forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#125447 - oli-obk:eq_opaque_pred, r=compiler…
…-errors Allow constraining opaque types during subtyping in the trait system Previous attempt: rust-lang#123979 Sometimes we don't immediately perform subtyping, but instead register a subtyping obligation and solve that obligation when its inference variables become resolved. Unlike immediate subtyping, we currently do not allow registering hidden types for opaque types. This PR also allows that.
- Loading branch information
Showing
5 changed files
with
38 additions
and
88 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`. |