Silence follow-up errors from lit_to_const
This commit is contained in:
parent
acf48426b6
commit
cb72b9bb37
5 changed files with 11 additions and 78 deletions
|
@ -2,7 +2,7 @@ use rustc_ast as ast;
|
|||
use rustc_hir::LangItem;
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::mir::interpret::{LitToConstError, LitToConstInput};
|
||||
use rustc_middle::ty::{self, ScalarInt, TyCtxt};
|
||||
use rustc_middle::ty::{self, ScalarInt, TyCtxt, TypeVisitableExt as _};
|
||||
use tracing::trace;
|
||||
|
||||
use crate::build::parse_float_into_scalar;
|
||||
|
@ -13,6 +13,10 @@ pub(crate) fn lit_to_const<'tcx>(
|
|||
) -> Result<ty::Const<'tcx>, LitToConstError> {
|
||||
let LitToConstInput { lit, ty, neg } = lit_input;
|
||||
|
||||
if let Err(guar) = ty.error_reported() {
|
||||
return Ok(ty::Const::new_error(tcx, guar));
|
||||
}
|
||||
|
||||
let trunc = |n| {
|
||||
let width = match tcx.layout_of(ty::TypingEnv::fully_monomorphized().as_query_input(ty)) {
|
||||
Ok(layout) => layout.size,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue