Skip to content

Commit 529b891

Browse files
committed
Review comments: split requirement text to multiple lines for readability
1 parent 3a58953 commit 529b891

11 files changed

+33
-17
lines changed

src/librustc_typeck/check/method/suggest.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
639639
None => format!("`{}`", p),
640640
Some((parent_p, _)) => {
641641
collect_type_param_suggestions(self_ty, parent_pred, &p);
642-
format!("`{}` which is required by `{}`", p, parent_p)
642+
format!("`{}`\nwhich is required by `{}`", p, parent_p)
643643
}
644644
},
645645
})

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ LL | Bar::<NotClone> { x: 1 }.clone();
1414
| ^^^^^ method not found in `Bar<NotClone>`
1515
|
1616
= note: the method `clone` exists but the following trait bounds were not satisfied:
17-
`NotClone: std::clone::Clone` which is required by `Bar<NotClone>: std::clone::Clone`
17+
`NotClone: std::clone::Clone`
18+
which is required by `Bar<NotClone>: std::clone::Clone`
1819
= help: items from traits can only be used if the trait is implemented and in scope
1920
= note: the following trait defines an item `clone`, perhaps you need to implement it:
2021
candidate #1: `std::clone::Clone`

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ LL | println!("{}", z.to_string());
77
= 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
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:
10-
`*const u8: std::fmt::Display` which is required by `*const u8: std::string::ToString`
10+
`*const u8: std::fmt::Display`
11+
which is required by `*const u8: std::string::ToString`
1112

1213
error: aborting due to previous error
1314

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

+4-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ LL | pub struct TakeWhile<I, P> {
2222
| -------------------------- doesn't satisfy `<_ as std::iter::Iterator>::Item = &_`
2323
|
2424
= note: the method `collect` exists but the following trait bounds were not satisfied:
25-
`<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`
26-
`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`
25+
`<std::iter::TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:10:39: 13:6 found_e:_]> as std::iter::Iterator>::Item = &_`
26+
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`
27+
`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`
28+
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`
2729

2830
error: aborting due to 2 previous errors
2931

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ LL | .take()
4444
| ^^^^ method not found in `Foo`
4545
|
4646
= note: the method `take` exists but the following trait bounds were not satisfied:
47-
`Foo: std::iter::Iterator` which is required by `&mut Foo: std::iter::Iterator`
47+
`Foo: std::iter::Iterator`
48+
which is required by `&mut Foo: std::iter::Iterator`
4849
= help: items from traits can only be used if the trait is implemented and in scope
4950
= note: the following traits define an item `take`, perhaps you need to implement one of them:
5051
candidate #1: `std::io::Read`

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

+6-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,12 @@ LL | pub struct Filter<I, P> {
1313
| ----------------------- doesn't satisfy `_: std::iter::Iterator`
1414
|
1515
= note: the method `count` exists but the following trait bounds were not satisfied:
16-
`<[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`
17-
`[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`
18-
`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`
16+
`<[closure@$DIR/issue-36053-2.rs:11:39: 11:53] as std::ops::FnOnce<(&&str,)>>::Output = bool`
17+
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`
18+
`[closure@$DIR/issue-36053-2.rs:11:39: 11:53]: std::ops::FnMut<(&&str,)>`
19+
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`
20+
`std::iter::Filter<std::iter::Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:11:39: 11:53]>: std::iter::Iterator`
21+
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`
1922

2023
error[E0631]: type mismatch in closure arguments
2124
--> $DIR/issue-36053-2.rs:11:32

src/test/ui/suggestions/missing-trait-bounds-for-method-call.stderr

+6-3
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ LL | self.foo();
1111
| ^^^ method not found in `&Foo<T>`
1212
|
1313
= note: the method `foo` exists but the following trait bounds were not satisfied:
14-
`T: Bar` which is required by `Foo<T>: Bar`
15-
`T: std::default::Default` which is required by `Foo<T>: Bar`
14+
`T: Bar`
15+
which is required by `Foo<T>: Bar`
16+
`T: std::default::Default`
17+
which is required by `Foo<T>: Bar`
1618
= help: items from traits can only be used if the trait is implemented and in scope
1719
help: consider restricting the type parameters to satisfy the obligations
1820
|
@@ -32,7 +34,8 @@ LL | self.foo();
3234
| ^^^ method not found in `&Fin<T>`
3335
|
3436
= note: the method `foo` exists but the following trait bounds were not satisfied:
35-
`T: std::default::Default` which is required by `Fin<T>: Bar`
37+
`T: std::default::Default`
38+
which is required by `Fin<T>: Bar`
3639
= help: items from traits can only be used if the trait is implemented and in scope
3740
help: consider restricting the type parameter to satisfy the obligation
3841
|

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ LL | pub struct BufWriter<W: Write> {
3737
| ------------------------------ doesn't satisfy `_: std::io::Write`
3838
|
3939
= note: the method `write_fmt` exists but the following trait bounds were not satisfied:
40-
`&dyn std::io::Write: std::io::Write` which is required by `std::io::BufWriter<&dyn std::io::Write>: std::io::Write`
40+
`&dyn std::io::Write: std::io::Write`
41+
which is required by `std::io::BufWriter<&dyn std::io::Write>: std::io::Write`
4142
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
4243

4344
error: aborting due to 4 previous errors

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ LL | let w = u.clone();
2323
| ^^^^^ method not found in `U5<CloneNoCopy>`
2424
|
2525
= note: the method `clone` exists but the following trait bounds were not satisfied:
26-
`CloneNoCopy: std::marker::Copy` which is required by `U5<CloneNoCopy>: std::clone::Clone`
26+
`CloneNoCopy: std::marker::Copy`
27+
which is required by `U5<CloneNoCopy>: std::clone::Clone`
2728
= help: items from traits can only be used if the trait is implemented and in scope
2829
= note: the following trait defines an item `clone`, perhaps you need to implement it:
2930
candidate #1: `std::clone::Clone`

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

+4-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ LL | pub struct Box<T: ?Sized>(Unique<T>);
1616
| ------------------------------------- doesn't satisfy `std::boxed::Box<dyn Foo>: std::clone::Clone`
1717
|
1818
= note: the method `clone` exists but the following trait bounds were not satisfied:
19-
`dyn Foo: std::clone::Clone` which is required by `std::boxed::Box<dyn Foo>: std::clone::Clone`
20-
`dyn Foo: std::marker::Sized` which is required by `std::boxed::Box<dyn Foo>: std::clone::Clone`
19+
`dyn Foo: std::clone::Clone`
20+
which is required by `std::boxed::Box<dyn Foo>: std::clone::Clone`
21+
`dyn Foo: std::marker::Sized`
22+
which is required by `std::boxed::Box<dyn Foo>: std::clone::Clone`
2123
= help: items from traits can only be used if the trait is implemented and in scope
2224
= note: the following trait defines an item `clone`, perhaps you need to implement it:
2325
candidate #1: `std::clone::Clone`

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ LL | pub struct Box<T: ?Sized>(Unique<T>);
1313
| ------------------------------------- doesn't satisfy `std::boxed::Box<R>: std::clone::Clone`
1414
|
1515
= note: the method `clone` exists but the following trait bounds were not satisfied:
16-
`R: std::clone::Clone` which is required by `std::boxed::Box<R>: std::clone::Clone`
16+
`R: std::clone::Clone`
17+
which is required by `std::boxed::Box<R>: std::clone::Clone`
1718
= help: items from traits can only be used if the trait is implemented and in scope
1819
= note: the following trait defines an item `clone`, perhaps you need to implement it:
1920
candidate #1: `std::clone::Clone`

0 commit comments

Comments
 (0)