rust/tests/ui/variance/variance-trait-object-bound.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

19 lines
374 B
Rust
Raw Normal View History

// 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)]
use std::mem;
trait T { fn foo(&self); }
#[rustc_variance]
struct TOption<'a> { //~ ERROR [+]
2019-05-28 13:46:13 -05:00
v: Option<Box<dyn T + 'a>>,
}
fn main() { }