Skip to content

Commit ba5e201

Browse files
compiler: start using rustc_ast_lowering in rustc_passes
1 parent c778d76 commit ba5e201

File tree

5 files changed

+8
-5
lines changed

5 files changed

+8
-5
lines changed

Diff for: Cargo.lock

+1
Original file line numberDiff line numberDiff line change
@@ -4364,6 +4364,7 @@ version = "0.0.0"
43644364
dependencies = [
43654365
"rustc_abi",
43664366
"rustc_ast",
4367+
"rustc_ast_lowering",
43674368
"rustc_ast_pretty",
43684369
"rustc_attr_parsing",
43694370
"rustc_data_structures",

Diff for: compiler/rustc_ast_lowering/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ mod index;
8383
mod item;
8484
mod pat;
8585
mod path;
86-
mod stability;
86+
pub mod stability;
8787

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

Diff for: compiler/rustc_ast_lowering/src/stability.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ pub(crate) fn gate_unstable_abi(sess: &Session, features: &Features, span: Span,
4747
}
4848
}
4949

50-
pub(crate) struct UnstableAbi {
50+
pub struct UnstableAbi {
5151
abi: ExternAbi,
5252
feature: Symbol,
5353
explain: GateReason,
@@ -74,7 +74,7 @@ impl fmt::Display for UnstableAbi {
7474
}
7575
}
7676

77-
pub(crate) fn extern_abi_stability(abi: ExternAbi) -> Result<(), UnstableAbi> {
77+
pub fn extern_abi_stability(abi: ExternAbi) -> Result<(), UnstableAbi> {
7878
match abi {
7979
// stable ABIs
8080
ExternAbi::Rust

Diff for: 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" }

Diff for: 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)