diff --git a/Cargo.lock b/Cargo.lock index 89eb514917d6d..11ff417b11d02 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3400,6 +3400,7 @@ dependencies = [ name = "rustc_ast_lowering" version = "0.0.0" dependencies = [ + "rustc_abi", "rustc_ast", "rustc_ast_pretty", "rustc_data_structures", @@ -3422,6 +3423,7 @@ name = "rustc_ast_passes" version = "0.0.0" dependencies = [ "itertools", + "rustc_abi", "rustc_ast", "rustc_ast_pretty", "rustc_attr_parsing", @@ -4015,6 +4017,7 @@ version = "0.0.0" dependencies = [ "rustc-rayon", "rustc-rayon-core", + "rustc_abi", "rustc_ast", "rustc_ast_lowering", "rustc_ast_passes", diff --git a/compiler/rustc_ast/src/ast.rs b/compiler/rustc_ast/src/ast.rs index e75334b19c890..deee3a597aed9 100644 --- a/compiler/rustc_ast/src/ast.rs +++ b/compiler/rustc_ast/src/ast.rs @@ -3225,7 +3225,7 @@ pub enum Extern { /// /// 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), /// An explicit extern keyword was used with an explicit ABI. /// diff --git a/compiler/rustc_ast_lowering/Cargo.toml b/compiler/rustc_ast_lowering/Cargo.toml index 8cc4521e0a78d..754f3c1a6e9ae 100644 --- a/compiler/rustc_ast_lowering/Cargo.toml +++ b/compiler/rustc_ast_lowering/Cargo.toml @@ -8,6 +8,7 @@ doctest = false [dependencies] # tidy-alphabetical-start +rustc_abi = { path = "../rustc_abi" } rustc_ast = { path = "../rustc_ast" } rustc_ast_pretty = { path = "../rustc_ast_pretty" } rustc_data_structures = { path = "../rustc_data_structures" } diff --git a/compiler/rustc_ast_lowering/src/item.rs b/compiler/rustc_ast_lowering/src/item.rs index c96110fee619b..9e86ad29ef968 100644 --- a/compiler/rustc_ast_lowering/src/item.rs +++ b/compiler/rustc_ast_lowering/src/item.rs @@ -1,3 +1,4 @@ +use rustc_abi::ExternAbi; use rustc_ast::ptr::P; use rustc_ast::visit::AssocCtxt; use rustc_ast::*; @@ -11,7 +12,6 @@ use rustc_middle::span_bug; use rustc_middle::ty::{ResolverAstLowering, TyCtxt}; use rustc_span::edit_distance::find_best_match_for_name; use rustc_span::{DesugaringKind, Ident, Span, Symbol, kw, sym}; -use rustc_target::spec::abi; use smallvec::{SmallVec, smallvec}; use thin_vec::ThinVec; use tracing::instrument; @@ -275,7 +275,7 @@ impl<'hir> LoweringContext<'_, 'hir> { ModKind::Unloaded => panic!("`mod` items should have been loaded by now"), }, 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 .arena .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 { - abi::lookup(abi.symbol_unescaped.as_str()).unwrap_or_else(|err| { + pub(super) fn lower_abi(&mut self, abi: StrLit) -> ExternAbi { + rustc_abi::lookup(abi.symbol_unescaped.as_str()).unwrap_or_else(|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 { - Extern::None => abi::Abi::Rust, - Extern::Implicit(_) => abi::Abi::FALLBACK, + Extern::None => ExternAbi::Rust, + Extern::Implicit(_) => ExternAbi::FALLBACK, Extern::Explicit(abi, _) => self.lower_abi(abi), } } - fn error_on_invalid_abi(&self, abi: StrLit, err: abi::AbiUnsupported) { - let abi_names = abi::enabled_names(self.tcx.features(), abi.span) + fn error_on_invalid_abi(&self, abi: StrLit, err: rustc_abi::AbiUnsupported) { + let abi_names = rustc_abi::enabled_names(self.tcx.features(), abi.span) .iter() .map(|s| Symbol::intern(s)) .collect::>(); @@ -1495,7 +1495,7 @@ impl<'hir> LoweringContext<'_, 'hir> { abi: abi.symbol_unescaped, span: abi.span, explain: match err { - abi::AbiUnsupported::Reason { explain } => Some(InvalidAbiReason(explain)), + rustc_abi::AbiUnsupported::Reason { explain } => Some(InvalidAbiReason(explain)), _ => None, }, suggestion: suggested_name.map(|suggested_name| InvalidAbiSuggestion { diff --git a/compiler/rustc_ast_passes/Cargo.toml b/compiler/rustc_ast_passes/Cargo.toml index 8046765647e8d..19c379c8599a8 100644 --- a/compiler/rustc_ast_passes/Cargo.toml +++ b/compiler/rustc_ast_passes/Cargo.toml @@ -6,6 +6,7 @@ edition = "2021" [dependencies] # tidy-alphabetical-start itertools = "0.12" +rustc_abi = { path = "../rustc_abi" } rustc_ast = { path = "../rustc_ast" } rustc_ast_pretty = { path = "../rustc_ast_pretty" } rustc_attr_parsing = { path = "../rustc_attr_parsing" } diff --git a/compiler/rustc_ast_passes/src/feature_gate.rs b/compiler/rustc_ast_passes/src/feature_gate.rs index 62e451fa8764f..13294efdaf6f9 100644 --- a/compiler/rustc_ast_passes/src/feature_gate.rs +++ b/compiler/rustc_ast_passes/src/feature_gate.rs @@ -6,7 +6,6 @@ use rustc_session::Session; use rustc_session::parse::{feature_err, feature_err_issue, feature_warn}; use rustc_span::source_map::Spanned; use rustc_span::{Span, Symbol, sym}; -use rustc_target::spec::abi; use thin_vec::ThinVec; use crate::errors; @@ -77,12 +76,12 @@ impl<'a> PostExpansionVisitor<'a> { fn check_abi(&self, abi: ast::StrLit) { 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(()) => (), - Err(abi::AbiDisabled::Unstable { feature, explain }) => { + Err(rustc_abi::AbiDisabled::Unstable { feature, explain }) => { 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()) { self.sess.dcx().span_delayed_bug( span, diff --git a/compiler/rustc_codegen_gcc/src/abi.rs b/compiler/rustc_codegen_gcc/src/abi.rs index d94fc5525288d..717baebcd8cd6 100644 --- a/compiler/rustc_codegen_gcc/src/abi.rs +++ b/compiler/rustc_codegen_gcc/src/abi.rs @@ -1,6 +1,7 @@ #[cfg(feature = "master")] use gccjit::FnAttribute; use gccjit::{ToLValue, ToRValue, Type}; +use rustc_abi::{Reg, RegKind}; use rustc_codegen_ssa::traits::{AbiBuilderMethods, BaseTypeCodegenMethods}; use rustc_data_structures::fx::FxHashSet; use rustc_middle::bug; @@ -8,7 +9,7 @@ use rustc_middle::ty::Ty; use rustc_middle::ty::layout::LayoutOf; #[cfg(feature = "master")] 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::context::CodegenCx; diff --git a/compiler/rustc_codegen_llvm/src/abi.rs b/compiler/rustc_codegen_llvm/src/abi.rs index 31ee0eeca11fa..fb3ec72785a6a 100644 --- a/compiler/rustc_codegen_llvm/src/abi.rs +++ b/compiler/rustc_codegen_llvm/src/abi.rs @@ -4,8 +4,7 @@ use std::cmp; use libc::c_uint; use rustc_abi as abi; pub(crate) use rustc_abi::ExternAbi; -use rustc_abi::Primitive::Int; -use rustc_abi::{HasDataLayout, Size}; +use rustc_abi::{HasDataLayout, Primitive, Reg, RegKind, Size}; use rustc_codegen_ssa::MemFlags; use rustc_codegen_ssa::mir::operand::{OperandRef, OperandValue}; 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| { if cx.sess().opts.optimize != config::OptLevel::No && 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 // become 0..0 when the type becomes i1, which would be rejected // 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 && llvm_util::get_version() < (19, 0, 0) && 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 // become 0..0 when the type becomes i1, which would be rejected // by the LLVM verifier. diff --git a/compiler/rustc_codegen_llvm/src/type_.rs b/compiler/rustc_codegen_llvm/src/type_.rs index c56ad886120f0..34cede54aaf15 100644 --- a/compiler/rustc_codegen_llvm/src/type_.rs +++ b/compiler/rustc_codegen_llvm/src/type_.rs @@ -1,14 +1,14 @@ use std::{fmt, ptr}; 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::traits::*; use rustc_data_structures::small_c_str::SmallCStr; use rustc_middle::bug; use rustc_middle::ty::layout::TyAndLayout; 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::context::{CodegenCx, SimpleCx}; diff --git a/compiler/rustc_codegen_ssa/src/mir/block.rs b/compiler/rustc_codegen_ssa/src/mir/block.rs index 2eecf81a5d28f..20d06e63749d0 100644 --- a/compiler/rustc_codegen_ssa/src/mir/block.rs +++ b/compiler/rustc_codegen_ssa/src/mir/block.rs @@ -1,6 +1,6 @@ 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::{InlineAsmOptions, InlineAsmTemplatePiece}; use rustc_hir::lang_items::LangItem; @@ -14,7 +14,7 @@ use rustc_middle::{bug, span_bug}; use rustc_session::config::OptLevel; use rustc_span::source_map::Spanned; 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 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 // of the `OperandValue::Immediate` we need for the call. 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() { bx.range_metadata(llval, WrappingRange { start: 0, end: 1 }); } diff --git a/compiler/rustc_codegen_ssa/src/traits/consts.rs b/compiler/rustc_codegen_ssa/src/traits/consts.rs index d0de7ff0b5ff1..5cfb56ebacee8 100644 --- a/compiler/rustc_codegen_ssa/src/traits/consts.rs +++ b/compiler/rustc_codegen_ssa/src/traits/consts.rs @@ -1,5 +1,5 @@ +use rustc_abi as abi; use rustc_middle::mir::interpret::{ConstAllocation, Scalar}; -use rustc_target::abi; use super::BackendTypes; diff --git a/compiler/rustc_codegen_ssa/src/traits/type_.rs b/compiler/rustc_codegen_ssa/src/traits/type_.rs index 6292d321f6bff..c178ebc596e1e 100644 --- a/compiler/rustc_codegen_ssa/src/traits/type_.rs +++ b/compiler/rustc_codegen_ssa/src/traits/type_.rs @@ -1,8 +1,8 @@ -use rustc_abi::{AddressSpace, Float, Integer}; +use rustc_abi::{AddressSpace, Float, Integer, Reg}; use rustc_middle::bug; use rustc_middle::ty::layout::{HasTyCtxt, HasTypingEnv, TyAndLayout}; 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::misc::MiscCodegenMethods; diff --git a/compiler/rustc_interface/Cargo.toml b/compiler/rustc_interface/Cargo.toml index dcb9c5d22d61b..295a988d2da5d 100644 --- a/compiler/rustc_interface/Cargo.toml +++ b/compiler/rustc_interface/Cargo.toml @@ -7,6 +7,7 @@ edition = "2021" # tidy-alphabetical-start rustc-rayon = { version = "0.5.0" } rustc-rayon-core = { version = "0.5.0" } +rustc_abi = { path = "../rustc_abi" } rustc_ast = { path = "../rustc_ast" } rustc_ast_lowering = { path = "../rustc_ast_lowering" } rustc_ast_passes = { path = "../rustc_ast_passes" } diff --git a/compiler/rustc_interface/src/tests.rs b/compiler/rustc_interface/src/tests.rs index 46d6f37a91cb5..a5a11cf776bfa 100644 --- a/compiler/rustc_interface/src/tests.rs +++ b/compiler/rustc_interface/src/tests.rs @@ -4,6 +4,7 @@ use std::num::NonZero; use std::path::{Path, PathBuf}; use std::sync::atomic::AtomicBool; +use rustc_abi::Align; use rustc_data_structures::profiling::TimePassesFormat; use rustc_errors::emitter::HumanReadableErrorType; 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::source_map::{RealFileLoader, SourceMapInputs}; use rustc_span::{FileName, SourceFileHashAlgorithm, sym}; -use rustc_target::abi::Align; use rustc_target::spec::{ CodeModel, FramePointer, LinkerFlavorCli, MergeFunctions, OnBrokenPipe, PanicStrategy, RelocModel, RelroLevel, SanitizerSet, SplitDebuginfo, StackProtector, TlsModel, WasmCAbi, diff --git a/compiler/rustc_monomorphize/src/mono_checks/abi_check.rs b/compiler/rustc_monomorphize/src/mono_checks/abi_check.rs index 30e634d825276..a0be7f11d709d 100644 --- a/compiler/rustc_monomorphize/src/mono_checks/abi_check.rs +++ b/compiler/rustc_monomorphize/src/mono_checks/abi_check.rs @@ -1,5 +1,6 @@ //! 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. +use rustc_abi::{BackendRepr, RegKind}; use rustc_hir::CRATE_HIR_ID; use rustc_middle::mir::{self, traversal}; 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_span::def_id::DefId; use rustc_span::{DUMMY_SP, Span, Symbol}; -use rustc_target::abi::call::{FnAbi, PassMode}; -use rustc_target::abi::{BackendRepr, RegKind}; +use rustc_target::callconv::{FnAbi, PassMode}; use crate::errors::{ AbiErrorDisabledVectorTypeCall, AbiErrorDisabledVectorTypeDef, diff --git a/compiler/rustc_passes/src/abi_test.rs b/compiler/rustc_passes/src/abi_test.rs index 75a1bb39a744d..4601bb87b76f9 100644 --- a/compiler/rustc_passes/src/abi_test.rs +++ b/compiler/rustc_passes/src/abi_test.rs @@ -6,7 +6,7 @@ use rustc_middle::ty::layout::{FnAbiError, LayoutError}; use rustc_middle::ty::{self, GenericArgs, Instance, Ty, TyCtxt}; use rustc_span::source_map::Spanned; use rustc_span::sym; -use rustc_target::abi::call::FnAbi; +use rustc_target::callconv::FnAbi; use super::layout_test::ensure_wf; use crate::errors::{AbiInvalidAttribute, AbiNe, AbiOf, UnrecognizedField}; diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs index 4c683c82b6c08..832143817607a 100644 --- a/compiler/rustc_passes/src/check_attr.rs +++ b/compiler/rustc_passes/src/check_attr.rs @@ -7,6 +7,7 @@ use std::cell::Cell; use std::collections::hash_map::Entry; +use rustc_abi::{ExternAbi, Size}; use rustc_ast::{AttrStyle, LitKind, MetaItemInner, MetaItemKind, MetaItemLit, ast}; use rustc_data_structures::fx::FxHashMap; 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_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::infer::{TyCtxtInferExt, ValuePairs}; use rustc_trait_selection::traits::ObligationCtxt; @@ -1519,7 +1518,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { if target == Target::ForeignMod && let hir::Node::Item(item) = self.tcx.hir_node(hir_id) && let Item { kind: ItemKind::ForeignMod { abi, .. }, .. } = item - && !matches!(abi, Abi::Rust | Abi::RustIntrinsic) + && !matches!(abi, ExternAbi::Rust | ExternAbi::RustIntrinsic) { return; } @@ -2445,7 +2444,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { token_stream, false, Safety::Safe, - Abi::Rust, + ExternAbi::Rust, ); if let Err(terr) = ocx.eq(&cause, param_env, expected_sig, sig) { diff --git a/compiler/rustc_resolve/src/imports.rs b/compiler/rustc_resolve/src/imports.rs index d555c93877035..d111dcf4fdc23 100644 --- a/compiler/rustc_resolve/src/imports.rs +++ b/compiler/rustc_resolve/src/imports.rs @@ -1500,7 +1500,7 @@ fn import_path_to_string(names: &[Ident], import_kind: &ImportKind<'_>, span: Sp let global = !names.is_empty() && names[0].name == kw::PathRoot; if let Some(pos) = pos { let names = if global { &names[1..pos + 1] } else { &names[..pos + 1] }; - names_to_string(&names.iter().map(|ident| ident.name).collect::>()) + names_to_string(names.iter().map(|ident| ident.name)) } else { let names = if global { &names[1..] } else { names }; if names.is_empty() { @@ -1508,7 +1508,7 @@ fn import_path_to_string(names: &[Ident], import_kind: &ImportKind<'_>, span: Sp } else { format!( "{}::{}", - names_to_string(&names.iter().map(|ident| ident.name).collect::>()), + names_to_string(names.iter().map(|ident| ident.name)), import_kind_to_string(import_kind), ) } diff --git a/compiler/rustc_resolve/src/lib.rs b/compiler/rustc_resolve/src/lib.rs index 1cf821653c9ee..90191b7776f32 100644 --- a/compiler/rustc_resolve/src/lib.rs +++ b/compiler/rustc_resolve/src/lib.rs @@ -358,7 +358,7 @@ impl Segment { } fn names_to_string(segments: &[Segment]) -> String { - names_to_string(&segments.iter().map(|seg| seg.ident.name).collect::>()) + names_to_string(segments.iter().map(|seg| seg.ident.name)) } } @@ -2241,13 +2241,13 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { } } -fn names_to_string(names: &[Symbol]) -> String { +fn names_to_string(names: impl Iterator) -> String { let mut result = String::new(); - for (i, name) in names.iter().filter(|name| **name != kw::PathRoot).enumerate() { + for (i, name) in names.filter(|name| *name != kw::PathRoot).enumerate() { if i > 0 { result.push_str("::"); } - if Ident::with_dummy_span(*name).is_raw_guess() { + if Ident::with_dummy_span(name).is_raw_guess() { result.push_str("r#"); } result.push_str(name.as_str()); @@ -2256,31 +2256,32 @@ fn names_to_string(names: &[Symbol]) -> String { } fn path_names_to_string(path: &Path) -> String { - names_to_string(&path.segments.iter().map(|seg| seg.ident.name).collect::>()) + names_to_string(path.segments.iter().map(|seg| seg.ident.name)) } /// A somewhat inefficient routine to obtain the name of a module. -fn module_to_string(module: Module<'_>) -> Option { +fn module_to_string(mut module: Module<'_>) -> Option { let mut names = Vec::new(); - - fn collect_mod(names: &mut Vec, module: Module<'_>) { + loop { if let ModuleKind::Def(.., name) = module.kind { if let Some(parent) = module.parent { names.push(name); - collect_mod(names, parent); + module = parent + } else { + break; } } else { names.push(sym::opaque_module_name_placeholder); - collect_mod(names, module.parent.unwrap()); + let Some(parent) = module.parent else { + return None; + }; + module = parent; } } - collect_mod(&mut names, module); - if names.is_empty() { return None; } - names.reverse(); - Some(names_to_string(&names)) + Some(names_to_string(names.iter().rev().copied())) } #[derive(Copy, Clone, Debug)] diff --git a/compiler/rustc_target/src/callconv/aarch64.rs b/compiler/rustc_target/src/callconv/aarch64.rs index d712bec9b780e..5c23e7036b043 100644 --- a/compiler/rustc_target/src/callconv/aarch64.rs +++ b/compiler/rustc_target/src/callconv/aarch64.rs @@ -2,7 +2,7 @@ use std::iter; 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}; /// Indicates the variant of the AArch64 ABI we are compiling for. diff --git a/compiler/rustc_target/src/callconv/amdgpu.rs b/compiler/rustc_target/src/callconv/amdgpu.rs index 91ac00e025001..3ec6d0b3da20b 100644 --- a/compiler/rustc_target/src/callconv/amdgpu.rs +++ b/compiler/rustc_target/src/callconv/amdgpu.rs @@ -1,6 +1,6 @@ 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>) where diff --git a/compiler/rustc_target/src/callconv/arm.rs b/compiler/rustc_target/src/callconv/arm.rs index 75797daba695a..0a5dcc6634759 100644 --- a/compiler/rustc_target/src/callconv/arm.rs +++ b/compiler/rustc_target/src/callconv/arm.rs @@ -1,6 +1,6 @@ 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; fn is_homogeneous_aggregate<'a, Ty, C>(cx: &C, arg: &mut ArgAbi<'a, Ty>) -> Option diff --git a/compiler/rustc_target/src/callconv/avr.rs b/compiler/rustc_target/src/callconv/avr.rs index dfc991e09543a..0d690eff68dcf 100644 --- a/compiler/rustc_target/src/callconv/avr.rs +++ b/compiler/rustc_target/src/callconv/avr.rs @@ -30,7 +30,7 @@ //! compatible with AVR-GCC - Rust and AVR-GCC only differ in the small amount //! of compiler frontend specific calling convention logic implemented here. -use crate::abi::call::{ArgAbi, FnAbi}; +use crate::callconv::{ArgAbi, FnAbi}; fn classify_ret_ty(ret: &mut ArgAbi<'_, Ty>) { if ret.layout.is_aggregate() { diff --git a/compiler/rustc_target/src/callconv/bpf.rs b/compiler/rustc_target/src/callconv/bpf.rs index f19772ac70918..f958aeb9bb654 100644 --- a/compiler/rustc_target/src/callconv/bpf.rs +++ b/compiler/rustc_target/src/callconv/bpf.rs @@ -1,5 +1,5 @@ // 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(ret: &mut ArgAbi<'_, Ty>) { if ret.layout.is_aggregate() || ret.layout.size.bits() > 64 { diff --git a/compiler/rustc_target/src/callconv/csky.rs b/compiler/rustc_target/src/callconv/csky.rs index b1c1ae814a7ed..cf289e639eac4 100644 --- a/compiler/rustc_target/src/callconv/csky.rs +++ b/compiler/rustc_target/src/callconv/csky.rs @@ -4,7 +4,7 @@ // Reference: Clang CSKY lowering code // 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(arg: &mut ArgAbi<'_, Ty>) { if !arg.layout.is_sized() { diff --git a/compiler/rustc_target/src/callconv/hexagon.rs b/compiler/rustc_target/src/callconv/hexagon.rs index 0a0688880c019..d4f6dd0a5b4d3 100644 --- a/compiler/rustc_target/src/callconv/hexagon.rs +++ b/compiler/rustc_target/src/callconv/hexagon.rs @@ -1,4 +1,4 @@ -use crate::abi::call::{ArgAbi, FnAbi}; +use crate::callconv::{ArgAbi, FnAbi}; fn classify_ret(ret: &mut ArgAbi<'_, Ty>) { if ret.layout.is_aggregate() && ret.layout.size.bits() > 64 { diff --git a/compiler/rustc_target/src/callconv/m68k.rs b/compiler/rustc_target/src/callconv/m68k.rs index 82fe81f8c52ae..0b637e1e27a5b 100644 --- a/compiler/rustc_target/src/callconv/m68k.rs +++ b/compiler/rustc_target/src/callconv/m68k.rs @@ -1,4 +1,4 @@ -use crate::abi::call::{ArgAbi, FnAbi}; +use crate::callconv::{ArgAbi, FnAbi}; fn classify_ret(ret: &mut ArgAbi<'_, Ty>) { if ret.layout.is_aggregate() { diff --git a/compiler/rustc_target/src/callconv/mips.rs b/compiler/rustc_target/src/callconv/mips.rs index f7d688221552b..6162267a0d064 100644 --- a/compiler/rustc_target/src/callconv/mips.rs +++ b/compiler/rustc_target/src/callconv/mips.rs @@ -1,6 +1,6 @@ use rustc_abi::{HasDataLayout, Size}; -use crate::abi::call::{ArgAbi, FnAbi, Reg, Uniform}; +use crate::callconv::{ArgAbi, FnAbi, Reg, Uniform}; fn classify_ret(cx: &C, ret: &mut ArgAbi<'_, Ty>, offset: &mut Size) where diff --git a/compiler/rustc_target/src/callconv/mod.rs b/compiler/rustc_target/src/callconv/mod.rs index 9e651376cd7ce..50ac6c8fcde16 100644 --- a/compiler/rustc_target/src/callconv/mod.rs +++ b/compiler/rustc_target/src/callconv/mod.rs @@ -2,10 +2,9 @@ use std::str::FromStr; use std::{fmt, iter}; use rustc_abi::{ - AddressSpace, Align, BackendRepr, ExternAbi, HasDataLayout, Scalar, Size, TyAbiInterface, - TyAndLayout, + AddressSpace, Align, BackendRepr, ExternAbi, HasDataLayout, Primitive, Reg, RegKind, Scalar, + Size, TyAbiInterface, TyAndLayout, }; -pub use rustc_abi::{Primitive, Reg, RegKind}; use rustc_macros::HashStable_Generic; use rustc_span::Symbol; diff --git a/compiler/rustc_target/src/callconv/msp430.rs b/compiler/rustc_target/src/callconv/msp430.rs index 4f613aa6c1549..3b53d183ddcda 100644 --- a/compiler/rustc_target/src/callconv/msp430.rs +++ b/compiler/rustc_target/src/callconv/msp430.rs @@ -1,7 +1,7 @@ // Reference: MSP430 Embedded Application Binary Interface // 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 // diff --git a/compiler/rustc_target/src/callconv/nvptx64.rs b/compiler/rustc_target/src/callconv/nvptx64.rs index c5da185565887..a26e7dac5bafb 100644 --- a/compiler/rustc_target/src/callconv/nvptx64.rs +++ b/compiler/rustc_target/src/callconv/nvptx64.rs @@ -1,7 +1,7 @@ use rustc_abi::{HasDataLayout, Reg, Size, TyAbiInterface}; use super::{ArgAttribute, ArgAttributes, ArgExtension, CastTarget}; -use crate::abi::call::{ArgAbi, FnAbi, Uniform}; +use crate::callconv::{ArgAbi, FnAbi, Uniform}; fn classify_ret(ret: &mut ArgAbi<'_, Ty>) { if ret.layout.is_aggregate() && ret.layout.is_sized() { diff --git a/compiler/rustc_target/src/callconv/powerpc.rs b/compiler/rustc_target/src/callconv/powerpc.rs index f3b05c4817301..2f6129626b812 100644 --- a/compiler/rustc_target/src/callconv/powerpc.rs +++ b/compiler/rustc_target/src/callconv/powerpc.rs @@ -1,4 +1,4 @@ -use crate::abi::call::{ArgAbi, FnAbi}; +use crate::callconv::{ArgAbi, FnAbi}; use crate::spec::HasTargetSpec; fn classify_ret(ret: &mut ArgAbi<'_, Ty>) { diff --git a/compiler/rustc_target/src/callconv/powerpc64.rs b/compiler/rustc_target/src/callconv/powerpc64.rs index 7a66ce8529af0..89ec85e4b6664 100644 --- a/compiler/rustc_target/src/callconv/powerpc64.rs +++ b/compiler/rustc_target/src/callconv/powerpc64.rs @@ -4,7 +4,7 @@ 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; #[derive(Debug, Clone, Copy, PartialEq)] diff --git a/compiler/rustc_target/src/callconv/riscv.rs b/compiler/rustc_target/src/callconv/riscv.rs index 24531b0ef6356..265ae20f9919d 100644 --- a/compiler/rustc_target/src/callconv/riscv.rs +++ b/compiler/rustc_target/src/callconv/riscv.rs @@ -9,7 +9,7 @@ use rustc_abi::{ 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; #[derive(Copy, Clone)] diff --git a/compiler/rustc_target/src/callconv/s390x.rs b/compiler/rustc_target/src/callconv/s390x.rs index edf57098d6d92..4f69e32b2e3df 100644 --- a/compiler/rustc_target/src/callconv/s390x.rs +++ b/compiler/rustc_target/src/callconv/s390x.rs @@ -3,7 +3,7 @@ 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; fn classify_ret(ret: &mut ArgAbi<'_, Ty>) { diff --git a/compiler/rustc_target/src/callconv/sparc.rs b/compiler/rustc_target/src/callconv/sparc.rs index f7d688221552b..6162267a0d064 100644 --- a/compiler/rustc_target/src/callconv/sparc.rs +++ b/compiler/rustc_target/src/callconv/sparc.rs @@ -1,6 +1,6 @@ use rustc_abi::{HasDataLayout, Size}; -use crate::abi::call::{ArgAbi, FnAbi, Reg, Uniform}; +use crate::callconv::{ArgAbi, FnAbi, Reg, Uniform}; fn classify_ret(cx: &C, ret: &mut ArgAbi<'_, Ty>, offset: &mut Size) where diff --git a/compiler/rustc_target/src/callconv/sparc64.rs b/compiler/rustc_target/src/callconv/sparc64.rs index 392fb5156fce4..7ca0031fc59c0 100644 --- a/compiler/rustc_target/src/callconv/sparc64.rs +++ b/compiler/rustc_target/src/callconv/sparc64.rs @@ -5,7 +5,7 @@ use rustc_abi::{ TyAndLayout, }; -use crate::abi::call::{ +use crate::callconv::{ ArgAbi, ArgAttribute, ArgAttributes, ArgExtension, CastTarget, FnAbi, Uniform, }; use crate::spec::HasTargetSpec; diff --git a/compiler/rustc_target/src/callconv/wasm.rs b/compiler/rustc_target/src/callconv/wasm.rs index 56cd7a3f93de7..364a655113114 100644 --- a/compiler/rustc_target/src/callconv/wasm.rs +++ b/compiler/rustc_target/src/callconv/wasm.rs @@ -1,6 +1,6 @@ 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 where diff --git a/compiler/rustc_target/src/callconv/x86.rs b/compiler/rustc_target/src/callconv/x86.rs index 7c88d9b55cfee..5b9414536d8ca 100644 --- a/compiler/rustc_target/src/callconv/x86.rs +++ b/compiler/rustc_target/src/callconv/x86.rs @@ -3,7 +3,7 @@ use rustc_abi::{ TyAbiInterface, TyAndLayout, }; -use crate::abi::call::{ArgAttribute, FnAbi, PassMode}; +use crate::callconv::{ArgAttribute, FnAbi, PassMode}; use crate::spec::HasTargetSpec; #[derive(PartialEq)] diff --git a/compiler/rustc_target/src/callconv/x86_64.rs b/compiler/rustc_target/src/callconv/x86_64.rs index 6e9b4690a2cfd..b15d82c26dac2 100644 --- a/compiler/rustc_target/src/callconv/x86_64.rs +++ b/compiler/rustc_target/src/callconv/x86_64.rs @@ -6,7 +6,7 @@ use rustc_abi::{ Variants, }; -use crate::abi::call::{ArgAbi, CastTarget, FnAbi}; +use crate::callconv::{ArgAbi, CastTarget, FnAbi}; /// Classification of "eightbyte" components. // N.B., the order of the variants is from general to specific, diff --git a/compiler/rustc_target/src/callconv/x86_win64.rs b/compiler/rustc_target/src/callconv/x86_win64.rs index 816564d2fed8b..23ef2cf828409 100644 --- a/compiler/rustc_target/src/callconv/x86_win64.rs +++ b/compiler/rustc_target/src/callconv/x86_win64.rs @@ -1,6 +1,6 @@ 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; // Win64 ABI: https://docs.microsoft.com/en-us/cpp/build/parameter-passing diff --git a/compiler/rustc_target/src/callconv/xtensa.rs b/compiler/rustc_target/src/callconv/xtensa.rs index 2542713bc11b3..6c030cb3bf770 100644 --- a/compiler/rustc_target/src/callconv/xtensa.rs +++ b/compiler/rustc_target/src/callconv/xtensa.rs @@ -7,7 +7,7 @@ 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; const NUM_ARG_GPRS: u64 = 6; diff --git a/compiler/rustc_target/src/json.rs b/compiler/rustc_target/src/json.rs index 961cce5d6b9f9..15cf7e195dbe5 100644 --- a/compiler/rustc_target/src/json.rs +++ b/compiler/rustc_target/src/json.rs @@ -92,7 +92,7 @@ impl ToJson for Option { } } -impl ToJson for crate::abi::call::Conv { +impl ToJson for crate::callconv::Conv { fn to_json(&self) -> Json { let buf: String; let s = match self { diff --git a/compiler/rustc_target/src/lib.rs b/compiler/rustc_target/src/lib.rs index 11fc09d26e4f9..bde4af643fa6c 100644 --- a/compiler/rustc_target/src/lib.rs +++ b/compiler/rustc_target/src/lib.rs @@ -30,12 +30,6 @@ pub mod target_features; #[cfg(test)] mod tests; -pub mod abi { - pub use rustc_abi::*; - - pub use crate::callconv as call; -} - pub use rustc_abi::HashStableContext; /// The name of rustc's own place to organize libraries. diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs index e95c4dbd2cffd..03b3426fcec01 100644 --- a/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs @@ -51,7 +51,7 @@ use rustc_span::{Symbol, kw, sym}; use serde_json::Value; use tracing::debug; -use crate::abi::call::Conv; +use crate::callconv::Conv; use crate::json::{Json, ToJson}; use crate::spec::crt_objects::CrtObjects; diff --git a/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu.rs index 1511c0ccaad90..de6fe991460a0 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu.rs @@ -1,4 +1,5 @@ -use crate::abi::Endian; +use rustc_abi::Endian; + use crate::spec::{StackProbeType, Target, TargetOptions, base}; pub(crate) fn target() -> Target { diff --git a/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu_ilp32.rs b/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu_ilp32.rs index e7070778794c2..8fdaff822fe79 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu_ilp32.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu_ilp32.rs @@ -1,4 +1,5 @@ -use crate::abi::Endian; +use rustc_abi::Endian; + use crate::spec::{StackProbeType, Target, TargetOptions, base}; pub(crate) fn target() -> Target { diff --git a/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_netbsd.rs b/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_netbsd.rs index f0f6e49eedd5f..4e1e95ab7516e 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_netbsd.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_netbsd.rs @@ -1,4 +1,5 @@ -use crate::abi::Endian; +use rustc_abi::Endian; + use crate::spec::{StackProbeType, Target, TargetOptions, base}; pub(crate) fn target() -> Target { diff --git a/compiler/rustc_target/src/spec/targets/armeb_unknown_linux_gnueabi.rs b/compiler/rustc_target/src/spec/targets/armeb_unknown_linux_gnueabi.rs index bac9b39bbf2ae..60ec4edbb0d21 100644 --- a/compiler/rustc_target/src/spec/targets/armeb_unknown_linux_gnueabi.rs +++ b/compiler/rustc_target/src/spec/targets/armeb_unknown_linux_gnueabi.rs @@ -1,4 +1,5 @@ -use crate::abi::Endian; +use rustc_abi::Endian; + use crate::spec::{FloatAbi, Target, TargetOptions, base}; pub(crate) fn target() -> Target { diff --git a/compiler/rustc_target/src/spec/targets/armebv7r_none_eabi.rs b/compiler/rustc_target/src/spec/targets/armebv7r_none_eabi.rs index db774323e7be6..18b93f6cbc4f5 100644 --- a/compiler/rustc_target/src/spec/targets/armebv7r_none_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/armebv7r_none_eabi.rs @@ -1,6 +1,7 @@ // Targets the Big endian Cortex-R4/R5 processor (ARMv7-R) -use crate::abi::Endian; +use rustc_abi::Endian; + use crate::spec::{ Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions, }; diff --git a/compiler/rustc_target/src/spec/targets/armebv7r_none_eabihf.rs b/compiler/rustc_target/src/spec/targets/armebv7r_none_eabihf.rs index de006a92668fb..6c22cd34fc3a1 100644 --- a/compiler/rustc_target/src/spec/targets/armebv7r_none_eabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armebv7r_none_eabihf.rs @@ -1,6 +1,7 @@ // Targets the Cortex-R4F/R5F processor (ARMv7-R) -use crate::abi::Endian; +use rustc_abi::Endian; + use crate::spec::{ Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions, }; diff --git a/compiler/rustc_target/src/spec/targets/armv7_sony_vita_newlibeabihf.rs b/compiler/rustc_target/src/spec/targets/armv7_sony_vita_newlibeabihf.rs index 18d834597d87e..5abee9ea33007 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_sony_vita_newlibeabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_sony_vita_newlibeabihf.rs @@ -1,4 +1,5 @@ -use crate::abi::Endian; +use rustc_abi::Endian; + use crate::spec::{Cc, FloatAbi, LinkerFlavor, Lld, RelocModel, Target, TargetOptions, cvs}; /// A base target for PlayStation Vita devices using the VITASDK toolchain (using newlib). diff --git a/compiler/rustc_target/src/spec/targets/bpfeb_unknown_none.rs b/compiler/rustc_target/src/spec/targets/bpfeb_unknown_none.rs index df0f29ceab23b..b95f93c3553cd 100644 --- a/compiler/rustc_target/src/spec/targets/bpfeb_unknown_none.rs +++ b/compiler/rustc_target/src/spec/targets/bpfeb_unknown_none.rs @@ -1,4 +1,5 @@ -use crate::abi::Endian; +use rustc_abi::Endian; + use crate::spec::{Target, base}; pub(crate) fn target() -> Target { diff --git a/compiler/rustc_target/src/spec/targets/bpfel_unknown_none.rs b/compiler/rustc_target/src/spec/targets/bpfel_unknown_none.rs index 691acf89d641f..711bbb04b1950 100644 --- a/compiler/rustc_target/src/spec/targets/bpfel_unknown_none.rs +++ b/compiler/rustc_target/src/spec/targets/bpfel_unknown_none.rs @@ -1,4 +1,5 @@ -use crate::abi::Endian; +use rustc_abi::Endian; + use crate::spec::{Target, base}; pub(crate) fn target() -> Target { diff --git a/compiler/rustc_target/src/spec/targets/m68k_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/m68k_unknown_linux_gnu.rs index 47c6d80548359..d3584a1be743a 100644 --- a/compiler/rustc_target/src/spec/targets/m68k_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/m68k_unknown_linux_gnu.rs @@ -1,4 +1,5 @@ -use crate::abi::Endian; +use rustc_abi::Endian; + use crate::spec::{LinkSelfContainedDefault, Target, TargetOptions, base}; pub(crate) fn target() -> Target { diff --git a/compiler/rustc_target/src/spec/targets/m68k_unknown_none_elf.rs b/compiler/rustc_target/src/spec/targets/m68k_unknown_none_elf.rs index 6b8b7c6ae0038..8b8693b55c5cc 100644 --- a/compiler/rustc_target/src/spec/targets/m68k_unknown_none_elf.rs +++ b/compiler/rustc_target/src/spec/targets/m68k_unknown_none_elf.rs @@ -1,4 +1,5 @@ -use crate::abi::Endian; +use rustc_abi::Endian; + use crate::spec::{CodeModel, PanicStrategy, RelocModel, Target, TargetOptions}; pub(crate) fn target() -> Target { diff --git a/compiler/rustc_target/src/spec/targets/mips64_openwrt_linux_musl.rs b/compiler/rustc_target/src/spec/targets/mips64_openwrt_linux_musl.rs index bddcc457498a4..4880e993722f4 100644 --- a/compiler/rustc_target/src/spec/targets/mips64_openwrt_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/mips64_openwrt_linux_musl.rs @@ -1,6 +1,7 @@ //! A target tuple for OpenWrt MIPS64 targets. -use crate::abi::Endian; +use rustc_abi::Endian; + use crate::spec::{Target, TargetOptions, base}; pub(crate) fn target() -> Target { diff --git a/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_gnuabi64.rs b/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_gnuabi64.rs index 75da4abc6b603..daf6d5de4c031 100644 --- a/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_gnuabi64.rs +++ b/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_gnuabi64.rs @@ -1,4 +1,5 @@ -use crate::abi::Endian; +use rustc_abi::Endian; + use crate::spec::{Target, TargetOptions, base}; pub(crate) fn target() -> Target { diff --git a/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_muslabi64.rs b/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_muslabi64.rs index 32f5c79d653d2..03c8fa9245046 100644 --- a/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_muslabi64.rs +++ b/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_muslabi64.rs @@ -1,4 +1,5 @@ -use crate::abi::Endian; +use rustc_abi::Endian; + use crate::spec::{Target, TargetOptions, base}; pub(crate) fn target() -> Target { diff --git a/compiler/rustc_target/src/spec/targets/mips_mti_none_elf.rs b/compiler/rustc_target/src/spec/targets/mips_mti_none_elf.rs index 4637e31fb1745..2815d995c315b 100644 --- a/compiler/rustc_target/src/spec/targets/mips_mti_none_elf.rs +++ b/compiler/rustc_target/src/spec/targets/mips_mti_none_elf.rs @@ -1,4 +1,5 @@ -use crate::abi::Endian; +use rustc_abi::Endian; + use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions}; pub(crate) fn target() -> Target { diff --git a/compiler/rustc_target/src/spec/targets/mips_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/mips_unknown_linux_gnu.rs index b9dc0d4a6ceb0..19cf62d19f6e5 100644 --- a/compiler/rustc_target/src/spec/targets/mips_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/mips_unknown_linux_gnu.rs @@ -1,4 +1,5 @@ -use crate::abi::Endian; +use rustc_abi::Endian; + use crate::spec::{Target, TargetOptions, base}; pub(crate) fn target() -> Target { diff --git a/compiler/rustc_target/src/spec/targets/mips_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/mips_unknown_linux_musl.rs index 5076ae345a97e..dbca90ba569c0 100644 --- a/compiler/rustc_target/src/spec/targets/mips_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/mips_unknown_linux_musl.rs @@ -1,4 +1,5 @@ -use crate::abi::Endian; +use rustc_abi::Endian; + use crate::spec::{Target, TargetOptions, base}; pub(crate) fn target() -> Target { diff --git a/compiler/rustc_target/src/spec/targets/mips_unknown_linux_uclibc.rs b/compiler/rustc_target/src/spec/targets/mips_unknown_linux_uclibc.rs index 36e61d55fa066..c26c7867ec7aa 100644 --- a/compiler/rustc_target/src/spec/targets/mips_unknown_linux_uclibc.rs +++ b/compiler/rustc_target/src/spec/targets/mips_unknown_linux_uclibc.rs @@ -1,4 +1,5 @@ -use crate::abi::Endian; +use rustc_abi::Endian; + use crate::spec::{Target, TargetOptions, base}; pub(crate) fn target() -> Target { diff --git a/compiler/rustc_target/src/spec/targets/mipsel_mti_none_elf.rs b/compiler/rustc_target/src/spec/targets/mipsel_mti_none_elf.rs index a89c0fce88c6a..f532643b56aee 100644 --- a/compiler/rustc_target/src/spec/targets/mipsel_mti_none_elf.rs +++ b/compiler/rustc_target/src/spec/targets/mipsel_mti_none_elf.rs @@ -1,4 +1,5 @@ -use crate::abi::Endian; +use rustc_abi::Endian; + use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions}; pub(crate) fn target() -> Target { diff --git a/compiler/rustc_target/src/spec/targets/mipsel_unknown_netbsd.rs b/compiler/rustc_target/src/spec/targets/mipsel_unknown_netbsd.rs index e1adeb98ec213..400e05f147837 100644 --- a/compiler/rustc_target/src/spec/targets/mipsel_unknown_netbsd.rs +++ b/compiler/rustc_target/src/spec/targets/mipsel_unknown_netbsd.rs @@ -1,4 +1,5 @@ -use crate::abi::Endian; +use rustc_abi::Endian; + use crate::spec::{Target, TargetOptions, base}; pub(crate) fn target() -> Target { diff --git a/compiler/rustc_target/src/spec/targets/mipsisa32r6_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/mipsisa32r6_unknown_linux_gnu.rs index 3ef0988d23570..c7b0a05d8899c 100644 --- a/compiler/rustc_target/src/spec/targets/mipsisa32r6_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/mipsisa32r6_unknown_linux_gnu.rs @@ -1,4 +1,5 @@ -use crate::abi::Endian; +use rustc_abi::Endian; + use crate::spec::{Target, TargetOptions, base}; pub(crate) fn target() -> Target { diff --git a/compiler/rustc_target/src/spec/targets/mipsisa64r6_unknown_linux_gnuabi64.rs b/compiler/rustc_target/src/spec/targets/mipsisa64r6_unknown_linux_gnuabi64.rs index d0d0ed1acc3f0..49bec90022c54 100644 --- a/compiler/rustc_target/src/spec/targets/mipsisa64r6_unknown_linux_gnuabi64.rs +++ b/compiler/rustc_target/src/spec/targets/mipsisa64r6_unknown_linux_gnuabi64.rs @@ -1,4 +1,5 @@ -use crate::abi::Endian; +use rustc_abi::Endian; + use crate::spec::{Target, TargetOptions, base}; pub(crate) fn target() -> Target { diff --git a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_freebsd.rs b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_freebsd.rs index 4ccb3ee466405..201ab0d534f50 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_freebsd.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_freebsd.rs @@ -1,4 +1,5 @@ -use crate::abi::Endian; +use rustc_abi::Endian; + use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base}; pub(crate) fn target() -> Target { diff --git a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_gnu.rs index 351ffa65eba8e..1a2f212594295 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_gnu.rs @@ -1,4 +1,5 @@ -use crate::abi::Endian; +use rustc_abi::Endian; + use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base}; pub(crate) fn target() -> Target { diff --git a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_musl.rs index a54b17c87a7db..417c8b63c86ba 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_musl.rs @@ -1,4 +1,5 @@ -use crate::abi::Endian; +use rustc_abi::Endian; + use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base}; pub(crate) fn target() -> Target { diff --git a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_openbsd.rs b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_openbsd.rs index 31fbb14152407..15947fdb0ac2d 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_openbsd.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_openbsd.rs @@ -1,4 +1,5 @@ -use crate::abi::Endian; +use rustc_abi::Endian; + use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base}; pub(crate) fn target() -> Target { diff --git a/compiler/rustc_target/src/spec/targets/powerpc64_wrs_vxworks.rs b/compiler/rustc_target/src/spec/targets/powerpc64_wrs_vxworks.rs index c37aa8d502ad7..d48c2f5e744b4 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc64_wrs_vxworks.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc64_wrs_vxworks.rs @@ -1,4 +1,5 @@ -use crate::abi::Endian; +use rustc_abi::Endian; + use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base}; pub(crate) fn target() -> Target { diff --git a/compiler/rustc_target/src/spec/targets/powerpc_unknown_freebsd.rs b/compiler/rustc_target/src/spec/targets/powerpc_unknown_freebsd.rs index 9cfc2153ac170..c6b391fc5924f 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc_unknown_freebsd.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc_unknown_freebsd.rs @@ -1,4 +1,5 @@ -use crate::abi::Endian; +use rustc_abi::Endian; + use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base}; pub(crate) fn target() -> Target { diff --git a/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_gnu.rs index 1c537491a6cad..6f3a2baf40564 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_gnu.rs @@ -1,4 +1,5 @@ -use crate::abi::Endian; +use rustc_abi::Endian; + use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base}; pub(crate) fn target() -> Target { diff --git a/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_gnuspe.rs b/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_gnuspe.rs index 4f5d9c661b08d..c4d894823e6af 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_gnuspe.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_gnuspe.rs @@ -1,4 +1,5 @@ -use crate::abi::Endian; +use rustc_abi::Endian; + use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base}; pub(crate) fn target() -> Target { diff --git a/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_musl.rs index 0cd0ea96ad377..5b5fea666bb9e 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_musl.rs @@ -1,4 +1,5 @@ -use crate::abi::Endian; +use rustc_abi::Endian; + use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base}; pub(crate) fn target() -> Target { diff --git a/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_muslspe.rs b/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_muslspe.rs index b86c3c2e8e042..dfd99635ddd0e 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_muslspe.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_muslspe.rs @@ -1,4 +1,5 @@ -use crate::abi::Endian; +use rustc_abi::Endian; + use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base}; pub(crate) fn target() -> Target { diff --git a/compiler/rustc_target/src/spec/targets/powerpc_unknown_netbsd.rs b/compiler/rustc_target/src/spec/targets/powerpc_unknown_netbsd.rs index 142443aa5b159..7492077bb88bd 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc_unknown_netbsd.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc_unknown_netbsd.rs @@ -1,4 +1,5 @@ -use crate::abi::Endian; +use rustc_abi::Endian; + use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base}; pub(crate) fn target() -> Target { diff --git a/compiler/rustc_target/src/spec/targets/powerpc_unknown_openbsd.rs b/compiler/rustc_target/src/spec/targets/powerpc_unknown_openbsd.rs index 7aedc2d0665cb..dd82a6a71cda1 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc_unknown_openbsd.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc_unknown_openbsd.rs @@ -1,4 +1,5 @@ -use crate::abi::Endian; +use rustc_abi::Endian; + use crate::spec::{StackProbeType, Target, base}; pub(crate) fn target() -> Target { diff --git a/compiler/rustc_target/src/spec/targets/powerpc_wrs_vxworks.rs b/compiler/rustc_target/src/spec/targets/powerpc_wrs_vxworks.rs index 22b38208b108a..c4f93c60d3ea6 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc_wrs_vxworks.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc_wrs_vxworks.rs @@ -1,4 +1,5 @@ -use crate::abi::Endian; +use rustc_abi::Endian; + use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base}; pub(crate) fn target() -> Target { diff --git a/compiler/rustc_target/src/spec/targets/powerpc_wrs_vxworks_spe.rs b/compiler/rustc_target/src/spec/targets/powerpc_wrs_vxworks_spe.rs index ee61a7da41c9c..0284c50bd6501 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc_wrs_vxworks_spe.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc_wrs_vxworks_spe.rs @@ -1,4 +1,5 @@ -use crate::abi::Endian; +use rustc_abi::Endian; + use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base}; pub(crate) fn target() -> Target { diff --git a/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_gnu.rs index a84a18a433ffc..41aa400f3e094 100644 --- a/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_gnu.rs @@ -1,4 +1,5 @@ -use crate::abi::Endian; +use rustc_abi::Endian; + use crate::spec::{SanitizerSet, StackProbeType, Target, base}; pub(crate) fn target() -> Target { diff --git a/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_musl.rs index fbe8c48eca72c..61c01eba70d40 100644 --- a/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_musl.rs @@ -1,4 +1,5 @@ -use crate::abi::Endian; +use rustc_abi::Endian; + use crate::spec::{SanitizerSet, StackProbeType, Target, base}; pub(crate) fn target() -> Target { diff --git a/compiler/rustc_target/src/spec/targets/sparc64_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/sparc64_unknown_linux_gnu.rs index ac2141f9b086c..3317fe51c334c 100644 --- a/compiler/rustc_target/src/spec/targets/sparc64_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/sparc64_unknown_linux_gnu.rs @@ -1,4 +1,5 @@ -use crate::abi::Endian; +use rustc_abi::Endian; + use crate::spec::{Target, base}; pub(crate) fn target() -> Target { diff --git a/compiler/rustc_target/src/spec/targets/sparc64_unknown_netbsd.rs b/compiler/rustc_target/src/spec/targets/sparc64_unknown_netbsd.rs index d16b3776cfb14..4c2b971c0f138 100644 --- a/compiler/rustc_target/src/spec/targets/sparc64_unknown_netbsd.rs +++ b/compiler/rustc_target/src/spec/targets/sparc64_unknown_netbsd.rs @@ -1,4 +1,5 @@ -use crate::abi::Endian; +use rustc_abi::Endian; + use crate::spec::{Cc, LinkerFlavor, Lld, Target, TargetOptions, base}; pub(crate) fn target() -> Target { diff --git a/compiler/rustc_target/src/spec/targets/sparc64_unknown_openbsd.rs b/compiler/rustc_target/src/spec/targets/sparc64_unknown_openbsd.rs index 91e64061020ff..81d7bf9a62842 100644 --- a/compiler/rustc_target/src/spec/targets/sparc64_unknown_openbsd.rs +++ b/compiler/rustc_target/src/spec/targets/sparc64_unknown_openbsd.rs @@ -1,4 +1,5 @@ -use crate::abi::Endian; +use rustc_abi::Endian; + use crate::spec::{Cc, LinkerFlavor, Lld, Target, base}; pub(crate) fn target() -> Target { diff --git a/compiler/rustc_target/src/spec/targets/sparc_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/sparc_unknown_linux_gnu.rs index 45941cd7c0164..97d56725e02d0 100644 --- a/compiler/rustc_target/src/spec/targets/sparc_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/sparc_unknown_linux_gnu.rs @@ -1,4 +1,5 @@ -use crate::abi::Endian; +use rustc_abi::Endian; + use crate::spec::{Cc, LinkerFlavor, Lld, Target, TargetOptions, base}; pub(crate) fn target() -> Target { diff --git a/compiler/rustc_target/src/spec/targets/sparc_unknown_none_elf.rs b/compiler/rustc_target/src/spec/targets/sparc_unknown_none_elf.rs index 987f69429c069..00cd7438f7ec4 100644 --- a/compiler/rustc_target/src/spec/targets/sparc_unknown_none_elf.rs +++ b/compiler/rustc_target/src/spec/targets/sparc_unknown_none_elf.rs @@ -1,4 +1,5 @@ -use crate::abi::Endian; +use rustc_abi::Endian; + use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions}; pub(crate) fn target() -> Target { diff --git a/compiler/rustc_target/src/spec/targets/sparcv9_sun_solaris.rs b/compiler/rustc_target/src/spec/targets/sparcv9_sun_solaris.rs index 770da60da9e00..5b7d560a8e09c 100644 --- a/compiler/rustc_target/src/spec/targets/sparcv9_sun_solaris.rs +++ b/compiler/rustc_target/src/spec/targets/sparcv9_sun_solaris.rs @@ -1,4 +1,5 @@ -use crate::abi::Endian; +use rustc_abi::Endian; + use crate::spec::{Cc, LinkerFlavor, Target, base}; pub(crate) fn target() -> Target { diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_uefi.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_uefi.rs index 8fd92e8123b99..bce6aa0ebc6bc 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_uefi.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_uefi.rs @@ -5,7 +5,7 @@ // 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. -use crate::abi::call::Conv; +use crate::callconv::Conv; use crate::spec::{RustcAbi, Target, base}; pub(crate) fn target() -> Target { diff --git a/compiler/rustc_target/src/spec/targets/xtensa_esp32_espidf.rs b/compiler/rustc_target/src/spec/targets/xtensa_esp32_espidf.rs index 442523aa39717..b2a7c8551e4ff 100644 --- a/compiler/rustc_target/src/spec/targets/xtensa_esp32_espidf.rs +++ b/compiler/rustc_target/src/spec/targets/xtensa_esp32_espidf.rs @@ -1,4 +1,5 @@ -use crate::abi::Endian; +use rustc_abi::Endian; + use crate::spec::base::xtensa; use crate::spec::{Target, TargetOptions, cvs}; diff --git a/compiler/rustc_target/src/spec/targets/xtensa_esp32s2_espidf.rs b/compiler/rustc_target/src/spec/targets/xtensa_esp32s2_espidf.rs index 353034df6f1b5..4fab2bac8e2d9 100644 --- a/compiler/rustc_target/src/spec/targets/xtensa_esp32s2_espidf.rs +++ b/compiler/rustc_target/src/spec/targets/xtensa_esp32s2_espidf.rs @@ -1,4 +1,5 @@ -use crate::abi::Endian; +use rustc_abi::Endian; + use crate::spec::base::xtensa; use crate::spec::{Target, TargetOptions, cvs}; diff --git a/compiler/rustc_target/src/spec/targets/xtensa_esp32s3_espidf.rs b/compiler/rustc_target/src/spec/targets/xtensa_esp32s3_espidf.rs index a242f451c342c..45d409a509f39 100644 --- a/compiler/rustc_target/src/spec/targets/xtensa_esp32s3_espidf.rs +++ b/compiler/rustc_target/src/spec/targets/xtensa_esp32s3_espidf.rs @@ -1,4 +1,5 @@ -use crate::abi::Endian; +use rustc_abi::Endian; + use crate::spec::base::xtensa; use crate::spec::{Target, TargetOptions, cvs}; diff --git a/compiler/rustc_transmute/src/lib.rs b/compiler/rustc_transmute/src/lib.rs index a50cc8f593251..f9537f708ef8d 100644 --- a/compiler/rustc_transmute/src/lib.rs +++ b/compiler/rustc_transmute/src/lib.rs @@ -84,7 +84,7 @@ mod rustc { use rustc_infer::infer::InferCtxt; use rustc_macros::TypeVisitable; use rustc_middle::traits::ObligationCause; - use rustc_middle::ty::{Const, ParamEnv, Ty, TyCtxt, ValTree}; + use rustc_middle::ty::{Const, ParamEnv, Ty, TyCtxt}; use super::*; @@ -139,25 +139,21 @@ mod rustc { let adt_def = cv.ty.ty_adt_def()?; - assert_eq!( - tcx.require_lang_item(LangItem::TransmuteOpts, None), - adt_def.did(), - "The given `Const` was not marked with the `{}` lang item.", - LangItem::TransmuteOpts.name(), - ); + if !tcx.is_lang_item(adt_def.did(), LangItem::TransmuteOpts) { + tcx.dcx().delayed_bug(format!( + "The given `const` was not marked with the `{}` lang item.", + LangItem::TransmuteOpts.name() + )); + return Some(Self { + alignment: true, + lifetimes: true, + safety: true, + validity: true, + }); + } let variant = adt_def.non_enum_variant(); - let fields = match cv.valtree { - ValTree::Branch(branch) => branch, - _ => { - return Some(Self { - alignment: true, - lifetimes: true, - safety: true, - validity: true, - }); - } - }; + let fields = cv.valtree.unwrap_branch(); let get_field = |name| { let (field_idx, _) = variant diff --git a/library/core/src/iter/traits/iterator.rs b/library/core/src/iter/traits/iterator.rs index 91c3a4b29b539..42886e90f997d 100644 --- a/library/core/src/iter/traits/iterator.rs +++ b/library/core/src/iter/traits/iterator.rs @@ -3493,7 +3493,8 @@ pub trait Iterator { /// /// Takes each element, adds them together, and returns the result. /// - /// An empty iterator returns the zero value of the type. + /// An empty iterator returns the *additive identity* ("zero") of the type, + /// which is `0` for integers and `-0.0` for floats. /// /// `sum()` can be used to sum any type implementing [`Sum`][`core::iter::Sum`], /// including [`Option`][`Option::sum`] and [`Result`][`Result::sum`]. @@ -3511,6 +3512,10 @@ pub trait Iterator { /// let sum: i32 = a.iter().sum(); /// /// assert_eq!(sum, 6); + /// + /// let b: Vec = vec![]; + /// let sum: f32 = b.iter().sum(); + /// assert_eq!(sum, -0.0_f32); /// ``` #[stable(feature = "iter_arith", since = "1.11.0")] fn sum(self) -> S diff --git a/library/core/src/ops/async_function.rs b/library/core/src/ops/async_function.rs index c90ae7babbd93..6be42ca7d32fe 100644 --- a/library/core/src/ops/async_function.rs +++ b/library/core/src/ops/async_function.rs @@ -6,7 +6,6 @@ use crate::marker::Tuple; /// All `async fn` and functions returning futures implement this trait. #[stable(feature = "async_closure", since = "1.85.0")] #[rustc_paren_sugar] -#[fundamental] #[must_use = "async closures are lazy and do nothing unless called"] #[lang = "async_fn"] pub trait AsyncFn: AsyncFnMut { @@ -20,7 +19,6 @@ pub trait AsyncFn: AsyncFnMut { /// All `async fn` and functions returning futures implement this trait. #[stable(feature = "async_closure", since = "1.85.0")] #[rustc_paren_sugar] -#[fundamental] #[must_use = "async closures are lazy and do nothing unless called"] #[lang = "async_fn_mut"] pub trait AsyncFnMut: AsyncFnOnce { @@ -41,7 +39,6 @@ pub trait AsyncFnMut: AsyncFnOnce { /// All `async fn` and functions returning futures implement this trait. #[stable(feature = "async_closure", since = "1.85.0")] #[rustc_paren_sugar] -#[fundamental] #[must_use = "async closures are lazy and do nothing unless called"] #[lang = "async_fn_once"] pub trait AsyncFnOnce { diff --git a/library/std/src/collections/hash/map.rs b/library/std/src/collections/hash/map.rs index 5013826cb9b3b..6a0ff3a29e08f 100644 --- a/library/std/src/collections/hash/map.rs +++ b/library/std/src/collections/hash/map.rs @@ -282,7 +282,7 @@ impl HashMap { /// manually using this function can expose a DoS attack vector. /// /// The `hash_builder` passed should implement the [`BuildHasher`] trait for - /// the HashMap to be useful, see its documentation for details. + /// the `HashMap` to be useful, see its documentation for details. /// /// # Examples /// @@ -314,7 +314,7 @@ impl HashMap { /// manually using this function can expose a DoS attack vector. /// /// The `hasher` passed should implement the [`BuildHasher`] trait for - /// the HashMap to be useful, see its documentation for details. + /// the `HashMap` to be useful, see its documentation for details. /// /// # Examples /// @@ -1283,7 +1283,7 @@ impl HashMap where S: BuildHasher, { - /// Creates a raw entry builder for the HashMap. + /// Creates a raw entry builder for the `HashMap`. /// /// Raw entries provide the lowest level of control for searching and /// manipulating a map. They must be manually initialized with a hash and @@ -1298,13 +1298,13 @@ where /// * Using custom comparison logic without newtype wrappers /// /// Because raw entries provide much more low-level control, it's much easier - /// to put the HashMap into an inconsistent state which, while memory-safe, + /// to put the `HashMap` into an inconsistent state which, while memory-safe, /// will cause the map to produce seemingly random results. Higher-level and /// more foolproof APIs like `entry` should be preferred when possible. /// /// In particular, the hash used to initialize the raw entry must still be /// consistent with the hash of the key that is ultimately stored in the entry. - /// This is because implementations of HashMap may need to recompute hashes + /// This is because implementations of `HashMap` may need to recompute hashes /// when resizing, at which point only the keys are available. /// /// Raw entries give mutable access to the keys. This must not be used @@ -1320,7 +1320,7 @@ where RawEntryBuilderMut { map: self } } - /// Creates a raw immutable entry builder for the HashMap. + /// Creates a raw immutable entry builder for the `HashMap`. /// /// Raw entries provide the lowest level of control for searching and /// manipulating a map. They must be manually initialized with a hash and diff --git a/library/std/src/collections/hash/set.rs b/library/std/src/collections/hash/set.rs index bbb6ca2352136..c265d42d06a9f 100644 --- a/library/std/src/collections/hash/set.rs +++ b/library/std/src/collections/hash/set.rs @@ -374,7 +374,7 @@ impl HashSet { /// manually using this function can expose a DoS attack vector. /// /// The `hash_builder` passed should implement the [`BuildHasher`] trait for - /// the HashMap to be useful, see its documentation for details. + /// the `HashSet` to be useful, see its documentation for details. /// /// # Examples /// @@ -406,7 +406,7 @@ impl HashSet { /// manually using this function can expose a DoS attack vector. /// /// The `hash_builder` passed should implement the [`BuildHasher`] trait for - /// the HashMap to be useful, see its documentation for details. + /// the `HashSet` to be useful, see its documentation for details. /// /// # Examples /// diff --git a/src/tools/clippy/clippy_lints/src/casts/cast_possible_truncation.rs b/src/tools/clippy/clippy_lints/src/casts/cast_possible_truncation.rs index 48e9f1d690eea..ca973f4bb1aae 100644 --- a/src/tools/clippy/clippy_lints/src/casts/cast_possible_truncation.rs +++ b/src/tools/clippy/clippy_lints/src/casts/cast_possible_truncation.rs @@ -4,13 +4,13 @@ use clippy_utils::expr_or_init; use clippy_utils::source::snippet; use clippy_utils::sugg::Sugg; use clippy_utils::ty::{get_discriminant_value, is_isize_or_usize}; +use rustc_abi::IntegerType; use rustc_errors::{Applicability, Diag}; use rustc_hir::def::{DefKind, Res}; use rustc_hir::{BinOpKind, Expr, ExprKind}; use rustc_lint::LateContext; use rustc_middle::ty::{self, FloatTy, Ty}; use rustc_span::Span; -use rustc_target::abi::IntegerType; use super::{CAST_ENUM_TRUNCATION, CAST_POSSIBLE_TRUNCATION, utils}; diff --git a/src/tools/clippy/clippy_lints/src/escape.rs b/src/tools/clippy/clippy_lints/src/escape.rs index a89f0d9c43274..c55d4387d6961 100644 --- a/src/tools/clippy/clippy_lints/src/escape.rs +++ b/src/tools/clippy/clippy_lints/src/escape.rs @@ -10,7 +10,7 @@ use rustc_session::impl_lint_pass; use rustc_span::Span; use rustc_span::def_id::LocalDefId; use rustc_span::symbol::kw; -use rustc_target::spec::abi::Abi; +use rustc_abi::ExternAbi; pub struct BoxedLocal { too_large_for_stack: u64, @@ -73,7 +73,7 @@ impl<'tcx> LateLintPass<'tcx> for BoxedLocal { fn_def_id: LocalDefId, ) { if let Some(header) = fn_kind.header() { - if header.abi != Abi::Rust { + if header.abi != ExternAbi::Rust { return; } } diff --git a/src/tools/clippy/clippy_lints/src/eta_reduction.rs b/src/tools/clippy/clippy_lints/src/eta_reduction.rs index f90bf9157aada..ae3acc1c4b193 100644 --- a/src/tools/clippy/clippy_lints/src/eta_reduction.rs +++ b/src/tools/clippy/clippy_lints/src/eta_reduction.rs @@ -15,7 +15,7 @@ use rustc_middle::ty::{ }; use rustc_session::declare_lint_pass; use rustc_span::symbol::sym; -use rustc_target::spec::abi::Abi; +use rustc_abi::ExternAbi; use rustc_trait_selection::error_reporting::InferCtxtErrorExt as _; 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 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 { return; } diff --git a/src/tools/clippy/clippy_lints/src/excessive_bools.rs b/src/tools/clippy/clippy_lints/src/excessive_bools.rs index 0011da03dda7a..15afe3e8c145c 100644 --- a/src/tools/clippy/clippy_lints/src/excessive_bools.rs +++ b/src/tools/clippy/clippy_lints/src/excessive_bools.rs @@ -7,7 +7,7 @@ use rustc_lint::{LateContext, LateLintPass}; use rustc_session::impl_lint_pass; use rustc_span::Span; use rustc_span::def_id::LocalDefId; -use rustc_target::spec::abi::Abi; +use rustc_abi::ExternAbi; declare_clippy_lint! { /// ### 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>) { // functions with a body are already checked by `check_fn` 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 { 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, ) { 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 && 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()) diff --git a/src/tools/clippy/clippy_lints/src/functions/too_many_arguments.rs b/src/tools/clippy/clippy_lints/src/functions/too_many_arguments.rs index e72a2ad49d826..f17f687719f26 100644 --- a/src/tools/clippy/clippy_lints/src/functions/too_many_arguments.rs +++ b/src/tools/clippy/clippy_lints/src/functions/too_many_arguments.rs @@ -1,7 +1,7 @@ use rustc_hir::{self as hir, intravisit}; use rustc_lint::LateContext; use rustc_span::Span; -use rustc_target::spec::abi::Abi; +use rustc_abi::ExternAbi; use clippy_utils::diagnostics::span_lint; use clippy_utils::is_trait_impl_item; @@ -23,11 +23,11 @@ pub(super) fn check_fn( intravisit::FnKind::Method( _, &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, decl, 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) { if let hir::TraitItemKind::Fn(ref sig, _) = item.kind { // 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( cx, sig.decl, diff --git a/src/tools/clippy/clippy_lints/src/inherent_to_string.rs b/src/tools/clippy/clippy_lints/src/inherent_to_string.rs index 415b47adac5a1..c58e8773e3a28 100644 --- a/src/tools/clippy/clippy_lints/src/inherent_to_string.rs +++ b/src/tools/clippy/clippy_lints/src/inherent_to_string.rs @@ -5,7 +5,7 @@ use rustc_hir::{GenericParamKind, ImplItem, ImplItemKind, LangItem}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::declare_lint_pass; use rustc_span::sym; -use rustc_target::spec::abi::Abi; +use rustc_abi::ExternAbi; declare_clippy_lint! { /// ### What it does @@ -96,7 +96,7 @@ impl<'tcx> LateLintPass<'tcx> for InherentToString { // #11201 && let header = signature.header && header.is_safe() - && header.abi == Abi::Rust + && header.abi == ExternAbi::Rust && impl_item.ident.name == sym::to_string && let decl = signature.decl && decl.implicit_self.has_implicit_self() diff --git a/src/tools/clippy/clippy_lints/src/large_futures.rs b/src/tools/clippy/clippy_lints/src/large_futures.rs index 593704f206a1f..fd7965d564d59 100644 --- a/src/tools/clippy/clippy_lints/src/large_futures.rs +++ b/src/tools/clippy/clippy_lints/src/large_futures.rs @@ -2,11 +2,11 @@ use clippy_config::Conf; use clippy_utils::diagnostics::span_lint_and_sugg; use clippy_utils::source::snippet; use clippy_utils::ty::implements_trait; +use rustc_abi::Size; use rustc_errors::Applicability; use rustc_hir::{Expr, ExprKind, LangItem, MatchSource, QPath}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::impl_lint_pass; -use rustc_target::abi::Size; declare_clippy_lint! { /// ### What it does diff --git a/src/tools/clippy/clippy_lints/src/methods/mod.rs b/src/tools/clippy/clippy_lints/src/methods/mod.rs index f501cf060c2a5..0a8eafad0e84f 100644 --- a/src/tools/clippy/clippy_lints/src/methods/mod.rs +++ b/src/tools/clippy/clippy_lints/src/methods/mod.rs @@ -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::{contains_return, is_bool, is_trait_method, iter_input_pats, peel_blocks, return_ty}; pub use path_ends_with_ext::DEFAULT_ALLOWED_DOTFILES; +use rustc_abi::ExternAbi; use rustc_data_structures::fx::FxHashSet; use rustc_hir as hir; 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), constness: hir::Constness::NotConst, asyncness: hir::IsAsync::NotAsync, - abi: rustc_target::spec::abi::Abi::Rust, + abi: ExternAbi::Rust, }; struct ShouldImplTraitCase { diff --git a/src/tools/clippy/clippy_lints/src/missing_const_for_fn.rs b/src/tools/clippy/clippy_lints/src/missing_const_for_fn.rs index 962d85c6a9d31..ba4af134ccd0b 100644 --- a/src/tools/clippy/clippy_lints/src/missing_const_for_fn.rs +++ b/src/tools/clippy/clippy_lints/src/missing_const_for_fn.rs @@ -1,3 +1,4 @@ + use clippy_config::Conf; use clippy_utils::diagnostics::span_lint_and_then; use clippy_utils::msrvs::{self, Msrv}; @@ -12,7 +13,7 @@ use rustc_middle::ty; use rustc_session::impl_lint_pass; use rustc_span::Span; use rustc_span::def_id::LocalDefId; -use rustc_target::spec::abi::Abi; +use rustc_abi::ExternAbi; declare_clippy_lint! { /// ### What it does @@ -183,11 +184,11 @@ fn already_const(header: hir::FnHeader) -> bool { 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 { - Abi::Rust => true, + ExternAbi::Rust => true, // `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. _ => msrv.meets(msrvs::CONST_EXTERN_FN), } diff --git a/src/tools/clippy/clippy_lints/src/needless_pass_by_ref_mut.rs b/src/tools/clippy/clippy_lints/src/needless_pass_by_ref_mut.rs index b7dc269061cf8..996251fdf1628 100644 --- a/src/tools/clippy/clippy_lints/src/needless_pass_by_ref_mut.rs +++ b/src/tools/clippy/clippy_lints/src/needless_pass_by_ref_mut.rs @@ -20,7 +20,7 @@ use rustc_session::impl_lint_pass; use rustc_span::Span; use rustc_span::def_id::LocalDefId; use rustc_span::symbol::kw; -use rustc_target::spec::abi::Abi; +use rustc_abi::ExternAbi; declare_clippy_lint! { /// ### What it does @@ -149,7 +149,7 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessPassByRefMut<'tcx> { return; } let attrs = cx.tcx.hir().attrs(hir_id); - if header.abi != Abi::Rust || requires_exact_signature(attrs) { + if header.abi != ExternAbi::Rust || requires_exact_signature(attrs) { return; } header.is_async() diff --git a/src/tools/clippy/clippy_lints/src/needless_pass_by_value.rs b/src/tools/clippy/clippy_lints/src/needless_pass_by_value.rs index 2855703b9d56e..40c65d1ef9e86 100644 --- a/src/tools/clippy/clippy_lints/src/needless_pass_by_value.rs +++ b/src/tools/clippy/clippy_lints/src/needless_pass_by_value.rs @@ -19,7 +19,7 @@ use rustc_session::declare_lint_pass; use rustc_span::def_id::LocalDefId; use rustc_span::symbol::kw; use rustc_span::{Span, sym}; -use rustc_target::spec::abi::Abi; +use rustc_abi::ExternAbi; use rustc_trait_selection::traits; use rustc_trait_selection::traits::misc::type_allowed_to_implement_copy; @@ -89,7 +89,7 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessPassByValue { match kind { FnKind::ItemFn(.., header) => { let attrs = cx.tcx.hir().attrs(hir_id); - if header.abi != Abi::Rust || requires_exact_signature(attrs) { + if header.abi != ExternAbi::Rust || requires_exact_signature(attrs) { return; } }, diff --git a/src/tools/clippy/clippy_lints/src/no_mangle_with_rust_abi.rs b/src/tools/clippy/clippy_lints/src/no_mangle_with_rust_abi.rs index 2e2916c957daa..b73b9083a9919 100644 --- a/src/tools/clippy/clippy_lints/src/no_mangle_with_rust_abi.rs +++ b/src/tools/clippy/clippy_lints/src/no_mangle_with_rust_abi.rs @@ -5,7 +5,7 @@ use rustc_hir::{Item, ItemKind}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::declare_lint_pass; use rustc_span::{BytePos, Pos}; -use rustc_target::spec::abi::Abi; +use rustc_abi::ExternAbi; declare_clippy_lint! { /// ### What it does @@ -46,7 +46,7 @@ impl<'tcx> LateLintPass<'tcx> for NoMangleWithRustAbi { for attr in attrs { if let Some(ident) = attr.ident() && ident.name == rustc_span::sym::no_mangle - && fn_sig.header.abi == Abi::Rust + && fn_sig.header.abi == ExternAbi::Rust && let Some((fn_attrs, _)) = fn_snippet.rsplit_once("fn") && !fn_attrs.contains("extern") { diff --git a/src/tools/clippy/clippy_lints/src/non_copy_const.rs b/src/tools/clippy/clippy_lints/src/non_copy_const.rs index 147654675ec91..405bbfc9c6fa7 100644 --- a/src/tools/clippy/clippy_lints/src/non_copy_const.rs +++ b/src/tools/clippy/clippy_lints/src/non_copy_const.rs @@ -5,6 +5,7 @@ use clippy_utils::diagnostics::span_lint_and_then; use clippy_utils::is_in_const_context; use clippy_utils::macros::macro_backtrace; use clippy_utils::ty::{InteriorMut, implements_trait}; +use rustc_abi::VariantIdx; use rustc_hir::def::{DefKind, Res}; use rustc_hir::def_id::DefId; use rustc_hir::{ @@ -16,7 +17,6 @@ use rustc_middle::ty::adjustment::Adjust; use rustc_middle::ty::{self, Ty, TyCtxt}; use rustc_session::impl_lint_pass; use rustc_span::{DUMMY_SP, Span, sym}; -use rustc_target::abi::VariantIdx; // FIXME: this is a correctness problem but there's no suitable // warn-by-default category. diff --git a/src/tools/clippy/clippy_lints/src/pass_by_ref_or_value.rs b/src/tools/clippy/clippy_lints/src/pass_by_ref_or_value.rs index b2089487a9f4d..a3e89671eecdc 100644 --- a/src/tools/clippy/clippy_lints/src/pass_by_ref_or_value.rs +++ b/src/tools/clippy/clippy_lints/src/pass_by_ref_or_value.rs @@ -19,7 +19,7 @@ use rustc_middle::ty::{self, RegionKind, TyCtxt}; use rustc_session::impl_lint_pass; use rustc_span::def_id::LocalDefId; use rustc_span::{Span, sym}; -use rustc_target::spec::abi::Abi; +use rustc_abi::ExternAbi; declare_clippy_lint! { /// ### What it does @@ -277,7 +277,7 @@ impl<'tcx> LateLintPass<'tcx> for PassByRefOrValue { let hir_id = cx.tcx.local_def_id_to_hir_id(def_id); match kind { FnKind::ItemFn(.., header) => { - if header.abi != Abi::Rust { + if header.abi != ExternAbi::Rust { return; } let attrs = cx.tcx.hir().attrs(hir_id); diff --git a/src/tools/clippy/clippy_lints/src/ptr.rs b/src/tools/clippy/clippy_lints/src/ptr.rs index 0b67594a9b199..7fba4b6a6c8b0 100644 --- a/src/tools/clippy/clippy_lints/src/ptr.rs +++ b/src/tools/clippy/clippy_lints/src/ptr.rs @@ -19,7 +19,7 @@ use rustc_middle::ty::{self, Binder, ClauseKind, ExistentialPredicate, List, Pre use rustc_session::declare_lint_pass; use rustc_span::symbol::Symbol; use rustc_span::{Span, sym}; -use rustc_target::spec::abi::Abi; +use rustc_abi::ExternAbi; use rustc_trait_selection::infer::InferCtxtExt as _; use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt as _; use std::{fmt, iter}; @@ -160,7 +160,7 @@ impl<'tcx> LateLintPass<'tcx> for Ptr { check_mut_from_ref(cx, sig, None); - if !matches!(sig.header.abi, Abi::Rust) { + if !matches!(sig.header.abi, ExternAbi::Rust) { // Ignore `extern` functions with non-Rust calling conventions return; } @@ -220,7 +220,7 @@ impl<'tcx> LateLintPass<'tcx> for Ptr { check_mut_from_ref(cx, sig, Some(body)); - if !matches!(sig.header.abi, Abi::Rust) { + if !matches!(sig.header.abi, ExternAbi::Rust) { // Ignore `extern` functions with non-Rust calling conventions return; } diff --git a/src/tools/clippy/clippy_lints/src/types/type_complexity.rs b/src/tools/clippy/clippy_lints/src/types/type_complexity.rs index 7f51660293b5c..0704653385f18 100644 --- a/src/tools/clippy/clippy_lints/src/types/type_complexity.rs +++ b/src/tools/clippy/clippy_lints/src/types/type_complexity.rs @@ -1,9 +1,9 @@ use clippy_utils::diagnostics::span_lint; +use rustc_abi::ExternAbi; use rustc_hir::intravisit::{InferKind, Visitor, VisitorExt, walk_ty}; use rustc_hir::{self as hir, AmbigArg, GenericParamKind, TyKind}; use rustc_lint::LateContext; use rustc_span::Span; -use rustc_target::spec::abi::Abi; use super::TYPE_COMPLEXITY; @@ -50,7 +50,7 @@ impl<'tcx> Visitor<'tcx> for TypeComplexityVisitor { TyKind::Path(..) | TyKind::Slice(..) | TyKind::Tup(..) | TyKind::Array(..) => (10 * self.nest, 1), // function types bring a lot of overhead - TyKind::BareFn(bare) if bare.abi == Abi::Rust => (50 * self.nest, 1), + TyKind::BareFn(bare) if bare.abi == ExternAbi::Rust => (50 * self.nest, 1), TyKind::TraitObject(param_bounds, _) => { let has_lifetime_parameters = param_bounds.iter().any(|bound| { diff --git a/src/tools/clippy/clippy_utils/src/check_proc_macro.rs b/src/tools/clippy/clippy_utils/src/check_proc_macro.rs index 179d42a8b5dc0..59aaaa3d9fb73 100644 --- a/src/tools/clippy/clippy_utils/src/check_proc_macro.rs +++ b/src/tools/clippy/clippy_utils/src/check_proc_macro.rs @@ -12,6 +12,7 @@ //! code was written, and check if the span contains that text. Note this will only work correctly //! if the span is not from a `macro_rules` based macro. +use rustc_abi::ExternAbi; use rustc_ast::AttrStyle; use rustc_ast::ast::{AttrKind, Attribute, IntTy, LitIntType, LitKind, StrStyle, TraitObjectSyntax, UintTy}; use rustc_ast::token::CommentKind; @@ -26,7 +27,6 @@ use rustc_middle::ty::TyCtxt; use rustc_session::Session; use rustc_span::symbol::{Ident, kw}; use rustc_span::{Span, Symbol}; -use rustc_target::spec::abi::Abi; /// The search pattern to look for. Used by `span_matches_pat` #[derive(Clone)] @@ -233,7 +233,7 @@ fn fn_header_search_pat(header: FnHeader) -> Pat { Pat::Str("const") } else if header.is_unsafe() { Pat::Str("unsafe") - } else if header.abi != Abi::Rust { + } else if header.abi != ExternAbi::Rust { Pat::Str("extern") } else { Pat::MultiStr(&["fn", "extern"]) @@ -375,7 +375,7 @@ fn ty_search_pat(ty: &Ty<'_>) -> (Pat, Pat) { TyKind::BareFn(bare_fn) => ( if bare_fn.safety.is_unsafe() { Pat::Str("unsafe") - } else if bare_fn.abi != Abi::Rust { + } else if bare_fn.abi != ExternAbi::Rust { Pat::Str("extern") } else { Pat::MultiStr(&["fn", "extern"]) diff --git a/src/tools/clippy/clippy_utils/src/consts.rs b/src/tools/clippy/clippy_utils/src/consts.rs index fab1db05d2e58..db82c458f703c 100644 --- a/src/tools/clippy/clippy_utils/src/consts.rs +++ b/src/tools/clippy/clippy_utils/src/consts.rs @@ -9,6 +9,7 @@ use std::sync::Arc; use crate::source::{SpanRangeExt, walk_span_to_context}; use crate::{clip, is_direct_expn_of, sext, unsext}; +use rustc_abi::Size; use rustc_apfloat::Float; use rustc_apfloat::ieee::{Half, Quad}; use rustc_ast::ast::{self, LitFloatType, LitKind}; @@ -25,7 +26,6 @@ use rustc_middle::{bug, mir, span_bug}; use rustc_span::def_id::DefId; use rustc_span::symbol::Ident; use rustc_span::{SyntaxContext, sym}; -use rustc_target::abi::Size; use std::cell::Cell; use std::cmp::Ordering; use std::hash::{Hash, Hasher}; diff --git a/src/tools/clippy/clippy_utils/src/lib.rs b/src/tools/clippy/clippy_utils/src/lib.rs index 337684b68f86e..79cc506658009 100644 --- a/src/tools/clippy/clippy_utils/src/lib.rs +++ b/src/tools/clippy/clippy_utils/src/lib.rs @@ -29,6 +29,7 @@ // FIXME: switch to something more ergonomic here, once available. // (Currently there is no way to opt into sysroot crates without `extern crate`.) +extern crate rustc_abi; extern crate rustc_ast; extern crate rustc_ast_pretty; extern crate rustc_attr_parsing; @@ -48,7 +49,6 @@ extern crate rustc_middle; extern crate rustc_mir_dataflow; extern crate rustc_session; extern crate rustc_span; -extern crate rustc_target; extern crate rustc_trait_selection; extern crate smallvec; @@ -123,7 +123,7 @@ use rustc_span::hygiene::{ExpnKind, MacroKind}; use rustc_span::source_map::SourceMap; use rustc_span::symbol::{Ident, Symbol, kw}; use rustc_span::{InnerSpan, Span, sym}; -use rustc_target::abi::Integer; +use rustc_abi::Integer; use visitors::{Visitable, for_each_unconsumed_temporary}; use crate::consts::{ConstEvalCtxt, Constant, mir_to_const}; diff --git a/src/tools/clippy/clippy_utils/src/ty/mod.rs b/src/tools/clippy/clippy_utils/src/ty/mod.rs index e9a05c45747de..a5374f6904e3a 100644 --- a/src/tools/clippy/clippy_utils/src/ty/mod.rs +++ b/src/tools/clippy/clippy_utils/src/ty/mod.rs @@ -4,6 +4,7 @@ use core::ops::ControlFlow; use itertools::Itertools; +use rustc_abi::VariantIdx; use rustc_ast::ast::Mutability; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_hir as hir; @@ -23,7 +24,6 @@ use rustc_middle::ty::{ }; use rustc_span::symbol::Ident; use rustc_span::{DUMMY_SP, Span, Symbol, sym}; -use rustc_target::abi::VariantIdx; use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt as _; use rustc_trait_selection::traits::query::normalize::QueryNormalizeExt; use rustc_trait_selection::traits::{Obligation, ObligationCause}; diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/borrowck-errors.classic2024.stderr b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/borrowck-errors.classic2024.stderr index 331b86736a0ba..1c44617830828 100644 --- a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/borrowck-errors.classic2024.stderr +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/borrowck-errors.classic2024.stderr @@ -48,19 +48,19 @@ LL | let &ref mut x = &0; | ^^^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable - --> $DIR/borrowck-errors.rs:35:23 + --> $DIR/borrowck-errors.rs:37:23 | LL | if let &Some(Some(x)) = &Some(&mut Some(0)) { | ^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable - --> $DIR/borrowck-errors.rs:40:11 + --> $DIR/borrowck-errors.rs:42:11 | LL | let &[x] = &&mut [0]; | ^ cannot borrow as mutable error[E0508]: cannot move out of type `[&mut i32; 1]`, a non-copy array - --> $DIR/borrowck-errors.rs:44:20 + --> $DIR/borrowck-errors.rs:46:20 | LL | let [&mut x] = &mut [&mut 0]; | - ^^^^^^^^^^^^^ cannot move out of here diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/borrowck-errors.rs b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/borrowck-errors.rs index 3f5d9c8db5d87..59cafc50d8661 100644 --- a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/borrowck-errors.rs +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/borrowck-errors.rs @@ -32,6 +32,8 @@ pub fn main() { let &ref mut x = &0; //~^ cannot borrow data in a `&` reference as mutable [E0596] + // For 2021 edition, this is also a regression test for #136223 + // since the maximum mutability is downgraded during the pattern check process. if let &Some(Some(x)) = &Some(&mut Some(0)) { //[stable2021,classic2024]~^ ERROR: cannot borrow data in a `&` reference as mutable let _: &u32 = x; diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/borrowck-errors.stable2021.stderr b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/borrowck-errors.stable2021.stderr index 65c98e2da9c38..deefe21ca7d45 100644 --- a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/borrowck-errors.stable2021.stderr +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/borrowck-errors.stable2021.stderr @@ -52,13 +52,13 @@ LL | let &ref mut x = &0; | ^^^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable - --> $DIR/borrowck-errors.rs:35:23 + --> $DIR/borrowck-errors.rs:37:23 | LL | if let &Some(Some(x)) = &Some(&mut Some(0)) { | ^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable - --> $DIR/borrowck-errors.rs:40:11 + --> $DIR/borrowck-errors.rs:42:11 | LL | let &[x] = &&mut [0]; | ^ cannot borrow as mutable diff --git a/tests/ui/transmutability/malformed-program-gracefulness/wrong-adt-assume.rs b/tests/ui/transmutability/malformed-program-gracefulness/wrong-adt-assume.rs new file mode 100644 index 0000000000000..2340df2502546 --- /dev/null +++ b/tests/ui/transmutability/malformed-program-gracefulness/wrong-adt-assume.rs @@ -0,0 +1,20 @@ +//! Test that we don't ICE when passing the wrong ADT to ASSUME. + +#![feature(adt_const_params)] +#![feature(transmutability)] + +use std::marker::ConstParamTy; +use std::mem::TransmuteFrom; + +#[derive(ConstParamTy, PartialEq, Eq)] +struct NotAssume; + +fn foo() +where + u8: TransmuteFrom, //~ ERROR the constant `ASSUME` is not of type `Assume` +{ +} + +fn main() { + foo::<{ NotAssume }>(); +} diff --git a/tests/ui/transmutability/malformed-program-gracefulness/wrong-adt-assume.stderr b/tests/ui/transmutability/malformed-program-gracefulness/wrong-adt-assume.stderr new file mode 100644 index 0000000000000..cae700ecfdc77 --- /dev/null +++ b/tests/ui/transmutability/malformed-program-gracefulness/wrong-adt-assume.stderr @@ -0,0 +1,11 @@ +error: the constant `ASSUME` is not of type `Assume` + --> $DIR/wrong-adt-assume.rs:14:9 + | +LL | u8: TransmuteFrom, + | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Assume`, found `NotAssume` + | +note: required by a const generic parameter in `TransmuteFrom` + --> $SRC_DIR/core/src/mem/transmutability.rs:LL:COL + +error: aborting due to 1 previous error + diff --git a/triagebot.toml b/triagebot.toml index 3caf4e9fb1e15..3accc31bac4e1 100644 --- a/triagebot.toml +++ b/triagebot.toml @@ -1058,7 +1058,6 @@ branch = "stable" [assign.adhoc_groups] compiler = [ "@BoxyUwU", - "@chenyukang", "@cjgillot", "@compiler-errors", "@davidtwco",