Skip to content
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 blocks do not fire unsafe_code lint #126738

Closed
ehuss opened this issue Jun 20, 2024 · 0 comments · Fixed by #127535
Closed

unsafe blocks do not fire unsafe_code lint #126738

ehuss opened this issue Jun 20, 2024 · 0 comments · Fixed by #127535
Assignees
Labels
C-bug Category: This is a bug. F-unsafe_extern_blocks `#![feature(unsafe_extern_blocks)]` T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@ehuss
Copy link
Contributor

ehuss commented Jun 20, 2024

RFC 3484 indicated that an unsafe block should fire the unsafe_code lint. However, it does not appear to do that, yet.

#![feature(unsafe_extern_blocks)]
#![warn(unsafe_code)]

unsafe extern "C" {
    pub fn foo();
}

Expected results: Should fire the unsafe_code lint.

Actual results: Lint is not fired.

Meta

rustc 1.81.0-nightly (59e2c01c2 2024-06-17)
binary: rustc
commit-hash: 59e2c01c2217a01546222e4d9ff4e6695ee8a1db
commit-date: 2024-06-17
host: aarch64-apple-darwin
release: 1.81.0-nightly
LLVM version: 18.1.7

cc @spastorino FYI, I didn't see a discussion of further work needing to be done in #124482, so I wanted to make sure it gets tracked.

Tracking:

@ehuss ehuss added the F-unsafe_extern_blocks `#![feature(unsafe_extern_blocks)]` label Jun 20, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jun 20, 2024
@traviscross traviscross added C-bug Category: This is a bug. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jun 21, 2024
@workingjubilee workingjubilee added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jun 22, 2024
@spastorino spastorino self-assigned this Jun 25, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jul 12, 2024
…rn_blocks, r=oli-obk

Fire unsafe_code lint on unsafe extern blocks

Fixes rust-lang#126738
@bors bors closed this as completed in 2e0591b Jul 13, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Jul 13, 2024
Rollup merge of rust-lang#127535 - spastorino:unsafe_code-unsafe_extern_blocks, r=oli-obk

Fire unsafe_code lint on unsafe extern blocks

Fixes rust-lang#126738
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. F-unsafe_extern_blocks `#![feature(unsafe_extern_blocks)]` T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants