-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
Fix a few diagnostics #152328
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
Merged
Merged
Fix a few diagnostics #152328
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2266,7 +2266,9 @@ pub(crate) enum AmbiguousMissingKwForItemSub { | |
| span: Span, | ||
| snippet: String, | ||
| }, | ||
| #[help("you likely meant to define an item, e.g., `{$vis} fn foo() {\"{}\"}`")] | ||
| #[help( | ||
| "if you meant to call a macro, remove the `pub` and add a trailing `!` after the identifier" | ||
| )] | ||
| HelpMacro, | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For this one I can't find a way to trigger this help message (though I didn't try very hard) |
||
| } | ||
|
|
||
|
|
||
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| //@ edition:2015 | ||
| //@ only-unix | ||
| //@ run-rustfix | ||
|
|
||
| #![deny(deprecated_safe_2024)] | ||
|
|
||
| use std::process::Command; | ||
| use std::os::unix::process::CommandExt; | ||
|
|
||
| #[allow(deprecated)] | ||
| fn main() { | ||
| let mut cmd = Command::new("sleep"); | ||
| // TODO: Audit that the closure is async-signal-safe. | ||
| unsafe { cmd.before_exec(|| Ok(())) }; | ||
| //~^ ERROR call to deprecated safe function | ||
| //~| WARN this is accepted in the current edition | ||
| drop(cmd); | ||
| } |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| //@ edition:2015 | ||
| //@ only-unix | ||
| //@ run-rustfix | ||
|
|
||
| #![deny(deprecated_safe_2024)] | ||
|
|
||
| use std::process::Command; | ||
| use std::os::unix::process::CommandExt; | ||
|
|
||
| #[allow(deprecated)] | ||
| fn main() { | ||
| let mut cmd = Command::new("sleep"); | ||
| cmd.before_exec(|| Ok(())); | ||
| //~^ ERROR call to deprecated safe function | ||
| //~| WARN this is accepted in the current edition | ||
| drop(cmd); | ||
| } |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| error: call to deprecated safe function `std::os::unix::process::CommandExt::before_exec` is unsafe and requires unsafe block | ||
| --> $DIR/unsafe-before_exec-suggestion.rs:13:5 | ||
| | | ||
| LL | cmd.before_exec(|| Ok(())); | ||
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function | ||
| | | ||
| = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! | ||
| = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/newly-unsafe-functions.html> | ||
| note: the lint level is defined here | ||
| --> $DIR/unsafe-before_exec-suggestion.rs:5:9 | ||
| | | ||
| LL | #![deny(deprecated_safe_2024)] | ||
| | ^^^^^^^^^^^^^^^^^^^^ | ||
| help: you can wrap the call in an `unsafe` block if you can guarantee that the closure is async-signal-safe | ||
| | | ||
| LL + // TODO: Audit that the closure is async-signal-safe. | ||
| LL ~ unsafe { cmd.before_exec(|| Ok(())) }; | ||
| | | ||
|
|
||
| error: aborting due to 1 previous error | ||
|
|
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
hmm, is this correct?
guaranteeis in the parent diagnostic. If it is, it seems quite error-prone e.g. with respect to refactoring (or complicates checking the syntax at compile time I guess).Uh oh!
There was an error while loading. Please reload this page.
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 is correct, subdiagnostics can use variables from their parent diagnostic, and this message (and quite a few others) do!
This was already the case, I also don't like it, and want to fix it
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 is also why subdiagnostics are currently exempted from the compile-time "do variables exist" check, again, was also already the case before my refactoring
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.
great to hear, it'll help reduce this
magicflexibility for the better, surely.