Skip to content

Commit 21ce587

Browse files
committed
Don't add message that will never be shown to users
It will still be used in json, as seen by the ui test changes
1 parent 014f7f4 commit 21ce587

File tree

5 files changed

+6
-9
lines changed

5 files changed

+6
-9
lines changed

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -2445,12 +2445,12 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
24452445
(Ok(l), Ok(r)) => l.line == r.line,
24462446
_ => true,
24472447
};
2448-
if !ident.span.overlaps(span) && !same_line {
2448+
if !ident.span.is_dummy() && !ident.span.overlaps(span) && !same_line {
24492449
multispan.push_span_label(ident.span, "required by a bound in this");
24502450
}
24512451
}
24522452
let descr = format!("required by a bound in `{}`", item_name);
2453-
if span != DUMMY_SP {
2453+
if !span.is_dummy() {
24542454
let msg = format!("required by this bound in `{}`", item_name);
24552455
multispan.push_span_label(span, msg);
24562456
err.span_note(multispan, &descr);

src/test/ui/iterators/collect-into-array.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
fn main() {
2-
//~^ NOTE required by a bound in this
32
let whatever: [u32; 10] = (0..10).collect();
43
//~^ ERROR an array of type `[u32; 10]` cannot be built directly from an iterator
54
//~| NOTE try collecting into a `Vec<{integer}>`, then using `.try_into()`

src/test/ui/iterators/collect-into-array.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0277]: an array of type `[u32; 10]` cannot be built directly from an iterator
2-
--> $DIR/collect-into-array.rs:3:31
2+
--> $DIR/collect-into-array.rs:2:31
33
|
44
LL | let whatever: [u32; 10] = (0..10).collect();
55
| ^^^^^^^ ------- required by a bound introduced by this call

src/test/ui/iterators/collect-into-slice.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
fn process_slice(data: &[i32]) {
2-
//~^ NOTE required by a bound in this
3-
//~| NOTE required by a bound in this
42
todo!()
53
}
64

src/test/ui/iterators/collect-into-slice.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0277]: the size for values of type `[i32]` cannot be known at compilation time
2-
--> $DIR/collect-into-slice.rs:8:9
2+
--> $DIR/collect-into-slice.rs:6:9
33
|
44
LL | let some_generated_vec = (0..10).collect();
55
| ^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
@@ -9,7 +9,7 @@ LL | let some_generated_vec = (0..10).collect();
99
= help: unsized locals are gated as an unstable feature
1010

1111
error[E0277]: the size for values of type `[i32]` cannot be known at compilation time
12-
--> $DIR/collect-into-slice.rs:8:38
12+
--> $DIR/collect-into-slice.rs:6:38
1313
|
1414
LL | let some_generated_vec = (0..10).collect();
1515
| ^^^^^^^ doesn't have a size known at compile-time
@@ -22,7 +22,7 @@ LL | fn collect<B: FromIterator<Self::Item>>(self) -> B
2222
| ^ required by this bound in `collect`
2323

2424
error[E0277]: a slice of type `[i32]` cannot be built since `[i32]` has no definite size
25-
--> $DIR/collect-into-slice.rs:8:30
25+
--> $DIR/collect-into-slice.rs:6:30
2626
|
2727
LL | let some_generated_vec = (0..10).collect();
2828
| ^^^^^^^ ------- required by a bound introduced by this call

0 commit comments

Comments
 (0)