-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Expand file tree
/
Copy pathdead_code.rs
More file actions
23 lines (21 loc) · 986 Bytes
/
dead_code.rs
File metadata and controls
23 lines (21 loc) · 986 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use rustc_data_structures::fx::FxIndexSet;
use rustc_hir::def_id::{DefId, LocalDefIdMap, LocalDefIdSet};
use rustc_macros::HashStable;
/// A single snapshot of dead-code liveness analysis state.
#[derive(Clone, Debug, HashStable)]
pub struct DeadCodeLivenessSnapshot {
pub live_symbols: LocalDefIdSet,
/// Maps each ADT to derived traits (for example `Debug` and `Clone`) that should be ignored
/// when checking for dead code diagnostics.
pub ignored_derived_traits: LocalDefIdMap<FxIndexSet<DefId>>,
}
/// Dead-code liveness data for both analysis phases.
///
/// `pre_deferred_seeding` is computed before reachable-public and `#[allow(dead_code)]` seeding,
/// and is used for lint `dead_code_pub_in_binary`.
/// `final_result` is the final liveness snapshot used for lint `dead_code`.
#[derive(Clone, Debug, HashStable)]
pub struct DeadCodeLivenessSummary {
pub pre_deferred_seeding: DeadCodeLivenessSnapshot,
pub final_result: DeadCodeLivenessSnapshot,
}