mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
Rollup merge of #132385 - workingjubilee:move-abi-to-rustc-abi, r=jieyouxu,compiler-errors
compiler: Move `rustc_target::spec::abi::Abi` to `rustc_abi::ExternAbi` Lift `enum Abi` from its rather odd place in the middle of rustc_target, and make it available again from rustc_abi. You know, the crate where you would expect the enum that describes all the ABIs to be? The platform-neutral ones, at least. This will help further refactoring of how we handle ABIs in the near future[^0]. Rename `Abi` to `ExternAbi` because quite a lot of the compiler overloads the concept of "ABI" enough that the existing name is imprecise and it is often renamed _anyway_. Often this was to avoid conflicts with the *other* type formerly known as `Abi` (now named BackendRepr[^1]), but sometimes it is just for clarity, and this name seems more self-explanatory. It does get reexported, though, using its old name, to reduce the odds of merge-conflicting over the entire tree. All of `ExternAbi`'s friends come along for the ride, which costs adding some optional dependencies to the rustc_abi crate. However, all of this also allows simply moving three crates entirely off rustc_target: - rustc_hir_pretty - rustc_lint_defs - rustc_mir_build This odd selection is mostly to demonstrate a secondary motivation: The majority of the front-end of the compiler should be as target-agnostic as possible, and it is easier to assure this if they simply don't depend on the crate that describes targets. Note that I didn't migrate crates that don't benefit from it in this way yet, and I didn't survey every last crate. [^0]: This is being undertaken as part of https://github.com/rust-lang/rust/issues/119183 [^1]: https://github.com/rust-lang/rust/pull/132246
This commit is contained in:
commit
6da4221d96
@ -3204,9 +3204,11 @@ dependencies = [
|
|||||||
"rand",
|
"rand",
|
||||||
"rand_xoshiro",
|
"rand_xoshiro",
|
||||||
"rustc_data_structures",
|
"rustc_data_structures",
|
||||||
|
"rustc_feature",
|
||||||
"rustc_index",
|
"rustc_index",
|
||||||
"rustc_macros",
|
"rustc_macros",
|
||||||
"rustc_serialize",
|
"rustc_serialize",
|
||||||
|
"rustc_span",
|
||||||
"tracing",
|
"tracing",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -3749,11 +3751,11 @@ dependencies = [
|
|||||||
name = "rustc_hir_pretty"
|
name = "rustc_hir_pretty"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"rustc_abi",
|
||||||
"rustc_ast",
|
"rustc_ast",
|
||||||
"rustc_ast_pretty",
|
"rustc_ast_pretty",
|
||||||
"rustc_hir",
|
"rustc_hir",
|
||||||
"rustc_span",
|
"rustc_span",
|
||||||
"rustc_target",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -3938,6 +3940,7 @@ dependencies = [
|
|||||||
name = "rustc_lint_defs"
|
name = "rustc_lint_defs"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"rustc_abi",
|
||||||
"rustc_ast",
|
"rustc_ast",
|
||||||
"rustc_data_structures",
|
"rustc_data_structures",
|
||||||
"rustc_error_messages",
|
"rustc_error_messages",
|
||||||
@ -3945,7 +3948,6 @@ dependencies = [
|
|||||||
"rustc_macros",
|
"rustc_macros",
|
||||||
"rustc_serialize",
|
"rustc_serialize",
|
||||||
"rustc_span",
|
"rustc_span",
|
||||||
"rustc_target",
|
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -4054,6 +4056,7 @@ version = "0.0.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"either",
|
"either",
|
||||||
"itertools",
|
"itertools",
|
||||||
|
"rustc_abi",
|
||||||
"rustc_apfloat",
|
"rustc_apfloat",
|
||||||
"rustc_arena",
|
"rustc_arena",
|
||||||
"rustc_ast",
|
"rustc_ast",
|
||||||
@ -4069,7 +4072,6 @@ dependencies = [
|
|||||||
"rustc_pattern_analysis",
|
"rustc_pattern_analysis",
|
||||||
"rustc_session",
|
"rustc_session",
|
||||||
"rustc_span",
|
"rustc_span",
|
||||||
"rustc_target",
|
|
||||||
"rustc_trait_selection",
|
"rustc_trait_selection",
|
||||||
"tracing",
|
"tracing",
|
||||||
]
|
]
|
||||||
|
@ -9,9 +9,11 @@ bitflags = "2.4.1"
|
|||||||
rand = { version = "0.8.4", default-features = false, optional = true }
|
rand = { version = "0.8.4", default-features = false, optional = true }
|
||||||
rand_xoshiro = { version = "0.6.0", optional = true }
|
rand_xoshiro = { version = "0.6.0", optional = true }
|
||||||
rustc_data_structures = { path = "../rustc_data_structures", optional = true }
|
rustc_data_structures = { path = "../rustc_data_structures", optional = true }
|
||||||
|
rustc_feature = { path = "../rustc_feature", optional = true }
|
||||||
rustc_index = { path = "../rustc_index", default-features = false }
|
rustc_index = { path = "../rustc_index", default-features = false }
|
||||||
rustc_macros = { path = "../rustc_macros", optional = true }
|
rustc_macros = { path = "../rustc_macros", optional = true }
|
||||||
rustc_serialize = { path = "../rustc_serialize", optional = true }
|
rustc_serialize = { path = "../rustc_serialize", optional = true }
|
||||||
|
rustc_span = { path = "../rustc_span", optional = true }
|
||||||
tracing = "0.1"
|
tracing = "0.1"
|
||||||
# tidy-alphabetical-end
|
# tidy-alphabetical-end
|
||||||
|
|
||||||
@ -22,8 +24,10 @@ default = ["nightly", "randomize"]
|
|||||||
# without depending on rustc_data_structures, rustc_macros and rustc_serialize
|
# without depending on rustc_data_structures, rustc_macros and rustc_serialize
|
||||||
nightly = [
|
nightly = [
|
||||||
"dep:rustc_data_structures",
|
"dep:rustc_data_structures",
|
||||||
|
"dep:rustc_feature",
|
||||||
"dep:rustc_macros",
|
"dep:rustc_macros",
|
||||||
"dep:rustc_serialize",
|
"dep:rustc_serialize",
|
||||||
|
"dep:rustc_span",
|
||||||
"rustc_index/nightly",
|
"rustc_index/nightly",
|
||||||
]
|
]
|
||||||
randomize = ["dep:rand", "dep:rand_xoshiro", "nightly"]
|
randomize = ["dep:rand", "dep:rand_xoshiro", "nightly"]
|
||||||
|
@ -7,9 +7,11 @@ use rustc_span::{Span, Symbol};
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests;
|
mod tests;
|
||||||
|
|
||||||
|
use ExternAbi as Abi;
|
||||||
|
|
||||||
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy, Debug)]
|
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy, Debug)]
|
||||||
#[derive(HashStable_Generic, Encodable, Decodable)]
|
#[derive(HashStable_Generic, Encodable, Decodable)]
|
||||||
pub enum Abi {
|
pub enum ExternAbi {
|
||||||
// Some of the ABIs come first because every time we add a new ABI, we have to re-bless all the
|
// Some of the ABIs come first because every time we add a new ABI, we have to re-bless all the
|
||||||
// hashing tests. These are used in many places, so giving them stable values reduces test
|
// hashing tests. These are used in many places, so giving them stable values reduces test
|
||||||
// churn. The specific values are meaningless.
|
// churn. The specific values are meaningless.
|
@ -1,6 +1,7 @@
|
|||||||
// tidy-alphabetical-start
|
// tidy-alphabetical-start
|
||||||
#![cfg_attr(feature = "nightly", allow(internal_features))]
|
#![cfg_attr(feature = "nightly", allow(internal_features))]
|
||||||
#![cfg_attr(feature = "nightly", doc(rust_logo))]
|
#![cfg_attr(feature = "nightly", doc(rust_logo))]
|
||||||
|
#![cfg_attr(feature = "nightly", feature(assert_matches))]
|
||||||
#![cfg_attr(feature = "nightly", feature(rustc_attrs))]
|
#![cfg_attr(feature = "nightly", feature(rustc_attrs))]
|
||||||
#![cfg_attr(feature = "nightly", feature(rustdoc_internals))]
|
#![cfg_attr(feature = "nightly", feature(rustdoc_internals))]
|
||||||
#![cfg_attr(feature = "nightly", feature(step_trait))]
|
#![cfg_attr(feature = "nightly", feature(step_trait))]
|
||||||
@ -28,8 +29,15 @@ mod layout;
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests;
|
mod tests;
|
||||||
|
|
||||||
|
#[cfg(feature = "nightly")]
|
||||||
|
mod extern_abi;
|
||||||
|
|
||||||
pub use callconv::{Heterogeneous, HomogeneousAggregate, Reg, RegKind};
|
pub use callconv::{Heterogeneous, HomogeneousAggregate, Reg, RegKind};
|
||||||
#[cfg(feature = "nightly")]
|
#[cfg(feature = "nightly")]
|
||||||
|
pub use extern_abi::{
|
||||||
|
AbiDisabled, AbiUnsupported, ExternAbi, all_names, enabled_names, is_enabled, is_stable, lookup,
|
||||||
|
};
|
||||||
|
#[cfg(feature = "nightly")]
|
||||||
pub use layout::{FIRST_VARIANT, FieldIdx, Layout, TyAbiInterface, TyAndLayout, VariantIdx};
|
pub use layout::{FIRST_VARIANT, FieldIdx, Layout, TyAbiInterface, TyAndLayout, VariantIdx};
|
||||||
pub use layout::{LayoutCalculator, LayoutCalculatorError};
|
pub use layout::{LayoutCalculator, LayoutCalculatorError};
|
||||||
|
|
||||||
|
@ -5,9 +5,9 @@ edition = "2021"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# tidy-alphabetical-start
|
# tidy-alphabetical-start
|
||||||
|
rustc_abi = { path = "../rustc_abi" }
|
||||||
rustc_ast = { path = "../rustc_ast" }
|
rustc_ast = { path = "../rustc_ast" }
|
||||||
rustc_ast_pretty = { path = "../rustc_ast_pretty" }
|
rustc_ast_pretty = { path = "../rustc_ast_pretty" }
|
||||||
rustc_hir = { path = "../rustc_hir" }
|
rustc_hir = { path = "../rustc_hir" }
|
||||||
rustc_span = { path = "../rustc_span" }
|
rustc_span = { path = "../rustc_span" }
|
||||||
rustc_target = { path = "../rustc_target" }
|
|
||||||
# tidy-alphabetical-end
|
# tidy-alphabetical-end
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
use std::vec;
|
use std::vec;
|
||||||
|
|
||||||
|
use rustc_abi::ExternAbi;
|
||||||
use rustc_ast::util::parser::{self, AssocOp, Fixity};
|
use rustc_ast::util::parser::{self, AssocOp, Fixity};
|
||||||
use rustc_ast_pretty::pp::Breaks::{Consistent, Inconsistent};
|
use rustc_ast_pretty::pp::Breaks::{Consistent, Inconsistent};
|
||||||
use rustc_ast_pretty::pp::{self, Breaks};
|
use rustc_ast_pretty::pp::{self, Breaks};
|
||||||
@ -20,7 +21,6 @@ use rustc_hir::{
|
|||||||
use rustc_span::FileName;
|
use rustc_span::FileName;
|
||||||
use rustc_span::source_map::SourceMap;
|
use rustc_span::source_map::SourceMap;
|
||||||
use rustc_span::symbol::{Ident, Symbol, kw};
|
use rustc_span::symbol::{Ident, Symbol, kw};
|
||||||
use rustc_target::spec::abi::Abi;
|
|
||||||
use {rustc_ast as ast, rustc_hir as hir};
|
use {rustc_ast as ast, rustc_hir as hir};
|
||||||
|
|
||||||
pub fn id_to_string(map: &dyn rustc_hir::intravisit::Map<'_>, hir_id: HirId) -> String {
|
pub fn id_to_string(map: &dyn rustc_hir::intravisit::Map<'_>, hir_id: HirId) -> String {
|
||||||
@ -2240,7 +2240,7 @@ impl<'a> State<'a> {
|
|||||||
|
|
||||||
fn print_ty_fn(
|
fn print_ty_fn(
|
||||||
&mut self,
|
&mut self,
|
||||||
abi: Abi,
|
abi: ExternAbi,
|
||||||
safety: hir::Safety,
|
safety: hir::Safety,
|
||||||
decl: &hir::FnDecl<'_>,
|
decl: &hir::FnDecl<'_>,
|
||||||
name: Option<Symbol>,
|
name: Option<Symbol>,
|
||||||
@ -2276,7 +2276,7 @@ impl<'a> State<'a> {
|
|||||||
|
|
||||||
self.print_safety(header.safety);
|
self.print_safety(header.safety);
|
||||||
|
|
||||||
if header.abi != Abi::Rust {
|
if header.abi != ExternAbi::Rust {
|
||||||
self.word_nbsp("extern");
|
self.word_nbsp("extern");
|
||||||
self.word_nbsp(header.abi.to_string());
|
self.word_nbsp(header.abi.to_string());
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ edition = "2021"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# tidy-alphabetical-start
|
# tidy-alphabetical-start
|
||||||
|
rustc_abi = { path = "../rustc_abi" }
|
||||||
rustc_ast = { path = "../rustc_ast" }
|
rustc_ast = { path = "../rustc_ast" }
|
||||||
rustc_data_structures = { path = "../rustc_data_structures" }
|
rustc_data_structures = { path = "../rustc_data_structures" }
|
||||||
rustc_error_messages = { path = "../rustc_error_messages" }
|
rustc_error_messages = { path = "../rustc_error_messages" }
|
||||||
@ -12,6 +13,5 @@ rustc_hir = { path = "../rustc_hir" }
|
|||||||
rustc_macros = { path = "../rustc_macros" }
|
rustc_macros = { path = "../rustc_macros" }
|
||||||
rustc_serialize = { path = "../rustc_serialize" }
|
rustc_serialize = { path = "../rustc_serialize" }
|
||||||
rustc_span = { path = "../rustc_span" }
|
rustc_span = { path = "../rustc_span" }
|
||||||
rustc_target = { path = "../rustc_target" }
|
|
||||||
serde = { version = "1.0.125", features = ["derive"] }
|
serde = { version = "1.0.125", features = ["derive"] }
|
||||||
# tidy-alphabetical-end
|
# tidy-alphabetical-end
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#![warn(unreachable_pub)]
|
#![warn(unreachable_pub)]
|
||||||
// tidy-alphabetical-end
|
// tidy-alphabetical-end
|
||||||
|
|
||||||
|
use rustc_abi::ExternAbi;
|
||||||
use rustc_ast::node_id::NodeId;
|
use rustc_ast::node_id::NodeId;
|
||||||
use rustc_ast::{AttrId, Attribute};
|
use rustc_ast::{AttrId, Attribute};
|
||||||
use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
|
use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
|
||||||
@ -15,7 +16,6 @@ use rustc_macros::{Decodable, Encodable, HashStable_Generic};
|
|||||||
pub use rustc_span::edition::Edition;
|
pub use rustc_span::edition::Edition;
|
||||||
use rustc_span::symbol::{Ident, MacroRulesNormalizedIdent};
|
use rustc_span::symbol::{Ident, MacroRulesNormalizedIdent};
|
||||||
use rustc_span::{Span, Symbol, sym};
|
use rustc_span::{Span, Symbol, sym};
|
||||||
use rustc_target::spec::abi::Abi;
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
pub use self::Level::*;
|
pub use self::Level::*;
|
||||||
@ -602,7 +602,7 @@ pub enum BuiltinLintDiag {
|
|||||||
path: String,
|
path: String,
|
||||||
since_kind: DeprecatedSinceKind,
|
since_kind: DeprecatedSinceKind,
|
||||||
},
|
},
|
||||||
MissingAbi(Span, Abi),
|
MissingAbi(Span, ExternAbi),
|
||||||
UnusedDocComment(Span),
|
UnusedDocComment(Span),
|
||||||
UnusedBuiltinAttribute {
|
UnusedBuiltinAttribute {
|
||||||
attr_name: Symbol,
|
attr_name: Symbol,
|
||||||
|
@ -7,6 +7,8 @@ edition = "2021"
|
|||||||
# tidy-alphabetical-start
|
# tidy-alphabetical-start
|
||||||
either = "1.5.0"
|
either = "1.5.0"
|
||||||
itertools = "0.12"
|
itertools = "0.12"
|
||||||
|
|
||||||
|
rustc_abi = { path = "../rustc_abi" }
|
||||||
rustc_apfloat = "0.2.0"
|
rustc_apfloat = "0.2.0"
|
||||||
rustc_arena = { path = "../rustc_arena" }
|
rustc_arena = { path = "../rustc_arena" }
|
||||||
rustc_ast = { path = "../rustc_ast" }
|
rustc_ast = { path = "../rustc_ast" }
|
||||||
@ -22,7 +24,6 @@ rustc_middle = { path = "../rustc_middle" }
|
|||||||
rustc_pattern_analysis = { path = "../rustc_pattern_analysis" }
|
rustc_pattern_analysis = { path = "../rustc_pattern_analysis" }
|
||||||
rustc_session = { path = "../rustc_session" }
|
rustc_session = { path = "../rustc_session" }
|
||||||
rustc_span = { path = "../rustc_span" }
|
rustc_span = { path = "../rustc_span" }
|
||||||
rustc_target = { path = "../rustc_target" }
|
|
||||||
rustc_trait_selection = { path = "../rustc_trait_selection" }
|
rustc_trait_selection = { path = "../rustc_trait_selection" }
|
||||||
tracing = "0.1"
|
tracing = "0.1"
|
||||||
# tidy-alphabetical-end
|
# tidy-alphabetical-end
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
use rustc_abi::{FieldIdx, VariantIdx};
|
||||||
use rustc_middle::mir::interpret::Scalar;
|
use rustc_middle::mir::interpret::Scalar;
|
||||||
use rustc_middle::mir::tcx::PlaceTy;
|
use rustc_middle::mir::tcx::PlaceTy;
|
||||||
use rustc_middle::mir::*;
|
use rustc_middle::mir::*;
|
||||||
@ -6,7 +7,6 @@ use rustc_middle::ty;
|
|||||||
use rustc_middle::ty::cast::mir_cast_kind;
|
use rustc_middle::ty::cast::mir_cast_kind;
|
||||||
use rustc_span::Span;
|
use rustc_span::Span;
|
||||||
use rustc_span::source_map::Spanned;
|
use rustc_span::source_map::Spanned;
|
||||||
use rustc_target::abi::{FieldIdx, VariantIdx};
|
|
||||||
|
|
||||||
use super::{PResult, ParseCtxt, parse_by_kind};
|
use super::{PResult, ParseCtxt, parse_by_kind};
|
||||||
use crate::build::custom::ParseError;
|
use crate::build::custom::ParseError;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
//! See docs in build/expr/mod.rs
|
//! See docs in build/expr/mod.rs
|
||||||
|
|
||||||
|
use rustc_abi::Size;
|
||||||
use rustc_ast as ast;
|
use rustc_ast as ast;
|
||||||
use rustc_hir::LangItem;
|
use rustc_hir::LangItem;
|
||||||
use rustc_middle::mir::interpret::{
|
use rustc_middle::mir::interpret::{
|
||||||
@ -11,7 +12,6 @@ use rustc_middle::ty::{
|
|||||||
self, CanonicalUserType, CanonicalUserTypeAnnotation, Ty, TyCtxt, UserTypeAnnotationIndex,
|
self, CanonicalUserType, CanonicalUserTypeAnnotation, Ty, TyCtxt, UserTypeAnnotationIndex,
|
||||||
};
|
};
|
||||||
use rustc_middle::{bug, mir, span_bug};
|
use rustc_middle::{bug, mir, span_bug};
|
||||||
use rustc_target::abi::Size;
|
|
||||||
use tracing::{instrument, trace};
|
use tracing::{instrument, trace};
|
||||||
|
|
||||||
use crate::build::{Builder, parse_float_into_constval};
|
use crate::build::{Builder, parse_float_into_constval};
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
use std::assert_matches::assert_matches;
|
use std::assert_matches::assert_matches;
|
||||||
use std::iter;
|
use std::iter;
|
||||||
|
|
||||||
|
use rustc_abi::{FIRST_VARIANT, FieldIdx, VariantIdx};
|
||||||
use rustc_hir::def_id::LocalDefId;
|
use rustc_hir::def_id::LocalDefId;
|
||||||
use rustc_middle::hir::place::{Projection as HirProjection, ProjectionKind as HirProjectionKind};
|
use rustc_middle::hir::place::{Projection as HirProjection, ProjectionKind as HirProjectionKind};
|
||||||
use rustc_middle::middle::region;
|
use rustc_middle::middle::region;
|
||||||
@ -12,7 +13,6 @@ use rustc_middle::thir::*;
|
|||||||
use rustc_middle::ty::{self, AdtDef, CanonicalUserTypeAnnotation, Ty, Variance};
|
use rustc_middle::ty::{self, AdtDef, CanonicalUserTypeAnnotation, Ty, Variance};
|
||||||
use rustc_middle::{bug, span_bug};
|
use rustc_middle::{bug, span_bug};
|
||||||
use rustc_span::Span;
|
use rustc_span::Span;
|
||||||
use rustc_target::abi::{FIRST_VARIANT, FieldIdx, VariantIdx};
|
|
||||||
use tracing::{debug, instrument, trace};
|
use tracing::{debug, instrument, trace};
|
||||||
|
|
||||||
use crate::build::ForGuard::{OutsideGuard, RefWithinGuard};
|
use crate::build::ForGuard::{OutsideGuard, RefWithinGuard};
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
//! See docs in `build/expr/mod.rs`.
|
//! See docs in `build/expr/mod.rs`.
|
||||||
|
|
||||||
|
use rustc_abi::{BackendRepr, FieldIdx, Primitive};
|
||||||
use rustc_hir::lang_items::LangItem;
|
use rustc_hir::lang_items::LangItem;
|
||||||
use rustc_index::{Idx, IndexVec};
|
use rustc_index::{Idx, IndexVec};
|
||||||
use rustc_middle::bug;
|
use rustc_middle::bug;
|
||||||
@ -13,7 +14,6 @@ use rustc_middle::ty::util::IntTypeExt;
|
|||||||
use rustc_middle::ty::{self, Ty, UpvarArgs};
|
use rustc_middle::ty::{self, Ty, UpvarArgs};
|
||||||
use rustc_span::source_map::Spanned;
|
use rustc_span::source_map::Spanned;
|
||||||
use rustc_span::{DUMMY_SP, Span};
|
use rustc_span::{DUMMY_SP, Span};
|
||||||
use rustc_target::abi::{BackendRepr, FieldIdx, Primitive};
|
|
||||||
use tracing::debug;
|
use tracing::debug;
|
||||||
|
|
||||||
use crate::build::expr::as_place::PlaceBase;
|
use crate::build::expr::as_place::PlaceBase;
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
//! This also includes code for pattern bindings in `let` statements and
|
//! This also includes code for pattern bindings in `let` statements and
|
||||||
//! function parameters.
|
//! function parameters.
|
||||||
|
|
||||||
|
use rustc_abi::VariantIdx;
|
||||||
use rustc_data_structures::fx::FxIndexMap;
|
use rustc_data_structures::fx::FxIndexMap;
|
||||||
use rustc_data_structures::stack::ensure_sufficient_stack;
|
use rustc_data_structures::stack::ensure_sufficient_stack;
|
||||||
use rustc_hir::{BindingMode, ByRef};
|
use rustc_hir::{BindingMode, ByRef};
|
||||||
@ -15,7 +16,6 @@ use rustc_middle::thir::{self, *};
|
|||||||
use rustc_middle::ty::{self, CanonicalUserTypeAnnotation, Ty};
|
use rustc_middle::ty::{self, CanonicalUserTypeAnnotation, Ty};
|
||||||
use rustc_span::symbol::Symbol;
|
use rustc_span::symbol::Symbol;
|
||||||
use rustc_span::{BytePos, Pos, Span};
|
use rustc_span::{BytePos, Pos, Span};
|
||||||
use rustc_target::abi::VariantIdx;
|
|
||||||
use tracing::{debug, instrument};
|
use tracing::{debug, instrument};
|
||||||
|
|
||||||
use crate::build::ForGuard::{self, OutsideGuard, RefWithinGuard};
|
use crate::build::ForGuard::{self, OutsideGuard, RefWithinGuard};
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
|
use rustc_abi::{ExternAbi, FieldIdx};
|
||||||
use rustc_apfloat::Float;
|
use rustc_apfloat::Float;
|
||||||
use rustc_apfloat::ieee::{Double, Half, Quad, Single};
|
use rustc_apfloat::ieee::{Double, Half, Quad, Single};
|
||||||
use rustc_ast::attr;
|
use rustc_ast::attr;
|
||||||
@ -20,8 +21,6 @@ use rustc_middle::ty::{self, ScalarInt, Ty, TyCtxt, TypeVisitableExt, TypingMode
|
|||||||
use rustc_middle::{bug, span_bug};
|
use rustc_middle::{bug, span_bug};
|
||||||
use rustc_span::symbol::sym;
|
use rustc_span::symbol::sym;
|
||||||
use rustc_span::{Span, Symbol};
|
use rustc_span::{Span, Symbol};
|
||||||
use rustc_target::abi::FieldIdx;
|
|
||||||
use rustc_target::spec::abi::Abi;
|
|
||||||
|
|
||||||
use super::lints;
|
use super::lints;
|
||||||
use crate::build::expr::as_place::PlaceBuilder;
|
use crate::build::expr::as_place::PlaceBuilder;
|
||||||
@ -467,7 +466,7 @@ fn construct_fn<'tcx>(
|
|||||||
if let DefKind::Closure = tcx.def_kind(fn_def) {
|
if let DefKind::Closure = tcx.def_kind(fn_def) {
|
||||||
// HACK(eddyb) Avoid having RustCall on closures,
|
// HACK(eddyb) Avoid having RustCall on closures,
|
||||||
// as it adds unnecessary (and wrong) auto-tupling.
|
// as it adds unnecessary (and wrong) auto-tupling.
|
||||||
abi = Abi::Rust;
|
abi = ExternAbi::Rust;
|
||||||
}
|
}
|
||||||
|
|
||||||
let arguments = &thir.params;
|
let arguments = &thir.params;
|
||||||
@ -540,7 +539,7 @@ fn construct_fn<'tcx>(
|
|||||||
|
|
||||||
let mut body = builder.finish();
|
let mut body = builder.finish();
|
||||||
|
|
||||||
body.spread_arg = if abi == Abi::RustCall {
|
body.spread_arg = if abi == ExternAbi::RustCall {
|
||||||
// RustCall pseudo-ABI untuples the last argument.
|
// RustCall pseudo-ABI untuples the last argument.
|
||||||
Some(Local::new(arguments.len()))
|
Some(Local::new(arguments.len()))
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
|
use rustc_abi::{FIRST_VARIANT, FieldIdx};
|
||||||
use rustc_data_structures::stack::ensure_sufficient_stack;
|
use rustc_data_structures::stack::ensure_sufficient_stack;
|
||||||
use rustc_hir as hir;
|
use rustc_hir as hir;
|
||||||
use rustc_hir::def::{CtorKind, CtorOf, DefKind, Res};
|
use rustc_hir::def::{CtorKind, CtorOf, DefKind, Res};
|
||||||
@ -18,7 +19,6 @@ use rustc_middle::ty::{
|
|||||||
};
|
};
|
||||||
use rustc_middle::{bug, span_bug};
|
use rustc_middle::{bug, span_bug};
|
||||||
use rustc_span::{Span, sym};
|
use rustc_span::{Span, sym};
|
||||||
use rustc_target::abi::{FIRST_VARIANT, FieldIdx};
|
|
||||||
use tracing::{debug, info, instrument, trace};
|
use tracing::{debug, info, instrument, trace};
|
||||||
|
|
||||||
use crate::errors;
|
use crate::errors;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
use either::Either;
|
use either::Either;
|
||||||
|
use rustc_abi::{FieldIdx, VariantIdx};
|
||||||
use rustc_apfloat::Float;
|
use rustc_apfloat::Float;
|
||||||
use rustc_hir as hir;
|
use rustc_hir as hir;
|
||||||
use rustc_index::Idx;
|
use rustc_index::Idx;
|
||||||
@ -9,7 +10,6 @@ use rustc_middle::mir::interpret::ErrorHandled;
|
|||||||
use rustc_middle::thir::{FieldPat, Pat, PatKind};
|
use rustc_middle::thir::{FieldPat, Pat, PatKind};
|
||||||
use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitableExt, TypingMode, ValTree};
|
use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitableExt, TypingMode, ValTree};
|
||||||
use rustc_span::Span;
|
use rustc_span::Span;
|
||||||
use rustc_target::abi::{FieldIdx, VariantIdx};
|
|
||||||
use rustc_trait_selection::traits::ObligationCause;
|
use rustc_trait_selection::traits::ObligationCause;
|
||||||
use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt;
|
use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt;
|
||||||
use tracing::{debug, instrument, trace};
|
use tracing::{debug, instrument, trace};
|
||||||
|
@ -5,6 +5,7 @@ mod const_to_pat;
|
|||||||
|
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
|
|
||||||
|
use rustc_abi::{FieldIdx, Integer};
|
||||||
use rustc_errors::codes::*;
|
use rustc_errors::codes::*;
|
||||||
use rustc_hir::def::{CtorOf, DefKind, Res};
|
use rustc_hir::def::{CtorOf, DefKind, Res};
|
||||||
use rustc_hir::pat_util::EnumerateAndAdjustIterator;
|
use rustc_hir::pat_util::EnumerateAndAdjustIterator;
|
||||||
@ -20,7 +21,6 @@ use rustc_middle::ty::{self, CanonicalUserTypeAnnotation, Ty, TyCtxt, TypeVisita
|
|||||||
use rustc_middle::{bug, span_bug};
|
use rustc_middle::{bug, span_bug};
|
||||||
use rustc_span::def_id::LocalDefId;
|
use rustc_span::def_id::LocalDefId;
|
||||||
use rustc_span::{ErrorGuaranteed, Span};
|
use rustc_span::{ErrorGuaranteed, Span};
|
||||||
use rustc_target::abi::{FieldIdx, Integer};
|
|
||||||
use tracing::{debug, instrument};
|
use tracing::{debug, instrument};
|
||||||
|
|
||||||
pub(crate) use self::check_match::check_match;
|
pub(crate) use self::check_match::check_match;
|
||||||
|
@ -55,9 +55,15 @@ use crate::json::{Json, ToJson};
|
|||||||
use crate::spec::abi::Abi;
|
use crate::spec::abi::Abi;
|
||||||
use crate::spec::crt_objects::CrtObjects;
|
use crate::spec::crt_objects::CrtObjects;
|
||||||
|
|
||||||
pub mod abi;
|
|
||||||
pub mod crt_objects;
|
pub mod crt_objects;
|
||||||
|
|
||||||
|
pub mod abi {
|
||||||
|
pub use rustc_abi::{
|
||||||
|
AbiDisabled, AbiUnsupported, ExternAbi as Abi, all_names, enabled_names, is_enabled,
|
||||||
|
is_stable, lookup,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
mod base;
|
mod base;
|
||||||
pub use base::apple::{
|
pub use base::apple::{
|
||||||
deployment_target_for_target as current_apple_deployment_target,
|
deployment_target_for_target as current_apple_deployment_target,
|
||||||
|
Loading…
Reference in New Issue
Block a user