Rollup merge of #108803 - cjgillot:const-prop-normalize, r=oli-obk
Do not ICE when failing to normalize in ConstProp. There is no reason to delay a bug there, as we bubble up the failure as TooGeneric. Fixes https://github.com/rust-lang/rust/issues/97728
This commit is contained in:
commit
ab7dd09fc2
2 changed files with 9 additions and 10 deletions
|
@ -7,7 +7,7 @@ use either::{Either, Left, Right};
|
||||||
use rustc_hir::{self as hir, def_id::DefId, definitions::DefPathData};
|
use rustc_hir::{self as hir, def_id::DefId, definitions::DefPathData};
|
||||||
use rustc_index::vec::IndexVec;
|
use rustc_index::vec::IndexVec;
|
||||||
use rustc_middle::mir;
|
use rustc_middle::mir;
|
||||||
use rustc_middle::mir::interpret::{ErrorHandled, InterpError, InvalidProgramInfo};
|
use rustc_middle::mir::interpret::{ErrorHandled, InterpError};
|
||||||
use rustc_middle::ty::layout::{
|
use rustc_middle::ty::layout::{
|
||||||
self, FnAbiError, FnAbiOfHelpers, FnAbiRequest, LayoutError, LayoutOf, LayoutOfHelpers,
|
self, FnAbiError, FnAbiOfHelpers, FnAbiRequest, LayoutError, LayoutOf, LayoutOfHelpers,
|
||||||
TyAndLayout,
|
TyAndLayout,
|
||||||
|
@ -508,14 +508,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
||||||
frame
|
frame
|
||||||
.instance
|
.instance
|
||||||
.try_subst_mir_and_normalize_erasing_regions(*self.tcx, self.param_env, value)
|
.try_subst_mir_and_normalize_erasing_regions(*self.tcx, self.param_env, value)
|
||||||
.map_err(|e| {
|
.map_err(|_| err_inval!(TooGeneric))
|
||||||
self.tcx.sess.delay_span_bug(
|
|
||||||
self.cur_span(),
|
|
||||||
format!("failed to normalize {}", e.get_type_for_failure()).as_str(),
|
|
||||||
);
|
|
||||||
|
|
||||||
InterpError::InvalidProgram(InvalidProgramInfo::TooGeneric)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The `substs` are assumed to already be in our interpreter "universe" (param_env).
|
/// The `substs` are assumed to already be in our interpreter "universe" (param_env).
|
||||||
|
|
|
@ -1,4 +1,10 @@
|
||||||
// check-pass
|
// revisions: check build
|
||||||
|
// [check]check-pass
|
||||||
|
//
|
||||||
|
// This second configuration aims to verify that we do not ICE in ConstProp because of
|
||||||
|
// normalization failure.
|
||||||
|
// [build]build-pass
|
||||||
|
// [build]compile-flags: -Zmir-opt-level=3 --emit=mir
|
||||||
|
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue