1
Fork 0

Always take the Ok path in lit_to_const and produce error constants instead

This commit is contained in:
Oli Scherer 2025-01-07 12:33:32 +00:00
parent 787af97bab
commit 07fcead073
9 changed files with 103 additions and 83 deletions

View file

@ -69,7 +69,7 @@ pub(crate) fn lit_to_const<'tcx>(
}
(ast::LitKind::Char(c), ty::Char) => ty::ValTree::from_scalar_int((*c).into()),
(ast::LitKind::Err(guar), _) => return Ok(ty::Const::new_error(tcx, *guar)),
_ => return Err(LitToConstError::TypeError),
_ => return Ok(ty::Const::new_misc_error(tcx)),
};
Ok(ty::Const::new_value(tcx, valtree, ty))