2015-02-12 04:16:02 -06:00
|
|
|
#![allow(dead_code)]
|
2015-02-18 16:31:42 -06:00
|
|
|
#![feature(rustc_attrs)]
|
2015-02-12 04:16:02 -06:00
|
|
|
|
|
|
|
// Check that bounds on type parameters (other than `Self`) do not
|
|
|
|
// influence variance.
|
|
|
|
|
2017-06-02 14:05:41 -05:00
|
|
|
trait Getter<T> {
|
2015-02-12 04:16:02 -06:00
|
|
|
fn get(&self) -> T;
|
|
|
|
}
|
|
|
|
|
2017-06-02 14:05:41 -05:00
|
|
|
trait Setter<T> {
|
2017-06-24 21:29:10 -05:00
|
|
|
fn get(&self, _: T);
|
2015-02-12 04:16:02 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
#[rustc_variance]
|
2016-08-26 17:13:48 -05:00
|
|
|
struct TestStruct<U,T:Setter<U>> { //~ ERROR [+, +]
|
2015-02-12 04:16:02 -06:00
|
|
|
t: T, u: U
|
|
|
|
}
|
|
|
|
|
|
|
|
#[rustc_variance]
|
2017-04-25 04:45:59 -05:00
|
|
|
enum TestEnum<U,T:Setter<U>> { //~ ERROR [*, +]
|
2015-02-12 04:16:02 -06:00
|
|
|
Foo(T)
|
|
|
|
}
|
|
|
|
|
|
|
|
#[rustc_variance]
|
2016-08-26 17:13:48 -05:00
|
|
|
struct TestContraStruct<U,T:Setter<U>> { //~ ERROR [*, +]
|
2015-02-12 04:16:02 -06:00
|
|
|
t: T
|
|
|
|
}
|
|
|
|
|
|
|
|
#[rustc_variance]
|
2016-08-26 17:13:48 -05:00
|
|
|
struct TestBox<U,T:Getter<U>+Setter<U>> { //~ ERROR [*, +]
|
2015-02-12 04:16:02 -06:00
|
|
|
t: T
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn main() { }
|