-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ICE when equating TAIT and RPIT in canonical queries #108498
Comments
This would require some more design and stuff -- but I wonder if, when we relate an opaque with another opaque in a DefiningAnchor::Bubble scope, we should emit some other sort of opaque type constraint, like |
yea, that was always the plan, but it seemed too niche to put the effort in for now |
…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 rust-lang/rust#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`
Reopened because the fix was incomplete. See #116530 |
Pass list of defineable opaque types into canonical queries based on rust-lang#121796 This eliminates `DefiningAnchor::Bubble` for good and brings the old solver closer to the new one wrt cycles and nested obligations. At that point the difference between `DefiningAnchor::Bind([])` and `DefiningAnchor::Error` was academic. We only used the difference for some sanity checks, which actually had to be worked around in places, so I just removed `DefiningAnchor` entirely and just stored the list of opaques that may be defined. fixes rust-lang#108498 * [ ] run crater
Pass list of defineable opaque types into canonical queries This eliminates `DefiningAnchor::Bubble` for good and brings the old solver closer to the new one wrt cycles and nested obligations. At that point the difference between `DefiningAnchor::Bind([])` and `DefiningAnchor::Error` was academic. We only used the difference for some sanity checks, which actually had to be worked around in places, so I just removed `DefiningAnchor` entirely and just stored the list of opaques that may be defined. fixes rust-lang#108498 * [ ] run crater
…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 rust-lang/rust#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`
…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 rust-lang/rust#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`
Code
https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=ec86c1b56e1fe08951cf0dbb67ea7d7b
While trying to prove the predicate
<get_rpit as FnOnce>::Output == Opaque
, we end up equatingget_rpit::opaque#0 == Opaque::opaque#0
. Because inside canonical queries we know nothing about the defining scope (DefiningAnchor::Bubble
), we register the hidden type asget_rpit::opaque := Opaque::opaque
instead ofOpaque::opaque := get_rpit::opaque
.Cc @oli-obk.
Meta
Nightly version: 1.69.0-nightly (2023-02-25 34e6673)
Error output
Backtrace
@rustbot label F-type_alias_impl_trait T-types
The text was updated successfully, but these errors were encountered: