Skip to content

Commit 5352e17

Browse files
Rollup merge of #89483 - hkmatsumoto:patch-diagnostics-2, r=estebank
Practice diagnostic message convention Detected by #89455. r? ```@estebank```
2 parents 2bc89ce + 3818981 commit 5352e17

File tree

63 files changed

+167
-168
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+167
-168
lines changed

compiler/rustc_ast_passes/src/ast_validation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ impl<'a> AstValidator<'a> {
590590
)
591591
.span_label(self.current_extern_span(), "in this `extern` block")
592592
.note(&format!(
593-
"This limitation may be lifted in the future; see issue #{} <https://github.com/rust-lang/rust/issues/{}> for more information",
593+
"this limitation may be lifted in the future; see issue #{} <https://github.com/rust-lang/rust/issues/{}> for more information",
594594
n, n,
595595
))
596596
.emit();

compiler/rustc_builtin_macros/src/concat_idents.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub fn expand_concat_idents<'cx>(
1212
tts: TokenStream,
1313
) -> Box<dyn base::MacResult + 'cx> {
1414
if tts.is_empty() {
15-
cx.span_err(sp, "concat_idents! takes 1 or more arguments.");
15+
cx.span_err(sp, "concat_idents! takes 1 or more arguments");
1616
return DummyResult::any(sp);
1717
}
1818

@@ -22,7 +22,7 @@ pub fn expand_concat_idents<'cx>(
2222
match e {
2323
TokenTree::Token(Token { kind: token::Comma, .. }) => {}
2424
_ => {
25-
cx.span_err(sp, "concat_idents! expecting comma.");
25+
cx.span_err(sp, "concat_idents! expecting comma");
2626
return DummyResult::any(sp);
2727
}
2828
}
@@ -34,7 +34,7 @@ pub fn expand_concat_idents<'cx>(
3434
}
3535
}
3636

37-
cx.span_err(sp, "concat_idents! requires ident args.");
37+
cx.span_err(sp, "concat_idents! requires ident args");
3838
return DummyResult::any(sp);
3939
}
4040
}

compiler/rustc_builtin_macros/src/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ fn should_panic(cx: &ExtCtxt<'_>, i: &ast::Item) -> ShouldPanic {
382382
.note(
383383
"errors in this attribute were erroneously \
384384
allowed and will become a hard error in a \
385-
future release.",
385+
future release",
386386
)
387387
.emit();
388388
ShouldPanic::Yes(None)

compiler/rustc_const_eval/src/transform/check_consts/ops.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ impl NonConstOp for RawPtrComparison {
407407
let mut err = ccx
408408
.tcx
409409
.sess
410-
.struct_span_err(span, "pointers cannot be reliably compared during const eval.");
410+
.struct_span_err(span, "pointers cannot be reliably compared during const eval");
411411
err.note(
412412
"see issue #53020 <https://github.com/rust-lang/rust/issues/53020> \
413413
for more information",
@@ -443,7 +443,7 @@ impl NonConstOp for RawPtrToIntCast {
443443
let mut err = ccx
444444
.tcx
445445
.sess
446-
.struct_span_err(span, "pointers cannot be cast to integers during const eval.");
446+
.struct_span_err(span, "pointers cannot be cast to integers during const eval");
447447
err.note("at compile-time, pointers do not have an integer value");
448448
err.note(
449449
"avoiding this restriction via `transmute`, `union`, or raw pointers leads to compile-time undefined behavior",

compiler/rustc_lint/src/array_into_iter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ impl<'tcx> LateLintPass<'tcx> for ArrayIntoIter {
124124
let mut diag = lint.build(&format!(
125125
"this method call resolves to `<&{} as IntoIterator>::into_iter` \
126126
(due to backwards compatibility), \
127-
but will resolve to <{} as IntoIterator>::into_iter in Rust 2021.",
127+
but will resolve to <{} as IntoIterator>::into_iter in Rust 2021",
128128
target, target,
129129
));
130130
diag.span_suggestion(

compiler/rustc_lint/src/builtin.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -918,7 +918,7 @@ impl EarlyLintPass for AnonymousParameters {
918918

919919
lint.build(
920920
"anonymous parameters are deprecated and will be \
921-
removed in the next edition.",
921+
removed in the next edition",
922922
)
923923
.span_suggestion(
924924
arg.pat.span,
@@ -1629,9 +1629,9 @@ impl<'tcx> LateLintPass<'tcx> for TrivialConstraints {
16291629
let predicates = cx.tcx.predicates_of(item.def_id);
16301630
for &(predicate, span) in predicates.predicates {
16311631
let predicate_kind_name = match predicate.kind().skip_binder() {
1632-
Trait(..) => "Trait",
1632+
Trait(..) => "trait",
16331633
TypeOutlives(..) |
1634-
RegionOutlives(..) => "Lifetime",
1634+
RegionOutlives(..) => "lifetime",
16351635

16361636
// Ignore projections, as they can only be global
16371637
// if the trait bound is global

compiler/rustc_lint/src/non_ascii_idents.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -331,18 +331,17 @@ impl EarlyLintPass for NonAsciiIdents {
331331
for ((sp, ch_list), script_set) in lint_reports {
332332
cx.struct_span_lint(MIXED_SCRIPT_CONFUSABLES, sp, |lint| {
333333
let message = format!(
334-
"The usage of Script Group `{}` in this crate consists solely of mixed script confusables",
334+
"the usage of Script Group `{}` in this crate consists solely of mixed script confusables",
335335
script_set);
336-
let mut note = "The usage includes ".to_string();
336+
let mut note = "the usage includes ".to_string();
337337
for (idx, ch) in ch_list.into_iter().enumerate() {
338338
if idx != 0 {
339339
note += ", ";
340340
}
341341
let char_info = format!("'{}' (U+{:04X})", ch, ch as u32);
342342
note += &char_info;
343343
}
344-
note += ".";
345-
lint.build(&message).note(&note).note("Please recheck to make sure their usages are indeed what you want.").emit()
344+
lint.build(&message).note(&note).note("please recheck to make sure their usages are indeed what you want").emit()
346345
});
347346
}
348347
}

compiler/rustc_metadata/src/creader.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,7 @@ impl<'a> CrateLoader<'a> {
878878
"no global memory allocator found but one is \
879879
required; link to std or \
880880
add `#[global_allocator]` to a static item \
881-
that implements the GlobalAlloc trait.",
881+
that implements the GlobalAlloc trait",
882882
);
883883
}
884884
self.cstore.allocator_kind = Some(AllocatorKind::Default);

compiler/rustc_metadata/src/native_libs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,13 +319,13 @@ impl Collector<'tcx> {
319319
self.tcx.sess.err(&format!(
320320
"renaming of the library `{}` was specified, \
321321
however this crate contains no `#[link(...)]` \
322-
attributes referencing this library.",
322+
attributes referencing this library",
323323
lib.name
324324
));
325325
} else if !renames.insert(&lib.name) {
326326
self.tcx.sess.err(&format!(
327327
"multiple renamings were \
328-
specified for library `{}` .",
328+
specified for library `{}`",
329329
lib.name
330330
));
331331
}

compiler/rustc_passes/src/weak_lang_items.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ fn verify<'tcx>(tcx: TyCtxt<'tcx>, items: &lang_items::LanguageItems) {
6666
tcx.sess.err("`#[panic_handler]` function required, but not found");
6767
} else if item == LangItem::Oom {
6868
if !tcx.features().default_alloc_error_handler {
69-
tcx.sess.err("`#[alloc_error_handler]` function required, but not found.");
70-
tcx.sess.note_without_error("Use `#![feature(default_alloc_error_handler)]` for a default error handler.");
69+
tcx.sess.err("`#[alloc_error_handler]` function required, but not found");
70+
tcx.sess.note_without_error("Use `#![feature(default_alloc_error_handler)]` for a default error handler");
7171
}
7272
} else {
7373
tcx.sess.err(&format!("language item required, but not found: `{}`", name));

0 commit comments

Comments
 (0)