about summary refs log tree commit diff
path: root/crates/hir-def/src/nameres.rs
diff options
context:
space:
mode:
authorLukas Wirth <lukastw97@gmail.com>2023-05-26 22:41:32 +0200
committerLukas Wirth <lukastw97@gmail.com>2023-05-28 14:18:44 +0200
commitbbd9e41606cba8efb02e356f78b7f1c8cfc04a94 (patch)
treef9d9d0745b037b6016944a6194db97a8c1937366 /crates/hir-def/src/nameres.rs
parent7c81fff52015b044a0d5dfadcd1e8caa2f237ea3 (diff)
downloadrust-bbd9e41606cba8efb02e356f78b7f1c8cfc04a94.tar.gz
rust-bbd9e41606cba8efb02e356f78b7f1c8cfc04a94.zip
Don't add --all-targets to runnables for no-std crates
Diffstat (limited to 'crates/hir-def/src/nameres.rs')
-rw-r--r--crates/hir-def/src/nameres.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/crates/hir-def/src/nameres.rs b/crates/hir-def/src/nameres.rs
index 8aceb4952a5..ccb9bed5c50 100644
--- a/crates/hir-def/src/nameres.rs
+++ b/crates/hir-def/src/nameres.rs
@@ -127,6 +127,8 @@ pub struct DefMap {
     unstable_features: FxHashSet<SmolStr>,
     /// #[rustc_coherence_is_core]
     rustc_coherence_is_core: bool,
+    no_core: bool,
+    no_std: bool,
 
     edition: Edition,
     recursion_limit: Option<u32>,
@@ -294,6 +296,8 @@ impl DefMap {
             unstable_features: FxHashSet::default(),
             diagnostics: Vec::new(),
             rustc_coherence_is_core: false,
+            no_core: false,
+            no_std: false,
         }
     }
 
@@ -331,6 +335,10 @@ impl DefMap {
         self.rustc_coherence_is_core
     }
 
+    pub fn is_no_std(&self) -> bool {
+        self.no_std || self.no_core
+    }
+
     pub fn root(&self) -> LocalModuleId {
         self.root
     }
@@ -528,6 +536,8 @@ impl DefMap {
             prelude: _,
             root: _,
             rustc_coherence_is_core: _,
+            no_core: _,
+            no_std: _,
         } = self;
 
         extern_prelude.shrink_to_fit();