1 // Test that a type which is covariant with respect to its region
2 // parameter yields an error when used in a contravariant way.
4 // Note: see variance-regions-*.rs for the tests that check that the
5 // variance inference works in the first place.
10 marker: marker::PhantomData<fn(&'a ())>
13 fn use_<'short,'long>(c: Covariant<'long>,
16 _where:Option<&'short &'long ()>) {
18 // Test whether Covariant<'long> <: Covariant<'short>. Since
19 // 'short <= 'long, this would be true if the Covariant type were
20 // contravariant with respect to its parameter 'a.
22 let _: Covariant<'short> = c;
23 //~^ ERROR lifetime may not live long enough