3 #![allow(unused_variables)]
4 // Test that a type which is contravariant with respect to its region
5 // parameter compiles successfully when used in a contravariant way.
7 // Note: see ui/variance/variance-regions-*.rs for the tests that check that the
8 // variance inference works in the first place.
10 // pretty-expanded FIXME #23616
12 struct Contravariant<'a> {
16 fn use_<'a>(c: Contravariant<'a>) {
19 // 'b winds up being inferred to this call.
20 // Contravariant<'a> <: Contravariant<'call> is true
21 // if 'call <= 'a, which is true, so no error.
24 fn collapse<'b>(x: &'b isize, c: Contravariant<'b>) { }