]> git.lizzy.rs Git - rust.git/blob - tests/ui/regions/regions-assoc-type-region-bound.rs
internally change regions to be covariant
[rust.git] / tests / ui / regions / regions-assoc-type-region-bound.rs
1 // run-pass
2 #![allow(dead_code)]
3 // Test that the compiler considers the 'a bound declared in the
4 // trait. Issue #20890.
5
6 // pretty-expanded FIXME #23616
7
8 trait Foo<'a> {
9     type Value: 'a;
10
11     fn get(&self) -> &'a Self::Value;
12 }
13
14 fn takes_foo<'a,F: Foo<'a>>(f: &'a F) {
15     // This call would be illegal, because it results in &'a F::Value,
16     // and the only way we know that `F::Value : 'a` is because of the
17     // trait declaration.
18
19     f.get();
20 }
21
22 fn main() { }