make PlaceholderConst
not store the type of the const
This commit is contained in:
parent
1f5d8d49eb
commit
825a7cc65c
@ -511,7 +511,7 @@ fn fold_const(&mut self, ct: ty::Const<'tcx>) -> ty::Const<'tcx> {
|
|||||||
}
|
}
|
||||||
ty::ConstKind::Placeholder(placeholder) => {
|
ty::ConstKind::Placeholder(placeholder) => {
|
||||||
return self.canonicalize_const_var(
|
return self.canonicalize_const_var(
|
||||||
CanonicalVarInfo { kind: CanonicalVarKind::PlaceholderConst(placeholder) },
|
CanonicalVarInfo { kind: CanonicalVarKind::PlaceholderConst(placeholder, ct.ty()) },
|
||||||
ct,
|
ct,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -695,11 +695,11 @@ fn canonical_var(&mut self, info: CanonicalVarInfo<'tcx>, kind: GenericArg<'tcx>
|
|||||||
..placeholder
|
..placeholder
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
CanonicalVarKind::PlaceholderConst(placeholder) => {
|
CanonicalVarKind::PlaceholderConst(placeholder, t) => {
|
||||||
CanonicalVarKind::PlaceholderConst(ty::Placeholder {
|
CanonicalVarKind::PlaceholderConst(ty::Placeholder {
|
||||||
universe: reverse_universe_map[&placeholder.universe],
|
universe: reverse_universe_map[&placeholder.universe],
|
||||||
..placeholder
|
..placeholder
|
||||||
})
|
}, t)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -144,13 +144,13 @@ fn instantiate_canonical_var(
|
|||||||
)
|
)
|
||||||
.into(),
|
.into(),
|
||||||
|
|
||||||
CanonicalVarKind::PlaceholderConst(ty::PlaceholderConst { universe, name }) => {
|
CanonicalVarKind::PlaceholderConst(ty::PlaceholderConst { universe, name }, ty) => {
|
||||||
let universe_mapped = universe_map(universe);
|
let universe_mapped = universe_map(universe);
|
||||||
let placeholder_mapped = ty::PlaceholderConst { universe: universe_mapped, name };
|
let placeholder_mapped = ty::PlaceholderConst { universe: universe_mapped, name };
|
||||||
self.tcx
|
self.tcx
|
||||||
.mk_const(ty::ConstS {
|
.mk_const(ty::ConstS {
|
||||||
kind: ty::ConstKind::Placeholder(placeholder_mapped),
|
kind: ty::ConstKind::Placeholder(placeholder_mapped),
|
||||||
ty: name.ty,
|
ty,
|
||||||
})
|
})
|
||||||
.into()
|
.into()
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ pub fn replace_bound_vars_with_placeholders<T>(&self, binder: ty::Binder<'tcx, T
|
|||||||
self.tcx.mk_const(ty::ConstS {
|
self.tcx.mk_const(ty::ConstS {
|
||||||
kind: ty::ConstKind::Placeholder(ty::PlaceholderConst {
|
kind: ty::ConstKind::Placeholder(ty::PlaceholderConst {
|
||||||
universe: next_universe,
|
universe: next_universe,
|
||||||
name: ty::BoundConst { var: bound_var, ty },
|
name: bound_var,
|
||||||
}),
|
}),
|
||||||
ty,
|
ty,
|
||||||
})
|
})
|
||||||
|
@ -2069,7 +2069,7 @@ fn replace_param_and_infer_substs_with_placeholder<'tcx>(
|
|||||||
ty,
|
ty,
|
||||||
kind: ty::ConstKind::Placeholder(ty::PlaceholderConst {
|
kind: ty::ConstKind::Placeholder(ty::PlaceholderConst {
|
||||||
universe: ty::UniverseIndex::ROOT,
|
universe: ty::UniverseIndex::ROOT,
|
||||||
name: ty::BoundConst { ty, var: ty::BoundVar::from_usize(idx) },
|
name: ty::BoundVar::from_usize(idx),
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
.into()
|
.into()
|
||||||
|
@ -105,7 +105,7 @@ pub fn is_existential(&self) -> bool {
|
|||||||
CanonicalVarKind::Region(_) => true,
|
CanonicalVarKind::Region(_) => true,
|
||||||
CanonicalVarKind::PlaceholderRegion(..) => false,
|
CanonicalVarKind::PlaceholderRegion(..) => false,
|
||||||
CanonicalVarKind::Const(..) => true,
|
CanonicalVarKind::Const(..) => true,
|
||||||
CanonicalVarKind::PlaceholderConst(_) => false,
|
CanonicalVarKind::PlaceholderConst(_, _) => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -133,7 +133,7 @@ pub enum CanonicalVarKind<'tcx> {
|
|||||||
Const(ty::UniverseIndex, Ty<'tcx>),
|
Const(ty::UniverseIndex, Ty<'tcx>),
|
||||||
|
|
||||||
/// A "placeholder" that represents "any const".
|
/// A "placeholder" that represents "any const".
|
||||||
PlaceholderConst(ty::PlaceholderConst<'tcx>),
|
PlaceholderConst(ty::PlaceholderConst<'tcx>, Ty<'tcx>),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> CanonicalVarKind<'tcx> {
|
impl<'tcx> CanonicalVarKind<'tcx> {
|
||||||
@ -148,7 +148,7 @@ pub fn universe(self) -> ty::UniverseIndex {
|
|||||||
CanonicalVarKind::Region(ui) => ui,
|
CanonicalVarKind::Region(ui) => ui,
|
||||||
CanonicalVarKind::PlaceholderRegion(placeholder) => placeholder.universe,
|
CanonicalVarKind::PlaceholderRegion(placeholder) => placeholder.universe,
|
||||||
CanonicalVarKind::Const(ui, _) => ui,
|
CanonicalVarKind::Const(ui, _) => ui,
|
||||||
CanonicalVarKind::PlaceholderConst(placeholder) => placeholder.universe,
|
CanonicalVarKind::PlaceholderConst(placeholder, _) => placeholder.universe,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1200,7 +1200,7 @@ pub struct BoundConst<'tcx> {
|
|||||||
pub ty: Ty<'tcx>,
|
pub ty: Ty<'tcx>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type PlaceholderConst<'tcx> = Placeholder<BoundConst<'tcx>>;
|
pub type PlaceholderConst<'tcx> = Placeholder<BoundVar>;
|
||||||
|
|
||||||
/// A `DefId` which, in case it is a const argument, is potentially bundled with
|
/// A `DefId` which, in case it is a const argument, is potentially bundled with
|
||||||
/// the `DefId` of the generic parameter it instantiates.
|
/// the `DefId` of the generic parameter it instantiates.
|
||||||
|
@ -746,7 +746,7 @@ fn fold_const(&mut self, ct: ty::Const<'tcx>) -> ty::Const<'tcx> {
|
|||||||
let universe = self.universe_for(debruijn);
|
let universe = self.universe_for(debruijn);
|
||||||
let p = ty::PlaceholderConst {
|
let p = ty::PlaceholderConst {
|
||||||
universe,
|
universe,
|
||||||
name: ty::BoundConst { var: bound_const, ty: ct.ty() },
|
name: bound_const,
|
||||||
};
|
};
|
||||||
self.mapped_consts.insert(p, bound_const);
|
self.mapped_consts.insert(p, bound_const);
|
||||||
self.infcx
|
self.infcx
|
||||||
|
@ -76,7 +76,7 @@ pub(crate) fn evaluate_goal<'tcx>(
|
|||||||
chalk_ir::UniverseIndex { counter: ui.index() },
|
chalk_ir::UniverseIndex { counter: ui.index() },
|
||||||
),
|
),
|
||||||
CanonicalVarKind::Const(_ui, _ty) => unimplemented!(),
|
CanonicalVarKind::Const(_ui, _ty) => unimplemented!(),
|
||||||
CanonicalVarKind::PlaceholderConst(_pc) => unimplemented!(),
|
CanonicalVarKind::PlaceholderConst(_pc, _ty) => unimplemented!(),
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
value: obligation.value.lower_into(interner),
|
value: obligation.value.lower_into(interner),
|
||||||
|
Loading…
Reference in New Issue
Block a user