diff --git a/Cargo.lock b/Cargo.lock index fc16ccf0a67..e2bd466a9d6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3204,9 +3204,11 @@ dependencies = [ "rand", "rand_xoshiro", "rustc_data_structures", + "rustc_feature", "rustc_index", "rustc_macros", "rustc_serialize", + "rustc_span", "tracing", ] diff --git a/compiler/rustc_abi/Cargo.toml b/compiler/rustc_abi/Cargo.toml index 7448f066d0a..3acd25e5461 100644 --- a/compiler/rustc_abi/Cargo.toml +++ b/compiler/rustc_abi/Cargo.toml @@ -9,9 +9,11 @@ bitflags = "2.4.1" rand = { version = "0.8.4", default-features = false, optional = true } rand_xoshiro = { version = "0.6.0", optional = true } rustc_data_structures = { path = "../rustc_data_structures", optional = true } +rustc_feature = { path = "../rustc_feature", optional = true } rustc_index = { path = "../rustc_index", default-features = false } rustc_macros = { path = "../rustc_macros", optional = true } rustc_serialize = { path = "../rustc_serialize", optional = true } +rustc_span = { path = "../rustc_span", optional = true } tracing = "0.1" # tidy-alphabetical-end @@ -22,8 +24,10 @@ default = ["nightly", "randomize"] # without depending on rustc_data_structures, rustc_macros and rustc_serialize nightly = [ "dep:rustc_data_structures", + "dep:rustc_feature", "dep:rustc_macros", "dep:rustc_serialize", + "dep:rustc_span", "rustc_index/nightly", ] randomize = ["dep:rand", "dep:rand_xoshiro", "nightly"] diff --git a/compiler/rustc_target/src/spec/abi/mod.rs b/compiler/rustc_abi/src/extern_abi/mod.rs similarity index 99% rename from compiler/rustc_target/src/spec/abi/mod.rs rename to compiler/rustc_abi/src/extern_abi/mod.rs index c2095155afa..f7e41280131 100644 --- a/compiler/rustc_target/src/spec/abi/mod.rs +++ b/compiler/rustc_abi/src/extern_abi/mod.rs @@ -7,9 +7,11 @@ #[cfg(test)] mod tests; +use ExternAbi as Abi; + #[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy, Debug)] #[derive(HashStable_Generic, Encodable, Decodable)] -pub enum Abi { +pub enum ExternAbi { // Some of the ABIs come first because every time we add a new ABI, we have to re-bless all the // hashing tests. These are used in many places, so giving them stable values reduces test // churn. The specific values are meaningless. diff --git a/compiler/rustc_target/src/spec/abi/tests.rs b/compiler/rustc_abi/src/extern_abi/tests.rs similarity index 100% rename from compiler/rustc_target/src/spec/abi/tests.rs rename to compiler/rustc_abi/src/extern_abi/tests.rs diff --git a/compiler/rustc_abi/src/lib.rs b/compiler/rustc_abi/src/lib.rs index fac1122c4df..ec758785173 100644 --- a/compiler/rustc_abi/src/lib.rs +++ b/compiler/rustc_abi/src/lib.rs @@ -1,6 +1,7 @@ // tidy-alphabetical-start #![cfg_attr(feature = "nightly", allow(internal_features))] #![cfg_attr(feature = "nightly", doc(rust_logo))] +#![cfg_attr(feature = "nightly", feature(assert_matches))] #![cfg_attr(feature = "nightly", feature(rustc_attrs))] #![cfg_attr(feature = "nightly", feature(rustdoc_internals))] #![cfg_attr(feature = "nightly", feature(step_trait))] @@ -28,8 +29,15 @@ #[cfg(test)] mod tests; +#[cfg(feature = "nightly")] +mod extern_abi; + pub use callconv::{Heterogeneous, HomogeneousAggregate, Reg, RegKind}; #[cfg(feature = "nightly")] +pub use extern_abi::{ + AbiDisabled, AbiUnsupported, ExternAbi, all_names, enabled_names, is_enabled, is_stable, lookup, +}; +#[cfg(feature = "nightly")] pub use layout::{FIRST_VARIANT, FieldIdx, Layout, TyAbiInterface, TyAndLayout, VariantIdx}; pub use layout::{LayoutCalculator, LayoutCalculatorError}; diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs index f4cbe47e0f3..3e7b42d3d1c 100644 --- a/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs @@ -55,9 +55,15 @@ use crate::spec::abi::Abi; use crate::spec::crt_objects::CrtObjects; -pub mod abi; pub mod crt_objects; +pub mod abi { + pub use rustc_abi::{ + AbiDisabled, AbiUnsupported, ExternAbi as Abi, all_names, enabled_names, is_enabled, + is_stable, lookup, + }; +} + mod base; pub use base::apple::{ deployment_target_for_target as current_apple_deployment_target,