Skip to content

Commit 24bfa16

Browse files
committed
Reduce vebosity of E0599
1 parent 9fa8d87 commit 24bfa16

14 files changed

+20
-62
lines changed

src/librustc_typeck/check/method/probe.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1426,17 +1426,18 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
14261426
}
14271427
}
14281428
}
1429-
_ => {}
1429+
_ => {
1430+
// Some nested subobligation of this predicate
1431+
// failed.
1432+
//
1433+
// FIXME: try to find the exact nested subobligation
1434+
// and point at it rather than reporting the entire
1435+
// trait-ref?
1436+
result = ProbeResult::NoMatch;
1437+
let trait_ref = self.resolve_vars_if_possible(&trait_ref);
1438+
possibly_unsatisfied_predicates.push(trait_ref);
1439+
}
14301440
}
1431-
// Some nested subobligation of this predicate
1432-
// failed.
1433-
//
1434-
// FIXME: try to find the exact nested subobligation
1435-
// and point at it rather than reporting the entire
1436-
// trait-ref?
1437-
result = ProbeResult::NoMatch;
1438-
let trait_ref = self.resolve_vars_if_possible(&trait_ref);
1439-
possibly_unsatisfied_predicates.push(trait_ref);
14401441
});
14411442
}
14421443
}

src/librustc_typeck/check/method/suggest.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
394394
tcx.sess.diagnostic().struct_dummy()
395395
};
396396

397-
// FIXME: Unify with unmet bound label.
398397
if let Some(def) = actual.ty_adt_def() {
399398
if let Some(full_sp) = tcx.hir().span_if_local(def.did) {
400399
let def_sp = tcx.sess.source_map().def_span(full_sp);
@@ -576,7 +575,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
576575
bound_list.sort();
577576
bound_list.dedup(); // #35677
578577
bound_spans.sort();
579-
bound_spans.dedup(); // #35677
578+
bound_spans.dedup();
580579
for (span, msg) in bound_spans.into_iter() {
581580
err.span_label(span, &msg);
582581
}

src/test/ui/derives/derive-assoc-type-not-impl.stderr

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@ error[E0599]: no method named `clone` found for struct `Bar<NotClone>` in the cu
22
--> $DIR/derive-assoc-type-not-impl.rs:18:30
33
|
44
LL | struct Bar<T: Foo> {
5-
| ------------------
6-
| |
7-
| method `clone` not found for this
8-
| this type doesn't satisfy the bound `std::clone::Clone`
5+
| ------------------ method `clone` not found for this
96
...
107
LL | struct NotClone;
118
| ---------------- this type doesn't satisfy the bound `std::clone::Clone`
@@ -14,7 +11,6 @@ LL | Bar::<NotClone> { x: 1 }.clone();
1411
| ^^^^^ method not found in `Bar<NotClone>`
1512
|
1613
= note: the method `clone` exists but the following trait bounds were not satisfied:
17-
`Bar<NotClone>: std::clone::Clone`
1814
`NotClone: std::clone::Clone`
1915
= help: items from traits can only be used if the trait is implemented and in scope
2016
= note: the following trait defines an item `clone`, perhaps you need to implement it:

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ LL | println!("{}", z.to_string());
88
= note: using `<*const T>::as_ref()` on a pointer which is unaligned or points to invalid or uninitialized memory is undefined behavior
99
= note: the method `to_string` exists but the following trait bounds were not satisfied:
1010
`*const u8: std::fmt::Display`
11-
`*const u8: std::string::ToString`
1211

1312
error: aborting due to previous error
1413

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ LL | pub struct Cloned<I> {
1919
| -------------------- this type doesn't satisfy the bound `std::iter::Iterator`
2020
|
2121
= note: the method `collect` exists but the following trait bounds were not satisfied:
22-
`&mut std::iter::Cloned<std::iter::TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:10:39: 13:6 found_e:_]>>: std::iter::Iterator`
2322
`std::iter::Cloned<std::iter::TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:10:39: 13:6 found_e:_]>>: std::iter::Iterator`
2423

2524
error: aborting due to 2 previous errors

src/test/ui/methods/method-call-err-msg.stderr

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ LL | .take()
4444
| ^^^^ method not found in `Foo`
4545
|
4646
= note: the method `take` exists but the following trait bounds were not satisfied:
47-
`&mut Foo: std::iter::Iterator`
4847
`Foo: std::iter::Iterator`
4948
= help: items from traits can only be used if the trait is implemented and in scope
5049
= note: the following traits define an item `take`, perhaps you need to implement one of them:

src/test/ui/mismatched_types/issue-36053-2.stderr

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ LL | pub struct Filter<I, P> {
1010
| ----------------------- this type doesn't satisfy the bound `std::iter::Iterator`
1111
|
1212
= note: the method `count` exists but the following trait bounds were not satisfied:
13-
`&mut std::iter::Filter<std::iter::Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:11:39: 11:53]>: std::iter::Iterator`
1413
`[closure@$DIR/issue-36053-2.rs:11:39: 11:53]: std::ops::FnMut<(&_,)>`
1514
`std::iter::Filter<std::iter::Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:11:39: 11:53]>: std::iter::Iterator`
1615

src/test/ui/suggestions/mut-borrow-needed-by-trait.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
// FIXME: missing sysroot spans (#53081)
2-
// ignore-i586-unknown-linux-gnu
3-
// ignore-i586-unknown-linux-musl
4-
// ignore-i686-unknown-linux-musl
51
use std::env::args;
62
use std::fs::File;
73
use std::io::{stdout, Write, BufWriter};

src/test/ui/suggestions/mut-borrow-needed-by-trait.stderr

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0277]: the trait bound `&dyn std::io::Write: std::io::Write` is not satisfied
2-
--> $DIR/mut-borrow-needed-by-trait.rs:21:29
2+
--> $DIR/mut-borrow-needed-by-trait.rs:17:29
33
|
44
LL | let fp = BufWriter::new(fp);
55
| ^^ the trait `std::io::Write` is not implemented for `&dyn std::io::Write`
@@ -8,7 +8,7 @@ LL | let fp = BufWriter::new(fp);
88
= note: required by `std::io::BufWriter::<W>::new`
99

1010
error[E0277]: the trait bound `&dyn std::io::Write: std::io::Write` is not satisfied
11-
--> $DIR/mut-borrow-needed-by-trait.rs:21:14
11+
--> $DIR/mut-borrow-needed-by-trait.rs:17:14
1212
|
1313
LL | let fp = BufWriter::new(fp);
1414
| ^^^^^^^^^^^^^^ the trait `std::io::Write` is not implemented for `&dyn std::io::Write`
@@ -17,7 +17,7 @@ LL | let fp = BufWriter::new(fp);
1717
= note: required by `std::io::BufWriter`
1818

1919
error[E0277]: the trait bound `&dyn std::io::Write: std::io::Write` is not satisfied
20-
--> $DIR/mut-borrow-needed-by-trait.rs:21:14
20+
--> $DIR/mut-borrow-needed-by-trait.rs:17:14
2121
|
2222
LL | let fp = BufWriter::new(fp);
2323
| ^^^^^^^^^^^^^^^^^^ the trait `std::io::Write` is not implemented for `&dyn std::io::Write`
@@ -26,19 +26,13 @@ LL | let fp = BufWriter::new(fp);
2626
= note: required by `std::io::BufWriter`
2727

2828
error[E0599]: no method named `write_fmt` found for struct `std::io::BufWriter<&dyn std::io::Write>` in the current scope
29-
--> $DIR/mut-borrow-needed-by-trait.rs:26:5
29+
--> $DIR/mut-borrow-needed-by-trait.rs:22:5
3030
|
3131
LL | writeln!(fp, "hello world").unwrap();
3232
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ method not found in `std::io::BufWriter<&dyn std::io::Write>`
33-
|
34-
::: $SRC_DIR/libstd/io/buffered.rs:LL:COL
35-
|
36-
LL | pub struct BufWriter<W: Write> {
37-
| ------------------------------ this type doesn't satisfy the bound `std::io::Write`
3833
|
3934
= note: the method `write_fmt` exists but the following trait bounds were not satisfied:
4035
`&dyn std::io::Write: std::io::Write`
41-
`std::io::BufWriter<&dyn std::io::Write>: std::io::Write`
4236
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
4337

4438
error: aborting due to 4 previous errors

src/test/ui/union/union-derive-clone.stderr

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@ error[E0599]: no method named `clone` found for union `U5<CloneNoCopy>` in the c
1111
--> $DIR/union-derive-clone.rs:37:15
1212
|
1313
LL | union U5<T> {
14-
| -----------
15-
| |
16-
| method `clone` not found for this
17-
| this type doesn't satisfy the bound `std::clone::Clone`
14+
| ----------- method `clone` not found for this
1815
...
1916
LL | struct CloneNoCopy;
2017
| ------------------- this type doesn't satisfy the bound `std::marker::Copy`
@@ -24,7 +21,6 @@ LL | let w = u.clone();
2421
|
2522
= note: the method `clone` exists but the following trait bounds were not satisfied:
2623
`CloneNoCopy: std::marker::Copy`
27-
`U5<CloneNoCopy>: std::clone::Clone`
2824
= help: items from traits can only be used if the trait is implemented and in scope
2925
= note: the following trait defines an item `clone`, perhaps you need to implement it:
3026
candidate #1: `std::clone::Clone`

src/test/ui/unique-object-noncopyable.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
// FIXME: missing sysroot spans (#53081)
2-
// ignore-i586-unknown-linux-gnu
3-
// ignore-i586-unknown-linux-musl
4-
// ignore-i686-unknown-linux-musl
51
#![feature(box_syntax)]
62

73
trait Foo {

src/test/ui/unique-object-noncopyable.stderr

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0599]: no method named `clone` found for struct `std::boxed::Box<dyn Foo>` in the current scope
2-
--> $DIR/unique-object-noncopyable.rs:28:16
2+
--> $DIR/unique-object-noncopyable.rs:24:16
33
|
44
LL | trait Foo {
55
| ---------
@@ -9,16 +9,10 @@ LL | trait Foo {
99
...
1010
LL | let _z = y.clone();
1111
| ^^^^^ method not found in `std::boxed::Box<dyn Foo>`
12-
|
13-
::: $SRC_DIR/liballoc/boxed.rs:LL:COL
14-
|
15-
LL | pub struct Box<T: ?Sized>(Unique<T>);
16-
| ------------------------------------- this type doesn't satisfy the bound `std::clone::Clone`
1712
|
1813
= note: the method `clone` exists but the following trait bounds were not satisfied:
1914
`dyn Foo: std::clone::Clone`
2015
`dyn Foo: std::marker::Sized`
21-
`std::boxed::Box<dyn Foo>: std::clone::Clone`
2216
= help: items from traits can only be used if the trait is implemented and in scope
2317
= note: the following trait defines an item `clone`, perhaps you need to implement it:
2418
candidate #1: `std::clone::Clone`

src/test/ui/unique-pinned-nocopy.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
// FIXME: missing sysroot spans (#53081)
2-
// ignore-i586-unknown-linux-gnu
3-
// ignore-i586-unknown-linux-musl
4-
// ignore-i686-unknown-linux-musl
51
#[derive(Debug)]
62
struct R {
73
b: bool,

src/test/ui/unique-pinned-nocopy.stderr

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
11
error[E0599]: no method named `clone` found for struct `std::boxed::Box<R>` in the current scope
2-
--> $DIR/unique-pinned-nocopy.rs:16:16
2+
--> $DIR/unique-pinned-nocopy.rs:12:16
33
|
44
LL | struct R {
55
| -------- this type doesn't satisfy the bound `std::clone::Clone`
66
...
77
LL | let _j = i.clone();
88
| ^^^^^ method not found in `std::boxed::Box<R>`
9-
|
10-
::: $SRC_DIR/liballoc/boxed.rs:LL:COL
11-
|
12-
LL | pub struct Box<T: ?Sized>(Unique<T>);
13-
| ------------------------------------- this type doesn't satisfy the bound `std::clone::Clone`
149
|
1510
= note: the method `clone` exists but the following trait bounds were not satisfied:
1611
`R: std::clone::Clone`
17-
`std::boxed::Box<R>: std::clone::Clone`
1812
= help: items from traits can only be used if the trait is implemented and in scope
1913
= note: the following trait defines an item `clone`, perhaps you need to implement it:
2014
candidate #1: `std::clone::Clone`

0 commit comments

Comments
 (0)