-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use sup instead of eq when unifying self type
- Loading branch information
1 parent
93c6c04
commit 8995c2c
Showing
6 changed files
with
52 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,9 @@ | ||
error[E0599]: the method `when` exists for struct `RaceBuilder<_, Never<_>>`, but its trait bounds were not satisfied | ||
error[E0275]: overflow assigning `_` to `Option<_>` | ||
--> $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 E0599`. | ||
For more information about this error, try `rustc --explain E0275`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
//@ check-pass | ||
|
||
// Test that we use `sup` not `eq` during method probe, since this has an effect | ||
// on the leak check. This is (conceptually) minimized from a crater run for | ||
// `wrend 0.3.6`. | ||
|
||
use std::ops::Deref; | ||
|
||
struct A; | ||
|
||
impl Deref for A { | ||
type Target = B<dyn Fn(&())>; | ||
|
||
fn deref(&self) -> &<Self as Deref>::Target { todo!() } | ||
} | ||
|
||
struct B<T: ?Sized>(T); | ||
impl<T> B<dyn Fn(T)> { | ||
fn method(&self) {} | ||
} | ||
|
||
fn main() { | ||
A.method(); | ||
} |