Monomorphize constants before inspecting them

This commit is contained in:
Oli Scherer 2023-07-20 08:53:09 +00:00
parent 9e5a67e57f
commit c7428d5052
2 changed files with 5 additions and 2 deletions

View File

@ -65,7 +65,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
&self, &self,
constant: &mir::Constant<'tcx>, constant: &mir::Constant<'tcx>,
) -> Result<Option<ty::ValTree<'tcx>>, ErrorHandled> { ) -> Result<Option<ty::ValTree<'tcx>>, ErrorHandled> {
let uv = match constant.literal { let uv = match self.monomorphize(constant.literal) {
mir::ConstantKind::Unevaluated(uv, _) => uv.shrink(), mir::ConstantKind::Unevaluated(uv, _) => uv.shrink(),
mir::ConstantKind::Ty(c) => match c.kind() { mir::ConstantKind::Ty(c) => match c.kind() {
// A constant that came from a const generic but was then used as an argument to old-style // A constant that came from a const generic but was then used as an argument to old-style

View File

@ -1,4 +1,7 @@
// run-pass // run-pass
// revisions: opt noopt
//[noopt] compile-flags: -Copt-level=0
//[opt] compile-flags: -O
#![feature(repr_simd, platform_intrinsics)] #![feature(repr_simd, platform_intrinsics)]
#![allow(incomplete_features)] #![allow(incomplete_features)]
#![feature(adt_const_params)] #![feature(adt_const_params)]