-
Notifications
You must be signed in to change notification settings - Fork 14k
mem::transmute warns if transmuting to a type with interior mutability #133653
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
Conversation
|
r? @davidtwco rustbot has assigned @davidtwco. Use |
This comment has been minimized.
This comment has been minimized.
f771457 to
053455f
Compare
|
The job Click to see the possible cause of the failure (guessed by this bot) |
|
Duplicate of #128351 which has |
|
Since #128351 got closed could we look into reopening this? This is a strict subset of the linting of the other PR but way simpler since it uses the |
|
Apparently there's a rebased version (#143343). I'm not sure what's the intended approach for this particular lint. I left a comment on that PR referencing this PR, but I'll delegate to that PR's reviewer re. the approach, since I don't have the bandwidth to look into this lint at the moment. |
closes #111229
Now
mem::transmutewarns when transmuting from&T->&UnsafeCell<T>(or things that contain it).In reality it warns when transmuting
&impl Freeze->&impl !Freezeso it might also warn against things like extern types and so on.transmute_to_interior_mutability(please check this as I'm not sure if I've done it properly)mutable_transmuteslint worksmutable_transmutesso that we can reuse most of the work.tests/ui/consts/const-eval/issue-55541.rsI've silenced the error... Should we do something about interior mutability and extern types?mem::transmutePlease review the lint text carefully as I don't know how factual that is.
Also, should we do this with raw pointers too? and if so, which cases are worth covering?