Skip to content

Commit 586e141

Browse files
compiler: Directly use rustc_abi in lints
1 parent 092135b commit 586e141

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

compiler/rustc_lint/src/nonstandard_style.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use rustc_abi::ExternAbi;
12
use rustc_hir::def::{DefKind, Res};
23
use rustc_hir::intravisit::FnKind;
34
use rustc_hir::{GenericParamKind, PatKind};
@@ -7,7 +8,6 @@ use rustc_session::{declare_lint, declare_lint_pass};
78
use rustc_span::def_id::LocalDefId;
89
use rustc_span::symbol::{Ident, sym};
910
use rustc_span::{BytePos, Span};
10-
use rustc_target::spec::abi::Abi;
1111
use {rustc_ast as ast, rustc_attr as attr, rustc_hir as hir};
1212

1313
use crate::lints::{
@@ -397,7 +397,7 @@ impl<'tcx> LateLintPass<'tcx> for NonSnakeCase {
397397
match &fk {
398398
FnKind::Method(ident, sig, ..) => match method_context(cx, id) {
399399
MethodLateContext::PlainImpl => {
400-
if sig.header.abi != Abi::Rust && cx.tcx.has_attr(id, sym::no_mangle) {
400+
if sig.header.abi != ExternAbi::Rust && cx.tcx.has_attr(id, sym::no_mangle) {
401401
return;
402402
}
403403
self.check_snake_case(cx, "method", ident);
@@ -409,7 +409,7 @@ impl<'tcx> LateLintPass<'tcx> for NonSnakeCase {
409409
},
410410
FnKind::ItemFn(ident, _, header) => {
411411
// Skip foreign-ABI #[no_mangle] functions (Issue #31924)
412-
if header.abi != Abi::Rust && cx.tcx.has_attr(id, sym::no_mangle) {
412+
if header.abi != ExternAbi::Rust && cx.tcx.has_attr(id, sym::no_mangle) {
413413
return;
414414
}
415415
self.check_snake_case(cx, "function", ident);

compiler/rustc_lint/src/types.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::iter;
22
use std::ops::ControlFlow;
33

4-
use rustc_abi::{BackendRepr, TagEncoding, Variants, WrappingRange};
4+
use rustc_abi::{BackendRepr, ExternAbi, TagEncoding, Variants, WrappingRange};
55
use rustc_data_structures::fx::FxHashSet;
66
use rustc_errors::DiagMessage;
77
use rustc_hir::{Expr, ExprKind};
@@ -14,7 +14,6 @@ use rustc_session::{declare_lint, declare_lint_pass, impl_lint_pass};
1414
use rustc_span::def_id::LocalDefId;
1515
use rustc_span::symbol::sym;
1616
use rustc_span::{Span, Symbol, source_map};
17-
use rustc_target::spec::abi::Abi as SpecAbi;
1817
use tracing::debug;
1918
use {rustc_ast as ast, rustc_hir as hir};
2019

@@ -1294,10 +1293,10 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
12941293
self.check_type_for_ffi_and_report_errors(span, ty, true, false);
12951294
}
12961295

1297-
fn is_internal_abi(&self, abi: SpecAbi) -> bool {
1296+
fn is_internal_abi(&self, abi: ExternAbi) -> bool {
12981297
matches!(
12991298
abi,
1300-
SpecAbi::Rust | SpecAbi::RustCall | SpecAbi::RustCold | SpecAbi::RustIntrinsic
1299+
ExternAbi::Rust | ExternAbi::RustCall | ExternAbi::RustCold | ExternAbi::RustIntrinsic
13011300
)
13021301
}
13031302

0 commit comments

Comments
 (0)