-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Do not allow safe/unsafe on static and fn items #126758
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
Do not allow safe/unsafe on static and fn items #126758
Conversation
This comment has been minimized.
This comment has been minimized.
8711347 to
8cef2ba
Compare
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 doesn't gate safe on cfg'd out code, so this still passes:
#[cfg(FALSE)]
safe fn foo() {}
I'm not sure if that was intentional, since I thought you intended to put this up as an alternative to #126757. If that's not the case, then you can ignore this.
This also doesn't consider other positions where safety may show up, like:
- Impl items and trait items
- Function pointers
|
edited my review comment a bit since i'm not sure what the relationship between #126757 and this PR is supposed to be. |
8cef2ba to
edf32cf
Compare
df6aa7a to
e70d112
Compare
e70d112 to
3d6d9e2
Compare
|
@rustbot ready |
|
@bors r+ rollup |
3d6d9e2 to
22831ed
Compare
|
@bors r=compiler-errors |
|
@compiler-errors @spastorino is this going to cause issues with https://github.com/rust-lang/rustfmt/pull/6204/files#r1648395270? Specifically I'm wondering about the test case that uses |
|
No -- this is validation that only happens when you try to compile the code. |
|
Awesome. Thanks for the quick response. Just wanted to make sure that this wouldn't cause issues for the upcoming sync |
|
💔 Test failed - checks-actions |
|
A job failed! Check out the build log: (web) (plain) Click to see the possible cause of the failure (guessed by this bot) |
|
@bors retry |
|
☀️ Test successful - checks-actions |
|
Finished benchmarking commit (fcae626): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results (primary -4.3%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 697.477s -> 693.147s (-0.62%) |
Fixes #126749
r? @compiler-errors
Tracking: