Canonicalize const variables correctly
This commit is contained in:
parent
72e74d7b9c
commit
012910dab2
4 changed files with 11 additions and 14 deletions
|
@ -425,7 +425,7 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for Canonicalizer<'cx, 'tcx> {
|
|||
// FIXME: perf problem described in #55921.
|
||||
ui = ty::UniverseIndex::ROOT;
|
||||
return self.canonicalize_const_var(
|
||||
CanonicalVarInfo { kind: CanonicalVarKind::Const(ui) },
|
||||
CanonicalVarInfo { kind: CanonicalVarKind::Const(ui, ct.ty) },
|
||||
ct,
|
||||
);
|
||||
}
|
||||
|
|
|
@ -137,12 +137,9 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
|
|||
self.tcx.mk_region(ty::RePlaceholder(placeholder_mapped)).into()
|
||||
}
|
||||
|
||||
CanonicalVarKind::Const(ui) => self
|
||||
CanonicalVarKind::Const(ui, ty) => self
|
||||
.next_const_var_in_universe(
|
||||
self.next_ty_var_in_universe(
|
||||
TypeVariableOrigin { kind: TypeVariableOriginKind::MiscVariable, span },
|
||||
universe_map(ui),
|
||||
),
|
||||
ty,
|
||||
ConstVariableOrigin { kind: ConstVariableOriginKind::MiscVariable, span },
|
||||
universe_map(ui),
|
||||
)
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
use crate::infer::MemberConstraint;
|
||||
use crate::ty::subst::GenericArg;
|
||||
use crate::ty::{self, BoundVar, List, Region, TyCtxt};
|
||||
use crate::ty::{self, BoundVar, List, Region, Ty, TyCtxt};
|
||||
use rustc_index::vec::IndexVec;
|
||||
use rustc_macros::HashStable;
|
||||
use smallvec::SmallVec;
|
||||
|
@ -104,7 +104,7 @@ impl<'tcx> CanonicalVarInfo<'tcx> {
|
|||
CanonicalVarKind::PlaceholderTy(_) => false,
|
||||
CanonicalVarKind::Region(_) => true,
|
||||
CanonicalVarKind::PlaceholderRegion(..) => false,
|
||||
CanonicalVarKind::Const(_) => true,
|
||||
CanonicalVarKind::Const(..) => true,
|
||||
CanonicalVarKind::PlaceholderConst(_) => false,
|
||||
}
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ pub enum CanonicalVarKind<'tcx> {
|
|||
PlaceholderRegion(ty::PlaceholderRegion),
|
||||
|
||||
/// Some kind of const inference variable.
|
||||
Const(ty::UniverseIndex),
|
||||
Const(ty::UniverseIndex, Ty<'tcx>),
|
||||
|
||||
/// A "placeholder" that represents "any const".
|
||||
PlaceholderConst(ty::PlaceholderConst<'tcx>),
|
||||
|
@ -147,7 +147,7 @@ impl<'tcx> CanonicalVarKind<'tcx> {
|
|||
CanonicalVarKind::PlaceholderTy(placeholder) => placeholder.universe,
|
||||
CanonicalVarKind::Region(ui) => ui,
|
||||
CanonicalVarKind::PlaceholderRegion(placeholder) => placeholder.universe,
|
||||
CanonicalVarKind::Const(ui) => ui,
|
||||
CanonicalVarKind::Const(ui, _) => ui,
|
||||
CanonicalVarKind::PlaceholderConst(placeholder) => placeholder.universe,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ crate fn evaluate_goal<'tcx>(
|
|||
chalk_ir::VariableKind::Lifetime,
|
||||
chalk_ir::UniverseIndex { counter: ui.index() },
|
||||
),
|
||||
CanonicalVarKind::Const(_ui) => unimplemented!(),
|
||||
CanonicalVarKind::Const(_ui, _ty) => unimplemented!(),
|
||||
CanonicalVarKind::PlaceholderConst(_pc) => unimplemented!(),
|
||||
}),
|
||||
),
|
||||
|
@ -127,9 +127,9 @@ crate fn evaluate_goal<'tcx>(
|
|||
chalk_ir::VariableKind::Lifetime => CanonicalVarKind::Region(
|
||||
ty::UniverseIndex::from_usize(var.skip_kind().counter),
|
||||
),
|
||||
chalk_ir::VariableKind::Const(_) => CanonicalVarKind::Const(
|
||||
ty::UniverseIndex::from_usize(var.skip_kind().counter),
|
||||
),
|
||||
// FIXME(compiler-errors): We don't currently have a way of turning
|
||||
// a Chalk ty back into a rustc ty, right?
|
||||
chalk_ir::VariableKind::Const(_) => todo!(),
|
||||
};
|
||||
CanonicalVarInfo { kind }
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue