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

Give a specific lint for unsafety not being inherited #103964

Merged
merged 2 commits into from
Nov 4, 2022

Conversation

clubby789
Copy link
Contributor

@clubby789 clubby789 commented Nov 4, 2022

In cases like

static mut FOO: u64 = 0;
fn main() {
    unsafe {static BAR: u64 = FOO;}    
}

and

fn foo() {
  unsafe {
    fn bar() {
      unsafe_call();
    }
  }
}

Specifically inform the user that the unsafety is not inherited for the seperate enclosing items
Fixes #94077
r? compiler-errors
@rustbot label +A-diagnostics

@rustbot 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 Nov 4, 2022
@rustbot
Copy link
Collaborator

rustbot commented Nov 4, 2022

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@rustbot rustbot added the A-diagnostics Area: Messages for errors, warnings, and lints label Nov 4, 2022
@compiler-errors
Copy link
Member

This should be good to go after addressing that one nit and a few formatting inconsistencies!

@compiler-errors
Copy link
Member

I think this is fine to land as-is -- if anyone has any strong opinions about the wording being made more precise or descriptive, they're welcome to open a follow-up PR.

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Nov 4, 2022

📌 Commit 28819cb has been approved by compiler-errors

It is now in the queue for this repository.

@bors 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 Nov 4, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 4, 2022
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#103367 (Remove std's transitive dependency on cfg-if 0.1)
 - rust-lang#103397 (Port `dead_code` lints to be translatable.)
 - rust-lang#103681 (libtest: run all tests in their own thread, if supported by the host)
 - rust-lang#103792 (Migrate `codegen_ssa` to diagnostics structs - [Part 2])
 - rust-lang#103897 (asm: Work around LLVM bug on AArch64)
 - rust-lang#103937 (minor changes to make method lookup diagnostic code easier to read)
 - rust-lang#103958 (Test tidy should not count untracked paths towards entries limit)
 - rust-lang#103964 (Give a specific lint for unsafety not being inherited)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 347c478 into rust-lang:master Nov 4, 2022
@rustbot rustbot added this to the 1.67.0 milestone Nov 4, 2022
@clubby789 clubby789 deleted the lint-enclosing-unsafe branch February 11, 2023 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Confusing message when using unsafe to initialize statics
4 participants