]> git.lizzy.rs Git - rust.git/blob - src/test/ui/variance/variance-associated-types.rs
Merge commit 'b71f3405606d49b9735606b479c3415a0ca9810f' into clippyup
[rust.git] / src / test / ui / variance / variance-associated-types.rs
1 // Test that the variance computation considers types/regions that
2 // appear in projections to be invariant.
3
4 #![feature(rustc_attrs)]
5
6 trait Trait<'a> {
7     type Type;
8
9     fn method(&'a self) { }
10 }
11
12 #[rustc_variance]
13 struct Foo<'a, T : Trait<'a>> { //~ ERROR [-, +]
14     field: (T, &'a ())
15 }
16
17 #[rustc_variance]
18 struct Bar<'a, T : Trait<'a>> { //~ ERROR [o, o]
19     field: <T as Trait<'a>>::Type
20 }
21
22 fn main() { }