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
huonw opened this issue
Mar 20, 2014
· 3 comments
· Fixed by #13108
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.
In the following, the deriving does the wrong thing: it shallow copies the pointer when the semantics mean it should be making a new allocation and copying the data; there's no indication of this until runtime double-frees/segfaults.
/// Wrapper around an owned allocation#[deriving(Clone)]structStruct{owned:*mutint}implStruct{fnnew(x:int){Struct{owned:unsafe{cast::transmute(~x)}}}}implDropforStruct{fndrop(&mutself){let _: ~int = unsafe{cast::transmute(self.owned)};}}
Some possible resolutions:
do nothing: unsafe code is unsafe
have lints for deriving + unsafe pointers
have deriving completely disabled on unsafe pointers
remove the trait impls for raw pointers
The text was updated successfully, but these errors were encountered:
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.
In the following, the
deriving
does the wrong thing: it shallow copies the pointer when the semantics mean it should be making a new allocation and copying the data; there's no indication of this until runtime double-frees/segfaults.Some possible resolutions:
deriving
+ unsafe pointersderiving
completely disabled on unsafe pointersThe text was updated successfully, but these errors were encountered: