compiler: start using rustc_ast_lowering in rustc_passes

This commit is contained in:
Jubilee Young 2025-02-05 11:18:18 -08:00
parent 3f50076fb3
commit 90c50f0164
5 changed files with 8 additions and 5 deletions

View file

@ -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",

View file

@ -84,7 +84,7 @@ mod index;
mod item;
mod pat;
mod path;
mod stability;
pub mod stability;
rustc_fluent_macro::fluent_messages! { "../messages.ftl" }

View file

@ -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

View file

@ -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" }

View file

@ -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;
}
}