Skip to content

Commit 4412845

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

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

+1-1
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

+3-3
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

+1-1
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

+2-2
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

+1-1
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

+3-3
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

+3-4
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

+1-1
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

+2-2
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

+2-2
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));

compiler/rustc_resolve/src/imports.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1339,7 +1339,7 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
13391339
};
13401340

13411341
if module.is_trait() {
1342-
self.r.session.span_err(import.span, "items in traits are not importable.");
1342+
self.r.session.span_err(import.span, "items in traits are not importable");
13431343
return;
13441344
} else if ptr::eq(module, import.parent_scope.module) {
13451345
return;

compiler/rustc_session/src/session.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1384,7 +1384,7 @@ fn validate_commandline_args_with_session_available(sess: &Session) {
13841384
// Cannot enable crt-static with sanitizers on Linux
13851385
if sess.crt_static(None) && !sess.opts.debugging_opts.sanitizer.is_empty() {
13861386
sess.err(
1387-
"Sanitizer is incompatible with statically linked libc, \
1387+
"sanitizer is incompatible with statically linked libc, \
13881388
disable it using `-C target-feature=-crt-static`",
13891389
);
13901390
}

compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
516516
});
517517
let unit_obligation = obligation.with(predicate.to_predicate(tcx));
518518
if self.predicate_may_hold(&unit_obligation) {
519-
err.note("this trait is implemented for `()`.");
519+
err.note("this trait is implemented for `()`");
520520
err.note(
521521
"this error might have been caused by changes to \
522522
Rust's type-inference algorithm (see issue #48950 \

compiler/rustc_trait_selection/src/traits/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ fn dump_vtable_entries<'tcx>(
623623
trait_ref: ty::PolyTraitRef<'tcx>,
624624
entries: &[VtblEntry<'tcx>],
625625
) {
626-
let msg = format!("Vtable entries for `{}`: {:#?}", trait_ref, entries);
626+
let msg = format!("vtable entries for `{}`: {:#?}", trait_ref, entries);
627627
tcx.sess.struct_span_err(sp, &msg).emit();
628628
}
629629

library/core/src/cell.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1305,7 +1305,7 @@ impl Clone for BorrowRef<'_> {
13051305
#[stable(feature = "rust1", since = "1.0.0")]
13061306
#[cfg_attr(
13071307
not(bootstrap),
1308-
must_not_suspend = "Holding a Ref across suspend \
1308+
must_not_suspend = "holding a Ref across suspend \
13091309
points can cause BorrowErrors"
13101310
)]
13111311
pub struct Ref<'b, T: ?Sized + 'b> {
@@ -1686,7 +1686,7 @@ impl<'b> BorrowRefMut<'b> {
16861686
#[stable(feature = "rust1", since = "1.0.0")]
16871687
#[cfg_attr(
16881688
not(bootstrap),
1689-
must_not_suspend = "Holding a RefMut across suspend \
1689+
must_not_suspend = "holding a RefMut across suspend \
16901690
points can cause BorrowErrors"
16911691
)]
16921692
pub struct RefMut<'b, T: ?Sized + 'b> {

library/std/src/sync/mutex.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ unsafe impl<T: ?Sized + Send> Sync for Mutex<T> {}
190190
#[must_use = "if unused the Mutex will immediately unlock"]
191191
#[cfg_attr(
192192
not(bootstrap),
193-
must_not_suspend = "Holding a MutexGuard across suspend \
193+
must_not_suspend = "holding a MutexGuard across suspend \
194194
points can cause deadlocks, delays, \
195195
and cause Futures to not implement `Send`"
196196
)]

library/std/src/sync/rwlock.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ unsafe impl<T: ?Sized + Send + Sync> Sync for RwLock<T> {}
9797
#[must_use = "if unused the RwLock will immediately unlock"]
9898
#[cfg_attr(
9999
not(bootstrap),
100-
must_not_suspend = "Holding a RwLockReadGuard across suspend \
100+
must_not_suspend = "holding a RwLockReadGuard across suspend \
101101
points can cause deadlocks, delays, \
102102
and cause Futures to not implement `Send`"
103103
)]
@@ -123,7 +123,7 @@ unsafe impl<T: ?Sized + Sync> Sync for RwLockReadGuard<'_, T> {}
123123
#[must_use = "if unused the RwLock will immediately unlock"]
124124
#[cfg_attr(
125125
not(bootstrap),
126-
must_not_suspend = "Holding a RwLockWriteGuard across suspend \
126+
must_not_suspend = "holding a RwLockWriteGuard across suspend \
127127
points can cause deadlocks, delays, \
128128
and cause Future's to not implement `Send`"
129129
)]

src/test/ui/anon-params/anon-params-deprecated.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
warning: anonymous parameters are deprecated and will be removed in the next edition.
1+
warning: anonymous parameters are deprecated and will be removed in the next edition
22
--> $DIR/anon-params-deprecated.rs:9:12
33
|
44
LL | fn foo(i32);
@@ -12,7 +12,7 @@ LL | #![warn(anonymous_parameters)]
1212
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018!
1313
= note: for more information, see issue #41686 <https://github.com/rust-lang/rust/issues/41686>
1414

15-
warning: anonymous parameters are deprecated and will be removed in the next edition.
15+
warning: anonymous parameters are deprecated and will be removed in the next edition
1616
--> $DIR/anon-params-deprecated.rs:12:30
1717
|
1818
LL | fn bar_with_default_impl(String, String) {}
@@ -21,7 +21,7 @@ LL | fn bar_with_default_impl(String, String) {}
2121
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018!
2222
= note: for more information, see issue #41686 <https://github.com/rust-lang/rust/issues/41686>
2323

24-
warning: anonymous parameters are deprecated and will be removed in the next edition.
24+
warning: anonymous parameters are deprecated and will be removed in the next edition
2525
--> $DIR/anon-params-deprecated.rs:12:38
2626
|
2727
LL | fn bar_with_default_impl(String, String) {}

src/test/ui/consts/const-eval/const_raw_ptr_ops.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
error: pointers cannot be reliably compared during const eval.
1+
error: pointers cannot be reliably compared during const eval
22
--> $DIR/const_raw_ptr_ops.rs:4:26
33
|
44
LL | const X: bool = unsafe { &1 as *const i32 == &2 as *const i32 };
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
77
= note: see issue #53020 <https://github.com/rust-lang/rust/issues/53020> for more information
88

9-
error: pointers cannot be reliably compared during const eval.
9+
error: pointers cannot be reliably compared during const eval
1010
--> $DIR/const_raw_ptr_ops.rs:6:27
1111
|
1212
LL | const X2: bool = unsafe { 42 as *const i32 == 43 as *const i32 };

src/test/ui/consts/const-eval/match-test-ptr-null.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: pointers cannot be cast to integers during const eval.
1+
error: pointers cannot be cast to integers during const eval
22
--> $DIR/match-test-ptr-null.rs:6:15
33
|
44
LL | match &1 as *const i32 as usize {

src/test/ui/consts/const-extern-fn/const-extern-fn-min-const-fn.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ LL | const unsafe extern "C" fn use_float() { 1.0 + 1.0; }
2525
= note: see issue #57241 <https://github.com/rust-lang/rust/issues/57241> for more information
2626
= help: add `#![feature(const_fn_floating_point_arithmetic)]` to the crate attributes to enable
2727

28-
error: pointers cannot be cast to integers during const eval.
28+
error: pointers cannot be cast to integers during const eval
2929
--> $DIR/const-extern-fn-min-const-fn.rs:9:48
3030
|
3131
LL | const extern "C" fn ptr_cast(val: *const u8) { val as usize; }

src/test/ui/consts/issue-17458.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: pointers cannot be cast to integers during const eval.
1+
error: pointers cannot be cast to integers during const eval
22
--> $DIR/issue-17458.rs:1:28
33
|
44
LL | static X: usize = unsafe { core::ptr::null::<usize>() as usize };

src/test/ui/consts/issue-25826.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: pointers cannot be reliably compared during const eval.
1+
error: pointers cannot be reliably compared during const eval
22
--> $DIR/issue-25826.rs:3:30
33
|
44
LL | const A: bool = unsafe { id::<u8> as *const () < id::<u16> as *const () };

src/test/ui/consts/issue-52023-array-size-pointer-cast.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: pointers cannot be cast to integers during const eval.
1+
error: pointers cannot be cast to integers during const eval
22
--> $DIR/issue-52023-array-size-pointer-cast.rs:2:17
33
|
44
LL | let _ = [0; (&0 as *const i32) as usize];

src/test/ui/consts/min_const_fn/cmp_fn_pointers.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ LL | const fn cmp(x: fn(), y: fn()) -> bool {
1616
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
1717
= help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable
1818

19-
error: pointers cannot be reliably compared during const eval.
19+
error: pointers cannot be reliably compared during const eval
2020
--> $DIR/cmp_fn_pointers.rs:4:14
2121
|
2222
LL | unsafe { x == y }

src/test/ui/consts/min_const_fn/min_const_fn.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ LL | const fn foo26() -> &'static u32 { &BAR }
164164
|
165165
= help: consider extracting the value of the `static` to a `const`, and referring to that
166166

167-
error: pointers cannot be cast to integers during const eval.
167+
error: pointers cannot be cast to integers during const eval
168168
--> $DIR/min_const_fn.rs:92:42
169169
|
170170
LL | const fn foo30(x: *const u32) -> usize { x as usize }
@@ -173,7 +173,7 @@ LL | const fn foo30(x: *const u32) -> usize { x as usize }
173173
= note: at compile-time, pointers do not have an integer value
174174
= note: avoiding this restriction via `transmute`, `union`, or raw pointers leads to compile-time undefined behavior
175175

176-
error: pointers cannot be cast to integers during const eval.
176+
error: pointers cannot be cast to integers during const eval
177177
--> $DIR/min_const_fn.rs:94:63
178178
|
179179
LL | const fn foo30_with_unsafe(x: *const u32) -> usize { unsafe { x as usize } }
@@ -182,7 +182,7 @@ LL | const fn foo30_with_unsafe(x: *const u32) -> usize { unsafe { x as usize }
182182
= note: at compile-time, pointers do not have an integer value
183183
= note: avoiding this restriction via `transmute`, `union`, or raw pointers leads to compile-time undefined behavior
184184

185-
error: pointers cannot be cast to integers during const eval.
185+
error: pointers cannot be cast to integers during const eval
186186
--> $DIR/min_const_fn.rs:96:42
187187
|
188188
LL | const fn foo30_2(x: *mut u32) -> usize { x as usize }
@@ -191,7 +191,7 @@ LL | const fn foo30_2(x: *mut u32) -> usize { x as usize }
191191
= note: at compile-time, pointers do not have an integer value
192192
= note: avoiding this restriction via `transmute`, `union`, or raw pointers leads to compile-time undefined behavior
193193

194-
error: pointers cannot be cast to integers during const eval.
194+
error: pointers cannot be cast to integers during const eval
195195
--> $DIR/min_const_fn.rs:98:63
196196
|
197197
LL | const fn foo30_2_with_unsafe(x: *mut u32) -> usize { unsafe { x as usize } }

src/test/ui/error-codes/E0395.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: pointers cannot be reliably compared during const eval.
1+
error: pointers cannot be reliably compared during const eval
22
--> $DIR/E0395.rs:4:29
33
|
44
LL | static BAZ: bool = unsafe { (&FOO as *const i32) == (&BAR as *const i32) };

src/test/ui/future-incompatible-lint-group.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
warning: anonymous parameters are deprecated and will be removed in the next edition.
1+
warning: anonymous parameters are deprecated and will be removed in the next edition
22
--> $DIR/future-incompatible-lint-group.rs:7:10
33
|
44
LL | fn f(u8) {}

src/test/ui/imports/issue-30560.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: items in traits are not importable.
1+
error: items in traits are not importable
22
--> $DIR/issue-30560.rs:7:5
33
|
44
LL | use T::*;

src/test/ui/issues/issue-18294.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: pointers cannot be cast to integers during const eval.
1+
error: pointers cannot be cast to integers during const eval
22
--> $DIR/issue-18294.rs:3:31
33
|
44
LL | const Y: usize = unsafe { &X as *const u32 as usize };

src/test/ui/issues/issue-50403.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: concat_idents! takes 1 or more arguments.
1+
error: concat_idents! takes 1 or more arguments
22
--> $DIR/issue-50403.rs:4:13
33
|
44
LL | let x = concat_idents!();

0 commit comments

Comments
 (0)