mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-17 06:26:55 +00:00
Auto merge of #136762 - workingjubilee:rollup-23fn0nl, r=workingjubilee
Rollup of 8 pull requests Successful merges: - #136397 (Add a comment pointing to ICE-136223) - #136686 (Clean up `HashMap` and `HashSet` docs.) - #136706 (compiler: mostly-finish `rustc_abi` updates) - #136710 (Document `Sum::sum` returns additive identities for `[]`) - #136724 (Make `AsyncFnOnce`, `AsyncFnMut`, `AsyncFn` non-`#[fundamental]`) - #136727 (Have a break from review rotation) - #136730 (transmutability: fix ICE when passing wrong ADT to ASSUME) - #136736 (Small resolve refactor) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
1ff21350fd
@ -3400,6 +3400,7 @@ dependencies = [
|
||||
name = "rustc_ast_lowering"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"rustc_abi",
|
||||
"rustc_ast",
|
||||
"rustc_ast_pretty",
|
||||
"rustc_data_structures",
|
||||
@ -3422,6 +3423,7 @@ name = "rustc_ast_passes"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"itertools",
|
||||
"rustc_abi",
|
||||
"rustc_ast",
|
||||
"rustc_ast_pretty",
|
||||
"rustc_attr_parsing",
|
||||
@ -4015,6 +4017,7 @@ version = "0.0.0"
|
||||
dependencies = [
|
||||
"rustc-rayon",
|
||||
"rustc-rayon-core",
|
||||
"rustc_abi",
|
||||
"rustc_ast",
|
||||
"rustc_ast_lowering",
|
||||
"rustc_ast_passes",
|
||||
|
@ -3225,7 +3225,7 @@ pub enum Extern {
|
||||
///
|
||||
/// E.g. `extern fn foo() {}`.
|
||||
///
|
||||
/// This is just `extern "C"` (see `rustc_target::spec::abi::Abi::FALLBACK`).
|
||||
/// This is just `extern "C"` (see `rustc_abi::ExternAbi::FALLBACK`).
|
||||
Implicit(Span),
|
||||
/// An explicit extern keyword was used with an explicit ABI.
|
||||
///
|
||||
|
@ -8,6 +8,7 @@ doctest = false
|
||||
|
||||
[dependencies]
|
||||
# tidy-alphabetical-start
|
||||
rustc_abi = { path = "../rustc_abi" }
|
||||
rustc_ast = { path = "../rustc_ast" }
|
||||
rustc_ast_pretty = { path = "../rustc_ast_pretty" }
|
||||
rustc_data_structures = { path = "../rustc_data_structures" }
|
||||
|
@ -1,3 +1,4 @@
|
||||
use rustc_abi::ExternAbi;
|
||||
use rustc_ast::ptr::P;
|
||||
use rustc_ast::visit::AssocCtxt;
|
||||
use rustc_ast::*;
|
||||
@ -11,7 +12,6 @@ use rustc_middle::span_bug;
|
||||
use rustc_middle::ty::{ResolverAstLowering, TyCtxt};
|
||||
use rustc_span::edit_distance::find_best_match_for_name;
|
||||
use rustc_span::{DesugaringKind, Ident, Span, Symbol, kw, sym};
|
||||
use rustc_target::spec::abi;
|
||||
use smallvec::{SmallVec, smallvec};
|
||||
use thin_vec::ThinVec;
|
||||
use tracing::instrument;
|
||||
@ -275,7 +275,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
||||
ModKind::Unloaded => panic!("`mod` items should have been loaded by now"),
|
||||
},
|
||||
ItemKind::ForeignMod(fm) => hir::ItemKind::ForeignMod {
|
||||
abi: fm.abi.map_or(abi::Abi::FALLBACK, |abi| self.lower_abi(abi)),
|
||||
abi: fm.abi.map_or(ExternAbi::FALLBACK, |abi| self.lower_abi(abi)),
|
||||
items: self
|
||||
.arena
|
||||
.alloc_from_iter(fm.items.iter().map(|x| self.lower_foreign_item_ref(x))),
|
||||
@ -1470,23 +1470,23 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn lower_abi(&mut self, abi: StrLit) -> abi::Abi {
|
||||
abi::lookup(abi.symbol_unescaped.as_str()).unwrap_or_else(|err| {
|
||||
pub(super) fn lower_abi(&mut self, abi: StrLit) -> ExternAbi {
|
||||
rustc_abi::lookup(abi.symbol_unescaped.as_str()).unwrap_or_else(|err| {
|
||||
self.error_on_invalid_abi(abi, err);
|
||||
abi::Abi::Rust
|
||||
ExternAbi::Rust
|
||||
})
|
||||
}
|
||||
|
||||
pub(super) fn lower_extern(&mut self, ext: Extern) -> abi::Abi {
|
||||
pub(super) fn lower_extern(&mut self, ext: Extern) -> ExternAbi {
|
||||
match ext {
|
||||
Extern::None => abi::Abi::Rust,
|
||||
Extern::Implicit(_) => abi::Abi::FALLBACK,
|
||||
Extern::None => ExternAbi::Rust,
|
||||
Extern::Implicit(_) => ExternAbi::FALLBACK,
|
||||
Extern::Explicit(abi, _) => self.lower_abi(abi),
|
||||
}
|
||||
}
|
||||
|
||||
fn error_on_invalid_abi(&self, abi: StrLit, err: abi::AbiUnsupported) {
|
||||
let abi_names = abi::enabled_names(self.tcx.features(), abi.span)
|
||||
fn error_on_invalid_abi(&self, abi: StrLit, err: rustc_abi::AbiUnsupported) {
|
||||
let abi_names = rustc_abi::enabled_names(self.tcx.features(), abi.span)
|
||||
.iter()
|
||||
.map(|s| Symbol::intern(s))
|
||||
.collect::<Vec<_>>();
|
||||
@ -1495,7 +1495,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
||||
abi: abi.symbol_unescaped,
|
||||
span: abi.span,
|
||||
explain: match err {
|
||||
abi::AbiUnsupported::Reason { explain } => Some(InvalidAbiReason(explain)),
|
||||
rustc_abi::AbiUnsupported::Reason { explain } => Some(InvalidAbiReason(explain)),
|
||||
_ => None,
|
||||
},
|
||||
suggestion: suggested_name.map(|suggested_name| InvalidAbiSuggestion {
|
||||
|
@ -6,6 +6,7 @@ edition = "2021"
|
||||
[dependencies]
|
||||
# tidy-alphabetical-start
|
||||
itertools = "0.12"
|
||||
rustc_abi = { path = "../rustc_abi" }
|
||||
rustc_ast = { path = "../rustc_ast" }
|
||||
rustc_ast_pretty = { path = "../rustc_ast_pretty" }
|
||||
rustc_attr_parsing = { path = "../rustc_attr_parsing" }
|
||||
|
@ -6,7 +6,6 @@ use rustc_session::Session;
|
||||
use rustc_session::parse::{feature_err, feature_err_issue, feature_warn};
|
||||
use rustc_span::source_map::Spanned;
|
||||
use rustc_span::{Span, Symbol, sym};
|
||||
use rustc_target::spec::abi;
|
||||
use thin_vec::ThinVec;
|
||||
|
||||
use crate::errors;
|
||||
@ -77,12 +76,12 @@ impl<'a> PostExpansionVisitor<'a> {
|
||||
fn check_abi(&self, abi: ast::StrLit) {
|
||||
let ast::StrLit { symbol_unescaped, span, .. } = abi;
|
||||
|
||||
match abi::is_enabled(self.features, span, symbol_unescaped.as_str()) {
|
||||
match rustc_abi::is_enabled(self.features, span, symbol_unescaped.as_str()) {
|
||||
Ok(()) => (),
|
||||
Err(abi::AbiDisabled::Unstable { feature, explain }) => {
|
||||
Err(rustc_abi::AbiDisabled::Unstable { feature, explain }) => {
|
||||
feature_err_issue(&self.sess, feature, span, GateIssue::Language, explain).emit();
|
||||
}
|
||||
Err(abi::AbiDisabled::Unrecognized) => {
|
||||
Err(rustc_abi::AbiDisabled::Unrecognized) => {
|
||||
if self.sess.opts.pretty.is_none_or(|ppm| ppm.needs_hir()) {
|
||||
self.sess.dcx().span_delayed_bug(
|
||||
span,
|
||||
|
@ -1,6 +1,7 @@
|
||||
#[cfg(feature = "master")]
|
||||
use gccjit::FnAttribute;
|
||||
use gccjit::{ToLValue, ToRValue, Type};
|
||||
use rustc_abi::{Reg, RegKind};
|
||||
use rustc_codegen_ssa::traits::{AbiBuilderMethods, BaseTypeCodegenMethods};
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_middle::bug;
|
||||
@ -8,7 +9,7 @@ use rustc_middle::ty::Ty;
|
||||
use rustc_middle::ty::layout::LayoutOf;
|
||||
#[cfg(feature = "master")]
|
||||
use rustc_session::config;
|
||||
use rustc_target::callconv::{ArgAttributes, CastTarget, FnAbi, PassMode, Reg, RegKind};
|
||||
use rustc_target::callconv::{ArgAttributes, CastTarget, FnAbi, PassMode};
|
||||
|
||||
use crate::builder::Builder;
|
||||
use crate::context::CodegenCx;
|
||||
|
@ -4,8 +4,7 @@ use std::cmp;
|
||||
use libc::c_uint;
|
||||
use rustc_abi as abi;
|
||||
pub(crate) use rustc_abi::ExternAbi;
|
||||
use rustc_abi::Primitive::Int;
|
||||
use rustc_abi::{HasDataLayout, Size};
|
||||
use rustc_abi::{HasDataLayout, Primitive, Reg, RegKind, Size};
|
||||
use rustc_codegen_ssa::MemFlags;
|
||||
use rustc_codegen_ssa::mir::operand::{OperandRef, OperandValue};
|
||||
use rustc_codegen_ssa::mir::place::{PlaceRef, PlaceValue};
|
||||
@ -440,7 +439,7 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
|
||||
let apply_range_attr = |idx: AttributePlace, scalar: rustc_abi::Scalar| {
|
||||
if cx.sess().opts.optimize != config::OptLevel::No
|
||||
&& llvm_util::get_version() >= (19, 0, 0)
|
||||
&& matches!(scalar.primitive(), Int(..))
|
||||
&& matches!(scalar.primitive(), Primitive::Int(..))
|
||||
// If the value is a boolean, the range is 0..2 and that ultimately
|
||||
// become 0..0 when the type becomes i1, which would be rejected
|
||||
// by the LLVM verifier.
|
||||
@ -574,7 +573,7 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
|
||||
if bx.cx.sess().opts.optimize != config::OptLevel::No
|
||||
&& llvm_util::get_version() < (19, 0, 0)
|
||||
&& let abi::BackendRepr::Scalar(scalar) = self.ret.layout.backend_repr
|
||||
&& matches!(scalar.primitive(), Int(..))
|
||||
&& matches!(scalar.primitive(), Primitive::Int(..))
|
||||
// If the value is a boolean, the range is 0..2 and that ultimately
|
||||
// become 0..0 when the type becomes i1, which would be rejected
|
||||
// by the LLVM verifier.
|
||||
|
@ -1,14 +1,14 @@
|
||||
use std::{fmt, ptr};
|
||||
|
||||
use libc::{c_char, c_uint};
|
||||
use rustc_abi::{AddressSpace, Align, Integer, Size};
|
||||
use rustc_abi::{AddressSpace, Align, Integer, Reg, Size};
|
||||
use rustc_codegen_ssa::common::TypeKind;
|
||||
use rustc_codegen_ssa::traits::*;
|
||||
use rustc_data_structures::small_c_str::SmallCStr;
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::ty::layout::TyAndLayout;
|
||||
use rustc_middle::ty::{self, Ty};
|
||||
use rustc_target::callconv::{CastTarget, FnAbi, Reg};
|
||||
use rustc_target::callconv::{CastTarget, FnAbi};
|
||||
|
||||
use crate::abi::{FnAbiLlvmExt, LlvmType};
|
||||
use crate::context::{CodegenCx, SimpleCx};
|
||||
|
@ -1,6 +1,6 @@
|
||||
use std::cmp;
|
||||
|
||||
use rustc_abi::{self as abi, ExternAbi, HasDataLayout, WrappingRange};
|
||||
use rustc_abi::{BackendRepr, ExternAbi, HasDataLayout, Reg, WrappingRange};
|
||||
use rustc_ast as ast;
|
||||
use rustc_ast::{InlineAsmOptions, InlineAsmTemplatePiece};
|
||||
use rustc_hir::lang_items::LangItem;
|
||||
@ -14,7 +14,7 @@ use rustc_middle::{bug, span_bug};
|
||||
use rustc_session::config::OptLevel;
|
||||
use rustc_span::source_map::Spanned;
|
||||
use rustc_span::{Span, sym};
|
||||
use rustc_target::callconv::{ArgAbi, FnAbi, PassMode, Reg};
|
||||
use rustc_target::callconv::{ArgAbi, FnAbi, PassMode};
|
||||
use tracing::{debug, info};
|
||||
|
||||
use super::operand::OperandRef;
|
||||
@ -1545,7 +1545,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||
// the load would just produce `OperandValue::Ref` instead
|
||||
// of the `OperandValue::Immediate` we need for the call.
|
||||
llval = bx.load(bx.backend_type(arg.layout), llval, align);
|
||||
if let abi::BackendRepr::Scalar(scalar) = arg.layout.backend_repr {
|
||||
if let BackendRepr::Scalar(scalar) = arg.layout.backend_repr {
|
||||
if scalar.is_bool() {
|
||||
bx.range_metadata(llval, WrappingRange { start: 0, end: 1 });
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
use rustc_abi as abi;
|
||||
use rustc_middle::mir::interpret::{ConstAllocation, Scalar};
|
||||
use rustc_target::abi;
|
||||
|
||||
use super::BackendTypes;
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
use rustc_abi::{AddressSpace, Float, Integer};
|
||||
use rustc_abi::{AddressSpace, Float, Integer, Reg};
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::ty::layout::{HasTyCtxt, HasTypingEnv, TyAndLayout};
|
||||
use rustc_middle::ty::{self, Ty};
|
||||
use rustc_target::callconv::{ArgAbi, CastTarget, FnAbi, Reg};
|
||||
use rustc_target::callconv::{ArgAbi, CastTarget, FnAbi};
|
||||
|
||||
use super::BackendTypes;
|
||||
use super::misc::MiscCodegenMethods;
|
||||
|
@ -7,6 +7,7 @@ edition = "2021"
|
||||
# tidy-alphabetical-start
|
||||
rustc-rayon = { version = "0.5.0" }
|
||||
rustc-rayon-core = { version = "0.5.0" }
|
||||
rustc_abi = { path = "../rustc_abi" }
|
||||
rustc_ast = { path = "../rustc_ast" }
|
||||
rustc_ast_lowering = { path = "../rustc_ast_lowering" }
|
||||
rustc_ast_passes = { path = "../rustc_ast_passes" }
|
||||
|
@ -4,6 +4,7 @@ use std::num::NonZero;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::sync::atomic::AtomicBool;
|
||||
|
||||
use rustc_abi::Align;
|
||||
use rustc_data_structures::profiling::TimePassesFormat;
|
||||
use rustc_errors::emitter::HumanReadableErrorType;
|
||||
use rustc_errors::{ColorConfig, registry};
|
||||
@ -24,7 +25,6 @@ use rustc_session::{CompilerIO, EarlyDiagCtxt, Session, build_session, filesearc
|
||||
use rustc_span::edition::{DEFAULT_EDITION, Edition};
|
||||
use rustc_span::source_map::{RealFileLoader, SourceMapInputs};
|
||||
use rustc_span::{FileName, SourceFileHashAlgorithm, sym};
|
||||
use rustc_target::abi::Align;
|
||||
use rustc_target::spec::{
|
||||
CodeModel, FramePointer, LinkerFlavorCli, MergeFunctions, OnBrokenPipe, PanicStrategy,
|
||||
RelocModel, RelroLevel, SanitizerSet, SplitDebuginfo, StackProtector, TlsModel, WasmCAbi,
|
||||
|
@ -1,5 +1,6 @@
|
||||
//! This module ensures that if a function's ABI requires a particular target feature,
|
||||
//! that target feature is enabled both on the callee and all callers.
|
||||
use rustc_abi::{BackendRepr, RegKind};
|
||||
use rustc_hir::CRATE_HIR_ID;
|
||||
use rustc_middle::mir::{self, traversal};
|
||||
use rustc_middle::ty::inherent::*;
|
||||
@ -7,8 +8,7 @@ use rustc_middle::ty::{self, Instance, InstanceKind, Ty, TyCtxt};
|
||||
use rustc_session::lint::builtin::ABI_UNSUPPORTED_VECTOR_TYPES;
|
||||
use rustc_span::def_id::DefId;
|
||||
use rustc_span::{DUMMY_SP, Span, Symbol};
|
||||
use rustc_target::abi::call::{FnAbi, PassMode};
|
||||
use rustc_target::abi::{BackendRepr, RegKind};
|
||||
use rustc_target::callconv::{FnAbi, PassMode};
|
||||
|
||||
use crate::errors::{
|
||||
AbiErrorDisabledVectorTypeCall, AbiErrorDisabledVectorTypeDef,
|
||||
|
@ -6,7 +6,7 @@ use rustc_middle::ty::layout::{FnAbiError, LayoutError};
|
||||
use rustc_middle::ty::{self, GenericArgs, Instance, Ty, TyCtxt};
|
||||
use rustc_span::source_map::Spanned;
|
||||
use rustc_span::sym;
|
||||
use rustc_target::abi::call::FnAbi;
|
||||
use rustc_target::callconv::FnAbi;
|
||||
|
||||
use super::layout_test::ensure_wf;
|
||||
use crate::errors::{AbiInvalidAttribute, AbiNe, AbiOf, UnrecognizedField};
|
||||
|
@ -7,6 +7,7 @@
|
||||
use std::cell::Cell;
|
||||
use std::collections::hash_map::Entry;
|
||||
|
||||
use rustc_abi::{ExternAbi, Size};
|
||||
use rustc_ast::{AttrStyle, LitKind, MetaItemInner, MetaItemKind, MetaItemLit, ast};
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_errors::{Applicability, DiagCtxtHandle, IntoDiagArg, MultiSpan, StashKey};
|
||||
@ -32,8 +33,6 @@ use rustc_session::lint::builtin::{
|
||||
};
|
||||
use rustc_session::parse::feature_err;
|
||||
use rustc_span::{BytePos, DUMMY_SP, Span, Symbol, kw, sym};
|
||||
use rustc_target::abi::Size;
|
||||
use rustc_target::spec::abi::Abi;
|
||||
use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
|
||||
use rustc_trait_selection::infer::{TyCtxtInferExt, ValuePairs};
|
||||
use rustc_trait_selection::traits::ObligationCtxt;
|
||||
@ -1519,7 +1518,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
if target == Target::ForeignMod
|
||||
&& let hir::Node::Item(item) = self.tcx.hir_node(hir_id)
|
||||
&& let Item { kind: ItemKind::ForeignMod { abi, .. }, .. } = item
|
||||
&& !matches!(abi, Abi::Rust | Abi::RustIntrinsic)
|
||||
&& !matches!(abi, ExternAbi::Rust | ExternAbi::RustIntrinsic)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -2445,7 +2444,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
token_stream,
|
||||
false,
|
||||
Safety::Safe,
|
||||
Abi::Rust,
|
||||
ExternAbi::Rust,
|
||||
);
|
||||
|
||||
if let Err(terr) = ocx.eq(&cause, param_env, expected_sig, sig) {
|
||||
|
@ -1500,7 +1500,7 @@ fn import_path_to_string(names: &[Ident], import_kind: &ImportKind<'_>, span: Sp
|
||||
let global = !names.is_empty() && names[0].name == kw::PathRoot;
|
||||
if let Some(pos) = pos {
|
||||
let names = if global { &names[1..pos + 1] } else { &names[..pos + 1] };
|
||||
names_to_string(&names.iter().map(|ident| ident.name).collect::<Vec<_>>())
|
||||
names_to_string(names.iter().map(|ident| ident.name))
|
||||
} else {
|
||||
let names = if global { &names[1..] } else { names };
|
||||
if names.is_empty() {
|
||||
@ -1508,7 +1508,7 @@ fn import_path_to_string(names: &[Ident], import_kind: &ImportKind<'_>, span: Sp
|
||||
} else {
|
||||
format!(
|
||||
"{}::{}",
|
||||
names_to_string(&names.iter().map(|ident| ident.name).collect::<Vec<_>>()),
|
||||
names_to_string(names.iter().map(|ident| ident.name)),
|
||||
import_kind_to_string(import_kind),
|
||||
)
|
||||
}
|
||||
|
@ -358,7 +358,7 @@ impl Segment {
|
||||
}
|
||||
|
||||
fn names_to_string(segments: &[Segment]) -> String {
|
||||
names_to_string(&segments.iter().map(|seg| seg.ident.name).collect::<Vec<_>>())
|
||||
names_to_string(segments.iter().map(|seg| seg.ident.name))
|
||||
}
|
||||
}
|
||||
|
||||
@ -2241,13 +2241,13 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
fn names_to_string(names: &[Symbol]) -> String {
|
||||
fn names_to_string(names: impl Iterator<Item = Symbol>) -> String {
|
||||
let mut result = String::new();
|
||||
for (i, name) in names.iter().filter(|name| **name != kw::PathRoot).enumerate() {
|
||||
for (i, name) in names.filter(|name| *name != kw::PathRoot).enumerate() {
|
||||
if i > 0 {
|
||||
result.push_str("::");
|
||||
}
|
||||
if Ident::with_dummy_span(*name).is_raw_guess() {
|
||||
if Ident::with_dummy_span(name).is_raw_guess() {
|
||||
result.push_str("r#");
|
||||
}
|
||||
result.push_str(name.as_str());
|
||||
@ -2256,31 +2256,32 @@ fn names_to_string(names: &[Symbol]) -> String {
|
||||
}
|
||||
|
||||
fn path_names_to_string(path: &Path) -> String {
|
||||
names_to_string(&path.segments.iter().map(|seg| seg.ident.name).collect::<Vec<_>>())
|
||||
names_to_string(path.segments.iter().map(|seg| seg.ident.name))
|
||||
}
|
||||
|
||||
/// A somewhat inefficient routine to obtain the name of a module.
|
||||
fn module_to_string(module: Module<'_>) -> Option<String> {
|
||||
fn module_to_string(mut module: Module<'_>) -> Option<String> {
|
||||
let mut names = Vec::new();
|
||||
|
||||
fn collect_mod(names: &mut Vec<Symbol>, module: Module<'_>) {
|
||||
loop {
|
||||
if let ModuleKind::Def(.., name) = module.kind {
|
||||
if let Some(parent) = module.parent {
|
||||
names.push(name);
|
||||
collect_mod(names, parent);
|
||||
module = parent
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
names.push(sym::opaque_module_name_placeholder);
|
||||
collect_mod(names, module.parent.unwrap());
|
||||
let Some(parent) = module.parent else {
|
||||
return None;
|
||||
};
|
||||
module = parent;
|
||||
}
|
||||
}
|
||||
collect_mod(&mut names, module);
|
||||
|
||||
if names.is_empty() {
|
||||
return None;
|
||||
}
|
||||
names.reverse();
|
||||
Some(names_to_string(&names))
|
||||
Some(names_to_string(names.iter().rev().copied()))
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
|
@ -2,7 +2,7 @@ use std::iter;
|
||||
|
||||
use rustc_abi::{BackendRepr, HasDataLayout, Primitive, TyAbiInterface};
|
||||
|
||||
use crate::abi::call::{ArgAbi, FnAbi, Reg, RegKind, Uniform};
|
||||
use crate::callconv::{ArgAbi, FnAbi, Reg, RegKind, Uniform};
|
||||
use crate::spec::{HasTargetSpec, Target};
|
||||
|
||||
/// Indicates the variant of the AArch64 ABI we are compiling for.
|
||||
|
@ -1,6 +1,6 @@
|
||||
use rustc_abi::{HasDataLayout, TyAbiInterface};
|
||||
|
||||
use crate::abi::call::{ArgAbi, FnAbi};
|
||||
use crate::callconv::{ArgAbi, FnAbi};
|
||||
|
||||
fn classify_ret<'a, Ty, C>(_cx: &C, ret: &mut ArgAbi<'a, Ty>)
|
||||
where
|
||||
|
@ -1,6 +1,6 @@
|
||||
use rustc_abi::{HasDataLayout, TyAbiInterface};
|
||||
|
||||
use crate::abi::call::{ArgAbi, Conv, FnAbi, Reg, RegKind, Uniform};
|
||||
use crate::callconv::{ArgAbi, Conv, FnAbi, Reg, RegKind, Uniform};
|
||||
use crate::spec::HasTargetSpec;
|
||||
|
||||
fn is_homogeneous_aggregate<'a, Ty, C>(cx: &C, arg: &mut ArgAbi<'a, Ty>) -> Option<Uniform>
|
||||
|
@ -30,7 +30,7 @@
|
||||
//! compatible with AVR-GCC - Rust and AVR-GCC only differ in the small amount
|
||||
//! of compiler frontend specific calling convention logic implemented here.
|
||||
|
||||
use crate::abi::call::{ArgAbi, FnAbi};
|
||||
use crate::callconv::{ArgAbi, FnAbi};
|
||||
|
||||
fn classify_ret_ty<Ty>(ret: &mut ArgAbi<'_, Ty>) {
|
||||
if ret.layout.is_aggregate() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
// see https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/BPF/BPFCallingConv.td
|
||||
use crate::abi::call::{ArgAbi, FnAbi};
|
||||
use crate::callconv::{ArgAbi, FnAbi};
|
||||
|
||||
fn classify_ret<Ty>(ret: &mut ArgAbi<'_, Ty>) {
|
||||
if ret.layout.is_aggregate() || ret.layout.size.bits() > 64 {
|
||||
|
@ -4,7 +4,7 @@
|
||||
// Reference: Clang CSKY lowering code
|
||||
// https://github.com/llvm/llvm-project/blob/4a074f32a6914f2a8d7215d78758c24942dddc3d/clang/lib/CodeGen/Targets/CSKY.cpp#L76-L162
|
||||
|
||||
use crate::abi::call::{ArgAbi, FnAbi, Reg, Uniform};
|
||||
use crate::callconv::{ArgAbi, FnAbi, Reg, Uniform};
|
||||
|
||||
fn classify_ret<Ty>(arg: &mut ArgAbi<'_, Ty>) {
|
||||
if !arg.layout.is_sized() {
|
||||
|
@ -1,4 +1,4 @@
|
||||
use crate::abi::call::{ArgAbi, FnAbi};
|
||||
use crate::callconv::{ArgAbi, FnAbi};
|
||||
|
||||
fn classify_ret<Ty>(ret: &mut ArgAbi<'_, Ty>) {
|
||||
if ret.layout.is_aggregate() && ret.layout.size.bits() > 64 {
|
||||
|
@ -1,4 +1,4 @@
|
||||
use crate::abi::call::{ArgAbi, FnAbi};
|
||||
use crate::callconv::{ArgAbi, FnAbi};
|
||||
|
||||
fn classify_ret<Ty>(ret: &mut ArgAbi<'_, Ty>) {
|
||||
if ret.layout.is_aggregate() {
|
||||
|
@ -1,6 +1,6 @@
|
||||
use rustc_abi::{HasDataLayout, Size};
|
||||
|
||||
use crate::abi::call::{ArgAbi, FnAbi, Reg, Uniform};
|
||||
use crate::callconv::{ArgAbi, FnAbi, Reg, Uniform};
|
||||
|
||||
fn classify_ret<Ty, C>(cx: &C, ret: &mut ArgAbi<'_, Ty>, offset: &mut Size)
|
||||
where
|
||||
|
@ -2,10 +2,9 @@ use std::str::FromStr;
|
||||
use std::{fmt, iter};
|
||||
|
||||
use rustc_abi::{
|
||||
AddressSpace, Align, BackendRepr, ExternAbi, HasDataLayout, Scalar, Size, TyAbiInterface,
|
||||
TyAndLayout,
|
||||
AddressSpace, Align, BackendRepr, ExternAbi, HasDataLayout, Primitive, Reg, RegKind, Scalar,
|
||||
Size, TyAbiInterface, TyAndLayout,
|
||||
};
|
||||
pub use rustc_abi::{Primitive, Reg, RegKind};
|
||||
use rustc_macros::HashStable_Generic;
|
||||
use rustc_span::Symbol;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Reference: MSP430 Embedded Application Binary Interface
|
||||
// https://www.ti.com/lit/an/slaa534a/slaa534a.pdf
|
||||
|
||||
use crate::abi::call::{ArgAbi, FnAbi};
|
||||
use crate::callconv::{ArgAbi, FnAbi};
|
||||
|
||||
// 3.5 Structures or Unions Passed and Returned by Reference
|
||||
//
|
||||
|
@ -1,7 +1,7 @@
|
||||
use rustc_abi::{HasDataLayout, Reg, Size, TyAbiInterface};
|
||||
|
||||
use super::{ArgAttribute, ArgAttributes, ArgExtension, CastTarget};
|
||||
use crate::abi::call::{ArgAbi, FnAbi, Uniform};
|
||||
use crate::callconv::{ArgAbi, FnAbi, Uniform};
|
||||
|
||||
fn classify_ret<Ty>(ret: &mut ArgAbi<'_, Ty>) {
|
||||
if ret.layout.is_aggregate() && ret.layout.is_sized() {
|
||||
|
@ -1,4 +1,4 @@
|
||||
use crate::abi::call::{ArgAbi, FnAbi};
|
||||
use crate::callconv::{ArgAbi, FnAbi};
|
||||
use crate::spec::HasTargetSpec;
|
||||
|
||||
fn classify_ret<Ty>(ret: &mut ArgAbi<'_, Ty>) {
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
use rustc_abi::{Endian, HasDataLayout, TyAbiInterface};
|
||||
|
||||
use crate::abi::call::{Align, ArgAbi, FnAbi, Reg, RegKind, Uniform};
|
||||
use crate::callconv::{Align, ArgAbi, FnAbi, Reg, RegKind, Uniform};
|
||||
use crate::spec::HasTargetSpec;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
|
@ -9,7 +9,7 @@ use rustc_abi::{
|
||||
TyAbiInterface, TyAndLayout, Variants,
|
||||
};
|
||||
|
||||
use crate::abi::call::{ArgAbi, ArgExtension, CastTarget, FnAbi, PassMode, Uniform};
|
||||
use crate::callconv::{ArgAbi, ArgExtension, CastTarget, FnAbi, PassMode, Uniform};
|
||||
use crate::spec::HasTargetSpec;
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
use rustc_abi::{BackendRepr, HasDataLayout, TyAbiInterface};
|
||||
|
||||
use crate::abi::call::{ArgAbi, FnAbi, Reg, RegKind};
|
||||
use crate::callconv::{ArgAbi, FnAbi, Reg, RegKind};
|
||||
use crate::spec::HasTargetSpec;
|
||||
|
||||
fn classify_ret<Ty>(ret: &mut ArgAbi<'_, Ty>) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
use rustc_abi::{HasDataLayout, Size};
|
||||
|
||||
use crate::abi::call::{ArgAbi, FnAbi, Reg, Uniform};
|
||||
use crate::callconv::{ArgAbi, FnAbi, Reg, Uniform};
|
||||
|
||||
fn classify_ret<Ty, C>(cx: &C, ret: &mut ArgAbi<'_, Ty>, offset: &mut Size)
|
||||
where
|
||||
|
@ -5,7 +5,7 @@ use rustc_abi::{
|
||||
TyAndLayout,
|
||||
};
|
||||
|
||||
use crate::abi::call::{
|
||||
use crate::callconv::{
|
||||
ArgAbi, ArgAttribute, ArgAttributes, ArgExtension, CastTarget, FnAbi, Uniform,
|
||||
};
|
||||
use crate::spec::HasTargetSpec;
|
||||
|
@ -1,6 +1,6 @@
|
||||
use rustc_abi::{BackendRepr, Float, HasDataLayout, Integer, Primitive, TyAbiInterface};
|
||||
|
||||
use crate::abi::call::{ArgAbi, FnAbi};
|
||||
use crate::callconv::{ArgAbi, FnAbi};
|
||||
|
||||
fn unwrap_trivial_aggregate<'a, Ty, C>(cx: &C, val: &mut ArgAbi<'a, Ty>) -> bool
|
||||
where
|
||||
|
@ -3,7 +3,7 @@ use rustc_abi::{
|
||||
TyAbiInterface, TyAndLayout,
|
||||
};
|
||||
|
||||
use crate::abi::call::{ArgAttribute, FnAbi, PassMode};
|
||||
use crate::callconv::{ArgAttribute, FnAbi, PassMode};
|
||||
use crate::spec::HasTargetSpec;
|
||||
|
||||
#[derive(PartialEq)]
|
||||
|
@ -6,7 +6,7 @@ use rustc_abi::{
|
||||
Variants,
|
||||
};
|
||||
|
||||
use crate::abi::call::{ArgAbi, CastTarget, FnAbi};
|
||||
use crate::callconv::{ArgAbi, CastTarget, FnAbi};
|
||||
|
||||
/// Classification of "eightbyte" components.
|
||||
// N.B., the order of the variants is from general to specific,
|
||||
|
@ -1,6 +1,6 @@
|
||||
use rustc_abi::{BackendRepr, Float, Integer, Primitive, RegKind, Size};
|
||||
|
||||
use crate::abi::call::{ArgAbi, FnAbi, Reg};
|
||||
use crate::callconv::{ArgAbi, FnAbi, Reg};
|
||||
use crate::spec::HasTargetSpec;
|
||||
|
||||
// Win64 ABI: https://docs.microsoft.com/en-us/cpp/build/parameter-passing
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
use rustc_abi::{BackendRepr, HasDataLayout, Size, TyAbiInterface};
|
||||
|
||||
use crate::abi::call::{ArgAbi, FnAbi, Reg, Uniform};
|
||||
use crate::callconv::{ArgAbi, FnAbi, Reg, Uniform};
|
||||
use crate::spec::HasTargetSpec;
|
||||
|
||||
const NUM_ARG_GPRS: u64 = 6;
|
||||
|
@ -92,7 +92,7 @@ impl<A: ToJson> ToJson for Option<A> {
|
||||
}
|
||||
}
|
||||
|
||||
impl ToJson for crate::abi::call::Conv {
|
||||
impl ToJson for crate::callconv::Conv {
|
||||
fn to_json(&self) -> Json {
|
||||
let buf: String;
|
||||
let s = match self {
|
||||
|
@ -30,12 +30,6 @@ pub mod target_features;
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
pub mod abi {
|
||||
pub use rustc_abi::*;
|
||||
|
||||
pub use crate::callconv as call;
|
||||
}
|
||||
|
||||
pub use rustc_abi::HashStableContext;
|
||||
|
||||
/// The name of rustc's own place to organize libraries.
|
||||
|
@ -51,7 +51,7 @@ use rustc_span::{Symbol, kw, sym};
|
||||
use serde_json::Value;
|
||||
use tracing::debug;
|
||||
|
||||
use crate::abi::call::Conv;
|
||||
use crate::callconv::Conv;
|
||||
use crate::json::{Json, ToJson};
|
||||
use crate::spec::crt_objects::CrtObjects;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
use crate::abi::Endian;
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{StackProbeType, Target, TargetOptions, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
|
@ -1,4 +1,5 @@
|
||||
use crate::abi::Endian;
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{StackProbeType, Target, TargetOptions, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
|
@ -1,4 +1,5 @@
|
||||
use crate::abi::Endian;
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{StackProbeType, Target, TargetOptions, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
|
@ -1,4 +1,5 @@
|
||||
use crate::abi::Endian;
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{FloatAbi, Target, TargetOptions, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
|
@ -1,6 +1,7 @@
|
||||
// Targets the Big endian Cortex-R4/R5 processor (ARMv7-R)
|
||||
|
||||
use crate::abi::Endian;
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{
|
||||
Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions,
|
||||
};
|
||||
|
@ -1,6 +1,7 @@
|
||||
// Targets the Cortex-R4F/R5F processor (ARMv7-R)
|
||||
|
||||
use crate::abi::Endian;
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{
|
||||
Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions,
|
||||
};
|
||||
|
@ -1,4 +1,5 @@
|
||||
use crate::abi::Endian;
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{Cc, FloatAbi, LinkerFlavor, Lld, RelocModel, Target, TargetOptions, cvs};
|
||||
|
||||
/// A base target for PlayStation Vita devices using the VITASDK toolchain (using newlib).
|
||||
|
@ -1,4 +1,5 @@
|
||||
use crate::abi::Endian;
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{Target, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
|
@ -1,4 +1,5 @@
|
||||
use crate::abi::Endian;
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{Target, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
|
@ -1,4 +1,5 @@
|
||||
use crate::abi::Endian;
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{LinkSelfContainedDefault, Target, TargetOptions, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
|
@ -1,4 +1,5 @@
|
||||
use crate::abi::Endian;
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{CodeModel, PanicStrategy, RelocModel, Target, TargetOptions};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
|
@ -1,6 +1,7 @@
|
||||
//! A target tuple for OpenWrt MIPS64 targets.
|
||||
|
||||
use crate::abi::Endian;
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{Target, TargetOptions, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
|
@ -1,4 +1,5 @@
|
||||
use crate::abi::Endian;
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{Target, TargetOptions, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
|
@ -1,4 +1,5 @@
|
||||
use crate::abi::Endian;
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{Target, TargetOptions, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
|
@ -1,4 +1,5 @@
|
||||
use crate::abi::Endian;
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
|
@ -1,4 +1,5 @@
|
||||
use crate::abi::Endian;
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{Target, TargetOptions, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
|
@ -1,4 +1,5 @@
|
||||
use crate::abi::Endian;
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{Target, TargetOptions, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
|
@ -1,4 +1,5 @@
|
||||
use crate::abi::Endian;
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{Target, TargetOptions, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
|
@ -1,4 +1,5 @@
|
||||
use crate::abi::Endian;
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
|
@ -1,4 +1,5 @@
|
||||
use crate::abi::Endian;
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{Target, TargetOptions, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
|
@ -1,4 +1,5 @@
|
||||
use crate::abi::Endian;
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{Target, TargetOptions, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
|
@ -1,4 +1,5 @@
|
||||
use crate::abi::Endian;
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{Target, TargetOptions, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
|
@ -1,4 +1,5 @@
|
||||
use crate::abi::Endian;
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
|
@ -1,4 +1,5 @@
|
||||
use crate::abi::Endian;
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
|
@ -1,4 +1,5 @@
|
||||
use crate::abi::Endian;
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
|
@ -1,4 +1,5 @@
|
||||
use crate::abi::Endian;
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
|
@ -1,4 +1,5 @@
|
||||
use crate::abi::Endian;
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
|
@ -1,4 +1,5 @@
|
||||
use crate::abi::Endian;
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
|
@ -1,4 +1,5 @@
|
||||
use crate::abi::Endian;
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
|
@ -1,4 +1,5 @@
|
||||
use crate::abi::Endian;
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
|
@ -1,4 +1,5 @@
|
||||
use crate::abi::Endian;
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
|
@ -1,4 +1,5 @@
|
||||
use crate::abi::Endian;
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
|
@ -1,4 +1,5 @@
|
||||
use crate::abi::Endian;
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
|
@ -1,4 +1,5 @@
|
||||
use crate::abi::Endian;
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{StackProbeType, Target, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
|
@ -1,4 +1,5 @@
|
||||
use crate::abi::Endian;
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
|
@ -1,4 +1,5 @@
|
||||
use crate::abi::Endian;
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
|
@ -1,4 +1,5 @@
|
||||
use crate::abi::Endian;
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{SanitizerSet, StackProbeType, Target, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
|
@ -1,4 +1,5 @@
|
||||
use crate::abi::Endian;
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{SanitizerSet, StackProbeType, Target, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
|
@ -1,4 +1,5 @@
|
||||
use crate::abi::Endian;
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{Target, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
|
@ -1,4 +1,5 @@
|
||||
use crate::abi::Endian;
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{Cc, LinkerFlavor, Lld, Target, TargetOptions, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
|
@ -1,4 +1,5 @@
|
||||
use crate::abi::Endian;
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{Cc, LinkerFlavor, Lld, Target, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
|
@ -1,4 +1,5 @@
|
||||
use crate::abi::Endian;
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{Cc, LinkerFlavor, Lld, Target, TargetOptions, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
|
@ -1,4 +1,5 @@
|
||||
use crate::abi::Endian;
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
|
@ -1,4 +1,5 @@
|
||||
use crate::abi::Endian;
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{Cc, LinkerFlavor, Target, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
|
@ -5,7 +5,7 @@
|
||||
// The win64 ABI is used. It differs from the sysv64 ABI, so we must use a windows target with
|
||||
// LLVM. "x86_64-unknown-windows" is used to get the minimal subset of windows-specific features.
|
||||
|
||||
use crate::abi::call::Conv;
|
||||
use crate::callconv::Conv;
|
||||
use crate::spec::{RustcAbi, Target, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
|
@ -1,4 +1,5 @@
|
||||
use crate::abi::Endian;
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::base::xtensa;
|
||||
use crate::spec::{Target, TargetOptions, cvs};
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
use crate::abi::Endian;
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::base::xtensa;
|
||||
use crate::spec::{Target, TargetOptions, cvs};
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
use crate::abi::Endian;
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::base::xtensa;
|
||||
use crate::spec::{Target, TargetOptions, cvs};
|
||||
|
||||
|
@ -84,7 +84,7 @@ mod rustc {
|
||||
use rustc_infer::infer::InferCtxt;
|
||||
use rustc_macros::TypeVisitable;
|
||||
use rustc_middle::traits::ObligationCause;
|
||||
use rustc_middle::ty::{Const, ParamEnv, Ty, TyCtxt, ValTree};
|
||||
use rustc_middle::ty::{Const, ParamEnv, Ty, TyCtxt};
|
||||
|
||||
use super::*;
|
||||
|
||||
@ -139,25 +139,21 @@ mod rustc {
|
||||
|
||||
let adt_def = cv.ty.ty_adt_def()?;
|
||||
|
||||
assert_eq!(
|
||||
tcx.require_lang_item(LangItem::TransmuteOpts, None),
|
||||
adt_def.did(),
|
||||
"The given `Const` was not marked with the `{}` lang item.",
|
||||
LangItem::TransmuteOpts.name(),
|
||||
);
|
||||
if !tcx.is_lang_item(adt_def.did(), LangItem::TransmuteOpts) {
|
||||
tcx.dcx().delayed_bug(format!(
|
||||
"The given `const` was not marked with the `{}` lang item.",
|
||||
LangItem::TransmuteOpts.name()
|
||||
));
|
||||
return Some(Self {
|
||||
alignment: true,
|
||||
lifetimes: true,
|
||||
safety: true,
|
||||
validity: true,
|
||||
});
|
||||
}
|
||||
|
||||
let variant = adt_def.non_enum_variant();
|
||||
let fields = match cv.valtree {
|
||||
ValTree::Branch(branch) => branch,
|
||||
_ => {
|
||||
return Some(Self {
|
||||
alignment: true,
|
||||
lifetimes: true,
|
||||
safety: true,
|
||||
validity: true,
|
||||
});
|
||||
}
|
||||
};
|
||||
let fields = cv.valtree.unwrap_branch();
|
||||
|
||||
let get_field = |name| {
|
||||
let (field_idx, _) = variant
|
||||
|
@ -3493,7 +3493,8 @@ pub trait Iterator {
|
||||
///
|
||||
/// Takes each element, adds them together, and returns the result.
|
||||
///
|
||||
/// An empty iterator returns the zero value of the type.
|
||||
/// An empty iterator returns the *additive identity* ("zero") of the type,
|
||||
/// which is `0` for integers and `-0.0` for floats.
|
||||
///
|
||||
/// `sum()` can be used to sum any type implementing [`Sum`][`core::iter::Sum`],
|
||||
/// including [`Option`][`Option::sum`] and [`Result`][`Result::sum`].
|
||||
@ -3511,6 +3512,10 @@ pub trait Iterator {
|
||||
/// let sum: i32 = a.iter().sum();
|
||||
///
|
||||
/// assert_eq!(sum, 6);
|
||||
///
|
||||
/// let b: Vec<f32> = vec![];
|
||||
/// let sum: f32 = b.iter().sum();
|
||||
/// assert_eq!(sum, -0.0_f32);
|
||||
/// ```
|
||||
#[stable(feature = "iter_arith", since = "1.11.0")]
|
||||
fn sum<S>(self) -> S
|
||||
|
@ -6,7 +6,6 @@ use crate::marker::Tuple;
|
||||
/// All `async fn` and functions returning futures implement this trait.
|
||||
#[stable(feature = "async_closure", since = "1.85.0")]
|
||||
#[rustc_paren_sugar]
|
||||
#[fundamental]
|
||||
#[must_use = "async closures are lazy and do nothing unless called"]
|
||||
#[lang = "async_fn"]
|
||||
pub trait AsyncFn<Args: Tuple>: AsyncFnMut<Args> {
|
||||
@ -20,7 +19,6 @@ pub trait AsyncFn<Args: Tuple>: AsyncFnMut<Args> {
|
||||
/// All `async fn` and functions returning futures implement this trait.
|
||||
#[stable(feature = "async_closure", since = "1.85.0")]
|
||||
#[rustc_paren_sugar]
|
||||
#[fundamental]
|
||||
#[must_use = "async closures are lazy and do nothing unless called"]
|
||||
#[lang = "async_fn_mut"]
|
||||
pub trait AsyncFnMut<Args: Tuple>: AsyncFnOnce<Args> {
|
||||
@ -41,7 +39,6 @@ pub trait AsyncFnMut<Args: Tuple>: AsyncFnOnce<Args> {
|
||||
/// All `async fn` and functions returning futures implement this trait.
|
||||
#[stable(feature = "async_closure", since = "1.85.0")]
|
||||
#[rustc_paren_sugar]
|
||||
#[fundamental]
|
||||
#[must_use = "async closures are lazy and do nothing unless called"]
|
||||
#[lang = "async_fn_once"]
|
||||
pub trait AsyncFnOnce<Args: Tuple> {
|
||||
|
@ -282,7 +282,7 @@ impl<K, V, S> HashMap<K, V, S> {
|
||||
/// manually using this function can expose a DoS attack vector.
|
||||
///
|
||||
/// The `hash_builder` passed should implement the [`BuildHasher`] trait for
|
||||
/// the HashMap to be useful, see its documentation for details.
|
||||
/// the `HashMap` to be useful, see its documentation for details.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
@ -314,7 +314,7 @@ impl<K, V, S> HashMap<K, V, S> {
|
||||
/// manually using this function can expose a DoS attack vector.
|
||||
///
|
||||
/// The `hasher` passed should implement the [`BuildHasher`] trait for
|
||||
/// the HashMap to be useful, see its documentation for details.
|
||||
/// the `HashMap` to be useful, see its documentation for details.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
@ -1283,7 +1283,7 @@ impl<K, V, S> HashMap<K, V, S>
|
||||
where
|
||||
S: BuildHasher,
|
||||
{
|
||||
/// Creates a raw entry builder for the HashMap.
|
||||
/// Creates a raw entry builder for the `HashMap`.
|
||||
///
|
||||
/// Raw entries provide the lowest level of control for searching and
|
||||
/// manipulating a map. They must be manually initialized with a hash and
|
||||
@ -1298,13 +1298,13 @@ where
|
||||
/// * Using custom comparison logic without newtype wrappers
|
||||
///
|
||||
/// Because raw entries provide much more low-level control, it's much easier
|
||||
/// to put the HashMap into an inconsistent state which, while memory-safe,
|
||||
/// to put the `HashMap` into an inconsistent state which, while memory-safe,
|
||||
/// will cause the map to produce seemingly random results. Higher-level and
|
||||
/// more foolproof APIs like `entry` should be preferred when possible.
|
||||
///
|
||||
/// In particular, the hash used to initialize the raw entry must still be
|
||||
/// consistent with the hash of the key that is ultimately stored in the entry.
|
||||
/// This is because implementations of HashMap may need to recompute hashes
|
||||
/// This is because implementations of `HashMap` may need to recompute hashes
|
||||
/// when resizing, at which point only the keys are available.
|
||||
///
|
||||
/// Raw entries give mutable access to the keys. This must not be used
|
||||
@ -1320,7 +1320,7 @@ where
|
||||
RawEntryBuilderMut { map: self }
|
||||
}
|
||||
|
||||
/// Creates a raw immutable entry builder for the HashMap.
|
||||
/// Creates a raw immutable entry builder for the `HashMap`.
|
||||
///
|
||||
/// Raw entries provide the lowest level of control for searching and
|
||||
/// manipulating a map. They must be manually initialized with a hash and
|
||||
|
@ -374,7 +374,7 @@ impl<T, S> HashSet<T, S> {
|
||||
/// manually using this function can expose a DoS attack vector.
|
||||
///
|
||||
/// The `hash_builder` passed should implement the [`BuildHasher`] trait for
|
||||
/// the HashMap to be useful, see its documentation for details.
|
||||
/// the `HashSet` to be useful, see its documentation for details.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
@ -406,7 +406,7 @@ impl<T, S> HashSet<T, S> {
|
||||
/// manually using this function can expose a DoS attack vector.
|
||||
///
|
||||
/// The `hash_builder` passed should implement the [`BuildHasher`] trait for
|
||||
/// the HashMap to be useful, see its documentation for details.
|
||||
/// the `HashSet` to be useful, see its documentation for details.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
|
@ -4,13 +4,13 @@ use clippy_utils::expr_or_init;
|
||||
use clippy_utils::source::snippet;
|
||||
use clippy_utils::sugg::Sugg;
|
||||
use clippy_utils::ty::{get_discriminant_value, is_isize_or_usize};
|
||||
use rustc_abi::IntegerType;
|
||||
use rustc_errors::{Applicability, Diag};
|
||||
use rustc_hir::def::{DefKind, Res};
|
||||
use rustc_hir::{BinOpKind, Expr, ExprKind};
|
||||
use rustc_lint::LateContext;
|
||||
use rustc_middle::ty::{self, FloatTy, Ty};
|
||||
use rustc_span::Span;
|
||||
use rustc_target::abi::IntegerType;
|
||||
|
||||
use super::{CAST_ENUM_TRUNCATION, CAST_POSSIBLE_TRUNCATION, utils};
|
||||
|
||||
|
@ -10,7 +10,7 @@ use rustc_session::impl_lint_pass;
|
||||
use rustc_span::Span;
|
||||
use rustc_span::def_id::LocalDefId;
|
||||
use rustc_span::symbol::kw;
|
||||
use rustc_target::spec::abi::Abi;
|
||||
use rustc_abi::ExternAbi;
|
||||
|
||||
pub struct BoxedLocal {
|
||||
too_large_for_stack: u64,
|
||||
@ -73,7 +73,7 @@ impl<'tcx> LateLintPass<'tcx> for BoxedLocal {
|
||||
fn_def_id: LocalDefId,
|
||||
) {
|
||||
if let Some(header) = fn_kind.header() {
|
||||
if header.abi != Abi::Rust {
|
||||
if header.abi != ExternAbi::Rust {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user