]> git.lizzy.rs Git - rust.git/blob - src/test/ui/variance/variance-associated-types.rs
Merge commit '40dd3e2b7089b5e96714e064b731f6dbf17c61a9' into sync_cg_clif-2021-05-27
[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() { }