Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
81e4027
Update RELEASES.md for 1.42.0
XAMPPRocky Feb 9, 2020
26fdcbb
Update RELEASES.md
XAMPPRocky Feb 9, 2020
7ab01b2
Update RELEASES.md
XAMPPRocky Feb 10, 2020
32daa2a
Update RELEASES.md
XAMPPRocky Feb 10, 2020
b030280
Blacklist powerpc-unknown-linux-gnu as having non-ignored GNU C ZSTs.
anyska Feb 18, 2020
9fa8d87
Add more context to E0599 errors
estebank Feb 18, 2020
24bfa16
Reduce vebosity of E0599
estebank Feb 18, 2020
70255ef
On single local candidate, use span label
estebank Feb 18, 2020
2e8399d
Deduplicate information in E0599
estebank Feb 18, 2020
1b4c5b5
Track all predicates in errors, not just trait obligations
estebank Feb 19, 2020
9a7345b
Show information of chain of bound obligations
estebank Feb 19, 2020
615542a
Point at closure definitions
estebank Feb 19, 2020
9245415
Mention the full path of the implementing trait
estebank Feb 19, 2020
cfbb746
Tweak wording
estebank Feb 19, 2020
7818a1d
Suggest constraining type parameters
estebank Feb 19, 2020
3a58953
Account for arbitrary self types in E0599
estebank Feb 19, 2020
529b891
Review comments: split requirement text to multiple lines for readabi…
estebank Feb 21, 2020
5da3939
miri/machine: add canonical_alloc_id hook to replace find_foreign_static
RalfJung Feb 23, 2020
e7a344f
Update RELEASES.md
XAMPPRocky Feb 23, 2020
01d9329
canonicalize alloc ID before calling tag_static_base_pointer
RalfJung Feb 23, 2020
9b62d60
fmt
RalfJung Feb 23, 2020
162d727
Also blacklist powerpc-unknown-linux-musl.
anyska Feb 24, 2020
a66599f
keep predicate order and tweak output
estebank Feb 25, 2020
c02de78
Reduce verbosity when suggesting restricting type params
estebank Feb 25, 2020
0173490
Reword message
estebank Feb 25, 2020
c02e56a
Do not suggest implementing traits if present in predicates
estebank Feb 25, 2020
526280a
Merge branch 'master' into relnotes-1.42.0
XAMPPRocky Feb 26, 2020
e6c8596
Revert "Backport only: avoid ICE on bad placeholder type"
estebank Feb 27, 2020
a7b727d
Account for bounds when denying `_` in type parameters
estebank Feb 13, 2020
c6cfcf9
Account for associated items when denying `_`
estebank Feb 17, 2020
4e0bea3
Stabilize `boxed_slice_try_from`
JohnTitor Feb 28, 2020
85b585d
late resolve, visit_fn: bail early if there's no body.
Centril Feb 28, 2020
35d64ee
Rollup merge of #68989 - XAMPPRocky:relnotes-1.42.0, r=Mark-Simulacrum
Dylan-DPC Feb 28, 2020
0c3a8cd
Rollup merge of #69148 - estebank:cold-as-ice, r=oli-obk
Dylan-DPC Feb 28, 2020
88f66f1
Rollup merge of #69255 - estebank:e0599-details, r=varkor
Dylan-DPC Feb 28, 2020
e5da563
Rollup merge of #69263 - anyska:blacklist-powerpc-zst, r=nagisa
Dylan-DPC Feb 28, 2020
04f5aae
Rollup merge of #69408 - RalfJung:canonical-alloc-id, r=oli-obk
Dylan-DPC Feb 28, 2020
bad53f3
Rollup merge of #69538 - JohnTitor:boxed-slice-try-from, r=Centril
Dylan-DPC Feb 28, 2020
a1b918a
Rollup merge of #69539 - Centril:fix-69401, r=petrochenkov
Dylan-DPC Feb 28, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Deduplicate information in E0599
  • Loading branch information
estebank committed Feb 21, 2020
commit 2e8399de22a10463bde964595bbad1b2d75cb40f
54 changes: 36 additions & 18 deletions src/librustc_typeck/check/method/suggest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -538,16 +538,25 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
let mut bound_spans = vec![];
let mut bound_list = unsatisfied_predicates
.iter()
.map(|p| {
.filter_map(|p| {
let self_ty = p.self_ty();
match &self_ty.kind {
ty::Adt(def, _) => bound_spans.push((
self.tcx.sess.source_map().def_span(self.tcx.def_span(def.did)),
format!(
"this type doesn't satisfy the bound `{}`",
p.print_only_trait_path()
),
)),
ty::Adt(def, _) => {
bound_spans.push((
self.tcx
.sess
.source_map()
.def_span(self.tcx.def_span(def.did)),
format!(
"the method `{}` exists but this type doesn't satisfy \
the bound `{}: {}`",
item_name,
p.self_ty(),
p.print_only_trait_path()
),
));
None
}
ty::Dynamic(preds, _) => {
for pred in *preds.skip_binder() {
match pred {
Expand All @@ -558,18 +567,25 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
.source_map()
.def_span(self.tcx.def_span(tr.def_id)),
format!(
"this trait doesn't satisfy the bound `{}`",
"the method `{}` exists but this trait \
doesn't satisfy the bound `{}: {}`",
item_name,
p.self_ty(),
p.print_only_trait_path()
),
)),
ty::ExistentialPredicate::Projection(_)
| ty::ExistentialPredicate::AutoTrait(_) => {}
}
}
None
}
_ => {}
};
format!("`{}: {}`", p.self_ty(), p.print_only_trait_path())
_ => Some(format!(
"`{}: {}`",
p.self_ty(),
p.print_only_trait_path()
)),
}
})
.collect::<Vec<_>>();
bound_list.sort();
Expand All @@ -579,12 +595,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
for (span, msg) in bound_spans.into_iter() {
err.span_label(span, &msg);
}
let bound_list = bound_list.join("\n");
err.note(&format!(
"the method `{}` exists but the following trait bounds were not \
satisfied:\n{}",
item_name, bound_list
));
if !bound_list.is_empty() {
let bound_list = bound_list.join("\n");
err.note(&format!(
"the method `{}` exists but the following trait bounds were not \
satisfied:\n{}",
item_name, bound_list
));
}
}

if actual.is_numeric() && actual.is_fresh() {
Expand Down
4 changes: 1 addition & 3 deletions src/test/ui/derives/derive-assoc-type-not-impl.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@ LL | struct Bar<T: Foo> {
| ------------------ method `clone` not found for this
...
LL | struct NotClone;
| ---------------- this type doesn't satisfy the bound `std::clone::Clone`
| ---------------- the method `clone` exists but this type doesn't satisfy the bound `NotClone: std::clone::Clone`
...
LL | Bar::<NotClone> { x: 1 }.clone();
| ^^^^^ method not found in `Bar<NotClone>`
|
= note: the method `clone` exists but the following trait bounds were not satisfied:
`NotClone: std::clone::Clone`
= help: items from traits can only be used if the trait is implemented and in scope
= note: the following trait defines an item `clone`, perhaps you need to implement it:
candidate #1: `std::clone::Clone`
Expand Down
5 changes: 1 addition & 4 deletions src/test/ui/issues/issue-31173.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ LL | .collect();
::: $SRC_DIR/libcore/iter/adapters/mod.rs:LL:COL
|
LL | pub struct Cloned<I> {
| -------------------- this type doesn't satisfy the bound `std::iter::Iterator`
|
= note: the method `collect` exists but the following trait bounds were not satisfied:
`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`
| -------------------- the method `collect` exists but this type doesn't satisfy the bound `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`

error: aborting due to 2 previous errors

Expand Down
4 changes: 1 addition & 3 deletions src/test/ui/methods/method-call-err-msg.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,11 @@ LL | pub struct Foo;
| ---------------
| |
| method `take` not found for this
| this type doesn't satisfy the bound `std::iter::Iterator`
| the method `take` exists but this type doesn't satisfy the bound `Foo: std::iter::Iterator`
...
LL | .take()
| ^^^^ method not found in `Foo`
|
= note: the method `take` exists but the following trait bounds were not satisfied:
`Foo: std::iter::Iterator`
= help: items from traits can only be used if the trait is implemented and in scope
= note: the following traits define an item `take`, perhaps you need to implement one of them:
candidate #1: `std::io::Read`
Expand Down
3 changes: 1 addition & 2 deletions src/test/ui/mismatched_types/issue-36053-2.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ LL | once::<&str>("str").fuse().filter(|a: &str| true).count();
::: $SRC_DIR/libcore/iter/adapters/mod.rs:LL:COL
|
LL | pub struct Filter<I, P> {
| ----------------------- this type doesn't satisfy the bound `std::iter::Iterator`
| ----------------------- the method `count` exists but this type doesn't satisfy the bound `std::iter::Filter<std::iter::Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:11:39: 11:53]>: std::iter::Iterator`
|
= note: the method `count` exists but the following trait bounds were not satisfied:
`[closure@$DIR/issue-36053-2.rs:11:39: 11:53]: std::ops::FnMut<(&_,)>`
`std::iter::Filter<std::iter::Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:11:39: 11:53]>: std::iter::Iterator`

error[E0631]: type mismatch in closure arguments
--> $DIR/issue-36053-2.rs:11:32
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@ error[E0599]: no method named `unwrap` found for enum `std::result::Result<(), F
--> $DIR/method-help-unsatisfied-bound.rs:5:7
|
LL | struct Foo;
| ----------- this type doesn't satisfy the bound `std::fmt::Debug`
| ----------- the method `unwrap` exists but this type doesn't satisfy the bound `Foo: std::fmt::Debug`
...
LL | a.unwrap();
| ^^^^^^ method not found in `std::result::Result<(), Foo>`
|
= note: the method `unwrap` exists but the following trait bounds were not satisfied:
`Foo: std::fmt::Debug`

error: aborting due to previous error

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@ LL | struct MyStruct;
| ----------------
| |
| method `foo_one` not found for this
| this type doesn't satisfy the bound `Foo`
| the method `foo_one` exists but this type doesn't satisfy the bound `MyStruct: Foo`
...
LL | println!("{}", MyStruct.foo_one());
| ^^^^^^^ method not found in `MyStruct`
|
= note: the method `foo_one` exists but the following trait bounds were not satisfied:
`MyStruct: Foo`
= help: items from traits can only be used if the trait is implemented and in scope

error: aborting due to previous error
Expand Down
4 changes: 1 addition & 3 deletions src/test/ui/union/union-derive-clone.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@ LL | union U5<T> {
| ----------- method `clone` not found for this
...
LL | struct CloneNoCopy;
| ------------------- this type doesn't satisfy the bound `std::marker::Copy`
| ------------------- the method `clone` exists but this type doesn't satisfy the bound `CloneNoCopy: std::marker::Copy`
...
LL | let w = u.clone();
| ^^^^^ method not found in `U5<CloneNoCopy>`
|
= note: the method `clone` exists but the following trait bounds were not satisfied:
`CloneNoCopy: std::marker::Copy`
= help: items from traits can only be used if the trait is implemented and in scope
= note: the following trait defines an item `clone`, perhaps you need to implement it:
candidate #1: `std::clone::Clone`
Expand Down
7 changes: 2 additions & 5 deletions src/test/ui/unique-object-noncopyable.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,12 @@ error[E0599]: no method named `clone` found for struct `std::boxed::Box<dyn Foo>
LL | trait Foo {
| ---------
| |
| this trait doesn't satisfy the bound `std::clone::Clone`
| this trait doesn't satisfy the bound `std::marker::Sized`
| the method `clone` exists but this trait doesn't satisfy the bound `dyn Foo: std::clone::Clone`
| the method `clone` exists but this trait doesn't satisfy the bound `dyn Foo: std::marker::Sized`
...
LL | let _z = y.clone();
| ^^^^^ method not found in `std::boxed::Box<dyn Foo>`
|
= note: the method `clone` exists but the following trait bounds were not satisfied:
`dyn Foo: std::clone::Clone`
`dyn Foo: std::marker::Sized`
= help: items from traits can only be used if the trait is implemented and in scope
= note: the following trait defines an item `clone`, perhaps you need to implement it:
candidate #1: `std::clone::Clone`
Expand Down
4 changes: 1 addition & 3 deletions src/test/ui/unique-pinned-nocopy.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ error[E0599]: no method named `clone` found for struct `std::boxed::Box<R>` in t
--> $DIR/unique-pinned-nocopy.rs:12:16
|
LL | struct R {
| -------- this type doesn't satisfy the bound `std::clone::Clone`
| -------- the method `clone` exists but this type doesn't satisfy the bound `R: std::clone::Clone`
...
LL | let _j = i.clone();
| ^^^^^ method not found in `std::boxed::Box<R>`
|
= note: the method `clone` exists but the following trait bounds were not satisfied:
`R: std::clone::Clone`
= help: items from traits can only be used if the trait is implemented and in scope
= note: the following trait defines an item `clone`, perhaps you need to implement it:
candidate #1: `std::clone::Clone`
Expand Down