Fix and enforce unsafe_op_in_unsafe_fn
in compiler
#127730
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In preparation for edition 2024, this PR previews the fallout of enabling the
unsafe_op_in_unsafe_fn
lint in the compiler, since it's defaulting to warn in the new edition (#112038).The major annoyance comes primarily from the
rustc_codegen_llvm
module, where there's a ton of unsafe calls. I tended to wrap individual calls to unsafe fns inunsafe {}
, but there a handful of places I chose to just wrap several calls in anunsafe {}
block just because it would've been excessive to wrap each call individually.This doesn't enable the lint for the standard library, since I'm not totally certain what T-libs prefers w/ this lint.