about summary refs log tree commit diff
path: root/compiler/rustc_session/src/cstore.rs
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2023-03-21 09:24:57 +0100
committerRalf Jung <post@ralfj.de>2023-03-21 09:24:57 +0100
commit4bfde41afa31aa957a80f39e782062834a0dc583 (patch)
treee560ed4646bc001322d9bfa3f1ad38f16e39fa2e /compiler/rustc_session/src/cstore.rs
parent2be2568a54540a8ddf2c9c77a20ec73b018b45cc (diff)
parent204807d8a93041f9ef69cc2a69646fe1020f4c9c (diff)
downloadrust-4bfde41afa31aa957a80f39e782062834a0dc583.tar.gz
rust-4bfde41afa31aa957a80f39e782062834a0dc583.zip
Merge from rustc
Diffstat (limited to 'compiler/rustc_session/src/cstore.rs')
-rw-r--r--compiler/rustc_session/src/cstore.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/compiler/rustc_session/src/cstore.rs b/compiler/rustc_session/src/cstore.rs
index 868ffdf0f1d..a262c06d91f 100644
--- a/compiler/rustc_session/src/cstore.rs
+++ b/compiler/rustc_session/src/cstore.rs
@@ -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.