diff options
| author | bors <bors@rust-lang.org> | 2023-06-03 07:25:40 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-06-03 07:25:40 +0000 |
| commit | 8177591aecf9c2ab1e96ba7fe2c00753f26a2011 (patch) | |
| tree | 18369d32f59c65f5fb69fb66762340aeeb5e8fe2 /tests | |
| parent | 7d5b746e1c83f23bc015e73582e102528f05db24 (diff) | |
| parent | c5604cd0b58f1f2c527ae76dac75a94c7dd23824 (diff) | |
| download | rust-8177591aecf9c2ab1e96ba7fe2c00753f26a2011.tar.gz rust-8177591aecf9c2ab1e96ba7fe2c00753f26a2011.zip | |
Auto merge of #111516 - compiler-errors:issue-111500, r=jackh726
Don't use `can_eq` in `derive(..)` suggestion for missing method Unsatisfied predicates returned from method probe may reference inference vars from that probe, so drop this extra check I added in #110877 for more accurate derive suggestions... Fixes #111500
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/issues/issue-62375.stderr | 7 | ||||
| -rw-r--r-- | tests/ui/typeck/derive-sugg-arg-arity.rs | 8 | ||||
| -rw-r--r-- | tests/ui/typeck/derive-sugg-arg-arity.stderr | 31 |
3 files changed, 44 insertions, 2 deletions
diff --git a/tests/ui/issues/issue-62375.stderr b/tests/ui/issues/issue-62375.stderr index cd632e64fe5..f6d7968c0c4 100644 --- a/tests/ui/issues/issue-62375.stderr +++ b/tests/ui/issues/issue-62375.stderr @@ -11,8 +11,11 @@ note: an implementation of `PartialEq<fn(()) -> A {A::Value}>` might be missing | LL | enum A { | ^^^^^^ must implement `PartialEq<fn(()) -> A {A::Value}>` -note: the trait `PartialEq` must be implemented - --> $SRC_DIR/core/src/cmp.rs:LL:COL +help: consider annotating `A` with `#[derive(PartialEq)]` + | +LL + #[derive(PartialEq)] +LL | enum A { + | help: use parentheses to construct this tuple variant | LL | a == A::Value(/* () */); diff --git a/tests/ui/typeck/derive-sugg-arg-arity.rs b/tests/ui/typeck/derive-sugg-arg-arity.rs new file mode 100644 index 00000000000..094c93a8535 --- /dev/null +++ b/tests/ui/typeck/derive-sugg-arg-arity.rs @@ -0,0 +1,8 @@ +pub struct A; + +fn main() { + match () { + _ => match A::partial_cmp() {}, + //~^ ERROR the function or associated item `partial_cmp` exists for struct `A`, but its trait bounds were not satisfied + } +} diff --git a/tests/ui/typeck/derive-sugg-arg-arity.stderr b/tests/ui/typeck/derive-sugg-arg-arity.stderr new file mode 100644 index 00000000000..5b4c4817198 --- /dev/null +++ b/tests/ui/typeck/derive-sugg-arg-arity.stderr @@ -0,0 +1,31 @@ +error[E0599]: the function or associated item `partial_cmp` exists for struct `A`, but its trait bounds were not satisfied + --> $DIR/derive-sugg-arg-arity.rs:5:23 + | +LL | pub struct A; + | ------------ + | | + | function or associated item `partial_cmp` not found for this struct + | doesn't satisfy `A: Iterator` + | doesn't satisfy `A: PartialOrd<_>` +... +LL | _ => match A::partial_cmp() {}, + | ^^^^^^^^^^^ function or associated item cannot be called on `A` due to unsatisfied trait bounds + | + = note: the following trait bounds were not satisfied: + `A: PartialOrd<_>` + which is required by `&A: PartialOrd<&_>` + `A: PartialOrd<_>` + which is required by `&mut A: PartialOrd<&mut _>` + `A: Iterator` + which is required by `&mut A: Iterator` +note: the trait `Iterator` must be implemented + --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL +help: consider annotating `A` with `#[derive(PartialEq, PartialOrd)]` + | +LL + #[derive(PartialEq, PartialOrd)] +LL | pub struct A; + | + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. |
