Rollup merge of #130990 - RalfJung:mir-const-normalize, r=compiler-errors
try to get rid of mir::Const::normalize It was easy to make this compile, let's see if anything breaks... r? `@compiler-errors`
This commit is contained in:
commit
a0ae32d6a2
5 changed files with 14 additions and 39 deletions
|
@ -221,7 +221,9 @@ pub enum Const<'tcx> {
|
|||
}
|
||||
|
||||
impl<'tcx> Const<'tcx> {
|
||||
pub fn identity_unevaluated(
|
||||
/// Creates an unevaluated const from a `DefId` for a const item.
|
||||
/// The binders of the const item still need to be instantiated.
|
||||
pub fn from_unevaluated(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
def_id: DefId,
|
||||
) -> ty::EarlyBinder<'tcx, Const<'tcx>> {
|
||||
|
@ -329,18 +331,6 @@ impl<'tcx> Const<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Normalizes the constant to a value or an error if possible.
|
||||
#[inline]
|
||||
pub fn normalize(self, tcx: TyCtxt<'tcx>, param_env: ty::ParamEnv<'tcx>) -> Self {
|
||||
match self.eval(tcx, param_env, DUMMY_SP) {
|
||||
Ok(val) => Self::Val(val, self.ty()),
|
||||
Err(ErrorHandled::Reported(guar, _span)) => {
|
||||
Self::Ty(Ty::new_error(tcx, guar.into()), ty::Const::new_error(tcx, guar.into()))
|
||||
}
|
||||
Err(ErrorHandled::TooGeneric(_span)) => self,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn try_eval_scalar(
|
||||
self,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue