Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
ef8c95c
privacy: Fix type privacy holes when it doesn't cause too much breakage
petrochenkov Feb 12, 2026
7cb6912
Remove a flaky `got_timeout` assert from two channel tests
Zalathar Mar 7, 2026
44d6cd2
Fix environ on FreeBSD with cdylib targets that use -Wl,--no-undefined .
asomers Mar 5, 2026
d2e3ab6
std: move `sys::pal::os` to `sys::paths` (rename/delete only)
joboet Mar 9, 2026
f4a95d3
std: move leftover Windows error test
joboet Mar 9, 2026
be5f070
std: move `sys::pal::os` to `sys::paths`
joboet Mar 9, 2026
0e0babc
docs(fs): Clarify that File::lock coordinates across processes
TKanX Mar 10, 2026
fb65707
Move freeze_* methods to OpenOptionsExt2
ChrisDenton Mar 6, 2026
858b82d
Simplify find_attr! for HirId usage
mehdiakiki Mar 9, 2026
425df0d
Do not emit separator as before elements
zakarumych Feb 19, 2026
800d9ea
Lifted intersperse and intersperse_with Fused restrictions and update…
asder8215 Mar 14, 2026
4eb9e66
Extend ASCII fast paths of `char` methods beyond ASCII
Jules-Bertholet Mar 16, 2024
a893257
remove usages of to-be-deprecated numeric constants
cyrgani Mar 15, 2026
cab72ae
implement `BinaryHeap::as_mut_slice`
usamoi Mar 17, 2026
577dba9
Skip stack_start_aligned for immediate-abort
danielzgtg Mar 16, 2026
e844c24
resolve namespaced crates with open modules
b-naber Feb 3, 2026
9a4b38c
Add new alias for Guillaume Gomez email address
GuillaumeGomez Mar 21, 2026
b31dc4a
diagnostics: avoid ICE for undeclared generic parameter in impl
Unique-Usman Mar 21, 2026
e0aed9c
Point to the tracking issue for #[diagnostic::on_move]
rperier Mar 21, 2026
8d07261
Add APIs for dealing with titlecase
Jules-Bertholet Mar 16, 2024
9b7dff9
Move and rename LTO-specific test files from tests/ui/issues/ to test…
ujjwalvishwakarma2006 Mar 21, 2026
9b0be78
allow `incomplete_features` in most UI tests
cyrgani Mar 21, 2026
e2a870f
Use BTreeMap::merge underneath the hood to deduplicate code
asder8215 Feb 25, 2026
e19ad08
Use enums to clarify `DepNodeColorMap` color marking
Zalathar Mar 20, 2026
1fec51c
Remove `DepNodeColorMap::insert_red`
Zalathar Mar 22, 2026
40ebcc0
target specs: rename abi to cfg_abi
RalfJung Mar 12, 2026
6b14876
enum-ify llvm_abiname
RalfJung Mar 14, 2026
4a0b264
ensure Other variants are only used by JSON targets
RalfJung Mar 22, 2026
dd2b208
Add comment at the top in two test files referencing the issue they o…
ujjwalvishwakarma2006 Mar 22, 2026
6458ca5
Unknown -> Unsupported compression algorithm
Mark-Simulacrum Jan 2, 2026
e5cad16
Rollup merge of #122668 - Jules-Bertholet:titlecase, r=Mark-Simulacrum
JonathanBrouwer Mar 22, 2026
4bef810
Rollup merge of #152543 - petrochenkov:rprivtit2, r=fmease
JonathanBrouwer Mar 22, 2026
cc6276c
Rollup merge of #153107 - asder8215:btreemap_append_optimized, r=Mark…
JonathanBrouwer Mar 22, 2026
179f58a
Rollup merge of #153312 - b-naber:namespaced-crate-names-pt1, r=petro…
JonathanBrouwer Mar 22, 2026
4718953
Rollup merge of #153534 - Zalathar:flaky-stress, r=Mark-Simulacrum
JonathanBrouwer Mar 22, 2026
6b2ca29
Rollup merge of #153718 - asomers:environ-freebsd, r=Mark-Simulacrum
JonathanBrouwer Mar 22, 2026
0653a58
Rollup merge of #153857 - RalfJung:cfg-abi, r=Mark-Simulacrum
JonathanBrouwer Mar 22, 2026
8f1ca79
Rollup merge of #153880 - asder8215:intersperse_nonfused, r=Mark-Simu…
JonathanBrouwer Mar 22, 2026
40bf3e5
Rollup merge of #153931 - cyrgani:old-consts, r=Mark-Simulacrum
JonathanBrouwer Mar 22, 2026
089d6a2
Rollup merge of #150630 - Mark-Simulacrum:rephrase-compression-warn, …
JonathanBrouwer Mar 22, 2026
37fc580
Rollup merge of #153491 - ChrisDenton:openoptionsext2, r=Mark-Simulacrum
JonathanBrouwer Mar 22, 2026
0b6606e
Rollup merge of #153582 - mehdiakiki:simplify-find-attr-hir-id, r=Jon…
JonathanBrouwer Mar 22, 2026
4207456
Rollup merge of #153623 - joboet:move_pal_os, r=Mark-Simulacrum
JonathanBrouwer Mar 22, 2026
27bcf51
Rollup merge of #153647 - TKanX:docs/153618-file-lock-cross-process, …
JonathanBrouwer Mar 22, 2026
2f4bb6e
Rollup merge of #153936 - danielzgtg:perf/immediateAbortAvoidPthreadG…
JonathanBrouwer Mar 22, 2026
4970ea0
Rollup merge of #154011 - usamoi:binary_heap_as_mut_slice, r=Mark-Sim…
JonathanBrouwer Mar 22, 2026
0dac1aa
Rollup merge of #154167 - ujjwalvishwakarma2006:move-lto-tests, r=Kiv…
JonathanBrouwer Mar 22, 2026
91429a7
Rollup merge of #154174 - cyrgani:incomplete-mcp, r=JonathanBrouwer
JonathanBrouwer Mar 22, 2026
dc81bc4
Rollup merge of #154175 - GuillaumeGomez:mailmap, r=Mark-Simulacrum
JonathanBrouwer Mar 22, 2026
3eaa73c
Rollup merge of #154182 - Unique-Usman:ua/constnotype2, r=estebank
JonathanBrouwer Mar 22, 2026
0c469fc
Rollup merge of #154188 - rperier:diagnostic_on_move_point_to_the_tra…
JonathanBrouwer Mar 22, 2026
905b306
Rollup merge of #154201 - Zalathar:try-set-color, r=nnethercote
JonathanBrouwer Mar 22, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ Guillaume Gomez <guillaume1.gomez@gmail.com>
Guillaume Gomez <guillaume1.gomez@gmail.com> ggomez <ggomez@ggo.ifr.lan>
Guillaume Gomez <guillaume1.gomez@gmail.com> Guillaume Gomez <ggomez@ggo.ifr.lan>
Guillaume Gomez <guillaume1.gomez@gmail.com> Guillaume Gomez <guillaume.gomez@huawei.com>
Guillaume Gomez <guillaume1.gomez@gmail.com> Guillaume Gomez <contact@guillaume-gomez.fr>
gnzlbg <gonzalobg88@gmail.com> <gnzlbg@users.noreply.github.com>
hamidreza kalbasi <hamidrezakalbasi@protonmail.com>
Hanna Kruppe <hanna.kruppe@gmail.com> <robin.kruppe@gmail.com>
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_cranelift/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
use rustc_session::Session;
use rustc_session::config::OutputFilenames;
use rustc_span::{Symbol, sym};
use rustc_target::spec::{Abi, Arch, Env, Os};
use rustc_target::spec::{Arch, CfgAbi, Env, Os};

pub use crate::config::*;
use crate::prelude::*;
Expand Down Expand Up @@ -178,7 +178,7 @@ impl CodegenBackend for CraneliftCodegenBackend {
let has_reliable_f16_f128 = !(sess.target.arch == Arch::X86_64
&& sess.target.os == Os::Windows
&& sess.target.env == Env::Gnu
&& sess.target.abi != Abi::Llvm);
&& sess.target.cfg_abi != CfgAbi::Llvm);

// FIXME(f128): f128 math operations need f128 math symbols, which currently aren't always
// filled in by compiler-builtins. The only libc that provides these currently is glibc.
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_codegen_llvm/src/back/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ use crate::builder::gpu_offload::scalar_width;
use crate::common::AsCCharPtr;
use crate::errors::{
CopyBitcode, FromLlvmDiag, FromLlvmOptimizationDiag, LlvmError, ParseTargetMachineConfig,
UnknownCompression, WithLlvmError, WriteBytecode,
UnsupportedCompression, WithLlvmError, WriteBytecode,
};
use crate::llvm::diagnostic::OptimizationDiagnosticKind::*;
use crate::llvm::{self, DiagnosticInfo};
Expand Down Expand Up @@ -225,7 +225,7 @@ pub(crate) fn target_machine_factory(
let triple = SmallCStr::new(&versioned_llvm_target(sess));
let cpu = SmallCStr::new(llvm_util::target_cpu(sess));
let features = CString::new(target_features.join(",")).unwrap();
let abi = SmallCStr::new(&sess.target.llvm_abiname);
let abi = SmallCStr::new(sess.target.llvm_abiname.desc());
let trap_unreachable =
sess.opts.unstable_opts.trap_unreachable.unwrap_or(sess.target.trap_unreachable);
let emit_stack_size_section = sess.opts.unstable_opts.emit_stack_sizes;
Expand All @@ -248,15 +248,15 @@ pub(crate) fn target_machine_factory(
if llvm::LLVMRustLLVMHasZlibCompression() {
llvm::CompressionKind::Zlib
} else {
sess.dcx().emit_warn(UnknownCompression { algorithm: "zlib" });
sess.dcx().emit_warn(UnsupportedCompression { algorithm: "zlib" });
llvm::CompressionKind::None
}
}
config::DebugInfoCompression::Zstd => {
if llvm::LLVMRustLLVMHasZstdCompression() {
llvm::CompressionKind::Zstd
} else {
sess.dcx().emit_warn(UnknownCompression { algorithm: "zstd" });
sess.dcx().emit_warn(UnsupportedCompression { algorithm: "zstd" });
llvm::CompressionKind::None
}
}
Expand Down
9 changes: 4 additions & 5 deletions compiler/rustc_codegen_llvm/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use rustc_session::config::{
use rustc_span::{DUMMY_SP, Span, Spanned, Symbol};
use rustc_symbol_mangling::mangle_internal_symbol;
use rustc_target::spec::{
Abi, Arch, Env, HasTargetSpec, Os, RelocModel, SmallDataThresholdSupport, Target, TlsModel,
Arch, CfgAbi, Env, HasTargetSpec, Os, RelocModel, SmallDataThresholdSupport, Target, TlsModel,
};
use smallvec::SmallVec;

Expand Down Expand Up @@ -344,7 +344,7 @@ pub(crate) unsafe fn create_module<'ll>(
if sess.target.is_like_msvc
|| (sess.target.options.os == Os::Windows
&& sess.target.options.env == Env::Gnu
&& sess.target.options.abi == Abi::Llvm)
&& sess.target.options.cfg_abi == CfgAbi::Llvm)
{
match sess.opts.cg.control_flow_guard {
CFGuard::Disabled => {}
Expand Down Expand Up @@ -509,14 +509,13 @@ pub(crate) unsafe fn create_module<'ll>(
// to workaround lld as the LTO plugin not
// correctly setting target-abi for the LTO object
// FIXME: https://github.com/llvm/llvm-project/issues/50591
// If llvm_abiname is empty, emit nothing.
let llvm_abiname = &sess.target.options.llvm_abiname;
if matches!(sess.target.arch, Arch::RiscV32 | Arch::RiscV64) && !llvm_abiname.is_empty() {
if matches!(sess.target.arch, Arch::RiscV32 | Arch::RiscV64) {
llvm::add_module_flag_str(
llmod,
llvm::ModuleFlagMergeBehavior::Error,
"target-abi",
llvm_abiname,
llvm_abiname.desc(),
);
}

Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_llvm/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,9 @@ pub(crate) struct CopyBitcode {

#[derive(Diagnostic)]
#[diag(
"unknown debuginfo compression algorithm {$algorithm} - will fall back to uncompressed debuginfo"
"unsupported debuginfo compression algorithm {$algorithm} - will fall back to uncompressed debuginfo"
)]
pub(crate) struct UnknownCompression {
pub(crate) struct UnsupportedCompression {
pub algorithm: &'static str,
}

Expand Down
12 changes: 8 additions & 4 deletions compiler/rustc_codegen_llvm/src/llvm_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use rustc_middle::bug;
use rustc_session::Session;
use rustc_session::config::{PrintKind, PrintRequest};
use rustc_target::spec::{
Abi, Arch, Env, MergeFunctions, Os, PanicStrategy, SmallDataThresholdSupport,
Arch, CfgAbi, Env, MergeFunctions, Os, PanicStrategy, SmallDataThresholdSupport,
};
use smallvec::{SmallVec, smallvec};

Expand Down Expand Up @@ -362,7 +362,7 @@ fn update_target_reliable_float_cfg(sess: &Session, cfg: &mut TargetConfig) {
let target_arch = &sess.target.arch;
let target_os = &sess.target.options.os;
let target_env = &sess.target.options.env;
let target_abi = &sess.target.options.abi;
let target_abi = &sess.target.options.cfg_abi;
let target_pointer_width = sess.target.pointer_width;
let version = get_version();
let (major, _, _) = version;
Expand All @@ -371,7 +371,9 @@ fn update_target_reliable_float_cfg(sess: &Session, cfg: &mut TargetConfig) {
// Unsupported <https://github.com/llvm/llvm-project/issues/94434> (fixed in llvm22)
(Arch::Arm64EC, _) if major < 22 => false,
// MinGW ABI bugs <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115054>
(Arch::X86_64, Os::Windows) if *target_env == Env::Gnu && *target_abi != Abi::Llvm => false,
(Arch::X86_64, Os::Windows) if *target_env == Env::Gnu && *target_abi != CfgAbi::Llvm => {
false
}
// Infinite recursion <https://github.com/llvm/llvm-project/issues/97981>
(Arch::CSky, _) if major < 22 => false, // (fixed in llvm22)
(Arch::PowerPC | Arch::PowerPC64, _) if major < 22 => false, // (fixed in llvm22)
Expand All @@ -397,7 +399,9 @@ fn update_target_reliable_float_cfg(sess: &Session, cfg: &mut TargetConfig) {
// ABI unsupported <https://github.com/llvm/llvm-project/issues/41838> (fixed in llvm22)
(Arch::Sparc, _) if major < 22 => false,
// MinGW ABI bugs <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115054>
(Arch::X86_64, Os::Windows) if *target_env == Env::Gnu && *target_abi != Abi::Llvm => false,
(Arch::X86_64, Os::Windows) if *target_env == Env::Gnu && *target_abi != CfgAbi::Llvm => {
false
}
// There are no known problems on other platforms, so the only requirement is that symbols
// are available. `compiler-builtins` provides all symbols required for core `f128`
// support, so this should work for everything else.
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_llvm/src/va_arg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use rustc_codegen_ssa::traits::{
use rustc_middle::bug;
use rustc_middle::ty::Ty;
use rustc_middle::ty::layout::{HasTyCtxt, LayoutOf, TyAndLayout};
use rustc_target::spec::{Arch, Env, RustcAbi};
use rustc_target::spec::{Arch, Env, LlvmAbi, RustcAbi};

use crate::builder::Builder;
use crate::llvm::{Type, Value};
Expand Down Expand Up @@ -1077,7 +1077,7 @@ pub(super) fn emit_va_arg<'ll, 'tcx>(
AllowHigherAlign::Yes,
ForceRightAdjust::Yes,
),
Arch::RiscV32 if target.llvm_abiname == "ilp32e" => {
Arch::RiscV32 if target.llvm_abiname == LlvmAbi::Ilp32e => {
// FIXME: clang manually adjusts the alignment for this ABI. It notes:
//
// > To be compatible with GCC's behaviors, we force arguments with
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_ssa/src/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ use rustc_session::{Session, filesearch};
use rustc_span::Symbol;
use rustc_target::spec::crt_objects::CrtObjects;
use rustc_target::spec::{
Abi, BinaryFormat, Cc, Env, LinkOutputKind, LinkSelfContainedComponents,
BinaryFormat, Cc, CfgAbi, Env, LinkOutputKind, LinkSelfContainedComponents,
LinkSelfContainedDefault, LinkerFeatures, LinkerFlavor, LinkerFlavorCli, Lld, Os, RelocModel,
RelroLevel, SanitizerSet, SplitDebuginfo,
};
Expand Down Expand Up @@ -1917,7 +1917,7 @@ fn self_contained_components(
LinkSelfContainedDefault::InferredForMusl => sess.crt_static(Some(crate_type)),
LinkSelfContainedDefault::InferredForMingw => {
sess.host == sess.target
&& sess.target.abi != Abi::Uwp
&& sess.target.cfg_abi != CfgAbi::Uwp
&& detect_self_contained_mingw(sess, linker)
}
}
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_codegen_ssa/src/back/linker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use rustc_middle::middle::exported_symbols::{
use rustc_middle::ty::TyCtxt;
use rustc_session::Session;
use rustc_session::config::{self, CrateType, DebugInfo, LinkerPluginLto, Lto, OptLevel, Strip};
use rustc_target::spec::{Abi, Arch, Cc, LinkOutputKind, LinkerFlavor, Lld, Os};
use rustc_target::spec::{Arch, Cc, CfgAbi, LinkOutputKind, LinkerFlavor, Lld, Os};
use tracing::{debug, warn};

use super::command::Command;
Expand Down Expand Up @@ -84,7 +84,7 @@ pub(crate) fn get_linker<'a>(
// To comply with the Windows App Certification Kit,
// MSVC needs to link with the Store versions of the runtime libraries (vcruntime, msvcrt, etc).
let t = &sess.target;
if matches!(flavor, LinkerFlavor::Msvc(..)) && t.abi == Abi::Uwp {
if matches!(flavor, LinkerFlavor::Msvc(..)) && t.cfg_abi == CfgAbi::Uwp {
if let Some(ref tool) = msvc_tool {
let original_path = tool.path();
if let Some(root_lib_path) = original_path.ancestors().nth(4) {
Expand Down Expand Up @@ -135,7 +135,7 @@ pub(crate) fn get_linker<'a>(

// FIXME: Move `/LIBPATH` addition for uwp targets from the linker construction
// to the linker args construction.
assert!(cmd.get_args().is_empty() || sess.target.abi == Abi::Uwp);
assert!(cmd.get_args().is_empty() || sess.target.cfg_abi == CfgAbi::Uwp);
match flavor {
LinkerFlavor::Unix(Cc::No) if sess.target.os == Os::L4Re => {
Box::new(L4Bender::new(cmd, sess)) as Box<dyn Linker>
Expand Down
40 changes: 20 additions & 20 deletions compiler/rustc_codegen_ssa/src/back/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use rustc_metadata::fs::METADATA_FILENAME;
use rustc_middle::bug;
use rustc_session::Session;
use rustc_span::sym;
use rustc_target::spec::{Abi, Os, RelocModel, Target, ef_avr_arch};
use rustc_target::spec::{CfgAbi, LlvmAbi, Os, RelocModel, Target, ef_avr_arch};
use tracing::debug;

use super::apple;
Expand Down Expand Up @@ -295,10 +295,10 @@ pub(super) fn elf_e_flags(architecture: Architecture, sess: &Session) -> u32 {
};

// Use the explicitly given ABI.
match sess.target.options.llvm_abiname.as_ref() {
"o32" if is_32bit => e_flags |= elf::EF_MIPS_ABI_O32,
"n32" if !is_32bit => e_flags |= elf::EF_MIPS_ABI2,
"n64" if !is_32bit => {}
match &sess.target.options.llvm_abiname {
LlvmAbi::O32 if is_32bit => e_flags |= elf::EF_MIPS_ABI_O32,
LlvmAbi::N32 if !is_32bit => e_flags |= elf::EF_MIPS_ABI2,
LlvmAbi::N64 if !is_32bit => {}
// The rest is invalid (which is already ensured by the target spec check).
s => bug!("invalid LLVM ABI `{}` for MIPS target", s),
};
Expand Down Expand Up @@ -336,12 +336,12 @@ pub(super) fn elf_e_flags(architecture: Architecture, sess: &Session) -> u32 {

// Set the appropriate flag based on ABI
// This needs to match LLVM `RISCVELFStreamer.cpp`
match &*sess.target.llvm_abiname {
"ilp32" | "lp64" => (),
"ilp32f" | "lp64f" => e_flags |= elf::EF_RISCV_FLOAT_ABI_SINGLE,
"ilp32d" | "lp64d" => e_flags |= elf::EF_RISCV_FLOAT_ABI_DOUBLE,
match &sess.target.llvm_abiname {
LlvmAbi::Ilp32 | LlvmAbi::Lp64 => (),
LlvmAbi::Ilp32f | LlvmAbi::Lp64f => e_flags |= elf::EF_RISCV_FLOAT_ABI_SINGLE,
LlvmAbi::Ilp32d | LlvmAbi::Lp64d => e_flags |= elf::EF_RISCV_FLOAT_ABI_DOUBLE,
// Note that the `lp64e` is still unstable as it's not (yet) part of the ELF psABI.
"ilp32e" | "lp64e" => e_flags |= elf::EF_RISCV_RVE,
LlvmAbi::Ilp32e | LlvmAbi::Lp64e => e_flags |= elf::EF_RISCV_RVE,
_ => bug!("unknown RISC-V ABI name"),
}

Expand All @@ -353,10 +353,10 @@ pub(super) fn elf_e_flags(architecture: Architecture, sess: &Session) -> u32 {

// Set the appropriate flag based on ABI
// This needs to match LLVM `LoongArchELFStreamer.cpp`
match &*sess.target.llvm_abiname {
"ilp32s" | "lp64s" => e_flags |= elf::EF_LARCH_ABI_SOFT_FLOAT,
"ilp32f" | "lp64f" => e_flags |= elf::EF_LARCH_ABI_SINGLE_FLOAT,
"ilp32d" | "lp64d" => e_flags |= elf::EF_LARCH_ABI_DOUBLE_FLOAT,
match &sess.target.llvm_abiname {
LlvmAbi::Ilp32s | LlvmAbi::Lp64s => e_flags |= elf::EF_LARCH_ABI_SOFT_FLOAT,
LlvmAbi::Ilp32f | LlvmAbi::Lp64f => e_flags |= elf::EF_LARCH_ABI_SINGLE_FLOAT,
LlvmAbi::Ilp32d | LlvmAbi::Lp64d => e_flags |= elf::EF_LARCH_ABI_DOUBLE_FLOAT,
_ => bug!("unknown LoongArch ABI name"),
}

Expand All @@ -372,7 +372,7 @@ pub(super) fn elf_e_flags(architecture: Architecture, sess: &Session) -> u32 {
}
}
Architecture::Csky => {
if matches!(sess.target.options.abi, Abi::AbiV2) {
if matches!(sess.target.options.cfg_abi, CfgAbi::AbiV2) {
elf::EF_CSKY_ABIV2
} else {
elf::EF_CSKY_ABIV1
Expand All @@ -383,14 +383,14 @@ pub(super) fn elf_e_flags(architecture: Architecture, sess: &Session) -> u32 {
const EF_PPC64_ABI_ELF_V1: u32 = 1;
const EF_PPC64_ABI_ELF_V2: u32 = 2;

match sess.target.options.llvm_abiname.as_ref() {
match sess.target.options.llvm_abiname {
// If the flags do not correctly indicate the ABI,
// linkers such as ld.lld assume that the ppc64 object files are always ELFv2
// which leads to broken binaries if ELFv1 is used for the object files.
"elfv1" => EF_PPC64_ABI_ELF_V1,
"elfv2" => EF_PPC64_ABI_ELF_V2,
"" if sess.target.options.binary_format.to_object() == BinaryFormat::Elf => {
bug!("No ABI specified for this PPC64 ELF target");
LlvmAbi::ElfV1 => EF_PPC64_ABI_ELF_V1,
LlvmAbi::ElfV2 => EF_PPC64_ABI_ELF_V2,
_ if sess.target.options.binary_format.to_object() == BinaryFormat::Elf => {
bug!("invalid ABI specified for this PPC64 ELF target");
}
// Fall back
_ => EF_PPC64_ABI_UNKNOWN,
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_ssa/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use rustc_middle::ty::{self, Instance, TyCtxt};
use rustc_middle::{bug, mir, span_bug};
use rustc_session::cstore::{DllCallingConvention, DllImport, DllImportSymbolType};
use rustc_span::Span;
use rustc_target::spec::{Abi, Env, Os, Target};
use rustc_target::spec::{CfgAbi, Env, Os, Target};

use crate::traits::*;

Expand Down Expand Up @@ -171,7 +171,7 @@ pub fn asm_const_to_str<'tcx>(
}

pub fn is_mingw_gnu_toolchain(target: &Target) -> bool {
target.os == Os::Windows && target.env == Env::Gnu && target.abi == Abi::Unspecified
target.os == Os::Windows && target.env == Env::Gnu && target.cfg_abi == CfgAbi::Unspecified
}

pub fn i686_decorated_name(
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_const_eval/src/const_eval/fn_queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ fn constness(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Constness {
}
}
Node::TraitItem(ti @ TraitItem { kind: TraitItemKind::Fn(..), .. }) => {
if find_attr!(tcx.hir_attrs(ti.hir_id()), RustcNonConstTraitMethod) {
if find_attr!(tcx, ti.hir_id(), RustcNonConstTraitMethod) {
Constness::NotConst
} else {
tcx.trait_def(tcx.local_parent(def_id)).constness
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_feature/src/unstable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ declare_features! (
/// Allows giving non-const impls custom diagnostic messages if attempted to be used as const
(unstable, diagnostic_on_const, "1.93.0", Some(143874)),
/// Allows giving on-move borrowck custom diagnostic messages for a type
(unstable, diagnostic_on_move, "CURRENT_RUSTC_VERSION", Some(150935)),
(unstable, diagnostic_on_move, "CURRENT_RUSTC_VERSION", Some(154181)),
/// Allows `#[doc(cfg(...))]`.
(unstable, doc_cfg, "1.21.0", Some(43781)),
/// Allows `#[doc(masked)]`.
Expand Down
26 changes: 19 additions & 7 deletions compiler/rustc_hir/src/attrs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ pub mod diagnostic;
mod encode_cross_crate;
mod pretty_printing;

/// A trait for types that can provide a list of attributes given a `TyCtxt`.
///
/// It allows `find_attr!` to accept either a `DefId`, `LocalDefId`, `OwnerId`, or `HirId`.
/// It is defined here with a generic `Tcx` because `rustc_hir` can't depend on `rustc_middle`.
/// The concrete implementations are in `rustc_middle`.
pub trait HasAttrs<'tcx, Tcx> {
fn get_attrs(self, tcx: &Tcx) -> &'tcx [crate::Attribute];
}

/// Finds attributes in sequences of attributes by pattern matching.
///
/// A little like `matches` but for attributes.
Expand All @@ -34,10 +43,12 @@ mod pretty_printing;
///
/// As a convenience, this macro can do that for you!
///
/// Instead of providing an attribute list, provide the `tcx` and a `DefId`.
/// Instead of providing an attribute list, provide the `tcx` and an id
/// (a `DefId`, `LocalDefId`, `OwnerId` or `HirId`).
///
/// ```rust,ignore (illustrative)
/// find_attr!(tcx, def_id, <pattern>)
/// find_attr!(tcx, hir_id, <pattern>)
/// ```
///
/// Another common case is finding attributes applied to the root of the current crate.
Expand All @@ -55,13 +66,14 @@ macro_rules! find_attr {
$crate::find_attr!($tcx.hir_krate_attrs(), $pattern $(if $guard)? => $e)
};

($tcx: expr, $def_id: expr, $pattern: pat $(if $guard: expr)?) => {
$crate::find_attr!($tcx, $def_id, $pattern $(if $guard)? => ()).is_some()
($tcx: expr, $id: expr, $pattern: pat $(if $guard: expr)?) => {
$crate::find_attr!($tcx, $id, $pattern $(if $guard)? => ()).is_some()
};
($tcx: expr, $def_id: expr, $pattern: pat $(if $guard: expr)? => $e: expr) => {{
#[allow(deprecated)] {
$crate::find_attr!($tcx.get_all_attrs($def_id), $pattern $(if $guard)? => $e)
}
($tcx: expr, $id: expr, $pattern: pat $(if $guard: expr)? => $e: expr) => {{
$crate::find_attr!(
$crate::attrs::HasAttrs::get_attrs($id, &$tcx),
$pattern $(if $guard)? => $e
)
}};


Expand Down
Loading
Loading