1
Fork 0

Rollup merge of #136706 - workingjubilee:finish-up-rustc-abi-updates, r=compiler-errors

compiler: mostly-finish `rustc_abi` updates

This almost-finishes all the updates in the compiler to use `rustc_abi` and removes some of the reexports of `rustc_abi` items in `rustc_target` that were previously available.

r? ```@compiler-errors```
This commit is contained in:
Jubilee 2025-02-08 20:41:21 -08:00 committed by GitHub
commit 5e4d6278af
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
111 changed files with 205 additions and 159 deletions

View file

@ -3400,6 +3400,7 @@ dependencies = [
name = "rustc_ast_lowering" name = "rustc_ast_lowering"
version = "0.0.0" version = "0.0.0"
dependencies = [ dependencies = [
"rustc_abi",
"rustc_ast", "rustc_ast",
"rustc_ast_pretty", "rustc_ast_pretty",
"rustc_data_structures", "rustc_data_structures",
@ -3422,6 +3423,7 @@ name = "rustc_ast_passes"
version = "0.0.0" version = "0.0.0"
dependencies = [ dependencies = [
"itertools", "itertools",
"rustc_abi",
"rustc_ast", "rustc_ast",
"rustc_ast_pretty", "rustc_ast_pretty",
"rustc_attr_parsing", "rustc_attr_parsing",
@ -4015,6 +4017,7 @@ version = "0.0.0"
dependencies = [ dependencies = [
"rustc-rayon", "rustc-rayon",
"rustc-rayon-core", "rustc-rayon-core",
"rustc_abi",
"rustc_ast", "rustc_ast",
"rustc_ast_lowering", "rustc_ast_lowering",
"rustc_ast_passes", "rustc_ast_passes",

View file

@ -3225,7 +3225,7 @@ pub enum Extern {
/// ///
/// E.g. `extern fn foo() {}`. /// E.g. `extern fn foo() {}`.
/// ///
/// This is just `extern "C"` (see `rustc_target::spec::abi::Abi::FALLBACK`). /// This is just `extern "C"` (see `rustc_abi::ExternAbi::FALLBACK`).
Implicit(Span), Implicit(Span),
/// An explicit extern keyword was used with an explicit ABI. /// An explicit extern keyword was used with an explicit ABI.
/// ///

View file

@ -8,6 +8,7 @@ doctest = false
[dependencies] [dependencies]
# tidy-alphabetical-start # tidy-alphabetical-start
rustc_abi = { path = "../rustc_abi" }
rustc_ast = { path = "../rustc_ast" } rustc_ast = { path = "../rustc_ast" }
rustc_ast_pretty = { path = "../rustc_ast_pretty" } rustc_ast_pretty = { path = "../rustc_ast_pretty" }
rustc_data_structures = { path = "../rustc_data_structures" } rustc_data_structures = { path = "../rustc_data_structures" }

View file

@ -1,3 +1,4 @@
use rustc_abi::ExternAbi;
use rustc_ast::ptr::P; use rustc_ast::ptr::P;
use rustc_ast::visit::AssocCtxt; use rustc_ast::visit::AssocCtxt;
use rustc_ast::*; use rustc_ast::*;
@ -11,7 +12,6 @@ use rustc_middle::span_bug;
use rustc_middle::ty::{ResolverAstLowering, TyCtxt}; use rustc_middle::ty::{ResolverAstLowering, TyCtxt};
use rustc_span::edit_distance::find_best_match_for_name; use rustc_span::edit_distance::find_best_match_for_name;
use rustc_span::{DesugaringKind, Ident, Span, Symbol, kw, sym}; use rustc_span::{DesugaringKind, Ident, Span, Symbol, kw, sym};
use rustc_target::spec::abi;
use smallvec::{SmallVec, smallvec}; use smallvec::{SmallVec, smallvec};
use thin_vec::ThinVec; use thin_vec::ThinVec;
use tracing::instrument; use tracing::instrument;
@ -275,7 +275,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
ModKind::Unloaded => panic!("`mod` items should have been loaded by now"), ModKind::Unloaded => panic!("`mod` items should have been loaded by now"),
}, },
ItemKind::ForeignMod(fm) => hir::ItemKind::ForeignMod { ItemKind::ForeignMod(fm) => hir::ItemKind::ForeignMod {
abi: fm.abi.map_or(abi::Abi::FALLBACK, |abi| self.lower_abi(abi)), abi: fm.abi.map_or(ExternAbi::FALLBACK, |abi| self.lower_abi(abi)),
items: self items: self
.arena .arena
.alloc_from_iter(fm.items.iter().map(|x| self.lower_foreign_item_ref(x))), .alloc_from_iter(fm.items.iter().map(|x| self.lower_foreign_item_ref(x))),
@ -1470,23 +1470,23 @@ impl<'hir> LoweringContext<'_, 'hir> {
} }
} }
pub(super) fn lower_abi(&mut self, abi: StrLit) -> abi::Abi { pub(super) fn lower_abi(&mut self, abi: StrLit) -> ExternAbi {
abi::lookup(abi.symbol_unescaped.as_str()).unwrap_or_else(|err| { rustc_abi::lookup(abi.symbol_unescaped.as_str()).unwrap_or_else(|err| {
self.error_on_invalid_abi(abi, err); self.error_on_invalid_abi(abi, err);
abi::Abi::Rust ExternAbi::Rust
}) })
} }
pub(super) fn lower_extern(&mut self, ext: Extern) -> abi::Abi { pub(super) fn lower_extern(&mut self, ext: Extern) -> ExternAbi {
match ext { match ext {
Extern::None => abi::Abi::Rust, Extern::None => ExternAbi::Rust,
Extern::Implicit(_) => abi::Abi::FALLBACK, Extern::Implicit(_) => ExternAbi::FALLBACK,
Extern::Explicit(abi, _) => self.lower_abi(abi), Extern::Explicit(abi, _) => self.lower_abi(abi),
} }
} }
fn error_on_invalid_abi(&self, abi: StrLit, err: abi::AbiUnsupported) { fn error_on_invalid_abi(&self, abi: StrLit, err: rustc_abi::AbiUnsupported) {
let abi_names = abi::enabled_names(self.tcx.features(), abi.span) let abi_names = rustc_abi::enabled_names(self.tcx.features(), abi.span)
.iter() .iter()
.map(|s| Symbol::intern(s)) .map(|s| Symbol::intern(s))
.collect::<Vec<_>>(); .collect::<Vec<_>>();
@ -1495,7 +1495,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
abi: abi.symbol_unescaped, abi: abi.symbol_unescaped,
span: abi.span, span: abi.span,
explain: match err { explain: match err {
abi::AbiUnsupported::Reason { explain } => Some(InvalidAbiReason(explain)), rustc_abi::AbiUnsupported::Reason { explain } => Some(InvalidAbiReason(explain)),
_ => None, _ => None,
}, },
suggestion: suggested_name.map(|suggested_name| InvalidAbiSuggestion { suggestion: suggested_name.map(|suggested_name| InvalidAbiSuggestion {

View file

@ -6,6 +6,7 @@ edition = "2021"
[dependencies] [dependencies]
# tidy-alphabetical-start # tidy-alphabetical-start
itertools = "0.12" itertools = "0.12"
rustc_abi = { path = "../rustc_abi" }
rustc_ast = { path = "../rustc_ast" } rustc_ast = { path = "../rustc_ast" }
rustc_ast_pretty = { path = "../rustc_ast_pretty" } rustc_ast_pretty = { path = "../rustc_ast_pretty" }
rustc_attr_parsing = { path = "../rustc_attr_parsing" } rustc_attr_parsing = { path = "../rustc_attr_parsing" }

View file

@ -6,7 +6,6 @@ use rustc_session::Session;
use rustc_session::parse::{feature_err, feature_err_issue, feature_warn}; use rustc_session::parse::{feature_err, feature_err_issue, feature_warn};
use rustc_span::source_map::Spanned; use rustc_span::source_map::Spanned;
use rustc_span::{Span, Symbol, sym}; use rustc_span::{Span, Symbol, sym};
use rustc_target::spec::abi;
use thin_vec::ThinVec; use thin_vec::ThinVec;
use crate::errors; use crate::errors;
@ -77,12 +76,12 @@ impl<'a> PostExpansionVisitor<'a> {
fn check_abi(&self, abi: ast::StrLit) { fn check_abi(&self, abi: ast::StrLit) {
let ast::StrLit { symbol_unescaped, span, .. } = abi; let ast::StrLit { symbol_unescaped, span, .. } = abi;
match abi::is_enabled(self.features, span, symbol_unescaped.as_str()) { match rustc_abi::is_enabled(self.features, span, symbol_unescaped.as_str()) {
Ok(()) => (), Ok(()) => (),
Err(abi::AbiDisabled::Unstable { feature, explain }) => { Err(rustc_abi::AbiDisabled::Unstable { feature, explain }) => {
feature_err_issue(&self.sess, feature, span, GateIssue::Language, explain).emit(); feature_err_issue(&self.sess, feature, span, GateIssue::Language, explain).emit();
} }
Err(abi::AbiDisabled::Unrecognized) => { Err(rustc_abi::AbiDisabled::Unrecognized) => {
if self.sess.opts.pretty.is_none_or(|ppm| ppm.needs_hir()) { if self.sess.opts.pretty.is_none_or(|ppm| ppm.needs_hir()) {
self.sess.dcx().span_delayed_bug( self.sess.dcx().span_delayed_bug(
span, span,

View file

@ -1,6 +1,7 @@
#[cfg(feature = "master")] #[cfg(feature = "master")]
use gccjit::FnAttribute; use gccjit::FnAttribute;
use gccjit::{ToLValue, ToRValue, Type}; use gccjit::{ToLValue, ToRValue, Type};
use rustc_abi::{Reg, RegKind};
use rustc_codegen_ssa::traits::{AbiBuilderMethods, BaseTypeCodegenMethods}; use rustc_codegen_ssa::traits::{AbiBuilderMethods, BaseTypeCodegenMethods};
use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::fx::FxHashSet;
use rustc_middle::bug; use rustc_middle::bug;
@ -8,7 +9,7 @@ use rustc_middle::ty::Ty;
use rustc_middle::ty::layout::LayoutOf; use rustc_middle::ty::layout::LayoutOf;
#[cfg(feature = "master")] #[cfg(feature = "master")]
use rustc_session::config; use rustc_session::config;
use rustc_target::callconv::{ArgAttributes, CastTarget, FnAbi, PassMode, Reg, RegKind}; use rustc_target::callconv::{ArgAttributes, CastTarget, FnAbi, PassMode};
use crate::builder::Builder; use crate::builder::Builder;
use crate::context::CodegenCx; use crate::context::CodegenCx;

View file

@ -4,8 +4,7 @@ use std::cmp;
use libc::c_uint; use libc::c_uint;
use rustc_abi as abi; use rustc_abi as abi;
pub(crate) use rustc_abi::ExternAbi; pub(crate) use rustc_abi::ExternAbi;
use rustc_abi::Primitive::Int; use rustc_abi::{HasDataLayout, Primitive, Reg, RegKind, Size};
use rustc_abi::{HasDataLayout, Size};
use rustc_codegen_ssa::MemFlags; use rustc_codegen_ssa::MemFlags;
use rustc_codegen_ssa::mir::operand::{OperandRef, OperandValue}; use rustc_codegen_ssa::mir::operand::{OperandRef, OperandValue};
use rustc_codegen_ssa::mir::place::{PlaceRef, PlaceValue}; use rustc_codegen_ssa::mir::place::{PlaceRef, PlaceValue};
@ -440,7 +439,7 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
let apply_range_attr = |idx: AttributePlace, scalar: rustc_abi::Scalar| { let apply_range_attr = |idx: AttributePlace, scalar: rustc_abi::Scalar| {
if cx.sess().opts.optimize != config::OptLevel::No if cx.sess().opts.optimize != config::OptLevel::No
&& llvm_util::get_version() >= (19, 0, 0) && llvm_util::get_version() >= (19, 0, 0)
&& matches!(scalar.primitive(), Int(..)) && matches!(scalar.primitive(), Primitive::Int(..))
// If the value is a boolean, the range is 0..2 and that ultimately // If the value is a boolean, the range is 0..2 and that ultimately
// become 0..0 when the type becomes i1, which would be rejected // become 0..0 when the type becomes i1, which would be rejected
// by the LLVM verifier. // by the LLVM verifier.
@ -574,7 +573,7 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
if bx.cx.sess().opts.optimize != config::OptLevel::No if bx.cx.sess().opts.optimize != config::OptLevel::No
&& llvm_util::get_version() < (19, 0, 0) && llvm_util::get_version() < (19, 0, 0)
&& let abi::BackendRepr::Scalar(scalar) = self.ret.layout.backend_repr && let abi::BackendRepr::Scalar(scalar) = self.ret.layout.backend_repr
&& matches!(scalar.primitive(), Int(..)) && matches!(scalar.primitive(), Primitive::Int(..))
// If the value is a boolean, the range is 0..2 and that ultimately // If the value is a boolean, the range is 0..2 and that ultimately
// become 0..0 when the type becomes i1, which would be rejected // become 0..0 when the type becomes i1, which would be rejected
// by the LLVM verifier. // by the LLVM verifier.

View file

@ -1,14 +1,14 @@
use std::{fmt, ptr}; use std::{fmt, ptr};
use libc::{c_char, c_uint}; use libc::{c_char, c_uint};
use rustc_abi::{AddressSpace, Align, Integer, Size}; use rustc_abi::{AddressSpace, Align, Integer, Reg, Size};
use rustc_codegen_ssa::common::TypeKind; use rustc_codegen_ssa::common::TypeKind;
use rustc_codegen_ssa::traits::*; use rustc_codegen_ssa::traits::*;
use rustc_data_structures::small_c_str::SmallCStr; use rustc_data_structures::small_c_str::SmallCStr;
use rustc_middle::bug; use rustc_middle::bug;
use rustc_middle::ty::layout::TyAndLayout; use rustc_middle::ty::layout::TyAndLayout;
use rustc_middle::ty::{self, Ty}; use rustc_middle::ty::{self, Ty};
use rustc_target::callconv::{CastTarget, FnAbi, Reg}; use rustc_target::callconv::{CastTarget, FnAbi};
use crate::abi::{FnAbiLlvmExt, LlvmType}; use crate::abi::{FnAbiLlvmExt, LlvmType};
use crate::context::{CodegenCx, SimpleCx}; use crate::context::{CodegenCx, SimpleCx};

View file

@ -1,6 +1,6 @@
use std::cmp; use std::cmp;
use rustc_abi::{self as abi, ExternAbi, HasDataLayout, WrappingRange}; use rustc_abi::{BackendRepr, ExternAbi, HasDataLayout, Reg, WrappingRange};
use rustc_ast as ast; use rustc_ast as ast;
use rustc_ast::{InlineAsmOptions, InlineAsmTemplatePiece}; use rustc_ast::{InlineAsmOptions, InlineAsmTemplatePiece};
use rustc_hir::lang_items::LangItem; use rustc_hir::lang_items::LangItem;
@ -14,7 +14,7 @@ use rustc_middle::{bug, span_bug};
use rustc_session::config::OptLevel; use rustc_session::config::OptLevel;
use rustc_span::source_map::Spanned; use rustc_span::source_map::Spanned;
use rustc_span::{Span, sym}; use rustc_span::{Span, sym};
use rustc_target::callconv::{ArgAbi, FnAbi, PassMode, Reg}; use rustc_target::callconv::{ArgAbi, FnAbi, PassMode};
use tracing::{debug, info}; use tracing::{debug, info};
use super::operand::OperandRef; use super::operand::OperandRef;
@ -1545,7 +1545,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
// the load would just produce `OperandValue::Ref` instead // the load would just produce `OperandValue::Ref` instead
// of the `OperandValue::Immediate` we need for the call. // of the `OperandValue::Immediate` we need for the call.
llval = bx.load(bx.backend_type(arg.layout), llval, align); llval = bx.load(bx.backend_type(arg.layout), llval, align);
if let abi::BackendRepr::Scalar(scalar) = arg.layout.backend_repr { if let BackendRepr::Scalar(scalar) = arg.layout.backend_repr {
if scalar.is_bool() { if scalar.is_bool() {
bx.range_metadata(llval, WrappingRange { start: 0, end: 1 }); bx.range_metadata(llval, WrappingRange { start: 0, end: 1 });
} }

View file

@ -1,5 +1,5 @@
use rustc_abi as abi;
use rustc_middle::mir::interpret::{ConstAllocation, Scalar}; use rustc_middle::mir::interpret::{ConstAllocation, Scalar};
use rustc_target::abi;
use super::BackendTypes; use super::BackendTypes;

View file

@ -1,8 +1,8 @@
use rustc_abi::{AddressSpace, Float, Integer}; use rustc_abi::{AddressSpace, Float, Integer, Reg};
use rustc_middle::bug; use rustc_middle::bug;
use rustc_middle::ty::layout::{HasTyCtxt, HasTypingEnv, TyAndLayout}; use rustc_middle::ty::layout::{HasTyCtxt, HasTypingEnv, TyAndLayout};
use rustc_middle::ty::{self, Ty}; use rustc_middle::ty::{self, Ty};
use rustc_target::callconv::{ArgAbi, CastTarget, FnAbi, Reg}; use rustc_target::callconv::{ArgAbi, CastTarget, FnAbi};
use super::BackendTypes; use super::BackendTypes;
use super::misc::MiscCodegenMethods; use super::misc::MiscCodegenMethods;

View file

@ -7,6 +7,7 @@ edition = "2021"
# tidy-alphabetical-start # tidy-alphabetical-start
rustc-rayon = { version = "0.5.0" } rustc-rayon = { version = "0.5.0" }
rustc-rayon-core = { version = "0.5.0" } rustc-rayon-core = { version = "0.5.0" }
rustc_abi = { path = "../rustc_abi" }
rustc_ast = { path = "../rustc_ast" } rustc_ast = { path = "../rustc_ast" }
rustc_ast_lowering = { path = "../rustc_ast_lowering" } rustc_ast_lowering = { path = "../rustc_ast_lowering" }
rustc_ast_passes = { path = "../rustc_ast_passes" } rustc_ast_passes = { path = "../rustc_ast_passes" }

View file

@ -4,6 +4,7 @@ use std::num::NonZero;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::sync::atomic::AtomicBool; use std::sync::atomic::AtomicBool;
use rustc_abi::Align;
use rustc_data_structures::profiling::TimePassesFormat; use rustc_data_structures::profiling::TimePassesFormat;
use rustc_errors::emitter::HumanReadableErrorType; use rustc_errors::emitter::HumanReadableErrorType;
use rustc_errors::{ColorConfig, registry}; use rustc_errors::{ColorConfig, registry};
@ -24,7 +25,6 @@ use rustc_session::{CompilerIO, EarlyDiagCtxt, Session, build_session, filesearc
use rustc_span::edition::{DEFAULT_EDITION, Edition}; use rustc_span::edition::{DEFAULT_EDITION, Edition};
use rustc_span::source_map::{RealFileLoader, SourceMapInputs}; use rustc_span::source_map::{RealFileLoader, SourceMapInputs};
use rustc_span::{FileName, SourceFileHashAlgorithm, sym}; use rustc_span::{FileName, SourceFileHashAlgorithm, sym};
use rustc_target::abi::Align;
use rustc_target::spec::{ use rustc_target::spec::{
CodeModel, FramePointer, LinkerFlavorCli, MergeFunctions, OnBrokenPipe, PanicStrategy, CodeModel, FramePointer, LinkerFlavorCli, MergeFunctions, OnBrokenPipe, PanicStrategy,
RelocModel, RelroLevel, SanitizerSet, SplitDebuginfo, StackProtector, TlsModel, WasmCAbi, RelocModel, RelroLevel, SanitizerSet, SplitDebuginfo, StackProtector, TlsModel, WasmCAbi,

View file

@ -1,5 +1,6 @@
//! This module ensures that if a function's ABI requires a particular target feature, //! This module ensures that if a function's ABI requires a particular target feature,
//! that target feature is enabled both on the callee and all callers. //! that target feature is enabled both on the callee and all callers.
use rustc_abi::{BackendRepr, RegKind};
use rustc_hir::CRATE_HIR_ID; use rustc_hir::CRATE_HIR_ID;
use rustc_middle::mir::{self, traversal}; use rustc_middle::mir::{self, traversal};
use rustc_middle::ty::inherent::*; use rustc_middle::ty::inherent::*;
@ -7,8 +8,7 @@ use rustc_middle::ty::{self, Instance, InstanceKind, Ty, TyCtxt};
use rustc_session::lint::builtin::ABI_UNSUPPORTED_VECTOR_TYPES; use rustc_session::lint::builtin::ABI_UNSUPPORTED_VECTOR_TYPES;
use rustc_span::def_id::DefId; use rustc_span::def_id::DefId;
use rustc_span::{DUMMY_SP, Span, Symbol}; use rustc_span::{DUMMY_SP, Span, Symbol};
use rustc_target::abi::call::{FnAbi, PassMode}; use rustc_target::callconv::{FnAbi, PassMode};
use rustc_target::abi::{BackendRepr, RegKind};
use crate::errors::{ use crate::errors::{
AbiErrorDisabledVectorTypeCall, AbiErrorDisabledVectorTypeDef, AbiErrorDisabledVectorTypeCall, AbiErrorDisabledVectorTypeDef,

View file

@ -6,7 +6,7 @@ use rustc_middle::ty::layout::{FnAbiError, LayoutError};
use rustc_middle::ty::{self, GenericArgs, Instance, Ty, TyCtxt}; use rustc_middle::ty::{self, GenericArgs, Instance, Ty, TyCtxt};
use rustc_span::source_map::Spanned; use rustc_span::source_map::Spanned;
use rustc_span::sym; use rustc_span::sym;
use rustc_target::abi::call::FnAbi; use rustc_target::callconv::FnAbi;
use super::layout_test::ensure_wf; use super::layout_test::ensure_wf;
use crate::errors::{AbiInvalidAttribute, AbiNe, AbiOf, UnrecognizedField}; use crate::errors::{AbiInvalidAttribute, AbiNe, AbiOf, UnrecognizedField};

View file

@ -7,6 +7,7 @@
use std::cell::Cell; use std::cell::Cell;
use std::collections::hash_map::Entry; use std::collections::hash_map::Entry;
use rustc_abi::{ExternAbi, Size};
use rustc_ast::{AttrStyle, LitKind, MetaItemInner, MetaItemKind, MetaItemLit, ast}; use rustc_ast::{AttrStyle, LitKind, MetaItemInner, MetaItemKind, MetaItemLit, ast};
use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::fx::FxHashMap;
use rustc_errors::{Applicability, DiagCtxtHandle, IntoDiagArg, MultiSpan, StashKey}; use rustc_errors::{Applicability, DiagCtxtHandle, IntoDiagArg, MultiSpan, StashKey};
@ -32,8 +33,6 @@ use rustc_session::lint::builtin::{
}; };
use rustc_session::parse::feature_err; use rustc_session::parse::feature_err;
use rustc_span::{BytePos, DUMMY_SP, Span, Symbol, kw, sym}; use rustc_span::{BytePos, DUMMY_SP, Span, Symbol, kw, sym};
use rustc_target::abi::Size;
use rustc_target::spec::abi::Abi;
use rustc_trait_selection::error_reporting::InferCtxtErrorExt; use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
use rustc_trait_selection::infer::{TyCtxtInferExt, ValuePairs}; use rustc_trait_selection::infer::{TyCtxtInferExt, ValuePairs};
use rustc_trait_selection::traits::ObligationCtxt; use rustc_trait_selection::traits::ObligationCtxt;
@ -1519,7 +1518,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
if target == Target::ForeignMod if target == Target::ForeignMod
&& let hir::Node::Item(item) = self.tcx.hir_node(hir_id) && let hir::Node::Item(item) = self.tcx.hir_node(hir_id)
&& let Item { kind: ItemKind::ForeignMod { abi, .. }, .. } = item && let Item { kind: ItemKind::ForeignMod { abi, .. }, .. } = item
&& !matches!(abi, Abi::Rust | Abi::RustIntrinsic) && !matches!(abi, ExternAbi::Rust | ExternAbi::RustIntrinsic)
{ {
return; return;
} }
@ -2445,7 +2444,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
token_stream, token_stream,
false, false,
Safety::Safe, Safety::Safe,
Abi::Rust, ExternAbi::Rust,
); );
if let Err(terr) = ocx.eq(&cause, param_env, expected_sig, sig) { if let Err(terr) = ocx.eq(&cause, param_env, expected_sig, sig) {

View file

@ -2,7 +2,7 @@ use std::iter;
use rustc_abi::{BackendRepr, HasDataLayout, Primitive, TyAbiInterface}; use rustc_abi::{BackendRepr, HasDataLayout, Primitive, TyAbiInterface};
use crate::abi::call::{ArgAbi, FnAbi, Reg, RegKind, Uniform}; use crate::callconv::{ArgAbi, FnAbi, Reg, RegKind, Uniform};
use crate::spec::{HasTargetSpec, Target}; use crate::spec::{HasTargetSpec, Target};
/// Indicates the variant of the AArch64 ABI we are compiling for. /// Indicates the variant of the AArch64 ABI we are compiling for.

View file

@ -1,6 +1,6 @@
use rustc_abi::{HasDataLayout, TyAbiInterface}; use rustc_abi::{HasDataLayout, TyAbiInterface};
use crate::abi::call::{ArgAbi, FnAbi}; use crate::callconv::{ArgAbi, FnAbi};
fn classify_ret<'a, Ty, C>(_cx: &C, ret: &mut ArgAbi<'a, Ty>) fn classify_ret<'a, Ty, C>(_cx: &C, ret: &mut ArgAbi<'a, Ty>)
where where

View file

@ -1,6 +1,6 @@
use rustc_abi::{HasDataLayout, TyAbiInterface}; use rustc_abi::{HasDataLayout, TyAbiInterface};
use crate::abi::call::{ArgAbi, Conv, FnAbi, Reg, RegKind, Uniform}; use crate::callconv::{ArgAbi, Conv, FnAbi, Reg, RegKind, Uniform};
use crate::spec::HasTargetSpec; use crate::spec::HasTargetSpec;
fn is_homogeneous_aggregate<'a, Ty, C>(cx: &C, arg: &mut ArgAbi<'a, Ty>) -> Option<Uniform> fn is_homogeneous_aggregate<'a, Ty, C>(cx: &C, arg: &mut ArgAbi<'a, Ty>) -> Option<Uniform>

View file

@ -30,7 +30,7 @@
//! compatible with AVR-GCC - Rust and AVR-GCC only differ in the small amount //! compatible with AVR-GCC - Rust and AVR-GCC only differ in the small amount
//! of compiler frontend specific calling convention logic implemented here. //! of compiler frontend specific calling convention logic implemented here.
use crate::abi::call::{ArgAbi, FnAbi}; use crate::callconv::{ArgAbi, FnAbi};
fn classify_ret_ty<Ty>(ret: &mut ArgAbi<'_, Ty>) { fn classify_ret_ty<Ty>(ret: &mut ArgAbi<'_, Ty>) {
if ret.layout.is_aggregate() { if ret.layout.is_aggregate() {

View file

@ -1,5 +1,5 @@
// see https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/BPF/BPFCallingConv.td // see https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/BPF/BPFCallingConv.td
use crate::abi::call::{ArgAbi, FnAbi}; use crate::callconv::{ArgAbi, FnAbi};
fn classify_ret<Ty>(ret: &mut ArgAbi<'_, Ty>) { fn classify_ret<Ty>(ret: &mut ArgAbi<'_, Ty>) {
if ret.layout.is_aggregate() || ret.layout.size.bits() > 64 { if ret.layout.is_aggregate() || ret.layout.size.bits() > 64 {

View file

@ -4,7 +4,7 @@
// Reference: Clang CSKY lowering code // Reference: Clang CSKY lowering code
// https://github.com/llvm/llvm-project/blob/4a074f32a6914f2a8d7215d78758c24942dddc3d/clang/lib/CodeGen/Targets/CSKY.cpp#L76-L162 // https://github.com/llvm/llvm-project/blob/4a074f32a6914f2a8d7215d78758c24942dddc3d/clang/lib/CodeGen/Targets/CSKY.cpp#L76-L162
use crate::abi::call::{ArgAbi, FnAbi, Reg, Uniform}; use crate::callconv::{ArgAbi, FnAbi, Reg, Uniform};
fn classify_ret<Ty>(arg: &mut ArgAbi<'_, Ty>) { fn classify_ret<Ty>(arg: &mut ArgAbi<'_, Ty>) {
if !arg.layout.is_sized() { if !arg.layout.is_sized() {

View file

@ -1,4 +1,4 @@
use crate::abi::call::{ArgAbi, FnAbi}; use crate::callconv::{ArgAbi, FnAbi};
fn classify_ret<Ty>(ret: &mut ArgAbi<'_, Ty>) { fn classify_ret<Ty>(ret: &mut ArgAbi<'_, Ty>) {
if ret.layout.is_aggregate() && ret.layout.size.bits() > 64 { if ret.layout.is_aggregate() && ret.layout.size.bits() > 64 {

View file

@ -1,4 +1,4 @@
use crate::abi::call::{ArgAbi, FnAbi}; use crate::callconv::{ArgAbi, FnAbi};
fn classify_ret<Ty>(ret: &mut ArgAbi<'_, Ty>) { fn classify_ret<Ty>(ret: &mut ArgAbi<'_, Ty>) {
if ret.layout.is_aggregate() { if ret.layout.is_aggregate() {

View file

@ -1,6 +1,6 @@
use rustc_abi::{HasDataLayout, Size}; use rustc_abi::{HasDataLayout, Size};
use crate::abi::call::{ArgAbi, FnAbi, Reg, Uniform}; use crate::callconv::{ArgAbi, FnAbi, Reg, Uniform};
fn classify_ret<Ty, C>(cx: &C, ret: &mut ArgAbi<'_, Ty>, offset: &mut Size) fn classify_ret<Ty, C>(cx: &C, ret: &mut ArgAbi<'_, Ty>, offset: &mut Size)
where where

View file

@ -2,10 +2,9 @@ use std::str::FromStr;
use std::{fmt, iter}; use std::{fmt, iter};
use rustc_abi::{ use rustc_abi::{
AddressSpace, Align, BackendRepr, ExternAbi, HasDataLayout, Scalar, Size, TyAbiInterface, AddressSpace, Align, BackendRepr, ExternAbi, HasDataLayout, Primitive, Reg, RegKind, Scalar,
TyAndLayout, Size, TyAbiInterface, TyAndLayout,
}; };
pub use rustc_abi::{Primitive, Reg, RegKind};
use rustc_macros::HashStable_Generic; use rustc_macros::HashStable_Generic;
use rustc_span::Symbol; use rustc_span::Symbol;

View file

@ -1,7 +1,7 @@
// Reference: MSP430 Embedded Application Binary Interface // Reference: MSP430 Embedded Application Binary Interface
// https://www.ti.com/lit/an/slaa534a/slaa534a.pdf // https://www.ti.com/lit/an/slaa534a/slaa534a.pdf
use crate::abi::call::{ArgAbi, FnAbi}; use crate::callconv::{ArgAbi, FnAbi};
// 3.5 Structures or Unions Passed and Returned by Reference // 3.5 Structures or Unions Passed and Returned by Reference
// //

View file

@ -1,7 +1,7 @@
use rustc_abi::{HasDataLayout, Reg, Size, TyAbiInterface}; use rustc_abi::{HasDataLayout, Reg, Size, TyAbiInterface};
use super::{ArgAttribute, ArgAttributes, ArgExtension, CastTarget}; use super::{ArgAttribute, ArgAttributes, ArgExtension, CastTarget};
use crate::abi::call::{ArgAbi, FnAbi, Uniform}; use crate::callconv::{ArgAbi, FnAbi, Uniform};
fn classify_ret<Ty>(ret: &mut ArgAbi<'_, Ty>) { fn classify_ret<Ty>(ret: &mut ArgAbi<'_, Ty>) {
if ret.layout.is_aggregate() && ret.layout.is_sized() { if ret.layout.is_aggregate() && ret.layout.is_sized() {

View file

@ -1,4 +1,4 @@
use crate::abi::call::{ArgAbi, FnAbi}; use crate::callconv::{ArgAbi, FnAbi};
use crate::spec::HasTargetSpec; use crate::spec::HasTargetSpec;
fn classify_ret<Ty>(ret: &mut ArgAbi<'_, Ty>) { fn classify_ret<Ty>(ret: &mut ArgAbi<'_, Ty>) {

View file

@ -4,7 +4,7 @@
use rustc_abi::{Endian, HasDataLayout, TyAbiInterface}; use rustc_abi::{Endian, HasDataLayout, TyAbiInterface};
use crate::abi::call::{Align, ArgAbi, FnAbi, Reg, RegKind, Uniform}; use crate::callconv::{Align, ArgAbi, FnAbi, Reg, RegKind, Uniform};
use crate::spec::HasTargetSpec; use crate::spec::HasTargetSpec;
#[derive(Debug, Clone, Copy, PartialEq)] #[derive(Debug, Clone, Copy, PartialEq)]

View file

@ -9,7 +9,7 @@ use rustc_abi::{
TyAbiInterface, TyAndLayout, Variants, TyAbiInterface, TyAndLayout, Variants,
}; };
use crate::abi::call::{ArgAbi, ArgExtension, CastTarget, FnAbi, PassMode, Uniform}; use crate::callconv::{ArgAbi, ArgExtension, CastTarget, FnAbi, PassMode, Uniform};
use crate::spec::HasTargetSpec; use crate::spec::HasTargetSpec;
#[derive(Copy, Clone)] #[derive(Copy, Clone)]

View file

@ -3,7 +3,7 @@
use rustc_abi::{BackendRepr, HasDataLayout, TyAbiInterface}; use rustc_abi::{BackendRepr, HasDataLayout, TyAbiInterface};
use crate::abi::call::{ArgAbi, FnAbi, Reg, RegKind}; use crate::callconv::{ArgAbi, FnAbi, Reg, RegKind};
use crate::spec::HasTargetSpec; use crate::spec::HasTargetSpec;
fn classify_ret<Ty>(ret: &mut ArgAbi<'_, Ty>) { fn classify_ret<Ty>(ret: &mut ArgAbi<'_, Ty>) {

View file

@ -1,6 +1,6 @@
use rustc_abi::{HasDataLayout, Size}; use rustc_abi::{HasDataLayout, Size};
use crate::abi::call::{ArgAbi, FnAbi, Reg, Uniform}; use crate::callconv::{ArgAbi, FnAbi, Reg, Uniform};
fn classify_ret<Ty, C>(cx: &C, ret: &mut ArgAbi<'_, Ty>, offset: &mut Size) fn classify_ret<Ty, C>(cx: &C, ret: &mut ArgAbi<'_, Ty>, offset: &mut Size)
where where

View file

@ -5,7 +5,7 @@ use rustc_abi::{
TyAndLayout, TyAndLayout,
}; };
use crate::abi::call::{ use crate::callconv::{
ArgAbi, ArgAttribute, ArgAttributes, ArgExtension, CastTarget, FnAbi, Uniform, ArgAbi, ArgAttribute, ArgAttributes, ArgExtension, CastTarget, FnAbi, Uniform,
}; };
use crate::spec::HasTargetSpec; use crate::spec::HasTargetSpec;

View file

@ -1,6 +1,6 @@
use rustc_abi::{BackendRepr, Float, HasDataLayout, Integer, Primitive, TyAbiInterface}; use rustc_abi::{BackendRepr, Float, HasDataLayout, Integer, Primitive, TyAbiInterface};
use crate::abi::call::{ArgAbi, FnAbi}; use crate::callconv::{ArgAbi, FnAbi};
fn unwrap_trivial_aggregate<'a, Ty, C>(cx: &C, val: &mut ArgAbi<'a, Ty>) -> bool fn unwrap_trivial_aggregate<'a, Ty, C>(cx: &C, val: &mut ArgAbi<'a, Ty>) -> bool
where where

View file

@ -3,7 +3,7 @@ use rustc_abi::{
TyAbiInterface, TyAndLayout, TyAbiInterface, TyAndLayout,
}; };
use crate::abi::call::{ArgAttribute, FnAbi, PassMode}; use crate::callconv::{ArgAttribute, FnAbi, PassMode};
use crate::spec::HasTargetSpec; use crate::spec::HasTargetSpec;
#[derive(PartialEq)] #[derive(PartialEq)]

View file

@ -6,7 +6,7 @@ use rustc_abi::{
Variants, Variants,
}; };
use crate::abi::call::{ArgAbi, CastTarget, FnAbi}; use crate::callconv::{ArgAbi, CastTarget, FnAbi};
/// Classification of "eightbyte" components. /// Classification of "eightbyte" components.
// N.B., the order of the variants is from general to specific, // N.B., the order of the variants is from general to specific,

View file

@ -1,6 +1,6 @@
use rustc_abi::{BackendRepr, Float, Integer, Primitive, RegKind, Size}; use rustc_abi::{BackendRepr, Float, Integer, Primitive, RegKind, Size};
use crate::abi::call::{ArgAbi, FnAbi, Reg}; use crate::callconv::{ArgAbi, FnAbi, Reg};
use crate::spec::HasTargetSpec; use crate::spec::HasTargetSpec;
// Win64 ABI: https://docs.microsoft.com/en-us/cpp/build/parameter-passing // Win64 ABI: https://docs.microsoft.com/en-us/cpp/build/parameter-passing

View file

@ -7,7 +7,7 @@
use rustc_abi::{BackendRepr, HasDataLayout, Size, TyAbiInterface}; use rustc_abi::{BackendRepr, HasDataLayout, Size, TyAbiInterface};
use crate::abi::call::{ArgAbi, FnAbi, Reg, Uniform}; use crate::callconv::{ArgAbi, FnAbi, Reg, Uniform};
use crate::spec::HasTargetSpec; use crate::spec::HasTargetSpec;
const NUM_ARG_GPRS: u64 = 6; const NUM_ARG_GPRS: u64 = 6;

View file

@ -92,7 +92,7 @@ impl<A: ToJson> ToJson for Option<A> {
} }
} }
impl ToJson for crate::abi::call::Conv { impl ToJson for crate::callconv::Conv {
fn to_json(&self) -> Json { fn to_json(&self) -> Json {
let buf: String; let buf: String;
let s = match self { let s = match self {

View file

@ -30,12 +30,6 @@ pub mod target_features;
#[cfg(test)] #[cfg(test)]
mod tests; mod tests;
pub mod abi {
pub use rustc_abi::*;
pub use crate::callconv as call;
}
pub use rustc_abi::HashStableContext; pub use rustc_abi::HashStableContext;
/// The name of rustc's own place to organize libraries. /// The name of rustc's own place to organize libraries.

View file

@ -51,7 +51,7 @@ use rustc_span::{Symbol, kw, sym};
use serde_json::Value; use serde_json::Value;
use tracing::debug; use tracing::debug;
use crate::abi::call::Conv; use crate::callconv::Conv;
use crate::json::{Json, ToJson}; use crate::json::{Json, ToJson};
use crate::spec::crt_objects::CrtObjects; use crate::spec::crt_objects::CrtObjects;

View file

@ -1,4 +1,5 @@
use crate::abi::Endian; use rustc_abi::Endian;
use crate::spec::{StackProbeType, Target, TargetOptions, base}; use crate::spec::{StackProbeType, Target, TargetOptions, base};
pub(crate) fn target() -> Target { pub(crate) fn target() -> Target {

View file

@ -1,4 +1,5 @@
use crate::abi::Endian; use rustc_abi::Endian;
use crate::spec::{StackProbeType, Target, TargetOptions, base}; use crate::spec::{StackProbeType, Target, TargetOptions, base};
pub(crate) fn target() -> Target { pub(crate) fn target() -> Target {

View file

@ -1,4 +1,5 @@
use crate::abi::Endian; use rustc_abi::Endian;
use crate::spec::{StackProbeType, Target, TargetOptions, base}; use crate::spec::{StackProbeType, Target, TargetOptions, base};
pub(crate) fn target() -> Target { pub(crate) fn target() -> Target {

View file

@ -1,4 +1,5 @@
use crate::abi::Endian; use rustc_abi::Endian;
use crate::spec::{FloatAbi, Target, TargetOptions, base}; use crate::spec::{FloatAbi, Target, TargetOptions, base};
pub(crate) fn target() -> Target { pub(crate) fn target() -> Target {

View file

@ -1,6 +1,7 @@
// Targets the Big endian Cortex-R4/R5 processor (ARMv7-R) // Targets the Big endian Cortex-R4/R5 processor (ARMv7-R)
use crate::abi::Endian; use rustc_abi::Endian;
use crate::spec::{ use crate::spec::{
Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions, Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions,
}; };

View file

@ -1,6 +1,7 @@
// Targets the Cortex-R4F/R5F processor (ARMv7-R) // Targets the Cortex-R4F/R5F processor (ARMv7-R)
use crate::abi::Endian; use rustc_abi::Endian;
use crate::spec::{ use crate::spec::{
Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions, Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions,
}; };

View file

@ -1,4 +1,5 @@
use crate::abi::Endian; use rustc_abi::Endian;
use crate::spec::{Cc, FloatAbi, LinkerFlavor, Lld, RelocModel, Target, TargetOptions, cvs}; use crate::spec::{Cc, FloatAbi, LinkerFlavor, Lld, RelocModel, Target, TargetOptions, cvs};
/// A base target for PlayStation Vita devices using the VITASDK toolchain (using newlib). /// A base target for PlayStation Vita devices using the VITASDK toolchain (using newlib).

View file

@ -1,4 +1,5 @@
use crate::abi::Endian; use rustc_abi::Endian;
use crate::spec::{Target, base}; use crate::spec::{Target, base};
pub(crate) fn target() -> Target { pub(crate) fn target() -> Target {

View file

@ -1,4 +1,5 @@
use crate::abi::Endian; use rustc_abi::Endian;
use crate::spec::{Target, base}; use crate::spec::{Target, base};
pub(crate) fn target() -> Target { pub(crate) fn target() -> Target {

View file

@ -1,4 +1,5 @@
use crate::abi::Endian; use rustc_abi::Endian;
use crate::spec::{LinkSelfContainedDefault, Target, TargetOptions, base}; use crate::spec::{LinkSelfContainedDefault, Target, TargetOptions, base};
pub(crate) fn target() -> Target { pub(crate) fn target() -> Target {

View file

@ -1,4 +1,5 @@
use crate::abi::Endian; use rustc_abi::Endian;
use crate::spec::{CodeModel, PanicStrategy, RelocModel, Target, TargetOptions}; use crate::spec::{CodeModel, PanicStrategy, RelocModel, Target, TargetOptions};
pub(crate) fn target() -> Target { pub(crate) fn target() -> Target {

View file

@ -1,6 +1,7 @@
//! A target tuple for OpenWrt MIPS64 targets. //! A target tuple for OpenWrt MIPS64 targets.
use crate::abi::Endian; use rustc_abi::Endian;
use crate::spec::{Target, TargetOptions, base}; use crate::spec::{Target, TargetOptions, base};
pub(crate) fn target() -> Target { pub(crate) fn target() -> Target {

View file

@ -1,4 +1,5 @@
use crate::abi::Endian; use rustc_abi::Endian;
use crate::spec::{Target, TargetOptions, base}; use crate::spec::{Target, TargetOptions, base};
pub(crate) fn target() -> Target { pub(crate) fn target() -> Target {

View file

@ -1,4 +1,5 @@
use crate::abi::Endian; use rustc_abi::Endian;
use crate::spec::{Target, TargetOptions, base}; use crate::spec::{Target, TargetOptions, base};
pub(crate) fn target() -> Target { pub(crate) fn target() -> Target {

View file

@ -1,4 +1,5 @@
use crate::abi::Endian; use rustc_abi::Endian;
use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions}; use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
pub(crate) fn target() -> Target { pub(crate) fn target() -> Target {

View file

@ -1,4 +1,5 @@
use crate::abi::Endian; use rustc_abi::Endian;
use crate::spec::{Target, TargetOptions, base}; use crate::spec::{Target, TargetOptions, base};
pub(crate) fn target() -> Target { pub(crate) fn target() -> Target {

View file

@ -1,4 +1,5 @@
use crate::abi::Endian; use rustc_abi::Endian;
use crate::spec::{Target, TargetOptions, base}; use crate::spec::{Target, TargetOptions, base};
pub(crate) fn target() -> Target { pub(crate) fn target() -> Target {

View file

@ -1,4 +1,5 @@
use crate::abi::Endian; use rustc_abi::Endian;
use crate::spec::{Target, TargetOptions, base}; use crate::spec::{Target, TargetOptions, base};
pub(crate) fn target() -> Target { pub(crate) fn target() -> Target {

View file

@ -1,4 +1,5 @@
use crate::abi::Endian; use rustc_abi::Endian;
use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions}; use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
pub(crate) fn target() -> Target { pub(crate) fn target() -> Target {

View file

@ -1,4 +1,5 @@
use crate::abi::Endian; use rustc_abi::Endian;
use crate::spec::{Target, TargetOptions, base}; use crate::spec::{Target, TargetOptions, base};
pub(crate) fn target() -> Target { pub(crate) fn target() -> Target {

View file

@ -1,4 +1,5 @@
use crate::abi::Endian; use rustc_abi::Endian;
use crate::spec::{Target, TargetOptions, base}; use crate::spec::{Target, TargetOptions, base};
pub(crate) fn target() -> Target { pub(crate) fn target() -> Target {

View file

@ -1,4 +1,5 @@
use crate::abi::Endian; use rustc_abi::Endian;
use crate::spec::{Target, TargetOptions, base}; use crate::spec::{Target, TargetOptions, base};
pub(crate) fn target() -> Target { pub(crate) fn target() -> Target {

View file

@ -1,4 +1,5 @@
use crate::abi::Endian; use rustc_abi::Endian;
use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base}; use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base};
pub(crate) fn target() -> Target { pub(crate) fn target() -> Target {

View file

@ -1,4 +1,5 @@
use crate::abi::Endian; use rustc_abi::Endian;
use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base}; use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base};
pub(crate) fn target() -> Target { pub(crate) fn target() -> Target {

View file

@ -1,4 +1,5 @@
use crate::abi::Endian; use rustc_abi::Endian;
use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base}; use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base};
pub(crate) fn target() -> Target { pub(crate) fn target() -> Target {

View file

@ -1,4 +1,5 @@
use crate::abi::Endian; use rustc_abi::Endian;
use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base}; use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base};
pub(crate) fn target() -> Target { pub(crate) fn target() -> Target {

View file

@ -1,4 +1,5 @@
use crate::abi::Endian; use rustc_abi::Endian;
use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base}; use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base};
pub(crate) fn target() -> Target { pub(crate) fn target() -> Target {

View file

@ -1,4 +1,5 @@
use crate::abi::Endian; use rustc_abi::Endian;
use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base}; use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base};
pub(crate) fn target() -> Target { pub(crate) fn target() -> Target {

View file

@ -1,4 +1,5 @@
use crate::abi::Endian; use rustc_abi::Endian;
use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base}; use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base};
pub(crate) fn target() -> Target { pub(crate) fn target() -> Target {

View file

@ -1,4 +1,5 @@
use crate::abi::Endian; use rustc_abi::Endian;
use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base}; use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base};
pub(crate) fn target() -> Target { pub(crate) fn target() -> Target {

View file

@ -1,4 +1,5 @@
use crate::abi::Endian; use rustc_abi::Endian;
use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base}; use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base};
pub(crate) fn target() -> Target { pub(crate) fn target() -> Target {

View file

@ -1,4 +1,5 @@
use crate::abi::Endian; use rustc_abi::Endian;
use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base}; use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base};
pub(crate) fn target() -> Target { pub(crate) fn target() -> Target {

View file

@ -1,4 +1,5 @@
use crate::abi::Endian; use rustc_abi::Endian;
use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base}; use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base};
pub(crate) fn target() -> Target { pub(crate) fn target() -> Target {

View file

@ -1,4 +1,5 @@
use crate::abi::Endian; use rustc_abi::Endian;
use crate::spec::{StackProbeType, Target, base}; use crate::spec::{StackProbeType, Target, base};
pub(crate) fn target() -> Target { pub(crate) fn target() -> Target {

View file

@ -1,4 +1,5 @@
use crate::abi::Endian; use rustc_abi::Endian;
use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base}; use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base};
pub(crate) fn target() -> Target { pub(crate) fn target() -> Target {

View file

@ -1,4 +1,5 @@
use crate::abi::Endian; use rustc_abi::Endian;
use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base}; use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base};
pub(crate) fn target() -> Target { pub(crate) fn target() -> Target {

View file

@ -1,4 +1,5 @@
use crate::abi::Endian; use rustc_abi::Endian;
use crate::spec::{SanitizerSet, StackProbeType, Target, base}; use crate::spec::{SanitizerSet, StackProbeType, Target, base};
pub(crate) fn target() -> Target { pub(crate) fn target() -> Target {

View file

@ -1,4 +1,5 @@
use crate::abi::Endian; use rustc_abi::Endian;
use crate::spec::{SanitizerSet, StackProbeType, Target, base}; use crate::spec::{SanitizerSet, StackProbeType, Target, base};
pub(crate) fn target() -> Target { pub(crate) fn target() -> Target {

View file

@ -1,4 +1,5 @@
use crate::abi::Endian; use rustc_abi::Endian;
use crate::spec::{Target, base}; use crate::spec::{Target, base};
pub(crate) fn target() -> Target { pub(crate) fn target() -> Target {

View file

@ -1,4 +1,5 @@
use crate::abi::Endian; use rustc_abi::Endian;
use crate::spec::{Cc, LinkerFlavor, Lld, Target, TargetOptions, base}; use crate::spec::{Cc, LinkerFlavor, Lld, Target, TargetOptions, base};
pub(crate) fn target() -> Target { pub(crate) fn target() -> Target {

View file

@ -1,4 +1,5 @@
use crate::abi::Endian; use rustc_abi::Endian;
use crate::spec::{Cc, LinkerFlavor, Lld, Target, base}; use crate::spec::{Cc, LinkerFlavor, Lld, Target, base};
pub(crate) fn target() -> Target { pub(crate) fn target() -> Target {

View file

@ -1,4 +1,5 @@
use crate::abi::Endian; use rustc_abi::Endian;
use crate::spec::{Cc, LinkerFlavor, Lld, Target, TargetOptions, base}; use crate::spec::{Cc, LinkerFlavor, Lld, Target, TargetOptions, base};
pub(crate) fn target() -> Target { pub(crate) fn target() -> Target {

View file

@ -1,4 +1,5 @@
use crate::abi::Endian; use rustc_abi::Endian;
use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions}; use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
pub(crate) fn target() -> Target { pub(crate) fn target() -> Target {

View file

@ -1,4 +1,5 @@
use crate::abi::Endian; use rustc_abi::Endian;
use crate::spec::{Cc, LinkerFlavor, Target, base}; use crate::spec::{Cc, LinkerFlavor, Target, base};
pub(crate) fn target() -> Target { pub(crate) fn target() -> Target {

View file

@ -5,7 +5,7 @@
// The win64 ABI is used. It differs from the sysv64 ABI, so we must use a windows target with // The win64 ABI is used. It differs from the sysv64 ABI, so we must use a windows target with
// LLVM. "x86_64-unknown-windows" is used to get the minimal subset of windows-specific features. // LLVM. "x86_64-unknown-windows" is used to get the minimal subset of windows-specific features.
use crate::abi::call::Conv; use crate::callconv::Conv;
use crate::spec::{RustcAbi, Target, base}; use crate::spec::{RustcAbi, Target, base};
pub(crate) fn target() -> Target { pub(crate) fn target() -> Target {

View file

@ -1,4 +1,5 @@
use crate::abi::Endian; use rustc_abi::Endian;
use crate::spec::base::xtensa; use crate::spec::base::xtensa;
use crate::spec::{Target, TargetOptions, cvs}; use crate::spec::{Target, TargetOptions, cvs};

View file

@ -1,4 +1,5 @@
use crate::abi::Endian; use rustc_abi::Endian;
use crate::spec::base::xtensa; use crate::spec::base::xtensa;
use crate::spec::{Target, TargetOptions, cvs}; use crate::spec::{Target, TargetOptions, cvs};

View file

@ -1,4 +1,5 @@
use crate::abi::Endian; use rustc_abi::Endian;
use crate::spec::base::xtensa; use crate::spec::base::xtensa;
use crate::spec::{Target, TargetOptions, cvs}; use crate::spec::{Target, TargetOptions, cvs};

View file

@ -4,13 +4,13 @@ use clippy_utils::expr_or_init;
use clippy_utils::source::snippet; use clippy_utils::source::snippet;
use clippy_utils::sugg::Sugg; use clippy_utils::sugg::Sugg;
use clippy_utils::ty::{get_discriminant_value, is_isize_or_usize}; use clippy_utils::ty::{get_discriminant_value, is_isize_or_usize};
use rustc_abi::IntegerType;
use rustc_errors::{Applicability, Diag}; use rustc_errors::{Applicability, Diag};
use rustc_hir::def::{DefKind, Res}; use rustc_hir::def::{DefKind, Res};
use rustc_hir::{BinOpKind, Expr, ExprKind}; use rustc_hir::{BinOpKind, Expr, ExprKind};
use rustc_lint::LateContext; use rustc_lint::LateContext;
use rustc_middle::ty::{self, FloatTy, Ty}; use rustc_middle::ty::{self, FloatTy, Ty};
use rustc_span::Span; use rustc_span::Span;
use rustc_target::abi::IntegerType;
use super::{CAST_ENUM_TRUNCATION, CAST_POSSIBLE_TRUNCATION, utils}; use super::{CAST_ENUM_TRUNCATION, CAST_POSSIBLE_TRUNCATION, utils};

View file

@ -10,7 +10,7 @@ use rustc_session::impl_lint_pass;
use rustc_span::Span; use rustc_span::Span;
use rustc_span::def_id::LocalDefId; use rustc_span::def_id::LocalDefId;
use rustc_span::symbol::kw; use rustc_span::symbol::kw;
use rustc_target::spec::abi::Abi; use rustc_abi::ExternAbi;
pub struct BoxedLocal { pub struct BoxedLocal {
too_large_for_stack: u64, too_large_for_stack: u64,
@ -73,7 +73,7 @@ impl<'tcx> LateLintPass<'tcx> for BoxedLocal {
fn_def_id: LocalDefId, fn_def_id: LocalDefId,
) { ) {
if let Some(header) = fn_kind.header() { if let Some(header) = fn_kind.header() {
if header.abi != Abi::Rust { if header.abi != ExternAbi::Rust {
return; return;
} }
} }

View file

@ -15,7 +15,7 @@ use rustc_middle::ty::{
}; };
use rustc_session::declare_lint_pass; use rustc_session::declare_lint_pass;
use rustc_span::symbol::sym; use rustc_span::symbol::sym;
use rustc_target::spec::abi::Abi; use rustc_abi::ExternAbi;
use rustc_trait_selection::error_reporting::InferCtxtErrorExt as _; use rustc_trait_selection::error_reporting::InferCtxtErrorExt as _;
declare_clippy_lint! { declare_clippy_lint! {
@ -172,7 +172,7 @@ fn check_closure<'tcx>(cx: &LateContext<'tcx>, outer_receiver: Option<&Expr<'tcx
&& let output = typeck.expr_ty(body.value) && let output = typeck.expr_ty(body.value)
&& let ty::Tuple(tys) = *subs.type_at(1).kind() && let ty::Tuple(tys) = *subs.type_at(1).kind()
{ {
cx.tcx.mk_fn_sig(tys, output, false, Safety::Safe, Abi::Rust) cx.tcx.mk_fn_sig(tys, output, false, Safety::Safe, ExternAbi::Rust)
} else { } else {
return; return;
} }

View file

@ -7,7 +7,7 @@ use rustc_lint::{LateContext, LateLintPass};
use rustc_session::impl_lint_pass; use rustc_session::impl_lint_pass;
use rustc_span::Span; use rustc_span::Span;
use rustc_span::def_id::LocalDefId; use rustc_span::def_id::LocalDefId;
use rustc_target::spec::abi::Abi; use rustc_abi::ExternAbi;
declare_clippy_lint! { declare_clippy_lint! {
/// ### What it does /// ### What it does
@ -145,7 +145,7 @@ impl<'tcx> LateLintPass<'tcx> for ExcessiveBools {
fn check_trait_item(&mut self, cx: &LateContext<'tcx>, trait_item: &'tcx TraitItem<'tcx>) { fn check_trait_item(&mut self, cx: &LateContext<'tcx>, trait_item: &'tcx TraitItem<'tcx>) {
// functions with a body are already checked by `check_fn` // functions with a body are already checked by `check_fn`
if let TraitItemKind::Fn(fn_sig, TraitFn::Required(_)) = &trait_item.kind if let TraitItemKind::Fn(fn_sig, TraitFn::Required(_)) = &trait_item.kind
&& fn_sig.header.abi == Abi::Rust && fn_sig.header.abi == ExternAbi::Rust
&& fn_sig.decl.inputs.len() as u64 > self.max_fn_params_bools && fn_sig.decl.inputs.len() as u64 > self.max_fn_params_bools
{ {
check_fn_decl(cx, fn_sig.decl, fn_sig.span, self.max_fn_params_bools); check_fn_decl(cx, fn_sig.decl, fn_sig.span, self.max_fn_params_bools);
@ -162,7 +162,7 @@ impl<'tcx> LateLintPass<'tcx> for ExcessiveBools {
def_id: LocalDefId, def_id: LocalDefId,
) { ) {
if let Some(fn_header) = fn_kind.header() if let Some(fn_header) = fn_kind.header()
&& fn_header.abi == Abi::Rust && fn_header.abi == ExternAbi::Rust
&& fn_decl.inputs.len() as u64 > self.max_fn_params_bools && fn_decl.inputs.len() as u64 > self.max_fn_params_bools
&& get_parent_as_impl(cx.tcx, cx.tcx.local_def_id_to_hir_id(def_id)) && get_parent_as_impl(cx.tcx, cx.tcx.local_def_id_to_hir_id(def_id))
.is_none_or(|impl_item| impl_item.of_trait.is_none()) .is_none_or(|impl_item| impl_item.of_trait.is_none())

View file

@ -1,7 +1,7 @@
use rustc_hir::{self as hir, intravisit}; use rustc_hir::{self as hir, intravisit};
use rustc_lint::LateContext; use rustc_lint::LateContext;
use rustc_span::Span; use rustc_span::Span;
use rustc_target::spec::abi::Abi; use rustc_abi::ExternAbi;
use clippy_utils::diagnostics::span_lint; use clippy_utils::diagnostics::span_lint;
use clippy_utils::is_trait_impl_item; use clippy_utils::is_trait_impl_item;
@ -23,11 +23,11 @@ pub(super) fn check_fn(
intravisit::FnKind::Method( intravisit::FnKind::Method(
_, _,
&hir::FnSig { &hir::FnSig {
header: hir::FnHeader { abi: Abi::Rust, .. }, header: hir::FnHeader { abi: ExternAbi::Rust, .. },
.. ..
}, },
) )
| intravisit::FnKind::ItemFn(_, _, hir::FnHeader { abi: Abi::Rust, .. }) => check_arg_number( | intravisit::FnKind::ItemFn(_, _, hir::FnHeader { abi: ExternAbi::Rust, .. }) => check_arg_number(
cx, cx,
decl, decl,
span.with_hi(decl.output.span().hi()), span.with_hi(decl.output.span().hi()),
@ -41,7 +41,7 @@ pub(super) fn check_fn(
pub(super) fn check_trait_item(cx: &LateContext<'_>, item: &hir::TraitItem<'_>, too_many_arguments_threshold: u64) { pub(super) fn check_trait_item(cx: &LateContext<'_>, item: &hir::TraitItem<'_>, too_many_arguments_threshold: u64) {
if let hir::TraitItemKind::Fn(ref sig, _) = item.kind { if let hir::TraitItemKind::Fn(ref sig, _) = item.kind {
// don't lint extern functions decls, it's not their fault // don't lint extern functions decls, it's not their fault
if sig.header.abi == Abi::Rust { if sig.header.abi == ExternAbi::Rust {
check_arg_number( check_arg_number(
cx, cx,
sig.decl, sig.decl,

View file

@ -5,7 +5,7 @@ use rustc_hir::{GenericParamKind, ImplItem, ImplItemKind, LangItem};
use rustc_lint::{LateContext, LateLintPass}; use rustc_lint::{LateContext, LateLintPass};
use rustc_session::declare_lint_pass; use rustc_session::declare_lint_pass;
use rustc_span::sym; use rustc_span::sym;
use rustc_target::spec::abi::Abi; use rustc_abi::ExternAbi;
declare_clippy_lint! { declare_clippy_lint! {
/// ### What it does /// ### What it does
@ -96,7 +96,7 @@ impl<'tcx> LateLintPass<'tcx> for InherentToString {
// #11201 // #11201
&& let header = signature.header && let header = signature.header
&& header.is_safe() && header.is_safe()
&& header.abi == Abi::Rust && header.abi == ExternAbi::Rust
&& impl_item.ident.name == sym::to_string && impl_item.ident.name == sym::to_string
&& let decl = signature.decl && let decl = signature.decl
&& decl.implicit_self.has_implicit_self() && decl.implicit_self.has_implicit_self()

View file

@ -2,11 +2,11 @@ use clippy_config::Conf;
use clippy_utils::diagnostics::span_lint_and_sugg; use clippy_utils::diagnostics::span_lint_and_sugg;
use clippy_utils::source::snippet; use clippy_utils::source::snippet;
use clippy_utils::ty::implements_trait; use clippy_utils::ty::implements_trait;
use rustc_abi::Size;
use rustc_errors::Applicability; use rustc_errors::Applicability;
use rustc_hir::{Expr, ExprKind, LangItem, MatchSource, QPath}; use rustc_hir::{Expr, ExprKind, LangItem, MatchSource, QPath};
use rustc_lint::{LateContext, LateLintPass}; use rustc_lint::{LateContext, LateLintPass};
use rustc_session::impl_lint_pass; use rustc_session::impl_lint_pass;
use rustc_target::abi::Size;
declare_clippy_lint! { declare_clippy_lint! {
/// ### What it does /// ### What it does

View file

@ -149,6 +149,7 @@ use clippy_utils::msrvs::{self, Msrv};
use clippy_utils::ty::{contains_ty_adt_constructor_opaque, implements_trait, is_copy, is_type_diagnostic_item}; use clippy_utils::ty::{contains_ty_adt_constructor_opaque, implements_trait, is_copy, is_type_diagnostic_item};
use clippy_utils::{contains_return, is_bool, is_trait_method, iter_input_pats, peel_blocks, return_ty}; use clippy_utils::{contains_return, is_bool, is_trait_method, iter_input_pats, peel_blocks, return_ty};
pub use path_ends_with_ext::DEFAULT_ALLOWED_DOTFILES; pub use path_ends_with_ext::DEFAULT_ALLOWED_DOTFILES;
use rustc_abi::ExternAbi;
use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::fx::FxHashSet;
use rustc_hir as hir; use rustc_hir as hir;
use rustc_hir::{Expr, ExprKind, Node, Stmt, StmtKind, TraitItem, TraitItemKind}; use rustc_hir::{Expr, ExprKind, Node, Stmt, StmtKind, TraitItem, TraitItemKind};
@ -5447,7 +5448,7 @@ const FN_HEADER: hir::FnHeader = hir::FnHeader {
safety: hir::HeaderSafety::Normal(hir::Safety::Safe), safety: hir::HeaderSafety::Normal(hir::Safety::Safe),
constness: hir::Constness::NotConst, constness: hir::Constness::NotConst,
asyncness: hir::IsAsync::NotAsync, asyncness: hir::IsAsync::NotAsync,
abi: rustc_target::spec::abi::Abi::Rust, abi: ExternAbi::Rust,
}; };
struct ShouldImplTraitCase { struct ShouldImplTraitCase {

View file

@ -1,3 +1,4 @@
use clippy_config::Conf; use clippy_config::Conf;
use clippy_utils::diagnostics::span_lint_and_then; use clippy_utils::diagnostics::span_lint_and_then;
use clippy_utils::msrvs::{self, Msrv}; use clippy_utils::msrvs::{self, Msrv};
@ -12,7 +13,7 @@ use rustc_middle::ty;
use rustc_session::impl_lint_pass; use rustc_session::impl_lint_pass;
use rustc_span::Span; use rustc_span::Span;
use rustc_span::def_id::LocalDefId; use rustc_span::def_id::LocalDefId;
use rustc_target::spec::abi::Abi; use rustc_abi::ExternAbi;
declare_clippy_lint! { declare_clippy_lint! {
/// ### What it does /// ### What it does
@ -183,11 +184,11 @@ fn already_const(header: hir::FnHeader) -> bool {
header.constness == Constness::Const header.constness == Constness::Const
} }
fn could_be_const_with_abi(msrv: &Msrv, abi: Abi) -> bool { fn could_be_const_with_abi(msrv: &Msrv, abi: ExternAbi) -> bool {
match abi { match abi {
Abi::Rust => true, ExternAbi::Rust => true,
// `const extern "C"` was stabilized after 1.62.0 // `const extern "C"` was stabilized after 1.62.0
Abi::C { unwind: false } => msrv.meets(msrvs::CONST_EXTERN_C_FN), ExternAbi::C { unwind: false } => msrv.meets(msrvs::CONST_EXTERN_C_FN),
// Rest ABIs are still unstable and need the `const_extern_fn` feature enabled. // Rest ABIs are still unstable and need the `const_extern_fn` feature enabled.
_ => msrv.meets(msrvs::CONST_EXTERN_FN), _ => msrv.meets(msrvs::CONST_EXTERN_FN),
} }

Some files were not shown because too many files have changed in this diff Show more