return const_error when ty has errors

This commit is contained in:
Takayuki Maeda 2022-11-02 14:47:48 +09:00
parent 33b55ac39f
commit b96ad1c096
3 changed files with 78 additions and 0 deletions

View file

@ -501,6 +501,9 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
}
GenericParamDefKind::Const { has_default } => {
let ty = tcx.at(self.span).type_of(param.def_id);
if ty.references_error() {
return tcx.const_error(ty).into();
}
if !infer_args && has_default {
tcx.bound_const_param_default(param.def_id)
.subst(tcx, substs.unwrap())