1
Fork 0

Auto merge of #111570 - compiler-errors:ct-err, r=BoxyUwU

Rename const error methods for consistency

renames `ty::Const`'s methods for creating a `ConstKind::Error` to be in the same naming style as `ty::Ty`'s equivalent methods.

r? `@BoxyUwU`
This commit is contained in:
bors 2023-05-15 01:03:29 +00:00
commit 8d18c32b61
11 changed files with 24 additions and 32 deletions

View file

@ -2330,7 +2330,7 @@ impl<'tcx> ConstantKind<'tcx> {
if let Some(val) = c.kind().try_eval_for_mir(tcx, param_env) {
match val {
Ok(val) => Self::Val(val, c.ty()),
Err(_) => Self::Ty(tcx.const_error(self.ty())),
Err(guar) => Self::Ty(tcx.const_error(self.ty(), guar)),
}
} else {
self
@ -2342,9 +2342,7 @@ impl<'tcx> ConstantKind<'tcx> {
match tcx.const_eval_resolve(param_env, uneval, None) {
Ok(val) => Self::Val(val, ty),
Err(ErrorHandled::TooGeneric) => self,
Err(ErrorHandled::Reported(guar)) => {
Self::Ty(tcx.const_error_with_guaranteed(ty, guar))
}
Err(ErrorHandled::Reported(guar)) => Self::Ty(tcx.const_error(ty, guar)),
}
}
}