You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Relying on inference guidance from item bounds of not yet inferred opaque types:
traitId{typeThis;}impl<T>IdforT{typeThis = T;}fnto_assoc<T>(x:T) -> <TasId>::This{
x
}fnmirror<T>(x:Vec<T>) -> implId<This = Vec<T>>{let x = to_assoc(mirror(x));// `?x` equals `<opaque::<T> as Id>::This`. As the hidden type of `opaque::<T>`// is still unknown at this point, the method below.
x.len();
x
}
changed the title [-]reblessive regression: non universal non-defining opaque type use[/-][+]reblessive regression: rely on item bounds of not-yet-defined opaque types [/+]on Apr 24, 2025
trait Test {
type Output;
fn method(self) -> Self::Output;
}
impl Test for () {
type Output = Bar;
fn method(self) -> Bar { Bar }
}
struct Bar;
impl Bar {
fn bar(&self) {}
}
fn foo() -> impl Test<Output = Bar> {
let x = Test::method(foo());
x.bar();
}
Fixing this requires us to fix two independent issues:
Opaques may only be related to the goal's self ty via subtyping. This requires us to canonicalize at least part of the subtyping graph.
We get a cycle when (e.g.) equating the assumption impl Sized: Sized and the goal ?0: Sized, since that then subsequently requires proving ?0: Sized in the process of normalizing impl Sized to its hidden type ?0. We could get around this by folding the item bounds of the opaque.
We also probably should not equate the self type of the goal with the hidden type of the opaque. This probably necessitates folding the item bounds of the opaque like I mentioned in (2.) above.
Activity
[-]reblessive regression[/-][+]reblessive regression: non universal non-defining opaque type use[/+]lcnr commentedon Apr 24, 2025
The above issue contains two issues:
Relying on inference guidance from item bounds of not yet inferred opaque types:
lcnr commentedon Apr 24, 2025
and #135. From what I can tell
reblessive
only breaks due to this issue and does not have a non-universal use in the defining scope.[-]reblessive regression: non universal non-defining opaque type use[/-][+]reblessive regression: rely on item bounds of not-yet-defined opaque types [/+]compiler-errors commentedon Apr 25, 2025
Another repro:
Fixing this requires us to fix two independent issues:
impl Sized: Sized
and the goal?0: Sized
, since that then subsequently requires proving?0: Sized
in the process of normalizingimpl Sized
to its hidden type?0
. We could get around this by folding the item bounds of the opaque.compiler-errors commentedon Apr 25, 2025
We also probably should not equate the self type of the goal with the hidden type of the opaque. This probably necessitates folding the item bounds of the opaque like I mentioned in (2.) above.
sub_relations
again rust-lang/rust#140375Auto merge of rust-lang#140375 - lcnr:subrelations-infcx, r=<try>
Auto merge of rust-lang#140375 - lcnr:subrelations-infcx, r=<try>
4 remaining items