compiler: Directly use rustc_abi in lints

This commit is contained in:
Jubilee Young 2024-11-02 19:33:36 -07:00
parent 092135b7b4
commit 586e141be7
2 changed files with 6 additions and 7 deletions

View File

@ -1,3 +1,4 @@
use rustc_abi::ExternAbi;
use rustc_hir::def::{DefKind, Res};
use rustc_hir::intravisit::FnKind;
use rustc_hir::{GenericParamKind, PatKind};
@ -7,7 +8,6 @@ use rustc_session::{declare_lint, declare_lint_pass};
use rustc_span::def_id::LocalDefId;
use rustc_span::symbol::{Ident, sym};
use rustc_span::{BytePos, Span};
use rustc_target::spec::abi::Abi;
use {rustc_ast as ast, rustc_attr as attr, rustc_hir as hir};
use crate::lints::{
@ -397,7 +397,7 @@ impl<'tcx> LateLintPass<'tcx> for NonSnakeCase {
match &fk {
FnKind::Method(ident, sig, ..) => match method_context(cx, id) {
MethodLateContext::PlainImpl => {
if sig.header.abi != Abi::Rust && cx.tcx.has_attr(id, sym::no_mangle) {
if sig.header.abi != ExternAbi::Rust && cx.tcx.has_attr(id, sym::no_mangle) {
return;
}
self.check_snake_case(cx, "method", ident);
@ -409,7 +409,7 @@ impl<'tcx> LateLintPass<'tcx> for NonSnakeCase {
},
FnKind::ItemFn(ident, _, header) => {
// Skip foreign-ABI #[no_mangle] functions (Issue #31924)
if header.abi != Abi::Rust && cx.tcx.has_attr(id, sym::no_mangle) {
if header.abi != ExternAbi::Rust && cx.tcx.has_attr(id, sym::no_mangle) {
return;
}
self.check_snake_case(cx, "function", ident);

View File

@ -1,7 +1,7 @@
use std::iter;
use std::ops::ControlFlow;
use rustc_abi::{BackendRepr, TagEncoding, Variants, WrappingRange};
use rustc_abi::{BackendRepr, ExternAbi, TagEncoding, Variants, WrappingRange};
use rustc_data_structures::fx::FxHashSet;
use rustc_errors::DiagMessage;
use rustc_hir::{Expr, ExprKind};
@ -14,7 +14,6 @@ use rustc_session::{declare_lint, declare_lint_pass, impl_lint_pass};
use rustc_span::def_id::LocalDefId;
use rustc_span::symbol::sym;
use rustc_span::{Span, Symbol, source_map};
use rustc_target::spec::abi::Abi as SpecAbi;
use tracing::debug;
use {rustc_ast as ast, rustc_hir as hir};
@ -1294,10 +1293,10 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
self.check_type_for_ffi_and_report_errors(span, ty, true, false);
}
fn is_internal_abi(&self, abi: SpecAbi) -> bool {
fn is_internal_abi(&self, abi: ExternAbi) -> bool {
matches!(
abi,
SpecAbi::Rust | SpecAbi::RustCall | SpecAbi::RustCold | SpecAbi::RustIntrinsic
ExternAbi::Rust | ExternAbi::RustCall | ExternAbi::RustCold | ExternAbi::RustIntrinsic
)
}