-
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
Omit 'obsolete' note for a warning with -Awarning #23782
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @kmcallister (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way Github handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see CONTRIBUTING.md for more information. |
@@ -207,6 +207,14 @@ impl Handler { | |||
if lvl == Warning && !self.can_emit_warnings { return } | |||
self.emit.borrow_mut().emit(cmsp, msg, Some(code), lvl); | |||
} | |||
pub fn emit_for(&self, |
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.
Can we have some documentation explaining the arguments and when to use this?
r? @alexcrichton (randomish assignment to fill the void) |
This function is currently only used in one location, and has a bit of a mouthful of a signature, so could it just manually check for |
The field is public, so that is a possibility aswell. |
Sounds good to me! |
I have pushed the alternative solution. |
When emmitting a note, previously it was not known if the note was for an error or a warning. If it was for a warning, then with `-Awarnings` it should not have been print. The `emit_for` function allows someone to specify which level should determine its visibility. An example: ```rust extern crate "std" as std2; fn main() {} ``` When compiling with `-Awarnings`, this would previously emit `note: use an identifier not in quotes instead` (and nothing else). With this patch, it will be completely silent as expected.
When emmitting a note, previously it was not known if the note was for an error or a warning. If it was for a warning, then with `-Awarnings` it should not have been print. The `emit_for` function allows someone to specify which level should determine its visibility. An example: ```rust extern crate \"std\" as std2; fn main() {} ``` When compiling with `-Awarnings`, this would previously emit `note: use an identifier not in quotes instead` (and nothing else). With this patch, it will be completely silent as expected.
When emmitting a note, previously it was not known if the note was for an error or a warning. If it was for a warning, then with `-Awarnings` it should not have been print. The `emit_for` function allows someone to specify which level should determine its visibility. An example: ```rust extern crate \"std\" as std2; fn main() {} ``` When compiling with `-Awarnings`, this would previously emit `note: use an identifier not in quotes instead` (and nothing else). With this patch, it will be completely silent as expected.
This was merged in #24512 , sorry, I rebased and forgot that'd screw it up :( |
When emmitting a note, previously it was not known if the note was for an error or a
warning. If it was for a warning, then with
-Awarnings
it should not have been print.The
emit_for
function allows someone to specify which level should determine its visibility.An example:
When compiling with
-Awarnings
, this would previously emitnote: use an identifier not in quotes instead
(and nothing else).With this patch, it will be completely silent as expected.