2014-10-27 13:03:25 -05:00
|
|
|
// Checks that regions which appear in a trait object type are
|
|
|
|
// observed by the variance inference algorithm (and hence
|
|
|
|
// `TOption` is contavariant w/r/t `'a` and not bivariant).
|
|
|
|
//
|
|
|
|
// Issue #18262.
|
|
|
|
|
2015-02-16 14:21:41 -06:00
|
|
|
#![feature(rustc_attrs)]
|
|
|
|
|
2014-10-27 13:03:25 -05:00
|
|
|
use std::mem;
|
|
|
|
|
2015-02-12 09:29:52 -06:00
|
|
|
trait T { fn foo(&self); }
|
2014-10-27 13:03:25 -05:00
|
|
|
|
|
|
|
#[rustc_variance]
|
2023-01-26 17:23:08 -06:00
|
|
|
struct TOption<'a> { //~ ERROR [+]
|
2019-05-28 13:46:13 -05:00
|
|
|
v: Option<Box<dyn T + 'a>>,
|
2014-10-27 13:03:25 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() { }
|