rustc_middle/middle/
dependency_format.rs

1//! Type definitions for learning about the dependency formats of all upstream
2//! crates (rlibs/dylibs/oh my).
3//!
4//! For all the gory details, see the provider of the `dependency_formats`
5//! query.
6
7// FIXME: move this file to rustc_metadata::dependency_format, but
8// this will introduce circular dependency between rustc_metadata and rustc_middle
9
10use rustc_data_structures::fx::FxIndexMap;
11use rustc_hir::def_id::CrateNum;
12use rustc_index::IndexVec;
13use rustc_macros::{Decodable, Encodable, HashStable};
14use rustc_session::config::CrateType;
15
16/// A list of dependencies for a certain crate type.
17pub type DependencyList = IndexVec<CrateNum, Linkage>;
18
19/// A mapping of all required dependencies for a particular flavor of output.
20///
21/// This is local to the tcx, and is generally relevant to one session.
22pub type Dependencies = FxIndexMap<CrateType, DependencyList>;
23
24#[derive(Copy, Clone, PartialEq, Debug, HashStable, Encodable, Decodable)]
25pub enum Linkage {
26    NotLinked,
27    IncludedFromDylib,
28    Static,
29    Dynamic,
30}