2014-10-27 14:03:25 -04: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-17 01:51:41 +05:30
|
|
|
#![feature(rustc_attrs)]
|
|
|
|
|
2014-10-27 14:03:25 -04:00
|
|
|
use std::mem;
|
|
|
|
|
2015-02-12 10:29:52 -05:00
|
|
|
trait T { fn foo(&self); }
|
2014-10-27 14:03:25 -04:00
|
|
|
|
|
|
|
#[rustc_variance]
|
2023-01-27 02:23:08 +03:00
|
|
|
struct TOption<'a> { //~ ERROR [+]
|
2019-05-28 14:46:13 -04:00
|
|
|
v: Option<Box<dyn T + 'a>>,
|
2014-10-27 14:03:25 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() { }
|