diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2023-10-12 17:19:19 +0000 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2023-10-21 10:30:16 +0000 |
| commit | 90e6d2995581b9f03be52ed7fa92fa6a5b981294 (patch) | |
| tree | 9be37452c6611ac037f632a1b8419db0f63df095 /compiler/rustc_mir_dataflow/src/impls | |
| parent | 8d535070a2e641889c9e51c0d093c01124bef5b0 (diff) | |
Avoid using a magic value for untracked locals.
Diffstat (limited to 'compiler/rustc_mir_dataflow/src/impls')
| -rw-r--r-- | compiler/rustc_mir_dataflow/src/impls/initialized.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/compiler/rustc_mir_dataflow/src/impls/initialized.rs b/compiler/rustc_mir_dataflow/src/impls/initialized.rs index 182f2590137..60488626974 100644 --- a/compiler/rustc_mir_dataflow/src/impls/initialized.rs +++ b/compiler/rustc_mir_dataflow/src/impls/initialized.rs @@ -690,9 +690,13 @@ impl<'tcx> GenKillAnalysis<'tcx> for EverInitializedPlaces<'_, 'tcx> { if let mir::StatementKind::StorageDead(local) = stmt.kind { // End inits for StorageDead, so that an immutable variable can // be reinitialized on the next iteration of the loop. - let move_path_index = rev_lookup.find_local(local); - debug!("clears the ever initialized status of {:?}", init_path_map[move_path_index]); - trans.kill_all(init_path_map[move_path_index].iter().copied()); + if let Some(move_path_index) = rev_lookup.find_local(local) { + debug!( + "clears the ever initialized status of {:?}", + init_path_map[move_path_index] + ); + trans.kill_all(init_path_map[move_path_index].iter().copied()); + } } } |
