Skip to content

Commit

Permalink
Review comments: split requirement text to multiple lines for readabi…
Browse files Browse the repository at this point in the history
…lity
  • Loading branch information
estebank committed Feb 21, 2020
1 parent 3a58953 commit 529b891
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/librustc_typeck/check/method/suggest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
None => format!("`{}`", p),
Some((parent_p, _)) => {
collect_type_param_suggestions(self_ty, parent_pred, &p);
format!("`{}` which is required by `{}`", p, parent_p)
format!("`{}`\nwhich is required by `{}`", p, parent_p)
}
},
})
Expand Down
3 changes: 2 additions & 1 deletion src/test/ui/derives/derive-assoc-type-not-impl.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ 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` which is required by `Bar<NotClone>: std::clone::Clone`
`NotClone: std::clone::Clone`
which is required by `Bar<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
3 changes: 2 additions & 1 deletion src/test/ui/issues/issue-21596.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ LL | println!("{}", z.to_string());
= note: try using `<*const T>::as_ref()` to get a reference to the type behind the pointer: https://doc.rust-lang.org/std/primitive.pointer.html#method.as_ref
= note: using `<*const T>::as_ref()` on a pointer which is unaligned or points to invalid or uninitialized memory is undefined behavior
= note: the method `to_string` exists but the following trait bounds were not satisfied:
`*const u8: std::fmt::Display` which is required by `*const u8: std::string::ToString`
`*const u8: std::fmt::Display`
which is required by `*const u8: std::string::ToString`

error: aborting due to previous error

Expand Down
6 changes: 4 additions & 2 deletions src/test/ui/issues/issue-31173.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ LL | pub struct TakeWhile<I, P> {
| -------------------------- doesn't satisfy `<_ as std::iter::Iterator>::Item = &_`
|
= note: the method `collect` exists but the following trait bounds were not satisfied:
`<std::iter::TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:10:39: 13:6 found_e:_]> as std::iter::Iterator>::Item = &_` which is required by `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`
`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` which is required by `&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`
`<std::iter::TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:10:39: 13:6 found_e:_]> as std::iter::Iterator>::Item = &_`
which is required by `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`
`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`
which is required by `&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`

error: aborting due to 2 previous errors

Expand Down
3 changes: 2 additions & 1 deletion src/test/ui/methods/method-call-err-msg.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ LL | .take()
| ^^^^ method not found in `Foo`
|
= note: the method `take` exists but the following trait bounds were not satisfied:
`Foo: std::iter::Iterator` which is required by `&mut Foo: std::iter::Iterator`
`Foo: std::iter::Iterator`
which is required by `&mut 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
9 changes: 6 additions & 3 deletions src/test/ui/mismatched_types/issue-36053-2.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@ LL | pub struct Filter<I, P> {
| ----------------------- doesn't satisfy `_: 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] as std::ops::FnOnce<(&&str,)>>::Output = bool` which is required by `std::iter::Filter<std::iter::Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:11:39: 11:53]>: std::iter::Iterator`
`[closure@$DIR/issue-36053-2.rs:11:39: 11:53]: std::ops::FnMut<(&&str,)>` which is required by `std::iter::Filter<std::iter::Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:11:39: 11:53]>: std::iter::Iterator`
`std::iter::Filter<std::iter::Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:11:39: 11:53]>: std::iter::Iterator` which is required by `&mut std::iter::Filter<std::iter::Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:11:39: 11:53]>: std::iter::Iterator`
`<[closure@$DIR/issue-36053-2.rs:11:39: 11:53] as std::ops::FnOnce<(&&str,)>>::Output = bool`
which is required by `std::iter::Filter<std::iter::Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:11:39: 11:53]>: std::iter::Iterator`
`[closure@$DIR/issue-36053-2.rs:11:39: 11:53]: std::ops::FnMut<(&&str,)>`
which is required by `std::iter::Filter<std::iter::Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:11:39: 11:53]>: std::iter::Iterator`
`std::iter::Filter<std::iter::Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:11:39: 11:53]>: std::iter::Iterator`
which is required by `&mut 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 @@ -11,8 +11,10 @@ LL | self.foo();
| ^^^ method not found in `&Foo<T>`
|
= note: the method `foo` exists but the following trait bounds were not satisfied:
`T: Bar` which is required by `Foo<T>: Bar`
`T: std::default::Default` which is required by `Foo<T>: Bar`
`T: Bar`
which is required by `Foo<T>: Bar`
`T: std::default::Default`
which is required by `Foo<T>: Bar`
= help: items from traits can only be used if the trait is implemented and in scope
help: consider restricting the type parameters to satisfy the obligations
|
Expand All @@ -32,7 +34,8 @@ LL | self.foo();
| ^^^ method not found in `&Fin<T>`
|
= note: the method `foo` exists but the following trait bounds were not satisfied:
`T: std::default::Default` which is required by `Fin<T>: Bar`
`T: std::default::Default`
which is required by `Fin<T>: Bar`
= help: items from traits can only be used if the trait is implemented and in scope
help: consider restricting the type parameter to satisfy the obligation
|
Expand Down
3 changes: 2 additions & 1 deletion src/test/ui/suggestions/mut-borrow-needed-by-trait.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ LL | pub struct BufWriter<W: Write> {
| ------------------------------ doesn't satisfy `_: std::io::Write`
|
= note: the method `write_fmt` exists but the following trait bounds were not satisfied:
`&dyn std::io::Write: std::io::Write` which is required by `std::io::BufWriter<&dyn std::io::Write>: std::io::Write`
`&dyn std::io::Write: std::io::Write`
which is required by `std::io::BufWriter<&dyn std::io::Write>: std::io::Write`
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to 4 previous errors
Expand Down
3 changes: 2 additions & 1 deletion src/test/ui/union/union-derive-clone.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ 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` which is required by `U5<CloneNoCopy>: std::clone::Clone`
`CloneNoCopy: std::marker::Copy`
which is required by `U5<CloneNoCopy>: 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
6 changes: 4 additions & 2 deletions src/test/ui/unique-object-noncopyable.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ LL | pub struct Box<T: ?Sized>(Unique<T>);
| ------------------------------------- doesn't satisfy `std::boxed::Box<dyn Foo>: std::clone::Clone`
|
= note: the method `clone` exists but the following trait bounds were not satisfied:
`dyn Foo: std::clone::Clone` which is required by `std::boxed::Box<dyn Foo>: std::clone::Clone`
`dyn Foo: std::marker::Sized` which is required by `std::boxed::Box<dyn Foo>: std::clone::Clone`
`dyn Foo: std::clone::Clone`
which is required by `std::boxed::Box<dyn Foo>: std::clone::Clone`
`dyn Foo: std::marker::Sized`
which is required by `std::boxed::Box<dyn Foo>: 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
3 changes: 2 additions & 1 deletion src/test/ui/unique-pinned-nocopy.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ LL | pub struct Box<T: ?Sized>(Unique<T>);
| ------------------------------------- doesn't satisfy `std::boxed::Box<R>: std::clone::Clone`
|
= note: the method `clone` exists but the following trait bounds were not satisfied:
`R: std::clone::Clone` which is required by `std::boxed::Box<R>: std::clone::Clone`
`R: std::clone::Clone`
which is required by `std::boxed::Box<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

0 comments on commit 529b891

Please sign in to comment.