compiler: Directly use rustc_abi in lints
This commit is contained in:
parent
092135b7b4
commit
586e141be7
@ -1,3 +1,4 @@
|
|||||||
|
use rustc_abi::ExternAbi;
|
||||||
use rustc_hir::def::{DefKind, Res};
|
use rustc_hir::def::{DefKind, Res};
|
||||||
use rustc_hir::intravisit::FnKind;
|
use rustc_hir::intravisit::FnKind;
|
||||||
use rustc_hir::{GenericParamKind, PatKind};
|
use rustc_hir::{GenericParamKind, PatKind};
|
||||||
@ -7,7 +8,6 @@
|
|||||||
use rustc_span::def_id::LocalDefId;
|
use rustc_span::def_id::LocalDefId;
|
||||||
use rustc_span::symbol::{Ident, sym};
|
use rustc_span::symbol::{Ident, sym};
|
||||||
use rustc_span::{BytePos, Span};
|
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 {rustc_ast as ast, rustc_attr as attr, rustc_hir as hir};
|
||||||
|
|
||||||
use crate::lints::{
|
use crate::lints::{
|
||||||
@ -397,7 +397,7 @@ fn check_fn(
|
|||||||
match &fk {
|
match &fk {
|
||||||
FnKind::Method(ident, sig, ..) => match method_context(cx, id) {
|
FnKind::Method(ident, sig, ..) => match method_context(cx, id) {
|
||||||
MethodLateContext::PlainImpl => {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
self.check_snake_case(cx, "method", ident);
|
self.check_snake_case(cx, "method", ident);
|
||||||
@ -409,7 +409,7 @@ fn check_fn(
|
|||||||
},
|
},
|
||||||
FnKind::ItemFn(ident, _, header) => {
|
FnKind::ItemFn(ident, _, header) => {
|
||||||
// Skip foreign-ABI #[no_mangle] functions (Issue #31924)
|
// 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;
|
return;
|
||||||
}
|
}
|
||||||
self.check_snake_case(cx, "function", ident);
|
self.check_snake_case(cx, "function", ident);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use std::iter;
|
use std::iter;
|
||||||
use std::ops::ControlFlow;
|
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_data_structures::fx::FxHashSet;
|
||||||
use rustc_errors::DiagMessage;
|
use rustc_errors::DiagMessage;
|
||||||
use rustc_hir::{Expr, ExprKind};
|
use rustc_hir::{Expr, ExprKind};
|
||||||
@ -14,7 +14,6 @@
|
|||||||
use rustc_span::def_id::LocalDefId;
|
use rustc_span::def_id::LocalDefId;
|
||||||
use rustc_span::symbol::sym;
|
use rustc_span::symbol::sym;
|
||||||
use rustc_span::{Span, Symbol, source_map};
|
use rustc_span::{Span, Symbol, source_map};
|
||||||
use rustc_target::spec::abi::Abi as SpecAbi;
|
|
||||||
use tracing::debug;
|
use tracing::debug;
|
||||||
use {rustc_ast as ast, rustc_hir as hir};
|
use {rustc_ast as ast, rustc_hir as hir};
|
||||||
|
|
||||||
@ -1294,10 +1293,10 @@ fn check_foreign_static(&mut self, id: hir::OwnerId, span: Span) {
|
|||||||
self.check_type_for_ffi_and_report_errors(span, ty, true, false);
|
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!(
|
matches!(
|
||||||
abi,
|
abi,
|
||||||
SpecAbi::Rust | SpecAbi::RustCall | SpecAbi::RustCold | SpecAbi::RustIntrinsic
|
ExternAbi::Rust | ExternAbi::RustCall | ExternAbi::RustCold | ExternAbi::RustIntrinsic
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user