1 // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // ignore-compare-mode-nll
13 // Illustrates the "projection gap": in this test, even though we know
14 // that `T::Foo: 'x`, that does not tell us that `T: 'x`, because
15 // there might be other ways for the caller of `func` to show that
16 // `T::Foo: 'x` holds (e.g., where-clause).
22 // calling this fn should trigger a check that the type argument
23 // supplied is well-formed.
26 fn func<'x, T:Trait1<'x>>(t: &'x T::Foo)
29 //~^ ERROR the parameter type `T` may not live long enough
32 fn caller2<'x, T:Trait1<'x>>(t: &'x T)
34 wf::<&'x T::Foo>(); // OK
37 fn caller3<'x, T:Trait1<'x>>(t: &'x T::Foo)
39 wf::<&'x T::Foo>(); // OK