]>
git.proxmox.com Git - rustc.git/blob - tests/ui/mir/field-projection-mutating-context2.rs
3 static GLOBAL
: Mutex
<&'
static str> = Mutex
::new("global str");
5 struct Foo
<T
>(T
); // `T` is covariant.
7 fn foo
<'a
>(mut x
: Foo
<fn(&'a
str)>, string
: &'a
str) {
8 let Foo(ref mut y
): Foo
<fn(&'
static str)> = x
;
9 //~^ ERROR lifetime may not live long enough
10 *y
= |s
| *GLOBAL
.lock().unwrap() = s
;
15 foo(Foo(|_
| ()), &String
::from("i am shortlived"));
16 println
!("{}", GLOBAL
.lock().unwrap());