1
Fork 0

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
This commit is contained in:
Oli Scherer 2022-11-11 14:45:18 +00:00
parent 014f7f4092
commit 21ce58732b
5 changed files with 6 additions and 9 deletions

View file

@ -2445,12 +2445,12 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
(Ok(l), Ok(r)) => l.line == r.line, (Ok(l), Ok(r)) => l.line == r.line,
_ => true, _ => true,
}; };
if !ident.span.overlaps(span) && !same_line { if !ident.span.is_dummy() && !ident.span.overlaps(span) && !same_line {
multispan.push_span_label(ident.span, "required by a bound in this"); multispan.push_span_label(ident.span, "required by a bound in this");
} }
} }
let descr = format!("required by a bound in `{}`", item_name); let descr = format!("required by a bound in `{}`", item_name);
if span != DUMMY_SP { if !span.is_dummy() {
let msg = format!("required by this bound in `{}`", item_name); let msg = format!("required by this bound in `{}`", item_name);
multispan.push_span_label(span, msg); multispan.push_span_label(span, msg);
err.span_note(multispan, &descr); err.span_note(multispan, &descr);

View file

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

View file

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

View file

@ -1,6 +1,4 @@
fn process_slice(data: &[i32]) { fn process_slice(data: &[i32]) {
//~^ NOTE required by a bound in this
//~| NOTE required by a bound in this
todo!() todo!()
} }

View file

@ -1,5 +1,5 @@
error[E0277]: the size for values of type `[i32]` cannot be known at compilation time error[E0277]: the size for values of type `[i32]` cannot be known at compilation time
--> $DIR/collect-into-slice.rs:8:9 --> $DIR/collect-into-slice.rs:6:9
| |
LL | let some_generated_vec = (0..10).collect(); LL | let some_generated_vec = (0..10).collect();
| ^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | ^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
@ -9,7 +9,7 @@ LL | let some_generated_vec = (0..10).collect();
= help: unsized locals are gated as an unstable feature = help: unsized locals are gated as an unstable feature
error[E0277]: the size for values of type `[i32]` cannot be known at compilation time error[E0277]: the size for values of type `[i32]` cannot be known at compilation time
--> $DIR/collect-into-slice.rs:8:38 --> $DIR/collect-into-slice.rs:6:38
| |
LL | let some_generated_vec = (0..10).collect(); LL | let some_generated_vec = (0..10).collect();
| ^^^^^^^ doesn't have a size known at compile-time | ^^^^^^^ doesn't have a size known at compile-time
@ -22,7 +22,7 @@ LL | fn collect<B: FromIterator<Self::Item>>(self) -> B
| ^ required by this bound in `collect` | ^ required by this bound in `collect`
error[E0277]: a slice of type `[i32]` cannot be built since `[i32]` has no definite size error[E0277]: a slice of type `[i32]` cannot be built since `[i32]` has no definite size
--> $DIR/collect-into-slice.rs:8:30 --> $DIR/collect-into-slice.rs:6:30
| |
LL | let some_generated_vec = (0..10).collect(); LL | let some_generated_vec = (0..10).collect();
| ^^^^^^^ ------- required by a bound introduced by this call | ^^^^^^^ ------- required by a bound introduced by this call