Skip to content

Commit 351e18a

Browse files
compiler: start using rustc_ast_lowering in rustc_passes
1 parent 36e5b43 commit 351e18a

File tree

5 files changed

+8
-5
lines changed

5 files changed

+8
-5
lines changed

Cargo.lock

+1
Original file line numberDiff line numberDiff line change
@@ -4365,6 +4365,7 @@ version = "0.0.0"
43654365
dependencies = [
43664366
"rustc_abi",
43674367
"rustc_ast",
4368+
"rustc_ast_lowering",
43684369
"rustc_ast_pretty",
43694370
"rustc_attr_parsing",
43704371
"rustc_data_structures",

compiler/rustc_ast_lowering/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ mod index;
8484
mod item;
8585
mod pat;
8686
mod path;
87-
mod stability;
87+
pub mod stability;
8888

8989
rustc_fluent_macro::fluent_messages! { "../messages.ftl" }
9090

compiler/rustc_ast_lowering/src/stability.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ pub(crate) fn gate_unstable_abi(sess: &Session, features: &Features, span: Span,
4040
}
4141
}
4242

43-
pub(crate) struct UnstableAbi {
43+
pub struct UnstableAbi {
4444
abi: ExternAbi,
4545
feature: Symbol,
4646
explain: GateReason,
@@ -67,7 +67,7 @@ impl fmt::Display for UnstableAbi {
6767
}
6868
}
6969

70-
pub(crate) fn extern_abi_stability(abi: ExternAbi) -> Result<(), UnstableAbi> {
70+
pub fn extern_abi_stability(abi: ExternAbi) -> Result<(), UnstableAbi> {
7171
match abi {
7272
// stable ABIs
7373
ExternAbi::Rust

compiler/rustc_passes/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ edition = "2021"
77
# tidy-alphabetical-start
88
rustc_abi = { path = "../rustc_abi" }
99
rustc_ast = { path = "../rustc_ast" }
10+
rustc_ast_lowering = { path = "../rustc_ast_lowering" }
1011
rustc_ast_pretty = { path = "../rustc_ast_pretty" }
1112
rustc_attr_parsing = { path = "../rustc_attr_parsing" }
1213
rustc_data_structures = { path = "../rustc_data_structures" }

compiler/rustc_passes/src/stability.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
use std::mem::replace;
55
use std::num::NonZero;
66

7+
use rustc_ast_lowering::stability::extern_abi_stability;
78
use rustc_attr_parsing::{
89
self as attr, ConstStability, DeprecatedSince, Stability, StabilityLevel, StableSince,
910
UnstableReason, VERSION_PLACEHOLDER,
@@ -1027,8 +1028,8 @@ impl<'tcx> Visitor<'tcx> for CheckTraitImplStable<'tcx> {
10271028
if let TyKind::Never = t.kind {
10281029
self.fully_stable = false;
10291030
}
1030-
if let TyKind::BareFn(f) = t.kind {
1031-
if rustc_target::spec::abi::is_stable(f.abi.name()).is_err() {
1031+
if let TyKind::BareFn(function) = t.kind {
1032+
if extern_abi_stability(function.abi).is_err() {
10321033
self.fully_stable = false;
10331034
}
10341035
}

0 commit comments

Comments
 (0)