suppress trait errors that are implied by other errors
Instead of suppressing only trait errors that are "exact duplicates", display only the "most high-level" error when there are multiple trait errors with the same span that imply each-other. e.g. when there are both `[closure]: Fn` and `[closure]: FnOnce`, omit displaying the `[closure]: FnOnce` bound.
This commit is contained in:
parent
dfa7e21e4e
commit
7b9519a5d4
23 changed files with 291 additions and 279 deletions
|
|
@ -18,5 +18,4 @@ fn main() {
|
|||
let _x: extern "C" fn() = f; // OK
|
||||
is_fn(f);
|
||||
//~^ ERROR `extern "C" fn() {f}: std::ops::Fn<()>` is not satisfied
|
||||
//~| ERROR `extern "C" fn() {f}: std::ops::FnOnce<()>` is not satisfied
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,5 +28,4 @@ fn main() {
|
|||
|
||||
needs_fn(1);
|
||||
//~^ ERROR : std::ops::Fn<(isize,)>`
|
||||
//~| ERROR : std::ops::FnOnce<(isize,)>`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,5 @@ fn main() {
|
|||
let _: &mut Fn() = unsafe {
|
||||
&mut *(ptr as *mut Fn())
|
||||
//~^ ERROR `(): std::ops::Fn<()>` is not satisfied
|
||||
//~| ERROR `(): std::ops::FnOnce<()>` is not satisfied
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,5 +11,4 @@
|
|||
fn main() {
|
||||
"".chars().fold(|_, _| (), ());
|
||||
//~^ ERROR E0277
|
||||
//~| ERROR E0277
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ use std::ops::*;
|
|||
struct AllTheRanges {
|
||||
a: Range<usize>,
|
||||
//~^ ERROR PartialOrd
|
||||
//~^^ ERROR PartialOrd
|
||||
//~^^^ ERROR Ord
|
||||
//~^^ ERROR Ord
|
||||
//~^^^ ERROR binary operation
|
||||
//~^^^^ ERROR binary operation
|
||||
//~^^^^^ ERROR binary operation
|
||||
//~^^^^^^ ERROR binary operation
|
||||
|
|
@ -26,11 +26,10 @@ struct AllTheRanges {
|
|||
//~^^^^^^^^ ERROR binary operation
|
||||
//~^^^^^^^^^ ERROR binary operation
|
||||
//~^^^^^^^^^^ ERROR binary operation
|
||||
//~^^^^^^^^^^^ ERROR binary operation
|
||||
b: RangeTo<usize>,
|
||||
//~^ ERROR PartialOrd
|
||||
//~^^ ERROR PartialOrd
|
||||
//~^^^ ERROR Ord
|
||||
//~^^ ERROR Ord
|
||||
//~^^^ ERROR binary operation
|
||||
//~^^^^ ERROR binary operation
|
||||
//~^^^^^ ERROR binary operation
|
||||
//~^^^^^^ ERROR binary operation
|
||||
|
|
@ -38,11 +37,10 @@ struct AllTheRanges {
|
|||
//~^^^^^^^^ ERROR binary operation
|
||||
//~^^^^^^^^^ ERROR binary operation
|
||||
//~^^^^^^^^^^ ERROR binary operation
|
||||
//~^^^^^^^^^^^ ERROR binary operation
|
||||
c: RangeFrom<usize>,
|
||||
//~^ ERROR PartialOrd
|
||||
//~^^ ERROR PartialOrd
|
||||
//~^^^ ERROR Ord
|
||||
//~^^ ERROR Ord
|
||||
//~^^^ ERROR binary operation
|
||||
//~^^^^ ERROR binary operation
|
||||
//~^^^^^ ERROR binary operation
|
||||
//~^^^^^^ ERROR binary operation
|
||||
|
|
@ -50,11 +48,10 @@ struct AllTheRanges {
|
|||
//~^^^^^^^^ ERROR binary operation
|
||||
//~^^^^^^^^^ ERROR binary operation
|
||||
//~^^^^^^^^^^ ERROR binary operation
|
||||
//~^^^^^^^^^^^ ERROR binary operation
|
||||
d: RangeFull,
|
||||
//~^ ERROR PartialOrd
|
||||
//~^^ ERROR PartialOrd
|
||||
//~^^^ ERROR Ord
|
||||
//~^^ ERROR Ord
|
||||
//~^^^ ERROR binary operation
|
||||
//~^^^^ ERROR binary operation
|
||||
//~^^^^^ ERROR binary operation
|
||||
//~^^^^^^ ERROR binary operation
|
||||
|
|
@ -62,11 +59,10 @@ struct AllTheRanges {
|
|||
//~^^^^^^^^ ERROR binary operation
|
||||
//~^^^^^^^^^ ERROR binary operation
|
||||
//~^^^^^^^^^^ ERROR binary operation
|
||||
//~^^^^^^^^^^^ ERROR binary operation
|
||||
e: RangeInclusive<usize>,
|
||||
//~^ ERROR PartialOrd
|
||||
//~^^ ERROR PartialOrd
|
||||
//~^^^ ERROR Ord
|
||||
//~^^ ERROR Ord
|
||||
//~^^^ ERROR binary operation
|
||||
//~^^^^ ERROR binary operation
|
||||
//~^^^^^ ERROR binary operation
|
||||
//~^^^^^^ ERROR binary operation
|
||||
|
|
@ -74,11 +70,10 @@ struct AllTheRanges {
|
|||
//~^^^^^^^^ ERROR binary operation
|
||||
//~^^^^^^^^^ ERROR binary operation
|
||||
//~^^^^^^^^^^ ERROR binary operation
|
||||
//~^^^^^^^^^^^ ERROR binary operation
|
||||
f: RangeToInclusive<usize>,
|
||||
//~^ ERROR PartialOrd
|
||||
//~^^ ERROR PartialOrd
|
||||
//~^^^ ERROR Ord
|
||||
//~^^ ERROR Ord
|
||||
//~^^^ ERROR binary operation
|
||||
//~^^^^ ERROR binary operation
|
||||
//~^^^^^ ERROR binary operation
|
||||
//~^^^^^^ ERROR binary operation
|
||||
|
|
@ -86,8 +81,6 @@ struct AllTheRanges {
|
|||
//~^^^^^^^^ ERROR binary operation
|
||||
//~^^^^^^^^^ ERROR binary operation
|
||||
//~^^^^^^^^^^ ERROR binary operation
|
||||
//~^^^^^^^^^^^ ERROR binary operation
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,8 +15,7 @@ fn mutate(s: &mut str) {
|
|||
//~^ ERROR `str: std::marker::Sized` is not satisfied
|
||||
//~| ERROR `str: std::marker::Sized` is not satisfied
|
||||
s[1usize] = bot();
|
||||
//~^ ERROR `str: std::ops::Index<usize>` is not satisfied
|
||||
//~| ERROR `str: std::ops::IndexMut<usize>` is not satisfied
|
||||
//~^ ERROR `str: std::ops::IndexMut<usize>` is not satisfied
|
||||
}
|
||||
|
||||
pub fn main() {}
|
||||
|
|
|
|||
|
|
@ -21,13 +21,11 @@ fn call_it_once<F:FnOnce(&isize)->isize>(_: F, _: isize) -> isize { 0 }
|
|||
fn a() {
|
||||
let x = call_it(&square, 22);
|
||||
//~^ ERROR E0277
|
||||
//~| ERROR E0277
|
||||
}
|
||||
|
||||
fn b() {
|
||||
let y = call_it_mut(&mut square, 22);
|
||||
//~^ ERROR E0277
|
||||
//~| ERROR E0277
|
||||
}
|
||||
|
||||
fn c() {
|
||||
|
|
|
|||
|
|
@ -21,13 +21,11 @@ fn call_it_once<F:FnOnce(&isize)->isize>(_: F, _: isize) -> isize { 0 }
|
|||
fn a() {
|
||||
let x = call_it(&square, 22);
|
||||
//~^ ERROR E0277
|
||||
//~| ERROR E0277
|
||||
}
|
||||
|
||||
fn b() {
|
||||
let y = call_it_mut(&mut square, 22);
|
||||
//~^ ERROR E0277
|
||||
//~| ERROR E0277
|
||||
}
|
||||
|
||||
fn c() {
|
||||
|
|
|
|||
|
|
@ -22,13 +22,11 @@ fn call_it_once<F:FnOnce(&isize)->isize>(_: F, _: isize) -> isize { 0 }
|
|||
fn a() {
|
||||
let x = call_it(&square, 22);
|
||||
//~^ ERROR E0277
|
||||
//~| ERROR E0277
|
||||
}
|
||||
|
||||
fn b() {
|
||||
let y = call_it_mut(&mut square, 22);
|
||||
//~^ ERROR E0277
|
||||
//~| ERROR E0277
|
||||
}
|
||||
|
||||
fn c() {
|
||||
|
|
|
|||
|
|
@ -12,15 +12,15 @@
|
|||
|
||||
trait T {}
|
||||
|
||||
fn f1<X: ?Sized>(x: &X) {
|
||||
let _: X; // <-- this is OK, no bindings created, no initializer.
|
||||
fn f1<W: ?Sized, X: ?Sized, Y: ?Sized, Z: ?Sized>(x: &X) {
|
||||
let _: W; // <-- this is OK, no bindings created, no initializer.
|
||||
let _: (isize, (X, isize)); //~ERROR `X: std::marker::Sized` is not satisfie
|
||||
let y: X; //~ERROR `X: std::marker::Sized` is not satisfied
|
||||
let y: (isize, (X, usize));
|
||||
let y: Y; //~ERROR `Y: std::marker::Sized` is not satisfied
|
||||
let y: (isize, (Z, usize)); //~ERROR `Z: std::marker::Sized` is not satisfied
|
||||
}
|
||||
fn f2<X: ?Sized + T>(x: &X) {
|
||||
fn f2<X: ?Sized, Y: ?Sized>(x: &X) {
|
||||
let y: X; //~ERROR `X: std::marker::Sized` is not satisfied
|
||||
let y: (isize, (X, isize)); //~ERROR `X: std::marker::Sized` is not satisfied
|
||||
let y: (isize, (Y, isize)); //~ERROR `Y: std::marker::Sized` is not satisfied
|
||||
}
|
||||
|
||||
fn f3<X: ?Sized>(x1: Box<X>, x2: Box<X>, x3: Box<X>) {
|
||||
|
|
|
|||
|
|
@ -9,16 +9,5 @@ error[E0281]: type mismatch: `[closure@$DIR/E0281.rs:14:9: 14:24]` implements th
|
|||
|
|
||||
= note: required by `foo`
|
||||
|
||||
error[E0281]: type mismatch: `[closure@$DIR/E0281.rs:14:9: 14:24]` implements the trait `std::ops::FnOnce<(std::string::String,)>`, but the trait `std::ops::FnOnce<(usize,)>` is required
|
||||
--> $DIR/E0281.rs:14:5
|
||||
|
|
||||
14 | foo(|y: String| { });
|
||||
| ^^^ --------------- implements `std::ops::FnOnce<(std::string::String,)>`
|
||||
| |
|
||||
| requires `std::ops::FnOnce<(usize,)>`
|
||||
| expected usize, found struct `std::string::String`
|
||||
|
|
||||
= note: required by `foo`
|
||||
|
||||
error: aborting due to previous error(s)
|
||||
|
||||
|
|
|
|||
|
|
@ -30,14 +30,6 @@ error[E0277]: the trait bound `{integer}: std::ops::Div<&str>` is not satisfied
|
|||
|
|
||||
= help: the trait `std::ops::Div<&str>` is not implemented for `{integer}`
|
||||
|
||||
error[E0277]: the trait bound `{integer}: std::cmp::PartialEq<std::string::String>` is not satisfied
|
||||
--> $DIR/binops.rs:16:7
|
||||
|
|
||||
16 | 5 < String::new();
|
||||
| ^ can't compare `{integer}` with `std::string::String`
|
||||
|
|
||||
= help: the trait `std::cmp::PartialEq<std::string::String>` is not implemented for `{integer}`
|
||||
|
||||
error[E0277]: the trait bound `{integer}: std::cmp::PartialOrd<std::string::String>` is not satisfied
|
||||
--> $DIR/binops.rs:16:7
|
||||
|
|
||||
|
|
|
|||
|
|
@ -6,22 +6,6 @@ error[E0593]: closure takes 0 arguments but 2 arguments are required
|
|||
| |
|
||||
| expected closure that takes 2 arguments
|
||||
|
||||
error[E0593]: closure takes 0 arguments but 2 arguments are required
|
||||
--> $DIR/closure-arg-count.rs:12:15
|
||||
|
|
||||
12 | [1, 2, 3].sort_by(|| panic!());
|
||||
| ^^^^^^^ ----------- takes 0 arguments
|
||||
| |
|
||||
| expected closure that takes 2 arguments
|
||||
|
||||
error[E0593]: closure takes 1 argument but 2 arguments are required
|
||||
--> $DIR/closure-arg-count.rs:13:15
|
||||
|
|
||||
13 | [1, 2, 3].sort_by(|tuple| panic!());
|
||||
| ^^^^^^^ ---------------- takes 1 argument
|
||||
| |
|
||||
| expected closure that takes 2 arguments
|
||||
|
||||
error[E0593]: closure takes 1 argument but 2 arguments are required
|
||||
--> $DIR/closure-arg-count.rs:13:15
|
||||
|
|
||||
|
|
@ -47,13 +31,5 @@ error[E0593]: closure takes 1 argument but 2 arguments are required
|
|||
| |
|
||||
| expected closure that takes 2 arguments
|
||||
|
||||
error[E0593]: closure takes 1 argument but 2 arguments are required
|
||||
--> $DIR/closure-arg-count.rs:14:15
|
||||
|
|
||||
14 | [1, 2, 3].sort_by(|(tuple, tuple2)| panic!());
|
||||
| ^^^^^^^ -------------------------- takes 1 argument
|
||||
| |
|
||||
| expected closure that takes 2 arguments
|
||||
|
||||
error: aborting due to previous error(s)
|
||||
|
||||
|
|
|
|||
|
|
@ -17,14 +17,5 @@ error[E0281]: type mismatch: `[closure@$DIR/issue-36053-2.rs:17:39: 17:53]` impl
|
|||
| requires `for<'r> std::ops::FnMut<(&'r &str,)>`
|
||||
| expected &str, found str
|
||||
|
||||
error[E0281]: type mismatch: `[closure@$DIR/issue-36053-2.rs:17:39: 17:53]` implements the trait `for<'r> std::ops::FnOnce<(&'r str,)>`, but the trait `for<'r> std::ops::FnOnce<(&'r &str,)>` is required
|
||||
--> $DIR/issue-36053-2.rs:17:32
|
||||
|
|
||||
17 | once::<&str>("str").fuse().filter(|a: &str| true).count();
|
||||
| ^^^^^^ -------------- implements `for<'r> std::ops::FnOnce<(&'r str,)>`
|
||||
| |
|
||||
| requires `for<'r> std::ops::FnOnce<(&'r &str,)>`
|
||||
| expected &str, found str
|
||||
|
||||
error: aborting due to previous error(s)
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ pub fn main() {
|
|||
//~| NOTE implements
|
||||
let z = call_it(3, f);
|
||||
//~^ ERROR type mismatch
|
||||
//~| ERROR type mismatch
|
||||
//~| NOTE expected isize, found usize
|
||||
//~| NOTE expected isize, found usize
|
||||
//~| NOTE requires
|
||||
|
|
|
|||
|
|
@ -12,19 +12,5 @@ error[E0281]: type mismatch: `[closure@$DIR/unboxed-closures-vtable-mismatch.rs:
|
|||
|
|
||||
= note: required by `call_it`
|
||||
|
||||
error[E0281]: type mismatch: `[closure@$DIR/unboxed-closures-vtable-mismatch.rs:22:23: 22:73]` implements the trait `std::ops::FnOnce<(usize, isize)>`, but the trait `std::ops::FnOnce<(isize, isize)>` is required
|
||||
--> $DIR/unboxed-closures-vtable-mismatch.rs:25:13
|
||||
|
|
||||
22 | let f = to_fn_mut(|x: usize, y: isize| -> isize { (x as isize) + y });
|
||||
| -------------------------------------------------- implements `std::ops::FnOnce<(usize, isize)>`
|
||||
...
|
||||
25 | let z = call_it(3, f);
|
||||
| ^^^^^^^
|
||||
| |
|
||||
| requires `std::ops::FnOnce<(isize, isize)>`
|
||||
| expected isize, found usize
|
||||
|
|
||||
= note: required by `call_it`
|
||||
|
||||
error: aborting due to previous error(s)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
error[E0282]: type annotations needed
|
||||
error[E0283]: type annotations required: cannot resolve `&'a T: Foo`
|
||||
--> $DIR/issue-40294.rs:15:1
|
||||
|
|
||||
15 | / fn foo<'a,'b,T>(x: &'a T, y: &'b T)
|
||||
|
|
@ -8,7 +8,9 @@ error[E0282]: type annotations needed
|
|||
19 | | x.foo();
|
||||
20 | | y.foo();
|
||||
21 | | }
|
||||
| |_^ cannot infer type for `&'a T`
|
||||
| |_^
|
||||
|
|
||||
= note: required by `Foo`
|
||||
|
||||
error: aborting due to previous error(s)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue