Skip to content

Commit eca1702

Browse files
compiler: Lift rustc_target::spec::abi::Abi to rustc_abi::ExternAbi
1 parent 4add5e4 commit eca1702

File tree

6 files changed

+24
-2
lines changed

6 files changed

+24
-2
lines changed

Cargo.lock

+2
Original file line numberDiff line numberDiff line change
@@ -3204,9 +3204,11 @@ dependencies = [
32043204
"rand",
32053205
"rand_xoshiro",
32063206
"rustc_data_structures",
3207+
"rustc_feature",
32073208
"rustc_index",
32083209
"rustc_macros",
32093210
"rustc_serialize",
3211+
"rustc_span",
32103212
"tracing",
32113213
]
32123214

compiler/rustc_abi/Cargo.toml

+4
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ bitflags = "2.4.1"
99
rand = { version = "0.8.4", default-features = false, optional = true }
1010
rand_xoshiro = { version = "0.6.0", optional = true }
1111
rustc_data_structures = { path = "../rustc_data_structures", optional = true }
12+
rustc_feature = { path = "../rustc_feature", optional = true }
1213
rustc_index = { path = "../rustc_index", default-features = false }
1314
rustc_macros = { path = "../rustc_macros", optional = true }
1415
rustc_serialize = { path = "../rustc_serialize", optional = true }
16+
rustc_span = { path = "../rustc_span", optional = true }
1517
tracing = "0.1"
1618
# tidy-alphabetical-end
1719

@@ -22,8 +24,10 @@ default = ["nightly", "randomize"]
2224
# without depending on rustc_data_structures, rustc_macros and rustc_serialize
2325
nightly = [
2426
"dep:rustc_data_structures",
27+
"dep:rustc_feature",
2528
"dep:rustc_macros",
2629
"dep:rustc_serialize",
30+
"dep:rustc_span",
2731
"rustc_index/nightly",
2832
]
2933
randomize = ["dep:rand", "dep:rand_xoshiro", "nightly"]

compiler/rustc_target/src/spec/abi/mod.rs renamed to compiler/rustc_abi/src/extern_abi/mod.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ use rustc_span::{Span, Symbol};
77
#[cfg(test)]
88
mod tests;
99

10+
use ExternAbi as Abi;
11+
1012
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy, Debug)]
1113
#[derive(HashStable_Generic, Encodable, Decodable)]
12-
pub enum Abi {
14+
pub enum ExternAbi {
1315
// Some of the ABIs come first because every time we add a new ABI, we have to re-bless all the
1416
// hashing tests. These are used in many places, so giving them stable values reduces test
1517
// churn. The specific values are meaningless.

compiler/rustc_abi/src/lib.rs

+8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// tidy-alphabetical-start
22
#![cfg_attr(feature = "nightly", allow(internal_features))]
33
#![cfg_attr(feature = "nightly", doc(rust_logo))]
4+
#![cfg_attr(feature = "nightly", feature(assert_matches))]
45
#![cfg_attr(feature = "nightly", feature(rustc_attrs))]
56
#![cfg_attr(feature = "nightly", feature(rustdoc_internals))]
67
#![cfg_attr(feature = "nightly", feature(step_trait))]
@@ -28,8 +29,15 @@ mod layout;
2829
#[cfg(test)]
2930
mod tests;
3031

32+
#[cfg(feature = "nightly")]
33+
mod extern_abi;
34+
3135
pub use callconv::{Heterogeneous, HomogeneousAggregate, Reg, RegKind};
3236
#[cfg(feature = "nightly")]
37+
pub use extern_abi::{
38+
AbiDisabled, AbiUnsupported, ExternAbi, all_names, enabled_names, is_enabled, is_stable, lookup,
39+
};
40+
#[cfg(feature = "nightly")]
3341
pub use layout::{FIRST_VARIANT, FieldIdx, Layout, TyAbiInterface, TyAndLayout, VariantIdx};
3442
pub use layout::{LayoutCalculator, LayoutCalculatorError};
3543

compiler/rustc_target/src/spec/mod.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,15 @@ use crate::json::{Json, ToJson};
5555
use crate::spec::abi::Abi;
5656
use crate::spec::crt_objects::CrtObjects;
5757

58-
pub mod abi;
5958
pub mod crt_objects;
6059

60+
pub mod abi {
61+
pub use rustc_abi::{
62+
AbiDisabled, AbiUnsupported, ExternAbi as Abi, all_names, enabled_names, is_enabled,
63+
is_stable, lookup,
64+
};
65+
}
66+
6167
mod base;
6268
pub use base::apple::{
6369
deployment_target_for_target as current_apple_deployment_target,

0 commit comments

Comments
 (0)