diff options
| author | Scott McMurray <scottmcm@users.noreply.github.com> | 2025-06-03 23:42:21 -0700 |
|---|---|---|
| committer | Scott McMurray <scottmcm@users.noreply.github.com> | 2025-06-03 23:42:21 -0700 |
| commit | ee9901e65c78f70b93dab5bd1e04bd77273b7c40 (patch) | |
| tree | c3092c96901856e9a3529b70cbcb448ab4646bb0 /compiler/rustc_codegen_ssa/src | |
| parent | 792fc2b033aea7ea7b766e38bdc40f7d6bdce8c3 (diff) | |
| download | rust-ee9901e65c78f70b93dab5bd1e04bd77273b7c40.tar.gz rust-ee9901e65c78f70b93dab5bd1e04bd77273b7c40.zip | |
Change `tag_field` to `FieldIdx` in `Variants::Multiple`
It was already available as a generic parameter anyway, and it's not like we'll ever put a tag in the 5-billionth field.
Diffstat (limited to 'compiler/rustc_codegen_ssa/src')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/mir/operand.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/mir/place.rs | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_codegen_ssa/src/mir/operand.rs b/compiler/rustc_codegen_ssa/src/mir/operand.rs index eade9e52de9..b7f2277bfda 100644 --- a/compiler/rustc_codegen_ssa/src/mir/operand.rs +++ b/compiler/rustc_codegen_ssa/src/mir/operand.rs @@ -462,10 +462,10 @@ impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V> { let tag_op = match self.val { OperandValue::ZeroSized => bug!(), OperandValue::Immediate(_) | OperandValue::Pair(_, _) => { - self.extract_field(fx, bx, tag_field) + self.extract_field(fx, bx, tag_field.as_usize()) } OperandValue::Ref(place) => { - let tag = place.with_type(self.layout).project_field(bx, tag_field); + let tag = place.with_type(self.layout).project_field(bx, tag_field.as_usize()); bx.load_operand(tag) } }; diff --git a/compiler/rustc_codegen_ssa/src/mir/place.rs b/compiler/rustc_codegen_ssa/src/mir/place.rs index 31db7fa9a18..937063c24a6 100644 --- a/compiler/rustc_codegen_ssa/src/mir/place.rs +++ b/compiler/rustc_codegen_ssa/src/mir/place.rs @@ -250,7 +250,7 @@ impl<'a, 'tcx, V: CodegenObject> PlaceRef<'tcx, V> { Variants::Single { index } => assert_eq!(index, variant_index), Variants::Multiple { tag_encoding: TagEncoding::Direct, tag_field, .. } => { - let ptr = self.project_field(bx, tag_field); + let ptr = self.project_field(bx, tag_field.as_usize()); let to = self.layout.ty.discriminant_for_variant(bx.tcx(), variant_index).unwrap().val; bx.store_to_place( @@ -265,7 +265,7 @@ impl<'a, 'tcx, V: CodegenObject> PlaceRef<'tcx, V> { .. } => { if variant_index != untagged_variant { - let niche = self.project_field(bx, tag_field); + let niche = self.project_field(bx, tag_field.as_usize()); let niche_llty = bx.cx().immediate_backend_type(niche.layout); let BackendRepr::Scalar(scalar) = niche.layout.backend_repr else { bug!("expected a scalar placeref for the niche"); |
