-
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
Improve unsafe extern blocks diagnostics #127106
Merged
bors
merged 2 commits into
rust-lang:master
from
spastorino:improve-unsafe-extern-blocks-diagnostics
Jun 30, 2024
Merged
Improve unsafe extern blocks diagnostics #127106
bors
merged 2 commits into
rust-lang:master
from
spastorino:improve-unsafe-extern-blocks-diagnostics
Jun 30, 2024
Conversation
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
rustbot
added
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
labels
Jun 29, 2024
spastorino
force-pushed
the
improve-unsafe-extern-blocks-diagnostics
branch
from
June 29, 2024 17:40
b18f6c6
to
15d5dac
Compare
compiler-errors
approved these changes
Jun 29, 2024
@bors r+ rollup |
bors
added
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
and removed
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
labels
Jun 29, 2024
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Jun 29, 2024
…locks-diagnostics, r=compiler-errors Improve unsafe extern blocks diagnostics Closes rust-lang#126327 For this code: ```rust extern { pub fn foo(); pub safe fn bar(); } ``` We get ... ``` error: items in unadorned `extern` blocks cannot have safety qualifiers --> test.rs:3:5 | 3 | pub safe fn bar(); | ^^^^^^^^^^^^^^^^^^ | help: add unsafe to this `extern` block | 1 | unsafe extern { | ++++++ error[E0658]: `unsafe extern {}` blocks and `safe` keyword are experimental --> test.rs:3:9 | 3 | pub safe fn bar(); | ^^^^ | = note: see issue rust-lang#123743 <rust-lang#123743> for more information = help: add `#![feature(unsafe_extern_blocks)]` to the crate attributes to enable error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0658`. ``` And then making the extern block unsafe, we get ... ``` error: extern block cannot be declared unsafe --> test.rs:1:1 | 1 | unsafe extern { | ^^^^^^ | = note: see issue rust-lang#123743 <rust-lang#123743> for more information = help: add `#![feature(unsafe_extern_blocks)]` to the crate attributes to enable error: items in unadorned `extern` blocks cannot have safety qualifiers --> test.rs:3:5 | 3 | pub safe fn bar(); | ^^^^^^^^^^^^^^^^^^ error[E0658]: `unsafe extern {}` blocks and `safe` keyword are experimental --> test.rs:3:9 | 3 | pub safe fn bar(); | ^^^^ | = note: see issue rust-lang#123743 <rust-lang#123743> for more information = help: add `#![feature(unsafe_extern_blocks)]` to the crate attributes to enable error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0658`. ``` r? `@compiler-errors`
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jun 29, 2024
…iaskrgr Rollup of 9 pull requests Successful merges: - rust-lang#123237 (Various rustc_codegen_ssa cleanups) - rust-lang#126960 (Improve error message in tidy) - rust-lang#127002 (Implement `x perf` as a separate tool) - rust-lang#127050 (Make mtime of reproducible tarballs dependent on git commit) - rust-lang#127081 (Add a run-make test that LLD is not being used by default on the x64 beta/stable channel) - rust-lang#127106 (Improve unsafe extern blocks diagnostics) - rust-lang#127110 (Fix a error suggestion for E0121 when using placeholder _ as return types on function signature.) - rust-lang#127114 (fix: prefer `(*p).clone` to `p.clone` if the `p` is a raw pointer) - rust-lang#127118 (Show `used attribute`'s kind for user when find it isn't applied to a `static` variable.) r? `@ghost` `@rustbot` modify labels: rollup
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jun 29, 2024
…iaskrgr Rollup of 9 pull requests Successful merges: - rust-lang#123237 (Various rustc_codegen_ssa cleanups) - rust-lang#126960 (Improve error message in tidy) - rust-lang#127002 (Implement `x perf` as a separate tool) - rust-lang#127081 (Add a run-make test that LLD is not being used by default on the x64 beta/stable channel) - rust-lang#127106 (Improve unsafe extern blocks diagnostics) - rust-lang#127110 (Fix a error suggestion for E0121 when using placeholder _ as return types on function signature.) - rust-lang#127114 (fix: prefer `(*p).clone` to `p.clone` if the `p` is a raw pointer) - rust-lang#127118 (Show `used attribute`'s kind for user when find it isn't applied to a `static` variable.) - rust-lang#127122 (Remove uneccessary condition in `div_ceil`) r? `@ghost` `@rustbot` modify labels: rollup
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jun 30, 2024
…iaskrgr Rollup of 9 pull requests Successful merges: - rust-lang#123237 (Various rustc_codegen_ssa cleanups) - rust-lang#126960 (Improve error message in tidy) - rust-lang#127002 (Implement `x perf` as a separate tool) - rust-lang#127081 (Add a run-make test that LLD is not being used by default on the x64 beta/stable channel) - rust-lang#127106 (Improve unsafe extern blocks diagnostics) - rust-lang#127110 (Fix a error suggestion for E0121 when using placeholder _ as return types on function signature.) - rust-lang#127114 (fix: prefer `(*p).clone` to `p.clone` if the `p` is a raw pointer) - rust-lang#127118 (Show `used attribute`'s kind for user when find it isn't applied to a `static` variable.) - rust-lang#127122 (Remove uneccessary condition in `div_ceil`) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jun 30, 2024
Rollup merge of rust-lang#127106 - spastorino:improve-unsafe-extern-blocks-diagnostics, r=compiler-errors Improve unsafe extern blocks diagnostics Closes rust-lang#126327 For this code: ```rust extern { pub fn foo(); pub safe fn bar(); } ``` We get ... ``` error: items in unadorned `extern` blocks cannot have safety qualifiers --> test.rs:3:5 | 3 | pub safe fn bar(); | ^^^^^^^^^^^^^^^^^^ | help: add unsafe to this `extern` block | 1 | unsafe extern { | ++++++ error[E0658]: `unsafe extern {}` blocks and `safe` keyword are experimental --> test.rs:3:9 | 3 | pub safe fn bar(); | ^^^^ | = note: see issue rust-lang#123743 <rust-lang#123743> for more information = help: add `#![feature(unsafe_extern_blocks)]` to the crate attributes to enable error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0658`. ``` And then making the extern block unsafe, we get ... ``` error: extern block cannot be declared unsafe --> test.rs:1:1 | 1 | unsafe extern { | ^^^^^^ | = note: see issue rust-lang#123743 <rust-lang#123743> for more information = help: add `#![feature(unsafe_extern_blocks)]` to the crate attributes to enable error: items in unadorned `extern` blocks cannot have safety qualifiers --> test.rs:3:5 | 3 | pub safe fn bar(); | ^^^^^^^^^^^^^^^^^^ error[E0658]: `unsafe extern {}` blocks and `safe` keyword are experimental --> test.rs:3:9 | 3 | pub safe fn bar(); | ^^^^ | = note: see issue rust-lang#123743 <rust-lang#123743> for more information = help: add `#![feature(unsafe_extern_blocks)]` to the crate attributes to enable error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0658`. ``` r? ``@compiler-errors``
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
F-unsafe_extern_blocks
`#![feature(unsafe_extern_blocks)]`
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
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.
Closes #126327
For this code:
We get ...
And then making the extern block unsafe, we get ...
r? @compiler-errors