Exclude unnecessary info from CodegenResults
`foreign_module` and `wasm_import_module` are not needed for linking, and hence can be removed from CodegenResults.
This commit is contained in:
parent
969b42d8c0
commit
732afd41cf
3 changed files with 24 additions and 7 deletions
|
@ -21,15 +21,17 @@ extern crate tracing;
|
|||
#[macro_use]
|
||||
extern crate rustc_middle;
|
||||
|
||||
use rustc_ast as ast;
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
use rustc_hir::def_id::CrateNum;
|
||||
use rustc_hir::LangItem;
|
||||
use rustc_middle::dep_graph::WorkProduct;
|
||||
use rustc_middle::middle::cstore::{CrateSource, LibSource, NativeLib};
|
||||
use rustc_middle::middle::cstore::{self, CrateSource, LibSource};
|
||||
use rustc_middle::middle::dependency_format::Dependencies;
|
||||
use rustc_middle::ty::query::Providers;
|
||||
use rustc_session::config::{OutputFilenames, OutputType, RUST_CGU_EXT};
|
||||
use rustc_session::utils::NativeLibKind;
|
||||
use rustc_span::symbol::Symbol;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
|
@ -105,6 +107,19 @@ bitflags::bitflags! {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Encodable, Decodable, HashStable)]
|
||||
pub struct NativeLib {
|
||||
pub kind: NativeLibKind,
|
||||
pub name: Option<Symbol>,
|
||||
pub cfg: Option<ast::MetaItem>,
|
||||
}
|
||||
|
||||
impl From<&cstore::NativeLib> for NativeLib {
|
||||
fn from(lib: &cstore::NativeLib) -> Self {
|
||||
NativeLib { kind: lib.kind.clone(), name: lib.name.clone(), cfg: lib.cfg.clone() }
|
||||
}
|
||||
}
|
||||
|
||||
/// Misc info we load from metadata to persist beyond the tcx.
|
||||
///
|
||||
/// Note: though `CrateNum` is only meaningful within the same tcx, information within `CrateInfo`
|
||||
|
@ -119,9 +134,9 @@ pub struct CrateInfo {
|
|||
pub compiler_builtins: Option<CrateNum>,
|
||||
pub profiler_runtime: Option<CrateNum>,
|
||||
pub is_no_builtins: FxHashSet<CrateNum>,
|
||||
pub native_libraries: FxHashMap<CrateNum, Lrc<Vec<NativeLib>>>,
|
||||
pub native_libraries: FxHashMap<CrateNum, Vec<NativeLib>>,
|
||||
pub crate_name: FxHashMap<CrateNum, String>,
|
||||
pub used_libraries: Lrc<Vec<NativeLib>>,
|
||||
pub used_libraries: Vec<NativeLib>,
|
||||
pub link_args: Lrc<Vec<String>>,
|
||||
pub used_crate_source: FxHashMap<CrateNum, Lrc<CrateSource>>,
|
||||
pub used_crates_static: Vec<(CrateNum, LibSource)>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue