mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-26 20:09:19 +00:00
fix: Correctly handle no_core
/no_std
for preludes
This commit is contained in:
parent
cfce2bb46d
commit
a268eaf053
9 changed files with 120 additions and 71 deletions
|
@ -324,21 +324,27 @@ pub struct Dependency {
|
|||
pub crate_id: CrateId,
|
||||
pub name: CrateName,
|
||||
prelude: bool,
|
||||
sysroot: bool,
|
||||
}
|
||||
|
||||
impl Dependency {
|
||||
pub fn new(name: CrateName, crate_id: CrateId) -> Self {
|
||||
Self { name, crate_id, prelude: true }
|
||||
Self { name, crate_id, prelude: true, sysroot: false }
|
||||
}
|
||||
|
||||
pub fn with_prelude(name: CrateName, crate_id: CrateId, prelude: bool) -> Self {
|
||||
Self { name, crate_id, prelude }
|
||||
pub fn with_prelude(name: CrateName, crate_id: CrateId, prelude: bool, sysroot: bool) -> Self {
|
||||
Self { name, crate_id, prelude, sysroot }
|
||||
}
|
||||
|
||||
/// Whether this dependency is to be added to the depending crate's extern prelude.
|
||||
pub fn is_prelude(&self) -> bool {
|
||||
self.prelude
|
||||
}
|
||||
|
||||
/// Whether this dependency is a sysroot injected one.
|
||||
pub fn is_sysroot(&self) -> bool {
|
||||
self.sysroot
|
||||
}
|
||||
}
|
||||
|
||||
impl CrateGraph {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue