diff options
| author | bors <bors@rust-lang.org> | 2024-04-02 17:08:11 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-04-02 17:08:11 +0000 |
| commit | 029cb1b13b6388b95e64e8996ec8b41a9f3cf16e (patch) | |
| tree | 4e80aead28e2d5ca6c74abd485309789bba8dad1 /compiler/rustc_mir_transform/src | |
| parent | 36b6f9b58e78a1225a322a759e42c262e6dc8d5d (diff) | |
| parent | 44680680efb5efc3dbfc54619a19015b967271d7 (diff) | |
| download | rust-029cb1b13b6388b95e64e8996ec8b41a9f3cf16e.tar.gz rust-029cb1b13b6388b95e64e8996ec8b41a9f3cf16e.zip | |
Auto merge of #123372 - GuillaumeGomez:rollup-nwxdzev, r=GuillaumeGomez
Rollup of 4 pull requests Successful merges: - #122614 (rustdoc-search: shard the search result descriptions) - #123338 (Update to new browser-ui-test version) - #123366 (Minor by_move_body impl cleanups) - #123371 (Remove dangling `.mir.stderr` and `.thir.stderr` test files) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_mir_transform/src')
| -rw-r--r-- | compiler/rustc_mir_transform/src/coroutine/by_move_body.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/compiler/rustc_mir_transform/src/coroutine/by_move_body.rs b/compiler/rustc_mir_transform/src/coroutine/by_move_body.rs index e0bbd582d88..99dbb342268 100644 --- a/compiler/rustc_mir_transform/src/coroutine/by_move_body.rs +++ b/compiler/rustc_mir_transform/src/coroutine/by_move_body.rs @@ -3,7 +3,7 @@ //! be a coroutine body that takes all of its upvars by-move, and which we stash //! into the `CoroutineInfo` for all coroutines returned by coroutine-closures. -use rustc_data_structures::fx::FxIndexSet; +use rustc_data_structures::unord::UnordSet; use rustc_hir as hir; use rustc_middle::mir::visit::MutVisitor; use rustc_middle::mir::{self, dump_mir, MirPass}; @@ -33,7 +33,7 @@ impl<'tcx> MirPass<'tcx> for ByMoveBody { return; } - let mut by_ref_fields = FxIndexSet::default(); + let mut by_ref_fields = UnordSet::default(); let by_move_upvars = Ty::new_tup_from_iter( tcx, tcx.closure_captures(coroutine_def_id).iter().enumerate().map(|(idx, capture)| { @@ -73,7 +73,7 @@ impl<'tcx> MirPass<'tcx> for ByMoveBody { struct MakeByMoveBody<'tcx> { tcx: TyCtxt<'tcx>, - by_ref_fields: FxIndexSet<FieldIdx>, + by_ref_fields: UnordSet<FieldIdx>, by_move_coroutine_ty: Ty<'tcx>, } @@ -89,11 +89,11 @@ impl<'tcx> MutVisitor<'tcx> for MakeByMoveBody<'tcx> { location: mir::Location, ) { if place.local == ty::CAPTURE_STRUCT_LOCAL - && !place.projection.is_empty() - && let mir::ProjectionElem::Field(idx, ty) = place.projection[0] + && let Some((&mir::ProjectionElem::Field(idx, ty), projection)) = + place.projection.split_first() && self.by_ref_fields.contains(&idx) { - let (begin, end) = place.projection[1..].split_first().unwrap(); + let (begin, end) = projection.split_first().unwrap(); // FIXME(async_closures): I'm actually a bit surprised to see that we always // initially deref the by-ref upvars. If this is not actually true, then we // will at least get an ICE that explains why this isn't true :^) |
