about summary refs log tree commit diff
path: root/compiler/rustc_session/src/cstore.rs
diff options
context:
space:
mode:
authoryukang <moorekang@gmail.com>2023-03-17 09:23:46 +0800
committeryukang <moorekang@gmail.com>2023-03-19 11:23:19 +0800
commitd5558e67ef86bda546eca72778aeeeda24420926 (patch)
treefd82733ae7b4224df33be30836614288464359f8 /compiler/rustc_session/src/cstore.rs
parentc22f154e3fb6eca7dd1e83575564a5ea44d661bc (diff)
downloadrust-d5558e67ef86bda546eca72778aeeeda24420926.tar.gz
rust-d5558e67ef86bda546eca72778aeeeda24420926.zip
The name of NativeLib will be presented
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.