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
{{ message }}
Repository navigation
Copy constructors that modify the input param cannot be translated as Clone #613
We translate copy constructors using the Clone trait. Clone receives an immutable reference. C++ allows copy constructors to receive a mutable reference T(T&).
We cannot express T(T&) using the Clone trait. Our current solutions mistranslate this case. Unsafe translates as
implCloneforT{fnclone(&self){// the cast is UB if copy_from actually modifies selfT::copy_from(&selfas*constTas*mutT)}}
Refcount translates as:
implCloneforT{fnclone(&self) -> Self{let __src:Value<T> = Rc::new(RefCell::new(T{a:self.a.clone(), ...}));// Any modification on self is lost because __src is a temporaryT::copy_from(__src.as_pointer())}}
Activity