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
#![feature(collections)]structFoo{name:String,}fnmain(){letmut x = Foo{name:"Foo".to_string()};drop(x);
x.name = "Bar".to_string();}
even though we're setting a field on a non-copy struct after it has been dropped. If you try to print out x.name, the compiler correctly errors and says that x has been moved, but it doesn't stop you from setting the field.
Tested on rustc 1.0.0-nightly (1d00c545e 2015-01-30 19:56:34 +0000).
The text was updated successfully, but these errors were encountered:
Noticed in this reddit thread: http://www.reddit.com/r/rust/comments/2ufy4w/how_does_a_shared_ownership_of_a_mutable_source/
The following compiles without issue:
even though we're setting a field on a non-copy struct after it has been dropped. If you try to print out
x.name
, the compiler correctly errors and says thatx
has been moved, but it doesn't stop you from setting the field.Tested on
rustc 1.0.0-nightly (1d00c545e 2015-01-30 19:56:34 +0000)
.The text was updated successfully, but these errors were encountered: