Skip to content

Commit 8494882

Browse files
committed
Rustup to rustc 1.69.0-nightly (75a0be98f 2023-02-05)
1 parent 6dfa3c9 commit 8494882

File tree

3 files changed

+25
-12
lines changed

3 files changed

+25
-12
lines changed

build_sysroot/Cargo.lock

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust-toolchain

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[toolchain]
2-
channel = "nightly-2023-01-27"
2+
channel = "nightly-2023-02-06"
33
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]

src/base.rs

+22-9
Original file line numberDiff line numberDiff line change
@@ -790,17 +790,30 @@ fn codegen_stmt<'tcx>(
790790
let val = CValue::const_val(fx, fx.layout_of(fx.tcx.types.usize), val.into());
791791
lval.write_cvalue(fx, val);
792792
}
793-
Rvalue::Aggregate(ref kind, ref operands) => match kind.as_ref() {
794-
AggregateKind::Array(_ty) => {
795-
for (i, operand) in operands.iter().enumerate() {
796-
let operand = codegen_operand(fx, operand);
797-
let index = fx.bcx.ins().iconst(fx.pointer_type, i as i64);
798-
let to = lval.place_index(fx, index);
799-
to.write_cvalue(fx, operand);
793+
Rvalue::Aggregate(ref kind, ref operands) => {
794+
let (variant_index, variant_dest, active_field_index) = match **kind {
795+
mir::AggregateKind::Adt(_, variant_index, _, _, active_field_index) => {
796+
let variant_dest = lval.downcast_variant(fx, variant_index);
797+
(variant_index, variant_dest, active_field_index)
800798
}
799+
_ => (VariantIdx::from_u32(0), lval, None),
800+
};
801+
if active_field_index.is_some() {
802+
assert_eq!(operands.len(), 1);
801803
}
802-
_ => unreachable!("shouldn't exist at codegen {:?}", to_place_and_rval.1),
803-
},
804+
for (i, operand) in operands.iter().enumerate() {
805+
let operand = codegen_operand(fx, operand);
806+
let field_index = active_field_index.unwrap_or(i);
807+
let to = if let mir::AggregateKind::Array(_) = **kind {
808+
let index = fx.bcx.ins().iconst(fx.pointer_type, field_index as i64);
809+
variant_dest.place_index(fx, index)
810+
} else {
811+
variant_dest.place_field(fx, mir::Field::new(field_index))
812+
};
813+
to.write_cvalue(fx, operand);
814+
}
815+
crate::discriminant::codegen_set_discriminant(fx, lval, variant_index);
816+
}
804817
}
805818
}
806819
StatementKind::StorageLive(_)

0 commit comments

Comments
 (0)