about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-04-02 21:40:29 +0000
committerbors <bors@rust-lang.org>2023-04-02 21:40:29 +0000
commita93bcdc30771340dfff914a1cf48556886ad33a6 (patch)
treeaf18945bacc5061e824a46c8dfa5dce862c9657b /compiler/rustc_mir_transform/src
parent3a8a131e9509c478ece1c58fe0ea2d49463d2300 (diff)
parentb5b6def021d37c5f1cb7e06c1cf6915bcbcd53b1 (diff)
downloadrust-a93bcdc30771340dfff914a1cf48556886ad33a6.tar.gz
rust-a93bcdc30771340dfff914a1cf48556886ad33a6.zip
Auto merge of #109849 - scottmcm:more-fieldidx-rebase, r=oli-obk
Use `FieldIdx` in various things related to aggregates

Shrank `AggregateKind` by 8 bytes on x64, since the active field of a union is tracked as an `Option<FieldIdx>` instead of `Option<usize>`.

Part 3/? of https://github.com/rust-lang/compiler-team/issues/606

[`IndexSlice`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_index/vec/struct.IndexVec.html#deref-methods-IndexSlice%3CI,+T%3E) was added in https://github.com/rust-lang/rust/pull/109787
Diffstat (limited to 'compiler/rustc_mir_transform/src')
-rw-r--r--compiler/rustc_mir_transform/src/generator.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_mir_transform/src/generator.rs b/compiler/rustc_mir_transform/src/generator.rs
index 50538248d91..af6422c7246 100644
--- a/compiler/rustc_mir_transform/src/generator.rs
+++ b/compiler/rustc_mir_transform/src/generator.rs
@@ -274,7 +274,7 @@ impl<'tcx> TransformVisitor<'tcx> {
             statements.push(Statement {
                 kind: StatementKind::Assign(Box::new((
                     Place::return_place(),
-                    Rvalue::Aggregate(Box::new(kind), vec![]),
+                    Rvalue::Aggregate(Box::new(kind), IndexVec::new()),
                 ))),
                 source_info,
             });
@@ -287,7 +287,7 @@ impl<'tcx> TransformVisitor<'tcx> {
         statements.push(Statement {
             kind: StatementKind::Assign(Box::new((
                 Place::return_place(),
-                Rvalue::Aggregate(Box::new(kind), vec![val]),
+                Rvalue::Aggregate(Box::new(kind), IndexVec::from_iter([val])),
             ))),
             source_info,
         });