Auto merge of #102698 - michaelwoerister:unord-collections, r=lncr
Introduce UnordMap, UnordSet, and UnordBag (MCP 533) This is the start of implementing [MCP 533](https://github.com/rust-lang/compiler-team/issues/533). I followed `@eddyb's` suggestion of naming the collection types `Unord(Map/Set/Bag)` which is a bit easier to type than `Unordered(Map/Set/Bag)` r? `@eddyb`
This commit is contained in:
commit
607878d069
10 changed files with 400 additions and 12 deletions
|
@ -1,5 +1,6 @@
|
|||
use crate::errors::{ExternCrateNotIdiomatic, UnusedExternCrate};
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_data_structures::unord::UnordSet;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::DefKind;
|
||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
|
@ -8,12 +9,12 @@ use rustc_session::lint;
|
|||
use rustc_span::{Span, Symbol};
|
||||
|
||||
pub fn check_crate(tcx: TyCtxt<'_>) {
|
||||
let mut used_trait_imports: FxHashSet<LocalDefId> = FxHashSet::default();
|
||||
let mut used_trait_imports: UnordSet<LocalDefId> = Default::default();
|
||||
|
||||
for item_def_id in tcx.hir().body_owners() {
|
||||
let imports = tcx.used_trait_imports(item_def_id);
|
||||
debug!("GatherVisitor: item_def_id={:?} with imports {:#?}", item_def_id, imports);
|
||||
used_trait_imports.extend(imports.iter());
|
||||
used_trait_imports.extend(imports.items().copied());
|
||||
}
|
||||
|
||||
for &id in tcx.maybe_unused_trait_imports(()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue