-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Unsafe extern blocks #124482
Merged
Merged
Unsafe extern blocks #124482
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
68b0b86
Add unsafe extern blocks failing tests
spastorino 6d670b7
Allow unsafe extern on all editions
spastorino 46cd80b
Test that unsafe extern defines unsafe fns
spastorino 3ba8de0
Make extern blocks without unsafe warn in edition 2024
spastorino bbddc9b
Allow using unsafe on functions inside extern blocks
spastorino 2a37712
Handle safety keyword for extern block inner items
spastorino b4cbdb7
Fail when using safe/unsafe items inside unadorned extern blocks
spastorino bac72cf
Add safe/unsafe to static inside extern blocks
spastorino 0380321
Add unsafe_extern_blocks feature flag
spastorino 1afc7d7
Make MISSING_UNSAFE_ON_EXTERN lint emit future compat info with sugge…
spastorino be0726c
Add revisions to safe/unsafe on unadorned extern blocks test
spastorino 525828d
Add rustfix test for unsafe extern blocks
spastorino File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is unfortunate but making
StaticItem
andStaticForeignItem
carry different types would require a major refactor mainly due to https://github.com/spastorino/rust/blob/f6f8e91adcaf446eb4b38fe960a97d0c1ab88417/compiler/rustc_parse/src/parser/item.rs#L1184 which is an ungreat way of code reusing.I can refactor this code to disentangle it after this PR lands and then remove this safety field and likely the expr one but I wouldn't block landing this PR on this pre-existing issue.