diff options
| author | b-naber <bn263@gmx.de> | 2022-06-03 21:41:01 +0200 |
|---|---|---|
| committer | b-naber <bn263@gmx.de> | 2022-06-14 16:11:35 +0200 |
| commit | 196f3c0e71e8affdb7173bde486f17649da51ae9 (patch) | |
| tree | 68ee946a7d012981cb934da73aa1305daf292fca | |
| parent | 6d94f95a201582e6c99ffc54573cd06fdfd0c165 (diff) | |
| download | rust-196f3c0e71e8affdb7173bde486f17649da51ae9.tar.gz rust-196f3c0e71e8affdb7173bde486f17649da51ae9.zip | |
fix wrong evaluation in clippy
| -rw-r--r-- | clippy_utils/src/consts.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clippy_utils/src/consts.rs b/clippy_utils/src/consts.rs index 6709ac13a43..5d0ce6cc620 100644 --- a/clippy_utils/src/consts.rs +++ b/clippy_utils/src/consts.rs @@ -619,7 +619,7 @@ pub fn miri_to_const<'tcx>(tcx: TyCtxt<'tcx>, result: mir::ConstantKind<'tcx>) - }, mir::ConstantKind::Val(ConstValue::ByRef { alloc, offset: _ }, _) => match result.ty().kind() { ty::Array(sub_type, len) => match sub_type.kind() { - ty::Float(FloatTy::F32) => match len.try_eval_usize(tcx, ty::ParamEnv::empty()) { + ty::Float(FloatTy::F32) => match len.to_valtree().try_to_machine_usize(tcx) { Some(len) => alloc .inner() .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>) - .map(Constant::Vec), _ => None, }, - ty::Float(FloatTy::F64) => match len.try_eval_usize(tcx, ty::ParamEnv::empty()) { + ty::Float(FloatTy::F64) => match len.to_valtree().try_to_machine_usize(tcx) { Some(len) => alloc .inner() .inspect_with_uninit_and_ptr_outside_interpreter(0..(8 * len as usize)) |
