diff options
Diffstat (limited to 'compiler/rustc_session/src/cstore.rs')
-rw-r--r-- | compiler/rustc_session/src/cstore.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/compiler/rustc_session/src/cstore.rs b/compiler/rustc_session/src/cstore.rs index 868ffdf0f..dd1721801 100644 --- a/compiler/rustc_session/src/cstore.rs +++ b/compiler/rustc_session/src/cstore.rs @@ -6,7 +6,7 @@ use crate::search_paths::PathKind; use crate::utils::NativeLibKind; use crate::Session; use rustc_ast as ast; -use rustc_data_structures::sync::{self, AppendOnlyVec, MetadataRef, RwLock}; +use rustc_data_structures::sync::{self, AppendOnlyIndexVec, MetadataRef, RwLock}; use rustc_hir::def_id::{CrateNum, DefId, LocalDefId, StableCrateId, LOCAL_CRATE}; use rustc_hir::definitions::{DefKey, DefPath, DefPathHash, Definitions}; use rustc_span::hygiene::{ExpnHash, ExpnId}; @@ -67,12 +67,11 @@ pub enum LinkagePreference { #[derive(Debug, Encodable, Decodable, HashStable_Generic)] pub struct NativeLib { pub kind: NativeLibKind, - pub name: Option<Symbol>, + pub name: Symbol, /// If packed_bundled_libs enabled, actual filename of library is stored. pub filename: Option<Symbol>, pub cfg: Option<ast::MetaItem>, pub foreign_module: Option<DefId>, - pub wasm_import_module: Option<Symbol>, pub verbatim: Option<bool>, pub dll_imports: Vec<DllImport>, } @@ -81,6 +80,10 @@ impl NativeLib { pub fn has_modifiers(&self) -> bool { self.verbatim.is_some() || self.kind.has_modifiers() } + + pub fn wasm_import_module(&self) -> Option<Symbol> { + if self.kind == NativeLibKind::WasmImportModule { Some(self.name) } else { None } + } } /// Different ways that the PE Format can decorate a symbol name. @@ -254,6 +257,6 @@ pub type CrateStoreDyn = dyn CrateStore + sync::Sync + sync::Send; pub struct Untracked { pub cstore: RwLock<Box<CrateStoreDyn>>, /// Reference span for definitions. - pub source_span: AppendOnlyVec<LocalDefId, Span>, + pub source_span: AppendOnlyIndexVec<LocalDefId, Span>, pub definitions: RwLock<Definitions>, } |