Skip to content

fixed_map: derive(Key) treats alias as rigid #216

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

Open
lcnr opened this issue May 21, 2025 · 1 comment
Open

fixed_map: derive(Key) treats alias as rigid #216

lcnr opened this issue May 21, 2025 · 1 comment
Labels
from-crater A regression found via a crater run, not part of our test suite

Comments

@lcnr
Copy link
Contributor

lcnr commented May 21, 2025

https://crater-reports.s3.amazonaws.com/pr-133502-13/try%233cddd79d4be3c8f1e937d09ca618d192abc69373/reg/fixed-map-0.9.5/log.txt

struct Outer;
struct Inner;
trait Id<T> {
    type This;
}
impl<T, U> Id<U> for T {
    type This = T;
}

fn free<T>(x: T) -> <T as Id<Inner>>::This
where
    <T as Id<Outer>>::This: Id<Inner, This = <T as Id<Inner>>::This>,
{
    x
}

compiles with old, errors with new.

@lcnr lcnr added the from-crater A regression found via a crater run, not part of our test suite label May 21, 2025
@lcnr
Copy link
Contributor Author

lcnr commented May 21, 2025

Normalizing <T as Id<Outer>>::This: Id<Inner, This = <T as Id<Inner>>::This> is interesting:tm:

  • <T as Id<Outer>>::This always uses the impl and normalizes to T
  • <T as Id<Inner>>::This can be normalized by using either the impl or the normalized where-clause

The old solver normalizes it in an unnormalized env, which uses the impl and normalizes it to T.

The new solver properly handles aliases in the environment, so we're able to equate <T as Id<Outer>>::This with T no matter here we normalize <T as Id<Inner>>::This. This means that the alias is treated as rigid with the new solver.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
from-crater A regression found via a crater run, not part of our test suite
Projects
Status: unknown
Development

No branches or pull requests

1 participant