the documentation available at rustup doc --book? I'm having a bit of trouble understanding what
// r1 and r2 are no longer used after this point
means in their example snippet (https://del.dog/cemuhuzuta) since I can still access the values
Before the Non-lexical lifetimes were introduced in rust, That code would not have compiled in the first place. Since, the scope of r1, r2 and r3 has the same scope and you are not allowed to have immutable reference if you also have a mutable reference. But after the Non-lexical lifetimes were introduced, The compiler got a bit smarter. It checks the code and finds out, r1,r2 and r3 have the same scope but r1 and r2 are not used after r3 has been created, So, The program is not violating the law. i.e. holding a mutable reference while it has a immutable reference. So, It allows the code to be compiled. If you try to access r1 or r2 after r3 has been created, The program will fail to compile and give you the exact reason for why that happened. Try adding println!("{}", r1); after r3 was created.
Обсуждают сегодня