Skip to content

Commit 7cd14d2

Browse files
committed
Auto merge of #93312 - pierwill:map-all-local-trait-impls, r=cjgillot
Return an indexmap in `all_local_trait_impls` query The data structure previously used here required that `DefId` be `Ord`. As part of #90317, we do not want `DefId` to implement `Ord`.
2 parents dca1e7a + f5fe6cd commit 7cd14d2

File tree

4 files changed

+5
-7
lines changed

4 files changed

+5
-7
lines changed

compiler/rustc_middle/src/query/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1100,7 +1100,7 @@ rustc_queries! {
11001100
}
11011101

11021102
/// Return all `impl` blocks in the current crate.
1103-
query all_local_trait_impls(_: ()) -> &'tcx BTreeMap<DefId, Vec<LocalDefId>> {
1103+
query all_local_trait_impls(_: ()) -> &'tcx rustc_data_structures::fx::FxIndexMap<DefId, Vec<LocalDefId>> {
11041104
desc { "local trait impls" }
11051105
}
11061106

compiler/rustc_middle/src/ty/mod.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use crate::ty::subst::{GenericArg, InternalSubsts, Subst, SubstsRef};
2828
use crate::ty::util::Discr;
2929
use rustc_ast as ast;
3030
use rustc_attr as attr;
31-
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
31+
use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap};
3232
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
3333
use rustc_data_structures::tagged_ptr::CopyTaggedPtr;
3434
use rustc_hir as hir;
@@ -43,7 +43,6 @@ use rustc_span::{sym, Span};
4343
use rustc_target::abi::Align;
4444

4545
use std::cmp::Ordering;
46-
use std::collections::BTreeMap;
4746
use std::hash::{Hash, Hasher};
4847
use std::ops::ControlFlow;
4948
use std::{fmt, ptr, str};
@@ -136,7 +135,7 @@ pub struct ResolverOutputs {
136135
/// via `extern crate` item and not `--extern` option or compiler built-in.
137136
pub extern_prelude: FxHashMap<Symbol, bool>,
138137
pub main_def: Option<MainDefinition>,
139-
pub trait_impls: BTreeMap<DefId, Vec<LocalDefId>>,
138+
pub trait_impls: FxIndexMap<DefId, Vec<LocalDefId>>,
140139
/// A list of proc macro LocalDefIds, written out in the order in which
141140
/// they are declared in the static array generated by proc_macro_harness.
142141
pub proc_macros: Vec<LocalDefId>,

compiler/rustc_middle/src/ty/query.rs

-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ use rustc_ast as ast;
5656
use rustc_attr as attr;
5757
use rustc_span::symbol::Symbol;
5858
use rustc_span::{Span, DUMMY_SP};
59-
use std::collections::BTreeMap;
6059
use std::ops::Deref;
6160
use std::path::PathBuf;
6261
use std::sync::Arc;

compiler/rustc_resolve/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ use rustc_span::{Span, DUMMY_SP};
6868

6969
use smallvec::{smallvec, SmallVec};
7070
use std::cell::{Cell, RefCell};
71-
use std::collections::{BTreeMap, BTreeSet};
71+
use std::collections::BTreeSet;
7272
use std::ops::ControlFlow;
7373
use std::{cmp, fmt, iter, mem, ptr};
7474
use tracing::debug;
@@ -1061,7 +1061,7 @@ pub struct Resolver<'a> {
10611061
item_generics_num_lifetimes: FxHashMap<LocalDefId, usize>,
10621062

10631063
main_def: Option<MainDefinition>,
1064-
trait_impls: BTreeMap<DefId, Vec<LocalDefId>>,
1064+
trait_impls: FxIndexMap<DefId, Vec<LocalDefId>>,
10651065
/// A list of proc macro LocalDefIds, written out in the order in which
10661066
/// they are declared in the static array generated by proc_macro_harness.
10671067
proc_macros: Vec<NodeId>,

0 commit comments

Comments
 (0)