-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow constraining opaque types during subtyping in the trait system
- Loading branch information
Showing
5 changed files
with
25 additions
and
32 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 was deleted.
Oops, something went wrong.
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
31 changes: 18 additions & 13 deletions
31
tests/ui/type-alias-impl-trait/lazy_subtyping_of_opaques.stderr
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,26 +1,31 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/lazy_subtyping_of_opaques.rs:10:23 | ||
error[E0277]: expected a `FnOnce()` closure, found `()` | ||
--> $DIR/lazy_subtyping_of_opaques.rs:11:23 | ||
| | ||
LL | type Tait = impl FnOnce() -> (); | ||
| ------------------- the found opaque type | ||
... | ||
LL | Thunk::new(|cont| cont) | ||
| ^^^^ expected `()`, found opaque type | ||
| ^^^^ expected an `FnOnce()` closure, found `()` | ||
| | ||
= note: expected unit type `()` | ||
found opaque type `Tait` | ||
= help: the trait `FnOnce<()>` is not implemented for `()` | ||
= note: wrap the `()` in a closure with no arguments: `|| { /* code */ }` | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/lazy_subtyping_of_opaques.rs:10:5 | ||
error[E0277]: expected a `FnOnce()` closure, found `()` | ||
--> $DIR/lazy_subtyping_of_opaques.rs:9:23 | ||
| | ||
LL | fn reify_as_tait() -> Thunk<Tait> { | ||
| ----------- expected `Thunk<_>` because of return type | ||
| ^^^^^^^^^^^ expected an `FnOnce()` closure, found `()` | ||
| | ||
= help: the trait `FnOnce<()>` is not implemented for `()` | ||
= note: wrap the `()` in a closure with no arguments: `|| { /* code */ }` | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/lazy_subtyping_of_opaques.rs:11:5 | ||
| | ||
LL | Thunk::new(|cont| cont) | ||
| ^^^^^^^^^^^^^^^^^^^^^^^ expected `Thunk<_>`, found `()` | ||
| | ||
= note: expected struct `Thunk<_>` | ||
found unit type `()` | ||
|
||
error: aborting due to 2 previous errors | ||
error: aborting due to 3 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0308`. | ||
Some errors have detailed explanations: E0277, E0308. | ||
For more information about an error, try `rustc --explain E0277`. |