]> git.lizzy.rs Git - rust.git/blob - src/test/ui/variance/variance-object-types.rs
Rollup merge of #92959 - asquared31415:test-non-fn-help, r=estebank
[rust.git] / src / test / ui / variance / variance-object-types.rs
1 // Test that Cell is considered invariant with respect to its
2 // type.
3
4 #![feature(rustc_attrs)]
5
6 use std::cell::Cell;
7
8 // For better or worse, associated types are invariant, and hence we
9 // get an invariant result for `'a`.
10 #[rustc_variance]
11 struct Foo<'a> { //~ ERROR [o]
12     x: Box<dyn Fn(i32) -> &'a i32 + 'static>
13 }
14
15 fn main() {
16 }