-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #114586 - oli-obk:patch_tait_rpit_order_check, r=lcnr,c…
…ompiler-errors Bubble up opaque <eq> opaque operations instead of picking an order In case we are in `Bubble` mode (meaning every opaque type that is defined in the current crate is treated as if it were in its defining scope), we don't try to register an opaque type as the hidden type of another opaque type, but instead bubble up an obligation to equate them at the query caller site. Usually that means we have a `DefiningAnchor::Bind` and thus can reliably figure out whether an opaque type is in its defining scope. Where we can't, we'll error out, so the default is sound. With this change we start using `AliasTyEq` predicates in the old solver, too. fixes #108498 But also regresses `tests/ui/impl-trait/anon_scope_creep.rs`. Our use of `Bubble` for `check_opaque_type_well_formed` is going to keep biting us. r? `@lcnr` `@compiler-errors`
- Loading branch information
Showing
8 changed files
with
128 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,6 +58,7 @@ build/ | |
\#* | ||
\#*\# | ||
.#* | ||
rustc-ice-*.txt | ||
|
||
## Tags | ||
tags | ||
|
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
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,9 @@ | ||
error[E0284]: type annotations needed: cannot satisfy `impl AsyncRead + 'a == PendingReader<'a>` | ||
--> $DIR/async_scope_creep.rs:26:9 | ||
| | ||
LL | self.read() | ||
| ^^^^^^^^^^^ cannot satisfy `impl AsyncRead + 'a == PendingReader<'a>` | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0284`. |
25 changes: 25 additions & 0 deletions
25
tests/ui/type-alias-impl-trait/rpit_tait_equality_in_canonical_query.rs
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,25 @@ | ||
//! This tries to prove the APIT's bounds in a canonical query, | ||
//! which doesn't know anything about the defining scope of either | ||
//! opaque type and thus makes a random choice as to which opaque type | ||
//! becomes the hidden type of the other. When we leave the canonical | ||
//! query, we attempt to actually check the defining anchor, but now we | ||
//! have a situation where the RPIT gets constrained outside its anchor. | ||
|
||
// revisions: current next | ||
//[next] compile-flags: -Ztrait-solver=next | ||
// check-pass | ||
|
||
#![feature(type_alias_impl_trait)] | ||
|
||
type Opaque = impl Sized; | ||
|
||
fn get_rpit() -> impl Clone {} | ||
|
||
fn query(_: impl FnOnce() -> Opaque) {} | ||
|
||
fn test() -> Opaque { | ||
query(get_rpit); | ||
get_rpit() | ||
} | ||
|
||
fn main() {} |