compiler: Lift rustc_target::spec::abi::Abi to rustc_abi::ExternAbi

This commit is contained in:
Jubilee Young 2024-10-30 20:37:51 -07:00
parent 4add5e4211
commit eca17022ef
6 changed files with 24 additions and 2 deletions

View File

@ -3204,9 +3204,11 @@ dependencies = [
"rand", "rand",
"rand_xoshiro", "rand_xoshiro",
"rustc_data_structures", "rustc_data_structures",
"rustc_feature",
"rustc_index", "rustc_index",
"rustc_macros", "rustc_macros",
"rustc_serialize", "rustc_serialize",
"rustc_span",
"tracing", "tracing",
] ]

View File

@ -9,9 +9,11 @@ bitflags = "2.4.1"
rand = { version = "0.8.4", default-features = false, optional = true } rand = { version = "0.8.4", default-features = false, optional = true }
rand_xoshiro = { version = "0.6.0", optional = true } rand_xoshiro = { version = "0.6.0", optional = true }
rustc_data_structures = { path = "../rustc_data_structures", 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_index = { path = "../rustc_index", default-features = false }
rustc_macros = { path = "../rustc_macros", optional = true } rustc_macros = { path = "../rustc_macros", optional = true }
rustc_serialize = { path = "../rustc_serialize", optional = true } rustc_serialize = { path = "../rustc_serialize", optional = true }
rustc_span = { path = "../rustc_span", optional = true }
tracing = "0.1" tracing = "0.1"
# tidy-alphabetical-end # tidy-alphabetical-end
@ -22,8 +24,10 @@ default = ["nightly", "randomize"]
# without depending on rustc_data_structures, rustc_macros and rustc_serialize # without depending on rustc_data_structures, rustc_macros and rustc_serialize
nightly = [ nightly = [
"dep:rustc_data_structures", "dep:rustc_data_structures",
"dep:rustc_feature",
"dep:rustc_macros", "dep:rustc_macros",
"dep:rustc_serialize", "dep:rustc_serialize",
"dep:rustc_span",
"rustc_index/nightly", "rustc_index/nightly",
] ]
randomize = ["dep:rand", "dep:rand_xoshiro", "nightly"] randomize = ["dep:rand", "dep:rand_xoshiro", "nightly"]

View File

@ -7,9 +7,11 @@
#[cfg(test)] #[cfg(test)]
mod tests; mod tests;
use ExternAbi as Abi;
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy, Debug)] #[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy, Debug)]
#[derive(HashStable_Generic, Encodable, Decodable)] #[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 // 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 // hashing tests. These are used in many places, so giving them stable values reduces test
// churn. The specific values are meaningless. // churn. The specific values are meaningless.

View File

@ -1,6 +1,7 @@
// tidy-alphabetical-start // tidy-alphabetical-start
#![cfg_attr(feature = "nightly", allow(internal_features))] #![cfg_attr(feature = "nightly", allow(internal_features))]
#![cfg_attr(feature = "nightly", doc(rust_logo))] #![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(rustc_attrs))]
#![cfg_attr(feature = "nightly", feature(rustdoc_internals))] #![cfg_attr(feature = "nightly", feature(rustdoc_internals))]
#![cfg_attr(feature = "nightly", feature(step_trait))] #![cfg_attr(feature = "nightly", feature(step_trait))]
@ -28,8 +29,15 @@
#[cfg(test)] #[cfg(test)]
mod tests; mod tests;
#[cfg(feature = "nightly")]
mod extern_abi;
pub use callconv::{Heterogeneous, HomogeneousAggregate, Reg, RegKind}; pub use callconv::{Heterogeneous, HomogeneousAggregate, Reg, RegKind};
#[cfg(feature = "nightly")] #[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::{FIRST_VARIANT, FieldIdx, Layout, TyAbiInterface, TyAndLayout, VariantIdx};
pub use layout::{LayoutCalculator, LayoutCalculatorError}; pub use layout::{LayoutCalculator, LayoutCalculatorError};

View File

@ -55,9 +55,15 @@
use crate::spec::abi::Abi; use crate::spec::abi::Abi;
use crate::spec::crt_objects::CrtObjects; use crate::spec::crt_objects::CrtObjects;
pub mod abi;
pub mod crt_objects; 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; mod base;
pub use base::apple::{ pub use base::apple::{
deployment_target_for_target as current_apple_deployment_target, deployment_target_for_target as current_apple_deployment_target,