Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd37f456

Browse files
committed
Avoid aFieldIdx::from_usize in InstSimplify
1 parentb092569 commitd37f456

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

‎compiler/rustc_mir_transform/src/dataflow_const_prop.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,10 @@ impl<'tcx> ValueAnalysis<'tcx> for ConstAnalysis<'_, 'tcx> {
142142
_ =>return,
143143
};
144144
ifletSome(variant_target_idx) = variant_target{
145-
for(field_index, operand)in operands.iter().enumerate(){
145+
for(field_index, operand)in operands.iter_enumerated(){
146146
ifletSome(field) =self.map().apply(
147147
variant_target_idx,
148-
TrackElem::Field(FieldIdx::from_usize(field_index)),
148+
TrackElem::Field(field_index),
149149
){
150150
self.assign_operand(state, field, operand);
151151
}

‎compiler/rustc_mir_transform/src/instsimplify.rs‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use rustc_middle::ty::layout::ValidityRequirement;
99
use rustc_middle::ty::{self,GenericArgsRef,ParamEnv,Ty,TyCtxt};
1010
use rustc_span::sym;
1111
use rustc_span::symbol::Symbol;
12-
use rustc_target::abi::FieldIdx;
1312
use rustc_target::spec::abi::Abi;
1413

1514
pubstructInstSimplify;
@@ -217,11 +216,11 @@ impl<'tcx> InstSimplifyContext<'tcx, '_> {
217216
&&letSome(place) = operand.place()
218217
{
219218
let variant = adt_def.non_enum_variant();
220-
for(i, field)in variant.fields.iter().enumerate(){
219+
for(i, field)in variant.fields.iter_enumerated(){
221220
let field_ty = field.ty(self.tcx, args);
222221
if field_ty ==*cast_ty{
223222
let place = place.project_deeper(
224-
&[ProjectionElem::Field(FieldIdx::from_usize(i),*cast_ty)],
223+
&[ProjectionElem::Field(i,*cast_ty)],
225224
self.tcx,
226225
);
227226
let operand =if operand.is_move(){

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp