diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2025-03-17 01:34:46 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2025-03-24 23:03:11 +0300 |
| commit | ba4190cf7e919d7cc31c366906ded41874ef0439 (patch) | |
| tree | 33e1f9e95d75ccc394d156e3a76a30e307b99d50 /compiler/rustc_resolve/src/imports.rs | |
| parent | 4510e86a41388733675465a8647d4235f3bf2023 (diff) | |
| download | rust-ba4190cf7e919d7cc31c366906ded41874ef0439.tar.gz rust-ba4190cf7e919d7cc31c366906ded41874ef0439.zip | |
resolve: Avoid some unstable iteration 2
Diffstat (limited to 'compiler/rustc_resolve/src/imports.rs')
| -rw-r--r-- | compiler/rustc_resolve/src/imports.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_resolve/src/imports.rs b/compiler/rustc_resolve/src/imports.rs index 89b9a074351..454460e10dc 100644 --- a/compiler/rustc_resolve/src/imports.rs +++ b/compiler/rustc_resolve/src/imports.rs @@ -4,7 +4,7 @@ use std::cell::Cell; use std::mem; use rustc_ast::NodeId; -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::fx::{FxHashSet, FxIndexSet}; use rustc_data_structures::intern::Interned; use rustc_errors::codes::*; use rustc_errors::{Applicability, MultiSpan, pluralize, struct_span_code_err}; @@ -233,7 +233,7 @@ impl<'ra> ImportData<'ra> { pub(crate) struct NameResolution<'ra> { /// Single imports that may define the name in the namespace. /// Imports are arena-allocated, so it's ok to use pointers as keys. - pub single_imports: FxHashSet<Import<'ra>>, + pub single_imports: FxIndexSet<Import<'ra>>, /// The least shadowable known binding for this name, or None if there are no known bindings. pub binding: Option<NameBinding<'ra>>, pub shadowed_glob: Option<NameBinding<'ra>>, @@ -494,7 +494,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { let key = BindingKey::new(target, ns); let _ = this.try_define(import.parent_scope.module, key, dummy_binding, false); this.update_resolution(import.parent_scope.module, key, false, |_, resolution| { - resolution.single_imports.remove(&import); + resolution.single_imports.swap_remove(&import); }) }); self.record_use(target, dummy_binding, Used::Other); @@ -862,7 +862,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { } let key = BindingKey::new(target, ns); this.update_resolution(parent, key, false, |_, resolution| { - resolution.single_imports.remove(&import); + resolution.single_imports.swap_remove(&import); }); } } |
