]> git.proxmox.com Git - rustc.git/blame - src/test/ui/variance/variance-cell-is-invariant.rs
New upstream version 1.63.0+dfsg1
[rustc.git] / src / test / ui / variance / variance-cell-is-invariant.rs
CommitLineData
1a4d82fc
JJ
1// Test that Cell is considered invariant with respect to its
2// type.
223e47cc 3
1a4d82fc 4use std::cell::Cell;
223e47cc 5
1a4d82fc
JJ
6struct Foo<'a> {
7 x: Cell<Option<&'a isize>>,
223e47cc
LB
8}
9
1a4d82fc
JJ
10fn use_<'short,'long>(c: Foo<'short>,
11 s: &'short isize,
12 l: &'long isize,
13 _where:Option<&'short &'long ()>) {
04454e1e 14 let _: Foo<'long> = c;
923072b8 15 //~^ ERROR lifetime may not live long enough
223e47cc
LB
16}
17
18fn main() {
19}