Skip to content

Commit b55ae42

Browse files
committed
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`.
1 parent e5bd5b5 commit b55ae42

File tree

10 files changed

+25
-45
lines changed

10 files changed

+25
-45
lines changed

compiler/rustc_codegen_ssa/src/back/link.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1477,7 +1477,7 @@ fn print_native_static_libs(
14771477
sess.emit_note(errors::StaticLibraryNativeArtifacts);
14781478
// Prefix for greppability
14791479
// Note: This must not be translated as tools are allowed to depend on this exact string.
1480-
sess.note_without_error(format!("native-static-libs: {}", &lib_args.join(" ")));
1480+
sess.note(format!("native-static-libs: {}", &lib_args.join(" ")));
14811481
}
14821482
}
14831483
}

compiler/rustc_codegen_ssa/src/back/write.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1870,7 +1870,7 @@ impl SharedEmitterMain {
18701870
let mut err = match level {
18711871
Level::Error { lint: false } => sess.struct_err(msg).forget_guarantee(),
18721872
Level::Warning(_) => sess.struct_warn(msg),
1873-
Level::Note => sess.struct_note_without_error(msg),
1873+
Level::Note => sess.struct_note(msg),
18741874
_ => bug!("Invalid inline asm diagnostic level"),
18751875
};
18761876

compiler/rustc_errors/src/lib.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -927,10 +927,7 @@ impl Handler {
927927
/// Construct a builder at the `Note` level with the `msg`.
928928
#[rustc_lint_diagnostics]
929929
#[track_caller]
930-
pub fn struct_note_without_error(
931-
&self,
932-
msg: impl Into<DiagnosticMessage>,
933-
) -> DiagnosticBuilder<'_, ()> {
930+
pub fn struct_note(&self, msg: impl Into<DiagnosticMessage>) -> DiagnosticBuilder<'_, ()> {
934931
DiagnosticBuilder::new(self, Level::Note, msg)
935932
}
936933

@@ -1022,11 +1019,7 @@ impl Handler {
10221019

10231020
#[track_caller]
10241021
#[rustc_lint_diagnostics]
1025-
pub fn span_note_without_error(
1026-
&self,
1027-
span: impl Into<MultiSpan>,
1028-
msg: impl Into<DiagnosticMessage>,
1029-
) {
1022+
pub fn span_note(&self, span: impl Into<MultiSpan>, msg: impl Into<DiagnosticMessage>) {
10301023
self.emit_diag_at_span(Diagnostic::new(Note, msg), span);
10311024
}
10321025

@@ -1059,7 +1052,7 @@ impl Handler {
10591052
}
10601053

10611054
#[rustc_lint_diagnostics]
1062-
pub fn note_without_error(&self, msg: impl Into<DiagnosticMessage>) {
1055+
pub fn note(&self, msg: impl Into<DiagnosticMessage>) {
10631056
DiagnosticBuilder::new(self, Note, msg).emit();
10641057
}
10651058

compiler/rustc_expand/src/mbe/macro_rules.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -648,10 +648,8 @@ fn is_empty_token_tree(sess: &ParseSess, seq: &mbe::SequenceRepetition) -> bool
648648
iter.next();
649649
}
650650
let span = t.span.to(now.span);
651-
sess.span_diagnostic.span_note_without_error(
652-
span,
653-
"doc comments are ignored in matcher position",
654-
);
651+
sess.span_diagnostic
652+
.span_note(span, "doc comments are ignored in matcher position");
655653
}
656654
mbe::TokenTree::Sequence(_, sub_seq)
657655
if (sub_seq.kleene.op == mbe::KleeneOp::ZeroOrMore

compiler/rustc_expand/src/mbe/quoted.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ fn parse_sep_and_kleene_op<'a>(
357357
fn span_dollar_dollar_or_metavar_in_the_lhs_err(sess: &ParseSess, token: &Token) {
358358
sess.span_diagnostic
359359
.span_err(token.span, format!("unexpected token: {}", pprust::token_to_string(token)));
360-
sess.span_diagnostic.span_note_without_error(
360+
sess.span_diagnostic.span_note(
361361
token.span,
362362
"`$$` and meta-variable expressions are not allowed inside macro parameter definitions",
363363
);

compiler/rustc_hir_typeck/src/lib.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -420,20 +420,16 @@ fn fatally_break_rust(tcx: TyCtxt<'_>) {
420420
MultiSpan::new(),
421421
"It looks like you're trying to break rust; would you like some ICE?",
422422
);
423-
handler.note_without_error("the compiler expectedly panicked. this is a feature.");
424-
handler.note_without_error(
423+
handler.note("the compiler expectedly panicked. this is a feature.");
424+
handler.note(
425425
"we would appreciate a joke overview: \
426426
https://github.com/rust-lang/rust/issues/43162#issuecomment-320764675",
427427
);
428-
handler.note_without_error(format!(
429-
"rustc {} running on {}",
430-
tcx.sess.cfg_version,
431-
config::host_triple(),
432-
));
428+
handler.note(format!("rustc {} running on {}", tcx.sess.cfg_version, config::host_triple(),));
433429
if let Some((flags, excluded_cargo_defaults)) = rustc_session::utils::extra_compiler_flags() {
434-
handler.note_without_error(format!("compiler flags: {}", flags.join(" ")));
430+
handler.note(format!("compiler flags: {}", flags.join(" ")));
435431
if excluded_cargo_defaults {
436-
handler.note_without_error("some of the compiler flags provided by cargo are hidden");
432+
handler.note("some of the compiler flags provided by cargo are hidden");
437433
}
438434
}
439435
}

compiler/rustc_session/src/session.rs

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -655,30 +655,23 @@ impl Session {
655655
#[rustc_lint_diagnostics]
656656
#[allow(rustc::untranslatable_diagnostic)]
657657
#[allow(rustc::diagnostic_outside_of_impl)]
658-
pub fn note_without_error(&self, msg: impl Into<DiagnosticMessage>) {
659-
self.diagnostic().note_without_error(msg)
658+
pub fn note(&self, msg: impl Into<DiagnosticMessage>) {
659+
self.diagnostic().note(msg)
660660
}
661661

662662
#[track_caller]
663663
#[rustc_lint_diagnostics]
664664
#[allow(rustc::untranslatable_diagnostic)]
665665
#[allow(rustc::diagnostic_outside_of_impl)]
666-
pub fn span_note_without_error<S: Into<MultiSpan>>(
667-
&self,
668-
sp: S,
669-
msg: impl Into<DiagnosticMessage>,
670-
) {
671-
self.diagnostic().span_note_without_error(sp, msg)
666+
pub fn span_note<S: Into<MultiSpan>>(&self, sp: S, msg: impl Into<DiagnosticMessage>) {
667+
self.diagnostic().span_note(sp, msg)
672668
}
673669

674670
#[rustc_lint_diagnostics]
675671
#[allow(rustc::untranslatable_diagnostic)]
676672
#[allow(rustc::diagnostic_outside_of_impl)]
677-
pub fn struct_note_without_error(
678-
&self,
679-
msg: impl Into<DiagnosticMessage>,
680-
) -> DiagnosticBuilder<'_, ()> {
681-
self.diagnostic().struct_note_without_error(msg)
673+
pub fn struct_note(&self, msg: impl Into<DiagnosticMessage>) -> DiagnosticBuilder<'_, ()> {
674+
self.diagnostic().struct_note(msg)
682675
}
683676

684677
#[inline]
@@ -1726,7 +1719,7 @@ impl EarlyErrorHandler {
17261719
#[allow(rustc::untranslatable_diagnostic)]
17271720
#[allow(rustc::diagnostic_outside_of_impl)]
17281721
pub fn early_note(&self, msg: impl Into<DiagnosticMessage>) {
1729-
self.handler.struct_note_without_error(msg).emit()
1722+
self.handler.struct_note(msg).emit()
17301723
}
17311724

17321725
#[allow(rustc::untranslatable_diagnostic)]

src/tools/clippy/src/driver.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ pub fn main() {
183183
// as simple as moving the call from the hook to main, because `install_ice_hook` doesn't
184184
// accept a generic closure.
185185
let version_info = rustc_tools_util::get_version_info!();
186-
handler.note_without_error(format!("Clippy version: {version_info}"));
186+
handler.note(format!("Clippy version: {version_info}"));
187187
});
188188

189189
exit(rustc_driver::catch_with_exit_code(move || {

src/tools/miri/src/diagnostics.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ pub fn report_error<'tcx, 'mir>(
384384

385385
// Include a note like `std` does when we omit frames from a backtrace
386386
if was_pruned {
387-
ecx.tcx.sess.diagnostic().note_without_error(
387+
ecx.tcx.sess.diagnostic().note(
388388
"some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace",
389389
);
390390
}
@@ -431,7 +431,7 @@ pub fn report_leaks<'mir, 'tcx>(
431431
);
432432
}
433433
if any_pruned {
434-
ecx.tcx.sess.diagnostic().note_without_error(
434+
ecx.tcx.sess.diagnostic().note(
435435
"some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace",
436436
);
437437
}

src/tools/miri/src/eval.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ pub fn eval_entry<'tcx>(
464464
// Check for thread leaks.
465465
if !ecx.have_all_terminated() {
466466
tcx.sess.err("the main thread terminated without waiting for all remaining threads");
467-
tcx.sess.note_without_error("pass `-Zmiri-ignore-leaks` to disable this check");
467+
tcx.sess.note("pass `-Zmiri-ignore-leaks` to disable this check");
468468
return None;
469469
}
470470
// Check for memory leaks.
@@ -475,7 +475,7 @@ pub fn eval_entry<'tcx>(
475475
let leak_message = "the evaluated program leaked memory, pass `-Zmiri-ignore-leaks` to disable this check";
476476
if ecx.machine.collect_leak_backtraces {
477477
// If we are collecting leak backtraces, each leak is a distinct error diagnostic.
478-
tcx.sess.note_without_error(leak_message);
478+
tcx.sess.note(leak_message);
479479
} else {
480480
// If we do not have backtraces, we just report an error without any span.
481481
tcx.sess.err(leak_message);

0 commit comments

Comments
 (0)