Skip to content

Fix constructor call sequence - #690

Closed
lucic71 wants to merge 7 commits into
Cpp2Rust:masterfrom
lucic71:in-place-init
Closed

lucic71 wants to merge 7 commits into
Cpp2Rust:masterfrom
lucic71:in-place-init

Conversation

@lucic71

@lucic71 lucic71 commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Replace:

let v = Rc::new(RefCell::new({
  let __v = Rc::new(RefCell::new(<T>::zero_init());
  T::new(__v.as_pointer(), ctor_args);
  Rc::try_unwrap(__v).ok().unwrap().into_inner()
}

with:

let v = Rc::new(RefCell::new(<T>::zero_init());
T::new(v.as_pointer(), ctor_args);

for local variables.

@nunoplopes

Copy link
Copy Markdown
Contributor

I think we had a race condition on this one. My commit already fixed this.

@nunoplopes nunoplopes closed this Dec 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants