2

Fix ICEs related to `Deref<Target=[T; N]>` on newtypes by compiler-errors...

 2 years ago
source link: https://github.com/rust-lang/rust/pull/92640
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Copy link

Contributor

compiler-errors commented 23 days ago

edited
  1. Stash a const infer's type into the canonical var during canonicalization, so we can recreate the fresh const infer with that same type.
    For example, given [T; _] we know _ is a usize. If we go from infer => canonical => infer, we shouldn't forget that variable is a usize.
    Fixes #92626
    Fixes #83704

  2. Don't stash the autoderef'd slice type that we get from method lookup, but instead recreate it during method confirmation. We need to do this because the type we receive back after picking the method references a type variable that does not exist after probing is done.
    Fixes #92637

... A better solution for the second issue would be to actually properly implement Deref for [T; N] instead of fixing this autoderef hack to stop leaking inference variables. But I actually looked into this, and there are many complications with const impls.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK