mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 17:24:06 +00:00
Move NativeLibraryKind to rustc_session
This commit is contained in:
parent
f03d8f305a
commit
285144a8de
@ -20,6 +20,7 @@ use rustc_target::spec::Target;
|
||||
use rustc_data_structures::sync::{self, MetadataRef};
|
||||
use rustc_macros::HashStable;
|
||||
|
||||
pub use rustc_session::utils::NativeLibraryKind;
|
||||
pub use self::NativeLibraryKind::*;
|
||||
|
||||
// lonely orphan structs and enums looking for a better home
|
||||
@ -94,21 +95,6 @@ pub enum LinkagePreference {
|
||||
RequireStatic,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash,
|
||||
RustcEncodable, RustcDecodable, HashStable)]
|
||||
pub enum NativeLibraryKind {
|
||||
/// native static library (.a archive)
|
||||
NativeStatic,
|
||||
/// native static library, which doesn't get bundled into .rlibs
|
||||
NativeStaticNobundle,
|
||||
/// macOS-specific
|
||||
NativeFramework,
|
||||
/// Windows dynamic library without import library.
|
||||
NativeRawDylib,
|
||||
/// default way to specify a dynamic library
|
||||
NativeUnknown,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, RustcEncodable, RustcDecodable, HashStable)]
|
||||
pub struct NativeLibrary {
|
||||
pub kind: NativeLibraryKind,
|
||||
|
@ -2,7 +2,7 @@
|
||||
//! command-line options.
|
||||
|
||||
use rustc_session::lint;
|
||||
use crate::middle::cstore;
|
||||
use rustc_session::utils::NativeLibraryKind;
|
||||
use crate::session::{early_error, early_warn, Session};
|
||||
use crate::session::search_paths::SearchPath;
|
||||
|
||||
@ -415,7 +415,7 @@ top_level_options!(
|
||||
describe_lints: bool [UNTRACKED],
|
||||
output_types: OutputTypes [TRACKED],
|
||||
search_paths: Vec<SearchPath> [UNTRACKED],
|
||||
libs: Vec<(String, Option<String>, Option<cstore::NativeLibraryKind>)> [TRACKED],
|
||||
libs: Vec<(String, Option<String>, Option<NativeLibraryKind>)> [TRACKED],
|
||||
maybe_sysroot: Option<PathBuf> [UNTRACKED],
|
||||
|
||||
target_triple: TargetTriple [TRACKED],
|
||||
@ -2379,7 +2379,7 @@ fn select_debuginfo(
|
||||
fn parse_libs(
|
||||
matches: &getopts::Matches,
|
||||
error_format: ErrorOutputType,
|
||||
) -> Vec<(String, Option<String>, Option<cstore::NativeLibraryKind>)> {
|
||||
) -> Vec<(String, Option<String>, Option<NativeLibraryKind>)> {
|
||||
matches
|
||||
.opt_strs("l")
|
||||
.into_iter()
|
||||
@ -2390,10 +2390,12 @@ fn parse_libs(
|
||||
let kind = parts.next().unwrap();
|
||||
let (name, kind) = match (parts.next(), kind) {
|
||||
(None, name) => (name, None),
|
||||
(Some(name), "dylib") => (name, Some(cstore::NativeUnknown)),
|
||||
(Some(name), "framework") => (name, Some(cstore::NativeFramework)),
|
||||
(Some(name), "static") => (name, Some(cstore::NativeStatic)),
|
||||
(Some(name), "static-nobundle") => (name, Some(cstore::NativeStaticNobundle)),
|
||||
(Some(name), "dylib") => (name, Some(NativeLibraryKind::NativeUnknown)),
|
||||
(Some(name), "framework") => (name, Some(NativeLibraryKind::NativeFramework)),
|
||||
(Some(name), "static") => (name, Some(NativeLibraryKind::NativeStatic)),
|
||||
(Some(name), "static-nobundle") => {
|
||||
(name, Some(NativeLibraryKind::NativeStaticNobundle))
|
||||
}
|
||||
(_, s) => {
|
||||
early_error(
|
||||
error_format,
|
||||
@ -2405,7 +2407,8 @@ fn parse_libs(
|
||||
);
|
||||
}
|
||||
};
|
||||
if kind == Some(cstore::NativeStaticNobundle) && !nightly_options::is_nightly_build() {
|
||||
if kind == Some(NativeLibraryKind::NativeStaticNobundle) &&
|
||||
!nightly_options::is_nightly_build() {
|
||||
early_error(
|
||||
error_format,
|
||||
&format!(
|
||||
@ -2855,7 +2858,7 @@ impl PpMode {
|
||||
/// how the hash should be calculated when adding a new command-line argument.
|
||||
mod dep_tracking {
|
||||
use rustc_session::lint;
|
||||
use crate::middle::cstore;
|
||||
use rustc_session::utils::NativeLibraryKind;
|
||||
use std::collections::BTreeMap;
|
||||
use std::hash::Hash;
|
||||
use std::path::PathBuf;
|
||||
@ -2913,7 +2916,7 @@ mod dep_tracking {
|
||||
impl_dep_tracking_hash_via_hash!(Option<RelroLevel>);
|
||||
impl_dep_tracking_hash_via_hash!(Option<lint::Level>);
|
||||
impl_dep_tracking_hash_via_hash!(Option<PathBuf>);
|
||||
impl_dep_tracking_hash_via_hash!(Option<cstore::NativeLibraryKind>);
|
||||
impl_dep_tracking_hash_via_hash!(Option<NativeLibraryKind>);
|
||||
impl_dep_tracking_hash_via_hash!(CrateType);
|
||||
impl_dep_tracking_hash_via_hash!(MergeFunctions);
|
||||
impl_dep_tracking_hash_via_hash!(PanicStrategy);
|
||||
@ -2924,7 +2927,7 @@ mod dep_tracking {
|
||||
impl_dep_tracking_hash_via_hash!(DebugInfo);
|
||||
impl_dep_tracking_hash_via_hash!(UnstableFeatures);
|
||||
impl_dep_tracking_hash_via_hash!(OutputTypes);
|
||||
impl_dep_tracking_hash_via_hash!(cstore::NativeLibraryKind);
|
||||
impl_dep_tracking_hash_via_hash!(NativeLibraryKind);
|
||||
impl_dep_tracking_hash_via_hash!(Sanitizer);
|
||||
impl_dep_tracking_hash_via_hash!(Option<Sanitizer>);
|
||||
impl_dep_tracking_hash_via_hash!(TargetTriple);
|
||||
@ -2940,7 +2943,7 @@ mod dep_tracking {
|
||||
impl_dep_tracking_hash_for_sortable_vec_of!((
|
||||
String,
|
||||
Option<String>,
|
||||
Option<cstore::NativeLibraryKind>
|
||||
Option<NativeLibraryKind>
|
||||
));
|
||||
impl_dep_tracking_hash_for_sortable_vec_of!((String, u64));
|
||||
impl_dep_tracking_hash_for_sortable_vec_of!(Sanitizer);
|
||||
|
@ -7,3 +7,19 @@ pub fn duration_to_secs_str(dur: std::time::Duration) -> String {
|
||||
|
||||
format!("{:.3}", secs)
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable)]
|
||||
pub enum NativeLibraryKind {
|
||||
/// native static library (.a archive)
|
||||
NativeStatic,
|
||||
/// native static library, which doesn't get bundled into .rlibs
|
||||
NativeStaticNobundle,
|
||||
/// macOS-specific
|
||||
NativeFramework,
|
||||
/// Windows dynamic library without import library.
|
||||
NativeRawDylib,
|
||||
/// default way to specify a dynamic library
|
||||
NativeUnknown,
|
||||
}
|
||||
|
||||
rustc_data_structures::impl_stable_hash_via_hash!(NativeLibraryKind);
|
||||
|
Loading…
Reference in New Issue
Block a user