diff options
| author | Jubilee Young <workingjubilee@gmail.com> | 2025-02-05 11:18:18 -0800 |
|---|---|---|
| committer | Jubilee Young <workingjubilee@gmail.com> | 2025-02-09 20:45:47 -0800 |
| commit | 90c50f0164d07945fdac83a316a5ebaf9e86d7a7 (patch) | |
| tree | c3ee0cf189bcdb45ade34649fa066a0a6bff9b68 | |
| parent | 3f50076fb3166b3f71b4a52e8ebc4cd59572ac74 (diff) | |
| download | rust-90c50f0164d07945fdac83a316a5ebaf9e86d7a7.tar.gz rust-90c50f0164d07945fdac83a316a5ebaf9e86d7a7.zip | |
compiler: start using rustc_ast_lowering in rustc_passes
| -rw-r--r-- | Cargo.lock | 1 | ||||
| -rw-r--r-- | compiler/rustc_ast_lowering/src/lib.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_ast_lowering/src/stability.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_passes/Cargo.toml | 1 | ||||
| -rw-r--r-- | compiler/rustc_passes/src/stability.rs | 5 |
5 files changed, 8 insertions, 5 deletions
diff --git a/Cargo.lock b/Cargo.lock index 14634fe3b46..15feae4b193 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4357,6 +4357,7 @@ version = "0.0.0" dependencies = [ "rustc_abi", "rustc_ast", + "rustc_ast_lowering", "rustc_ast_pretty", "rustc_attr_parsing", "rustc_data_structures", diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index 8997fe24c1f..3fecb9e9c7e 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -84,7 +84,7 @@ mod index; mod item; mod pat; mod path; -mod stability; +pub mod stability; rustc_fluent_macro::fluent_messages! { "../messages.ftl" } diff --git a/compiler/rustc_ast_lowering/src/stability.rs b/compiler/rustc_ast_lowering/src/stability.rs index 5fd26a29aba..e7c166850a4 100644 --- a/compiler/rustc_ast_lowering/src/stability.rs +++ b/compiler/rustc_ast_lowering/src/stability.rs @@ -40,7 +40,7 @@ pub(crate) fn gate_unstable_abi(sess: &Session, features: &Features, span: Span, } } -pub(crate) struct UnstableAbi { +pub struct UnstableAbi { abi: ExternAbi, feature: Symbol, explain: GateReason, @@ -70,7 +70,7 @@ impl fmt::Display for UnstableAbi { } } -pub(crate) fn extern_abi_stability(abi: ExternAbi) -> Result<(), UnstableAbi> { +pub fn extern_abi_stability(abi: ExternAbi) -> Result<(), UnstableAbi> { match abi { // stable ABIs ExternAbi::Rust diff --git a/compiler/rustc_passes/Cargo.toml b/compiler/rustc_passes/Cargo.toml index 2b8a3b9ce23..f592a12ab75 100644 --- a/compiler/rustc_passes/Cargo.toml +++ b/compiler/rustc_passes/Cargo.toml @@ -7,6 +7,7 @@ edition = "2021" # tidy-alphabetical-start rustc_abi = { path = "../rustc_abi" } rustc_ast = { path = "../rustc_ast" } +rustc_ast_lowering = { path = "../rustc_ast_lowering" } rustc_ast_pretty = { path = "../rustc_ast_pretty" } rustc_attr_parsing = { path = "../rustc_attr_parsing" } rustc_data_structures = { path = "../rustc_data_structures" } diff --git a/compiler/rustc_passes/src/stability.rs b/compiler/rustc_passes/src/stability.rs index 34f1ca55c78..fd30d0d4867 100644 --- a/compiler/rustc_passes/src/stability.rs +++ b/compiler/rustc_passes/src/stability.rs @@ -4,6 +4,7 @@ use std::mem::replace; use std::num::NonZero; +use rustc_ast_lowering::stability::extern_abi_stability; use rustc_attr_parsing::{ self as attr, ConstStability, DeprecatedSince, Stability, StabilityLevel, StableSince, UnstableReason, VERSION_PLACEHOLDER, @@ -1027,8 +1028,8 @@ impl<'tcx> Visitor<'tcx> for CheckTraitImplStable<'tcx> { if let TyKind::Never = t.kind { self.fully_stable = false; } - if let TyKind::BareFn(f) = t.kind { - if rustc_target::spec::abi::is_stable(f.abi.name()).is_err() { + if let TyKind::BareFn(function) = t.kind { + if extern_abi_stability(function.abi).is_err() { self.fully_stable = false; } } |
