Rename *note_without_error
as *note
.
Because the variant name in `Level` is `Note`, and the `without_error` suffix is omitted in similar cases like `struct_allow` and `struct_help`.
This commit is contained in:
parent
c3628bb970
commit
57d6f840b9
10 changed files with 25 additions and 45 deletions
|
@ -1477,7 +1477,7 @@ fn print_native_static_libs(
|
||||||
sess.emit_note(errors::StaticLibraryNativeArtifacts);
|
sess.emit_note(errors::StaticLibraryNativeArtifacts);
|
||||||
// Prefix for greppability
|
// Prefix for greppability
|
||||||
// Note: This must not be translated as tools are allowed to depend on this exact string.
|
// Note: This must not be translated as tools are allowed to depend on this exact string.
|
||||||
sess.note_without_error(format!("native-static-libs: {}", &lib_args.join(" ")));
|
sess.note(format!("native-static-libs: {}", &lib_args.join(" ")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1870,7 +1870,7 @@ impl SharedEmitterMain {
|
||||||
let mut err = match level {
|
let mut err = match level {
|
||||||
Level::Error { lint: false } => sess.struct_err(msg).forget_guarantee(),
|
Level::Error { lint: false } => sess.struct_err(msg).forget_guarantee(),
|
||||||
Level::Warning(_) => sess.struct_warn(msg),
|
Level::Warning(_) => sess.struct_warn(msg),
|
||||||
Level::Note => sess.struct_note_without_error(msg),
|
Level::Note => sess.struct_note(msg),
|
||||||
_ => bug!("Invalid inline asm diagnostic level"),
|
_ => bug!("Invalid inline asm diagnostic level"),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -927,10 +927,7 @@ impl Handler {
|
||||||
/// Construct a builder at the `Note` level with the `msg`.
|
/// Construct a builder at the `Note` level with the `msg`.
|
||||||
#[rustc_lint_diagnostics]
|
#[rustc_lint_diagnostics]
|
||||||
#[track_caller]
|
#[track_caller]
|
||||||
pub fn struct_note_without_error(
|
pub fn struct_note(&self, msg: impl Into<DiagnosticMessage>) -> DiagnosticBuilder<'_, ()> {
|
||||||
&self,
|
|
||||||
msg: impl Into<DiagnosticMessage>,
|
|
||||||
) -> DiagnosticBuilder<'_, ()> {
|
|
||||||
DiagnosticBuilder::new(self, Level::Note, msg)
|
DiagnosticBuilder::new(self, Level::Note, msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1022,11 +1019,7 @@ impl Handler {
|
||||||
|
|
||||||
#[track_caller]
|
#[track_caller]
|
||||||
#[rustc_lint_diagnostics]
|
#[rustc_lint_diagnostics]
|
||||||
pub fn span_note_without_error(
|
pub fn span_note(&self, span: impl Into<MultiSpan>, msg: impl Into<DiagnosticMessage>) {
|
||||||
&self,
|
|
||||||
span: impl Into<MultiSpan>,
|
|
||||||
msg: impl Into<DiagnosticMessage>,
|
|
||||||
) {
|
|
||||||
self.emit_diag_at_span(Diagnostic::new(Note, msg), span);
|
self.emit_diag_at_span(Diagnostic::new(Note, msg), span);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1059,7 +1052,7 @@ impl Handler {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[rustc_lint_diagnostics]
|
#[rustc_lint_diagnostics]
|
||||||
pub fn note_without_error(&self, msg: impl Into<DiagnosticMessage>) {
|
pub fn note(&self, msg: impl Into<DiagnosticMessage>) {
|
||||||
DiagnosticBuilder::new(self, Note, msg).emit();
|
DiagnosticBuilder::new(self, Note, msg).emit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -648,10 +648,8 @@ fn is_empty_token_tree(sess: &ParseSess, seq: &mbe::SequenceRepetition) -> bool
|
||||||
iter.next();
|
iter.next();
|
||||||
}
|
}
|
||||||
let span = t.span.to(now.span);
|
let span = t.span.to(now.span);
|
||||||
sess.span_diagnostic.span_note_without_error(
|
sess.span_diagnostic
|
||||||
span,
|
.span_note(span, "doc comments are ignored in matcher position");
|
||||||
"doc comments are ignored in matcher position",
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
mbe::TokenTree::Sequence(_, sub_seq)
|
mbe::TokenTree::Sequence(_, sub_seq)
|
||||||
if (sub_seq.kleene.op == mbe::KleeneOp::ZeroOrMore
|
if (sub_seq.kleene.op == mbe::KleeneOp::ZeroOrMore
|
||||||
|
|
|
@ -357,7 +357,7 @@ fn parse_sep_and_kleene_op<'a>(
|
||||||
fn span_dollar_dollar_or_metavar_in_the_lhs_err(sess: &ParseSess, token: &Token) {
|
fn span_dollar_dollar_or_metavar_in_the_lhs_err(sess: &ParseSess, token: &Token) {
|
||||||
sess.span_diagnostic
|
sess.span_diagnostic
|
||||||
.span_err(token.span, format!("unexpected token: {}", pprust::token_to_string(token)));
|
.span_err(token.span, format!("unexpected token: {}", pprust::token_to_string(token)));
|
||||||
sess.span_diagnostic.span_note_without_error(
|
sess.span_diagnostic.span_note(
|
||||||
token.span,
|
token.span,
|
||||||
"`$$` and meta-variable expressions are not allowed inside macro parameter definitions",
|
"`$$` and meta-variable expressions are not allowed inside macro parameter definitions",
|
||||||
);
|
);
|
||||||
|
|
|
@ -420,20 +420,16 @@ fn fatally_break_rust(tcx: TyCtxt<'_>) {
|
||||||
MultiSpan::new(),
|
MultiSpan::new(),
|
||||||
"It looks like you're trying to break rust; would you like some ICE?",
|
"It looks like you're trying to break rust; would you like some ICE?",
|
||||||
);
|
);
|
||||||
handler.note_without_error("the compiler expectedly panicked. this is a feature.");
|
handler.note("the compiler expectedly panicked. this is a feature.");
|
||||||
handler.note_without_error(
|
handler.note(
|
||||||
"we would appreciate a joke overview: \
|
"we would appreciate a joke overview: \
|
||||||
https://github.com/rust-lang/rust/issues/43162#issuecomment-320764675",
|
https://github.com/rust-lang/rust/issues/43162#issuecomment-320764675",
|
||||||
);
|
);
|
||||||
handler.note_without_error(format!(
|
handler.note(format!("rustc {} running on {}", tcx.sess.cfg_version, config::host_triple(),));
|
||||||
"rustc {} running on {}",
|
|
||||||
tcx.sess.cfg_version,
|
|
||||||
config::host_triple(),
|
|
||||||
));
|
|
||||||
if let Some((flags, excluded_cargo_defaults)) = rustc_session::utils::extra_compiler_flags() {
|
if let Some((flags, excluded_cargo_defaults)) = rustc_session::utils::extra_compiler_flags() {
|
||||||
handler.note_without_error(format!("compiler flags: {}", flags.join(" ")));
|
handler.note(format!("compiler flags: {}", flags.join(" ")));
|
||||||
if excluded_cargo_defaults {
|
if excluded_cargo_defaults {
|
||||||
handler.note_without_error("some of the compiler flags provided by cargo are hidden");
|
handler.note("some of the compiler flags provided by cargo are hidden");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -653,30 +653,23 @@ impl Session {
|
||||||
#[rustc_lint_diagnostics]
|
#[rustc_lint_diagnostics]
|
||||||
#[allow(rustc::untranslatable_diagnostic)]
|
#[allow(rustc::untranslatable_diagnostic)]
|
||||||
#[allow(rustc::diagnostic_outside_of_impl)]
|
#[allow(rustc::diagnostic_outside_of_impl)]
|
||||||
pub fn note_without_error(&self, msg: impl Into<DiagnosticMessage>) {
|
pub fn note(&self, msg: impl Into<DiagnosticMessage>) {
|
||||||
self.diagnostic().note_without_error(msg)
|
self.diagnostic().note(msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[track_caller]
|
#[track_caller]
|
||||||
#[rustc_lint_diagnostics]
|
#[rustc_lint_diagnostics]
|
||||||
#[allow(rustc::untranslatable_diagnostic)]
|
#[allow(rustc::untranslatable_diagnostic)]
|
||||||
#[allow(rustc::diagnostic_outside_of_impl)]
|
#[allow(rustc::diagnostic_outside_of_impl)]
|
||||||
pub fn span_note_without_error<S: Into<MultiSpan>>(
|
pub fn span_note<S: Into<MultiSpan>>(&self, sp: S, msg: impl Into<DiagnosticMessage>) {
|
||||||
&self,
|
self.diagnostic().span_note(sp, msg)
|
||||||
sp: S,
|
|
||||||
msg: impl Into<DiagnosticMessage>,
|
|
||||||
) {
|
|
||||||
self.diagnostic().span_note_without_error(sp, msg)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[rustc_lint_diagnostics]
|
#[rustc_lint_diagnostics]
|
||||||
#[allow(rustc::untranslatable_diagnostic)]
|
#[allow(rustc::untranslatable_diagnostic)]
|
||||||
#[allow(rustc::diagnostic_outside_of_impl)]
|
#[allow(rustc::diagnostic_outside_of_impl)]
|
||||||
pub fn struct_note_without_error(
|
pub fn struct_note(&self, msg: impl Into<DiagnosticMessage>) -> DiagnosticBuilder<'_, ()> {
|
||||||
&self,
|
self.diagnostic().struct_note(msg)
|
||||||
msg: impl Into<DiagnosticMessage>,
|
|
||||||
) -> DiagnosticBuilder<'_, ()> {
|
|
||||||
self.diagnostic().struct_note_without_error(msg)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -1743,7 +1736,7 @@ impl EarlyErrorHandler {
|
||||||
#[allow(rustc::untranslatable_diagnostic)]
|
#[allow(rustc::untranslatable_diagnostic)]
|
||||||
#[allow(rustc::diagnostic_outside_of_impl)]
|
#[allow(rustc::diagnostic_outside_of_impl)]
|
||||||
pub fn early_note(&self, msg: impl Into<DiagnosticMessage>) {
|
pub fn early_note(&self, msg: impl Into<DiagnosticMessage>) {
|
||||||
self.handler.struct_note_without_error(msg).emit()
|
self.handler.struct_note(msg).emit()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(rustc::untranslatable_diagnostic)]
|
#[allow(rustc::untranslatable_diagnostic)]
|
||||||
|
|
|
@ -183,7 +183,7 @@ pub fn main() {
|
||||||
// as simple as moving the call from the hook to main, because `install_ice_hook` doesn't
|
// as simple as moving the call from the hook to main, because `install_ice_hook` doesn't
|
||||||
// accept a generic closure.
|
// accept a generic closure.
|
||||||
let version_info = rustc_tools_util::get_version_info!();
|
let version_info = rustc_tools_util::get_version_info!();
|
||||||
handler.note_without_error(format!("Clippy version: {version_info}"));
|
handler.note(format!("Clippy version: {version_info}"));
|
||||||
});
|
});
|
||||||
|
|
||||||
exit(rustc_driver::catch_with_exit_code(move || {
|
exit(rustc_driver::catch_with_exit_code(move || {
|
||||||
|
|
|
@ -384,7 +384,7 @@ pub fn report_error<'tcx, 'mir>(
|
||||||
|
|
||||||
// Include a note like `std` does when we omit frames from a backtrace
|
// Include a note like `std` does when we omit frames from a backtrace
|
||||||
if was_pruned {
|
if was_pruned {
|
||||||
ecx.tcx.sess.diagnostic().note_without_error(
|
ecx.tcx.sess.diagnostic().note(
|
||||||
"some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace",
|
"some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -431,7 +431,7 @@ pub fn report_leaks<'mir, 'tcx>(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if any_pruned {
|
if any_pruned {
|
||||||
ecx.tcx.sess.diagnostic().note_without_error(
|
ecx.tcx.sess.diagnostic().note(
|
||||||
"some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace",
|
"some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -464,7 +464,7 @@ pub fn eval_entry<'tcx>(
|
||||||
// Check for thread leaks.
|
// Check for thread leaks.
|
||||||
if !ecx.have_all_terminated() {
|
if !ecx.have_all_terminated() {
|
||||||
tcx.sess.err("the main thread terminated without waiting for all remaining threads");
|
tcx.sess.err("the main thread terminated without waiting for all remaining threads");
|
||||||
tcx.sess.note_without_error("pass `-Zmiri-ignore-leaks` to disable this check");
|
tcx.sess.note("pass `-Zmiri-ignore-leaks` to disable this check");
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
// Check for memory leaks.
|
// Check for memory leaks.
|
||||||
|
@ -475,7 +475,7 @@ pub fn eval_entry<'tcx>(
|
||||||
let leak_message = "the evaluated program leaked memory, pass `-Zmiri-ignore-leaks` to disable this check";
|
let leak_message = "the evaluated program leaked memory, pass `-Zmiri-ignore-leaks` to disable this check";
|
||||||
if ecx.machine.collect_leak_backtraces {
|
if ecx.machine.collect_leak_backtraces {
|
||||||
// If we are collecting leak backtraces, each leak is a distinct error diagnostic.
|
// If we are collecting leak backtraces, each leak is a distinct error diagnostic.
|
||||||
tcx.sess.note_without_error(leak_message);
|
tcx.sess.note(leak_message);
|
||||||
} else {
|
} else {
|
||||||
// If we do not have backtraces, we just report an error without any span.
|
// If we do not have backtraces, we just report an error without any span.
|
||||||
tcx.sess.err(leak_message);
|
tcx.sess.err(leak_message);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue