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
Hi everybody,
While playing with Rust move/borrow, I ran across a strange behavior, that comes from the following code:
structPoint<'a>{x123:&'amuti32,y541:&'amuti32}fnmain(){let p123 = Point{x123:&mut10,y541:&mut11};let x :&muti32 = p123.x123;let y = p123.y541;let z = p123;}
The thing that happens is that p123.x123 is borrowed by x, while p123.y541 is moved in y (according to the error messages). I think that this may happen from the type inference that finds that x and p123.x123 do not have the same type of pointer (different lifetimes ?) and hence does a reborrow, is it correct ? Is it an expected feature of the type checker ?
Thanks in advance.
The text was updated successfully, but these errors were encountered:
Hi everybody,
While playing with Rust move/borrow, I ran across a strange behavior, that comes from the following code:
The thing that happens is that p123.x123 is borrowed by x, while p123.y541 is moved in y (according to the error messages). I think that this may happen from the type inference that finds that x and p123.x123 do not have the same type of pointer (different lifetimes ?) and hence does a reborrow, is it correct ? Is it an expected feature of the type checker ?
Thanks in advance.
The text was updated successfully, but these errors were encountered: