// Test that we correctly infer variance for type parameters in // various types and traits. #![feature(rustc_attrs)] #[rustc_variance] struct TestImm { //~ ERROR [A: +, B: +] x: A, y: B, } #[rustc_variance] struct TestMut { //~ ERROR [A: +, B: o] x: A, y: &'static mut B, } #[rustc_variance] struct TestIndirect { //~ ERROR [A: +, B: o] m: TestMut } #[rustc_variance] struct TestIndirect2 { //~ ERROR [A: o, B: o] n: TestMut, m: TestMut } trait Getter { fn get(&self) -> A; } trait Setter { fn set(&mut self, a: A); } #[rustc_variance] struct TestObject { //~ ERROR [A: o, R: o] n: Box+Send>, m: Box+Send>, } fn main() {}