diff options
| author | Michael Goulet <michael@errs.io> | 2022-06-05 17:37:45 -0700 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2022-06-11 16:27:01 -0700 |
| commit | 9c47afe9fac56b71644c91ec91debd9a1f4424b1 (patch) | |
| tree | f502ccea3a65640b1b553baa719ed615045e8143 /src/test | |
| parent | 8506b7d4e081cf99751022440147e9ac4845c99d (diff) | |
| download | rust-9c47afe9fac56b71644c91ec91debd9a1f4424b1.tar.gz rust-9c47afe9fac56b71644c91ec91debd9a1f4424b1.zip | |
Handle empty where-clause better
Diffstat (limited to 'src/test')
13 files changed, 31 insertions, 14 deletions
diff --git a/src/test/ui/issues/issue-35668.stderr b/src/test/ui/issues/issue-35668.stderr index 07409e9834a..84add5799ab 100644 --- a/src/test/ui/issues/issue-35668.stderr +++ b/src/test/ui/issues/issue-35668.stderr @@ -6,7 +6,7 @@ LL | a.iter().map(|a| a*a) | | | &T | -help: consider introducing a `where` bound, but there might be an alternative better way to express this requirement +help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | LL | fn func<'a, T>(a: &'a [T]) -> impl Iterator<Item=&'a T> where &T: Mul<&T> { | +++++++++++++++++ diff --git a/src/test/ui/partialeq_help.rs b/src/test/ui/partialeq_help.rs index c3ba805405b..34b88b8a866 100644 --- a/src/test/ui/partialeq_help.rs +++ b/src/test/ui/partialeq_help.rs @@ -2,6 +2,11 @@ fn foo<T: PartialEq>(a: &T, b: T) { a == b; //~ ERROR E0277 } +fn foo2<T: PartialEq>(a: &T, b: T) where { + a == b; //~ ERROR E0277 +} + fn main() { foo(&1, 1); + foo2(&1, 1); } diff --git a/src/test/ui/partialeq_help.stderr b/src/test/ui/partialeq_help.stderr index 528306b22dd..fdff94f425c 100644 --- a/src/test/ui/partialeq_help.stderr +++ b/src/test/ui/partialeq_help.stderr @@ -5,11 +5,23 @@ LL | a == b; | ^^ no implementation for `&T == T` | = help: the trait `PartialEq<T>` is not implemented for `&T` -help: consider introducing a `where` bound, but there might be an alternative better way to express this requirement +help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | LL | fn foo<T: PartialEq>(a: &T, b: T) where &T: PartialEq<T> { | ++++++++++++++++++++++ -error: aborting due to previous error +error[E0277]: can't compare `&T` with `T` + --> $DIR/partialeq_help.rs:6:7 + | +LL | a == b; + | ^^ no implementation for `&T == T` + | + = help: the trait `PartialEq<T>` is not implemented for `&T` +help: consider extending the `where` clause, but there might be an alternative better way to express this requirement + | +LL | fn foo2<T: PartialEq>(a: &T, b: T) where &T: PartialEq<T> { + | ++++++++++++++++ + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/rfc-2632-const-trait-impl/assoc-type.stderr b/src/test/ui/rfc-2632-const-trait-impl/assoc-type.stderr index 0788b17a1c0..64501c52374 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/assoc-type.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/assoc-type.stderr @@ -15,7 +15,7 @@ note: required by a bound in `Foo::Bar` | LL | type Bar: ~const std::ops::Add; | ^^^^^^^^^^^^^^^^^^^^ required by this bound in `Foo::Bar` -help: consider introducing a `where` bound, but there might be an alternative better way to express this requirement +help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | LL | impl const Foo for NonConstAdd where NonConstAdd: ~const Add { | +++++++++++++++++++++++++++++ diff --git a/src/test/ui/rfc-2632-const-trait-impl/default-method-body-is-const-body-checking.stderr b/src/test/ui/rfc-2632-const-trait-impl/default-method-body-is-const-body-checking.stderr index 668e166c298..7542b81fe2a 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/default-method-body-is-const-body-checking.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/default-method-body-is-const-body-checking.stderr @@ -14,7 +14,7 @@ note: required by a bound in `foo` | LL | const fn foo<T>() where T: ~const Tr {} | ^^^^^^^^^ required by this bound in `foo` -help: consider introducing a `where` bound, but there might be an alternative better way to express this requirement +help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | LL | pub trait Foo where (): ~const Tr { | +++++++++++++++++++ diff --git a/src/test/ui/specialization/default-associated-type-bound-2.stderr b/src/test/ui/specialization/default-associated-type-bound-2.stderr index 0fd1f65b0a2..91778ed0f4c 100644 --- a/src/test/ui/specialization/default-associated-type-bound-2.stderr +++ b/src/test/ui/specialization/default-associated-type-bound-2.stderr @@ -20,7 +20,7 @@ note: required by a bound in `X::U` | LL | type U: PartialEq<T>; | ^^^^^^^^^^^^ required by this bound in `X::U` -help: consider introducing a `where` bound, but there might be an alternative better way to express this requirement +help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | LL | impl<B: 'static, T> X<B> for T where &'static B: PartialEq<B> { | ++++++++++++++++++++++++++++++ diff --git a/src/test/ui/suggestions/derive-macro-missing-bounds.stderr b/src/test/ui/suggestions/derive-macro-missing-bounds.stderr index 75658f58c8a..501d083e2bc 100644 --- a/src/test/ui/suggestions/derive-macro-missing-bounds.stderr +++ b/src/test/ui/suggestions/derive-macro-missing-bounds.stderr @@ -13,7 +13,7 @@ help: consider annotating `a::Inner<T>` with `#[derive(Debug)]` | LL | #[derive(Debug)] | -help: consider introducing a `where` bound, but there might be an alternative better way to express this requirement +help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | LL | struct Outer<T>(Inner<T>) where a::Inner<T>: Debug; | ++++++++++++++++++++++++ diff --git a/src/test/ui/suggestions/invalid-bin-op.stderr b/src/test/ui/suggestions/invalid-bin-op.stderr index fe5e2b5816f..94bd2d41565 100644 --- a/src/test/ui/suggestions/invalid-bin-op.stderr +++ b/src/test/ui/suggestions/invalid-bin-op.stderr @@ -15,7 +15,7 @@ help: consider annotating `S<T>` with `#[derive(PartialEq)]` | LL | #[derive(PartialEq)] | -help: consider introducing a `where` bound, but there might be an alternative better way to express this requirement +help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | LL | pub fn foo<T>(s: S<T>, t: S<T>) where S<T>: PartialEq { | +++++++++++++++++++++ diff --git a/src/test/ui/suggestions/suggest-change-mut.rs b/src/test/ui/suggestions/suggest-change-mut.rs index a2bc6fd09b5..47dc7c343da 100644 --- a/src/test/ui/suggestions/suggest-change-mut.rs +++ b/src/test/ui/suggestions/suggest-change-mut.rs @@ -2,7 +2,7 @@ use std::io::{BufRead, BufReader, Read, Write}; -fn issue_81421<T: Read + Write>(mut stream: T) { //~ HELP consider introducing a `where` bound +fn issue_81421<T: Read + Write>(mut stream: T) { //~ HELP consider introducing a `where` clause let initial_message = format!("Hello world"); let mut buffer: Vec<u8> = Vec::new(); let bytes_written = stream.write_all(initial_message.as_bytes()); diff --git a/src/test/ui/suggestions/suggest-change-mut.stderr b/src/test/ui/suggestions/suggest-change-mut.stderr index 2fa69cd5a2c..be549239e36 100644 --- a/src/test/ui/suggestions/suggest-change-mut.stderr +++ b/src/test/ui/suggestions/suggest-change-mut.stderr @@ -16,7 +16,7 @@ help: consider removing the leading `&`-reference LL - let mut stream_reader = BufReader::new(&stream); LL + let mut stream_reader = BufReader::new(stream); | -help: consider introducing a `where` bound, but there might be an alternative better way to express this requirement +help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | LL | fn issue_81421<T: Read + Write>(mut stream: T) where &T: std::io::Read { | +++++++++++++++++++++++ diff --git a/src/test/ui/traits/resolution-in-overloaded-op.stderr b/src/test/ui/traits/resolution-in-overloaded-op.stderr index 3ae6bf130cc..34fae64e4d2 100644 --- a/src/test/ui/traits/resolution-in-overloaded-op.stderr +++ b/src/test/ui/traits/resolution-in-overloaded-op.stderr @@ -6,7 +6,7 @@ LL | a * b | | | &T | -help: consider introducing a `where` bound, but there might be an alternative better way to express this requirement +help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | LL | fn foo<T: MyMul<f64, f64>>(a: &T, b: f64) -> f64 where &T: Mul<f64> { | ++++++++++++++++++ diff --git a/src/test/ui/traits/suggest-where-clause.stderr b/src/test/ui/traits/suggest-where-clause.stderr index e2cdd368888..520ee0b5ea7 100644 --- a/src/test/ui/traits/suggest-where-clause.stderr +++ b/src/test/ui/traits/suggest-where-clause.stderr @@ -49,7 +49,7 @@ error[E0277]: the trait bound `u64: From<T>` is not satisfied LL | <u64 as From<T>>::from; | ^^^^^^^^^^^^^^^^^^^^^^ the trait `From<T>` is not implemented for `u64` | -help: consider introducing a `where` bound, but there might be an alternative better way to express this requirement +help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | LL | fn check<T: Iterator, U: ?Sized>() where u64: From<T> { | ++++++++++++++++++ @@ -60,7 +60,7 @@ error[E0277]: the trait bound `u64: From<<T as Iterator>::Item>` is not satisfie LL | <u64 as From<<T as Iterator>::Item>>::from; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `From<<T as Iterator>::Item>` is not implemented for `u64` | -help: consider introducing a `where` bound, but there might be an alternative better way to express this requirement +help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | LL | fn check<T: Iterator, U: ?Sized>() where u64: From<<T as Iterator>::Item> { | ++++++++++++++++++++++++++++++++++++++ diff --git a/src/test/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn.stderr b/src/test/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn.stderr index f4d8b4509d4..198f3e26393 100644 --- a/src/test/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn.stderr +++ b/src/test/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn.stderr @@ -5,7 +5,7 @@ LL | (a, a) | ^ the trait `From<&A>` is not implemented for `&'static B` | = note: required because of the requirements on the impl of `Into<&'static B>` for `&A` -help: consider introducing a `where` bound, but there might be an alternative better way to express this requirement +help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | LL | fn f<A, B: 'static>(a: &'static A, b: B) -> (X<A, B>, X<B, A>) where &'static B: From<&A> { | ++++++++++++++++++++++++++ |
