fn main()
{
let mut a: i32 = 57;
let b: &mut i32 = &mut a;
let c: &i32 = &b;
//fun( b, c); // error
//fun(&mut b, &c); //error too
println!("{} {}", b, c ); // works
}
fn fun( b: &mut i32, c: &i32) { }
It seems to me that println! macro takes the variable(b, c) differently than the function fun. What could be the reasonable explanations behind it in simple English?
The macro does indeed capture the variables in a different way. That's because the macro actually expands to something that contains &b and &c rather than just containing b and c.