Skip to content

Commit 196f3c0

Browse files
committed
fix wrong evaluation in clippy
1 parent 6d94f95 commit 196f3c0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

clippy_utils/src/consts.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ pub fn miri_to_const<'tcx>(tcx: TyCtxt<'tcx>, result: mir::ConstantKind<'tcx>) -
619619
},
620620
mir::ConstantKind::Val(ConstValue::ByRef { alloc, offset: _ }, _) => match result.ty().kind() {
621621
ty::Array(sub_type, len) => match sub_type.kind() {
622-
ty::Float(FloatTy::F32) => match len.try_eval_usize(tcx, ty::ParamEnv::empty()) {
622+
ty::Float(FloatTy::F32) => match len.to_valtree().try_to_machine_usize(tcx) {
623623
Some(len) => alloc
624624
.inner()
625625
.inspect_with_uninit_and_ptr_outside_interpreter(0..(4 * len as usize))
@@ -634,7 +634,7 @@ pub fn miri_to_const<'tcx>(tcx: TyCtxt<'tcx>, result: mir::ConstantKind<'tcx>) -
634634
.map(Constant::Vec),
635635
_ => None,
636636
},
637-
ty::Float(FloatTy::F64) => match len.try_eval_usize(tcx, ty::ParamEnv::empty()) {
637+
ty::Float(FloatTy::F64) => match len.to_valtree().try_to_machine_usize(tcx) {
638638
Some(len) => alloc
639639
.inner()
640640
.inspect_with_uninit_and_ptr_outside_interpreter(0..(8 * len as usize))

0 commit comments

Comments
 (0)