rust/src/test/ui/nll/closure-requirements/escape-argument.stderr

40 lines
1.3 KiB
Plaintext
Raw Normal View History

note: External requirements
--> $DIR/escape-argument.rs:36:38
|
36 | let mut closure = expect_sig(|p, y| *p = y);
| ^^^^^^^^^^^^^
|
= note: defining type: DefId(0/1:9 ~ escape_argument[317d]::test[0]::{{closure}}[0]) with closure substs [
i16,
for<'r, 's> extern "rust-call" fn((&ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 'r)) mut &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 's)) i32, &ReLateBound(DebruijnIndex { depth: 1 }, BrNamed(crate0:DefIndex(0:0), 's)) i32))
]
= note: number of external vids: 1
note: No external requirements
--> $DIR/escape-argument.rs:30:1
|
30 | / fn test() {
31 | | let x = 44;
32 | | let mut p = &x;
33 | |
... |
41 | | deref(p);
42 | | }
| |_^
|
= note: defining type: DefId(0/0:3 ~ escape_argument[317d]::test[0]) with substs []
error[E0597]: `y` does not live long enough
--> $DIR/escape-argument.rs:37:25
|
37 | closure(&mut p, &y);
| ^^ does not live long enough
38 | //~^ ERROR `y` does not live long enough [E0597]
39 | }
| - borrowed value only lives until here
|
= note: borrowed value must be valid for lifetime '_#5r...
error: aborting due to previous error