This blog is for new Vector
let mut v: Vec<i32> = vec![2, 4, 6];
let first = &v[0];
v.push(8);
println!("{:?}", first);
Above code won’t compile because we can’t have mutable and immutable references in the same scope.

But if we println!
v
let mut v: Vec<i32> = vec![2, 4, 6];
let first = &v[0];
println!("{:?}", first);
v.push(8);



Here I got confused. Because according to the book, this should not compile. I asked the forum and community. I got the answer here.
Above scenario is possible because Non-lexical lifetimes
edition
Cargo.toml



In the above example, I don’t see any benefit NLL
let mut time_in_minutes = Some(5u32);
if let Some(i) = &time_in_minutes {
convert_in_seconds(i);
} else {
time_in_minutes = Some(5u32);
println!("Updated Time:{:?}", &time_in_minutes);
}
Above code will not compile in Rust 2015 but will work in 2018. This feature is not explained in Rust Programming book. I tried to explain this feature through this blog. For more details, please refer to below links:
Non-lexical lifetimes
What are non-lexical lifetimes?


