Skip to content

Commit 13e2aba

Browse files
committed
Auto merge of #154255 - JonathanBrouwer:rollup-kVSo6wy, r=JonathanBrouwer
Rollup of 21 pull requests Successful merges: - #152543 (privacy: Fix type privacy holes in RPITITs) - #153107 (Optimize BTreeMap::append() using CursorMut) - #153312 (Packages as namespaces part 1) - #153534 (Remove a flaky `got_timeout` assert from two channel tests) - #153718 (Fix environ on FreeBSD with cdylib targets that use -Wl,--no-undefined .) - #153857 (Rename `target.abi` to `target.cfg_abi` and enum-ify llvm_abiname) - #153880 (Lifted intersperse and intersperse_with Fused transformation and updated documentation + tests) - #153931 (remove usages of to-be-deprecated numeric constants) - #150630 (Unknown -> Unsupported compression algorithm) - #153491 (Move `freeze_*` methods to `OpenOptionsExt2`) - #153582 (Simplify find_attr! for HirId usage) - #153623 (std: move `sys::pal::os` to `sys::paths`) - #153647 (docs(fs): Clarify That File::lock Coordinates Across Processes) - #153936 (Skip stack_start_aligned for immediate-abort) - #154011 (implement `BinaryHeap::as_mut_slice`) - #154167 (ui/lto: move and rename two tests from issues/) - #154174 (allow `incomplete_features` in most UI tests) - #154175 (Add new alias for Guillaume Gomez email address) - #154182 (diagnostics: avoid ICE for undeclared generic parameter in impl) - #154188 (Update the tracking issue for #[diagnostic::on_move]) - #154201 (Use enums to clarify `DepNodeColorMap` color marking )
2 parents bbe8536 + baffc5e commit 13e2aba

File tree

410 files changed

+2107
-2373
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

410 files changed

+2107
-2373
lines changed

‎.mailmap‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ Guillaume Gomez <guillaume1.gomez@gmail.com>
262262
Guillaume Gomez <guillaume1.gomez@gmail.com> ggomez <ggomez@ggo.ifr.lan>
263263
Guillaume Gomez <guillaume1.gomez@gmail.com> Guillaume Gomez <ggomez@ggo.ifr.lan>
264264
Guillaume Gomez <guillaume1.gomez@gmail.com> Guillaume Gomez <guillaume.gomez@huawei.com>
265+
Guillaume Gomez <guillaume1.gomez@gmail.com> Guillaume Gomez <contact@guillaume-gomez.fr>
265266
gnzlbg <gonzalobg88@gmail.com> <gnzlbg@users.noreply.github.com>
266267
hamidreza kalbasi <hamidrezakalbasi@protonmail.com>
267268
Hanna Kruppe <hanna.kruppe@gmail.com> <robin.kruppe@gmail.com>

‎compiler/rustc_codegen_cranelift/src/lib.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
4646
use rustc_session::Session;
4747
use rustc_session::config::OutputFilenames;
4848
use rustc_span::{Symbol, sym};
49-
use rustc_target::spec::{Abi, Arch, Env, Os};
49+
use rustc_target::spec::{Arch, CfgAbi, Env, Os};
5050

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

183183
// FIXME(f128): f128 math operations need f128 math symbols, which currently aren't always
184184
// filled in by compiler-builtins. The only libc that provides these currently is glibc.

‎compiler/rustc_codegen_llvm/src/back/write.rs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ use crate::builder::gpu_offload::scalar_width;
3636
use crate::common::AsCCharPtr;
3737
use crate::errors::{
3838
CopyBitcode, FromLlvmDiag, FromLlvmOptimizationDiag, LlvmError, ParseTargetMachineConfig,
39-
UnknownCompression, WithLlvmError, WriteBytecode,
39+
UnsupportedCompression, WithLlvmError, WriteBytecode,
4040
};
4141
use crate::llvm::diagnostic::OptimizationDiagnosticKind::*;
4242
use crate::llvm::{self, DiagnosticInfo};
@@ -225,7 +225,7 @@ pub(crate) fn target_machine_factory(
225225
let triple = SmallCStr::new(&versioned_llvm_target(sess));
226226
let cpu = SmallCStr::new(llvm_util::target_cpu(sess));
227227
let features = CString::new(target_features.join(",")).unwrap();
228-
let abi = SmallCStr::new(&sess.target.llvm_abiname);
228+
let abi = SmallCStr::new(sess.target.llvm_abiname.desc());
229229
let trap_unreachable =
230230
sess.opts.unstable_opts.trap_unreachable.unwrap_or(sess.target.trap_unreachable);
231231
let emit_stack_size_section = sess.opts.unstable_opts.emit_stack_sizes;
@@ -248,15 +248,15 @@ pub(crate) fn target_machine_factory(
248248
if llvm::LLVMRustLLVMHasZlibCompression() {
249249
llvm::CompressionKind::Zlib
250250
} else {
251-
sess.dcx().emit_warn(UnknownCompression { algorithm: "zlib" });
251+
sess.dcx().emit_warn(UnsupportedCompression { algorithm: "zlib" });
252252
llvm::CompressionKind::None
253253
}
254254
}
255255
config::DebugInfoCompression::Zstd => {
256256
if llvm::LLVMRustLLVMHasZstdCompression() {
257257
llvm::CompressionKind::Zstd
258258
} else {
259-
sess.dcx().emit_warn(UnknownCompression { algorithm: "zstd" });
259+
sess.dcx().emit_warn(UnsupportedCompression { algorithm: "zstd" });
260260
llvm::CompressionKind::None
261261
}
262262
}

‎compiler/rustc_codegen_llvm/src/context.rs‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use rustc_session::config::{
2828
use rustc_span::{DUMMY_SP, Span, Spanned, Symbol};
2929
use rustc_symbol_mangling::mangle_internal_symbol;
3030
use rustc_target::spec::{
31-
Abi, Arch, Env, HasTargetSpec, Os, RelocModel, SmallDataThresholdSupport, Target, TlsModel,
31+
Arch, CfgAbi, Env, HasTargetSpec, Os, RelocModel, SmallDataThresholdSupport, Target, TlsModel,
3232
};
3333
use smallvec::SmallVec;
3434

@@ -344,7 +344,7 @@ pub(crate) unsafe fn create_module<'ll>(
344344
if sess.target.is_like_msvc
345345
|| (sess.target.options.os == Os::Windows
346346
&& sess.target.options.env == Env::Gnu
347-
&& sess.target.options.abi == Abi::Llvm)
347+
&& sess.target.options.cfg_abi == CfgAbi::Llvm)
348348
{
349349
match sess.opts.cg.control_flow_guard {
350350
CFGuard::Disabled => {}
@@ -509,14 +509,13 @@ pub(crate) unsafe fn create_module<'ll>(
509509
// to workaround lld as the LTO plugin not
510510
// correctly setting target-abi for the LTO object
511511
// FIXME: https://github.com/llvm/llvm-project/issues/50591
512-
// If llvm_abiname is empty, emit nothing.
513512
let llvm_abiname = &sess.target.options.llvm_abiname;
514-
if matches!(sess.target.arch, Arch::RiscV32 | Arch::RiscV64) && !llvm_abiname.is_empty() {
513+
if matches!(sess.target.arch, Arch::RiscV32 | Arch::RiscV64) {
515514
llvm::add_module_flag_str(
516515
llmod,
517516
llvm::ModuleFlagMergeBehavior::Error,
518517
"target-abi",
519-
llvm_abiname,
518+
llvm_abiname.desc(),
520519
);
521520
}
522521

‎compiler/rustc_codegen_llvm/src/errors.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,9 @@ pub(crate) struct CopyBitcode {
182182

183183
#[derive(Diagnostic)]
184184
#[diag(
185-
"unknown debuginfo compression algorithm {$algorithm} - will fall back to uncompressed debuginfo"
185+
"unsupported debuginfo compression algorithm {$algorithm} - will fall back to uncompressed debuginfo"
186186
)]
187-
pub(crate) struct UnknownCompression {
187+
pub(crate) struct UnsupportedCompression {
188188
pub algorithm: &'static str,
189189
}
190190

‎compiler/rustc_codegen_llvm/src/llvm_util.rs‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use rustc_middle::bug;
1616
use rustc_session::Session;
1717
use rustc_session::config::{PrintKind, PrintRequest};
1818
use rustc_target::spec::{
19-
Abi, Arch, Env, MergeFunctions, Os, PanicStrategy, SmallDataThresholdSupport,
19+
Arch, CfgAbi, Env, MergeFunctions, Os, PanicStrategy, SmallDataThresholdSupport,
2020
};
2121
use smallvec::{SmallVec, smallvec};
2222

@@ -362,7 +362,7 @@ fn update_target_reliable_float_cfg(sess: &Session, cfg: &mut TargetConfig) {
362362
let target_arch = &sess.target.arch;
363363
let target_os = &sess.target.options.os;
364364
let target_env = &sess.target.options.env;
365-
let target_abi = &sess.target.options.abi;
365+
let target_abi = &sess.target.options.cfg_abi;
366366
let target_pointer_width = sess.target.pointer_width;
367367
let version = get_version();
368368
let (major, _, _) = version;
@@ -371,7 +371,9 @@ fn update_target_reliable_float_cfg(sess: &Session, cfg: &mut TargetConfig) {
371371
// Unsupported <https://github.com/llvm/llvm-project/issues/94434> (fixed in llvm22)
372372
(Arch::Arm64EC, _) if major < 22 => false,
373373
// MinGW ABI bugs <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115054>
374-
(Arch::X86_64, Os::Windows) if *target_env == Env::Gnu && *target_abi != Abi::Llvm => false,
374+
(Arch::X86_64, Os::Windows) if *target_env == Env::Gnu && *target_abi != CfgAbi::Llvm => {
375+
false
376+
}
375377
// Infinite recursion <https://github.com/llvm/llvm-project/issues/97981>
376378
(Arch::CSky, _) if major < 22 => false, // (fixed in llvm22)
377379
(Arch::PowerPC | Arch::PowerPC64, _) if major < 22 => false, // (fixed in llvm22)
@@ -397,7 +399,9 @@ fn update_target_reliable_float_cfg(sess: &Session, cfg: &mut TargetConfig) {
397399
// ABI unsupported <https://github.com/llvm/llvm-project/issues/41838> (fixed in llvm22)
398400
(Arch::Sparc, _) if major < 22 => false,
399401
// MinGW ABI bugs <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115054>
400-
(Arch::X86_64, Os::Windows) if *target_env == Env::Gnu && *target_abi != Abi::Llvm => false,
402+
(Arch::X86_64, Os::Windows) if *target_env == Env::Gnu && *target_abi != CfgAbi::Llvm => {
403+
false
404+
}
401405
// There are no known problems on other platforms, so the only requirement is that symbols
402406
// are available. `compiler-builtins` provides all symbols required for core `f128`
403407
// support, so this should work for everything else.

‎compiler/rustc_codegen_llvm/src/va_arg.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use rustc_codegen_ssa::traits::{
88
use rustc_middle::bug;
99
use rustc_middle::ty::Ty;
1010
use rustc_middle::ty::layout::{HasTyCtxt, LayoutOf, TyAndLayout};
11-
use rustc_target::spec::{Arch, Env, RustcAbi};
11+
use rustc_target::spec::{Arch, Env, LlvmAbi, RustcAbi};
1212

1313
use crate::builder::Builder;
1414
use crate::llvm::{Type, Value};
@@ -1077,7 +1077,7 @@ pub(super) fn emit_va_arg<'ll, 'tcx>(
10771077
AllowHigherAlign::Yes,
10781078
ForceRightAdjust::Yes,
10791079
),
1080-
Arch::RiscV32 if target.llvm_abiname == "ilp32e" => {
1080+
Arch::RiscV32 if target.llvm_abiname == LlvmAbi::Ilp32e => {
10811081
// FIXME: clang manually adjusts the alignment for this ABI. It notes:
10821082
//
10831083
// > To be compatible with GCC's behaviors, we force arguments with

‎compiler/rustc_codegen_ssa/src/back/link.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ use rustc_session::{Session, filesearch};
4747
use rustc_span::Symbol;
4848
use rustc_target::spec::crt_objects::CrtObjects;
4949
use rustc_target::spec::{
50-
Abi, BinaryFormat, Cc, Env, LinkOutputKind, LinkSelfContainedComponents,
50+
BinaryFormat, Cc, CfgAbi, Env, LinkOutputKind, LinkSelfContainedComponents,
5151
LinkSelfContainedDefault, LinkerFeatures, LinkerFlavor, LinkerFlavorCli, Lld, Os, RelocModel,
5252
RelroLevel, SanitizerSet, SplitDebuginfo,
5353
};
@@ -1917,7 +1917,7 @@ fn self_contained_components(
19171917
LinkSelfContainedDefault::InferredForMusl => sess.crt_static(Some(crate_type)),
19181918
LinkSelfContainedDefault::InferredForMingw => {
19191919
sess.host == sess.target
1920-
&& sess.target.abi != Abi::Uwp
1920+
&& sess.target.cfg_abi != CfgAbi::Uwp
19211921
&& detect_self_contained_mingw(sess, linker)
19221922
}
19231923
}

‎compiler/rustc_codegen_ssa/src/back/linker.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use rustc_middle::middle::exported_symbols::{
1818
use rustc_middle::ty::TyCtxt;
1919
use rustc_session::Session;
2020
use rustc_session::config::{self, CrateType, DebugInfo, LinkerPluginLto, Lto, OptLevel, Strip};
21-
use rustc_target::spec::{Abi, Arch, Cc, LinkOutputKind, LinkerFlavor, Lld, Os};
21+
use rustc_target::spec::{Arch, Cc, CfgAbi, LinkOutputKind, LinkerFlavor, Lld, Os};
2222
use tracing::{debug, warn};
2323

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

136136
// FIXME: Move `/LIBPATH` addition for uwp targets from the linker construction
137137
// to the linker args construction.
138-
assert!(cmd.get_args().is_empty() || sess.target.abi == Abi::Uwp);
138+
assert!(cmd.get_args().is_empty() || sess.target.cfg_abi == CfgAbi::Uwp);
139139
match flavor {
140140
LinkerFlavor::Unix(Cc::No) if sess.target.os == Os::L4Re => {
141141
Box::new(L4Bender::new(cmd, sess)) as Box<dyn Linker>

‎compiler/rustc_codegen_ssa/src/back/metadata.rs‎

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use rustc_metadata::fs::METADATA_FILENAME;
2020
use rustc_middle::bug;
2121
use rustc_session::Session;
2222
use rustc_span::sym;
23-
use rustc_target::spec::{Abi, Os, RelocModel, Target, ef_avr_arch};
23+
use rustc_target::spec::{CfgAbi, LlvmAbi, Os, RelocModel, Target, ef_avr_arch};
2424
use tracing::debug;
2525

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

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

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

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

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

@@ -372,7 +372,7 @@ pub(super) fn elf_e_flags(architecture: Architecture, sess: &Session) -> u32 {
372372
}
373373
}
374374
Architecture::Csky => {
375-
if matches!(sess.target.options.abi, Abi::AbiV2) {
375+
if matches!(sess.target.options.cfg_abi, CfgAbi::AbiV2) {
376376
elf::EF_CSKY_ABIV2
377377
} else {
378378
elf::EF_CSKY_ABIV1
@@ -383,14 +383,14 @@ pub(super) fn elf_e_flags(architecture: Architecture, sess: &Session) -> u32 {
383383
const EF_PPC64_ABI_ELF_V1: u32 = 1;
384384
const EF_PPC64_ABI_ELF_V2: u32 = 2;
385385

386-
match sess.target.options.llvm_abiname.as_ref() {
386+
match sess.target.options.llvm_abiname {
387387
// If the flags do not correctly indicate the ABI,
388388
// linkers such as ld.lld assume that the ppc64 object files are always ELFv2
389389
// which leads to broken binaries if ELFv1 is used for the object files.
390-
"elfv1" => EF_PPC64_ABI_ELF_V1,
391-
"elfv2" => EF_PPC64_ABI_ELF_V2,
392-
"" if sess.target.options.binary_format.to_object() == BinaryFormat::Elf => {
393-
bug!("No ABI specified for this PPC64 ELF target");
390+
LlvmAbi::ElfV1 => EF_PPC64_ABI_ELF_V1,
391+
LlvmAbi::ElfV2 => EF_PPC64_ABI_ELF_V2,
392+
_ if sess.target.options.binary_format.to_object() == BinaryFormat::Elf => {
393+
bug!("invalid ABI specified for this PPC64 ELF target");
394394
}
395395
// Fall back
396396
_ => EF_PPC64_ABI_UNKNOWN,

0 commit comments

Comments
 (0)