You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#![feature(nll)]
fn main() {
let mut m = vec![[0; 1]; 1];
m[0][0] = 1;
}
With feature(nll) it gives:
error[E0597]: `m` does not live long enough
--> ...\test.rs:4:5
|
4 | m[0][0] = 1;
| ^ borrowed value does not live long enough
5 | }
| - borrowed value only lives until here
|
= note: borrowed value must be valid for lifetime '_#2r...
The text was updated successfully, but these errors were encountered:
#![feature(nll)]
fn main() {
let mut a = [0u8; 1];
a[0] = 0.to_string().as_bytes()[0];
}
Gives:
error[E0597]: borrowed value does not live long enough
--> ...\test.rs:4:12
|
4 | a[0] = 0.to_string().as_bytes()[0];
| ^^^^^^^^^^^^^ - temporary value only lives until here
| |
| temporary value does not live long enough
|
= note: borrowed value must be valid for lifetime '_#3r...
This code compiles without feature(nll):
With feature(nll) it gives:
The text was updated successfully, but these errors were encountered: