-
Notifications
You must be signed in to change notification settings - Fork 14k
Description
From #49810:
The plan is to generalize the existing
CanonicalVarso that it represents a "bound" thing -- probably it just gets unified withDebruijnIndex.
General instructions:
The canonical var is a "new type index" declared here:
Line 1107 in 3242880
| newtype_index!(CanonicalVar); |
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 that DebruijnIndex does not implement the Idx trait, so we can't presently have a IndexVec<DebruijnIndex>, as we do in the CanonicalVarValues struct:
rust/src/librustc/infer/canonical.rs
Lines 76 to 78 in 3242880
| pub struct CanonicalVarValues<'tcx> { | |
| pub var_values: IndexVec<CanonicalVar, Kind<'tcx>>, | |
| } |
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.