diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-06-04 23:42:00 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-06-04 23:42:00 +0200 |
| commit | 326315bf5499d2ff59ebd2bdd0e22576bef25b44 (patch) | |
| tree | 2fc0bfa7884f8a89e3ad1a821da17b4311ca881e /compiler/rustc_resolve/src | |
| parent | 3a8e71385940c2f02ec4b23876c0a36fd09bdefe (diff) | |
| parent | 76c6845a8592931edd1e80dbccfd8cbd047e4f2b (diff) | |
| download | rust-326315bf5499d2ff59ebd2bdd0e22576bef25b44.tar.gz rust-326315bf5499d2ff59ebd2bdd0e22576bef25b44.zip | |
Rollup merge of #97609 - Elliot-Roberts:unused-trait-refactor, r=cjgillot
Iterate over `maybe_unused_trait_imports` when checking dead trait imports
Closes #96873
r? `@cjgillot`
Some questions, if you have time:
- Is there a way to shorten the `rustc_data_structures::fx::FxIndexSet` path in the query declaration? I wasn't sure where to put a `use`.
- Was returning by reference from the query the right choice here?
- How would I go about evaluating the importance of the `is_dummy()` call in `check_crate`? I don't see failing tests when I comment it out. Should I just try to determine whether dummy spans can ever be put into `maybe_unused_trait_imports`?
- Am I doing anything silly with the various ID types?
- Is that `let-else` with `unreachable!()` bad? (i.e is there a better idiom? Would `panic!("<explanation>")` be better?)
- If I want to evaluate the perf of using a `Vec` as mentioned in #96873, is the best way to use the CI or is it feasible locally?
Thanks :)
Diffstat (limited to 'compiler/rustc_resolve/src')
| -rw-r--r-- | compiler/rustc_resolve/src/lib.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_resolve/src/lib.rs b/compiler/rustc_resolve/src/lib.rs index 73c8a9d28bd..49c15d2c9ef 100644 --- a/compiler/rustc_resolve/src/lib.rs +++ b/compiler/rustc_resolve/src/lib.rs @@ -28,7 +28,7 @@ use rustc_ast::node_id::NodeMap; use rustc_ast::{self as ast, NodeId, CRATE_NODE_ID}; use rustc_ast::{AngleBracketedArg, Crate, Expr, ExprKind, GenericArg, GenericArgs, LitKind, Path}; use rustc_ast_lowering::{LifetimeRes, ResolverAstLowering}; -use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap}; +use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap, FxIndexSet}; use rustc_data_structures::intern::Interned; use rustc_data_structures::sync::Lrc; use rustc_errors::{Applicability, DiagnosticBuilder, ErrorGuaranteed}; @@ -941,7 +941,7 @@ pub struct Resolver<'a> { visibilities: FxHashMap<LocalDefId, ty::Visibility>, has_pub_restricted: bool, used_imports: FxHashSet<NodeId>, - maybe_unused_trait_imports: FxHashSet<LocalDefId>, + maybe_unused_trait_imports: FxIndexSet<LocalDefId>, maybe_unused_extern_crates: Vec<(LocalDefId, Span)>, /// Privacy errors are delayed until the end in order to deduplicate them. |
