Bump indexmap

`swap` has been deprecated in favour of `swap_remove` - the behaviour
is the same though.
This commit is contained in:
clubby789 2024-01-28 20:53:28 +00:00
parent a84bb95a1f
commit 4de3a3af4a
25 changed files with 65 additions and 34 deletions

View File

@ -2014,9 +2014,9 @@ checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683"
[[package]] [[package]]
name = "indexmap" name = "indexmap"
version = "2.0.0" version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" checksum = "cf2a4f498956c7723dc280afc6a37d0dec50b39a29e232c6187ce4503703e8c2"
dependencies = [ dependencies = [
"equivalent", "equivalent",
"hashbrown", "hashbrown",

View File

@ -2479,7 +2479,8 @@ pub fn get_buffered_mut_error(
&mut self, &mut self,
span: Span, span: Span,
) -> Option<(DiagnosticBuilder<'tcx>, usize)> { ) -> Option<(DiagnosticBuilder<'tcx>, usize)> {
self.diags.buffered_mut_errors.remove(&span) // FIXME(#120456) - is `swap_remove` correct?
self.diags.buffered_mut_errors.swap_remove(&span)
} }
pub fn buffer_mut_error(&mut self, span: Span, t: DiagnosticBuilder<'tcx>, count: usize) { pub fn buffer_mut_error(&mut self, span: Span, t: DiagnosticBuilder<'tcx>, count: usize) {

View File

@ -58,7 +58,8 @@ fn remove_never_initialized_mut_locals(&mut self, into: Place<'_>) {
// be those that were never initialized - we will consider those as being used as // be those that were never initialized - we will consider those as being used as
// they will either have been removed by unreachable code optimizations; or linted // they will either have been removed by unreachable code optimizations; or linted
// as unused variables. // as unused variables.
self.never_initialized_mut_locals.remove(&into.local); // FIXME(#120456) - is `swap_remove` correct?
self.never_initialized_mut_locals.swap_remove(&into.local);
} }
} }

View File

@ -106,7 +106,8 @@ fn asm_target_features(tcx: TyCtxt<'_>, did: DefId) -> &FxIndexSet<Symbol> {
match attrs.instruction_set { match attrs.instruction_set {
None => {} None => {}
Some(InstructionSetAttr::ArmA32) => { Some(InstructionSetAttr::ArmA32) => {
target_features.remove(&sym::thumb_mode); // FIXME(#120456) - is `swap_remove` correct?
target_features.swap_remove(&sym::thumb_mode);
} }
Some(InstructionSetAttr::ArmT32) => { Some(InstructionSetAttr::ArmT32) => {
target_features.insert(sym::thumb_mode); target_features.insert(sym::thumb_mode);

View File

@ -122,7 +122,8 @@ fn remove<Q: ?Sized + Hash + Eq>(&mut self, k: &Q) -> Option<V>
where where
K: Borrow<Q>, K: Borrow<Q>,
{ {
FxIndexMap::remove(self, k) // FIXME(#120456) - is `swap_remove` correct?
FxIndexMap::swap_remove(self, k)
} }
#[inline(always)] #[inline(always)]

View File

@ -49,7 +49,8 @@ fn intern_shallow<'rt, 'mir, 'tcx, T, M: CompileTimeMachine<'mir, 'tcx, T>>(
) -> Result<impl Iterator<Item = CtfeProvenance> + 'tcx, ()> { ) -> Result<impl Iterator<Item = CtfeProvenance> + 'tcx, ()> {
trace!("intern_shallow {:?}", alloc_id); trace!("intern_shallow {:?}", alloc_id);
// remove allocation // remove allocation
let Some((_kind, mut alloc)) = ecx.memory.alloc_map.remove(&alloc_id) else { // FIXME(#120456) - is `swap_remove` correct?
let Some((_kind, mut alloc)) = ecx.memory.alloc_map.swap_remove(&alloc_id) else {
return Err(()); return Err(());
}; };
// Set allocation mutability as appropriate. This is used by LLVM to put things into // Set allocation mutability as appropriate. This is used by LLVM to put things into

View File

@ -1635,7 +1635,8 @@ fn emit_messages_default_inner(
let mut to_add = FxHashMap::default(); let mut to_add = FxHashMap::default();
for (depth, style) in depths { for (depth, style) in depths {
if multilines.remove(&depth).is_none() { // FIXME(#120456) - is `swap_remove` correct?
if multilines.swap_remove(&depth).is_none() {
to_add.insert(depth, style); to_add.insert(depth, style);
} }
} }

View File

@ -707,7 +707,8 @@ pub fn stash_diagnostic(&self, span: Span, key: StashKey, diag: Diagnostic) {
pub fn steal_diagnostic(&self, span: Span, key: StashKey) -> Option<DiagnosticBuilder<'_, ()>> { pub fn steal_diagnostic(&self, span: Span, key: StashKey) -> Option<DiagnosticBuilder<'_, ()>> {
let mut inner = self.inner.borrow_mut(); let mut inner = self.inner.borrow_mut();
let key = (span.with_parent(None), key); let key = (span.with_parent(None), key);
let diag = inner.stashed_diagnostics.remove(&key)?; // FIXME(#120456) - is `swap_remove` correct?
let diag = inner.stashed_diagnostics.swap_remove(&key)?;
if diag.is_error() { if diag.is_error() {
if diag.is_lint.is_none() { if diag.is_lint.is_none() {
inner.stashed_err_count -= 1; inner.stashed_err_count -= 1;

View File

@ -218,7 +218,8 @@ trait here instead: `trait NewTrait: {} {{}}`",
for def_ids in associated_types.values_mut() { for def_ids in associated_types.values_mut() {
for (projection_bound, span) in &projection_bounds { for (projection_bound, span) in &projection_bounds {
let def_id = projection_bound.projection_def_id(); let def_id = projection_bound.projection_def_id();
def_ids.remove(&def_id); // FIXME(#120456) - is `swap_remove` correct?
def_ids.swap_remove(&def_id);
if tcx.generics_require_sized_self(def_id) { if tcx.generics_require_sized_self(def_id) {
tcx.emit_node_span_lint( tcx.emit_node_span_lint(
UNUSED_ASSOCIATED_TYPE_BOUNDS, UNUSED_ASSOCIATED_TYPE_BOUNDS,

View File

@ -1873,7 +1873,8 @@ fn uninsert_lifetime_on_error(
lifetime_ref: &'tcx hir::Lifetime, lifetime_ref: &'tcx hir::Lifetime,
bad_def: ResolvedArg, bad_def: ResolvedArg,
) { ) {
let old_value = self.map.defs.remove(&lifetime_ref.hir_id); // FIXME(#120456) - is `swap_remove` correct?
let old_value = self.map.defs.swap_remove(&lifetime_ref.hir_id);
assert_eq!(old_value, Some(bad_def)); assert_eq!(old_value, Some(bad_def));
} }
} }

View File

@ -1579,7 +1579,8 @@ pub(in super::super) fn with_breakable_ctxt<F: FnOnce() -> R, R>(
let ctxt = { let ctxt = {
let mut enclosing_breakables = self.enclosing_breakables.borrow_mut(); let mut enclosing_breakables = self.enclosing_breakables.borrow_mut();
debug_assert!(enclosing_breakables.stack.len() == index + 1); debug_assert!(enclosing_breakables.stack.len() == index + 1);
enclosing_breakables.by_id.remove(&id).expect("missing breakable context"); // FIXME(#120456) - is `swap_remove` correct?
enclosing_breakables.by_id.swap_remove(&id).expect("missing breakable context");
enclosing_breakables.stack.pop().expect("missing breakable context") enclosing_breakables.stack.pop().expect("missing breakable context")
}; };
(ctxt, result) (ctxt, result)

View File

@ -20,7 +20,8 @@ pub(crate) fn remove(&mut self, key: OpaqueTypeKey<'tcx>, idx: Option<OpaqueHidd
if let Some(idx) = idx { if let Some(idx) = idx {
self.opaque_types.get_mut(&key).unwrap().hidden_type = idx; self.opaque_types.get_mut(&key).unwrap().hidden_type = idx;
} else { } else {
match self.opaque_types.remove(&key) { // FIXME(#120456) - is `swap_remove` correct?
match self.opaque_types.swap_remove(&key) {
None => bug!("reverted opaque type inference that was never registered: {:?}", key), None => bug!("reverted opaque type inference that was never registered: {:?}", key),
Some(_) => {} Some(_) => {}
} }

View File

@ -708,7 +708,8 @@ pub fn add_lint(
} }
pub fn take(&mut self, id: NodeId) -> Vec<BufferedEarlyLint> { pub fn take(&mut self, id: NodeId) -> Vec<BufferedEarlyLint> {
self.map.remove(&id).unwrap_or_default() // FIXME(#120456) - is `swap_remove` correct?
self.map.swap_remove(&id).unwrap_or_default()
} }
pub fn buffer_lint( pub fn buffer_lint(

View File

@ -398,7 +398,8 @@ fn entry_filter_candidates(
let candidates = entry.get_mut(); let candidates = entry.get_mut();
Self::vec_filter_candidates(p, candidates, f, at); Self::vec_filter_candidates(p, candidates, f, at);
if candidates.len() == 0 { if candidates.len() == 0 {
entry.remove(); // FIXME(#120456) - is `swap_remove` correct?
entry.swap_remove();
} }
} }

View File

@ -957,8 +957,9 @@ pub fn check_unused_or_stable_features(tcx: TyCtxt<'_>) {
// available as we'd like it to be. // available as we'd like it to be.
// FIXME: only remove `libc` when `stdbuild` is active. // FIXME: only remove `libc` when `stdbuild` is active.
// FIXME: remove special casing for `test`. // FIXME: remove special casing for `test`.
remaining_lib_features.remove(&sym::libc); // FIXME(#120456) - is `swap_remove` correct?
remaining_lib_features.remove(&sym::test); remaining_lib_features.swap_remove(&sym::libc);
remaining_lib_features.swap_remove(&sym::test);
/// For each feature in `defined_features`.. /// For each feature in `defined_features`..
/// ///
@ -996,7 +997,8 @@ fn check_features<'tcx>(
unnecessary_stable_feature_lint(tcx, *span, feature, since); unnecessary_stable_feature_lint(tcx, *span, feature, since);
} }
} }
remaining_lib_features.remove(&feature); // FIXME(#120456) - is `swap_remove` correct?
remaining_lib_features.swap_remove(&feature);
// `feature` is the feature doing the implying, but `implied_by` is the feature with // `feature` is the feature doing the implying, but `implied_by` is the feature with
// the attribute that establishes this relationship. `implied_by` is guaranteed to be a // the attribute that establishes this relationship. `implied_by` is guaranteed to be a

View File

@ -92,7 +92,8 @@ fn check_import(&mut self, id: ast::NodeId) {
} else { } else {
// This trait import is definitely used, in a way other than // This trait import is definitely used, in a way other than
// method resolution. // method resolution.
self.r.maybe_unused_trait_imports.remove(&def_id); // FIXME(#120456) - is `swap_remove` correct?
self.r.maybe_unused_trait_imports.swap_remove(&def_id);
if let Some(i) = self.unused_imports.get_mut(&self.base_id) { if let Some(i) = self.unused_imports.get_mut(&self.base_id) {
i.unused.remove(&id); i.unused.remove(&id);
} }

View File

@ -524,13 +524,15 @@ fn map_vid_to_region<'cx>(
if let Entry::Occupied(v) = vid_map.entry(*smaller) { if let Entry::Occupied(v) = vid_map.entry(*smaller) {
let smaller_deps = v.into_mut(); let smaller_deps = v.into_mut();
smaller_deps.larger.insert(*larger); smaller_deps.larger.insert(*larger);
smaller_deps.larger.remove(&target); // FIXME(#120456) - is `swap_remove` correct?
smaller_deps.larger.swap_remove(&target);
} }
if let Entry::Occupied(v) = vid_map.entry(*larger) { if let Entry::Occupied(v) = vid_map.entry(*larger) {
let larger_deps = v.into_mut(); let larger_deps = v.into_mut();
larger_deps.smaller.insert(*smaller); larger_deps.smaller.insert(*smaller);
larger_deps.smaller.remove(&target); // FIXME(#120456) - is `swap_remove` correct?
larger_deps.smaller.swap_remove(&target);
} }
} }
(&RegionTarget::RegionVid(v1), &RegionTarget::Region(r1)) => { (&RegionTarget::RegionVid(v1), &RegionTarget::Region(r1)) => {
@ -543,13 +545,15 @@ fn map_vid_to_region<'cx>(
if let Entry::Occupied(v) = vid_map.entry(*smaller) { if let Entry::Occupied(v) = vid_map.entry(*smaller) {
let smaller_deps = v.into_mut(); let smaller_deps = v.into_mut();
smaller_deps.larger.insert(*larger); smaller_deps.larger.insert(*larger);
smaller_deps.larger.remove(&target); // FIXME(#120456) - is `swap_remove` correct?
smaller_deps.larger.swap_remove(&target);
} }
if let Entry::Occupied(v) = vid_map.entry(*larger) { if let Entry::Occupied(v) = vid_map.entry(*larger) {
let larger_deps = v.into_mut(); let larger_deps = v.into_mut();
larger_deps.smaller.insert(*smaller); larger_deps.smaller.insert(*smaller);
larger_deps.smaller.remove(&target); // FIXME(#120456) - is `swap_remove` correct?
larger_deps.smaller.swap_remove(&target);
} }
} }
} }

View File

@ -522,7 +522,8 @@ pub(crate) fn to_pretty_impl_header(tcx: TyCtxt<'_>, impl_def_id: DefId) -> Opti
for (p, _) in predicates { for (p, _) in predicates {
if let Some(poly_trait_ref) = p.as_trait_clause() { if let Some(poly_trait_ref) = p.as_trait_clause() {
if Some(poly_trait_ref.def_id()) == sized_trait { if Some(poly_trait_ref.def_id()) == sized_trait {
types_without_default_bounds.remove(&poly_trait_ref.self_ty().skip_binder()); // FIXME(#120456) - is `swap_remove` correct?
types_without_default_bounds.swap_remove(&poly_trait_ref.self_ty().skip_binder());
continue; continue;
} }
} }

View File

@ -511,7 +511,8 @@ fn scan_block_for_eq<'tcx>(
for stmt in &stmts[stmts.len() - init..=stmts.len() - offset] { for stmt in &stmts[stmts.len() - init..=stmts.len() - offset] {
if let StmtKind::Local(l) = stmt.kind { if let StmtKind::Local(l) = stmt.kind {
l.pat.each_binding_or_first(&mut |_, id, _, _| { l.pat.each_binding_or_first(&mut |_, id, _, _| {
eq.locals.remove(&id); // FIXME(rust/#120456) - is `swap_remove` correct?
eq.locals.swap_remove(&id);
}); });
} }
} }

View File

@ -138,7 +138,8 @@ impl<'a, 'tcx> Delegate<'tcx> for EscapeDelegate<'a, 'tcx> {
fn consume(&mut self, cmt: &PlaceWithHirId<'tcx>, _: HirId) { fn consume(&mut self, cmt: &PlaceWithHirId<'tcx>, _: HirId) {
if cmt.place.projections.is_empty() { if cmt.place.projections.is_empty() {
if let PlaceBase::Local(lid) = cmt.place.base { if let PlaceBase::Local(lid) = cmt.place.base {
self.set.remove(&lid); // FIXME(rust/#120456) - is `swap_remove` correct?
self.set.swap_remove(&lid);
} }
} }
} }
@ -146,7 +147,8 @@ fn consume(&mut self, cmt: &PlaceWithHirId<'tcx>, _: HirId) {
fn borrow(&mut self, cmt: &PlaceWithHirId<'tcx>, _: HirId, _: ty::BorrowKind) { fn borrow(&mut self, cmt: &PlaceWithHirId<'tcx>, _: HirId, _: ty::BorrowKind) {
if cmt.place.projections.is_empty() { if cmt.place.projections.is_empty() {
if let PlaceBase::Local(lid) = cmt.place.base { if let PlaceBase::Local(lid) = cmt.place.base {
self.set.remove(&lid); // FIXME(rust/#120456) - is `swap_remove` correct?
self.set.swap_remove(&lid);
} }
} }
} }

View File

@ -106,7 +106,8 @@ fn find_slice_values(cx: &LateContext<'_>, pat: &hir::Pat<'_>) -> FxIndexMap<hir
} }
if sub_pat.is_some() { if sub_pat.is_some() {
removed_pat.insert(value_hir_id); removed_pat.insert(value_hir_id);
slices.remove(&value_hir_id); // FIXME(rust/#120456) - is `swap_remove` correct?
slices.swap_remove(&value_hir_id);
return; return;
} }
@ -259,7 +260,8 @@ fn visit_expr(&mut self, expr: &'tcx hir::Expr<'tcx>) {
} }
// The slice was used for something other than indexing // The slice was used for something other than indexing
self.slice_lint_info.remove(&local_id); // FIXME(rust/#120456) - is `swap_remove` correct?
self.slice_lint_info.swap_remove(&local_id);
} }
intravisit::walk_expr(self, expr); intravisit::walk_expr(self, expr);
} }

View File

@ -415,6 +415,7 @@ fn pat_contains_local(pat: &Pat<'_>, id: HirId) -> bool {
/// Returns true if all the bindings in the `Pat` are in `ids` and vice versa /// Returns true if all the bindings in the `Pat` are in `ids` and vice versa
fn bindings_eq(pat: &Pat<'_>, mut ids: HirIdSet) -> bool { fn bindings_eq(pat: &Pat<'_>, mut ids: HirIdSet) -> bool {
let mut result = true; let mut result = true;
pat.each_binding_or_first(&mut |_, id, _, _| result &= ids.remove(&id)); // FIXME(rust/#120456) - is `swap_remove` correct?
pat.each_binding_or_first(&mut |_, id, _, _| result &= ids.swap_remove(&id));
result && ids.is_empty() result && ids.is_empty()
} }

View File

@ -382,7 +382,8 @@ fn consume(&mut self, cmt: &euv::PlaceWithHirId<'tcx>, id: HirId) {
self.add_mutably_used_var(*vid); self.add_mutably_used_var(*vid);
} }
self.prev_bind = None; self.prev_bind = None;
self.prev_move_to_closure.remove(vid); // FIXME(rust/#120456) - is `swap_remove` correct?
self.prev_move_to_closure.swap_remove(vid);
} }
} }

View File

@ -98,7 +98,8 @@ fn check_block(&mut self, _: &LateContext<'tcx>, _: &'tcx rustc_hir::Block<'tcx>
fn check_block_post(&mut self, cx: &LateContext<'tcx>, _: &'tcx rustc_hir::Block<'tcx>) { fn check_block_post(&mut self, cx: &LateContext<'tcx>, _: &'tcx rustc_hir::Block<'tcx>) {
for hir_id in self.local_bindings.pop().unwrap() { for hir_id in self.local_bindings.pop().unwrap() {
if let Some(span) = self.underscore_bindings.remove(&hir_id) { // FIXME(rust/#120456) - is `swap_remove` correct?
if let Some(span) = self.underscore_bindings.swap_remove(&hir_id) {
span_lint_hir( span_lint_hir(
cx, cx,
NO_EFFECT_UNDERSCORE_BINDING, NO_EFFECT_UNDERSCORE_BINDING,
@ -112,7 +113,8 @@ fn check_block_post(&mut self, cx: &LateContext<'tcx>, _: &'tcx rustc_hir::Block
fn check_expr(&mut self, _: &LateContext<'tcx>, expr: &'tcx rustc_hir::Expr<'tcx>) { fn check_expr(&mut self, _: &LateContext<'tcx>, expr: &'tcx rustc_hir::Expr<'tcx>) {
if let Some(def_id) = path_to_local(expr) { if let Some(def_id) = path_to_local(expr) {
self.underscore_bindings.remove(&def_id); // FIXME(rust/#120456) - is `swap_remove` correct?
self.underscore_bindings.swap_remove(&def_id);
} }
} }
} }

View File

@ -153,7 +153,8 @@ fn remove_by_id(&mut self, id: HirId) {
param.uses = Vec::new(); param.uses = Vec::new();
let key = (param.fn_id, param.idx); let key = (param.fn_id, param.idx);
self.by_fn.remove(&key); self.by_fn.remove(&key);
self.by_id.remove(&id); // FIXME(rust/#120456) - is `swap_remove` correct?
self.by_id.swap_remove(&id);
} }
} }