-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
unused_unsafe gives wrong reason #48131
Comments
sfackler
added
the
A-lints
Area: Lints (warnings about flaws in source code) such as unused_mut.
label
Feb 10, 2018
fix looks trivial, I think I got this |
More specifically, I believe |
Manishearth
added a commit
to Manishearth/rust
that referenced
this issue
Feb 24, 2018
…ebank unused_unsafe: don't label irrelevant fns Fixes rust-lang#48131 Diagnostic bugfix to remove an errant note. Stops the search for an enclosing unsafe scope at the first safe fn encountered. ```rust pub unsafe fn outer() { fn inner() { unsafe { /* unnecessary */ } } inner() } ``` **Before:** ``` warning: unnecessary `unsafe` block --> src/main.rs:3:9 | 1 | pub unsafe fn outer() { | --------------------- because it's nested under this `unsafe` fn 2 | fn inner() { 3 | unsafe { /* unnecessary */ } | ^^^^^^ unnecessary `unsafe` block | = note: #[warn(unused_unsafe)] on by default ``` **After:** ``` warning: unnecessary `unsafe` block --> src/main.rs:3:9 | 3 | unsafe { /* unnecessary */ } | ^^^^^^ unnecessary `unsafe` block | = note: #[warn(unused_unsafe)] on by default ```
Manishearth
added a commit
to Manishearth/rust
that referenced
this issue
Feb 24, 2018
…ebank unused_unsafe: don't label irrelevant fns Fixes rust-lang#48131 Diagnostic bugfix to remove an errant note. Stops the search for an enclosing unsafe scope at the first safe fn encountered. ```rust pub unsafe fn outer() { fn inner() { unsafe { /* unnecessary */ } } inner() } ``` **Before:** ``` warning: unnecessary `unsafe` block --> src/main.rs:3:9 | 1 | pub unsafe fn outer() { | --------------------- because it's nested under this `unsafe` fn 2 | fn inner() { 3 | unsafe { /* unnecessary */ } | ^^^^^^ unnecessary `unsafe` block | = note: #[warn(unused_unsafe)] on by default ``` **After:** ``` warning: unnecessary `unsafe` block --> src/main.rs:3:9 | 3 | unsafe { /* unnecessary */ } | ^^^^^^ unnecessary `unsafe` block | = note: #[warn(unused_unsafe)] on by default ```
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The
unsafe
block is clearly unnecessary, but it being inside a safe function which is nested in an unsafe function is clearly not the reason. PlaypenThe text was updated successfully, but these errors were encountered: