Skip to content

Commit dd6534a

Browse files
authored
Rollup merge of rust-lang#108047 - oli-obk:machine->🞋, r=RalfJung
Use `target` instead of `machine` for mir interpreter integer handling. The naming of `machine` only makes sense from a mir interpreter internals perspective, but outside users talk about the `target` platform. As per rust-lang#108029 (comment) r? `@RalfJung`
2 parents 30f38d6 + cecc45c commit dd6534a

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

clippy_lints/src/large_const_arrays.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ impl<'tcx> LateLintPass<'tcx> for LargeConstArrays {
5454
let ty = hir_ty_to_ty(cx.tcx, hir_ty);
5555
if let ty::Array(element_type, cst) = ty.kind();
5656
if let ConstKind::Value(ty::ValTree::Leaf(element_count)) = cst.kind();
57-
if let Ok(element_count) = element_count.try_to_machine_usize(cx.tcx);
57+
if let Ok(element_count) = element_count.try_to_target_usize(cx.tcx);
5858
if let Ok(element_size) = cx.layout_of(*element_type).map(|l| l.size.bytes());
5959
if self.maximum_allowed_size < u128::from(element_count) * u128::from(element_size);
6060

clippy_lints/src/large_stack_arrays.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ impl<'tcx> LateLintPass<'tcx> for LargeStackArrays {
4141
if let ExprKind::Repeat(_, _) = expr.kind
4242
&& let ty::Array(element_type, cst) = cx.typeck_results().expr_ty(expr).kind()
4343
&& let ConstKind::Value(ty::ValTree::Leaf(element_count)) = cst.kind()
44-
&& let Ok(element_count) = element_count.try_to_machine_usize(cx.tcx)
44+
&& let Ok(element_count) = element_count.try_to_target_usize(cx.tcx)
4545
&& let Ok(element_size) = cx.layout_of(*element_type).map(|l| l.size.bytes())
4646
&& !cx.tcx.hir().parent_iter(expr.hir_id)
4747
.any(|(_, node)| matches!(node, Node::Item(Item { kind: ItemKind::Static(..), .. })))

clippy_utils/src/consts.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ pub fn miri_to_const<'tcx>(tcx: TyCtxt<'tcx>, result: mir::ConstantKind<'tcx>) -
640640
},
641641
mir::ConstantKind::Val(ConstValue::ByRef { alloc, offset: _ }, _) => match result.ty().kind() {
642642
ty::Array(sub_type, len) => match sub_type.kind() {
643-
ty::Float(FloatTy::F32) => match len.kind().try_to_machine_usize(tcx) {
643+
ty::Float(FloatTy::F32) => match len.kind().try_to_target_usize(tcx) {
644644
Some(len) => alloc
645645
.inner()
646646
.inspect_with_uninit_and_ptr_outside_interpreter(0..(4 * usize::try_from(len).unwrap()))
@@ -651,7 +651,7 @@ pub fn miri_to_const<'tcx>(tcx: TyCtxt<'tcx>, result: mir::ConstantKind<'tcx>) -
651651
.map(Constant::Vec),
652652
_ => None,
653653
},
654-
ty::Float(FloatTy::F64) => match len.kind().try_to_machine_usize(tcx) {
654+
ty::Float(FloatTy::F64) => match len.kind().try_to_target_usize(tcx) {
655655
Some(len) => alloc
656656
.inner()
657657
.inspect_with_uninit_and_ptr_outside_interpreter(0..(8 * usize::try_from(len).unwrap()))

0 commit comments

Comments
 (0)