Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove all cast_ref_to_mut #850

Closed
wenyuzhao opened this issue Jun 7, 2023 · 2 comments
Closed

Remove all cast_ref_to_mut #850

wenyuzhao opened this issue Jun 7, 2023 · 2 comments
Labels
A-meta Area: Meta issues for the repository P-normal Priority: Normal.

Comments

@wenyuzhao
Copy link
Member

wenyuzhao commented Jun 7, 2023

Transmuting a const ptr to a mutable ptr has become a hard compile error since rustc 1.72 rust-lang/rust#111567

We need to consider refactoring and removing all the cast_ref_to_mut related code before upgrading to 1.72.

@Manishearth
Copy link

Manishearth commented Jun 8, 2023

Note: if the shared mutation is a part of the design, and you can prove that the shared mutation never overlaps with any reads, the way to avoid that UB is to store lxr etc as UnsafeCell<LXR<...>> and use the UnsafeCell methods to get mutable references. Rust does allow for the C model of shared mutation using cell types, however there is still UB possible with UnsafeCell.

I recommend trying to refactor it such that unsafe is not needed.

(or slap a RefCell on everything you want to mutate here and pay the runtime cost)

@playXE
Copy link
Contributor

playXE commented Aug 8, 2023

This PR fixes UB using NonNull<> and UnsafeCell where appropriate everywhere: #893

@qinsoon qinsoon moved this to 🔖 Ready in v0.20 (20230929) Aug 14, 2023
@qinsoon qinsoon moved this to 🔖 Ready in v0.21 (20231103) Oct 16, 2023
@k-sareen k-sareen added A-meta Area: Meta issues for the repository P-normal Priority: Normal. labels Nov 6, 2023
@k-sareen k-sareen closed this as completed Nov 6, 2023
@github-project-automation github-project-automation bot moved this from 🔖 Ready to ✅ Done in v0.21 (20231103) Nov 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-meta Area: Meta issues for the repository P-normal Priority: Normal.
Projects
No open projects
Status: 🔖 Ready
Status: ✅ Done
Development

No branches or pull requests

4 participants