frontend 0.4.0

rustc's frontend with no LLVM and no std: parsing through MIR, as a library
//! Type definitions for learning about the dependency formats of all upstream
//! crates (rlibs/dylibs/oh my).
//!
//! For all the gory details, see the provider of the `dependency_formats`
//! query.

// FIXME: move this file to crate::rustc_metadata::dependency_format, but
// this will introduce circular dependency between rustc_metadata and rustc_middle

// `#![no_std]`: these arrive with the standard prelude and name no path, so a `std::`
// search cannot see them - and a `#[derive]` can use them without the name appearing
// in this file at all, which is why they are not trimmed by inspection.
use alloc::borrow::ToOwned;
use alloc::boxed::Box;
use alloc::format;
use alloc::string::{String, ToString};
use alloc::vec;
use alloc::vec::Vec;

use crate::rustc_data_structures::fx::FxIndexMap;
use crate::rustc_hir::def_id::CrateNum;
use crate::rustc_index::IndexVec;
use rustc_macros::{Decodable, Encodable, StableHash};
use crate::rustc_structures::CrateType;

/// A list of dependencies for a certain crate type.
pub type DependencyList = IndexVec<CrateNum, Linkage>;

/// A mapping of all required dependencies for a particular flavor of output.
///
/// This is local to the tcx, and is generally relevant to one session.
pub type Dependencies = FxIndexMap<CrateType, DependencyList>;

#[derive(Copy, Clone, PartialEq, Debug, StableHash, Encodable, Decodable)]
pub enum Linkage {
    NotLinked,
    IncludedFromDylib,
    Static,
    Dynamic,
}