Skip to content

Commit 7448c24

Browse files
committed
Aggregating arrays can always take the place path
1 parent 443bdc0 commit 7448c24

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

compiler/rustc_codegen_ssa/src/mir/rvalue.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,8 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
738738
_ => bug!("RawPtr operands {data:?} {meta:?}"),
739739
}
740740
}
741-
mir::Rvalue::Repeat(..) | mir::Rvalue::Aggregate(..) => {
741+
mir::Rvalue::Repeat(..) => bug!("{rvalue:?} in codegen_rvalue_operand"),
742+
mir::Rvalue::Aggregate(..) => {
742743
// According to `rvalue_creates_operand`, only ZST
743744
// aggregate rvalues are allowed to be operands.
744745
let ty = rvalue.ty(self.mir, self.cx.tcx());
@@ -1052,7 +1053,9 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
10521053
true,
10531054
// This always produces a `ty::RawPtr`, so will be Immediate or Pair
10541055
mir::Rvalue::Aggregate(box AggregateKind::RawPtr(..), ..) => true,
1055-
mir::Rvalue::Repeat(..) |
1056+
// Arrays are always aggregates, so it's not worth checking anything here.
1057+
// (If it's really `[(); N]` or `[T; 0]` and we use the place path, fine.)
1058+
mir::Rvalue::Repeat(..) => false,
10561059
mir::Rvalue::Aggregate(..) => {
10571060
let ty = rvalue.ty(self.mir, self.cx.tcx());
10581061
let ty = self.monomorphize(ty);

0 commit comments

Comments
 (0)