Skip to content

Instantly share code, notes, and snippets.

@nikomatsakis
Last active April 23, 2018 15:41
Show Gist options
  • Save nikomatsakis/3cd6bf3f058cafa87675a5965428a8df to your computer and use it in GitHub Desktop.
Save nikomatsakis/3cd6bf3f058cafa87675a5965428a8df to your computer and use it in GitHub Desktop.
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-test
// compile-pass
#![feature(infer_outlives_requirements)]
trait Trait<'x, T> where T: 'x {
}
// should infer that `A: 'a`
struct Foo<'a, A> {
foo: Box<dyn Trait<'a, A>>
}
fn main() {}
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-test
// compile-pass
#![feature(infer_outlives_requirements)]
trait Trait<'x, T> where T: 'x {
type Type;
}
// should infer that `B: 'a`
struct Foo<'a, A, B> {
foo: <A as Trait<'a, B>>::Type
}
fn main() {}
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-test
// compile-pass
#![feature(infer_outlives_requirements)]
trait Trait<'x, T> where Self: 'x {
type Type;
}
// should infer that `A: 'a`
struct Foo<'a, A, B> {
foo: <A as Trait<'a, B>>::Type
}
fn main() {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment