about summary refs log tree commit diff
path: root/tests/ui/impl-trait
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2024-03-10 19:43:20 -0400
committerMichael Goulet <michael@errs.io>2024-04-21 20:10:12 -0400
commitff4653a08f0c9dad1db927727e102c51f0ea39b2 (patch)
tree6b6afbe549efdfa7fddf2240beff60c7a2e6c7d9 /tests/ui/impl-trait
parentc13af7db21c8e7978f5d6bd462a397f5f7a29c8d (diff)
downloadrust-ff4653a08f0c9dad1db927727e102c51f0ea39b2.tar.gz
rust-ff4653a08f0c9dad1db927727e102c51f0ea39b2.zip
Use fulfillment, not evaluate, during method probe
Diffstat (limited to 'tests/ui/impl-trait')
-rw-r--r--tests/ui/impl-trait/issues/issue-62742.rs2
-rw-r--r--tests/ui/impl-trait/issues/issue-62742.stderr50
-rw-r--r--tests/ui/impl-trait/issues/issue-84073.rs3
-rw-r--r--tests/ui/impl-trait/issues/issue-84073.stderr28
4 files changed, 57 insertions, 26 deletions
diff --git a/tests/ui/impl-trait/issues/issue-62742.rs b/tests/ui/impl-trait/issues/issue-62742.rs
index 11a75737e55..bd48c51c065 100644
--- a/tests/ui/impl-trait/issues/issue-62742.rs
+++ b/tests/ui/impl-trait/issues/issue-62742.rs
@@ -3,7 +3,7 @@ use std::marker::PhantomData;
 fn _alias_check() {
     WrongImpl::foo(0i32);
     //~^ ERROR the trait bound `RawImpl<_>: Raw<_>` is not satisfied
-    //~| ERROR the trait bound `RawImpl<_>: Raw<_>` is not satisfied
+    //~| ERROR the function or associated item `foo` exists for struct `SafeImpl<_, RawImpl<_>>`, but its trait bounds were not satisfied
     WrongImpl::<()>::foo(0i32);
     //~^ ERROR the trait bound `RawImpl<()>: Raw<()>` is not satisfied
     //~| ERROR trait bounds were not satisfied
diff --git a/tests/ui/impl-trait/issues/issue-62742.stderr b/tests/ui/impl-trait/issues/issue-62742.stderr
index 9ec581c231b..f6798f55a47 100644
--- a/tests/ui/impl-trait/issues/issue-62742.stderr
+++ b/tests/ui/impl-trait/issues/issue-62742.stderr
@@ -1,30 +1,27 @@
-error[E0277]: the trait bound `RawImpl<_>: Raw<_>` is not satisfied
-  --> $DIR/issue-62742.rs:4:5
+error[E0599]: the function or associated item `foo` exists for struct `SafeImpl<_, RawImpl<_>>`, but its trait bounds were not satisfied
+  --> $DIR/issue-62742.rs:4:16
    |
 LL |     WrongImpl::foo(0i32);
-   |     ^^^^^^^^^^^^^^^^^^^^ the trait `Raw<_>` is not implemented for `RawImpl<_>`
+   |                ^^^ function or associated item cannot be called on `SafeImpl<_, RawImpl<_>>` due to unsatisfied trait bounds
+...
+LL | pub struct RawImpl<T>(PhantomData<T>);
+   | --------------------- doesn't satisfy `RawImpl<_>: Raw<_>`
+...
+LL | pub struct SafeImpl<T: ?Sized, A: Raw<T>>(PhantomData<(A, T)>);
+   | ----------------------------------------- function or associated item `foo` not found for this struct
    |
-   = help: the trait `Raw<[_]>` is implemented for `RawImpl<_>`
-note: required by a bound in `SafeImpl::<T, A>::foo`
+note: trait bound `RawImpl<_>: Raw<_>` was not satisfied
   --> $DIR/issue-62742.rs:29:20
    |
 LL | impl<T: ?Sized, A: Raw<T>> SafeImpl<T, A> {
-   |                    ^^^^^^ required by this bound in `SafeImpl::<T, A>::foo`
-LL |     pub fn foo(value: A::Value) {}
-   |            --- required by a bound in this associated function
-
-error[E0277]: the trait bound `RawImpl<_>: Raw<_>` is not satisfied
-  --> $DIR/issue-62742.rs:4:5
-   |
-LL |     WrongImpl::foo(0i32);
-   |     ^^^^^^^^^ the trait `Raw<_>` is not implemented for `RawImpl<_>`
-   |
-   = help: the trait `Raw<[_]>` is implemented for `RawImpl<_>`
-note: required by a bound in `SafeImpl`
-  --> $DIR/issue-62742.rs:27:35
+   |                    ^^^^^^  --------------
+   |                    |
+   |                    unsatisfied trait bound introduced here
+note: the trait `Raw` must be implemented
+  --> $DIR/issue-62742.rs:13:1
    |
-LL | pub struct SafeImpl<T: ?Sized, A: Raw<T>>(PhantomData<(A, T)>);
-   |                                   ^^^^^^ required by this bound in `SafeImpl`
+LL | pub trait Raw<T: ?Sized> {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0599]: the function or associated item `foo` exists for struct `SafeImpl<(), RawImpl<()>>`, but its trait bounds were not satisfied
   --> $DIR/issue-62742.rs:7:22
@@ -51,6 +48,19 @@ note: the trait `Raw` must be implemented
 LL | pub trait Raw<T: ?Sized> {
    | ^^^^^^^^^^^^^^^^^^^^^^^^
 
+error[E0277]: the trait bound `RawImpl<_>: Raw<_>` is not satisfied
+  --> $DIR/issue-62742.rs:4:5
+   |
+LL |     WrongImpl::foo(0i32);
+   |     ^^^^^^^^^ the trait `Raw<_>` is not implemented for `RawImpl<_>`
+   |
+   = help: the trait `Raw<[_]>` is implemented for `RawImpl<_>`
+note: required by a bound in `SafeImpl`
+  --> $DIR/issue-62742.rs:27:35
+   |
+LL | pub struct SafeImpl<T: ?Sized, A: Raw<T>>(PhantomData<(A, T)>);
+   |                                   ^^^^^^ required by this bound in `SafeImpl`
+
 error[E0277]: the trait bound `RawImpl<()>: Raw<()>` is not satisfied
   --> $DIR/issue-62742.rs:7:5
    |
diff --git a/tests/ui/impl-trait/issues/issue-84073.rs b/tests/ui/impl-trait/issues/issue-84073.rs
index 85d9d461fd9..f2f1835dc34 100644
--- a/tests/ui/impl-trait/issues/issue-84073.rs
+++ b/tests/ui/impl-trait/issues/issue-84073.rs
@@ -29,5 +29,6 @@ where
 }
 
 fn main() {
-    Race::new(|race| race.when()); //~ ERROR overflow assigning `_` to `Option<_>`
+    Race::new(|race| race.when());
+    //~^ ERROR the method `when` exists for struct `RaceBuilder<_, Never<_>>`, but its trait bounds were not satisfied
 }
diff --git a/tests/ui/impl-trait/issues/issue-84073.stderr b/tests/ui/impl-trait/issues/issue-84073.stderr
index ab119a8a4f4..eeb23b13081 100644
--- a/tests/ui/impl-trait/issues/issue-84073.stderr
+++ b/tests/ui/impl-trait/issues/issue-84073.stderr
@@ -1,9 +1,29 @@
-error[E0275]: overflow assigning `_` to `Option<_>`
-  --> $DIR/issue-84073.rs:32:22
+error[E0599]: the method `when` exists for struct `RaceBuilder<_, Never<_>>`, but its trait bounds were not satisfied
+  --> $DIR/issue-84073.rs:32:27
    |
+LL | pub struct Never<T>(PhantomData<T>);
+   | ------------------- doesn't satisfy `Never<_>: StatefulFuture<Option<_>>`
+...
+LL | pub struct RaceBuilder<F, S> {
+   | ---------------------------- method `when` not found for this struct
+...
 LL |     Race::new(|race| race.when());
-   |                      ^^^^
+   |                           ^^^^ method cannot be called on `RaceBuilder<_, Never<_>>` due to unsatisfied trait bounds
+   |
+note: trait bound `Never<_>: StatefulFuture<Option<_>>` was not satisfied
+  --> $DIR/issue-84073.rs:14:8
+   |
+LL | impl<T, F> RaceBuilder<T, F>
+   |            -----------------
+LL | where
+LL |     F: StatefulFuture<Option<T>>,
+   |        ^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound introduced here
+note: the trait `StatefulFuture` must be implemented
+  --> $DIR/issue-84073.rs:3:1
+   |
+LL | pub trait StatefulFuture<S> {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to 1 previous error
 
-For more information about this error, try `rustc --explain E0275`.
+For more information about this error, try `rustc --explain E0599`.