-
-
Notifications
You must be signed in to change notification settings - Fork 15k
Unify CanonicalVar and DebruijnIndex #49887
Copy link
Copy link
Closed
Labels
A-trait-systemArea: Trait systemArea: Trait systemC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-trait-systemArea: Trait systemArea: Trait systemC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
From #49810:
General instructions:
The canonical var is a "new type index" declared here:
rust/src/librustc/ty/sty.rs
Line 1107 in 3242880
We would basically just want to remove it completely and replace uses of it with
DebruijnIndex. There are a few complications to be overcome. One is that debruijn indices are currently 1-based (that is #49813), so indexing with them will require some tweaks. Another related problem is thatDebruijnIndexdoes not implement theIdxtrait, so we can't presently have aIndexVec<DebruijnIndex>, as we do in theCanonicalVarValuesstruct:rust/src/librustc/infer/canonical.rs
Lines 76 to 78 in 3242880
This is not that big a deal -- we can just use a plain vector -- although if we make debruijn indices 0-based we could then generate it with the
newtype_index!macro, which would be nice.