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