Skip to content

Distinguish between error vs. warning for external macros #57716

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

Closed
jordy25519 opened this issue Jan 17, 2019 · 1 comment · Fixed by #59574
Closed

Distinguish between error vs. warning for external macros #57716

jordy25519 opened this issue Jan 17, 2019 · 1 comment · Fixed by #59574
Assignees
Labels
A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@jordy25519
Copy link

I often see compiler notes for warnings accompanied with this message:

   = note: this error originates in a macro outside this <...>

would it be more sensible and correct to say this _warning_ originates...?

Very superficial but I find seeing "error" in compilation logs catches my eye far too often and
its only a warning. Happy to submit PR if it is a valid change.

@Centril Centril added the A-diagnostics Area: Messages for errors, warnings, and lints label Jan 17, 2019
@Centril Centril added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jan 17, 2019
@estebank
Copy link
Contributor

This can be easily added at

fn fix_multispans_in_std_macros(&mut self,
span: &mut MultiSpan,
children: &mut Vec<SubDiagnostic>,
backtrace: bool) {
let mut spans_updated = self.fix_multispan_in_std_macros(span, backtrace);
for child in children.iter_mut() {
spans_updated |= self.fix_multispan_in_std_macros(&mut child.span, backtrace);
}
if spans_updated {
children.push(SubDiagnostic {
level: Level::Note,
message: vec![
("this error originates in a macro outside of the current crate \
(in Nightly builds, run with -Z external-macro-backtrace \
for more info)".to_string(),
Style::NoStyle),
],
span: MultiSpan::new(),
render_span: None,
});
}
}

by looking at the Diagnostic::code or, if not available, theDiagnostic::level and changing the text accordingly.

Centril added a commit to Centril/rust that referenced this issue Mar 31, 2019
…ing, r=Centril

Distinguish message for external macros depending on error level

fixes rust-lang#57716

(I picked you because assigned to this issue.)
r? @estebank
Centril added a commit to Centril/rust that referenced this issue Mar 31, 2019
…ing, r=Centril

Distinguish message for external macros depending on error level

fixes rust-lang#57716

(I picked you because assigned to this issue.)
r? @estebank
Centril added a commit to Centril/rust that referenced this issue Mar 31, 2019
…ing, r=Centril

Distinguish message for external macros depending on error level

fixes rust-lang#57716

(I picked you because assigned to this issue.)
r? @estebank
Centril added a commit to Centril/rust that referenced this issue Mar 31, 2019
…ing, r=Centril

Distinguish message for external macros depending on error level

fixes rust-lang#57716

(I picked you because assigned to this issue.)
r? @estebank
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 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.

3 participants