Why are multiple mutable borrows possible in the same scope?
问题 I wrote this code that borrows a mutable variable more than once and compiles without any error, but according to The Rust Programming Language this should not compile: fn main() { let mut s = String::from("hello"); println!("{}", s); test_three(&mut s); println!("{}", s); test_three(&mut s); println!("{}", s); } fn test_three(st: &mut String) { st.push('f'); } (playground) Is this a bug or there is new feature in Rust? 回答1: Nothing weird happens here; the mutable borrow becomes void every