Stabilize native library modifier syntax and the whole-archive modifier specifically

This commit is contained in:
Vadim Petrochenkov 2022-02-11 15:08:35 +08:00
parent bb5c437a2c
commit 1004783ef9
33 changed files with 269 additions and 164 deletions

View file

@ -43,6 +43,20 @@ pub enum NativeLibKind {
Unspecified,
}
impl NativeLibKind {
pub fn has_modifiers(&self) -> bool {
match self {
NativeLibKind::Static { bundle, whole_archive } => {
bundle.is_some() || whole_archive.is_some()
}
NativeLibKind::Dylib { as_needed } | NativeLibKind::Framework { as_needed } => {
as_needed.is_some()
}
NativeLibKind::RawDylib | NativeLibKind::Unspecified => false,
}
}
}
rustc_data_structures::impl_stable_hash_via_hash!(NativeLibKind);
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Encodable, Decodable)]
@ -53,6 +67,12 @@ pub struct NativeLib {
pub verbatim: Option<bool>,
}
impl NativeLib {
pub fn has_modifiers(&self) -> bool {
self.verbatim.is_some() || self.kind.has_modifiers()
}
}
rustc_data_structures::impl_stable_hash_via_hash!(NativeLib);
/// A path that has been canonicalized along with its original, non-canonicalized form