Auto merge of #98588 - b-naber:valtrees-cleanup, r=lcnr
Use only ty::Unevaluated<'tcx, ()> in type system r? `@lcnr`
This commit is contained in:
commit
c524c7dd25
59 changed files with 383 additions and 323 deletions
|
@ -743,7 +743,8 @@ impl<'tcx> TypeRelation<'tcx> for Generalizer<'_, 'tcx> {
|
|||
}
|
||||
}
|
||||
ty::ConstKind::Unevaluated(ty::Unevaluated { def, substs, promoted }) => {
|
||||
assert_eq!(promoted, None);
|
||||
assert_eq!(promoted, ());
|
||||
|
||||
let substs = self.relate_with_variance(
|
||||
ty::Variance::Invariant,
|
||||
ty::VarianceDiagInfo::default(),
|
||||
|
@ -964,13 +965,15 @@ impl<'tcx> TypeRelation<'tcx> for ConstInferUnifier<'_, 'tcx> {
|
|||
}
|
||||
}
|
||||
ty::ConstKind::Unevaluated(ty::Unevaluated { def, substs, promoted }) => {
|
||||
assert_eq!(promoted, None);
|
||||
assert_eq!(promoted, ());
|
||||
|
||||
let substs = self.relate_with_variance(
|
||||
ty::Variance::Invariant,
|
||||
ty::VarianceDiagInfo::default(),
|
||||
substs,
|
||||
substs,
|
||||
)?;
|
||||
|
||||
Ok(self.tcx().mk_const(ty::ConstS {
|
||||
ty: c.ty(),
|
||||
kind: ty::ConstKind::Unevaluated(ty::Unevaluated { def, substs, promoted }),
|
||||
|
|
|
@ -1673,7 +1673,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
|||
pub fn try_const_eval_resolve(
|
||||
&self,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
unevaluated: ty::Unevaluated<'tcx>,
|
||||
unevaluated: ty::Unevaluated<'tcx, ()>,
|
||||
ty: Ty<'tcx>,
|
||||
span: Option<Span>,
|
||||
) -> Result<ty::Const<'tcx>, ErrorHandled> {
|
||||
|
@ -1708,7 +1708,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
|||
pub fn const_eval_resolve(
|
||||
&self,
|
||||
mut param_env: ty::ParamEnv<'tcx>,
|
||||
unevaluated: ty::Unevaluated<'tcx>,
|
||||
unevaluated: ty::Unevaluated<'tcx, ()>,
|
||||
span: Option<Span>,
|
||||
) -> EvalToValTreeResult<'tcx> {
|
||||
let mut substs = self.resolve_vars_if_possible(unevaluated.substs);
|
||||
|
@ -1717,7 +1717,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
|||
// Postpone the evaluation of constants whose substs depend on inference
|
||||
// variables
|
||||
if substs.has_infer_types_or_consts() {
|
||||
let ac = AbstractConst::new(self.tcx, unevaluated.shrink());
|
||||
let ac = AbstractConst::new(self.tcx, unevaluated);
|
||||
match ac {
|
||||
Ok(None) => {
|
||||
substs = InternalSubsts::identity_for_item(self.tcx, unevaluated.def.did);
|
||||
|
@ -1739,11 +1739,8 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
|||
debug!(?param_env_erased);
|
||||
debug!(?substs_erased);
|
||||
|
||||
let unevaluated = ty::Unevaluated {
|
||||
def: unevaluated.def,
|
||||
substs: substs_erased,
|
||||
promoted: unevaluated.promoted,
|
||||
};
|
||||
let unevaluated =
|
||||
ty::Unevaluated { def: unevaluated.def, substs: substs_erased, promoted: () };
|
||||
|
||||
// The return value is the evaluated value which doesn't contain any reference to inference
|
||||
// variables, thus we don't need to substitute back the original values.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue