mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
Rollup merge of #132574 - workingjubilee:abi-in-compiler, r=compiler-errors
compiler: Directly use rustc_abi almost everywhere Use rustc_abi instead of rustc_target where applicable. This is mostly described by the following substitutions: ```rust match path_substring { rustc_target::spec::abi::Abi => rustc_abi::ExternAbi, rustc_target::abi::call => rustc_target::callconv, rustc_target::abi => rustc_abi, } ``` A number of spot-fixes make that not quite the whole story. The main exception is in 33edc68 where I get a lot more persnickety about how things are imported, especially in `rustc_middle::ty::layout`, not just from where. This includes putting an end to a reexport of `rustc_middle::ty::ReprOptions`, for the same reason that the rest of this change is happening: reexports mostly confound things. This notably omits rustc_passes and the ast crates, as I'm still examining a question I have about how they do stability checking of `extern "Abi"` strings and if I can simplify their logic. The rustc_abi and rustc_target crates also go untouched because they will be entangled in that cleanup. r? compiler-errors
This commit is contained in:
commit
72df7780dd
@ -4093,7 +4093,6 @@ dependencies = [
|
||||
"rustc_macros",
|
||||
"rustc_middle",
|
||||
"rustc_span",
|
||||
"rustc_target",
|
||||
"smallvec",
|
||||
"tracing",
|
||||
]
|
||||
@ -4237,7 +4236,6 @@ dependencies = [
|
||||
"rustc_middle",
|
||||
"rustc_session",
|
||||
"rustc_span",
|
||||
"rustc_target",
|
||||
"smallvec",
|
||||
"tracing",
|
||||
"tracing-subscriber",
|
||||
@ -4437,7 +4435,6 @@ dependencies = [
|
||||
"rustc_middle",
|
||||
"rustc_session",
|
||||
"rustc_span",
|
||||
"rustc_target",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
|
@ -2,6 +2,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_codegen_ssa::MemFlags;
|
||||
@ -13,9 +14,8 @@ use rustc_middle::ty::layout::LayoutOf;
|
||||
pub(crate) use rustc_middle::ty::layout::{WIDE_PTR_ADDR, WIDE_PTR_EXTRA};
|
||||
use rustc_middle::{bug, ty};
|
||||
use rustc_session::config;
|
||||
pub(crate) use rustc_target::abi::call::*;
|
||||
pub(crate) use rustc_target::callconv::*;
|
||||
use rustc_target::spec::SanitizerSet;
|
||||
pub(crate) use rustc_target::spec::abi::Abi;
|
||||
use smallvec::SmallVec;
|
||||
|
||||
use crate::attributes::llfn_attrs_from_instance;
|
||||
@ -436,7 +436,7 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
|
||||
i - 1
|
||||
};
|
||||
|
||||
let apply_range_attr = |idx: AttributePlace, scalar: rustc_target::abi::Scalar| {
|
||||
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(..))
|
||||
|
@ -1,6 +1,7 @@
|
||||
use std::assert_matches::assert_matches;
|
||||
|
||||
use libc::{c_char, c_uint};
|
||||
use rustc_abi::{BackendRepr, Float, Integer, Primitive, Scalar};
|
||||
use rustc_ast::{InlineAsmOptions, InlineAsmTemplatePiece};
|
||||
use rustc_codegen_ssa::mir::operand::OperandValue;
|
||||
use rustc_codegen_ssa::traits::*;
|
||||
@ -9,7 +10,6 @@ use rustc_middle::ty::Instance;
|
||||
use rustc_middle::ty::layout::TyAndLayout;
|
||||
use rustc_middle::{bug, span_bug};
|
||||
use rustc_span::{Pos, Span, Symbol, sym};
|
||||
use rustc_target::abi::*;
|
||||
use rustc_target::asm::*;
|
||||
use smallvec::SmallVec;
|
||||
use tracing::debug;
|
||||
|
@ -21,7 +21,7 @@ use rustc_middle::ty::{self, Instance, Ty, TyCtxt};
|
||||
use rustc_sanitizers::{cfi, kcfi};
|
||||
use rustc_session::config::OptLevel;
|
||||
use rustc_span::Span;
|
||||
use rustc_target::abi::call::FnAbi;
|
||||
use rustc_target::callconv::FnAbi;
|
||||
use rustc_target::spec::{HasTargetSpec, SanitizerSet, Target};
|
||||
use smallvec::SmallVec;
|
||||
use tracing::{debug, instrument};
|
||||
|
@ -1,5 +1,8 @@
|
||||
use std::ops::Range;
|
||||
|
||||
use rustc_abi::{
|
||||
Align, AlignFromBytesError, HasDataLayout, Primitive, Scalar, Size, WrappingRange,
|
||||
};
|
||||
use rustc_codegen_ssa::common;
|
||||
use rustc_codegen_ssa::traits::*;
|
||||
use rustc_hir::def::DefKind;
|
||||
@ -14,9 +17,6 @@ use rustc_middle::ty::layout::LayoutOf;
|
||||
use rustc_middle::ty::{self, Instance};
|
||||
use rustc_middle::{bug, span_bug};
|
||||
use rustc_session::config::Lto;
|
||||
use rustc_target::abi::{
|
||||
Align, AlignFromBytesError, HasDataLayout, Primitive, Scalar, Size, WrappingRange,
|
||||
};
|
||||
use tracing::{debug, instrument, trace};
|
||||
|
||||
use crate::common::{AsCCharPtr, CodegenCx};
|
||||
|
@ -3,6 +3,7 @@ use std::cell::{Cell, RefCell};
|
||||
use std::ffi::{CStr, c_uint};
|
||||
use std::str;
|
||||
|
||||
use rustc_abi::{HasDataLayout, TargetDataLayout, VariantIdx};
|
||||
use rustc_codegen_ssa::back::versioned_llvm_target;
|
||||
use rustc_codegen_ssa::base::{wants_msvc_seh, wants_wasm_eh};
|
||||
use rustc_codegen_ssa::errors as ssa_errors;
|
||||
@ -24,7 +25,6 @@ use rustc_session::config::{
|
||||
};
|
||||
use rustc_span::source_map::Spanned;
|
||||
use rustc_span::{DUMMY_SP, Span};
|
||||
use rustc_target::abi::{HasDataLayout, TargetDataLayout, VariantIdx};
|
||||
use rustc_target::spec::{HasTargetSpec, RelocModel, SmallDataThresholdSupport, Target, TlsModel};
|
||||
use smallvec::SmallVec;
|
||||
|
||||
|
@ -2,6 +2,7 @@ use std::cell::{OnceCell, RefCell};
|
||||
use std::ffi::{CStr, CString};
|
||||
|
||||
use libc::c_uint;
|
||||
use rustc_abi::Size;
|
||||
use rustc_codegen_ssa::traits::{
|
||||
BuilderMethods, ConstCodegenMethods, CoverageInfoBuilderMethods, MiscCodegenMethods,
|
||||
};
|
||||
@ -10,7 +11,6 @@ use rustc_llvm::RustString;
|
||||
use rustc_middle::mir::coverage::CoverageKind;
|
||||
use rustc_middle::ty::Instance;
|
||||
use rustc_middle::ty::layout::HasTyCtxt;
|
||||
use rustc_target::abi::Size;
|
||||
use tracing::{debug, instrument};
|
||||
|
||||
use crate::builder::Builder;
|
||||
|
@ -5,6 +5,7 @@ use std::path::{Path, PathBuf};
|
||||
use std::{iter, ptr};
|
||||
|
||||
use libc::{c_char, c_longlong, c_uint};
|
||||
use rustc_abi::{Align, Size};
|
||||
use rustc_codegen_ssa::debuginfo::type_names::{VTableNameKind, cpp_like_debuginfo};
|
||||
use rustc_codegen_ssa::traits::*;
|
||||
use rustc_hir::def::{CtorKind, DefKind};
|
||||
@ -19,7 +20,6 @@ use rustc_session::config::{self, DebugInfo, Lto};
|
||||
use rustc_span::symbol::Symbol;
|
||||
use rustc_span::{DUMMY_SP, FileName, FileNameDisplayPreference, SourceFile, hygiene};
|
||||
use rustc_symbol_mangling::typeid_for_trait_ref;
|
||||
use rustc_target::abi::{Align, Size};
|
||||
use rustc_target::spec::DebuginfoKind;
|
||||
use smallvec::smallvec;
|
||||
use tracing::{debug, instrument};
|
||||
|
@ -1,6 +1,7 @@
|
||||
use std::borrow::Cow;
|
||||
|
||||
use libc::c_uint;
|
||||
use rustc_abi::{Align, Endian, Size, TagEncoding, VariantIdx, Variants};
|
||||
use rustc_codegen_ssa::debuginfo::type_names::compute_debuginfo_type_name;
|
||||
use rustc_codegen_ssa::debuginfo::{tag_base_type, wants_c_like_enum_debuginfo};
|
||||
use rustc_codegen_ssa::traits::ConstCodegenMethods;
|
||||
@ -8,7 +9,6 @@ use rustc_index::IndexVec;
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::ty::layout::{LayoutOf, TyAndLayout};
|
||||
use rustc_middle::ty::{self, AdtDef, CoroutineArgs, CoroutineArgsExt, Ty};
|
||||
use rustc_target::abi::{Align, Endian, Size, TagEncoding, VariantIdx, Variants};
|
||||
use smallvec::smallvec;
|
||||
|
||||
use crate::common::{AsCCharPtr, CodegenCx};
|
||||
|
@ -1,5 +1,6 @@
|
||||
use std::borrow::Cow;
|
||||
|
||||
use rustc_abi::{FieldIdx, TagEncoding, VariantIdx, Variants};
|
||||
use rustc_codegen_ssa::debuginfo::type_names::{compute_debuginfo_type_name, cpp_like_debuginfo};
|
||||
use rustc_codegen_ssa::debuginfo::{tag_base_type, wants_c_like_enum_debuginfo};
|
||||
use rustc_hir::def::CtorKind;
|
||||
@ -9,7 +10,6 @@ use rustc_middle::mir::CoroutineLayout;
|
||||
use rustc_middle::ty::layout::{LayoutOf, TyAndLayout};
|
||||
use rustc_middle::ty::{self, AdtDef, CoroutineArgs, CoroutineArgsExt, Ty, VariantDef};
|
||||
use rustc_span::Symbol;
|
||||
use rustc_target::abi::{FieldIdx, TagEncoding, VariantIdx, Variants};
|
||||
|
||||
use super::type_map::{DINodeCreationResult, UniqueTypeId};
|
||||
use super::{SmallVec, size_and_align_of};
|
||||
|
@ -1,13 +1,13 @@
|
||||
use std::borrow::Cow;
|
||||
|
||||
use libc::c_uint;
|
||||
use rustc_abi::{Size, TagEncoding, VariantIdx, Variants};
|
||||
use rustc_codegen_ssa::debuginfo::type_names::compute_debuginfo_type_name;
|
||||
use rustc_codegen_ssa::debuginfo::{tag_base_type, wants_c_like_enum_debuginfo};
|
||||
use rustc_codegen_ssa::traits::ConstCodegenMethods;
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::ty::layout::{LayoutOf, TyAndLayout};
|
||||
use rustc_middle::ty::{self};
|
||||
use rustc_target::abi::{Size, TagEncoding, VariantIdx, Variants};
|
||||
use smallvec::smallvec;
|
||||
|
||||
use crate::common::{AsCCharPtr, CodegenCx};
|
||||
|
@ -1,12 +1,12 @@
|
||||
use std::cell::RefCell;
|
||||
|
||||
use rustc_abi::{Align, Size, VariantIdx};
|
||||
use rustc_data_structures::fingerprint::Fingerprint;
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
||||
use rustc_macros::HashStable;
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::ty::{ParamEnv, PolyExistentialTraitRef, Ty, TyCtxt};
|
||||
use rustc_target::abi::{Align, Size, VariantIdx};
|
||||
|
||||
use super::{SmallVec, UNKNOWN_LINE_NUMBER, unknown_file_metadata};
|
||||
use crate::common::{AsCCharPtr, CodegenCx};
|
||||
|
@ -5,6 +5,7 @@ use std::ops::Range;
|
||||
use std::{iter, ptr};
|
||||
|
||||
use libc::c_uint;
|
||||
use rustc_abi::Size;
|
||||
use rustc_codegen_ssa::debuginfo::type_names;
|
||||
use rustc_codegen_ssa::mir::debuginfo::VariableKind::*;
|
||||
use rustc_codegen_ssa::mir::debuginfo::{DebugScope, FunctionDebugContext, VariableKind};
|
||||
@ -22,7 +23,6 @@ use rustc_span::symbol::Symbol;
|
||||
use rustc_span::{
|
||||
BytePos, Pos, SourceFile, SourceFileAndLine, SourceFileHash, Span, StableSourceFileId,
|
||||
};
|
||||
use rustc_target::abi::Size;
|
||||
use smallvec::SmallVec;
|
||||
use tracing::debug;
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
use std::assert_matches::assert_matches;
|
||||
use std::cmp::Ordering;
|
||||
|
||||
use rustc_abi::{self as abi, Align, Float, HasDataLayout, Primitive, Size};
|
||||
use rustc_codegen_ssa::base::{compare_simd_types, wants_msvc_seh, wants_wasm_eh};
|
||||
use rustc_codegen_ssa::common::{IntPredicate, TypeKind};
|
||||
use rustc_codegen_ssa::errors::{ExpectedPointerMutability, InvalidMonomorphization};
|
||||
@ -13,11 +14,10 @@ use rustc_middle::ty::layout::{FnAbiOf, HasTyCtxt, LayoutOf};
|
||||
use rustc_middle::ty::{self, GenericArgsRef, Ty};
|
||||
use rustc_middle::{bug, span_bug};
|
||||
use rustc_span::{Span, Symbol, sym};
|
||||
use rustc_target::abi::{self, Align, Float, HasDataLayout, Primitive, Size};
|
||||
use rustc_target::spec::{HasTargetSpec, PanicStrategy};
|
||||
use tracing::debug;
|
||||
|
||||
use crate::abi::{Abi, FnAbi, FnAbiLlvmExt, LlvmType, PassMode};
|
||||
use crate::abi::{ExternAbi, FnAbi, FnAbiLlvmExt, LlvmType, PassMode};
|
||||
use crate::builder::Builder;
|
||||
use crate::context::CodegenCx;
|
||||
use crate::llvm::{self, Metadata};
|
||||
@ -1094,7 +1094,7 @@ fn get_rust_try_fn<'ll, 'tcx>(
|
||||
tcx.types.unit,
|
||||
false,
|
||||
hir::Safety::Unsafe,
|
||||
Abi::Rust,
|
||||
ExternAbi::Rust,
|
||||
)),
|
||||
);
|
||||
// `unsafe fn(*mut i8, *mut i8) -> ()`
|
||||
@ -1105,7 +1105,7 @@ fn get_rust_try_fn<'ll, 'tcx>(
|
||||
tcx.types.unit,
|
||||
false,
|
||||
hir::Safety::Unsafe,
|
||||
Abi::Rust,
|
||||
ExternAbi::Rust,
|
||||
)),
|
||||
);
|
||||
// `unsafe fn(unsafe fn(*mut i8) -> (), *mut i8, unsafe fn(*mut i8, *mut i8) -> ()) -> i32`
|
||||
@ -1114,7 +1114,7 @@ fn get_rust_try_fn<'ll, 'tcx>(
|
||||
tcx.types.i32,
|
||||
false,
|
||||
hir::Safety::Unsafe,
|
||||
Abi::Rust,
|
||||
ExternAbi::Rust,
|
||||
));
|
||||
let rust_try = gen_fn(cx, "__rust_try", rust_fn_sig, codegen);
|
||||
cx.rust_try_fn.set(Some(rust_try));
|
||||
|
@ -8,8 +8,8 @@ use std::str::FromStr;
|
||||
use std::string::FromUtf8Error;
|
||||
|
||||
use libc::c_uint;
|
||||
use rustc_abi::{Align, Size, WrappingRange};
|
||||
use rustc_llvm::RustString;
|
||||
use rustc_target::abi::{Align, Size, WrappingRange};
|
||||
|
||||
pub use self::AtomicRmwBinOp::*;
|
||||
pub use self::CallConv::*;
|
||||
|
@ -1,14 +1,14 @@
|
||||
use std::{fmt, ptr};
|
||||
|
||||
use libc::{c_char, c_uint};
|
||||
use rustc_abi::{AddressSpace, Align, Integer, 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::abi::call::{CastTarget, FnAbi, Reg};
|
||||
use rustc_target::abi::{AddressSpace, Align, Integer, Size};
|
||||
use rustc_target::callconv::{CastTarget, FnAbi, Reg};
|
||||
|
||||
use crate::abi::{FnAbiLlvmExt, LlvmType};
|
||||
use crate::context::CodegenCx;
|
||||
|
@ -1,9 +1,9 @@
|
||||
use rustc_abi::{Align, Endian, HasDataLayout, Size};
|
||||
use rustc_codegen_ssa::common::IntPredicate;
|
||||
use rustc_codegen_ssa::mir::operand::OperandRef;
|
||||
use rustc_codegen_ssa::traits::{BaseTypeCodegenMethods, BuilderMethods, ConstCodegenMethods};
|
||||
use rustc_middle::ty::Ty;
|
||||
use rustc_middle::ty::layout::{HasTyCtxt, LayoutOf};
|
||||
use rustc_target::abi::{Align, Endian, HasDataLayout, Size};
|
||||
|
||||
use crate::builder::Builder;
|
||||
use crate::type_::Type;
|
||||
|
@ -11,6 +11,7 @@ use object::{
|
||||
SectionFlags, SectionKind, SubArchitecture, SymbolFlags, SymbolKind, SymbolScope, elf, pe,
|
||||
xcoff,
|
||||
};
|
||||
use rustc_abi::Endian;
|
||||
use rustc_data_structures::memmap::Mmap;
|
||||
use rustc_data_structures::owned_slice::{OwnedSlice, try_slice_owned};
|
||||
use rustc_metadata::EncodedMetadata;
|
||||
@ -19,7 +20,6 @@ use rustc_metadata::fs::METADATA_FILENAME;
|
||||
use rustc_middle::bug;
|
||||
use rustc_session::Session;
|
||||
use rustc_span::sym;
|
||||
use rustc_target::abi::Endian;
|
||||
use rustc_target::spec::{RelocModel, Target, ef_avr_arch};
|
||||
|
||||
use super::apple;
|
||||
|
@ -548,7 +548,7 @@ pub(crate) fn linking_symbol_name_for_instance_in_crate<'tcx>(
|
||||
symbol: ExportedSymbol<'tcx>,
|
||||
instantiating_crate: CrateNum,
|
||||
) -> String {
|
||||
use rustc_target::abi::call::Conv;
|
||||
use rustc_target::callconv::Conv;
|
||||
|
||||
let mut undecorated = symbol_name_for_instance_in_crate(tcx, symbol, instantiating_crate);
|
||||
|
||||
|
@ -3,6 +3,7 @@ use std::collections::BTreeSet;
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
use itertools::Itertools;
|
||||
use rustc_abi::FIRST_VARIANT;
|
||||
use rustc_ast::expand::allocator::{ALLOCATOR_METHODS, AllocatorKind, global_fn_name};
|
||||
use rustc_attr as attr;
|
||||
use rustc_data_structures::fx::{FxHashMap, FxIndexSet};
|
||||
@ -26,7 +27,6 @@ use rustc_session::Session;
|
||||
use rustc_session::config::{self, CrateType, EntryFnType, OptLevel, OutputType};
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_span::{DUMMY_SP, Symbol};
|
||||
use rustc_target::abi::FIRST_VARIANT;
|
||||
use rustc_trait_selection::infer::at::ToTrace;
|
||||
use rustc_trait_selection::infer::{BoundRegionConversionTime, TyCtxtInferExt};
|
||||
use rustc_trait_selection::traits::{ObligationCause, ObligationCtxt};
|
||||
|
@ -1,7 +1,7 @@
|
||||
use rustc_abi::{Integer, Primitive, Size, TagEncoding, Variants};
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::ty::layout::{IntegerExt, PrimitiveExt, TyAndLayout};
|
||||
use rustc_middle::ty::{self, Ty, TyCtxt};
|
||||
use rustc_target::abi::{Integer, Primitive, Size, TagEncoding, Variants};
|
||||
|
||||
// FIXME(eddyb) find a place for this (or a way to replace it).
|
||||
pub mod type_names;
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
use std::fmt::Write;
|
||||
|
||||
use rustc_abi::Integer;
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_data_structures::stable_hasher::{Hash64, HashStable, StableHasher};
|
||||
use rustc_hir::def_id::DefId;
|
||||
@ -23,7 +24,6 @@ use rustc_middle::ty::layout::{IntegerExt, TyAndLayout};
|
||||
use rustc_middle::ty::{
|
||||
self, ExistentialProjection, GenericArgKind, GenericArgsRef, ParamEnv, Ty, TyCtxt,
|
||||
};
|
||||
use rustc_target::abi::Integer;
|
||||
use smallvec::SmallVec;
|
||||
|
||||
use crate::debuginfo::wants_c_like_enum_debuginfo;
|
||||
@ -364,7 +364,7 @@ fn push_debuginfo_type_name<'tcx>(
|
||||
} else {
|
||||
output.push_str(sig.safety.prefix_str());
|
||||
|
||||
if sig.abi != rustc_target::spec::abi::Abi::Rust {
|
||||
if sig.abi != rustc_abi::ExternAbi::Rust {
|
||||
output.push_str("extern \"");
|
||||
output.push_str(sig.abi.name());
|
||||
output.push_str("\" ");
|
||||
|
@ -2,7 +2,7 @@ use rustc_middle::bug;
|
||||
use rustc_middle::ty::{self, GenericArgKind, Ty};
|
||||
use rustc_session::config::Lto;
|
||||
use rustc_symbol_mangling::typeid_for_trait_ref;
|
||||
use rustc_target::abi::call::FnAbi;
|
||||
use rustc_target::callconv::FnAbi;
|
||||
use tracing::{debug, instrument};
|
||||
|
||||
use crate::traits::*;
|
||||
|
@ -1,5 +1,6 @@
|
||||
use std::cmp;
|
||||
|
||||
use rustc_abi::{self as abi, ExternAbi, HasDataLayout, WrappingRange};
|
||||
use rustc_ast as ast;
|
||||
use rustc_ast::{InlineAsmOptions, InlineAsmTemplatePiece};
|
||||
use rustc_hir::lang_items::LangItem;
|
||||
@ -13,9 +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::abi::call::{ArgAbi, FnAbi, PassMode, Reg};
|
||||
use rustc_target::abi::{self, HasDataLayout, WrappingRange};
|
||||
use rustc_target::spec::abi::Abi;
|
||||
use rustc_target::callconv::{ArgAbi, FnAbi, PassMode, Reg};
|
||||
use tracing::{debug, info};
|
||||
|
||||
use super::operand::OperandRef;
|
||||
@ -977,7 +976,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||
});
|
||||
|
||||
// Split the rust-call tupled arguments off.
|
||||
let (first_args, untuple) = if abi == Abi::RustCall && !args.is_empty() {
|
||||
let (first_args, untuple) = if abi == ExternAbi::RustCall && !args.is_empty() {
|
||||
let (tup, args) = args.split_last().unwrap();
|
||||
(args, Some(tup))
|
||||
} else {
|
||||
|
@ -1,9 +1,9 @@
|
||||
use rustc_abi::WrappingRange;
|
||||
use rustc_middle::ty::{self, Ty, TyCtxt};
|
||||
use rustc_middle::{bug, span_bug};
|
||||
use rustc_session::config::OptLevel;
|
||||
use rustc_span::{Span, sym};
|
||||
use rustc_target::abi::WrappingRange;
|
||||
use rustc_target::abi::call::{FnAbi, PassMode};
|
||||
use rustc_target::callconv::{FnAbi, PassMode};
|
||||
|
||||
use super::FunctionCx;
|
||||
use super::operand::OperandRef;
|
||||
|
@ -7,7 +7,7 @@ use rustc_middle::mir::{UnwindTerminateReason, traversal};
|
||||
use rustc_middle::ty::layout::{FnAbiOf, HasTyCtxt, TyAndLayout};
|
||||
use rustc_middle::ty::{self, Instance, Ty, TyCtxt, TypeFoldable, TypeVisitableExt};
|
||||
use rustc_middle::{bug, mir, span_bug};
|
||||
use rustc_target::abi::call::{FnAbi, PassMode};
|
||||
use rustc_target::callconv::{FnAbi, PassMode};
|
||||
use tracing::{debug, instrument};
|
||||
|
||||
use crate::base;
|
||||
|
@ -1,10 +1,9 @@
|
||||
use rustc_abi::Primitive::{Int, Pointer};
|
||||
use rustc_abi::{Align, FieldsShape, Size, TagEncoding, Variants};
|
||||
use rustc_abi::{Align, FieldsShape, Size, TagEncoding, VariantIdx, Variants};
|
||||
use rustc_middle::mir::tcx::PlaceTy;
|
||||
use rustc_middle::ty::layout::{HasTyCtxt, LayoutOf, TyAndLayout};
|
||||
use rustc_middle::ty::{self, Ty};
|
||||
use rustc_middle::{bug, mir};
|
||||
use rustc_target::abi::VariantIdx;
|
||||
use tracing::{debug, instrument};
|
||||
|
||||
use super::operand::OperandValue;
|
||||
|
@ -1,13 +1,13 @@
|
||||
use std::assert_matches::assert_matches;
|
||||
|
||||
use arrayvec::ArrayVec;
|
||||
use rustc_abi::{self as abi, FIRST_VARIANT, FieldIdx};
|
||||
use rustc_middle::ty::adjustment::PointerCoercion;
|
||||
use rustc_middle::ty::layout::{HasTyCtxt, LayoutOf, TyAndLayout};
|
||||
use rustc_middle::ty::{self, Instance, Ty, TyCtxt};
|
||||
use rustc_middle::{bug, mir, span_bug};
|
||||
use rustc_session::config::OptLevel;
|
||||
use rustc_span::{DUMMY_SP, Span};
|
||||
use rustc_target::abi::{self, FIRST_VARIANT, FieldIdx};
|
||||
use tracing::{debug, instrument};
|
||||
|
||||
use super::operand::{OperandRef, OperandValue};
|
||||
|
@ -78,7 +78,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||
let count = self.codegen_operand(bx, count).immediate();
|
||||
let pointee_layout = dst_val
|
||||
.layout
|
||||
.pointee_info_at(bx, rustc_target::abi::Size::ZERO)
|
||||
.pointee_info_at(bx, rustc_abi::Size::ZERO)
|
||||
.expect("Expected pointer");
|
||||
let bytes = bx.mul(count, bx.const_usize(pointee_layout.size.bytes()));
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
//! Computing the size and alignment of a value.
|
||||
|
||||
use rustc_abi::WrappingRange;
|
||||
use rustc_hir::LangItem;
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::ty::print::{with_no_trimmed_paths, with_no_visible_paths};
|
||||
use rustc_middle::ty::{self, Ty};
|
||||
use rustc_target::abi::WrappingRange;
|
||||
use tracing::{debug, trace};
|
||||
|
||||
use crate::common::IntPredicate;
|
||||
|
@ -7,7 +7,7 @@ use rustc_middle::ty::layout::{FnAbiOf, LayoutOf, TyAndLayout};
|
||||
use rustc_middle::ty::{Instance, Ty};
|
||||
use rustc_session::config::OptLevel;
|
||||
use rustc_span::Span;
|
||||
use rustc_target::abi::call::FnAbi;
|
||||
use rustc_target::callconv::FnAbi;
|
||||
|
||||
use super::abi::AbiBuilderMethods;
|
||||
use super::asm::AsmBuilderMethods;
|
||||
|
@ -1,10 +1,10 @@
|
||||
use std::ops::Range;
|
||||
|
||||
use rustc_abi::Size;
|
||||
use rustc_middle::mir;
|
||||
use rustc_middle::ty::{Instance, PolyExistentialTraitRef, Ty};
|
||||
use rustc_span::{SourceFile, Span, Symbol};
|
||||
use rustc_target::abi::Size;
|
||||
use rustc_target::abi::call::FnAbi;
|
||||
use rustc_target::callconv::FnAbi;
|
||||
|
||||
use super::BackendTypes;
|
||||
use crate::mir::debuginfo::{FunctionDebugContext, VariableKind};
|
||||
|
@ -1,6 +1,6 @@
|
||||
use rustc_middle::ty::{self, Ty};
|
||||
use rustc_span::Span;
|
||||
use rustc_target::abi::call::FnAbi;
|
||||
use rustc_target::callconv::FnAbi;
|
||||
|
||||
use super::BackendTypes;
|
||||
use crate::mir::operand::OperandRef;
|
||||
|
@ -29,7 +29,7 @@ use std::fmt;
|
||||
|
||||
use rustc_middle::ty::Ty;
|
||||
use rustc_middle::ty::layout::{FnAbiOf, LayoutOf, TyAndLayout};
|
||||
use rustc_target::abi::call::FnAbi;
|
||||
use rustc_target::callconv::FnAbi;
|
||||
|
||||
pub use self::abi::AbiBuilderMethods;
|
||||
pub use self::asm::{
|
||||
|
@ -1,5 +1,5 @@
|
||||
use rustc_abi::Align;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_target::abi::Align;
|
||||
|
||||
use super::BackendTypes;
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
use rustc_abi::{AddressSpace, Float, Integer};
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::ty::layout::{HasTyCtxt, TyAndLayout};
|
||||
use rustc_middle::ty::{self, Ty};
|
||||
use rustc_target::abi::call::{ArgAbi, CastTarget, FnAbi, Reg};
|
||||
use rustc_target::abi::{AddressSpace, Float, Integer};
|
||||
use rustc_target::callconv::{ArgAbi, CastTarget, FnAbi, Reg};
|
||||
|
||||
use super::BackendTypes;
|
||||
use super::misc::MiscCodegenMethods;
|
||||
|
@ -86,7 +86,7 @@ impl<'tcx> interpret::Machine<'tcx> for DummyMachine {
|
||||
fn find_mir_or_eval_fn(
|
||||
_ecx: &mut InterpCx<'tcx, Self>,
|
||||
_instance: ty::Instance<'tcx>,
|
||||
_abi: rustc_target::spec::abi::Abi,
|
||||
_abi: rustc_abi::ExternAbi,
|
||||
_args: &[interpret::FnArg<'tcx, Self::Provenance>],
|
||||
_destination: &interpret::MPlaceTy<'tcx, Self::Provenance>,
|
||||
_target: Option<BasicBlock>,
|
||||
|
@ -3,6 +3,7 @@ use std::fmt;
|
||||
use std::hash::Hash;
|
||||
use std::ops::ControlFlow;
|
||||
|
||||
use rustc_abi::{Align, ExternAbi, Size};
|
||||
use rustc_ast::Mutability;
|
||||
use rustc_data_structures::fx::{FxHashMap, FxIndexMap, IndexEntry};
|
||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
@ -14,8 +15,6 @@ use rustc_middle::ty::{self, Ty, TyCtxt};
|
||||
use rustc_middle::{bug, mir};
|
||||
use rustc_span::Span;
|
||||
use rustc_span::symbol::{Symbol, sym};
|
||||
use rustc_target::abi::{Align, Size};
|
||||
use rustc_target::spec::abi::Abi as CallAbi;
|
||||
use tracing::debug;
|
||||
|
||||
use super::error::*;
|
||||
@ -411,7 +410,7 @@ impl<'tcx> interpret::Machine<'tcx> for CompileTimeMachine<'tcx> {
|
||||
fn find_mir_or_eval_fn(
|
||||
ecx: &mut InterpCx<'tcx, Self>,
|
||||
orig_instance: ty::Instance<'tcx>,
|
||||
_abi: CallAbi,
|
||||
_abi: ExternAbi,
|
||||
args: &[FnArg<'tcx>],
|
||||
dest: &MPlaceTy<'tcx>,
|
||||
ret: Option<mir::BasicBlock>,
|
||||
|
@ -1,9 +1,9 @@
|
||||
// Not in interpret to make sure we do not use private implementation details
|
||||
|
||||
use rustc_abi::VariantIdx;
|
||||
use rustc_middle::query::{Key, TyCtxtAt};
|
||||
use rustc_middle::ty::{self, Ty, TyCtxt};
|
||||
use rustc_middle::{bug, mir};
|
||||
use rustc_target::abi::VariantIdx;
|
||||
use tracing::instrument;
|
||||
|
||||
use crate::interpret::InterpCx;
|
||||
|
@ -2,6 +2,7 @@ use std::borrow::Cow;
|
||||
use std::fmt::Write;
|
||||
|
||||
use either::Either;
|
||||
use rustc_abi::WrappingRange;
|
||||
use rustc_errors::codes::*;
|
||||
use rustc_errors::{
|
||||
Diag, DiagArgValue, DiagCtxtHandle, DiagMessage, Diagnostic, EmissionGuarantee, Level,
|
||||
@ -15,8 +16,7 @@ use rustc_middle::mir::interpret::{
|
||||
};
|
||||
use rustc_middle::ty::{self, Mutability, Ty};
|
||||
use rustc_span::{Span, Symbol};
|
||||
use rustc_target::abi::WrappingRange;
|
||||
use rustc_target::abi::call::AdjustForForeignAbiError;
|
||||
use rustc_target::callconv::AdjustForForeignAbiError;
|
||||
|
||||
use crate::interpret::InternKind;
|
||||
|
||||
|
@ -4,13 +4,12 @@ use std::assert_matches::assert_matches;
|
||||
use std::borrow::Cow;
|
||||
|
||||
use either::{Left, Right};
|
||||
use rustc_abi::{self as abi, ExternAbi, FieldIdx, Integer};
|
||||
use rustc_middle::ty::layout::{FnAbiOf, IntegerExt, LayoutOf, TyAndLayout};
|
||||
use rustc_middle::ty::{self, AdtDef, Instance, Ty};
|
||||
use rustc_middle::{bug, mir, span_bug};
|
||||
use rustc_span::sym;
|
||||
use rustc_target::abi::call::{ArgAbi, FnAbi, PassMode};
|
||||
use rustc_target::abi::{self, FieldIdx, Integer};
|
||||
use rustc_target::spec::abi::Abi;
|
||||
use rustc_target::callconv::{ArgAbi, FnAbi, PassMode};
|
||||
use tracing::{info, instrument, trace};
|
||||
|
||||
use super::{
|
||||
@ -488,7 +487,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
|
||||
pub(super) fn init_fn_call(
|
||||
&mut self,
|
||||
fn_val: FnVal<'tcx, M::ExtraFnVal>,
|
||||
(caller_abi, caller_fn_abi): (Abi, &FnAbi<'tcx, Ty<'tcx>>),
|
||||
(caller_abi, caller_fn_abi): (ExternAbi, &FnAbi<'tcx, Ty<'tcx>>),
|
||||
args: &[FnArg<'tcx, M::Provenance>],
|
||||
with_caller_location: bool,
|
||||
destination: &MPlaceTy<'tcx, M::Provenance>,
|
||||
@ -566,7 +565,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
|
||||
|
||||
// Special handling for the closure ABI: untuple the last argument.
|
||||
let args: Cow<'_, [FnArg<'tcx, M::Provenance>]> =
|
||||
if caller_abi == Abi::RustCall && !args.is_empty() {
|
||||
if caller_abi == ExternAbi::RustCall && !args.is_empty() {
|
||||
// Untuple
|
||||
let (untuple_arg, args) = args.split_last().unwrap();
|
||||
trace!("init_fn_call: Will pass last argument by untupling");
|
||||
@ -732,7 +731,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
|
||||
pub(super) fn init_fn_tail_call(
|
||||
&mut self,
|
||||
fn_val: FnVal<'tcx, M::ExtraFnVal>,
|
||||
(caller_abi, caller_fn_abi): (Abi, &FnAbi<'tcx, Ty<'tcx>>),
|
||||
(caller_abi, caller_fn_abi): (ExternAbi, &FnAbi<'tcx, Ty<'tcx>>),
|
||||
args: &[FnArg<'tcx, M::Provenance>],
|
||||
with_caller_location: bool,
|
||||
) -> InterpResult<'tcx> {
|
||||
@ -817,7 +816,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
|
||||
|
||||
self.init_fn_call(
|
||||
FnVal::Instance(instance),
|
||||
(Abi::Rust, fn_abi),
|
||||
(ExternAbi::Rust, fn_abi),
|
||||
&[FnArg::Copy(arg.into())],
|
||||
false,
|
||||
&ret,
|
||||
|
@ -1,5 +1,6 @@
|
||||
use std::assert_matches::assert_matches;
|
||||
|
||||
use rustc_abi::Integer;
|
||||
use rustc_apfloat::ieee::{Double, Half, Quad, Single};
|
||||
use rustc_apfloat::{Float, FloatConvert};
|
||||
use rustc_middle::mir::CastKind;
|
||||
@ -8,7 +9,6 @@ use rustc_middle::ty::adjustment::PointerCoercion;
|
||||
use rustc_middle::ty::layout::{IntegerExt, LayoutOf, TyAndLayout};
|
||||
use rustc_middle::ty::{self, FloatTy, Ty};
|
||||
use rustc_middle::{bug, span_bug};
|
||||
use rustc_target::abi::Integer;
|
||||
use rustc_type_ir::TyKind::*;
|
||||
use tracing::trace;
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
//! Functions for reading and writing discriminants of multi-variant layouts (enums and coroutines).
|
||||
|
||||
use rustc_abi::{self as abi, TagEncoding, VariantIdx, Variants};
|
||||
use rustc_middle::ty::layout::{LayoutOf, PrimitiveExt};
|
||||
use rustc_middle::ty::{self, CoroutineArgsExt, ScalarInt, Ty};
|
||||
use rustc_middle::{mir, span_bug};
|
||||
use rustc_target::abi::{self, TagEncoding, VariantIdx, Variants};
|
||||
use tracing::{instrument, trace};
|
||||
|
||||
use super::{
|
||||
|
@ -1,4 +1,5 @@
|
||||
use either::{Left, Right};
|
||||
use rustc_abi::{Align, HasDataLayout, Size, TargetDataLayout};
|
||||
use rustc_errors::DiagCtxtHandle;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_infer::infer::TyCtxtInferExt;
|
||||
@ -15,8 +16,7 @@ use rustc_middle::ty::{
|
||||
use rustc_middle::{mir, span_bug};
|
||||
use rustc_session::Limit;
|
||||
use rustc_span::Span;
|
||||
use rustc_target::abi::call::FnAbi;
|
||||
use rustc_target::abi::{Align, HasDataLayout, Size, TargetDataLayout};
|
||||
use rustc_target::callconv::FnAbi;
|
||||
use rustc_trait_selection::traits::ObligationCtxt;
|
||||
use tracing::{debug, instrument, trace};
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
use std::assert_matches::assert_matches;
|
||||
|
||||
use rustc_abi::Size;
|
||||
use rustc_apfloat::ieee::{Double, Half, Quad, Single};
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_middle::mir::{self, BinOp, ConstValue, NonDivergingIntrinsic};
|
||||
@ -11,7 +12,6 @@ use rustc_middle::ty::layout::{LayoutOf as _, TyAndLayout, ValidityRequirement};
|
||||
use rustc_middle::ty::{GenericArgsRef, Ty, TyCtxt};
|
||||
use rustc_middle::{bug, ty};
|
||||
use rustc_span::symbol::{Symbol, sym};
|
||||
use rustc_target::abi::Size;
|
||||
use tracing::trace;
|
||||
|
||||
use super::memory::MemoryKind;
|
||||
|
@ -6,6 +6,7 @@ use std::borrow::{Borrow, Cow};
|
||||
use std::fmt::Debug;
|
||||
use std::hash::Hash;
|
||||
|
||||
use rustc_abi::{Align, ExternAbi, Size};
|
||||
use rustc_apfloat::{Float, FloatConvert};
|
||||
use rustc_ast::{InlineAsmOptions, InlineAsmTemplatePiece};
|
||||
use rustc_middle::query::TyCtxtAt;
|
||||
@ -14,8 +15,6 @@ use rustc_middle::ty::layout::TyAndLayout;
|
||||
use rustc_middle::{mir, ty};
|
||||
use rustc_span::Span;
|
||||
use rustc_span::def_id::DefId;
|
||||
use rustc_target::abi::{Align, Size};
|
||||
use rustc_target::spec::abi::Abi as CallAbi;
|
||||
|
||||
use super::{
|
||||
AllocBytes, AllocId, AllocKind, AllocRange, Allocation, CTFE_ALLOC_SALT, ConstAllocation,
|
||||
@ -202,7 +201,7 @@ pub trait Machine<'tcx>: Sized {
|
||||
fn find_mir_or_eval_fn(
|
||||
ecx: &mut InterpCx<'tcx, Self>,
|
||||
instance: ty::Instance<'tcx>,
|
||||
abi: CallAbi,
|
||||
abi: ExternAbi,
|
||||
args: &[FnArg<'tcx, Self::Provenance>],
|
||||
destination: &MPlaceTy<'tcx, Self::Provenance>,
|
||||
target: Option<mir::BasicBlock>,
|
||||
@ -214,7 +213,7 @@ pub trait Machine<'tcx>: Sized {
|
||||
fn call_extra_fn(
|
||||
ecx: &mut InterpCx<'tcx, Self>,
|
||||
fn_val: Self::ExtraFnVal,
|
||||
abi: CallAbi,
|
||||
abi: ExternAbi,
|
||||
args: &[FnArg<'tcx, Self::Provenance>],
|
||||
destination: &MPlaceTy<'tcx, Self::Provenance>,
|
||||
target: Option<mir::BasicBlock>,
|
||||
@ -653,7 +652,7 @@ pub macro compile_time_machine(<$tcx: lifetime>) {
|
||||
fn call_extra_fn(
|
||||
_ecx: &mut InterpCx<$tcx, Self>,
|
||||
fn_val: !,
|
||||
_abi: CallAbi,
|
||||
_abi: ExternAbi,
|
||||
_args: &[FnArg<$tcx>],
|
||||
_destination: &MPlaceTy<$tcx, Self::Provenance>,
|
||||
_target: Option<mir::BasicBlock>,
|
||||
|
@ -11,13 +11,13 @@ use std::borrow::{Borrow, Cow};
|
||||
use std::collections::VecDeque;
|
||||
use std::{fmt, mem, ptr};
|
||||
|
||||
use rustc_abi::{Align, HasDataLayout, Size};
|
||||
use rustc_ast::Mutability;
|
||||
use rustc_data_structures::fx::{FxHashSet, FxIndexMap};
|
||||
use rustc_hir::def::DefKind;
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::mir::display_allocation;
|
||||
use rustc_middle::ty::{self, Instance, ParamEnv, Ty, TyCtxt};
|
||||
use rustc_target::abi::{Align, HasDataLayout, Size};
|
||||
use tracing::{debug, instrument, trace};
|
||||
|
||||
use super::{
|
||||
|
@ -1,4 +1,5 @@
|
||||
use either::Either;
|
||||
use rustc_abi::Size;
|
||||
use rustc_apfloat::{Float, FloatConvert};
|
||||
use rustc_middle::mir::NullOp;
|
||||
use rustc_middle::mir::interpret::{InterpResult, PointerArithmetic, Scalar};
|
||||
@ -6,7 +7,6 @@ use rustc_middle::ty::layout::{LayoutOf, TyAndLayout};
|
||||
use rustc_middle::ty::{self, FloatTy, ScalarInt, Ty};
|
||||
use rustc_middle::{bug, mir, span_bug};
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_target::abi::Size;
|
||||
use tracing::trace;
|
||||
|
||||
use super::{ImmTy, InterpCx, Machine, MemPlaceMeta, interp_ok, throw_ub};
|
||||
|
@ -10,10 +10,10 @@
|
||||
use std::marker::PhantomData;
|
||||
use std::ops::Range;
|
||||
|
||||
use rustc_abi::{self as abi, Size, VariantIdx};
|
||||
use rustc_middle::ty::Ty;
|
||||
use rustc_middle::ty::layout::{LayoutOf, TyAndLayout};
|
||||
use rustc_middle::{bug, mir, span_bug, ty};
|
||||
use rustc_target::abi::{self, Size, VariantIdx};
|
||||
use tracing::{debug, instrument};
|
||||
|
||||
use super::{
|
||||
|
@ -3,13 +3,13 @@
|
||||
//! The main entry point is the `step` method.
|
||||
|
||||
use either::Either;
|
||||
use rustc_abi::{FIRST_VARIANT, FieldIdx};
|
||||
use rustc_index::IndexSlice;
|
||||
use rustc_middle::ty::layout::FnAbiOf;
|
||||
use rustc_middle::ty::{self, Instance, Ty};
|
||||
use rustc_middle::{bug, mir, span_bug};
|
||||
use rustc_span::source_map::Spanned;
|
||||
use rustc_target::abi::call::FnAbi;
|
||||
use rustc_target::abi::{FIRST_VARIANT, FieldIdx};
|
||||
use rustc_target::callconv::FnAbi;
|
||||
use tracing::{info, instrument, trace};
|
||||
|
||||
use super::{
|
||||
|
@ -1,7 +1,7 @@
|
||||
use rustc_abi::{Align, Size};
|
||||
use rustc_middle::mir::interpret::{InterpResult, Pointer};
|
||||
use rustc_middle::ty::layout::LayoutOf;
|
||||
use rustc_middle::ty::{self, ExistentialPredicateStableCmpExt, Ty, TyCtxt, VtblEntry};
|
||||
use rustc_target::abi::{Align, Size};
|
||||
use tracing::trace;
|
||||
|
||||
use super::util::ensure_monomorphic_enough;
|
||||
|
@ -3,11 +3,11 @@
|
||||
|
||||
use std::num::NonZero;
|
||||
|
||||
use rustc_abi::{FieldIdx, FieldsShape, VariantIdx, Variants};
|
||||
use rustc_index::IndexVec;
|
||||
use rustc_middle::mir::interpret::InterpResult;
|
||||
use rustc_middle::ty::layout::LayoutOf;
|
||||
use rustc_middle::ty::{self, Ty};
|
||||
use rustc_target::abi::{FieldIdx, FieldsShape, VariantIdx, Variants};
|
||||
use tracing::trace;
|
||||
|
||||
use super::{InterpCx, MPlaceTy, Machine, Projectable, interp_ok, throw_inval};
|
||||
|
@ -1,6 +1,6 @@
|
||||
use rustc_abi::Align;
|
||||
use rustc_middle::mir::*;
|
||||
use rustc_middle::ty::{self, TyCtxt};
|
||||
use rustc_target::abi::Align;
|
||||
use tracing::debug;
|
||||
|
||||
/// Returns `true` if this place is allowed to be less aligned
|
||||
|
@ -37,7 +37,7 @@ use super::compare_impl_item::{check_type_bounds, compare_impl_method, compare_i
|
||||
use super::*;
|
||||
use crate::check::intrinsicck::InlineAsmCtxt;
|
||||
|
||||
pub fn check_abi(tcx: TyCtxt<'_>, span: Span, abi: Abi) {
|
||||
pub fn check_abi(tcx: TyCtxt<'_>, span: Span, abi: ExternAbi) {
|
||||
if !tcx.sess.target.is_abi_supported(abi) {
|
||||
struct_span_code_err!(
|
||||
tcx.dcx(),
|
||||
@ -49,7 +49,7 @@ pub fn check_abi(tcx: TyCtxt<'_>, span: Span, abi: Abi) {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn check_abi_fn_ptr(tcx: TyCtxt<'_>, hir_id: hir::HirId, span: Span, abi: Abi) {
|
||||
pub fn check_abi_fn_ptr(tcx: TyCtxt<'_>, hir_id: hir::HirId, span: Span, abi: ExternAbi) {
|
||||
if !tcx.sess.target.is_abi_supported(abi) {
|
||||
tcx.node_span_lint(UNSUPPORTED_FN_PTR_CALLING_CONVENTIONS, hir_id, span, |lint| {
|
||||
lint.primary_message(format!(
|
||||
@ -628,7 +628,7 @@ pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) {
|
||||
def_id,
|
||||
tcx.def_ident_span(def_id).unwrap(),
|
||||
i.name,
|
||||
Abi::Rust,
|
||||
ExternAbi::Rust,
|
||||
)
|
||||
}
|
||||
// Everything else is checked entirely within check_item_body
|
||||
@ -699,7 +699,7 @@ pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) {
|
||||
check_abi(tcx, it.span, abi);
|
||||
|
||||
match abi {
|
||||
Abi::RustIntrinsic => {
|
||||
ExternAbi::RustIntrinsic => {
|
||||
for item in items {
|
||||
intrinsic::check_intrinsic_type(
|
||||
tcx,
|
||||
|
@ -1,5 +1,6 @@
|
||||
use std::ops::Not;
|
||||
|
||||
use rustc_abi::ExternAbi;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::Node;
|
||||
use rustc_infer::infer::TyCtxtInferExt;
|
||||
@ -9,7 +10,6 @@ use rustc_session::config::EntryFnType;
|
||||
use rustc_span::Span;
|
||||
use rustc_span::def_id::{CRATE_DEF_ID, DefId, LocalDefId};
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_target::spec::abi::Abi;
|
||||
use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
|
||||
use rustc_trait_selection::traits::{self, ObligationCause, ObligationCauseCode};
|
||||
|
||||
@ -158,7 +158,7 @@ fn check_main_fn_ty(tcx: TyCtxt<'_>, main_def_id: DefId) {
|
||||
expected_return_type,
|
||||
false,
|
||||
hir::Safety::Safe,
|
||||
Abi::Rust,
|
||||
ExternAbi::Rust,
|
||||
));
|
||||
|
||||
if check_function_signature(
|
||||
@ -254,7 +254,7 @@ fn check_start_fn_ty(tcx: TyCtxt<'_>, start_def_id: DefId) {
|
||||
tcx.types.isize,
|
||||
false,
|
||||
hir::Safety::Safe,
|
||||
Abi::Rust,
|
||||
ExternAbi::Rust,
|
||||
));
|
||||
|
||||
let _ = check_function_signature(
|
||||
|
@ -1,6 +1,7 @@
|
||||
//! Type-checking for the rust-intrinsic and platform-intrinsic
|
||||
//! intrinsics that the compiler exposes.
|
||||
|
||||
use rustc_abi::ExternAbi;
|
||||
use rustc_errors::codes::*;
|
||||
use rustc_errors::{DiagMessage, struct_span_code_err};
|
||||
use rustc_hir as hir;
|
||||
@ -10,7 +11,6 @@ use rustc_middle::ty::{self, Ty, TyCtxt};
|
||||
use rustc_span::def_id::LocalDefId;
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_span::{Span, Symbol};
|
||||
use rustc_target::spec::abi::Abi;
|
||||
|
||||
use crate::check::check_function_signature;
|
||||
use crate::errors::{
|
||||
@ -163,7 +163,7 @@ pub fn check_intrinsic_type(
|
||||
intrinsic_id: LocalDefId,
|
||||
span: Span,
|
||||
intrinsic_name: Symbol,
|
||||
abi: Abi,
|
||||
abi: ExternAbi,
|
||||
) {
|
||||
let generics = tcx.generics_of(intrinsic_id);
|
||||
let param = |n| {
|
||||
@ -533,14 +533,14 @@ pub fn check_intrinsic_type(
|
||||
tcx.types.unit,
|
||||
false,
|
||||
hir::Safety::Safe,
|
||||
Abi::Rust,
|
||||
ExternAbi::Rust,
|
||||
));
|
||||
let catch_fn_ty = ty::Binder::dummy(tcx.mk_fn_sig(
|
||||
[mut_u8, mut_u8],
|
||||
tcx.types.unit,
|
||||
false,
|
||||
hir::Safety::Safe,
|
||||
Abi::Rust,
|
||||
ExternAbi::Rust,
|
||||
));
|
||||
(
|
||||
0,
|
||||
|
@ -74,7 +74,7 @@ pub mod wfcheck;
|
||||
use std::num::NonZero;
|
||||
|
||||
pub use check::{check_abi, check_abi_fn_ptr};
|
||||
use rustc_abi::VariantIdx;
|
||||
use rustc_abi::{ExternAbi, VariantIdx};
|
||||
use rustc_data_structures::fx::{FxHashSet, FxIndexMap};
|
||||
use rustc_errors::{Diag, ErrorGuaranteed, pluralize, struct_span_code_err};
|
||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
@ -91,7 +91,6 @@ use rustc_session::parse::feature_err;
|
||||
use rustc_span::def_id::CRATE_DEF_ID;
|
||||
use rustc_span::symbol::{Ident, kw, sym};
|
||||
use rustc_span::{BytePos, DUMMY_SP, Span, Symbol};
|
||||
use rustc_target::spec::abi::Abi;
|
||||
use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
|
||||
use rustc_trait_selection::error_reporting::infer::ObligationCauseExt as _;
|
||||
use rustc_trait_selection::error_reporting::traits::suggestions::ReturnsVisitor;
|
||||
@ -142,8 +141,8 @@ fn get_owner_return_paths(
|
||||
/// Forbid defining intrinsics in Rust code,
|
||||
/// as they must always be defined by the compiler.
|
||||
// FIXME: Move this to a more appropriate place.
|
||||
pub fn forbid_intrinsic_abi(tcx: TyCtxt<'_>, sp: Span, abi: Abi) {
|
||||
if let Abi::RustIntrinsic = abi {
|
||||
pub fn forbid_intrinsic_abi(tcx: TyCtxt<'_>, sp: Span, abi: ExternAbi) {
|
||||
if let ExternAbi::RustIntrinsic = abi {
|
||||
tcx.dcx().span_err(sp, "intrinsic must be in `extern \"rust-intrinsic\" { ... }` block");
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ use std::cell::LazyCell;
|
||||
use std::ops::{ControlFlow, Deref};
|
||||
|
||||
use hir::intravisit::{self, Visitor};
|
||||
use rustc_abi::ExternAbi;
|
||||
use rustc_data_structures::fx::{FxHashSet, FxIndexMap, FxIndexSet};
|
||||
use rustc_errors::codes::*;
|
||||
use rustc_errors::{Applicability, ErrorGuaranteed, pluralize, struct_span_code_err};
|
||||
@ -23,7 +24,6 @@ use rustc_middle::{bug, span_bug};
|
||||
use rustc_session::parse::feature_err;
|
||||
use rustc_span::symbol::{Ident, sym};
|
||||
use rustc_span::{DUMMY_SP, Span};
|
||||
use rustc_target::spec::abi::Abi;
|
||||
use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
|
||||
use rustc_trait_selection::regions::InferCtxtRegionExt;
|
||||
use rustc_trait_selection::traits::misc::{
|
||||
@ -1644,7 +1644,7 @@ fn check_fn_or_method<'tcx>(
|
||||
|
||||
check_where_clauses(wfcx, span, def_id);
|
||||
|
||||
if sig.abi == Abi::RustCall {
|
||||
if sig.abi == ExternAbi::RustCall {
|
||||
let span = tcx.def_span(def_id);
|
||||
let has_implicit_self = hir_decl.implicit_self != hir::ImplicitSelfKind::None;
|
||||
let mut inputs = sig.inputs().iter().skip(if has_implicit_self { 1 } else { 0 });
|
||||
|
@ -18,6 +18,7 @@ use std::cell::Cell;
|
||||
use std::iter;
|
||||
use std::ops::Bound;
|
||||
|
||||
use rustc_abi::ExternAbi;
|
||||
use rustc_ast::Recovered;
|
||||
use rustc_data_structures::captures::Captures;
|
||||
use rustc_data_structures::fx::{FxHashSet, FxIndexMap};
|
||||
@ -38,7 +39,6 @@ use rustc_middle::ty::{self, AdtKind, Const, IsSuggestable, Ty, TyCtxt, TypingMo
|
||||
use rustc_middle::{bug, span_bug};
|
||||
use rustc_span::symbol::{Ident, Symbol, kw, sym};
|
||||
use rustc_span::{DUMMY_SP, Span};
|
||||
use rustc_target::spec::abi;
|
||||
use rustc_trait_selection::error_reporting::traits::suggestions::NextTypeParamName;
|
||||
use rustc_trait_selection::infer::InferCtxtExt;
|
||||
use rustc_trait_selection::traits::ObligationCtxt;
|
||||
@ -1361,7 +1361,7 @@ fn fn_sig(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::EarlyBinder<'_, ty::PolyFn
|
||||
(Bound::Unbounded, Bound::Unbounded) => hir::Safety::Safe,
|
||||
_ => hir::Safety::Unsafe,
|
||||
};
|
||||
ty::Binder::dummy(tcx.mk_fn_sig(inputs, ty, false, safety, abi::Abi::Rust))
|
||||
ty::Binder::dummy(tcx.mk_fn_sig(inputs, ty, false, safety, ExternAbi::Rust))
|
||||
}
|
||||
|
||||
Expr(&hir::Expr { kind: hir::ExprKind::Closure { .. }, .. }) => {
|
||||
@ -1686,10 +1686,10 @@ fn compute_sig_of_foreign_fn_decl<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
def_id: LocalDefId,
|
||||
decl: &'tcx hir::FnDecl<'tcx>,
|
||||
abi: abi::Abi,
|
||||
abi: ExternAbi,
|
||||
safety: hir::Safety,
|
||||
) -> ty::PolyFnSig<'tcx> {
|
||||
let safety = if abi == abi::Abi::RustIntrinsic {
|
||||
let safety = if abi == ExternAbi::RustIntrinsic {
|
||||
intrinsic_operation_unsafety(tcx, def_id)
|
||||
} else {
|
||||
safety
|
||||
@ -1700,7 +1700,7 @@ fn compute_sig_of_foreign_fn_decl<'tcx>(
|
||||
|
||||
// Feature gate SIMD types in FFI, since I am not sure that the
|
||||
// ABIs are handled at all correctly. -huonw
|
||||
if abi != abi::Abi::RustIntrinsic && !tcx.features().simd_ffi() {
|
||||
if abi != ExternAbi::RustIntrinsic && !tcx.features().simd_ffi() {
|
||||
let check = |hir_ty: &hir::Ty<'_>, ty: Ty<'_>| {
|
||||
if ty.is_simd() {
|
||||
let snip = tcx
|
||||
|
@ -1,9 +1,9 @@
|
||||
use rustc_abi::ExternAbi;
|
||||
use rustc_errors::{DiagCtxtHandle, E0781, struct_span_code_err};
|
||||
use rustc_hir::{self as hir, HirId};
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::ty::layout::LayoutError;
|
||||
use rustc_middle::ty::{self, ParamEnv, TyCtxt};
|
||||
use rustc_target::spec::abi;
|
||||
|
||||
use crate::errors;
|
||||
|
||||
@ -14,13 +14,13 @@ pub(crate) fn validate_cmse_abi<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
dcx: DiagCtxtHandle<'_>,
|
||||
hir_id: HirId,
|
||||
abi: abi::Abi,
|
||||
abi: ExternAbi,
|
||||
fn_sig: ty::PolyFnSig<'tcx>,
|
||||
) {
|
||||
let abi_name = abi.name();
|
||||
|
||||
match abi {
|
||||
abi::Abi::CCmseNonSecureCall => {
|
||||
ExternAbi::CCmseNonSecureCall => {
|
||||
let hir_node = tcx.hir_node(hir_id);
|
||||
let hir::Node::Ty(hir::Ty {
|
||||
span: bare_fn_span,
|
||||
@ -78,7 +78,7 @@ pub(crate) fn validate_cmse_abi<'tcx>(
|
||||
}
|
||||
};
|
||||
}
|
||||
abi::Abi::CCmseNonSecureEntry => {
|
||||
ExternAbi::CCmseNonSecureEntry => {
|
||||
let hir_node = tcx.hir_node(hir_id);
|
||||
let Some(hir::FnSig { decl, span: fn_sig_span, .. }) = hir_node.fn_sig() else {
|
||||
// might happen when this ABI is used incorrectly. That will be handled elsewhere
|
||||
@ -195,17 +195,17 @@ fn is_valid_cmse_output<'tcx>(
|
||||
Ok(ret_ty == tcx.types.i64 || ret_ty == tcx.types.u64 || ret_ty == tcx.types.f64)
|
||||
}
|
||||
|
||||
fn should_emit_generic_error<'tcx>(abi: abi::Abi, layout_err: &'tcx LayoutError<'tcx>) -> bool {
|
||||
fn should_emit_generic_error<'tcx>(abi: ExternAbi, layout_err: &'tcx LayoutError<'tcx>) -> bool {
|
||||
use LayoutError::*;
|
||||
|
||||
match layout_err {
|
||||
Unknown(ty) => {
|
||||
match abi {
|
||||
abi::Abi::CCmseNonSecureCall => {
|
||||
ExternAbi::CCmseNonSecureCall => {
|
||||
// prevent double reporting of this error
|
||||
!ty.is_impl_trait()
|
||||
}
|
||||
abi::Abi::CCmseNonSecureEntry => true,
|
||||
ExternAbi::CCmseNonSecureEntry => true,
|
||||
_ => bug!("invalid ABI: {abi}"),
|
||||
}
|
||||
}
|
||||
|
@ -47,7 +47,6 @@ use rustc_session::lint::builtin::AMBIGUOUS_ASSOCIATED_ITEMS;
|
||||
use rustc_span::edit_distance::find_best_match_for_name;
|
||||
use rustc_span::symbol::{Ident, Symbol, kw};
|
||||
use rustc_span::{DUMMY_SP, Span};
|
||||
use rustc_target::spec::abi;
|
||||
use rustc_trait_selection::infer::InferCtxtExt;
|
||||
use rustc_trait_selection::traits::wf::object_region_bounds;
|
||||
use rustc_trait_selection::traits::{self, ObligationCtxt};
|
||||
@ -2352,7 +2351,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
|
||||
&self,
|
||||
hir_id: HirId,
|
||||
safety: hir::Safety,
|
||||
abi: abi::Abi,
|
||||
abi: rustc_abi::ExternAbi,
|
||||
decl: &hir::FnDecl<'tcx>,
|
||||
generics: Option<&hir::Generics<'_>>,
|
||||
hir_ty: Option<&hir::Ty<'_>>,
|
||||
|
@ -91,6 +91,7 @@ mod impl_wf_check;
|
||||
mod outlives;
|
||||
mod variance;
|
||||
|
||||
use rustc_abi::ExternAbi;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::DefKind;
|
||||
use rustc_middle::middle;
|
||||
@ -100,19 +101,23 @@ use rustc_middle::ty::{self, Ty, TyCtxt};
|
||||
use rustc_session::parse::feature_err;
|
||||
use rustc_span::Span;
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_target::spec::abi::Abi;
|
||||
use rustc_trait_selection::traits;
|
||||
|
||||
rustc_fluent_macro::fluent_messages! { "../messages.ftl" }
|
||||
|
||||
fn require_c_abi_if_c_variadic(tcx: TyCtxt<'_>, decl: &hir::FnDecl<'_>, abi: Abi, span: Span) {
|
||||
fn require_c_abi_if_c_variadic(
|
||||
tcx: TyCtxt<'_>,
|
||||
decl: &hir::FnDecl<'_>,
|
||||
abi: ExternAbi,
|
||||
span: Span,
|
||||
) {
|
||||
const CONVENTIONS_UNSTABLE: &str =
|
||||
"`C`, `cdecl`, `system`, `aapcs`, `win64`, `sysv64` or `efiapi`";
|
||||
const CONVENTIONS_STABLE: &str = "`C` or `cdecl`";
|
||||
const UNSTABLE_EXPLAIN: &str =
|
||||
"using calling conventions other than `C` or `cdecl` for varargs functions is unstable";
|
||||
|
||||
if !decl.c_variadic || matches!(abi, Abi::C { .. } | Abi::Cdecl { .. }) {
|
||||
if !decl.c_variadic || matches!(abi, ExternAbi::C { .. } | ExternAbi::Cdecl { .. }) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,6 @@ use rustc_middle::{bug, span_bug};
|
||||
use rustc_span::Span;
|
||||
use rustc_span::def_id::LocalDefId;
|
||||
use rustc_span::symbol::{Ident, sym};
|
||||
use rustc_target::spec::abi;
|
||||
use rustc_trait_selection::error_reporting::traits::DefIdOrName;
|
||||
use rustc_trait_selection::infer::InferCtxtExt as _;
|
||||
use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt as _;
|
||||
@ -509,7 +508,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
def_id,
|
||||
);
|
||||
|
||||
if fn_sig.abi == abi::Abi::RustCall {
|
||||
if fn_sig.abi == rustc_abi::ExternAbi::RustCall {
|
||||
let sp = arg_exprs.last().map_or(call_expr.span, |expr| expr.span);
|
||||
if let Some(ty) = fn_sig.inputs().last().copied() {
|
||||
self.register_bound(
|
||||
|
@ -1,5 +1,6 @@
|
||||
use std::cell::RefCell;
|
||||
|
||||
use rustc_abi::ExternAbi;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::DefKind;
|
||||
use rustc_hir::intravisit::Visitor;
|
||||
@ -10,7 +11,6 @@ use rustc_infer::traits::WellFormedLoc;
|
||||
use rustc_middle::ty::{self, Binder, Ty, TyCtxt};
|
||||
use rustc_span::def_id::LocalDefId;
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_target::spec::abi::Abi;
|
||||
use rustc_trait_selection::traits::{ObligationCause, ObligationCauseCode};
|
||||
use tracing::{debug, instrument};
|
||||
|
||||
@ -211,7 +211,7 @@ fn check_panic_info_fn(tcx: TyCtxt<'_>, fn_id: LocalDefId, fn_sig: ty::FnSig<'_>
|
||||
ty::BoundVariableKind::Region(ty::BrAnon),
|
||||
]);
|
||||
let expected_sig = ty::Binder::bind_with_vars(
|
||||
tcx.mk_fn_sig([panic_info_ref_ty], tcx.types.never, false, fn_sig.safety, Abi::Rust),
|
||||
tcx.mk_fn_sig([panic_info_ref_ty], tcx.types.never, false, fn_sig.safety, ExternAbi::Rust),
|
||||
bounds,
|
||||
);
|
||||
|
||||
@ -234,7 +234,7 @@ fn check_lang_start_fn<'tcx>(tcx: TyCtxt<'tcx>, fn_sig: ty::FnSig<'tcx>, def_id:
|
||||
let generic_ty = Ty::new_param(tcx, fn_generic.index, fn_generic.name);
|
||||
let main_fn_ty = Ty::new_fn_ptr(
|
||||
tcx,
|
||||
Binder::dummy(tcx.mk_fn_sig([], generic_ty, false, hir::Safety::Safe, Abi::Rust)),
|
||||
Binder::dummy(tcx.mk_fn_sig([], generic_ty, false, hir::Safety::Safe, ExternAbi::Rust)),
|
||||
);
|
||||
|
||||
let expected_sig = ty::Binder::dummy(tcx.mk_fn_sig(
|
||||
@ -247,7 +247,7 @@ fn check_lang_start_fn<'tcx>(tcx: TyCtxt<'tcx>, fn_sig: ty::FnSig<'tcx>, def_id:
|
||||
tcx.types.isize,
|
||||
false,
|
||||
fn_sig.safety,
|
||||
Abi::Rust,
|
||||
ExternAbi::Rust,
|
||||
));
|
||||
|
||||
let _ = check_function_signature(
|
||||
|
@ -3,6 +3,7 @@
|
||||
use std::iter;
|
||||
use std::ops::ControlFlow;
|
||||
|
||||
use rustc_abi::ExternAbi;
|
||||
use rustc_errors::ErrorGuaranteed;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::lang_items::LangItem;
|
||||
@ -15,7 +16,6 @@ use rustc_middle::ty::visit::{TypeVisitable, TypeVisitableExt};
|
||||
use rustc_middle::ty::{self, GenericArgs, Ty, TyCtxt, TypeSuperVisitable, TypeVisitor};
|
||||
use rustc_span::def_id::LocalDefId;
|
||||
use rustc_span::{DUMMY_SP, Span};
|
||||
use rustc_target::spec::abi::Abi;
|
||||
use rustc_trait_selection::error_reporting::traits::ArgKind;
|
||||
use rustc_trait_selection::traits;
|
||||
use rustc_type_ir::ClosureKind;
|
||||
@ -508,7 +508,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
ret_param_ty,
|
||||
false,
|
||||
hir::Safety::Safe,
|
||||
Abi::Rust,
|
||||
ExternAbi::Rust,
|
||||
));
|
||||
|
||||
Some(ExpectedSig { cause_span, sig })
|
||||
@ -594,7 +594,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
return_ty,
|
||||
false,
|
||||
hir::Safety::Safe,
|
||||
Abi::Rust,
|
||||
ExternAbi::Rust,
|
||||
));
|
||||
|
||||
Some(ExpectedSig { cause_span, sig })
|
||||
@ -706,7 +706,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
sig.output(),
|
||||
sig.c_variadic,
|
||||
hir::Safety::Safe,
|
||||
Abi::RustCall,
|
||||
ExternAbi::RustCall,
|
||||
)
|
||||
});
|
||||
|
||||
@ -845,7 +845,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
supplied_output_ty,
|
||||
expected_sigs.liberated_sig.c_variadic,
|
||||
hir::Safety::Safe,
|
||||
Abi::RustCall,
|
||||
ExternAbi::RustCall,
|
||||
);
|
||||
|
||||
Ok(InferOk { value: expected_sigs, obligations: all_obligations })
|
||||
@ -922,7 +922,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
supplied_return,
|
||||
decl.c_variadic,
|
||||
hir::Safety::Safe,
|
||||
Abi::RustCall,
|
||||
ExternAbi::RustCall,
|
||||
),
|
||||
bound_vars,
|
||||
);
|
||||
@ -1086,7 +1086,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
err_ty,
|
||||
decl.c_variadic,
|
||||
hir::Safety::Safe,
|
||||
Abi::RustCall,
|
||||
ExternAbi::RustCall,
|
||||
));
|
||||
|
||||
debug!("supplied_sig_of_closure: result={:?}", result);
|
||||
|
@ -37,6 +37,7 @@
|
||||
|
||||
use std::ops::Deref;
|
||||
|
||||
use rustc_abi::ExternAbi;
|
||||
use rustc_errors::codes::*;
|
||||
use rustc_errors::{Applicability, Diag, struct_span_code_err};
|
||||
use rustc_hir as hir;
|
||||
@ -60,7 +61,6 @@ use rustc_middle::ty::{self, GenericArgsRef, Ty, TyCtxt};
|
||||
use rustc_session::parse::feature_err;
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_span::{BytePos, DUMMY_SP, DesugaringKind, Span};
|
||||
use rustc_target::spec::abi::Abi;
|
||||
use rustc_trait_selection::infer::InferCtxtExt as _;
|
||||
use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt;
|
||||
use rustc_trait_selection::traits::{
|
||||
@ -1244,7 +1244,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
};
|
||||
if let (Some(a_sig), Some(b_sig)) = (a_sig, b_sig) {
|
||||
// Intrinsics are not coercible to function pointers.
|
||||
if a_sig.abi() == Abi::RustIntrinsic || b_sig.abi() == Abi::RustIntrinsic {
|
||||
if a_sig.abi() == ExternAbi::RustIntrinsic || b_sig.abi() == ExternAbi::RustIntrinsic {
|
||||
return Err(TypeError::IntrinsicCast);
|
||||
}
|
||||
// The signature must match.
|
||||
|
@ -5,6 +5,7 @@
|
||||
//!
|
||||
//! See [`rustc_hir_analysis::check`] for more context on type checking in general.
|
||||
|
||||
use rustc_abi::{FIRST_VARIANT, FieldIdx};
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
use rustc_data_structures::stack::ensure_sufficient_stack;
|
||||
use rustc_data_structures::unord::UnordMap;
|
||||
@ -34,7 +35,6 @@ use rustc_span::edit_distance::find_best_match_for_name;
|
||||
use rustc_span::hygiene::DesugaringKind;
|
||||
use rustc_span::source_map::Spanned;
|
||||
use rustc_span::symbol::{Ident, Symbol, kw, sym};
|
||||
use rustc_target::abi::{FIRST_VARIANT, FieldIdx};
|
||||
use rustc_trait_selection::infer::InferCtxtExt;
|
||||
use rustc_trait_selection::traits::{self, ObligationCauseCode, ObligationCtxt};
|
||||
use tracing::{debug, instrument, trace};
|
||||
|
@ -9,6 +9,7 @@ use std::slice::from_ref;
|
||||
use hir::Expr;
|
||||
use hir::def::DefKind;
|
||||
use hir::pat_util::EnumerateAndAdjustIterator as _;
|
||||
use rustc_abi::{FIRST_VARIANT, FieldIdx, VariantIdx};
|
||||
use rustc_data_structures::fx::FxIndexMap;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::{CtorOf, Res};
|
||||
@ -24,7 +25,6 @@ use rustc_middle::ty::{
|
||||
};
|
||||
use rustc_middle::{bug, span_bug};
|
||||
use rustc_span::{ErrorGuaranteed, Span};
|
||||
use rustc_target::abi::{FIRST_VARIANT, FieldIdx, VariantIdx};
|
||||
use rustc_trait_selection::infer::InferCtxtExt;
|
||||
use tracing::{debug, trace};
|
||||
use ty::BorrowKind::ImmBorrow;
|
||||
|
@ -1,6 +1,7 @@
|
||||
use std::collections::hash_map::Entry;
|
||||
use std::slice;
|
||||
|
||||
use rustc_abi::FieldIdx;
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_errors::{Applicability, Diag, ErrorGuaranteed, MultiSpan, StashKey};
|
||||
use rustc_hir as hir;
|
||||
@ -32,7 +33,6 @@ use rustc_span::Span;
|
||||
use rustc_span::def_id::LocalDefId;
|
||||
use rustc_span::hygiene::DesugaringKind;
|
||||
use rustc_span::symbol::kw;
|
||||
use rustc_target::abi::FieldIdx;
|
||||
use rustc_trait_selection::error_reporting::infer::need_type_info::TypeAnnotationNeeded;
|
||||
use rustc_trait_selection::traits::{
|
||||
self, NormalizeExt, ObligationCauseCode, StructurallyNormalizeExt,
|
||||
|
@ -1,5 +1,6 @@
|
||||
use hir::HirId;
|
||||
use rustc_abi::Primitive::Pointer;
|
||||
use rustc_abi::VariantIdx;
|
||||
use rustc_errors::codes::*;
|
||||
use rustc_errors::struct_span_code_err;
|
||||
use rustc_hir as hir;
|
||||
@ -7,7 +8,6 @@ use rustc_index::Idx;
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::ty::layout::{LayoutError, SizeSkeleton};
|
||||
use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitableExt};
|
||||
use rustc_target::abi::VariantIdx;
|
||||
use tracing::trace;
|
||||
|
||||
use super::FnCtxt;
|
||||
|
@ -1,6 +1,7 @@
|
||||
use std::cmp;
|
||||
use std::collections::hash_map::Entry::{Occupied, Vacant};
|
||||
|
||||
use rustc_abi::FieldIdx;
|
||||
use rustc_ast as ast;
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_errors::codes::*;
|
||||
@ -20,7 +21,6 @@ use rustc_span::hygiene::DesugaringKind;
|
||||
use rustc_span::source_map::Spanned;
|
||||
use rustc_span::symbol::{Ident, kw, sym};
|
||||
use rustc_span::{BytePos, DUMMY_SP, Span};
|
||||
use rustc_target::abi::FieldIdx;
|
||||
use rustc_trait_selection::infer::InferCtxtExt;
|
||||
use rustc_trait_selection::traits::{ObligationCause, ObligationCauseCode};
|
||||
use tracing::{debug, instrument, trace};
|
||||
|
@ -32,6 +32,7 @@
|
||||
|
||||
use std::iter;
|
||||
|
||||
use rustc_abi::FIRST_VARIANT;
|
||||
use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
|
||||
use rustc_data_structures::unord::{ExtendUnord, UnordSet};
|
||||
use rustc_errors::{Applicability, MultiSpan};
|
||||
@ -49,7 +50,6 @@ use rustc_middle::ty::{
|
||||
use rustc_middle::{bug, span_bug};
|
||||
use rustc_session::lint;
|
||||
use rustc_span::{BytePos, Pos, Span, Symbol, sym};
|
||||
use rustc_target::abi::FIRST_VARIANT;
|
||||
use rustc_trait_selection::infer::InferCtxtExt;
|
||||
use tracing::{debug, instrument};
|
||||
|
||||
@ -438,7 +438,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
tupled_upvars_ty_for_borrow,
|
||||
false,
|
||||
hir::Safety::Safe,
|
||||
rustc_target::spec::abi::Abi::Rust,
|
||||
rustc_abi::ExternAbi::Rust,
|
||||
),
|
||||
self.tcx.mk_bound_variable_kinds(&[ty::BoundVariableKind::Region(
|
||||
ty::BoundRegionKind::BrEnv,
|
||||
|
@ -1,3 +1,4 @@
|
||||
use rustc_abi::ExternAbi;
|
||||
use rustc_hir::def::{DefKind, Res};
|
||||
use rustc_hir::intravisit::FnKind;
|
||||
use rustc_hir::{GenericParamKind, PatKind};
|
||||
@ -7,7 +8,6 @@ use rustc_session::{declare_lint, declare_lint_pass};
|
||||
use rustc_span::def_id::LocalDefId;
|
||||
use rustc_span::symbol::{Ident, sym};
|
||||
use rustc_span::{BytePos, Span};
|
||||
use rustc_target::spec::abi::Abi;
|
||||
use {rustc_ast as ast, rustc_attr as attr, rustc_hir as hir};
|
||||
|
||||
use crate::lints::{
|
||||
@ -397,7 +397,7 @@ impl<'tcx> LateLintPass<'tcx> for NonSnakeCase {
|
||||
match &fk {
|
||||
FnKind::Method(ident, sig, ..) => match method_context(cx, id) {
|
||||
MethodLateContext::PlainImpl => {
|
||||
if sig.header.abi != Abi::Rust && cx.tcx.has_attr(id, sym::no_mangle) {
|
||||
if sig.header.abi != ExternAbi::Rust && cx.tcx.has_attr(id, sym::no_mangle) {
|
||||
return;
|
||||
}
|
||||
self.check_snake_case(cx, "method", ident);
|
||||
@ -409,7 +409,7 @@ impl<'tcx> LateLintPass<'tcx> for NonSnakeCase {
|
||||
},
|
||||
FnKind::ItemFn(ident, _, header) => {
|
||||
// Skip foreign-ABI #[no_mangle] functions (Issue #31924)
|
||||
if header.abi != Abi::Rust && cx.tcx.has_attr(id, sym::no_mangle) {
|
||||
if header.abi != ExternAbi::Rust && cx.tcx.has_attr(id, sym::no_mangle) {
|
||||
return;
|
||||
}
|
||||
self.check_snake_case(cx, "function", ident);
|
||||
|
@ -1,7 +1,7 @@
|
||||
use std::iter;
|
||||
use std::ops::ControlFlow;
|
||||
|
||||
use rustc_abi::{BackendRepr, TagEncoding, Variants, WrappingRange};
|
||||
use rustc_abi::{BackendRepr, ExternAbi, TagEncoding, Variants, WrappingRange};
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_errors::DiagMessage;
|
||||
use rustc_hir::{Expr, ExprKind};
|
||||
@ -14,7 +14,6 @@ use rustc_session::{declare_lint, declare_lint_pass, impl_lint_pass};
|
||||
use rustc_span::def_id::LocalDefId;
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_span::{Span, Symbol, source_map};
|
||||
use rustc_target::spec::abi::Abi as SpecAbi;
|
||||
use tracing::debug;
|
||||
use {rustc_ast as ast, rustc_hir as hir};
|
||||
|
||||
@ -1294,10 +1293,10 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
|
||||
self.check_type_for_ffi_and_report_errors(span, ty, true, false);
|
||||
}
|
||||
|
||||
fn is_internal_abi(&self, abi: SpecAbi) -> bool {
|
||||
fn is_internal_abi(&self, abi: ExternAbi) -> bool {
|
||||
matches!(
|
||||
abi,
|
||||
SpecAbi::Rust | SpecAbi::RustCall | SpecAbi::RustCold | SpecAbi::RustIntrinsic
|
||||
ExternAbi::Rust | ExternAbi::RustCall | ExternAbi::RustCold | ExternAbi::RustIntrinsic
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
use std::ops::ControlFlow;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use rustc_abi::ExternAbi;
|
||||
use rustc_ast::CRATE_NODE_ID;
|
||||
use rustc_attr as attr;
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
@ -17,7 +18,6 @@ use rustc_session::utils::NativeLibKind;
|
||||
use rustc_span::def_id::{DefId, LOCAL_CRATE};
|
||||
use rustc_span::symbol::{Symbol, sym};
|
||||
use rustc_target::spec::LinkSelfContainedComponents;
|
||||
use rustc_target::spec::abi::Abi;
|
||||
|
||||
use crate::{errors, fluent_generated};
|
||||
|
||||
@ -203,7 +203,7 @@ impl<'tcx> Collector<'tcx> {
|
||||
|
||||
let sess = self.tcx.sess;
|
||||
|
||||
if matches!(abi, Abi::Rust | Abi::RustIntrinsic) {
|
||||
if matches!(abi, ExternAbi::Rust | ExternAbi::RustIntrinsic) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -625,7 +625,7 @@ impl<'tcx> Collector<'tcx> {
|
||||
|
||||
fn build_dll_import(
|
||||
&self,
|
||||
abi: Abi,
|
||||
abi: ExternAbi,
|
||||
import_name_type: Option<PeImportNameType>,
|
||||
item: DefId,
|
||||
) -> DllImport {
|
||||
@ -634,12 +634,14 @@ impl<'tcx> Collector<'tcx> {
|
||||
// this logic is similar to `Target::adjust_abi` (in rustc_target/src/spec/mod.rs) but errors on unsupported inputs
|
||||
let calling_convention = if self.tcx.sess.target.arch == "x86" {
|
||||
match abi {
|
||||
Abi::C { .. } | Abi::Cdecl { .. } => DllCallingConvention::C,
|
||||
Abi::Stdcall { .. } => DllCallingConvention::Stdcall(self.i686_arg_list_size(item)),
|
||||
ExternAbi::C { .. } | ExternAbi::Cdecl { .. } => DllCallingConvention::C,
|
||||
ExternAbi::Stdcall { .. } => {
|
||||
DllCallingConvention::Stdcall(self.i686_arg_list_size(item))
|
||||
}
|
||||
// On Windows, `extern "system"` behaves like msvc's `__stdcall`.
|
||||
// `__stdcall` only applies on x86 and on non-variadic functions:
|
||||
// https://learn.microsoft.com/en-us/cpp/cpp/stdcall?view=msvc-170
|
||||
Abi::System { .. } => {
|
||||
ExternAbi::System { .. } => {
|
||||
let c_variadic =
|
||||
self.tcx.type_of(item).instantiate_identity().fn_sig(self.tcx).c_variadic();
|
||||
|
||||
@ -649,10 +651,10 @@ impl<'tcx> Collector<'tcx> {
|
||||
DllCallingConvention::Stdcall(self.i686_arg_list_size(item))
|
||||
}
|
||||
}
|
||||
Abi::Fastcall { .. } => {
|
||||
ExternAbi::Fastcall { .. } => {
|
||||
DllCallingConvention::Fastcall(self.i686_arg_list_size(item))
|
||||
}
|
||||
Abi::Vectorcall { .. } => {
|
||||
ExternAbi::Vectorcall { .. } => {
|
||||
DllCallingConvention::Vectorcall(self.i686_arg_list_size(item))
|
||||
}
|
||||
_ => {
|
||||
@ -661,7 +663,9 @@ impl<'tcx> Collector<'tcx> {
|
||||
}
|
||||
} else {
|
||||
match abi {
|
||||
Abi::C { .. } | Abi::Win64 { .. } | Abi::System { .. } => DllCallingConvention::C,
|
||||
ExternAbi::C { .. } | ExternAbi::Win64 { .. } | ExternAbi::System { .. } => {
|
||||
DllCallingConvention::C
|
||||
}
|
||||
_ => {
|
||||
self.tcx.dcx().emit_fatal(errors::UnsupportedAbi { span });
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ use decoder::{DecodeContext, Metadata};
|
||||
use def_path_hash_map::DefPathHashMapRef;
|
||||
use encoder::EncodeContext;
|
||||
pub use encoder::{EncodedMetadata, encode_metadata, rendered_const};
|
||||
use rustc_abi::{FieldIdx, VariantIdx};
|
||||
use rustc_abi::{FieldIdx, ReprOptions, VariantIdx};
|
||||
use rustc_ast::expand::StrippedCfgItem;
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_data_structures::svh::Svh;
|
||||
@ -27,7 +27,7 @@ use rustc_middle::middle::lib_features::FeatureStability;
|
||||
use rustc_middle::middle::resolve_bound_vars::ObjectLifetimeDefault;
|
||||
use rustc_middle::ty::fast_reject::SimplifiedType;
|
||||
use rustc_middle::ty::{
|
||||
self, DeducedParamAttrs, ParameterizedOverTcx, ReprOptions, Ty, TyCtxt, UnusedGenericParams,
|
||||
self, DeducedParamAttrs, ParameterizedOverTcx, Ty, TyCtxt, UnusedGenericParams,
|
||||
};
|
||||
use rustc_middle::util::Providers;
|
||||
use rustc_middle::{mir, trivially_parameterized_over_tcx};
|
||||
|
@ -9,7 +9,7 @@ macro_rules! arena_types {
|
||||
($macro:path) => (
|
||||
$macro!([
|
||||
[] layout: rustc_abi::LayoutData<rustc_abi::FieldIdx, rustc_abi::VariantIdx>,
|
||||
[] fn_abi: rustc_target::abi::call::FnAbi<'tcx, rustc_middle::ty::Ty<'tcx>>,
|
||||
[] fn_abi: rustc_target::callconv::FnAbi<'tcx, rustc_middle::ty::Ty<'tcx>>,
|
||||
// AdtDef are interned and compared by address
|
||||
[decode] adt_def: rustc_middle::ty::AdtDefData,
|
||||
[] steal_thir: rustc_data_structures::steal::Steal<rustc_middle::thir::Thir<'tcx>>,
|
||||
|
@ -1,3 +1,4 @@
|
||||
use rustc_abi::ExternAbi;
|
||||
use rustc_ast::visit::{VisitorResult, walk_list};
|
||||
use rustc_data_structures::fingerprint::Fingerprint;
|
||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
||||
@ -12,7 +13,6 @@ use rustc_middle::hir::nested_filter;
|
||||
use rustc_span::def_id::StableCrateId;
|
||||
use rustc_span::symbol::{Ident, Symbol, kw, sym};
|
||||
use rustc_span::{ErrorGuaranteed, Span};
|
||||
use rustc_target::spec::abi::Abi;
|
||||
use {rustc_ast as ast, rustc_hir_pretty as pprust_hir};
|
||||
|
||||
use crate::hir::ModuleItems;
|
||||
@ -668,7 +668,7 @@ impl<'hir> Map<'hir> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_foreign_abi(self, hir_id: HirId) -> Abi {
|
||||
pub fn get_foreign_abi(self, hir_id: HirId) -> ExternAbi {
|
||||
let parent = self.get_parent_item(hir_id);
|
||||
if let OwnerNode::Item(Item { kind: ItemKind::ForeignMod { abi, .. }, .. }) =
|
||||
self.tcx.hir_owner_node(parent)
|
||||
|
@ -1,6 +1,6 @@
|
||||
use rustc_abi::{FieldIdx, VariantIdx};
|
||||
use rustc_hir::HirId;
|
||||
use rustc_macros::{HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable};
|
||||
use rustc_target::abi::{FieldIdx, VariantIdx};
|
||||
|
||||
use crate::ty;
|
||||
use crate::ty::Ty;
|
||||
|
@ -1,7 +1,7 @@
|
||||
use rustc_abi::Align;
|
||||
use rustc_attr::{InlineAttr, InstructionSetAttr, OptimizeAttr};
|
||||
use rustc_macros::{HashStable, TyDecodable, TyEncodable};
|
||||
use rustc_span::symbol::Symbol;
|
||||
use rustc_target::abi::Align;
|
||||
use rustc_target::spec::SanitizerSet;
|
||||
|
||||
use crate::mir::mono::Linkage;
|
||||
|
@ -1,12 +1,12 @@
|
||||
use std::fmt::{self, Debug, Display, Formatter};
|
||||
|
||||
use either::Either;
|
||||
use rustc_abi::{HasDataLayout, Size};
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_macros::{HashStable, Lift, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable};
|
||||
use rustc_session::RemapFileNameExt;
|
||||
use rustc_session::config::RemapPathScopeComponents;
|
||||
use rustc_span::{DUMMY_SP, Span};
|
||||
use rustc_target::abi::{HasDataLayout, Size};
|
||||
|
||||
use crate::mir::interpret::{AllocId, ConstAllocation, ErrorHandled, Scalar, alloc_range};
|
||||
use crate::mir::{Promoted, pretty_print_const_value};
|
||||
|
@ -12,10 +12,10 @@ use either::{Left, Right};
|
||||
use init_mask::*;
|
||||
pub use init_mask::{InitChunk, InitChunkIter};
|
||||
use provenance_map::*;
|
||||
use rustc_abi::{Align, HasDataLayout, Size};
|
||||
use rustc_ast::Mutability;
|
||||
use rustc_data_structures::intern::Interned;
|
||||
use rustc_macros::{HashStable, TyDecodable, TyEncodable};
|
||||
use rustc_target::abi::{Align, HasDataLayout, Size};
|
||||
|
||||
use super::{
|
||||
AllocId, BadBytesAccess, CtfeProvenance, InterpErrorKind, InterpResult, Pointer,
|
||||
|
@ -4,9 +4,9 @@ mod tests;
|
||||
use std::ops::Range;
|
||||
use std::{hash, iter};
|
||||
|
||||
use rustc_abi::Size;
|
||||
use rustc_macros::{HashStable, TyDecodable, TyEncodable};
|
||||
use rustc_serialize::{Decodable, Encodable};
|
||||
use rustc_target::abi::Size;
|
||||
use rustc_type_ir::{TyDecoder, TyEncoder};
|
||||
|
||||
use super::AllocRange;
|
||||
|
@ -3,10 +3,10 @@
|
||||
|
||||
use std::cmp;
|
||||
|
||||
use rustc_abi::{HasDataLayout, Size};
|
||||
use rustc_data_structures::sorted_map::SortedMap;
|
||||
use rustc_macros::HashStable;
|
||||
use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
|
||||
use rustc_target::abi::{HasDataLayout, Size};
|
||||
use tracing::trace;
|
||||
|
||||
use super::{AllocError, AllocRange, AllocResult, CtfeProvenance, Provenance, alloc_range};
|
||||
|
@ -4,6 +4,7 @@ use std::borrow::Cow;
|
||||
use std::{convert, fmt, mem, ops};
|
||||
|
||||
use either::Either;
|
||||
use rustc_abi::{Align, Size, VariantIdx, WrappingRange};
|
||||
use rustc_ast_ir::Mutability;
|
||||
use rustc_data_structures::sync::Lock;
|
||||
use rustc_errors::{DiagArgName, DiagArgValue, DiagMessage, ErrorGuaranteed, IntoDiagArg};
|
||||
@ -11,7 +12,6 @@ use rustc_macros::{HashStable, TyDecodable, TyEncodable};
|
||||
use rustc_session::CtfeBacktrace;
|
||||
use rustc_span::def_id::DefId;
|
||||
use rustc_span::{DUMMY_SP, Span, Symbol};
|
||||
use rustc_target::abi::{Align, Size, VariantIdx, WrappingRange, call};
|
||||
|
||||
use super::{AllocId, AllocRange, ConstAllocation, Pointer, Scalar};
|
||||
use crate::error;
|
||||
@ -217,7 +217,7 @@ pub enum InvalidProgramInfo<'tcx> {
|
||||
/// An error occurred during FnAbi computation: the passed --target lacks FFI support
|
||||
/// (which unfortunately typeck does not reject).
|
||||
/// Not using `FnAbiError` as that contains a nested `LayoutError`.
|
||||
FnAbiAdjustForForeignAbi(call::AdjustForForeignAbiError),
|
||||
FnAbiAdjustForForeignAbi(rustc_target::callconv::AdjustForForeignAbiError),
|
||||
}
|
||||
|
||||
/// Details of why a pointer had to be in-bounds.
|
||||
|
@ -12,6 +12,7 @@ use std::io::{Read, Write};
|
||||
use std::num::NonZero;
|
||||
use std::{fmt, io};
|
||||
|
||||
use rustc_abi::{AddressSpace, Endian, HasDataLayout};
|
||||
use rustc_ast::LitKind;
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_data_structures::sync::Lock;
|
||||
@ -20,7 +21,6 @@ use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
use rustc_macros::{HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable};
|
||||
use rustc_middle::ty::print::with_no_trimmed_paths;
|
||||
use rustc_serialize::{Decodable, Encodable};
|
||||
use rustc_target::abi::{AddressSpace, Endian, HasDataLayout};
|
||||
use tracing::{debug, trace};
|
||||
// Also make the error macros available from this module.
|
||||
pub use {
|
||||
|
@ -1,9 +1,9 @@
|
||||
use std::fmt;
|
||||
use std::num::NonZero;
|
||||
|
||||
use rustc_abi::{HasDataLayout, Size};
|
||||
use rustc_data_structures::static_assert_size;
|
||||
use rustc_macros::{HashStable, TyDecodable, TyEncodable};
|
||||
use rustc_target::abi::{HasDataLayout, Size};
|
||||
|
||||
use super::AllocId;
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
use std::fmt;
|
||||
|
||||
use either::{Either, Left, Right};
|
||||
use rustc_abi::{HasDataLayout, Size};
|
||||
use rustc_apfloat::Float;
|
||||
use rustc_apfloat::ieee::{Double, Half, Quad, Single};
|
||||
use rustc_macros::{HashStable, TyDecodable, TyEncodable};
|
||||
use rustc_target::abi::{HasDataLayout, Size};
|
||||
|
||||
use super::{
|
||||
AllocId, CtfeProvenance, InterpResult, Pointer, PointerArithmetic, Provenance,
|
||||
|
@ -10,6 +10,7 @@ use std::{iter, mem};
|
||||
pub use basic_blocks::BasicBlocks;
|
||||
use either::Either;
|
||||
use polonius_engine::Atom;
|
||||
use rustc_abi::{FieldIdx, VariantIdx};
|
||||
pub use rustc_ast::Mutability;
|
||||
use rustc_data_structures::captures::Captures;
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
@ -27,7 +28,6 @@ use rustc_serialize::{Decodable, Encodable};
|
||||
use rustc_span::source_map::Spanned;
|
||||
use rustc_span::symbol::Symbol;
|
||||
use rustc_span::{DUMMY_SP, Span};
|
||||
use rustc_target::abi::{FieldIdx, VariantIdx};
|
||||
use tracing::trace;
|
||||
|
||||
pub use self::query::*;
|
||||
|
@ -4,6 +4,7 @@ use std::fs;
|
||||
use std::io::{self, Write as _};
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use rustc_abi::Size;
|
||||
use rustc_ast::InlineAsmTemplatePiece;
|
||||
use rustc_middle::mir::interpret::{
|
||||
AllocBytes, AllocId, Allocation, GlobalAlloc, Pointer, Provenance, alloc_range,
|
||||
@ -11,7 +12,6 @@ use rustc_middle::mir::interpret::{
|
||||
};
|
||||
use rustc_middle::mir::visit::Visitor;
|
||||
use rustc_middle::mir::*;
|
||||
use rustc_target::abi::Size;
|
||||
use tracing::trace;
|
||||
|
||||
use super::graphviz::write_mir_fn_graphviz;
|
||||
|
@ -4,6 +4,7 @@ use std::cell::Cell;
|
||||
use std::fmt::{self, Debug};
|
||||
|
||||
use derive_where::derive_where;
|
||||
use rustc_abi::{FieldIdx, VariantIdx};
|
||||
use rustc_data_structures::fx::FxIndexMap;
|
||||
use rustc_errors::ErrorGuaranteed;
|
||||
use rustc_hir::def_id::LocalDefId;
|
||||
@ -12,7 +13,6 @@ use rustc_index::{Idx, IndexVec};
|
||||
use rustc_macros::{HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable};
|
||||
use rustc_span::Span;
|
||||
use rustc_span::symbol::Symbol;
|
||||
use rustc_target::abi::{FieldIdx, VariantIdx};
|
||||
use smallvec::SmallVec;
|
||||
|
||||
use super::{ConstValue, SourceInfo};
|
||||
|
@ -3,6 +3,7 @@
|
||||
//! This is in a dedicated file so that changes to this file can be reviewed more carefully.
|
||||
//! The intention is that this file only contains datatype declarations, no code.
|
||||
|
||||
use rustc_abi::{FieldIdx, VariantIdx};
|
||||
use rustc_ast::{InlineAsmOptions, InlineAsmTemplatePiece, Mutability};
|
||||
use rustc_data_structures::packed::Pu128;
|
||||
use rustc_hir::CoroutineKind;
|
||||
@ -13,7 +14,6 @@ use rustc_span::Span;
|
||||
use rustc_span::def_id::LocalDefId;
|
||||
use rustc_span::source_map::Spanned;
|
||||
use rustc_span::symbol::Symbol;
|
||||
use rustc_target::abi::{FieldIdx, VariantIdx};
|
||||
use rustc_target::asm::InlineAsmRegOrRegClass;
|
||||
use smallvec::SmallVec;
|
||||
|
||||
|
@ -132,12 +132,10 @@ impl EraseType for Result<bool, &ty::layout::LayoutError<'_>> {
|
||||
type Result = [u8; size_of::<Result<bool, &'static ty::layout::LayoutError<'static>>>()];
|
||||
}
|
||||
|
||||
impl EraseType
|
||||
for Result<rustc_target::abi::TyAndLayout<'_, Ty<'_>>, &ty::layout::LayoutError<'_>>
|
||||
{
|
||||
impl EraseType for Result<rustc_abi::TyAndLayout<'_, Ty<'_>>, &ty::layout::LayoutError<'_>> {
|
||||
type Result = [u8; size_of::<
|
||||
Result<
|
||||
rustc_target::abi::TyAndLayout<'static, Ty<'static>>,
|
||||
rustc_abi::TyAndLayout<'static, Ty<'static>>,
|
||||
&'static ty::layout::LayoutError<'static>,
|
||||
>,
|
||||
>()];
|
||||
@ -253,13 +251,14 @@ trivial! {
|
||||
Option<rustc_span::def_id::DefId>,
|
||||
Option<rustc_span::def_id::LocalDefId>,
|
||||
Option<rustc_span::Span>,
|
||||
Option<rustc_target::abi::FieldIdx>,
|
||||
Option<rustc_abi::FieldIdx>,
|
||||
Option<rustc_target::spec::PanicStrategy>,
|
||||
Option<usize>,
|
||||
Option<rustc_middle::ty::IntrinsicDef>,
|
||||
Result<(), rustc_errors::ErrorGuaranteed>,
|
||||
Result<(), rustc_middle::traits::query::NoSolution>,
|
||||
Result<rustc_middle::traits::EvaluationResult, rustc_middle::traits::OverflowError>,
|
||||
rustc_abi::ReprOptions,
|
||||
rustc_ast::expand::allocator::AllocatorKind,
|
||||
rustc_attr::ConstStability,
|
||||
rustc_attr::DefaultBodyStability,
|
||||
@ -311,7 +310,6 @@ trivial! {
|
||||
rustc_middle::ty::fast_reject::SimplifiedType,
|
||||
rustc_middle::ty::ImplPolarity,
|
||||
rustc_middle::ty::Representability,
|
||||
rustc_middle::ty::ReprOptions,
|
||||
rustc_middle::ty::UnusedGenericParams,
|
||||
rustc_middle::ty::util::AlwaysRequiresDrop,
|
||||
rustc_middle::ty::Visibility<rustc_span::def_id::DefId>,
|
||||
|
@ -5,7 +5,6 @@ use rustc_hir::hir_id::{HirId, OwnerId};
|
||||
use rustc_query_system::query::{DefIdCache, DefaultCache, SingleCache, VecCache};
|
||||
use rustc_span::symbol::{Ident, Symbol};
|
||||
use rustc_span::{DUMMY_SP, Span};
|
||||
use rustc_target::abi;
|
||||
|
||||
use crate::infer::canonical::CanonicalQueryInput;
|
||||
use crate::ty::fast_reject::SimplifiedType;
|
||||
@ -509,7 +508,7 @@ impl<'tcx> Key for (DefId, Ty<'tcx>, GenericArgsRef<'tcx>, ty::ParamEnv<'tcx>) {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> Key for (Ty<'tcx>, abi::VariantIdx) {
|
||||
impl<'tcx> Key for (Ty<'tcx>, rustc_abi::VariantIdx) {
|
||||
type Cache<V> = DefaultCache<Self, V>;
|
||||
|
||||
fn default_span(&self, _tcx: TyCtxt<'_>) -> Span {
|
||||
|
@ -42,9 +42,8 @@ use rustc_session::lint::LintExpectationId;
|
||||
use rustc_span::def_id::LOCAL_CRATE;
|
||||
use rustc_span::symbol::Symbol;
|
||||
use rustc_span::{DUMMY_SP, Span};
|
||||
use rustc_target::abi;
|
||||
use rustc_target::spec::PanicStrategy;
|
||||
use {rustc_ast as ast, rustc_attr as attr, rustc_hir as hir};
|
||||
use {rustc_abi as abi, rustc_ast as ast, rustc_attr as attr, rustc_hir as hir};
|
||||
|
||||
use crate::infer::canonical::{self, Canonical};
|
||||
use crate::lint::LintExpectation;
|
||||
@ -1465,7 +1464,7 @@ rustc_queries! {
|
||||
/// instead, where the instance is an `InstanceKind::Virtual`.
|
||||
query fn_abi_of_fn_ptr(
|
||||
key: ty::ParamEnvAnd<'tcx, (ty::PolyFnSig<'tcx>, &'tcx ty::List<Ty<'tcx>>)>
|
||||
) -> Result<&'tcx abi::call::FnAbi<'tcx, Ty<'tcx>>, &'tcx ty::layout::FnAbiError<'tcx>> {
|
||||
) -> Result<&'tcx rustc_target::callconv::FnAbi<'tcx, Ty<'tcx>>, &'tcx ty::layout::FnAbiError<'tcx>> {
|
||||
desc { "computing call ABI of `{}` function pointers", key.value.0 }
|
||||
}
|
||||
|
||||
@ -1476,7 +1475,7 @@ rustc_queries! {
|
||||
/// to an `InstanceKind::Virtual` instance (of `<dyn Trait as Trait>::fn`).
|
||||
query fn_abi_of_instance(
|
||||
key: ty::ParamEnvAnd<'tcx, (ty::Instance<'tcx>, &'tcx ty::List<Ty<'tcx>>)>
|
||||
) -> Result<&'tcx abi::call::FnAbi<'tcx, Ty<'tcx>>, &'tcx ty::layout::FnAbiError<'tcx>> {
|
||||
) -> Result<&'tcx rustc_target::callconv::FnAbi<'tcx, Ty<'tcx>>, &'tcx ty::layout::FnAbiError<'tcx>> {
|
||||
desc { "computing call ABI of `{}`", key.value.0 }
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,7 @@ use std::cmp::Ordering;
|
||||
use std::fmt;
|
||||
use std::ops::Index;
|
||||
|
||||
use rustc_abi::{FieldIdx, Integer, Size, VariantIdx};
|
||||
use rustc_ast::{AsmMacro, InlineAsmOptions, InlineAsmTemplatePiece};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::DefId;
|
||||
@ -29,7 +30,6 @@ use rustc_middle::ty::{
|
||||
};
|
||||
use rustc_span::def_id::LocalDefId;
|
||||
use rustc_span::{ErrorGuaranteed, Span, Symbol};
|
||||
use rustc_target::abi::{FieldIdx, Integer, Size, VariantIdx};
|
||||
use rustc_target::asm::InlineAsmRegOrRegClass;
|
||||
use tracing::instrument;
|
||||
|
||||
@ -1063,7 +1063,7 @@ impl<'tcx> PatRangeBoundary<'tcx> {
|
||||
a.partial_cmp(&b)
|
||||
}
|
||||
ty::Int(ity) => {
|
||||
let size = rustc_target::abi::Integer::from_int_ty(&tcx, *ity).size();
|
||||
let size = rustc_abi::Integer::from_int_ty(&tcx, *ity).size();
|
||||
let a = size.sign_extend(a) as i128;
|
||||
let b = size.sign_extend(b) as i128;
|
||||
Some(a.cmp(&b))
|
||||
|
@ -1,8 +1,8 @@
|
||||
use rustc_abi::FieldIdx;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::lang_items::LangItem;
|
||||
use rustc_macros::{HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable};
|
||||
use rustc_span::Span;
|
||||
use rustc_target::abi::FieldIdx;
|
||||
|
||||
use crate::ty::{self, Ty, TyCtxt};
|
||||
|
||||
|
@ -3,6 +3,7 @@ use std::hash::{Hash, Hasher};
|
||||
use std::ops::Range;
|
||||
use std::str;
|
||||
|
||||
use rustc_abi::{FIRST_VARIANT, ReprOptions, VariantIdx};
|
||||
use rustc_data_structures::captures::Captures;
|
||||
use rustc_data_structures::fingerprint::Fingerprint;
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
@ -17,7 +18,6 @@ use rustc_macros::{HashStable, TyDecodable, TyEncodable};
|
||||
use rustc_query_system::ich::StableHashingContext;
|
||||
use rustc_session::DataTypeKind;
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_target::abi::{FIRST_VARIANT, ReprOptions, VariantIdx};
|
||||
use tracing::{debug, info, trace};
|
||||
|
||||
use super::{
|
||||
|
@ -10,12 +10,12 @@ use std::hash::Hash;
|
||||
use std::intrinsics;
|
||||
use std::marker::DiscriminantKind;
|
||||
|
||||
use rustc_abi::{FieldIdx, VariantIdx};
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_hir::def_id::LocalDefId;
|
||||
use rustc_middle::ty::TyCtxt;
|
||||
use rustc_serialize::{Decodable, Encodable};
|
||||
use rustc_span::Span;
|
||||
use rustc_target::abi::{FieldIdx, VariantIdx};
|
||||
pub use rustc_type_ir::{TyDecoder, TyEncoder};
|
||||
|
||||
use crate::arena::ArenaAllocatable;
|
||||
|
@ -1,11 +1,11 @@
|
||||
use std::fmt;
|
||||
use std::num::NonZero;
|
||||
|
||||
use rustc_abi::Size;
|
||||
use rustc_apfloat::Float;
|
||||
use rustc_apfloat::ieee::{Double, Half, Quad, Single};
|
||||
use rustc_errors::{DiagArgValue, IntoDiagArg};
|
||||
use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
|
||||
use rustc_target::abi::Size;
|
||||
|
||||
use crate::ty::TyCtxt;
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user