authorbors <bors@rust-lang.org> 2026-03-23 11:17:44 UTC
committerbors <bors@rust-lang.org> 2026-03-23 11:17:44 UTC
log13e2abaac846b2680ae93e1b3bd9fe7fe1b9a7fe
tree2478b2e426d0a6f627f6b1a35ddde5d64e648cdd
parentbbe853615821442ef11d6cd42a30a73432b38d89
parentbaffc5e9bc04e11efe911cf6c56c2792d5cebb4a

Auto merge of #154255 - JonathanBrouwer:rollup-kVSo6wy, r=JonathanBrouwer

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

418 files changed, 2998 insertions(+), 3264 deletions(-)

.mailmap+1
......@@ -262,6 +262,7 @@ Guillaume Gomez <guillaume1.gomez@gmail.com>
262262Guillaume Gomez <guillaume1.gomez@gmail.com> ggomez <ggomez@ggo.ifr.lan>
263263Guillaume Gomez <guillaume1.gomez@gmail.com> Guillaume Gomez <ggomez@ggo.ifr.lan>
264264Guillaume Gomez <guillaume1.gomez@gmail.com> Guillaume Gomez <guillaume.gomez@huawei.com>
265Guillaume Gomez <guillaume1.gomez@gmail.com> Guillaume Gomez <contact@guillaume-gomez.fr>
265266gnzlbg <gonzalobg88@gmail.com> <gnzlbg@users.noreply.github.com>
266267hamidreza kalbasi <hamidrezakalbasi@protonmail.com>
267268Hanna Kruppe <hanna.kruppe@gmail.com> <robin.kruppe@gmail.com>
compiler/rustc_codegen_cranelift/src/lib.rs+2-2
......@@ -46,7 +46,7 @@ use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
4646use rustc_session::Session;
4747use rustc_session::config::OutputFilenames;
4848use rustc_span::{Symbol, sym};
49use rustc_target::spec::{Abi, Arch, Env, Os};
49use rustc_target::spec::{Arch, CfgAbi, Env, Os};
5050
5151pub use crate::config::*;
5252use 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+4-4
......@@ -36,7 +36,7 @@ use crate::builder::gpu_offload::scalar_width;
3636use crate::common::AsCCharPtr;
3737use crate::errors::{
3838 CopyBitcode, FromLlvmDiag, FromLlvmOptimizationDiag, LlvmError, ParseTargetMachineConfig,
39 UnknownCompression, WithLlvmError, WriteBytecode,
39 UnsupportedCompression, WithLlvmError, WriteBytecode,
4040};
4141use crate::llvm::diagnostic::OptimizationDiagnosticKind::*;
4242use 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,7 +248,7 @@ 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 }
......@@ -256,7 +256,7 @@ pub(crate) fn target_machine_factory(
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+4-5
......@@ -28,7 +28,7 @@ use rustc_session::config::{
2828use rustc_span::{DUMMY_SP, Span, Spanned, Symbol};
2929use rustc_symbol_mangling::mangle_internal_symbol;
3030use rustc_target::spec::{
31 Abi, Arch, Env, HasTargetSpec, Os, RelocModel, SmallDataThresholdSupport, Target, TlsModel,
31 Arch, CfgAbi, Env, HasTargetSpec, Os, RelocModel, SmallDataThresholdSupport, Target, TlsModel,
3232};
3333use 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+2-2
......@@ -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)]
187pub(crate) struct UnknownCompression {
187pub(crate) struct UnsupportedCompression {
188188 pub algorithm: &'static str,
189189}
190190
compiler/rustc_codegen_llvm/src/llvm_util.rs+8-4
......@@ -16,7 +16,7 @@ use rustc_middle::bug;
1616use rustc_session::Session;
1717use rustc_session::config::{PrintKind, PrintRequest};
1818use rustc_target::spec::{
19 Abi, Arch, Env, MergeFunctions, Os, PanicStrategy, SmallDataThresholdSupport,
19 Arch, CfgAbi, Env, MergeFunctions, Os, PanicStrategy, SmallDataThresholdSupport,
2020};
2121use 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+2-2
......@@ -8,7 +8,7 @@ use rustc_codegen_ssa::traits::{
88use rustc_middle::bug;
99use rustc_middle::ty::Ty;
1010use rustc_middle::ty::layout::{HasTyCtxt, LayoutOf, TyAndLayout};
11use rustc_target::spec::{Arch, Env, RustcAbi};
11use rustc_target::spec::{Arch, Env, LlvmAbi, RustcAbi};
1212
1313use crate::builder::Builder;
1414use 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+2-2
......@@ -47,7 +47,7 @@ use rustc_session::{Session, filesearch};
4747use rustc_span::Symbol;
4848use rustc_target::spec::crt_objects::CrtObjects;
4949use 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+3-3
......@@ -18,7 +18,7 @@ use rustc_middle::middle::exported_symbols::{
1818use rustc_middle::ty::TyCtxt;
1919use rustc_session::Session;
2020use rustc_session::config::{self, CrateType, DebugInfo, LinkerPluginLto, Lto, OptLevel, Strip};
21use rustc_target::spec::{Abi, Arch, Cc, LinkOutputKind, LinkerFlavor, Lld, Os};
21use rustc_target::spec::{Arch, Cc, CfgAbi, LinkOutputKind, LinkerFlavor, Lld, Os};
2222use tracing::{debug, warn};
2323
2424use 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+20-20
......@@ -20,7 +20,7 @@ use rustc_metadata::fs::METADATA_FILENAME;
2020use rustc_middle::bug;
2121use rustc_session::Session;
2222use rustc_span::sym;
23use rustc_target::spec::{Abi, Os, RelocModel, Target, ef_avr_arch};
23use rustc_target::spec::{CfgAbi, LlvmAbi, Os, RelocModel, Target, ef_avr_arch};
2424use tracing::debug;
2525
2626use 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,
compiler/rustc_codegen_ssa/src/common.rs+2-2
......@@ -7,7 +7,7 @@ use rustc_middle::ty::{self, Instance, TyCtxt};
77use rustc_middle::{bug, mir, span_bug};
88use rustc_session::cstore::{DllCallingConvention, DllImport, DllImportSymbolType};
99use rustc_span::Span;
10use rustc_target::spec::{Abi, Env, Os, Target};
10use rustc_target::spec::{CfgAbi, Env, Os, Target};
1111
1212use crate::traits::*;
1313
......@@ -171,7 +171,7 @@ pub fn asm_const_to_str<'tcx>(
171171}
172172
173173pub fn is_mingw_gnu_toolchain(target: &Target) -> bool {
174 target.os == Os::Windows && target.env == Env::Gnu && target.abi == Abi::Unspecified
174 target.os == Os::Windows && target.env == Env::Gnu && target.cfg_abi == CfgAbi::Unspecified
175175}
176176
177177pub fn i686_decorated_name(
compiler/rustc_const_eval/src/const_eval/fn_queries.rs+1-1
......@@ -37,7 +37,7 @@ fn constness(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Constness {
3737 }
3838 }
3939 Node::TraitItem(ti @ TraitItem { kind: TraitItemKind::Fn(..), .. }) => {
40 if find_attr!(tcx.hir_attrs(ti.hir_id()), RustcNonConstTraitMethod) {
40 if find_attr!(tcx, ti.hir_id(), RustcNonConstTraitMethod) {
4141 Constness::NotConst
4242 } else {
4343 tcx.trait_def(tcx.local_parent(def_id)).constness
compiler/rustc_feature/src/unstable.rs+1-1
......@@ -473,7 +473,7 @@ declare_features! (
473473 /// Allows giving non-const impls custom diagnostic messages if attempted to be used as const
474474 (unstable, diagnostic_on_const, "1.93.0", Some(143874)),
475475 /// Allows giving on-move borrowck custom diagnostic messages for a type
476 (unstable, diagnostic_on_move, "CURRENT_RUSTC_VERSION", Some(150935)),
476 (unstable, diagnostic_on_move, "CURRENT_RUSTC_VERSION", Some(154181)),
477477 /// Allows `#[doc(cfg(...))]`.
478478 (unstable, doc_cfg, "1.21.0", Some(43781)),
479479 /// Allows `#[doc(masked)]`.
compiler/rustc_hir/src/attrs/mod.rs+19-7
......@@ -13,6 +13,15 @@ pub mod diagnostic;
1313mod encode_cross_crate;
1414mod pretty_printing;
1515
16/// A trait for types that can provide a list of attributes given a `TyCtxt`.
17///
18/// It allows `find_attr!` to accept either a `DefId`, `LocalDefId`, `OwnerId`, or `HirId`.
19/// It is defined here with a generic `Tcx` because `rustc_hir` can't depend on `rustc_middle`.
20/// The concrete implementations are in `rustc_middle`.
21pub trait HasAttrs<'tcx, Tcx> {
22 fn get_attrs(self, tcx: &Tcx) -> &'tcx [crate::Attribute];
23}
24
1625/// Finds attributes in sequences of attributes by pattern matching.
1726///
1827/// A little like `matches` but for attributes.
......@@ -34,10 +43,12 @@ mod pretty_printing;
3443///
3544/// As a convenience, this macro can do that for you!
3645///
37/// Instead of providing an attribute list, provide the `tcx` and a `DefId`.
46/// Instead of providing an attribute list, provide the `tcx` and an id
47/// (a `DefId`, `LocalDefId`, `OwnerId` or `HirId`).
3848///
3949/// ```rust,ignore (illustrative)
4050/// find_attr!(tcx, def_id, <pattern>)
51/// find_attr!(tcx, hir_id, <pattern>)
4152/// ```
4253///
4354/// Another common case is finding attributes applied to the root of the current crate.
......@@ -55,13 +66,14 @@ macro_rules! find_attr {
5566 $crate::find_attr!($tcx.hir_krate_attrs(), $pattern $(if $guard)? => $e)
5667 };
5768
58 ($tcx: expr, $def_id: expr, $pattern: pat $(if $guard: expr)?) => {
59 $crate::find_attr!($tcx, $def_id, $pattern $(if $guard)? => ()).is_some()
69 ($tcx: expr, $id: expr, $pattern: pat $(if $guard: expr)?) => {
70 $crate::find_attr!($tcx, $id, $pattern $(if $guard)? => ()).is_some()
6071 };
61 ($tcx: expr, $def_id: expr, $pattern: pat $(if $guard: expr)? => $e: expr) => {{
62 #[allow(deprecated)] {
63 $crate::find_attr!($tcx.get_all_attrs($def_id), $pattern $(if $guard)? => $e)
64 }
72 ($tcx: expr, $id: expr, $pattern: pat $(if $guard: expr)? => $e: expr) => {{
73 $crate::find_attr!(
74 $crate::attrs::HasAttrs::get_attrs($id, &$tcx),
75 $pattern $(if $guard)? => $e
76 )
6577 }};
6678
6779
compiler/rustc_hir/src/def.rs+16-3
......@@ -590,6 +590,13 @@ pub enum Res<Id = hir::HirId> {
590590 /// **Belongs to the type namespace.**
591591 ToolMod,
592592
593 /// The resolution for an open module in a namespaced crate. E.g. `my_api`
594 /// in the namespaced crate `my_api::utils` when `my_api` isn't part of the
595 /// extern prelude.
596 ///
597 /// **Belongs to the type namespace.**
598 OpenMod(Symbol),
599
593600 // Macro namespace
594601 /// An attribute that is *not* implemented via macro.
595602 /// E.g., `#[inline]` and `#[rustfmt::skip]`, which are essentially directives,
......@@ -838,6 +845,7 @@ impl<Id> Res<Id> {
838845 | Res::SelfTyAlias { .. }
839846 | Res::SelfCtor(..)
840847 | Res::ToolMod
848 | Res::OpenMod(..)
841849 | Res::NonMacroAttr(..)
842850 | Res::Err => None,
843851 }
......@@ -869,6 +877,7 @@ impl<Id> Res<Id> {
869877 Res::Local(..) => "local variable",
870878 Res::SelfTyParam { .. } | Res::SelfTyAlias { .. } => "self type",
871879 Res::ToolMod => "tool module",
880 Res::OpenMod(..) => "namespaced crate",
872881 Res::NonMacroAttr(attr_kind) => attr_kind.descr(),
873882 Res::Err => "unresolved item",
874883 }
......@@ -895,6 +904,7 @@ impl<Id> Res<Id> {
895904 Res::SelfTyAlias { alias_to, is_trait_impl }
896905 }
897906 Res::ToolMod => Res::ToolMod,
907 Res::OpenMod(sym) => Res::OpenMod(sym),
898908 Res::NonMacroAttr(attr_kind) => Res::NonMacroAttr(attr_kind),
899909 Res::Err => Res::Err,
900910 }
......@@ -911,6 +921,7 @@ impl<Id> Res<Id> {
911921 Res::SelfTyAlias { alias_to, is_trait_impl }
912922 }
913923 Res::ToolMod => Res::ToolMod,
924 Res::OpenMod(sym) => Res::OpenMod(sym),
914925 Res::NonMacroAttr(attr_kind) => Res::NonMacroAttr(attr_kind),
915926 Res::Err => Res::Err,
916927 })
......@@ -936,9 +947,11 @@ impl<Id> Res<Id> {
936947 pub fn ns(&self) -> Option<Namespace> {
937948 match self {
938949 Res::Def(kind, ..) => kind.ns(),
939 Res::PrimTy(..) | Res::SelfTyParam { .. } | Res::SelfTyAlias { .. } | Res::ToolMod => {
940 Some(Namespace::TypeNS)
941 }
950 Res::PrimTy(..)
951 | Res::SelfTyParam { .. }
952 | Res::SelfTyAlias { .. }
953 | Res::ToolMod
954 | Res::OpenMod(..) => Some(Namespace::TypeNS),
942955 Res::SelfCtor(..) | Res::Local(..) => Some(Namespace::ValueNS),
943956 Res::NonMacroAttr(..) => Some(Namespace::MacroNS),
944957 Res::Err => None,
compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs+1
......@@ -2830,6 +2830,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
28302830 | Res::SelfCtor(_)
28312831 | Res::Local(_)
28322832 | Res::ToolMod
2833 | Res::OpenMod(..)
28332834 | Res::NonMacroAttr(_)
28342835 | Res::Err) => Const::new_error_with_message(
28352836 tcx,
compiler/rustc_hir_typeck/src/loops.rs+2-2
......@@ -207,7 +207,7 @@ impl<'hir> Visitor<'hir> for CheckLoopVisitor<'hir> {
207207 };
208208
209209 // A `#[const_continue]` must break to a block in a `#[loop_match]`.
210 if find_attr!(self.tcx.hir_attrs(e.hir_id), ConstContinue(_)) {
210 if find_attr!(self.tcx, e.hir_id, ConstContinue(_)) {
211211 let Some(label) = break_destination.label else {
212212 let span = e.span;
213213 self.tcx.dcx().emit_fatal(ConstContinueBadLabel { span });
......@@ -420,7 +420,7 @@ impl<'hir> CheckLoopVisitor<'hir> {
420420 e: &'hir hir::Expr<'hir>,
421421 body: &'hir hir::Block<'hir>,
422422 ) -> Option<Destination> {
423 if !find_attr!(self.tcx.hir_attrs(e.hir_id), LoopMatch(_)) {
423 if !find_attr!(self.tcx, e.hir_id, LoopMatch(_)) {
424424 return None;
425425 }
426426
compiler/rustc_interface/src/proc_macro_decls.rs+1-1
......@@ -7,7 +7,7 @@ fn proc_macro_decls_static(tcx: TyCtxt<'_>, (): ()) -> Option<LocalDefId> {
77 let mut decls = None;
88
99 for id in tcx.hir_free_items() {
10 if find_attr!(tcx.hir_attrs(id.hir_id()), RustcProcMacroDecls) {
10 if find_attr!(tcx, id.hir_id(), RustcProcMacroDecls) {
1111 decls = Some(id.owner_id.def_id);
1212 }
1313 }
compiler/rustc_metadata/src/native_libs.rs+3-3
......@@ -19,7 +19,7 @@ use rustc_session::cstore::{
1919use rustc_session::search_paths::PathKind;
2020use rustc_span::Symbol;
2121use rustc_span::def_id::{DefId, LOCAL_CRATE};
22use rustc_target::spec::{Abi, Arch, BinaryFormat, Env, LinkSelfContainedComponents, Os};
22use rustc_target::spec::{Arch, BinaryFormat, CfgAbi, Env, LinkSelfContainedComponents, Os};
2323
2424use crate::errors;
2525
......@@ -73,14 +73,14 @@ pub fn walk_native_lib_search_dirs<R>(
7373 // FIXME: On AIX this also has the side-effect of making the list of library search paths
7474 // non-empty, which is needed or the linker may decide to record the LIBPATH env, if
7575 // defined, as the search path instead of appending the default search paths.
76 if sess.target.abi == Abi::Fortanix
76 if sess.target.cfg_abi == CfgAbi::Fortanix
7777 || sess.target.os == Os::Linux
7878 || sess.target.os == Os::Fuchsia
7979 || sess.target.is_like_aix
8080 || sess.target.is_like_darwin && !sess.sanitizers().is_empty()
8181 || sess.target.os == Os::Windows
8282 && sess.target.env == Env::Gnu
83 && sess.target.abi == Abi::Llvm
83 && sess.target.cfg_abi == CfgAbi::Llvm
8484 {
8585 f(&sess.target_tlib_path.dir, false)?;
8686 }
compiler/rustc_middle/src/dep_graph/graph.rs+40-23
......@@ -164,9 +164,10 @@ impl DepGraph {
164164 );
165165 assert_eq!(red_node_index, DepNodeIndex::FOREVER_RED_NODE);
166166 if prev_graph_node_count > 0 {
167 colors.insert_red(SerializedDepNodeIndex::from_u32(
168 DepNodeIndex::FOREVER_RED_NODE.as_u32(),
169 ));
167 let prev_index =
168 const { SerializedDepNodeIndex::from_u32(DepNodeIndex::FOREVER_RED_NODE.as_u32()) };
169 let result = colors.try_set_color(prev_index, DesiredColor::Red);
170 assert_matches!(result, TrySetColorResult::Success);
170171 }
171172
172173 DepGraph {
......@@ -1415,28 +1416,29 @@ impl DepNodeColorMap {
14151416 if value <= DepNodeIndex::MAX_AS_U32 { Some(DepNodeIndex::from_u32(value)) } else { None }
14161417 }
14171418
1418 /// This tries to atomically mark a node green and assign `index` as the new
1419 /// index if `green` is true, otherwise it will try to atomicaly mark it red.
1419 /// Atomically sets the color of a previous-session dep node to either green
1420 /// or red, if it has not already been colored.
14201421 ///
1421 /// This returns `Ok` if `index` gets assigned or the node is marked red, otherwise it returns
1422 /// the already allocated index in `Err` if it is green already. If it was already
1423 /// red, `Err(None)` is returned.
1422 /// If the node already has a color, the new color is ignored, and the
1423 /// return value indicates the existing color.
14241424 #[inline(always)]
1425 pub(super) fn try_mark(
1425 pub(super) fn try_set_color(
14261426 &self,
14271427 prev_index: SerializedDepNodeIndex,
1428 index: DepNodeIndex,
1429 green: bool,
1430 ) -> Result<(), Option<DepNodeIndex>> {
1431 let value = &self.values[prev_index];
1432 match value.compare_exchange(
1428 color: DesiredColor,
1429 ) -> TrySetColorResult {
1430 match self.values[prev_index].compare_exchange(
14331431 COMPRESSED_UNKNOWN,
1434 if green { index.as_u32() } else { COMPRESSED_RED },
1432 match color {
1433 DesiredColor::Red => COMPRESSED_RED,
1434 DesiredColor::Green { index } => index.as_u32(),
1435 },
14351436 Ordering::Relaxed,
14361437 Ordering::Relaxed,
14371438 ) {
1438 Ok(_) => Ok(()),
1439 Err(v) => Err(if v == COMPRESSED_RED { None } else { Some(DepNodeIndex::from_u32(v)) }),
1439 Ok(_) => TrySetColorResult::Success,
1440 Err(COMPRESSED_RED) => TrySetColorResult::AlreadyRed,
1441 Err(index) => TrySetColorResult::AlreadyGreen { index: DepNodeIndex::from_u32(index) },
14401442 }
14411443 }
14421444
......@@ -1454,13 +1456,28 @@ impl DepNodeColorMap {
14541456 DepNodeColor::Unknown
14551457 }
14561458 }
1459}
14571460
1458 #[inline]
1459 pub(super) fn insert_red(&self, index: SerializedDepNodeIndex) {
1460 let value = self.values[index].swap(COMPRESSED_RED, Ordering::Release);
1461 // Sanity check for duplicate nodes
1462 assert_eq!(value, COMPRESSED_UNKNOWN, "tried to color an already colored node as red");
1463 }
1461/// The color that [`DepNodeColorMap::try_set_color`] should try to apply to a node.
1462#[derive(Clone, Copy, Debug)]
1463pub(super) enum DesiredColor {
1464 /// Try to mark the node red.
1465 Red,
1466 /// Try to mark the node green, associating it with a current-session node index.
1467 Green { index: DepNodeIndex },
1468}
1469
1470/// Return value of [`DepNodeColorMap::try_set_color`], indicating success or failure,
1471/// and (on failure) what the existing color is.
1472#[derive(Clone, Copy, Debug)]
1473pub(super) enum TrySetColorResult {
1474 /// The [`DesiredColor`] was freshly applied to the node.
1475 Success,
1476 /// Coloring failed because the node was already marked red.
1477 AlreadyRed,
1478 /// Coloring failed because the node was already marked green,
1479 /// and corresponds to node `index` in the current-session dep graph.
1480 AlreadyGreen { index: DepNodeIndex },
14641481}
14651482
14661483#[inline(never)]
compiler/rustc_middle/src/dep_graph/serialized.rs+15-12
......@@ -43,7 +43,7 @@ use std::cell::RefCell;
4343use std::cmp::max;
4444use std::sync::Arc;
4545use std::sync::atomic::Ordering;
46use std::{iter, mem, u64};
46use std::{iter, mem};
4747
4848use rustc_data_structures::fingerprint::{Fingerprint, PackedFingerprint};
4949use rustc_data_structures::fx::FxHashMap;
......@@ -58,7 +58,7 @@ use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
5858use rustc_session::Session;
5959use tracing::{debug, instrument};
6060
61use super::graph::{CurrentDepGraph, DepNodeColorMap};
61use super::graph::{CurrentDepGraph, DepNodeColorMap, DesiredColor, TrySetColorResult};
6262use super::retained::RetainedDepGraph;
6363use super::{DepKind, DepNode, DepNodeIndex};
6464use crate::dep_graph::edges::EdgesVec;
......@@ -905,13 +905,14 @@ impl GraphEncoder {
905905 let mut local = self.status.local.borrow_mut();
906906
907907 let index = self.status.next_index(&mut *local);
908 let color = if is_green { DesiredColor::Green { index } } else { DesiredColor::Red };
908909
909 // Use `try_mark` to avoid racing when `send_promoted` is called concurrently
910 // Use `try_set_color` to avoid racing when `send_promoted` is called concurrently
910911 // on the same index.
911 match colors.try_mark(prev_index, index, is_green) {
912 Ok(()) => (),
913 Err(None) => panic!("dep node {:?} is unexpectedly red", prev_index),
914 Err(Some(dep_node_index)) => return dep_node_index,
912 match colors.try_set_color(prev_index, color) {
913 TrySetColorResult::Success => {}
914 TrySetColorResult::AlreadyRed => panic!("dep node {prev_index:?} is unexpectedly red"),
915 TrySetColorResult::AlreadyGreen { index } => return index,
915916 }
916917
917918 self.status.bump_index(&mut *local);
......@@ -923,7 +924,8 @@ impl GraphEncoder {
923924 /// from the previous dep graph and expects all edges to already have a new dep node index
924925 /// assigned.
925926 ///
926 /// This will also ensure the dep node is marked green if `Some` is returned.
927 /// Tries to mark the dep node green, and returns Some if it is now green,
928 /// or None if had already been concurrently marked red.
927929 #[inline]
928930 pub(crate) fn send_promoted(
929931 &self,
......@@ -935,10 +937,10 @@ impl GraphEncoder {
935937 let mut local = self.status.local.borrow_mut();
936938 let index = self.status.next_index(&mut *local);
937939
938 // Use `try_mark_green` to avoid racing when `send_promoted` or `send_and_color`
940 // Use `try_set_color` to avoid racing when `send_promoted` or `send_and_color`
939941 // is called concurrently on the same index.
940 match colors.try_mark(prev_index, index, true) {
941 Ok(()) => {
942 match colors.try_set_color(prev_index, DesiredColor::Green { index }) {
943 TrySetColorResult::Success => {
942944 self.status.bump_index(&mut *local);
943945 self.status.encode_promoted_node(
944946 index,
......@@ -949,7 +951,8 @@ impl GraphEncoder {
949951 );
950952 Some(index)
951953 }
952 Err(dep_node_index) => dep_node_index,
954 TrySetColorResult::AlreadyRed => None,
955 TrySetColorResult::AlreadyGreen { index } => Some(index),
953956 }
954957 }
955958
compiler/rustc_middle/src/ty/mod.rs+30
......@@ -2172,6 +2172,36 @@ impl<'tcx> TyCtxt<'tcx> {
21722172 }
21732173}
21742174
2175// `HasAttrs` impls: allow `find_attr!(tcx, id, ...)` to work with both DefId-like types and HirId.
2176
2177impl<'tcx> hir::attrs::HasAttrs<'tcx, TyCtxt<'tcx>> for DefId {
2178 fn get_attrs(self, tcx: &TyCtxt<'tcx>) -> &'tcx [hir::Attribute] {
2179 if let Some(did) = self.as_local() {
2180 tcx.hir_attrs(tcx.local_def_id_to_hir_id(did))
2181 } else {
2182 tcx.attrs_for_def(self)
2183 }
2184 }
2185}
2186
2187impl<'tcx> hir::attrs::HasAttrs<'tcx, TyCtxt<'tcx>> for LocalDefId {
2188 fn get_attrs(self, tcx: &TyCtxt<'tcx>) -> &'tcx [hir::Attribute] {
2189 tcx.hir_attrs(tcx.local_def_id_to_hir_id(self))
2190 }
2191}
2192
2193impl<'tcx> hir::attrs::HasAttrs<'tcx, TyCtxt<'tcx>> for hir::OwnerId {
2194 fn get_attrs(self, tcx: &TyCtxt<'tcx>) -> &'tcx [hir::Attribute] {
2195 hir::attrs::HasAttrs::get_attrs(self.def_id, tcx)
2196 }
2197}
2198
2199impl<'tcx> hir::attrs::HasAttrs<'tcx, TyCtxt<'tcx>> for hir::HirId {
2200 fn get_attrs(self, tcx: &TyCtxt<'tcx>) -> &'tcx [hir::Attribute] {
2201 tcx.hir_attrs(self)
2202 }
2203}
2204
21752205pub fn provide(providers: &mut Providers) {
21762206 closure::provide(providers);
21772207 context::provide(providers);
compiler/rustc_mir_build/src/builder/mod.rs+1-1
......@@ -491,7 +491,7 @@ fn construct_fn<'tcx>(
491491 };
492492
493493 if let Some((dialect, phase)) =
494 find_attr!(tcx.hir_attrs(fn_id), CustomMir(dialect, phase, _) => (dialect, phase))
494 find_attr!(tcx, fn_id, CustomMir(dialect, phase, _) => (dialect, phase))
495495 {
496496 return custom::build_custom_mir(
497497 tcx,
compiler/rustc_mir_build/src/thir/cx/expr.rs+2-2
......@@ -917,7 +917,7 @@ impl<'tcx> ThirBuildCx<'tcx> {
917917 hir::ExprKind::Ret(v) => ExprKind::Return { value: v.map(|v| self.mirror_expr(v)) },
918918 hir::ExprKind::Become(call) => ExprKind::Become { value: self.mirror_expr(call) },
919919 hir::ExprKind::Break(dest, ref value) => {
920 if find_attr!(self.tcx.hir_attrs(expr.hir_id), ConstContinue(_)) {
920 if find_attr!(self.tcx, expr.hir_id, ConstContinue(_)) {
921921 match dest.target_id {
922922 Ok(target_id) => {
923923 let (Some(value), Some(_)) = (value, dest.label) else {
......@@ -982,7 +982,7 @@ impl<'tcx> ThirBuildCx<'tcx> {
982982 match_source,
983983 },
984984 hir::ExprKind::Loop(body, ..) => {
985 if find_attr!(self.tcx.hir_attrs(expr.hir_id), LoopMatch(_)) {
985 if find_attr!(self.tcx, expr.hir_id, LoopMatch(_)) {
986986 let dcx = self.tcx.dcx();
987987
988988 // Accept either `state = expr` or `state = expr;`.
compiler/rustc_mir_build/src/thir/cx/mod.rs+1-1
......@@ -104,7 +104,7 @@ impl<'tcx> ThirBuildCx<'tcx> {
104104 typing_env: ty::TypingEnv::non_body_analysis(tcx, def),
105105 typeck_results,
106106 body_owner: def.to_def_id(),
107 apply_adjustments: !find_attr!(tcx.hir_attrs(hir_id), CustomMir(..) => ()).is_some(),
107 apply_adjustments: !find_attr!(tcx, hir_id, CustomMir(..)),
108108 }
109109 }
110110
compiler/rustc_passes/src/dead.rs+1-1
......@@ -157,7 +157,7 @@ impl<'tcx> MarkSymbolVisitor<'tcx> {
157157 Res::Def(_, def_id) => self.check_def_id(def_id),
158158 Res::SelfTyParam { trait_: t } => self.check_def_id(t),
159159 Res::SelfTyAlias { alias_to: i, .. } => self.check_def_id(i),
160 Res::ToolMod | Res::NonMacroAttr(..) | Res::Err => {}
160 Res::ToolMod | Res::NonMacroAttr(..) | Res::OpenMod(..) | Res::Err => {}
161161 }
162162 }
163163
compiler/rustc_privacy/src/lib.rs+3-2
......@@ -1595,13 +1595,14 @@ impl<'tcx> PrivateItemsInPublicInterfacesChecker<'_, 'tcx> {
15951595 let mut check = self.check(item.def_id.expect_local(), vis, effective_vis);
15961596
15971597 let is_assoc_ty = item.is_type();
1598 check.hard_error = is_assoc_ty && !item.is_impl_trait_in_trait();
1598 check.hard_error = is_assoc_ty;
15991599 check.generics().predicates();
16001600 if assoc_has_type_of(self.tcx, item) {
1601 check.hard_error = check.hard_error && item.defaultness(self.tcx).has_value();
16021601 check.ty();
16031602 }
16041603 if is_assoc_ty && item.container == AssocContainer::Trait {
1604 // FIXME: too much breakage from reporting hard errors here, better wait for a fix
1605 // from proper associated type normalization.
16051606 check.hard_error = false;
16061607 check.bounds();
16071608 }
compiler/rustc_resolve/src/build_reduced_graph.rs+1
......@@ -357,6 +357,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
357357 | Res::SelfTyParam { .. }
358358 | Res::SelfTyAlias { .. }
359359 | Res::SelfCtor(..)
360 | Res::OpenMod(..)
360361 | Res::Err => bug!("unexpected resolution: {:?}", res),
361362 }
362363 }
compiler/rustc_resolve/src/diagnostics.rs+4-3
......@@ -1740,8 +1740,8 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
17401740 Res::Def(DefKind::Macro(kinds), _) => {
17411741 format!("{} {}", kinds.article(), kinds.descr())
17421742 }
1743 Res::ToolMod => {
1744 // Don't confuse the user with tool modules.
1743 Res::ToolMod | Res::OpenMod(..) => {
1744 // Don't confuse the user with tool modules or open modules.
17451745 continue;
17461746 }
17471747 Res::Def(DefKind::Trait, _) if macro_kind == MacroKind::Derive => {
......@@ -1978,7 +1978,8 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
19781978 let (built_in, from) = match scope {
19791979 Scope::StdLibPrelude | Scope::MacroUsePrelude => ("", " from prelude"),
19801980 Scope::ExternPreludeFlags
1981 if self.tcx.sess.opts.externs.get(ident.as_str()).is_some() =>
1981 if self.tcx.sess.opts.externs.get(ident.as_str()).is_some()
1982 || matches!(res, Res::OpenMod(..)) =>
19821983 {
19831984 ("", " passed with `--extern`")
19841985 }
compiler/rustc_resolve/src/ident.rs+13-3
......@@ -26,7 +26,7 @@ use crate::{
2626 AmbiguityError, AmbiguityKind, AmbiguityWarning, BindingKey, CmResolver, Decl, DeclKind,
2727 Determinacy, Finalize, IdentKey, ImportKind, LateDecl, Module, ModuleKind, ModuleOrUniformRoot,
2828 ParentScope, PathResult, PrivacyError, Res, ResolutionError, Resolver, Scope, ScopeSet,
29 Segment, Stage, Used, errors,
29 Segment, Stage, Symbol, Used, errors,
3030};
3131
3232#[derive(Copy, Clone)]
......@@ -386,7 +386,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
386386 }
387387
388388 /// Resolve an identifier in the specified set of scopes.
389 #[instrument(level = "debug", skip(self))]
390389 pub(crate) fn resolve_ident_in_scope_set<'r>(
391390 self: CmResolver<'r, 'ra, 'tcx>,
392391 orig_ident: Ident,
......@@ -976,6 +975,14 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
976975 ignore_import,
977976 )
978977 }
978 ModuleOrUniformRoot::OpenModule(sym) => {
979 let open_ns_name = format!("{}::{}", sym.as_str(), ident.name);
980 let ns_ident = IdentKey::with_root_ctxt(Symbol::intern(&open_ns_name));
981 match self.extern_prelude_get_flag(ns_ident, ident.span, finalize.is_some()) {
982 Some(decl) => Ok(decl),
983 None => Err(Determinacy::Determined),
984 }
985 }
979986 ModuleOrUniformRoot::ModuleAndExternPrelude(module) => self.resolve_ident_in_scope_set(
980987 ident,
981988 ScopeSet::ModuleAndExternPrelude(ns, module),
......@@ -1962,7 +1969,10 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
19621969 }
19631970
19641971 let maybe_assoc = opt_ns != Some(MacroNS) && PathSource::Type.is_expected(res);
1965 if let Some(def_id) = binding.res().module_like_def_id() {
1972 if let Res::OpenMod(sym) = binding.res() {
1973 module = Some(ModuleOrUniformRoot::OpenModule(sym));
1974 record_segment_res(self.reborrow(), finalize, res, id);
1975 } else if let Some(def_id) = binding.res().module_like_def_id() {
19661976 if self.mods_with_parse_errors.contains(&def_id) {
19671977 module_had_parse_errors = true;
19681978 }
compiler/rustc_resolve/src/imports.rs+1-1
......@@ -41,7 +41,7 @@ type Res = def::Res<NodeId>;
4141
4242/// A potential import declaration in the process of being planted into a module.
4343/// Also used for lazily planting names from `--extern` flags to extern prelude.
44#[derive(Clone, Copy, Default, PartialEq)]
44#[derive(Clone, Copy, Default, PartialEq, Debug)]
4545pub(crate) enum PendingDecl<'ra> {
4646 Ready(Option<Decl<'ra>>),
4747 #[default]
compiler/rustc_resolve/src/late/diagnostics.rs+1-1
......@@ -3381,7 +3381,7 @@ impl<'ast, 'ra, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
33813381 && def_id.is_local()
33823382 && let Some(local_def_id) = def_id.as_local()
33833383 && let Some(struct_generics) = self.r.struct_generics.get(&local_def_id)
3384 && let target_param = &struct_generics.params[idx]
3384 && let Some(target_param) = &struct_generics.params.get(idx)
33853385 && let GenericParamKind::Const { ty, .. } = &target_param.kind
33863386 && let TyKind::Path(_, path) = &ty.kind
33873387 {
compiler/rustc_resolve/src/lib.rs+101-43
......@@ -61,6 +61,7 @@ use rustc_hir::definitions::DisambiguatorState;
6161use rustc_hir::{PrimTy, TraitCandidate, find_attr};
6262use rustc_index::bit_set::DenseBitSet;
6363use rustc_metadata::creader::CStore;
64use rustc_middle::bug;
6465use rustc_middle::metadata::{AmbigModChild, ModChild, Reexport};
6566use rustc_middle::middle::privacy::EffectiveVisibilities;
6667use rustc_middle::query::Providers;
......@@ -445,6 +446,11 @@ enum ModuleOrUniformRoot<'ra> {
445446 /// Used only for resolving single-segment imports. The reason it exists is that import paths
446447 /// are always split into two parts, the first of which should be some kind of module.
447448 CurrentScope,
449
450 /// Virtual module for the resolution of base names of namespaced crates,
451 /// where the base name doesn't correspond to a module in the extern prelude.
452 /// E.g. `my_api::utils` is in the prelude, but `my_api` is not.
453 OpenModule(Symbol),
448454}
449455
450456#[derive(Debug)]
......@@ -1105,13 +1111,20 @@ impl<'ra> DeclData<'ra> {
11051111 }
11061112}
11071113
1114#[derive(Debug)]
11081115struct ExternPreludeEntry<'ra> {
11091116 /// Name declaration from an `extern crate` item.
11101117 /// The boolean flag is true is `item_decl` is non-redundant, happens either when
11111118 /// `flag_decl` is `None`, or when `extern crate` introducing `item_decl` used renaming.
11121119 item_decl: Option<(Decl<'ra>, Span, /* introduced by item */ bool)>,
11131120 /// Name declaration from an `--extern` flag, lazily populated on first use.
1114 flag_decl: Option<CacheCell<(PendingDecl<'ra>, /* finalized */ bool)>>,
1121 flag_decl: Option<
1122 CacheCell<(
1123 PendingDecl<'ra>,
1124 /* finalized */ bool,
1125 /* open flag (namespaced crate) */ bool,
1126 )>,
1127 >,
11151128}
11161129
11171130impl ExternPreludeEntry<'_> {
......@@ -1122,7 +1135,14 @@ impl ExternPreludeEntry<'_> {
11221135 fn flag() -> Self {
11231136 ExternPreludeEntry {
11241137 item_decl: None,
1125 flag_decl: Some(CacheCell::new((PendingDecl::Pending, false))),
1138 flag_decl: Some(CacheCell::new((PendingDecl::Pending, false, false))),
1139 }
1140 }
1141
1142 fn open_flag() -> Self {
1143 ExternPreludeEntry {
1144 item_decl: None,
1145 flag_decl: Some(CacheCell::new((PendingDecl::Pending, false, true))),
11261146 }
11271147 }
11281148
......@@ -1643,35 +1663,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
16431663 let mut invocation_parents = FxHashMap::default();
16441664 invocation_parents.insert(LocalExpnId::ROOT, InvocationParent::ROOT);
16451665
1646 let mut extern_prelude: FxIndexMap<_, _> = tcx
1647 .sess
1648 .opts
1649 .externs
1650 .iter()
1651 .filter_map(|(name, entry)| {
1652 // Make sure `self`, `super`, `_` etc do not get into extern prelude.
1653 // FIXME: reject `--extern self` and similar in option parsing instead.
1654 if entry.add_prelude
1655 && let name = Symbol::intern(name)
1656 && name.can_be_raw()
1657 {
1658 let ident = IdentKey::with_root_ctxt(name);
1659 Some((ident, ExternPreludeEntry::flag()))
1660 } else {
1661 None
1662 }
1663 })
1664 .collect();
1665
1666 if !attr::contains_name(attrs, sym::no_core) {
1667 let ident = IdentKey::with_root_ctxt(sym::core);
1668 extern_prelude.insert(ident, ExternPreludeEntry::flag());
1669 if !attr::contains_name(attrs, sym::no_std) {
1670 let ident = IdentKey::with_root_ctxt(sym::std);
1671 extern_prelude.insert(ident, ExternPreludeEntry::flag());
1672 }
1673 }
1674
1666 let extern_prelude = build_extern_prelude(tcx, attrs);
16751667 let registered_tools = tcx.registered_tools(());
16761668 let edition = tcx.sess.edition();
16771669
......@@ -2326,10 +2318,10 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
23262318 ) -> Option<Decl<'ra>> {
23272319 let entry = self.extern_prelude.get(&ident);
23282320 entry.and_then(|entry| entry.flag_decl.as_ref()).and_then(|flag_decl| {
2329 let (pending_decl, finalized) = flag_decl.get();
2321 let (pending_decl, finalized, is_open) = flag_decl.get();
23302322 let decl = match pending_decl {
23312323 PendingDecl::Ready(decl) => {
2332 if finalize && !finalized {
2324 if finalize && !finalized && !is_open {
23332325 self.cstore_mut().process_path_extern(
23342326 self.tcx,
23352327 ident.name,
......@@ -2340,18 +2332,28 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
23402332 }
23412333 PendingDecl::Pending => {
23422334 debug_assert!(!finalized);
2343 let crate_id = if finalize {
2344 self.cstore_mut().process_path_extern(self.tcx, ident.name, orig_ident_span)
2335 if is_open {
2336 let res = Res::OpenMod(ident.name);
2337 Some(self.arenas.new_pub_def_decl(res, DUMMY_SP, LocalExpnId::ROOT))
23452338 } else {
2346 self.cstore_mut().maybe_process_path_extern(self.tcx, ident.name)
2347 };
2348 crate_id.map(|crate_id| {
2349 let res = Res::Def(DefKind::Mod, crate_id.as_def_id());
2350 self.arenas.new_pub_def_decl(res, DUMMY_SP, LocalExpnId::ROOT)
2351 })
2339 let crate_id = if finalize {
2340 self.cstore_mut().process_path_extern(
2341 self.tcx,
2342 ident.name,
2343 orig_ident_span,
2344 )
2345 } else {
2346 self.cstore_mut().maybe_process_path_extern(self.tcx, ident.name)
2347 };
2348 crate_id.map(|crate_id| {
2349 let def_id = crate_id.as_def_id();
2350 let res = Res::Def(DefKind::Mod, def_id);
2351 self.arenas.new_pub_def_decl(res, DUMMY_SP, LocalExpnId::ROOT)
2352 })
2353 }
23522354 }
23532355 };
2354 flag_decl.set((PendingDecl::Ready(decl), finalize || finalized));
2356 flag_decl.set((PendingDecl::Ready(decl), finalize || finalized, is_open));
23552357 decl.or_else(|| finalize.then_some(self.dummy_decl))
23562358 })
23572359 }
......@@ -2393,7 +2395,9 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
23932395 PathResult::Module(ModuleOrUniformRoot::ExternPrelude) | PathResult::Failed { .. } => {
23942396 None
23952397 }
2396 PathResult::Module(..) | PathResult::Indeterminate => unreachable!(),
2398 path_result @ (PathResult::Module(..) | PathResult::Indeterminate) => {
2399 bug!("got invalid path_result: {path_result:?}")
2400 }
23972401 }
23982402 }
23992403
......@@ -2511,6 +2515,60 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
25112515 }
25122516}
25132517
2518fn build_extern_prelude<'tcx, 'ra>(
2519 tcx: TyCtxt<'tcx>,
2520 attrs: &[ast::Attribute],
2521) -> FxIndexMap<IdentKey, ExternPreludeEntry<'ra>> {
2522 let mut extern_prelude: FxIndexMap<IdentKey, ExternPreludeEntry<'ra>> = tcx
2523 .sess
2524 .opts
2525 .externs
2526 .iter()
2527 .filter_map(|(name, entry)| {
2528 // Make sure `self`, `super`, `_` etc do not get into extern prelude.
2529 // FIXME: reject `--extern self` and similar in option parsing instead.
2530 if entry.add_prelude
2531 && let sym = Symbol::intern(name)
2532 && sym.can_be_raw()
2533 {
2534 Some((IdentKey::with_root_ctxt(sym), ExternPreludeEntry::flag()))
2535 } else {
2536 None
2537 }
2538 })
2539 .collect();
2540
2541 // Add open base entries for namespaced crates whose base segment
2542 // is missing from the prelude (e.g. `foo::bar` without `foo`).
2543 // These are necessary in order to resolve the open modules, whereas
2544 // the namespaced names are necessary in `extern_prelude` for actually
2545 // resolving the namespaced crates.
2546 let missing_open_bases: Vec<IdentKey> = extern_prelude
2547 .keys()
2548 .filter_map(|ident| {
2549 let (base, _) = ident.name.as_str().split_once("::")?;
2550 let base_sym = Symbol::intern(base);
2551 base_sym.can_be_raw().then(|| IdentKey::with_root_ctxt(base_sym))
2552 })
2553 .filter(|base_ident| !extern_prelude.contains_key(base_ident))
2554 .collect();
2555
2556 extern_prelude.extend(
2557 missing_open_bases.into_iter().map(|ident| (ident, ExternPreludeEntry::open_flag())),
2558 );
2559
2560 // Inject `core` / `std` unless suppressed by attributes.
2561 if !attr::contains_name(attrs, sym::no_core) {
2562 extern_prelude.insert(IdentKey::with_root_ctxt(sym::core), ExternPreludeEntry::flag());
2563
2564 if !attr::contains_name(attrs, sym::no_std) {
2565 extern_prelude.insert(IdentKey::with_root_ctxt(sym::std), ExternPreludeEntry::flag());
2566 }
2567 }
2568
2569 extern_prelude
2570}
2571
25142572fn names_to_string(names: impl Iterator<Item = Symbol>) -> String {
25152573 let mut result = String::new();
25162574 for (i, name) in names.enumerate().filter(|(_, name)| *name != kw::PathRoot) {
compiler/rustc_session/src/config/cfg.rs+2-2
......@@ -239,7 +239,7 @@ pub(crate) fn default_configuration(sess: &Session) -> Cfg {
239239 ins_none!(sym::sanitizer_cfi_normalize_integers);
240240 }
241241
242 ins_sym!(sym::target_abi, sess.target.abi.desc_symbol());
242 ins_sym!(sym::target_abi, sess.target.cfg_abi.desc_symbol());
243243 ins_sym!(sym::target_arch, sess.target.arch.desc_symbol());
244244 ins_str!(sym::target_endian, sess.target.endian.as_str());
245245 ins_sym!(sym::target_env, sess.target.env.desc_symbol());
......@@ -447,7 +447,7 @@ impl CheckCfg {
447447 };
448448
449449 for target in Target::builtins().chain(iter::once(current_target.clone())) {
450 values_target_abi.insert(target.options.abi.desc_symbol());
450 values_target_abi.insert(target.options.cfg_abi.desc_symbol());
451451 values_target_arch.insert(target.arch.desc_symbol());
452452 values_target_endian.insert(Symbol::intern(target.options.endian.as_str()));
453453 values_target_env.insert(target.options.env.desc_symbol());
compiler/rustc_session/src/config/externs.rs+7
......@@ -43,6 +43,13 @@ pub(crate) fn split_extern_opt<'a>(
4343 }
4444 };
4545
46 // Reject paths with more than two segments.
47 if unstable_opts.namespaced_crates && crate_name.split("::").count() > 2 {
48 return Err(early_dcx.early_struct_fatal(format!(
49 "crate name `{crate_name}` passed to `--extern` can have at most two segments."
50 )));
51 }
52
4653 if !valid_crate_name(&crate_name, unstable_opts) {
4754 let mut error = early_dcx.early_struct_fatal(format!(
4855 "crate name `{crate_name}` passed to `--extern` is not a valid ASCII identifier"
compiler/rustc_target/src/asm/mod.rs+2-2
......@@ -5,7 +5,7 @@ use rustc_data_structures::fx::{FxHashMap, FxIndexSet};
55use rustc_macros::{Decodable, Encodable, HashStable_Generic};
66use rustc_span::Symbol;
77
8use crate::spec::{Abi, Arch, RelocModel, Target};
8use crate::spec::{Arch, CfgAbi, RelocModel, Target};
99
1010pub struct ModifierInfo {
1111 pub modifier: char,
......@@ -1001,7 +1001,7 @@ impl InlineAsmClobberAbi {
10011001 _ => Err(&["C", "system", "efiapi"]),
10021002 },
10031003 InlineAsmArch::PowerPC | InlineAsmArch::PowerPC64 => match name {
1004 "C" | "system" => Ok(if target.abi == Abi::Spe {
1004 "C" | "system" => Ok(if target.cfg_abi == CfgAbi::Spe {
10051005 InlineAsmClobberAbi::PowerPCSPE
10061006 } else {
10071007 InlineAsmClobberAbi::PowerPC
compiler/rustc_target/src/asm/powerpc.rs+9-5
......@@ -4,7 +4,7 @@ use rustc_data_structures::fx::FxIndexSet;
44use rustc_span::Symbol;
55
66use super::{InlineAsmArch, InlineAsmType, ModifierInfo};
7use crate::spec::{Abi, RelocModel, Target};
7use crate::spec::{CfgAbi, RelocModel, Target};
88
99def_reg_class! {
1010 PowerPC PowerPCInlineAsmRegClass {
......@@ -105,9 +105,9 @@ fn reserved_v20to31(
105105 _is_clobber: bool,
106106) -> Result<(), &'static str> {
107107 if target.is_like_aix {
108 match &target.options.abi {
109 Abi::VecDefault => Err("v20-v31 (vs52-vs63) are reserved on vec-default ABI"),
110 Abi::VecExtAbi => Ok(()),
108 match &target.options.cfg_abi {
109 CfgAbi::VecDefault => Err("v20-v31 (vs52-vs63) are reserved on vec-default ABI"),
110 CfgAbi::VecExtAbi => Ok(()),
111111 abi => unreachable!("unrecognized AIX ABI: {abi}"),
112112 }
113113 } else {
......@@ -122,7 +122,11 @@ fn spe_acc_target_check(
122122 target: &Target,
123123 _is_clobber: bool,
124124) -> Result<(), &'static str> {
125 if target.abi == Abi::Spe { Ok(()) } else { Err("spe_acc is only available on spe targets") }
125 if target.cfg_abi == CfgAbi::Spe {
126 Ok(())
127 } else {
128 Err("spe_acc is only available on spe targets")
129 }
126130}
127131
128132def_regs! {
compiler/rustc_target/src/callconv/loongarch.rs+4-4
......@@ -4,7 +4,7 @@ use rustc_abi::{
44};
55
66use crate::callconv::{ArgAbi, ArgExtension, CastTarget, FnAbi, PassMode, Uniform};
7use crate::spec::HasTargetSpec;
7use crate::spec::{HasTargetSpec, LlvmAbi};
88
99#[derive(Copy, Clone)]
1010enum RegPassKind {
......@@ -415,9 +415,9 @@ where
415415 C: HasDataLayout + HasTargetSpec,
416416{
417417 let xlen = cx.data_layout().pointer_size().bits();
418 let flen = match &cx.target_spec().llvm_abiname[..] {
419 "ilp32f" | "lp64f" => 32,
420 "ilp32d" | "lp64d" => 64,
418 let flen = match &cx.target_spec().llvm_abiname {
419 LlvmAbi::Ilp32f | LlvmAbi::Lp64f => 32,
420 LlvmAbi::Ilp32d | LlvmAbi::Lp64d => 64,
421421 _ => 0,
422422 };
423423
compiler/rustc_target/src/callconv/powerpc64.rs+3-3
......@@ -5,7 +5,7 @@
55use rustc_abi::{Endian, HasDataLayout, TyAbiInterface};
66
77use crate::callconv::{Align, ArgAbi, FnAbi, Reg, RegKind, Uniform};
8use crate::spec::{HasTargetSpec, Os};
8use crate::spec::{HasTargetSpec, LlvmAbi, Os};
99
1010#[derive(Debug, Clone, Copy, PartialEq)]
1111enum ABI {
......@@ -106,9 +106,9 @@ where
106106 Ty: TyAbiInterface<'a, C> + Copy,
107107 C: HasDataLayout + HasTargetSpec,
108108{
109 let abi = if cx.target_spec().options.llvm_abiname == "elfv2" {
109 let abi = if cx.target_spec().options.llvm_abiname == LlvmAbi::ElfV2 {
110110 ELFv2
111 } else if cx.target_spec().options.llvm_abiname == "elfv1" {
111 } else if cx.target_spec().options.llvm_abiname == LlvmAbi::ElfV1 {
112112 ELFv1
113113 } else if cx.target_spec().os == Os::Aix {
114114 AIX
compiler/rustc_target/src/callconv/riscv.rs+4-4
......@@ -10,7 +10,7 @@ use rustc_abi::{
1010};
1111
1212use crate::callconv::{ArgAbi, ArgExtension, CastTarget, FnAbi, PassMode, Uniform};
13use crate::spec::HasTargetSpec;
13use crate::spec::{HasTargetSpec, LlvmAbi};
1414
1515#[derive(Copy, Clone)]
1616enum RegPassKind {
......@@ -419,9 +419,9 @@ where
419419 Ty: TyAbiInterface<'a, C> + Copy,
420420 C: HasDataLayout + HasTargetSpec,
421421{
422 let flen = match &cx.target_spec().llvm_abiname[..] {
423 "ilp32f" | "lp64f" => 32,
424 "ilp32d" | "lp64d" => 64,
422 let flen = match &cx.target_spec().llvm_abiname {
423 LlvmAbi::Ilp32f | LlvmAbi::Lp64f => 32,
424 LlvmAbi::Ilp32d | LlvmAbi::Lp64d => 64,
425425 _ => 0,
426426 };
427427 let xlen = cx.data_layout().pointer_size().bits();
compiler/rustc_target/src/spec/base/aix.rs+3-3
......@@ -1,13 +1,13 @@
11use rustc_abi::Endian;
22
33use crate::spec::{
4 Abi, BinaryFormat, Cc, CodeModel, LinkOutputKind, LinkerFlavor, Os, TargetOptions, crt_objects,
5 cvs,
4 BinaryFormat, Cc, CfgAbi, CodeModel, LinkOutputKind, LinkerFlavor, Os, TargetOptions,
5 crt_objects, cvs,
66};
77
88pub(crate) fn opts() -> TargetOptions {
99 TargetOptions {
10 abi: Abi::VecExtAbi,
10 cfg_abi: CfgAbi::VecExtAbi,
1111 code_model: Some(CodeModel::Large),
1212 cpu: "pwr7".into(),
1313 os: Os::Aix,
compiler/rustc_target/src/spec/base/apple/mod.rs+6-6
......@@ -4,7 +4,7 @@ use std::num::ParseIntError;
44use std::str::FromStr;
55
66use crate::spec::{
7 Abi, BinaryFormat, Cc, DebuginfoKind, Env, FloatAbi, FramePointer, LinkerFlavor, Lld, Os,
7 BinaryFormat, Cc, CfgAbi, DebuginfoKind, Env, FloatAbi, FramePointer, LinkerFlavor, Lld, Os,
88 RustcAbi, SplitDebuginfo, StackProbeType, StaticCow, Target, TargetOptions, cvs,
99};
1010
......@@ -108,11 +108,11 @@ impl TargetEnv {
108108 //
109109 // But let's continue setting them for backwards compatibility.
110110 // FIXME(madsmtm): Warn about using these in the future.
111 fn target_abi(self) -> Abi {
111 fn target_abi(self) -> CfgAbi {
112112 match self {
113 Self::Normal => Abi::Unspecified,
114 Self::MacCatalyst => Abi::MacAbi,
115 Self::Simulator => Abi::Sim,
113 Self::Normal => CfgAbi::Unspecified,
114 Self::MacCatalyst => CfgAbi::MacAbi,
115 Self::Simulator => CfgAbi::Sim,
116116 }
117117 }
118118}
......@@ -135,7 +135,7 @@ pub(crate) fn base(
135135 },
136136 os,
137137 env: env.target_env(),
138 abi: env.target_abi(),
138 cfg_abi: env.target_abi(),
139139 cpu: arch.target_cpu(env).into(),
140140 link_env_remove,
141141 vendor: "apple".into(),
compiler/rustc_target/src/spec/base/apple/tests.rs+2-2
......@@ -4,7 +4,7 @@ use crate::spec::targets::{
44 aarch64_apple_watchos_sim, i686_apple_darwin, x86_64_apple_darwin, x86_64_apple_ios,
55 x86_64_apple_tvos, x86_64_apple_watchos_sim,
66};
7use crate::spec::{Abi, Env};
7use crate::spec::{CfgAbi, Env};
88
99#[test]
1010fn simulator_targets_set_env() {
......@@ -21,7 +21,7 @@ fn simulator_targets_set_env() {
2121 for target in &all_sim_targets {
2222 assert_eq!(target.env, Env::Sim);
2323 // Ensure backwards compat
24 assert_eq!(target.abi, Abi::Sim);
24 assert_eq!(target.cfg_abi, CfgAbi::Sim);
2525 }
2626}
2727
compiler/rustc_target/src/spec/base/windows_gnullvm.rs+2-2
......@@ -2,7 +2,7 @@ use std::borrow::Cow;
22
33use crate::spec::crt_objects::pre_mingw_self_contained;
44use crate::spec::{
5 Abi, BinaryFormat, Cc, DebuginfoKind, Env, LinkSelfContainedDefault, LinkerFlavor, Lld, Os,
5 BinaryFormat, Cc, CfgAbi, DebuginfoKind, Env, LinkSelfContainedDefault, LinkerFlavor, Lld, Os,
66 SplitDebuginfo, TargetOptions, add_link_args, cvs,
77};
88
......@@ -26,7 +26,7 @@ pub(crate) fn opts() -> TargetOptions {
2626 os: Os::Windows,
2727 env: Env::Gnu,
2828 vendor: "pc".into(),
29 abi: Abi::Llvm,
29 cfg_abi: CfgAbi::Llvm,
3030 linker: Some("clang".into()),
3131 dynamic_linking: true,
3232 dll_tls_export: false,
compiler/rustc_target/src/spec/base/windows_uwp_gnu.rs+2-2
......@@ -1,4 +1,4 @@
1use crate::spec::{Abi, Cc, LinkArgs, LinkerFlavor, Lld, TargetOptions, add_link_args, base};
1use crate::spec::{Cc, CfgAbi, LinkArgs, LinkerFlavor, Lld, TargetOptions, add_link_args, base};
22
33pub(crate) fn opts() -> TargetOptions {
44 let base = base::windows_gnu::opts();
......@@ -23,7 +23,7 @@ pub(crate) fn opts() -> TargetOptions {
2323 let late_link_args_static = LinkArgs::new();
2424
2525 TargetOptions {
26 abi: Abi::Uwp,
26 cfg_abi: CfgAbi::Uwp,
2727 vendor: "uwp".into(),
2828 limit_rdylib_exports: false,
2929 late_link_args,
compiler/rustc_target/src/spec/base/windows_uwp_msvc.rs+2-2
......@@ -1,8 +1,8 @@
1use crate::spec::{Abi, LinkerFlavor, Lld, TargetOptions, base};
1use crate::spec::{CfgAbi, LinkerFlavor, Lld, TargetOptions, base};
22
33pub(crate) fn opts() -> TargetOptions {
44 let mut opts =
5 TargetOptions { abi: Abi::Uwp, vendor: "uwp".into(), ..base::windows_msvc::opts() };
5 TargetOptions { cfg_abi: CfgAbi::Uwp, vendor: "uwp".into(), ..base::windows_msvc::opts() };
66
77 opts.add_pre_link_args(LinkerFlavor::Msvc(Lld::No), &["/APPCONTAINER", "mincore.lib"]);
88
compiler/rustc_target/src/spec/json.rs+8-6
......@@ -5,14 +5,14 @@ use rustc_abi::{Align, AlignFromBytesError};
55
66use super::crt_objects::CrtObjects;
77use super::{
8 Abi, Arch, BinaryFormat, CodeModel, DebuginfoKind, Env, FloatAbi, FramePointer, LinkArgsCli,
8 Arch, BinaryFormat, CfgAbi, CodeModel, DebuginfoKind, Env, FloatAbi, FramePointer, LinkArgsCli,
99 LinkSelfContainedComponents, LinkSelfContainedDefault, LinkerFlavorCli, LldFlavor,
1010 MergeFunctions, Os, PanicStrategy, RelocModel, RelroLevel, RustcAbi, SanitizerSet,
1111 SmallDataThresholdSupport, SplitDebuginfo, StackProbeType, StaticCow, SymbolVisibility, Target,
1212 TargetKind, TargetOptions, TargetWarnings, TlsModel,
1313};
1414use crate::json::{Json, ToJson};
15use crate::spec::AbiMap;
15use crate::spec::{AbiMap, LlvmAbi};
1616
1717impl Target {
1818 /// Loads a target descriptor from a JSON object.
......@@ -69,7 +69,9 @@ impl Target {
6969 forward_opt!(c_enum_min_bits); // if None, matches c_int_width
7070 forward!(os);
7171 forward!(env);
72 forward!(abi);
72 if let Some(abi) = json.abi {
73 base.cfg_abi = abi;
74 }
7375 forward!(vendor);
7476 forward_opt!(linker);
7577 forward!(linker_flavor_json);
......@@ -297,7 +299,7 @@ impl ToJson for Target {
297299 target_option_val!(c_int_width, "target-c-int-width");
298300 target_option_val!(os);
299301 target_option_val!(env);
300 target_option_val!(abi);
302 target_option_val!(cfg_abi, "abi");
301303 target_option_val!(vendor);
302304 target_option_val!(linker);
303305 target_option_val!(linker_flavor_json, "linker-flavor");
......@@ -505,7 +507,7 @@ struct TargetSpecJson {
505507 c_enum_min_bits: Option<u64>,
506508 os: Option<Os>,
507509 env: Option<Env>,
508 abi: Option<Abi>,
510 abi: Option<CfgAbi>,
509511 vendor: Option<StaticCow<str>>,
510512 linker: Option<StaticCow<str>>,
511513 #[serde(rename = "linker-flavor")]
......@@ -609,7 +611,7 @@ struct TargetSpecJson {
609611 #[serde(rename = "target-mcount")]
610612 mcount: Option<StaticCow<str>>,
611613 llvm_mcount_intrinsic: Option<StaticCow<str>>,
612 llvm_abiname: Option<StaticCow<str>>,
614 llvm_abiname: Option<LlvmAbi>,
613615 llvm_floatabi: Option<FloatAbi>,
614616 rustc_abi: Option<RustcAbi>,
615617 relax_elf_relocations: Option<bool>,
compiler/rustc_target/src/spec/mod.rs+193-104
......@@ -2065,7 +2065,10 @@ impl Env {
20652065}
20662066
20672067crate::target_spec_enum! {
2068 pub enum Abi {
2068 /// An enum representing possible values for `cfg(target_abi)`.
2069 /// This field is not forwarded to LLVM so it does not by itself affect codegen.
2070 /// See the `cfg_abi` field of [`TargetOptions`] for more details.
2071 pub enum CfgAbi {
20692072 Abi64 = "abi64",
20702073 AbiV2 = "abiv2",
20712074 AbiV2Hf = "abiv2hf",
......@@ -2090,12 +2093,40 @@ crate::target_spec_enum! {
20902093 other_variant = Other;
20912094}
20922095
2093impl Abi {
2096impl CfgAbi {
20942097 pub fn desc_symbol(&self) -> Symbol {
20952098 Symbol::intern(self.desc())
20962099 }
20972100}
20982101
2102crate::target_spec_enum! {
2103 /// An enum representing possible values for the `llvm_abiname` field of [`TargetOptions`].
2104 /// This field is used by LLVM on some targets to control which ABI to use.
2105 pub enum LlvmAbi {
2106 // RISC-V and LoongArch
2107 Ilp32 = "ilp32",
2108 Ilp32f = "ilp32f",
2109 Ilp32d = "ilp32d",
2110 Ilp32e = "ilp32e",
2111 Ilp32s = "ilp32s",
2112 Lp64 = "lp64",
2113 Lp64f = "lp64f",
2114 Lp64d = "lp64d",
2115 Lp64e = "lp64e",
2116 Lp64s = "lp64s",
2117 // MIPS
2118 O32 = "o32",
2119 N32 = "n32",
2120 N64 = "n64",
2121 // PowerPC
2122 ElfV1 = "elfv1",
2123 ElfV2 = "elfv2",
2124
2125 Unspecified = "",
2126 }
2127 other_variant = Other;
2128}
2129
20992130/// Everything `rustc` knows about how to compile for a specific target.
21002131///
21012132/// Every field here must be specified, and has no default value.
......@@ -2221,13 +2252,18 @@ pub struct TargetOptions {
22212252 pub os: Os,
22222253 /// Environment name to use for conditional compilation (`target_env`). Defaults to [`Env::Unspecified`].
22232254 pub env: Env,
2224 /// ABI name to distinguish multiple ABIs on the same OS and architecture. For instance, `"eabi"`
2225 /// or `"eabihf"`. Defaults to [`Abi::Unspecified`].
2226 /// This field is *not* forwarded directly to LLVM and therefore does not control which ABI (in
2227 /// the sense of function calling convention) is actually used; its primary purpose is
2228 /// `cfg(target_abi)`. The actual calling convention is controlled by `llvm_abiname`,
2229 /// `llvm_floatabi`, and `rustc_abi`.
2230 pub abi: Abi,
2255 /// ABI name to distinguish multiple ABIs on the same OS and architecture. For instance,
2256 /// `"eabi"` or `"eabihf"`. Defaults to [`CfgAbi::Unspecified`].
2257 /// The only purpose of this field is to control `cfg(target_abi)`. This does not control the
2258 /// calling convention used by this target! The actual calling convention is controlled by
2259 /// `llvm_abiname`, `llvm_floatabi`, and `rustc_abi`.
2260 ///
2261 /// In a target spec, this field generally *informs* the user about what the ABI is, but you
2262 /// have to also set up other parts of the target spec to ensure that this information is
2263 /// correct. In the rest of the compiler, do not check this field if what you actually need to
2264 /// know about is the calling convention. Most targets have an open-ended set of values for this
2265 /// field.
2266 pub cfg_abi: CfgAbi,
22312267 /// Vendor name to use for conditional compilation (`target_vendor`). Defaults to "unknown".
22322268 #[rustc_lint_opt_deny_field_access(
22332269 "use `Target::is_like_*` instead of this field; see https://github.com/rust-lang/rust/issues/100343 for rationale"
......@@ -2537,7 +2573,7 @@ pub struct TargetOptions {
25372573
25382574 /// LLVM ABI name, corresponds to the '-mabi' parameter available in multilib C compilers
25392575 /// and the `-target-abi` flag in llc. In the LLVM API this is `MCOptions.ABIName`.
2540 pub llvm_abiname: StaticCow<str>,
2576 pub llvm_abiname: LlvmAbi,
25412577
25422578 /// Control the float ABI to use, for architectures that support it. The only architecture we
25432579 /// currently use this for is ARM. Corresponds to the `-float-abi` flag in llc. In the LLVM API
......@@ -2550,7 +2586,6 @@ pub struct TargetOptions {
25502586 /// Picks a specific ABI for this target. This is *not* just for "Rust" ABI functions,
25512587 /// it can also affect "C" ABI functions; the point is that this flag is interpreted by
25522588 /// rustc and not forwarded to LLVM.
2553 /// So far, this is only used on x86.
25542589 pub rustc_abi: Option<RustcAbi>,
25552590
25562591 /// Whether or not RelaxElfRelocation flag will be passed to the linker
......@@ -2739,7 +2774,7 @@ impl Default for TargetOptions {
27392774 c_int_width: 32,
27402775 os: Os::None,
27412776 env: Env::Unspecified,
2742 abi: Abi::Unspecified,
2777 cfg_abi: CfgAbi::Unspecified,
27432778 vendor: "unknown".into(),
27442779 linker: option_env!("CFG_DEFAULT_LINKER").map(|s| s.into()),
27452780 linker_flavor: LinkerFlavor::Gnu(Cc::Yes, Lld::No),
......@@ -2835,7 +2870,7 @@ impl Default for TargetOptions {
28352870 merge_functions: MergeFunctions::Aliases,
28362871 mcount: "mcount".into(),
28372872 llvm_mcount_intrinsic: None,
2838 llvm_abiname: "".into(),
2873 llvm_abiname: LlvmAbi::Unspecified,
28392874 llvm_floatabi: None,
28402875 rustc_abi: None,
28412876 relax_elf_relocations: false,
......@@ -3183,71 +3218,106 @@ impl Target {
31833218 );
31843219 }
31853220
3221 // Ensure built-in targets don't use the `Other` variants.
3222 if kind == TargetKind::Builtin {
3223 check!(
3224 !matches!(self.arch, Arch::Other(_)),
3225 "`Arch::Other` is only meant for JSON targets"
3226 );
3227 check!(!matches!(self.os, Os::Other(_)), "`Os::Other` is only meant for JSON targets");
3228 check!(
3229 !matches!(self.env, Env::Other(_)),
3230 "`Env::Other` is only meant for JSON targets"
3231 );
3232 check!(
3233 !matches!(self.cfg_abi, CfgAbi::Other(_)),
3234 "`CfgAbi::Other` is only meant for JSON targets"
3235 );
3236 check!(
3237 !matches!(self.llvm_abiname, LlvmAbi::Other(_)),
3238 "`LlvmAbi::Other` is only meant for JSON targets"
3239 );
3240 }
3241
31863242 // Check ABI flag consistency, for the architectures where we have proper ABI treatment.
31873243 // To ensure targets are trated consistently, please consult with the team before allowing
31883244 // new cases.
31893245 match self.arch {
31903246 Arch::X86 => {
3191 check!(self.llvm_abiname.is_empty(), "`llvm_abiname` is unused on x86-32");
3247 check!(
3248 self.llvm_abiname == LlvmAbi::Unspecified,
3249 "`llvm_abiname` is unused on x86-32"
3250 );
31923251 check!(self.llvm_floatabi.is_none(), "`llvm_floatabi` is unused on x86-32");
31933252 check_matches!(
3194 (&self.rustc_abi, &self.abi),
3253 (&self.rustc_abi, &self.cfg_abi),
31953254 // FIXME: we do not currently set a target_abi for softfloat targets here,
31963255 // but we probably should, so we already allow it.
3197 (Some(RustcAbi::Softfloat), Abi::SoftFloat | Abi::Unspecified | Abi::Other(_))
3198 | (
3199 Some(RustcAbi::X86Sse2) | None,
3200 Abi::Uwp | Abi::Llvm | Abi::Sim | Abi::Unspecified | Abi::Other(_)
3201 ),
3256 (
3257 Some(RustcAbi::Softfloat),
3258 CfgAbi::SoftFloat | CfgAbi::Unspecified | CfgAbi::Other(_)
3259 ) | (
3260 Some(RustcAbi::X86Sse2) | None,
3261 CfgAbi::Uwp
3262 | CfgAbi::Llvm
3263 | CfgAbi::Sim
3264 | CfgAbi::Unspecified
3265 | CfgAbi::Other(_)
3266 ),
32023267 "invalid x86-32 Rust-specific ABI and `cfg(target_abi)` combination:\n\
32033268 Rust-specific ABI: {:?}\n\
32043269 cfg(target_abi): {}",
32053270 self.rustc_abi,
3206 self.abi,
3271 self.cfg_abi,
32073272 );
32083273 }
32093274 Arch::X86_64 => {
3210 check!(self.llvm_abiname.is_empty(), "`llvm_abiname` is unused on x86-64");
3275 check!(
3276 self.llvm_abiname == LlvmAbi::Unspecified,
3277 "`llvm_abiname` is unused on x86-64"
3278 );
32113279 check!(self.llvm_floatabi.is_none(), "`llvm_floatabi` is unused on x86-64");
32123280 // FIXME: we do not currently set a target_abi for softfloat targets here, but we
32133281 // probably should, so we already allow it.
32143282 // FIXME: Ensure that target_abi = "x32" correlates with actually using that ABI.
32153283 // Do any of the others need a similar check?
32163284 check_matches!(
3217 (&self.rustc_abi, &self.abi),
3218 (Some(RustcAbi::Softfloat), Abi::SoftFloat | Abi::Unspecified | Abi::Other(_))
3219 | (
3220 None,
3221 Abi::X32
3222 | Abi::Llvm
3223 | Abi::Fortanix
3224 | Abi::Uwp
3225 | Abi::MacAbi
3226 | Abi::Sim
3227 | Abi::Unspecified
3228 | Abi::Other(_)
3229 ),
3285 (&self.rustc_abi, &self.cfg_abi),
3286 (
3287 Some(RustcAbi::Softfloat),
3288 CfgAbi::SoftFloat | CfgAbi::Unspecified | CfgAbi::Other(_)
3289 ) | (
3290 None,
3291 CfgAbi::X32
3292 | CfgAbi::Llvm
3293 | CfgAbi::Fortanix
3294 | CfgAbi::Uwp
3295 | CfgAbi::MacAbi
3296 | CfgAbi::Sim
3297 | CfgAbi::Unspecified
3298 | CfgAbi::Other(_)
3299 ),
32303300 "invalid x86-64 Rust-specific ABI and `cfg(target_abi)` combination:\n\
32313301 Rust-specific ABI: {:?}\n\
32323302 cfg(target_abi): {}",
32333303 self.rustc_abi,
3234 self.abi,
3304 self.cfg_abi,
32353305 );
32363306 }
32373307 Arch::RiscV32 => {
32383308 check!(self.llvm_floatabi.is_none(), "`llvm_floatabi` is unused on RISC-V");
32393309 check!(self.rustc_abi.is_none(), "`rustc_abi` is unused on RISC-V");
32403310 check_matches!(
3241 (&*self.llvm_abiname, &self.abi),
3242 ("ilp32", Abi::Unspecified | Abi::Other(_))
3243 | ("ilp32f", Abi::Unspecified | Abi::Other(_))
3244 | ("ilp32d", Abi::Unspecified | Abi::Other(_))
3245 | ("ilp32e", Abi::Ilp32e),
3311 (&self.llvm_abiname, &self.cfg_abi),
3312 (LlvmAbi::Ilp32, CfgAbi::Unspecified | CfgAbi::Other(_))
3313 | (LlvmAbi::Ilp32f, CfgAbi::Unspecified | CfgAbi::Other(_))
3314 | (LlvmAbi::Ilp32d, CfgAbi::Unspecified | CfgAbi::Other(_))
3315 | (LlvmAbi::Ilp32e, CfgAbi::Ilp32e),
32463316 "invalid RISC-V ABI name and `cfg(target_abi)` combination:\n\
32473317 ABI name: {}\n\
32483318 cfg(target_abi): {}",
32493319 self.llvm_abiname,
3250 self.abi,
3320 self.cfg_abi,
32513321 );
32523322 }
32533323 Arch::RiscV64 => {
......@@ -3255,68 +3325,77 @@ impl Target {
32553325 check!(self.llvm_floatabi.is_none(), "`llvm_floatabi` is unused on RISC-V");
32563326 check!(self.rustc_abi.is_none(), "`rustc_abi` is unused on RISC-V");
32573327 check_matches!(
3258 (&*self.llvm_abiname, &self.abi),
3259 ("lp64", Abi::Unspecified | Abi::Other(_))
3260 | ("lp64f", Abi::Unspecified | Abi::Other(_))
3261 | ("lp64d", Abi::Unspecified | Abi::Other(_))
3262 | ("lp64e", Abi::Unspecified | Abi::Other(_)),
3328 (&self.llvm_abiname, &self.cfg_abi),
3329 (LlvmAbi::Lp64, CfgAbi::Unspecified | CfgAbi::Other(_))
3330 | (LlvmAbi::Lp64f, CfgAbi::Unspecified | CfgAbi::Other(_))
3331 | (LlvmAbi::Lp64d, CfgAbi::Unspecified | CfgAbi::Other(_))
3332 | (LlvmAbi::Lp64e, CfgAbi::Unspecified | CfgAbi::Other(_)),
32633333 "invalid RISC-V ABI name and `cfg(target_abi)` combination:\n\
32643334 ABI name: {}\n\
32653335 cfg(target_abi): {}",
32663336 self.llvm_abiname,
3267 self.abi,
3337 self.cfg_abi,
32683338 );
32693339 }
32703340 Arch::Arm => {
3271 check!(self.llvm_abiname.is_empty(), "`llvm_abiname` is unused on ARM");
3341 check!(
3342 self.llvm_abiname == LlvmAbi::Unspecified,
3343 "`llvm_abiname` is unused on ARM"
3344 );
32723345 check!(self.rustc_abi.is_none(), "`rustc_abi` is unused on ARM");
32733346 check_matches!(
3274 (&self.llvm_floatabi, &self.abi),
3347 (&self.llvm_floatabi, &self.cfg_abi),
32753348 (
32763349 Some(FloatAbi::Hard),
3277 Abi::EabiHf | Abi::Uwp | Abi::Unspecified | Abi::Other(_)
3278 ) | (Some(FloatAbi::Soft), Abi::Eabi),
3350 CfgAbi::EabiHf | CfgAbi::Uwp | CfgAbi::Unspecified | CfgAbi::Other(_)
3351 ) | (Some(FloatAbi::Soft), CfgAbi::Eabi),
32793352 "Invalid combination of float ABI and `cfg(target_abi)` for ARM target\n\
32803353 float ABI: {:?}\n\
32813354 cfg(target_abi): {}",
32823355 self.llvm_floatabi,
3283 self.abi,
3356 self.cfg_abi,
32843357 )
32853358 }
32863359 Arch::AArch64 => {
3287 check!(self.llvm_abiname.is_empty(), "`llvm_abiname` is unused on aarch64");
3360 check!(
3361 self.llvm_abiname == LlvmAbi::Unspecified,
3362 "`llvm_abiname` is unused on aarch64"
3363 );
32883364 check!(self.llvm_floatabi.is_none(), "`llvm_floatabi` is unused on aarch64");
32893365 // FIXME: Ensure that target_abi = "ilp32" correlates with actually using that ABI.
32903366 // Do any of the others need a similar check?
32913367 check_matches!(
3292 (&self.rustc_abi, &self.abi),
3293 (Some(RustcAbi::Softfloat), Abi::SoftFloat)
3368 (&self.rustc_abi, &self.cfg_abi),
3369 (Some(RustcAbi::Softfloat), CfgAbi::SoftFloat)
32943370 | (
32953371 None,
3296 Abi::Ilp32
3297 | Abi::Llvm
3298 | Abi::MacAbi
3299 | Abi::Sim
3300 | Abi::Uwp
3301 | Abi::Unspecified
3302 | Abi::Other(_)
3372 CfgAbi::Ilp32
3373 | CfgAbi::Llvm
3374 | CfgAbi::MacAbi
3375 | CfgAbi::Sim
3376 | CfgAbi::Uwp
3377 | CfgAbi::Unspecified
3378 | CfgAbi::Other(_)
33033379 ),
33043380 "invalid aarch64 Rust-specific ABI and `cfg(target_abi)` combination:\n\
33053381 Rust-specific ABI: {:?}\n\
33063382 cfg(target_abi): {}",
33073383 self.rustc_abi,
3308 self.abi,
3384 self.cfg_abi,
33093385 );
33103386 }
33113387 Arch::PowerPC => {
3312 check!(self.llvm_abiname.is_empty(), "`llvm_abiname` is unused on PowerPC");
3388 check!(
3389 self.llvm_abiname == LlvmAbi::Unspecified,
3390 "`llvm_abiname` is unused on PowerPC"
3391 );
33133392 check!(self.llvm_floatabi.is_none(), "`llvm_floatabi` is unused on PowerPC");
33143393 check!(self.rustc_abi.is_none(), "`rustc_abi` is unused on PowerPC");
33153394 // FIXME: Check that `target_abi` matches the actually configured ABI (with or
33163395 // without SPE).
33173396 check_matches!(
3318 self.abi,
3319 Abi::Spe | Abi::Unspecified | Abi::Other(_),
3397 self.cfg_abi,
3398 CfgAbi::Spe | CfgAbi::Unspecified | CfgAbi::Other(_),
33203399 "invalid `target_abi` for PowerPC"
33213400 );
33223401 }
......@@ -3328,116 +3407,123 @@ impl Target {
33283407 // FIXME: Check that `target_abi` matches the actually configured ABI
33293408 // (vec-default vs vec-ext).
33303409 check_matches!(
3331 (&*self.llvm_abiname, &self.abi),
3332 ("", Abi::VecDefault | Abi::VecExtAbi),
3410 (&self.llvm_abiname, &self.cfg_abi),
3411 (LlvmAbi::Unspecified, CfgAbi::VecDefault | CfgAbi::VecExtAbi),
33333412 "invalid PowerPC64 AIX ABI name and `cfg(target_abi)` combination:\n\
33343413 ABI name: {}\n\
33353414 cfg(target_abi): {}",
33363415 self.llvm_abiname,
3337 self.abi,
3416 self.cfg_abi,
33383417 );
33393418 } else if self.endian == Endian::Big {
33403419 check_matches!(
3341 (&*self.llvm_abiname, &self.abi),
3342 ("elfv1", Abi::ElfV1) | ("elfv2", Abi::ElfV2),
3420 (&self.llvm_abiname, &self.cfg_abi),
3421 (LlvmAbi::ElfV1, CfgAbi::ElfV1) | (LlvmAbi::ElfV2, CfgAbi::ElfV2),
33433422 "invalid PowerPC64 big-endian ABI name and `cfg(target_abi)` combination:\n\
33443423 ABI name: {}\n\
33453424 cfg(target_abi): {}",
33463425 self.llvm_abiname,
3347 self.abi,
3426 self.cfg_abi,
33483427 );
33493428 } else {
33503429 check_matches!(
3351 (&*self.llvm_abiname, &self.abi),
3352 ("elfv2", Abi::ElfV2),
3430 (&self.llvm_abiname, &self.cfg_abi),
3431 (LlvmAbi::ElfV2, CfgAbi::ElfV2),
33533432 "invalid PowerPC64 little-endian ABI name and `cfg(target_abi)` combination:\n\
33543433 ABI name: {}\n\
33553434 cfg(target_abi): {}",
33563435 self.llvm_abiname,
3357 self.abi,
3436 self.cfg_abi,
33583437 );
33593438 }
33603439 }
33613440 Arch::S390x => {
3362 check!(self.llvm_abiname.is_empty(), "`llvm_abiname` is unused on s390x");
3441 check!(
3442 self.llvm_abiname == LlvmAbi::Unspecified,
3443 "`llvm_abiname` is unused on s390x"
3444 );
33633445 check!(self.llvm_floatabi.is_none(), "`llvm_floatabi` is unused on s390x");
33643446 check_matches!(
3365 (&self.rustc_abi, &self.abi),
3366 (Some(RustcAbi::Softfloat), Abi::SoftFloat)
3367 | (None, Abi::Unspecified | Abi::Other(_)),
3447 (&self.rustc_abi, &self.cfg_abi),
3448 (Some(RustcAbi::Softfloat), CfgAbi::SoftFloat)
3449 | (None, CfgAbi::Unspecified | CfgAbi::Other(_)),
33683450 "invalid s390x Rust-specific ABI and `cfg(target_abi)` combination:\n\
33693451 Rust-specific ABI: {:?}\n\
33703452 cfg(target_abi): {}",
33713453 self.rustc_abi,
3372 self.abi,
3454 self.cfg_abi,
33733455 );
33743456 }
33753457 Arch::LoongArch32 => {
33763458 check!(self.llvm_floatabi.is_none(), "`llvm_floatabi` is unused on LoongArch");
33773459 check!(self.rustc_abi.is_none(), "`rustc_abi` is unused on LoongArch");
33783460 check_matches!(
3379 (&*self.llvm_abiname, &self.abi),
3380 ("ilp32s", Abi::SoftFloat)
3381 | ("ilp32f", Abi::Unspecified | Abi::Other(_))
3382 | ("ilp32d", Abi::Unspecified | Abi::Other(_)),
3461 (&self.llvm_abiname, &self.cfg_abi),
3462 (LlvmAbi::Ilp32s, CfgAbi::SoftFloat)
3463 | (LlvmAbi::Ilp32f, CfgAbi::Unspecified | CfgAbi::Other(_))
3464 | (LlvmAbi::Ilp32d, CfgAbi::Unspecified | CfgAbi::Other(_)),
33833465 "invalid LoongArch ABI name and `cfg(target_abi)` combination:\n\
33843466 ABI name: {}\n\
33853467 cfg(target_abi): {}",
33863468 self.llvm_abiname,
3387 self.abi,
3469 self.cfg_abi,
33883470 );
33893471 }
33903472 Arch::LoongArch64 => {
33913473 check!(self.llvm_floatabi.is_none(), "`llvm_floatabi` is unused on LoongArch");
33923474 check!(self.rustc_abi.is_none(), "`rustc_abi` is unused on LoongArch");
33933475 check_matches!(
3394 (&*self.llvm_abiname, &self.abi),
3395 ("lp64s", Abi::SoftFloat)
3396 | ("lp64f", Abi::Unspecified | Abi::Other(_))
3397 | ("lp64d", Abi::Unspecified | Abi::Other(_)),
3476 (&self.llvm_abiname, &self.cfg_abi),
3477 (LlvmAbi::Lp64s, CfgAbi::SoftFloat)
3478 | (LlvmAbi::Lp64f, CfgAbi::Unspecified | CfgAbi::Other(_))
3479 | (LlvmAbi::Lp64d, CfgAbi::Unspecified | CfgAbi::Other(_)),
33983480 "invalid LoongArch ABI name and `cfg(target_abi)` combination:\n\
33993481 ABI name: {}\n\
34003482 cfg(target_abi): {}",
34013483 self.llvm_abiname,
3402 self.abi,
3484 self.cfg_abi,
34033485 );
34043486 }
34053487 Arch::Mips | Arch::Mips32r6 => {
34063488 check!(self.llvm_floatabi.is_none(), "`llvm_floatabi` is unused on MIPS");
34073489 check!(self.rustc_abi.is_none(), "`rustc_abi` is unused on MIPS");
34083490 check_matches!(
3409 (&*self.llvm_abiname, &self.abi),
3410 ("o32", Abi::Unspecified | Abi::Other(_)),
3491 (&self.llvm_abiname, &self.cfg_abi),
3492 (LlvmAbi::O32, CfgAbi::Unspecified | CfgAbi::Other(_)),
34113493 "invalid MIPS ABI name and `cfg(target_abi)` combination:\n\
34123494 ABI name: {}\n\
34133495 cfg(target_abi): {}",
34143496 self.llvm_abiname,
3415 self.abi,
3497 self.cfg_abi,
34163498 );
34173499 }
34183500 Arch::Mips64 | Arch::Mips64r6 => {
34193501 check!(self.llvm_floatabi.is_none(), "`llvm_floatabi` is unused on MIPS");
34203502 check!(self.rustc_abi.is_none(), "`rustc_abi` is unused on MIPS");
34213503 check_matches!(
3422 (&*self.llvm_abiname, &self.abi),
3504 (&self.llvm_abiname, &self.cfg_abi),
34233505 // No in-tree targets use "n32" but at least for now we let out-of-tree targets
34243506 // experiment with that.
3425 ("n64", Abi::Abi64) | ("n32", Abi::Unspecified | Abi::Other(_)),
3507 (LlvmAbi::N64, CfgAbi::Abi64)
3508 | (LlvmAbi::N32, CfgAbi::Unspecified | CfgAbi::Other(_)),
34263509 "invalid MIPS ABI name and `cfg(target_abi)` combination:\n\
34273510 ABI name: {}\n\
34283511 cfg(target_abi): {}",
34293512 self.llvm_abiname,
3430 self.abi,
3513 self.cfg_abi,
34313514 );
34323515 }
34333516 Arch::CSky => {
3434 check!(self.llvm_abiname.is_empty(), "`llvm_abiname` is unused on CSky");
3517 check!(
3518 self.llvm_abiname == LlvmAbi::Unspecified,
3519 "`llvm_abiname` is unused on CSky"
3520 );
34353521 check!(self.llvm_floatabi.is_none(), "`llvm_floatabi` is unused on CSky");
34363522 check!(self.rustc_abi.is_none(), "`rustc_abi` is unused on CSky");
34373523 // FIXME: Check that `target_abi` matches the actually configured ABI (v2 vs v2hf).
34383524 check_matches!(
3439 self.abi,
3440 Abi::AbiV2 | Abi::AbiV2Hf,
3525 self.cfg_abi,
3526 CfgAbi::AbiV2 | CfgAbi::AbiV2Hf,
34413527 "invalid `target_abi` for CSky"
34423528 );
34433529 }
......@@ -3446,11 +3532,14 @@ impl Target {
34463532 // Ensure consistency among built-in targets, but give JSON targets the opportunity
34473533 // to experiment with these.
34483534 if kind == TargetKind::Builtin {
3449 check!(self.llvm_abiname.is_empty(), "`llvm_abiname` is unused on {arch}");
3535 check!(
3536 self.llvm_abiname == LlvmAbi::Unspecified,
3537 "`llvm_abiname` is unused on {arch}"
3538 );
34503539 check!(self.llvm_floatabi.is_none(), "`llvm_floatabi` is unused on {arch}");
34513540 check_matches!(
3452 self.abi,
3453 Abi::Unspecified | Abi::Other(_),
3541 self.cfg_abi,
3542 CfgAbi::Unspecified | CfgAbi::Other(_),
34543543 "`target_abi` is unused on {arch}"
34553544 );
34563545 }
......@@ -3665,7 +3754,7 @@ impl Target {
36653754 // it using a custom target specification. N32
36663755 // is an ILP32 ABI like the Aarch64_Ilp32
36673756 // and X86_64_X32 cases above and below this one.
3668 if self.options.llvm_abiname.as_ref() == "n32" {
3757 if self.options.llvm_abiname == LlvmAbi::N32 {
36693758 Architecture::Mips64_N32
36703759 } else {
36713760 Architecture::Mips64
compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu_ilp32.rs+2-2
......@@ -1,7 +1,7 @@
11use rustc_abi::Endian;
22
33use crate::spec::{
4 Abi, Arch, FramePointer, StackProbeType, Target, TargetMetadata, TargetOptions, base,
4 Arch, CfgAbi, FramePointer, StackProbeType, Target, TargetMetadata, TargetOptions, base,
55};
66
77pub(crate) fn target() -> Target {
......@@ -20,7 +20,7 @@ pub(crate) fn target() -> Target {
2020 data_layout: "E-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32".into(),
2121 arch: Arch::AArch64,
2222 options: TargetOptions {
23 abi: Abi::Ilp32,
23 cfg_abi: CfgAbi::Ilp32,
2424 features: "+v8a,+outline-atomics".into(),
2525 // the AAPCS64 expects use of non-leaf frame pointers per
2626 // https://github.com/ARM-software/abi-aa/blob/4492d1570eb70c8fd146623e0db65b2d241f12e7/aapcs64/aapcs64.rst#the-frame-pointer
compiler/rustc_target/src/spec/targets/aarch64_be_unknown_none_softfloat.rs+2-2
......@@ -8,13 +8,13 @@
88use rustc_abi::Endian;
99
1010use crate::spec::{
11 Abi, Arch, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, RustcAbi, SanitizerSet,
11 Arch, Cc, CfgAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, RustcAbi, SanitizerSet,
1212 StackProbeType, Target, TargetMetadata, TargetOptions,
1313};
1414
1515pub(crate) fn target() -> Target {
1616 let opts = TargetOptions {
17 abi: Abi::SoftFloat,
17 cfg_abi: CfgAbi::SoftFloat,
1818 rustc_abi: Some(RustcAbi::Softfloat),
1919 linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
2020 linker: Some("rust-lld".into()),
compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu_ilp32.rs+2-2
......@@ -1,5 +1,5 @@
11use crate::spec::{
2 Abi, Arch, FramePointer, StackProbeType, Target, TargetMetadata, TargetOptions, base,
2 Arch, CfgAbi, FramePointer, StackProbeType, Target, TargetMetadata, TargetOptions, base,
33};
44
55pub(crate) fn target() -> Target {
......@@ -15,7 +15,7 @@ pub(crate) fn target() -> Target {
1515 data_layout: "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32".into(),
1616 arch: Arch::AArch64,
1717 options: TargetOptions {
18 abi: Abi::Ilp32,
18 cfg_abi: CfgAbi::Ilp32,
1919 features: "+v8a,+outline-atomics".into(),
2020 // the AAPCS64 expects use of non-leaf frame pointers per
2121 // https://github.com/ARM-software/abi-aa/blob/4492d1570eb70c8fd146623e0db65b2d241f12e7/aapcs64/aapcs64.rst#the-frame-pointer
compiler/rustc_target/src/spec/targets/aarch64_unknown_none_softfloat.rs+2-2
......@@ -7,13 +7,13 @@
77// For example, `-C target-cpu=cortex-a53`.
88
99use crate::spec::{
10 Abi, Arch, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, RustcAbi, SanitizerSet,
10 Arch, Cc, CfgAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, RustcAbi, SanitizerSet,
1111 StackProbeType, Target, TargetMetadata, TargetOptions,
1212};
1313
1414pub(crate) fn target() -> Target {
1515 let opts = TargetOptions {
16 abi: Abi::SoftFloat,
16 cfg_abi: CfgAbi::SoftFloat,
1717 rustc_abi: Some(RustcAbi::Softfloat),
1818 linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
1919 linker: Some("rust-lld".into()),
compiler/rustc_target/src/spec/targets/aarch64v8r_unknown_none_softfloat.rs+2-2
......@@ -1,11 +1,11 @@
11use crate::spec::{
2 Abi, Arch, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, RustcAbi, SanitizerSet,
2 Arch, Cc, CfgAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, RustcAbi, SanitizerSet,
33 StackProbeType, Target, TargetMetadata, TargetOptions,
44};
55
66pub(crate) fn target() -> Target {
77 let opts = TargetOptions {
8 abi: Abi::SoftFloat,
8 cfg_abi: CfgAbi::SoftFloat,
99 rustc_abi: Some(RustcAbi::Softfloat),
1010 linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
1111 linker: Some("rust-lld".into()),
compiler/rustc_target/src/spec/targets/arm_linux_androideabi.rs+4-2
......@@ -1,4 +1,6 @@
1use crate::spec::{Abi, Arch, FloatAbi, SanitizerSet, Target, TargetMetadata, TargetOptions, base};
1use crate::spec::{
2 Arch, CfgAbi, FloatAbi, SanitizerSet, Target, TargetMetadata, TargetOptions, base,
3};
24
35pub(crate) fn target() -> Target {
46 Target {
......@@ -13,7 +15,7 @@ pub(crate) fn target() -> Target {
1315 data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
1416 arch: Arch::Arm,
1517 options: TargetOptions {
16 abi: Abi::Eabi,
18 cfg_abi: CfgAbi::Eabi,
1719 llvm_floatabi: Some(FloatAbi::Soft),
1820 // https://developer.android.com/ndk/guides/abis.html#armeabi
1921 features: "+strict-align,+v5te".into(),
compiler/rustc_target/src/spec/targets/arm_unknown_linux_gnueabi.rs+2-2
......@@ -1,4 +1,4 @@
1use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
1use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
......@@ -13,7 +13,7 @@ pub(crate) fn target() -> Target {
1313 data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
1414 arch: Arch::Arm,
1515 options: TargetOptions {
16 abi: Abi::Eabi,
16 cfg_abi: CfgAbi::Eabi,
1717 llvm_floatabi: Some(FloatAbi::Soft),
1818 features: "+strict-align,+v6".into(),
1919 max_atomic_width: Some(64),
compiler/rustc_target/src/spec/targets/arm_unknown_linux_gnueabihf.rs+2-2
......@@ -1,4 +1,4 @@
1use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
1use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
......@@ -13,7 +13,7 @@ pub(crate) fn target() -> Target {
1313 data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
1414 arch: Arch::Arm,
1515 options: TargetOptions {
16 abi: Abi::EabiHf,
16 cfg_abi: CfgAbi::EabiHf,
1717 llvm_floatabi: Some(FloatAbi::Hard),
1818 features: "+strict-align,+v6,+vfp2".into(),
1919 max_atomic_width: Some(64),
compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs+2-2
......@@ -1,4 +1,4 @@
1use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
1use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
......@@ -13,7 +13,7 @@ pub(crate) fn target() -> Target {
1313 data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
1414 arch: Arch::Arm,
1515 options: TargetOptions {
16 abi: Abi::Eabi,
16 cfg_abi: CfgAbi::Eabi,
1717 llvm_floatabi: Some(FloatAbi::Soft),
1818 // Most of these settings are copied from the arm_unknown_linux_gnueabi
1919 // target.
compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs+2-2
......@@ -1,4 +1,4 @@
1use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
1use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
......@@ -13,7 +13,7 @@ pub(crate) fn target() -> Target {
1313 data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
1414 arch: Arch::Arm,
1515 options: TargetOptions {
16 abi: Abi::EabiHf,
16 cfg_abi: CfgAbi::EabiHf,
1717 llvm_floatabi: Some(FloatAbi::Hard),
1818 // Most of these settings are copied from the arm_unknown_linux_gnueabihf
1919 // target.
compiler/rustc_target/src/spec/targets/armeb_unknown_linux_gnueabi.rs+2-2
......@@ -1,6 +1,6 @@
11use rustc_abi::Endian;
22
3use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
3use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
44
55pub(crate) fn target() -> Target {
66 Target {
......@@ -15,7 +15,7 @@ pub(crate) fn target() -> Target {
1515 data_layout: "E-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
1616 arch: Arch::Arm,
1717 options: TargetOptions {
18 abi: Abi::Eabi,
18 cfg_abi: CfgAbi::Eabi,
1919 llvm_floatabi: Some(FloatAbi::Soft),
2020 features: "+strict-align,+v8,+crc".into(),
2121 endian: Endian::Big,
compiler/rustc_target/src/spec/targets/armebv7r_none_eabi.rs+3-3
......@@ -3,8 +3,8 @@
33use rustc_abi::Endian;
44
55use crate::spec::{
6 Abi, Arch, Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata,
7 TargetOptions,
6 Arch, Cc, CfgAbi, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target,
7 TargetMetadata, TargetOptions,
88};
99
1010pub(crate) fn target() -> Target {
......@@ -20,7 +20,7 @@ pub(crate) fn target() -> Target {
2020 data_layout: "E-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
2121 arch: Arch::Arm,
2222 options: TargetOptions {
23 abi: Abi::Eabi,
23 cfg_abi: CfgAbi::Eabi,
2424 llvm_floatabi: Some(FloatAbi::Soft),
2525 endian: Endian::Big,
2626 linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
compiler/rustc_target/src/spec/targets/armebv7r_none_eabihf.rs+3-3
......@@ -3,8 +3,8 @@
33use rustc_abi::Endian;
44
55use crate::spec::{
6 Abi, Arch, Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata,
7 TargetOptions,
6 Arch, Cc, CfgAbi, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target,
7 TargetMetadata, TargetOptions,
88};
99
1010pub(crate) fn target() -> Target {
......@@ -20,7 +20,7 @@ pub(crate) fn target() -> Target {
2020 data_layout: "E-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
2121 arch: Arch::Arm,
2222 options: TargetOptions {
23 abi: Abi::EabiHf,
23 cfg_abi: CfgAbi::EabiHf,
2424 llvm_floatabi: Some(FloatAbi::Hard),
2525 endian: Endian::Big,
2626 linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
compiler/rustc_target/src/spec/targets/armv4t_none_eabi.rs+2-2
......@@ -9,7 +9,7 @@
99//! The default link script is very likely wrong, so you should use
1010//! `-Clink-arg=-Tmy_script.ld` to override that with a correct linker script.
1111
12use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base, cvs};
12use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base, cvs};
1313
1414pub(crate) fn target() -> Target {
1515 Target {
......@@ -24,7 +24,7 @@ pub(crate) fn target() -> Target {
2424 arch: Arch::Arm,
2525 data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
2626 options: TargetOptions {
27 abi: Abi::Eabi,
27 cfg_abi: CfgAbi::Eabi,
2828 llvm_floatabi: Some(FloatAbi::Soft),
2929 asm_args: cvs!["-mthumb-interwork", "-march=armv4t", "-mlittle-endian",],
3030 features: "+soft-float,+strict-align".into(),
compiler/rustc_target/src/spec/targets/armv4t_unknown_linux_gnueabi.rs+2-2
......@@ -1,4 +1,4 @@
1use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
1use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
......@@ -13,7 +13,7 @@ pub(crate) fn target() -> Target {
1313 data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
1414 arch: Arch::Arm,
1515 options: TargetOptions {
16 abi: Abi::Eabi,
16 cfg_abi: CfgAbi::Eabi,
1717 llvm_floatabi: Some(FloatAbi::Soft),
1818 features: "+soft-float,+strict-align".into(),
1919 // Atomic operations provided by compiler-builtins
compiler/rustc_target/src/spec/targets/armv5te_none_eabi.rs+2-2
......@@ -1,6 +1,6 @@
11//! Targets the ARMv5TE architecture, with `a32` code by default.
22
3use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base, cvs};
3use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base, cvs};
44
55pub(crate) fn target() -> Target {
66 Target {
......@@ -15,7 +15,7 @@ pub(crate) fn target() -> Target {
1515 arch: Arch::Arm,
1616 data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
1717 options: TargetOptions {
18 abi: Abi::Eabi,
18 cfg_abi: CfgAbi::Eabi,
1919 llvm_floatabi: Some(FloatAbi::Soft),
2020 asm_args: cvs!["-mthumb-interwork", "-march=armv5te", "-mlittle-endian",],
2121 features: "+soft-float,+strict-align".into(),
compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_gnueabi.rs+2-2
......@@ -1,4 +1,4 @@
1use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
1use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
......@@ -13,7 +13,7 @@ pub(crate) fn target() -> Target {
1313 data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
1414 arch: Arch::Arm,
1515 options: TargetOptions {
16 abi: Abi::Eabi,
16 cfg_abi: CfgAbi::Eabi,
1717 llvm_floatabi: Some(FloatAbi::Soft),
1818 features: "+soft-float,+strict-align".into(),
1919 // Atomic operations provided by compiler-builtins
compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_musleabi.rs+2-2
......@@ -1,4 +1,4 @@
1use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
1use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
......@@ -13,7 +13,7 @@ pub(crate) fn target() -> Target {
1313 data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
1414 arch: Arch::Arm,
1515 options: TargetOptions {
16 abi: Abi::Eabi,
16 cfg_abi: CfgAbi::Eabi,
1717 llvm_floatabi: Some(FloatAbi::Soft),
1818 features: "+soft-float,+strict-align".into(),
1919 // Atomic operations provided by compiler-builtins
compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_uclibceabi.rs+2-2
......@@ -1,4 +1,4 @@
1use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
1use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
......@@ -13,7 +13,7 @@ pub(crate) fn target() -> Target {
1313 data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
1414 arch: Arch::Arm,
1515 options: TargetOptions {
16 abi: Abi::Eabi,
16 cfg_abi: CfgAbi::Eabi,
1717 llvm_floatabi: Some(FloatAbi::Soft),
1818 features: "+soft-float,+strict-align".into(),
1919 // Atomic operations provided by compiler-builtins
compiler/rustc_target/src/spec/targets/armv6_none_eabi.rs+2-2
......@@ -1,6 +1,6 @@
11//! Targets the ARMv6K architecture, with `a32` code by default.
22
3use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base, cvs};
3use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base, cvs};
44
55pub(crate) fn target() -> Target {
66 Target {
......@@ -15,7 +15,7 @@ pub(crate) fn target() -> Target {
1515 arch: Arch::Arm,
1616 data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
1717 options: TargetOptions {
18 abi: Abi::Eabi,
18 cfg_abi: CfgAbi::Eabi,
1919 llvm_floatabi: Some(FloatAbi::Soft),
2020 asm_args: cvs!["-mthumb-interwork", "-march=armv6", "-mlittle-endian",],
2121 features: "+soft-float,+strict-align,+v6k".into(),
compiler/rustc_target/src/spec/targets/armv6_none_eabihf.rs+2-2
......@@ -1,6 +1,6 @@
11//! Targets the ARMv6K architecture, with `a32` code by default, and hard-float ABI
22
3use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base, cvs};
3use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base, cvs};
44
55pub(crate) fn target() -> Target {
66 Target {
......@@ -15,7 +15,7 @@ pub(crate) fn target() -> Target {
1515 arch: Arch::Arm,
1616 data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
1717 options: TargetOptions {
18 abi: Abi::EabiHf,
18 cfg_abi: CfgAbi::EabiHf,
1919 llvm_floatabi: Some(FloatAbi::Hard),
2020 asm_args: cvs!["-mthumb-interwork", "-march=armv6", "-mlittle-endian",],
2121 features: "+strict-align,+v6k,+vfp2,-d32".into(),
compiler/rustc_target/src/spec/targets/armv6_unknown_freebsd.rs+2-2
......@@ -1,4 +1,4 @@
1use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
1use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
......@@ -13,7 +13,7 @@ pub(crate) fn target() -> Target {
1313 data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
1414 arch: Arch::Arm,
1515 options: TargetOptions {
16 abi: Abi::EabiHf,
16 cfg_abi: CfgAbi::EabiHf,
1717 llvm_floatabi: Some(FloatAbi::Hard),
1818 features: "+v6,+vfp2".into(),
1919 max_atomic_width: Some(64),
compiler/rustc_target/src/spec/targets/armv6_unknown_netbsd_eabihf.rs+2-2
......@@ -1,4 +1,4 @@
1use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
1use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
......@@ -13,7 +13,7 @@ pub(crate) fn target() -> Target {
1313 data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
1414 arch: Arch::Arm,
1515 options: TargetOptions {
16 abi: Abi::EabiHf,
16 cfg_abi: CfgAbi::EabiHf,
1717 llvm_floatabi: Some(FloatAbi::Hard),
1818 features: "+v6,+vfp2".into(),
1919 max_atomic_width: Some(64),
compiler/rustc_target/src/spec/targets/armv6k_nintendo_3ds.rs+2-2
......@@ -1,5 +1,5 @@
11use crate::spec::{
2 Abi, Arch, Cc, Env, FloatAbi, LinkerFlavor, Lld, Os, RelocModel, Target, TargetMetadata,
2 Arch, Cc, CfgAbi, Env, FloatAbi, LinkerFlavor, Lld, Os, RelocModel, Target, TargetMetadata,
33 TargetOptions, cvs,
44};
55
......@@ -29,7 +29,7 @@ pub(crate) fn target() -> Target {
2929 env: Env::Newlib,
3030 vendor: "nintendo".into(),
3131 cpu: "mpcore".into(),
32 abi: Abi::EabiHf,
32 cfg_abi: CfgAbi::EabiHf,
3333 llvm_floatabi: Some(FloatAbi::Hard),
3434 families: cvs!["unix"],
3535 linker: Some("arm-none-eabi-gcc".into()),
compiler/rustc_target/src/spec/targets/armv7_linux_androideabi.rs+2-2
......@@ -1,5 +1,5 @@
11use crate::spec::{
2 Abi, Arch, Cc, FloatAbi, LinkerFlavor, Lld, SanitizerSet, Target, TargetMetadata,
2 Arch, Cc, CfgAbi, FloatAbi, LinkerFlavor, Lld, SanitizerSet, Target, TargetMetadata,
33 TargetOptions, base,
44};
55
......@@ -26,7 +26,7 @@ pub(crate) fn target() -> Target {
2626 data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
2727 arch: Arch::Arm,
2828 options: TargetOptions {
29 abi: Abi::Eabi,
29 cfg_abi: CfgAbi::Eabi,
3030 llvm_floatabi: Some(FloatAbi::Soft),
3131 features: "+v7,+thumb-mode,+thumb2,+vfp3d16,-neon".into(),
3232 supported_sanitizers: SanitizerSet::ADDRESS,
compiler/rustc_target/src/spec/targets/armv7_rtems_eabihf.rs+2-2
......@@ -1,5 +1,5 @@
11use crate::spec::{
2 Abi, Arch, Cc, Env, FloatAbi, LinkerFlavor, Lld, Os, PanicStrategy, RelocModel, Target,
2 Arch, Cc, CfgAbi, Env, FloatAbi, LinkerFlavor, Lld, Os, PanicStrategy, RelocModel, Target,
33 TargetMetadata, TargetOptions, cvs,
44};
55
......@@ -19,7 +19,7 @@ pub(crate) fn target() -> Target {
1919 options: TargetOptions {
2020 os: Os::Rtems,
2121 families: cvs!["unix"],
22 abi: Abi::EabiHf,
22 cfg_abi: CfgAbi::EabiHf,
2323 llvm_floatabi: Some(FloatAbi::Hard),
2424 linker_flavor: LinkerFlavor::Gnu(Cc::Yes, Lld::No),
2525 linker: None,
compiler/rustc_target/src/spec/targets/armv7_sony_vita_newlibeabihf.rs+2-2
......@@ -1,7 +1,7 @@
11use rustc_abi::Endian;
22
33use crate::spec::{
4 Abi, Arch, Cc, Env, FloatAbi, LinkerFlavor, Lld, Os, RelocModel, Target, TargetMetadata,
4 Arch, Cc, CfgAbi, Env, FloatAbi, LinkerFlavor, Lld, Os, RelocModel, Target, TargetMetadata,
55 TargetOptions, cvs,
66};
77
......@@ -34,7 +34,7 @@ pub(crate) fn target() -> Target {
3434 c_int_width: 32,
3535 env: Env::Newlib,
3636 vendor: "sony".into(),
37 abi: Abi::EabiHf,
37 cfg_abi: CfgAbi::EabiHf,
3838 llvm_floatabi: Some(FloatAbi::Hard),
3939 linker_flavor: LinkerFlavor::Gnu(Cc::Yes, Lld::No),
4040 no_default_libraries: false,
compiler/rustc_target/src/spec/targets/armv7_unknown_freebsd.rs+2-2
......@@ -1,4 +1,4 @@
1use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
1use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
......@@ -13,7 +13,7 @@ pub(crate) fn target() -> Target {
1313 data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
1414 arch: Arch::Arm,
1515 options: TargetOptions {
16 abi: Abi::EabiHf,
16 cfg_abi: CfgAbi::EabiHf,
1717 llvm_floatabi: Some(FloatAbi::Hard),
1818 features: "+v7,+vfp3d16,+thumb2,-neon".into(),
1919 max_atomic_width: Some(64),
compiler/rustc_target/src/spec/targets/armv7_unknown_linux_gnueabi.rs+2-2
......@@ -1,4 +1,4 @@
1use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
1use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
22
33// This target is for glibc Linux on ARMv7 without thumb-mode, NEON or
44// hardfloat.
......@@ -16,7 +16,7 @@ pub(crate) fn target() -> Target {
1616 data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
1717 arch: Arch::Arm,
1818 options: TargetOptions {
19 abi: Abi::Eabi,
19 cfg_abi: CfgAbi::Eabi,
2020 llvm_floatabi: Some(FloatAbi::Soft),
2121 features: "+v7,+thumb2,+soft-float,-neon".into(),
2222 max_atomic_width: Some(64),
compiler/rustc_target/src/spec/targets/armv7_unknown_linux_gnueabihf.rs+2-2
......@@ -1,4 +1,4 @@
1use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
1use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
22
33// This target is for glibc Linux on ARMv7 without NEON or
44// thumb-mode. See the thumbv7neon variant for enabling both.
......@@ -16,7 +16,7 @@ pub(crate) fn target() -> Target {
1616 data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
1717 arch: Arch::Arm,
1818 options: TargetOptions {
19 abi: Abi::EabiHf,
19 cfg_abi: CfgAbi::EabiHf,
2020 llvm_floatabi: Some(FloatAbi::Hard),
2121 // Info about features at https://wiki.debian.org/ArmHardFloatPort
2222 features: "+v7,+vfp3d16,+thumb2,-neon".into(),
compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabi.rs+2-2
......@@ -1,4 +1,4 @@
1use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
1use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
22
33// This target is for musl Linux on ARMv7 without thumb-mode, NEON or
44// hardfloat.
......@@ -19,7 +19,7 @@ pub(crate) fn target() -> Target {
1919 arch: Arch::Arm,
2020
2121 options: TargetOptions {
22 abi: Abi::Eabi,
22 cfg_abi: CfgAbi::Eabi,
2323 llvm_floatabi: Some(FloatAbi::Soft),
2424 features: "+v7,+thumb2,+soft-float,-neon".into(),
2525 max_atomic_width: Some(64),
compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs+2-2
......@@ -1,4 +1,4 @@
1use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
1use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
22
33// This target is for musl Linux on ARMv7 without thumb-mode or NEON.
44
......@@ -18,7 +18,7 @@ pub(crate) fn target() -> Target {
1818 // Most of these settings are copied from the armv7_unknown_linux_gnueabihf
1919 // target.
2020 options: TargetOptions {
21 abi: Abi::EabiHf,
21 cfg_abi: CfgAbi::EabiHf,
2222 llvm_floatabi: Some(FloatAbi::Hard),
2323 features: "+v7,+vfp3d16,+thumb2,-neon".into(),
2424 max_atomic_width: Some(64),
compiler/rustc_target/src/spec/targets/armv7_unknown_linux_ohos.rs+2-2
......@@ -1,4 +1,4 @@
1use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
1use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
22
33// This target is for OpenHarmony on ARMv7 Linux with thumb-mode, but no NEON or
44// hardfloat.
......@@ -19,7 +19,7 @@ pub(crate) fn target() -> Target {
1919 arch: Arch::Arm,
2020
2121 options: TargetOptions {
22 abi: Abi::Eabi,
22 cfg_abi: CfgAbi::Eabi,
2323 llvm_floatabi: Some(FloatAbi::Soft),
2424 features: "+v7,+thumb2,+soft-float,-neon".into(),
2525 max_atomic_width: Some(64),
compiler/rustc_target/src/spec/targets/armv7_unknown_linux_uclibceabi.rs+2-2
......@@ -1,4 +1,4 @@
1use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
1use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
22
33// This target is for uclibc Linux on ARMv7 without NEON,
44// thumb-mode or hardfloat.
......@@ -18,7 +18,7 @@ pub(crate) fn target() -> Target {
1818 arch: Arch::Arm,
1919
2020 options: TargetOptions {
21 abi: Abi::Eabi,
21 cfg_abi: CfgAbi::Eabi,
2222 llvm_floatabi: Some(FloatAbi::Soft),
2323 features: "+v7,+thumb2,+soft-float,-neon".into(),
2424 cpu: "generic".into(),
compiler/rustc_target/src/spec/targets/armv7_unknown_linux_uclibceabihf.rs+2-2
......@@ -1,4 +1,4 @@
1use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
1use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
22
33// This target is for uclibc Linux on ARMv7 without NEON or
44// thumb-mode. See the thumbv7neon variant for enabling both.
......@@ -23,7 +23,7 @@ pub(crate) fn target() -> Target {
2323 cpu: "generic".into(),
2424 max_atomic_width: Some(64),
2525 mcount: "_mcount".into(),
26 abi: Abi::EabiHf,
26 cfg_abi: CfgAbi::EabiHf,
2727 llvm_floatabi: Some(FloatAbi::Hard),
2828 ..base
2929 },
compiler/rustc_target/src/spec/targets/armv7_unknown_netbsd_eabihf.rs+2-2
......@@ -1,4 +1,4 @@
1use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
1use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
......@@ -13,7 +13,7 @@ pub(crate) fn target() -> Target {
1313 data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
1414 arch: Arch::Arm,
1515 options: TargetOptions {
16 abi: Abi::EabiHf,
16 cfg_abi: CfgAbi::EabiHf,
1717 llvm_floatabi: Some(FloatAbi::Hard),
1818 features: "+v7,+vfp3d16,+thumb2,-neon".into(),
1919 max_atomic_width: Some(64),
compiler/rustc_target/src/spec/targets/armv7_unknown_trusty.rs+2-2
......@@ -1,5 +1,5 @@
11use crate::spec::{
2 Abi, Arch, FloatAbi, LinkSelfContainedDefault, Os, PanicStrategy, RelroLevel, Target,
2 Arch, CfgAbi, FloatAbi, LinkSelfContainedDefault, Os, PanicStrategy, RelroLevel, Target,
33 TargetMetadata, TargetOptions,
44};
55
......@@ -19,7 +19,7 @@ pub(crate) fn target() -> Target {
1919 data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
2020 arch: Arch::Arm,
2121 options: TargetOptions {
22 abi: Abi::Eabi,
22 cfg_abi: CfgAbi::Eabi,
2323 llvm_floatabi: Some(FloatAbi::Soft),
2424 features: "+v7,+thumb2,+soft-float,-neon".into(),
2525 max_atomic_width: Some(64),
compiler/rustc_target/src/spec/targets/armv7_wrs_vxworks_eabihf.rs+2-2
......@@ -1,4 +1,4 @@
1use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
1use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
......@@ -13,7 +13,7 @@ pub(crate) fn target() -> Target {
1313 data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
1414 arch: Arch::Arm,
1515 options: TargetOptions {
16 abi: Abi::EabiHf,
16 cfg_abi: CfgAbi::EabiHf,
1717 llvm_floatabi: Some(FloatAbi::Hard),
1818 // Info about features at https://wiki.debian.org/ArmHardFloatPort
1919 features: "+v7,+vfp3d16,+thumb2,-neon".into(),
compiler/rustc_target/src/spec/targets/armv7a_kmc_solid_asp3_eabi.rs+4-2
......@@ -1,4 +1,6 @@
1use crate::spec::{Abi, Arch, FloatAbi, RelocModel, Target, TargetMetadata, TargetOptions, base};
1use crate::spec::{
2 Arch, CfgAbi, FloatAbi, RelocModel, Target, TargetMetadata, TargetOptions, base,
3};
24
35pub(crate) fn target() -> Target {
46 let base = base::solid::opts();
......@@ -14,7 +16,7 @@ pub(crate) fn target() -> Target {
1416 data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
1517 arch: Arch::Arm,
1618 options: TargetOptions {
17 abi: Abi::Eabi,
19 cfg_abi: CfgAbi::Eabi,
1820 llvm_floatabi: Some(FloatAbi::Soft),
1921 linker: Some("arm-kmc-eabi-gcc".into()),
2022 features: "+v7,+soft-float,+thumb2,-neon".into(),
compiler/rustc_target/src/spec/targets/armv7a_kmc_solid_asp3_eabihf.rs+4-2
......@@ -1,4 +1,6 @@
1use crate::spec::{Abi, Arch, FloatAbi, RelocModel, Target, TargetMetadata, TargetOptions, base};
1use crate::spec::{
2 Arch, CfgAbi, FloatAbi, RelocModel, Target, TargetMetadata, TargetOptions, base,
3};
24
35pub(crate) fn target() -> Target {
46 let base = base::solid::opts();
......@@ -14,7 +16,7 @@ pub(crate) fn target() -> Target {
1416 data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
1517 arch: Arch::Arm,
1618 options: TargetOptions {
17 abi: Abi::EabiHf,
19 cfg_abi: CfgAbi::EabiHf,
1820 llvm_floatabi: Some(FloatAbi::Hard),
1921 linker: Some("arm-kmc-eabi-gcc".into()),
2022 features: "+v7,+vfp3d16,+thumb2,-neon".into(),
compiler/rustc_target/src/spec/targets/armv7a_none_eabi.rs+2-2
......@@ -1,6 +1,6 @@
11// Targets the Little-endian Cortex-A8 (and similar) processors (ARMv7-A)
22
3use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
3use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
44
55pub(crate) fn target() -> Target {
66 Target {
......@@ -15,7 +15,7 @@ pub(crate) fn target() -> Target {
1515 data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
1616 arch: Arch::Arm,
1717 options: TargetOptions {
18 abi: Abi::Eabi,
18 cfg_abi: CfgAbi::Eabi,
1919 llvm_floatabi: Some(FloatAbi::Soft),
2020 features: "+soft-float,-neon,+strict-align".into(),
2121 max_atomic_width: Some(64),
compiler/rustc_target/src/spec/targets/armv7a_none_eabihf.rs+2-2
......@@ -1,6 +1,6 @@
11// Targets the Little-endian Cortex-A8 (and similar) processors (ARMv7-A)
22
3use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
3use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
44
55pub(crate) fn target() -> Target {
66 Target {
......@@ -15,7 +15,7 @@ pub(crate) fn target() -> Target {
1515 data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
1616 arch: Arch::Arm,
1717 options: TargetOptions {
18 abi: Abi::EabiHf,
18 cfg_abi: CfgAbi::EabiHf,
1919 llvm_floatabi: Some(FloatAbi::Hard),
2020 features: "+vfp3d16,-neon,+strict-align".into(),
2121 max_atomic_width: Some(64),
compiler/rustc_target/src/spec/targets/armv7a_nuttx_eabi.rs+2-2
......@@ -5,13 +5,13 @@
55// configuration without hardware floating point support.
66
77use crate::spec::{
8 Abi, Arch, Cc, FloatAbi, LinkerFlavor, Lld, Os, PanicStrategy, RelocModel, Target,
8 Arch, Cc, CfgAbi, FloatAbi, LinkerFlavor, Lld, Os, PanicStrategy, RelocModel, Target,
99 TargetMetadata, TargetOptions, cvs,
1010};
1111
1212pub(crate) fn target() -> Target {
1313 let opts = TargetOptions {
14 abi: Abi::Eabi,
14 cfg_abi: CfgAbi::Eabi,
1515 llvm_floatabi: Some(FloatAbi::Soft),
1616 linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
1717 linker: Some("rust-lld".into()),
compiler/rustc_target/src/spec/targets/armv7a_nuttx_eabihf.rs+2-2
......@@ -5,13 +5,13 @@
55// configuration with hardware floating point support.
66
77use crate::spec::{
8 Abi, Arch, Cc, FloatAbi, LinkerFlavor, Lld, Os, PanicStrategy, RelocModel, Target,
8 Arch, Cc, CfgAbi, FloatAbi, LinkerFlavor, Lld, Os, PanicStrategy, RelocModel, Target,
99 TargetMetadata, TargetOptions, cvs,
1010};
1111
1212pub(crate) fn target() -> Target {
1313 let opts = TargetOptions {
14 abi: Abi::EabiHf,
14 cfg_abi: CfgAbi::EabiHf,
1515 llvm_floatabi: Some(FloatAbi::Hard),
1616 linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
1717 linker: Some("rust-lld".into()),
compiler/rustc_target/src/spec/targets/armv7a_vex_v5.rs+2-2
......@@ -1,5 +1,5 @@
11use crate::spec::{
2 Abi, Arch, Cc, Env, FloatAbi, LinkerFlavor, Lld, Os, PanicStrategy, RelocModel, Target,
2 Arch, Cc, CfgAbi, Env, FloatAbi, LinkerFlavor, Lld, Os, PanicStrategy, RelocModel, Target,
33 TargetMetadata, TargetOptions,
44};
55
......@@ -11,7 +11,7 @@ pub(crate) fn target() -> Target {
1111 env: Env::V5,
1212 os: Os::VexOs,
1313 cpu: "cortex-a9".into(),
14 abi: Abi::EabiHf,
14 cfg_abi: CfgAbi::EabiHf,
1515 is_like_vexos: true,
1616 llvm_floatabi: Some(FloatAbi::Hard),
1717 linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
compiler/rustc_target/src/spec/targets/armv7r_none_eabi.rs+2-2
......@@ -1,6 +1,6 @@
11// Targets the Little-endian Cortex-R4/R5 processor (ARMv7-R)
22
3use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
3use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
44
55pub(crate) fn target() -> Target {
66 Target {
......@@ -15,7 +15,7 @@ pub(crate) fn target() -> Target {
1515 data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
1616 arch: Arch::Arm,
1717 options: TargetOptions {
18 abi: Abi::Eabi,
18 cfg_abi: CfgAbi::Eabi,
1919 llvm_floatabi: Some(FloatAbi::Soft),
2020 max_atomic_width: Some(64),
2121 has_thumb_interworking: true,
compiler/rustc_target/src/spec/targets/armv7r_none_eabihf.rs+2-2
......@@ -1,6 +1,6 @@
11// Targets the Little-endian Cortex-R4F/R5F processor (ARMv7-R)
22
3use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
3use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
44
55pub(crate) fn target() -> Target {
66 Target {
......@@ -15,7 +15,7 @@ pub(crate) fn target() -> Target {
1515 data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
1616 arch: Arch::Arm,
1717 options: TargetOptions {
18 abi: Abi::EabiHf,
18 cfg_abi: CfgAbi::EabiHf,
1919 llvm_floatabi: Some(FloatAbi::Hard),
2020 features: "+vfp3d16".into(),
2121 max_atomic_width: Some(64),
compiler/rustc_target/src/spec/targets/armv8r_none_eabihf.rs+2-2
......@@ -1,6 +1,6 @@
11// Targets the Little-endian Cortex-R52 processor (ARMv8-R)
22
3use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
3use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
44
55pub(crate) fn target() -> Target {
66 Target {
......@@ -16,7 +16,7 @@ pub(crate) fn target() -> Target {
1616 arch: Arch::Arm,
1717
1818 options: TargetOptions {
19 abi: Abi::EabiHf,
19 cfg_abi: CfgAbi::EabiHf,
2020 llvm_floatabi: Some(FloatAbi::Hard),
2121 // Armv8-R requires a minimum set of floating-point features equivalent to:
2222 // fp-armv8, SP-only, with 16 DP (32 SP) registers
compiler/rustc_target/src/spec/targets/csky_unknown_linux_gnuabiv2.rs+4-2
......@@ -1,4 +1,6 @@
1use crate::spec::{Abi, Arch, Cc, LinkerFlavor, Lld, Target, TargetMetadata, TargetOptions, base};
1use crate::spec::{
2 Arch, Cc, CfgAbi, LinkerFlavor, Lld, Target, TargetMetadata, TargetOptions, base,
3};
24
35// This target is for glibc Linux on Csky
46
......@@ -16,7 +18,7 @@ pub(crate) fn target() -> Target {
1618 data_layout: "e-m:e-S32-p:32:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:32:32-v128:32:32-a:0:32-Fi32-n32".into(),
1719 arch: Arch::CSky,
1820 options: TargetOptions {
19 abi: Abi::AbiV2,
21 cfg_abi: CfgAbi::AbiV2,
2022 features: "+2e3,+3e7,+7e10,+cache,+dsp1e2,+dspe60,+e1,+e2,+edsp,+elrw,+hard-tp,+high-registers,+hwdiv,+mp,+mp1e2,+nvic,+trust".into(),
2123 late_link_args: TargetOptions::link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-l:libatomic.a"]),
2224 max_atomic_width: Some(32),
compiler/rustc_target/src/spec/targets/csky_unknown_linux_gnuabiv2hf.rs+4-2
......@@ -1,4 +1,6 @@
1use crate::spec::{Abi, Arch, Cc, LinkerFlavor, Lld, Target, TargetMetadata, TargetOptions, base};
1use crate::spec::{
2 Arch, Cc, CfgAbi, LinkerFlavor, Lld, Target, TargetMetadata, TargetOptions, base,
3};
24
35// This target is for glibc Linux on Csky
46
......@@ -16,7 +18,7 @@ pub(crate) fn target() -> Target {
1618 data_layout: "e-m:e-S32-p:32:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:32:32-v128:32:32-a:0:32-Fi32-n32".into(),
1719 arch: Arch::CSky,
1820 options: TargetOptions {
19 abi: Abi::AbiV2Hf,
21 cfg_abi: CfgAbi::AbiV2Hf,
2022 cpu: "ck860fv".into(),
2123 features: "+hard-float,+hard-float-abi,+2e3,+3e7,+7e10,+cache,+dsp1e2,+dspe60,+e1,+e2,+edsp,+elrw,+hard-tp,+high-registers,+hwdiv,+mp,+mp1e2,+nvic,+trust".into(),
2224 late_link_args: TargetOptions::link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-l:libatomic.a", "-mhard-float"]),
compiler/rustc_target/src/spec/targets/loongarch32_unknown_none.rs+3-2
......@@ -1,5 +1,6 @@
11use crate::spec::{
2 Arch, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions,
2 Arch, Cc, LinkerFlavor, Lld, LlvmAbi, PanicStrategy, RelocModel, Target, TargetMetadata,
3 TargetOptions,
34};
45
56pub(crate) fn target() -> Target {
......@@ -19,7 +20,7 @@ pub(crate) fn target() -> Target {
1920 features: "+f,+d".into(),
2021 linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
2122 linker: Some("rust-lld".into()),
22 llvm_abiname: "ilp32d".into(),
23 llvm_abiname: LlvmAbi::Ilp32d,
2324 max_atomic_width: Some(32),
2425 relocation_model: RelocModel::Static,
2526 panic_strategy: PanicStrategy::Abort,
compiler/rustc_target/src/spec/targets/loongarch32_unknown_none_softfloat.rs+4-4
......@@ -1,6 +1,6 @@
11use crate::spec::{
2 Abi, Arch, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata,
3 TargetOptions,
2 Arch, Cc, CfgAbi, LinkerFlavor, Lld, LlvmAbi, PanicStrategy, RelocModel, Target,
3 TargetMetadata, TargetOptions,
44};
55
66pub(crate) fn target() -> Target {
......@@ -18,10 +18,10 @@ pub(crate) fn target() -> Target {
1818 options: TargetOptions {
1919 cpu: "generic".into(),
2020 features: "-f,-d".into(),
21 abi: Abi::SoftFloat,
21 cfg_abi: CfgAbi::SoftFloat,
2222 linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
2323 linker: Some("rust-lld".into()),
24 llvm_abiname: "ilp32s".into(),
24 llvm_abiname: LlvmAbi::Ilp32s,
2525 max_atomic_width: Some(32),
2626 relocation_model: RelocModel::Static,
2727 panic_strategy: PanicStrategy::Abort,
compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_gnu.rs+4-2
......@@ -1,4 +1,6 @@
1use crate::spec::{Arch, CodeModel, SanitizerSet, Target, TargetMetadata, TargetOptions, base};
1use crate::spec::{
2 Arch, CodeModel, LlvmAbi, SanitizerSet, Target, TargetMetadata, TargetOptions, base,
3};
24
35pub(crate) fn target() -> Target {
46 Target {
......@@ -16,7 +18,7 @@ pub(crate) fn target() -> Target {
1618 code_model: Some(CodeModel::Medium),
1719 cpu: "generic".into(),
1820 features: "+f,+d,+lsx,+relax".into(),
19 llvm_abiname: "lp64d".into(),
21 llvm_abiname: LlvmAbi::Lp64d,
2022 max_atomic_width: Some(64),
2123 supported_sanitizers: SanitizerSet::ADDRESS
2224 | SanitizerSet::CFI
compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_musl.rs+4-2
......@@ -1,4 +1,6 @@
1use crate::spec::{Arch, CodeModel, SanitizerSet, Target, TargetMetadata, TargetOptions, base};
1use crate::spec::{
2 Arch, CodeModel, LlvmAbi, SanitizerSet, Target, TargetMetadata, TargetOptions, base,
3};
24
35pub(crate) fn target() -> Target {
46 Target {
......@@ -16,7 +18,7 @@ pub(crate) fn target() -> Target {
1618 code_model: Some(CodeModel::Medium),
1719 cpu: "generic".into(),
1820 features: "+f,+d,+lsx,+relax".into(),
19 llvm_abiname: "lp64d".into(),
21 llvm_abiname: LlvmAbi::Lp64d,
2022 max_atomic_width: Some(64),
2123 crt_static_default: false,
2224 supported_sanitizers: SanitizerSet::ADDRESS
compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_ohos.rs+4-2
......@@ -1,4 +1,6 @@
1use crate::spec::{Arch, CodeModel, SanitizerSet, Target, TargetMetadata, TargetOptions, base};
1use crate::spec::{
2 Arch, CodeModel, LlvmAbi, SanitizerSet, Target, TargetMetadata, TargetOptions, base,
3};
24
35pub(crate) fn target() -> Target {
46 Target {
......@@ -16,7 +18,7 @@ pub(crate) fn target() -> Target {
1618 code_model: Some(CodeModel::Medium),
1719 cpu: "generic".into(),
1820 features: "+f,+d,+lsx,+relax".into(),
19 llvm_abiname: "lp64d".into(),
21 llvm_abiname: LlvmAbi::Lp64d,
2022 max_atomic_width: Some(64),
2123 supported_sanitizers: SanitizerSet::ADDRESS
2224 | SanitizerSet::CFI
compiler/rustc_target/src/spec/targets/loongarch64_unknown_none.rs+3-3
......@@ -1,6 +1,6 @@
11use crate::spec::{
2 Arch, Cc, CodeModel, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata,
3 TargetOptions,
2 Arch, Cc, CodeModel, LinkerFlavor, Lld, LlvmAbi, PanicStrategy, RelocModel, Target,
3 TargetMetadata, TargetOptions,
44};
55
66pub(crate) fn target() -> Target {
......@@ -20,7 +20,7 @@ pub(crate) fn target() -> Target {
2020 features: "+f,+d,-lsx".into(),
2121 linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
2222 linker: Some("rust-lld".into()),
23 llvm_abiname: "lp64d".into(),
23 llvm_abiname: LlvmAbi::Lp64d,
2424 max_atomic_width: Some(64),
2525 relocation_model: RelocModel::Static,
2626 panic_strategy: PanicStrategy::Abort,
compiler/rustc_target/src/spec/targets/loongarch64_unknown_none_softfloat.rs+4-4
......@@ -1,6 +1,6 @@
11use crate::spec::{
2 Abi, Arch, Cc, CodeModel, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata,
3 TargetOptions,
2 Arch, Cc, CfgAbi, CodeModel, LinkerFlavor, Lld, LlvmAbi, PanicStrategy, RelocModel, Target,
3 TargetMetadata, TargetOptions,
44};
55
66pub(crate) fn target() -> Target {
......@@ -18,10 +18,10 @@ pub(crate) fn target() -> Target {
1818 options: TargetOptions {
1919 cpu: "generic".into(),
2020 features: "-f,-d".into(),
21 abi: Abi::SoftFloat,
21 cfg_abi: CfgAbi::SoftFloat,
2222 linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
2323 linker: Some("rust-lld".into()),
24 llvm_abiname: "lp64s".into(),
24 llvm_abiname: LlvmAbi::Lp64s,
2525 max_atomic_width: Some(64),
2626 relocation_model: RelocModel::Static,
2727 panic_strategy: PanicStrategy::Abort,
compiler/rustc_target/src/spec/targets/mips64_openwrt_linux_musl.rs+3-3
......@@ -2,7 +2,7 @@
22
33use rustc_abi::Endian;
44
5use crate::spec::{Abi, Arch, Target, TargetMetadata, TargetOptions, base};
5use crate::spec::{Arch, CfgAbi, LlvmAbi, Target, TargetMetadata, TargetOptions, base};
66
77pub(crate) fn target() -> Target {
88 let mut base = base::linux_musl::opts();
......@@ -24,10 +24,10 @@ pub(crate) fn target() -> Target {
2424 arch: Arch::Mips64,
2525 options: TargetOptions {
2626 vendor: "openwrt".into(),
27 abi: Abi::Abi64,
27 cfg_abi: CfgAbi::Abi64,
2828 endian: Endian::Big,
2929 mcount: "_mcount".into(),
30 llvm_abiname: "n64".into(),
30 llvm_abiname: LlvmAbi::N64,
3131 ..base
3232 },
3333 }
compiler/rustc_target/src/spec/targets/mips64_unknown_linux_gnuabi64.rs+3-3
......@@ -1,6 +1,6 @@
11use rustc_abi::Endian;
22
3use crate::spec::{Abi, Arch, Target, TargetMetadata, TargetOptions, base};
3use crate::spec::{Arch, CfgAbi, LlvmAbi, Target, TargetMetadata, TargetOptions, base};
44
55pub(crate) fn target() -> Target {
66 Target {
......@@ -15,14 +15,14 @@ pub(crate) fn target() -> Target {
1515 data_layout: "E-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
1616 arch: Arch::Mips64,
1717 options: TargetOptions {
18 abi: Abi::Abi64,
18 cfg_abi: CfgAbi::Abi64,
1919 endian: Endian::Big,
2020 // NOTE(mips64r2) matches C toolchain
2121 cpu: "mips64r2".into(),
2222 features: "+mips64r2,+xgot".into(),
2323 max_atomic_width: Some(64),
2424 mcount: "_mcount".into(),
25 llvm_abiname: "n64".into(),
25 llvm_abiname: LlvmAbi::N64,
2626
2727 ..base::linux_gnu::opts()
2828 },
compiler/rustc_target/src/spec/targets/mips64_unknown_linux_muslabi64.rs+3-3
......@@ -1,6 +1,6 @@
11use rustc_abi::Endian;
22
3use crate::spec::{Abi, Arch, Target, TargetMetadata, TargetOptions, base};
3use crate::spec::{Arch, CfgAbi, LlvmAbi, Target, TargetMetadata, TargetOptions, base};
44
55pub(crate) fn target() -> Target {
66 let mut base = base::linux_musl::opts();
......@@ -20,10 +20,10 @@ pub(crate) fn target() -> Target {
2020 data_layout: "E-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
2121 arch: Arch::Mips64,
2222 options: TargetOptions {
23 abi: Abi::Abi64,
23 cfg_abi: CfgAbi::Abi64,
2424 endian: Endian::Big,
2525 mcount: "_mcount".into(),
26 llvm_abiname: "n64".into(),
26 llvm_abiname: LlvmAbi::N64,
2727 ..base
2828 },
2929 }
compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_gnuabi64.rs+3-3
......@@ -1,4 +1,4 @@
1use crate::spec::{Abi, Arch, Target, TargetMetadata, TargetOptions, base};
1use crate::spec::{Arch, CfgAbi, LlvmAbi, Target, TargetMetadata, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
......@@ -13,13 +13,13 @@ pub(crate) fn target() -> Target {
1313 data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
1414 arch: Arch::Mips64,
1515 options: TargetOptions {
16 abi: Abi::Abi64,
16 cfg_abi: CfgAbi::Abi64,
1717 // NOTE(mips64r2) matches C toolchain
1818 cpu: "mips64r2".into(),
1919 features: "+mips64r2,+xgot".into(),
2020 max_atomic_width: Some(64),
2121 mcount: "_mcount".into(),
22 llvm_abiname: "n64".into(),
22 llvm_abiname: LlvmAbi::N64,
2323
2424 ..base::linux_gnu::opts()
2525 },
compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_muslabi64.rs+3-3
......@@ -1,4 +1,4 @@
1use crate::spec::{Abi, Arch, Target, TargetMetadata, TargetOptions, base};
1use crate::spec::{Arch, CfgAbi, LlvmAbi, Target, TargetMetadata, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::linux_musl::opts();
......@@ -18,9 +18,9 @@ pub(crate) fn target() -> Target {
1818 data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
1919 arch: Arch::Mips64,
2020 options: TargetOptions {
21 abi: Abi::Abi64,
21 cfg_abi: CfgAbi::Abi64,
2222 mcount: "_mcount".into(),
23 llvm_abiname: "n64".into(),
23 llvm_abiname: LlvmAbi::N64,
2424 ..base
2525 },
2626 }
compiler/rustc_target/src/spec/targets/mips_mti_none_elf.rs+3-2
......@@ -1,7 +1,8 @@
11use rustc_abi::Endian;
22
33use crate::spec::{
4 Arch, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions,
4 Arch, Cc, LinkerFlavor, Lld, LlvmAbi, PanicStrategy, RelocModel, Target, TargetMetadata,
5 TargetOptions,
56};
67
78pub(crate) fn target() -> Target {
......@@ -24,7 +25,7 @@ pub(crate) fn target() -> Target {
2425 endian: Endian::Big,
2526 cpu: "mips32r2".into(),
2627
27 llvm_abiname: "o32".into(),
28 llvm_abiname: LlvmAbi::O32,
2829 max_atomic_width: Some(32),
2930
3031 features: "+mips32r2,+soft-float,+noabicalls".into(),
compiler/rustc_target/src/spec/targets/mips_unknown_linux_gnu.rs+2-2
......@@ -1,6 +1,6 @@
11use rustc_abi::Endian;
22
3use crate::spec::{Arch, Target, TargetMetadata, TargetOptions, base};
3use crate::spec::{Arch, LlvmAbi, Target, TargetMetadata, TargetOptions, base};
44
55pub(crate) fn target() -> Target {
66 Target {
......@@ -18,7 +18,7 @@ pub(crate) fn target() -> Target {
1818 endian: Endian::Big,
1919 cpu: "mips32r2".into(),
2020 features: "+mips32r2,+fpxx,+nooddspreg".into(),
21 llvm_abiname: "o32".into(),
21 llvm_abiname: LlvmAbi::O32,
2222 max_atomic_width: Some(32),
2323 mcount: "_mcount".into(),
2424
compiler/rustc_target/src/spec/targets/mips_unknown_linux_musl.rs+2-2
......@@ -1,6 +1,6 @@
11use rustc_abi::Endian;
22
3use crate::spec::{Arch, Target, TargetMetadata, TargetOptions, base};
3use crate::spec::{Arch, LlvmAbi, Target, TargetMetadata, TargetOptions, base};
44
55pub(crate) fn target() -> Target {
66 let mut base = base::linux_musl::opts();
......@@ -20,7 +20,7 @@ pub(crate) fn target() -> Target {
2020 arch: Arch::Mips,
2121 options: TargetOptions {
2222 endian: Endian::Big,
23 llvm_abiname: "o32".into(),
23 llvm_abiname: LlvmAbi::O32,
2424 mcount: "_mcount".into(),
2525 ..base
2626 },
compiler/rustc_target/src/spec/targets/mips_unknown_linux_uclibc.rs+2-2
......@@ -1,6 +1,6 @@
11use rustc_abi::Endian;
22
3use crate::spec::{Arch, Target, TargetMetadata, TargetOptions, base};
3use crate::spec::{Arch, LlvmAbi, Target, TargetMetadata, TargetOptions, base};
44
55pub(crate) fn target() -> Target {
66 Target {
......@@ -18,7 +18,7 @@ pub(crate) fn target() -> Target {
1818 endian: Endian::Big,
1919 cpu: "mips32r2".into(),
2020 features: "+mips32r2,+soft-float".into(),
21 llvm_abiname: "o32".into(),
21 llvm_abiname: LlvmAbi::O32,
2222 max_atomic_width: Some(32),
2323 mcount: "_mcount".into(),
2424
compiler/rustc_target/src/spec/targets/mipsel_mti_none_elf.rs+3-2
......@@ -1,7 +1,8 @@
11use rustc_abi::Endian;
22
33use crate::spec::{
4 Arch, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions,
4 Arch, Cc, LinkerFlavor, Lld, LlvmAbi, PanicStrategy, RelocModel, Target, TargetMetadata,
5 TargetOptions,
56};
67
78pub(crate) fn target() -> Target {
......@@ -24,7 +25,7 @@ pub(crate) fn target() -> Target {
2425 endian: Endian::Little,
2526 cpu: "mips32r2".into(),
2627
27 llvm_abiname: "o32".into(),
28 llvm_abiname: LlvmAbi::O32,
2829 max_atomic_width: Some(32),
2930
3031 features: "+mips32r2,+soft-float,+noabicalls".into(),
compiler/rustc_target/src/spec/targets/mipsel_sony_psp.rs+3-2
......@@ -1,5 +1,6 @@
11use crate::spec::{
2 Arch, Cc, LinkerFlavor, Lld, Os, RelocModel, Target, TargetMetadata, TargetOptions, cvs,
2 Arch, Cc, LinkerFlavor, Lld, LlvmAbi, Os, RelocModel, Target, TargetMetadata, TargetOptions,
3 cvs,
34};
45
56// The PSP has custom linker requirements.
......@@ -36,7 +37,7 @@ pub(crate) fn target() -> Target {
3637
3738 // PSP does not support trap-on-condition instructions.
3839 llvm_args: cvs!["-mno-check-zero-division"],
39 llvm_abiname: "o32".into(),
40 llvm_abiname: LlvmAbi::O32,
4041 pre_link_args,
4142 link_script: Some(LINKER_SCRIPT.into()),
4243 ..Default::default()
compiler/rustc_target/src/spec/targets/mipsel_sony_psx.rs+2-2
......@@ -1,5 +1,5 @@
11use crate::spec::{
2 Arch, Cc, LinkerFlavor, Lld, Os, PanicStrategy, RelocModel, Target, TargetMetadata,
2 Arch, Cc, LinkerFlavor, Lld, LlvmAbi, Os, PanicStrategy, RelocModel, Target, TargetMetadata,
33 TargetOptions, cvs,
44};
55
......@@ -41,7 +41,7 @@ pub(crate) fn target() -> Target {
4141
4242 // PSX does not support trap-on-condition instructions.
4343 llvm_args: cvs!["-mno-check-zero-division"],
44 llvm_abiname: "o32".into(),
44 llvm_abiname: LlvmAbi::O32,
4545 panic_strategy: PanicStrategy::Abort,
4646 ..Default::default()
4747 },
compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_gnu.rs+2-2
......@@ -1,4 +1,4 @@
1use crate::spec::{Arch, Target, TargetMetadata, TargetOptions, base};
1use crate::spec::{Arch, LlvmAbi, Target, TargetMetadata, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
......@@ -16,7 +16,7 @@ pub(crate) fn target() -> Target {
1616 options: TargetOptions {
1717 cpu: "mips32r2".into(),
1818 features: "+mips32r2,+fpxx,+nooddspreg".into(),
19 llvm_abiname: "o32".into(),
19 llvm_abiname: LlvmAbi::O32,
2020 max_atomic_width: Some(32),
2121 mcount: "_mcount".into(),
2222
compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_musl.rs+2-2
......@@ -1,4 +1,4 @@
1use crate::spec::{Arch, Target, TargetMetadata, TargetOptions, base};
1use crate::spec::{Arch, LlvmAbi, Target, TargetMetadata, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::linux_musl::opts();
......@@ -16,6 +16,6 @@ pub(crate) fn target() -> Target {
1616 pointer_width: 32,
1717 data_layout: "e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".into(),
1818 arch: Arch::Mips,
19 options: TargetOptions { llvm_abiname: "o32".into(), mcount: "_mcount".into(), ..base },
19 options: TargetOptions { llvm_abiname: LlvmAbi::O32, mcount: "_mcount".into(), ..base },
2020 }
2121}
compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_uclibc.rs+2-2
......@@ -1,4 +1,4 @@
1use crate::spec::{Arch, Target, TargetMetadata, TargetOptions, base};
1use crate::spec::{Arch, LlvmAbi, Target, TargetMetadata, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
......@@ -16,7 +16,7 @@ pub(crate) fn target() -> Target {
1616 options: TargetOptions {
1717 cpu: "mips32r2".into(),
1818 features: "+mips32r2,+soft-float".into(),
19 llvm_abiname: "o32".into(),
19 llvm_abiname: LlvmAbi::O32,
2020 max_atomic_width: Some(32),
2121 mcount: "_mcount".into(),
2222
compiler/rustc_target/src/spec/targets/mipsel_unknown_netbsd.rs+2-2
......@@ -1,6 +1,6 @@
11use rustc_abi::Endian;
22
3use crate::spec::{Arch, Target, TargetMetadata, TargetOptions, base};
3use crate::spec::{Arch, LlvmAbi, Target, TargetMetadata, TargetOptions, base};
44
55pub(crate) fn target() -> Target {
66 let mut base = base::netbsd::opts();
......@@ -20,7 +20,7 @@ pub(crate) fn target() -> Target {
2020 arch: Arch::Mips,
2121 options: TargetOptions {
2222 features: "+soft-float".into(),
23 llvm_abiname: "o32".into(),
23 llvm_abiname: LlvmAbi::O32,
2424 mcount: "__mcount".into(),
2525 endian: Endian::Little,
2626 ..base
compiler/rustc_target/src/spec/targets/mipsel_unknown_none.rs+3-2
......@@ -3,7 +3,8 @@
33//! Can be used for MIPS M4K core (e.g. on PIC32MX devices)
44
55use crate::spec::{
6 Arch, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions,
6 Arch, Cc, LinkerFlavor, Lld, LlvmAbi, PanicStrategy, RelocModel, Target, TargetMetadata,
7 TargetOptions,
78};
89
910pub(crate) fn target() -> Target {
......@@ -23,7 +24,7 @@ pub(crate) fn target() -> Target {
2324 linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
2425 cpu: "mips32r2".into(),
2526 features: "+mips32r2,+soft-float,+noabicalls".into(),
26 llvm_abiname: "o32".into(),
27 llvm_abiname: LlvmAbi::O32,
2728 max_atomic_width: Some(32),
2829 linker: Some("rust-lld".into()),
2930 panic_strategy: PanicStrategy::Abort,
compiler/rustc_target/src/spec/targets/mipsisa32r6_unknown_linux_gnu.rs+2-2
......@@ -1,6 +1,6 @@
11use rustc_abi::Endian;
22
3use crate::spec::{Arch, Target, TargetMetadata, TargetOptions, base};
3use crate::spec::{Arch, LlvmAbi, Target, TargetMetadata, TargetOptions, base};
44
55pub(crate) fn target() -> Target {
66 Target {
......@@ -18,7 +18,7 @@ pub(crate) fn target() -> Target {
1818 endian: Endian::Big,
1919 cpu: "mips32r6".into(),
2020 features: "+mips32r6".into(),
21 llvm_abiname: "o32".into(),
21 llvm_abiname: LlvmAbi::O32,
2222 max_atomic_width: Some(32),
2323 mcount: "_mcount".into(),
2424
compiler/rustc_target/src/spec/targets/mipsisa32r6el_unknown_linux_gnu.rs+2-2
......@@ -1,4 +1,4 @@
1use crate::spec::{Arch, Target, TargetMetadata, TargetOptions, base};
1use crate::spec::{Arch, LlvmAbi, Target, TargetMetadata, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
......@@ -16,7 +16,7 @@ pub(crate) fn target() -> Target {
1616 options: TargetOptions {
1717 cpu: "mips32r6".into(),
1818 features: "+mips32r6".into(),
19 llvm_abiname: "o32".into(),
19 llvm_abiname: LlvmAbi::O32,
2020 max_atomic_width: Some(32),
2121 mcount: "_mcount".into(),
2222
compiler/rustc_target/src/spec/targets/mipsisa64r6_unknown_linux_gnuabi64.rs+3-3
......@@ -1,6 +1,6 @@
11use rustc_abi::Endian;
22
3use crate::spec::{Abi, Arch, Target, TargetMetadata, TargetOptions, base};
3use crate::spec::{Arch, CfgAbi, LlvmAbi, Target, TargetMetadata, TargetOptions, base};
44
55pub(crate) fn target() -> Target {
66 Target {
......@@ -15,14 +15,14 @@ pub(crate) fn target() -> Target {
1515 data_layout: "E-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
1616 arch: Arch::Mips64r6,
1717 options: TargetOptions {
18 abi: Abi::Abi64,
18 cfg_abi: CfgAbi::Abi64,
1919 endian: Endian::Big,
2020 // NOTE(mips64r6) matches C toolchain
2121 cpu: "mips64r6".into(),
2222 features: "+mips64r6".into(),
2323 max_atomic_width: Some(64),
2424 mcount: "_mcount".into(),
25 llvm_abiname: "n64".into(),
25 llvm_abiname: LlvmAbi::N64,
2626
2727 ..base::linux_gnu::opts()
2828 },
compiler/rustc_target/src/spec/targets/mipsisa64r6el_unknown_linux_gnuabi64.rs+3-3
......@@ -1,4 +1,4 @@
1use crate::spec::{Abi, Arch, Target, TargetMetadata, TargetOptions, base};
1use crate::spec::{Arch, CfgAbi, LlvmAbi, Target, TargetMetadata, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
......@@ -13,13 +13,13 @@ pub(crate) fn target() -> Target {
1313 data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
1414 arch: Arch::Mips64r6,
1515 options: TargetOptions {
16 abi: Abi::Abi64,
16 cfg_abi: CfgAbi::Abi64,
1717 // NOTE(mips64r6) matches C toolchain
1818 cpu: "mips64r6".into(),
1919 features: "+mips64r6".into(),
2020 max_atomic_width: Some(64),
2121 mcount: "_mcount".into(),
22 llvm_abiname: "n64".into(),
22 llvm_abiname: LlvmAbi::N64,
2323
2424 ..base::linux_gnu::opts()
2525 },
compiler/rustc_target/src/spec/targets/powerpc64_unknown_freebsd.rs+4-3
......@@ -1,7 +1,8 @@
11use rustc_abi::Endian;
22
33use crate::spec::{
4 Abi, Arch, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetMetadata, TargetOptions, base,
4 Arch, Cc, CfgAbi, LinkerFlavor, Lld, LlvmAbi, StackProbeType, Target, TargetMetadata,
5 TargetOptions, base,
56};
67
78pub(crate) fn target() -> Target {
......@@ -10,8 +11,8 @@ pub(crate) fn target() -> Target {
1011 base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
1112 base.max_atomic_width = Some(64);
1213 base.stack_probes = StackProbeType::Inline;
13 base.abi = Abi::ElfV2;
14 base.llvm_abiname = "elfv2".into();
14 base.cfg_abi = CfgAbi::ElfV2;
15 base.llvm_abiname = LlvmAbi::ElfV2;
1516
1617 Target {
1718 llvm_target: "powerpc64-unknown-freebsd".into(),
compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_gnu.rs+4-3
......@@ -1,7 +1,8 @@
11use rustc_abi::Endian;
22
33use crate::spec::{
4 Abi, Arch, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetMetadata, TargetOptions, base,
4 Arch, Cc, CfgAbi, LinkerFlavor, Lld, LlvmAbi, StackProbeType, Target, TargetMetadata,
5 TargetOptions, base,
56};
67
78pub(crate) fn target() -> Target {
......@@ -10,8 +11,8 @@ pub(crate) fn target() -> Target {
1011 base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
1112 base.max_atomic_width = Some(64);
1213 base.stack_probes = StackProbeType::Inline;
13 base.abi = Abi::ElfV1;
14 base.llvm_abiname = "elfv1".into();
14 base.cfg_abi = CfgAbi::ElfV1;
15 base.llvm_abiname = LlvmAbi::ElfV1;
1516
1617 Target {
1718 llvm_target: "powerpc64-unknown-linux-gnu".into(),
compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_musl.rs+4-3
......@@ -1,7 +1,8 @@
11use rustc_abi::Endian;
22
33use crate::spec::{
4 Abi, Arch, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetMetadata, TargetOptions, base,
4 Arch, Cc, CfgAbi, LinkerFlavor, Lld, LlvmAbi, StackProbeType, Target, TargetMetadata,
5 TargetOptions, base,
56};
67
78pub(crate) fn target() -> Target {
......@@ -10,8 +11,8 @@ pub(crate) fn target() -> Target {
1011 base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
1112 base.max_atomic_width = Some(64);
1213 base.stack_probes = StackProbeType::Inline;
13 base.abi = Abi::ElfV2;
14 base.llvm_abiname = "elfv2".into();
14 base.cfg_abi = CfgAbi::ElfV2;
15 base.llvm_abiname = LlvmAbi::ElfV2;
1516
1617 Target {
1718 llvm_target: "powerpc64-unknown-linux-musl".into(),
compiler/rustc_target/src/spec/targets/powerpc64_unknown_openbsd.rs+4-3
......@@ -1,7 +1,8 @@
11use rustc_abi::Endian;
22
33use crate::spec::{
4 Abi, Arch, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetMetadata, TargetOptions, base,
4 Arch, Cc, CfgAbi, LinkerFlavor, Lld, LlvmAbi, StackProbeType, Target, TargetMetadata,
5 TargetOptions, base,
56};
67
78pub(crate) fn target() -> Target {
......@@ -10,8 +11,8 @@ pub(crate) fn target() -> Target {
1011 base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
1112 base.max_atomic_width = Some(64);
1213 base.stack_probes = StackProbeType::Inline;
13 base.abi = Abi::ElfV2;
14 base.llvm_abiname = "elfv2".into();
14 base.cfg_abi = CfgAbi::ElfV2;
15 base.llvm_abiname = LlvmAbi::ElfV2;
1516
1617 Target {
1718 llvm_target: "powerpc64-unknown-openbsd".into(),
compiler/rustc_target/src/spec/targets/powerpc64_wrs_vxworks.rs+4-3
......@@ -1,7 +1,8 @@
11use rustc_abi::Endian;
22
33use crate::spec::{
4 Abi, Arch, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetMetadata, TargetOptions, base,
4 Arch, Cc, CfgAbi, LinkerFlavor, Lld, LlvmAbi, StackProbeType, Target, TargetMetadata,
5 TargetOptions, base,
56};
67
78pub(crate) fn target() -> Target {
......@@ -10,8 +11,8 @@ pub(crate) fn target() -> Target {
1011 base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
1112 base.max_atomic_width = Some(64);
1213 base.stack_probes = StackProbeType::Inline;
13 base.abi = Abi::ElfV1;
14 base.llvm_abiname = "elfv1".into();
14 base.cfg_abi = CfgAbi::ElfV1;
15 base.llvm_abiname = LlvmAbi::ElfV1;
1516
1617 Target {
1718 llvm_target: "powerpc64-unknown-linux-gnu".into(),
compiler/rustc_target/src/spec/targets/powerpc64le_unknown_freebsd.rs+4-3
......@@ -1,5 +1,6 @@
11use crate::spec::{
2 Abi, Arch, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetMetadata, TargetOptions, base,
2 Arch, Cc, CfgAbi, LinkerFlavor, Lld, LlvmAbi, StackProbeType, Target, TargetMetadata,
3 TargetOptions, base,
34};
45
56pub(crate) fn target() -> Target {
......@@ -8,8 +9,8 @@ pub(crate) fn target() -> Target {
89 base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
910 base.max_atomic_width = Some(64);
1011 base.stack_probes = StackProbeType::Inline;
11 base.abi = Abi::ElfV2;
12 base.llvm_abiname = "elfv2".into();
12 base.cfg_abi = CfgAbi::ElfV2;
13 base.llvm_abiname = LlvmAbi::ElfV2;
1314
1415 Target {
1516 llvm_target: "powerpc64le-unknown-freebsd".into(),
compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_gnu.rs+4-3
......@@ -1,5 +1,6 @@
11use crate::spec::{
2 Abi, Arch, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetMetadata, TargetOptions, base,
2 Arch, Cc, CfgAbi, LinkerFlavor, Lld, LlvmAbi, StackProbeType, Target, TargetMetadata,
3 TargetOptions, base,
34};
45
56pub(crate) fn target() -> Target {
......@@ -8,8 +9,8 @@ pub(crate) fn target() -> Target {
89 base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
910 base.max_atomic_width = Some(64);
1011 base.stack_probes = StackProbeType::Inline;
11 base.abi = Abi::ElfV2;
12 base.llvm_abiname = "elfv2".into();
12 base.cfg_abi = CfgAbi::ElfV2;
13 base.llvm_abiname = LlvmAbi::ElfV2;
1314
1415 Target {
1516 llvm_target: "powerpc64le-unknown-linux-gnu".into(),
compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_musl.rs+4-3
......@@ -1,5 +1,6 @@
11use crate::spec::{
2 Abi, Arch, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetMetadata, TargetOptions, base,
2 Arch, Cc, CfgAbi, LinkerFlavor, Lld, LlvmAbi, StackProbeType, Target, TargetMetadata,
3 TargetOptions, base,
34};
45
56pub(crate) fn target() -> Target {
......@@ -10,8 +11,8 @@ pub(crate) fn target() -> Target {
1011 base.stack_probes = StackProbeType::Inline;
1112 // FIXME(compiler-team#422): musl targets should be dynamically linked by default.
1213 base.crt_static_default = true;
13 base.abi = Abi::ElfV2;
14 base.llvm_abiname = "elfv2".into();
14 base.cfg_abi = CfgAbi::ElfV2;
15 base.llvm_abiname = LlvmAbi::ElfV2;
1516
1617 Target {
1718 llvm_target: "powerpc64le-unknown-linux-musl".into(),
compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_gnuspe.rs+3-2
......@@ -1,7 +1,8 @@
11use rustc_abi::Endian;
22
33use crate::spec::{
4 Abi, Arch, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetMetadata, TargetOptions, base,
4 Arch, Cc, CfgAbi, LinkerFlavor, Lld, StackProbeType, Target, TargetMetadata, TargetOptions,
5 base,
56};
67
78pub(crate) fn target() -> Target {
......@@ -22,7 +23,7 @@ pub(crate) fn target() -> Target {
2223 data_layout: "E-m:e-p:32:32-Fn32-i64:64-n32".into(),
2324 arch: Arch::PowerPC,
2425 options: TargetOptions {
25 abi: Abi::Spe,
26 cfg_abi: CfgAbi::Spe,
2627 endian: Endian::Big,
2728 features: "+secure-plt,+msync".into(),
2829 mcount: "_mcount".into(),
compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_muslspe.rs+3-2
......@@ -1,7 +1,8 @@
11use rustc_abi::Endian;
22
33use crate::spec::{
4 Abi, Arch, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetMetadata, TargetOptions, base,
4 Arch, Cc, CfgAbi, LinkerFlavor, Lld, StackProbeType, Target, TargetMetadata, TargetOptions,
5 base,
56};
67
78pub(crate) fn target() -> Target {
......@@ -22,7 +23,7 @@ pub(crate) fn target() -> Target {
2223 data_layout: "E-m:e-p:32:32-Fn32-i64:64-n32".into(),
2324 arch: Arch::PowerPC,
2425 options: TargetOptions {
25 abi: Abi::Spe,
26 cfg_abi: CfgAbi::Spe,
2627 endian: Endian::Big,
2728 features: "+msync".into(),
2829 mcount: "_mcount".into(),
compiler/rustc_target/src/spec/targets/powerpc_wrs_vxworks_spe.rs+3-2
......@@ -1,7 +1,8 @@
11use rustc_abi::Endian;
22
33use crate::spec::{
4 Abi, Arch, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetMetadata, TargetOptions, base,
4 Arch, Cc, CfgAbi, LinkerFlavor, Lld, StackProbeType, Target, TargetMetadata, TargetOptions,
5 base,
56};
67
78pub(crate) fn target() -> Target {
......@@ -22,7 +23,7 @@ pub(crate) fn target() -> Target {
2223 data_layout: "E-m:e-p:32:32-Fn32-i64:64-n32".into(),
2324 arch: Arch::PowerPC,
2425 options: TargetOptions {
25 abi: Abi::Spe,
26 cfg_abi: CfgAbi::Spe,
2627 endian: Endian::Big,
2728 // feature msync would disable instruction 'fsync' which is not supported by fsl_p1p2
2829 features: "+secure-plt,+msync".into(),
compiler/rustc_target/src/spec/targets/riscv32_wrs_vxworks.rs+2-2
......@@ -1,4 +1,4 @@
1use crate::spec::{Arch, StackProbeType, Target, TargetMetadata, TargetOptions, base};
1use crate::spec::{Arch, LlvmAbi, StackProbeType, Target, TargetMetadata, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
......@@ -14,7 +14,7 @@ pub(crate) fn target() -> Target {
1414 arch: Arch::RiscV32,
1515 options: TargetOptions {
1616 cpu: "generic-rv32".into(),
17 llvm_abiname: "ilp32d".into(),
17 llvm_abiname: LlvmAbi::Ilp32d,
1818 max_atomic_width: Some(32),
1919 features: "+m,+a,+f,+d,+c,+zicsr,+zifencei".into(),
2020 stack_probes: StackProbeType::Inline,
compiler/rustc_target/src/spec/targets/riscv32e_unknown_none_elf.rs+4-4
......@@ -1,6 +1,6 @@
11use crate::spec::{
2 Abi, Arch, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata,
3 TargetOptions,
2 Arch, Cc, CfgAbi, LinkerFlavor, Lld, LlvmAbi, PanicStrategy, RelocModel, Target,
3 TargetMetadata, TargetOptions,
44};
55
66pub(crate) fn target() -> Target {
......@@ -19,12 +19,12 @@ pub(crate) fn target() -> Target {
1919 arch: Arch::RiscV32,
2020
2121 options: TargetOptions {
22 abi: Abi::Ilp32e,
22 cfg_abi: CfgAbi::Ilp32e,
2323 linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
2424 linker: Some("rust-lld".into()),
2525 cpu: "generic-rv32".into(),
2626 // The ilp32e ABI specifies the `data_layout`
27 llvm_abiname: "ilp32e".into(),
27 llvm_abiname: LlvmAbi::Ilp32e,
2828 max_atomic_width: Some(32),
2929 atomic_cas: false,
3030 features: "+e,+forced-atomics".into(),
compiler/rustc_target/src/spec/targets/riscv32em_unknown_none_elf.rs+4-4
......@@ -1,6 +1,6 @@
11use crate::spec::{
2 Abi, Arch, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata,
3 TargetOptions,
2 Arch, Cc, CfgAbi, LinkerFlavor, Lld, LlvmAbi, PanicStrategy, RelocModel, Target,
3 TargetMetadata, TargetOptions,
44};
55
66pub(crate) fn target() -> Target {
......@@ -19,12 +19,12 @@ pub(crate) fn target() -> Target {
1919 arch: Arch::RiscV32,
2020
2121 options: TargetOptions {
22 abi: Abi::Ilp32e,
22 cfg_abi: CfgAbi::Ilp32e,
2323 linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
2424 linker: Some("rust-lld".into()),
2525 cpu: "generic-rv32".into(),
2626 // The ilp32e ABI specifies the `data_layout`
27 llvm_abiname: "ilp32e".into(),
27 llvm_abiname: LlvmAbi::Ilp32e,
2828 max_atomic_width: Some(32),
2929 atomic_cas: false,
3030 features: "+e,+m,+forced-atomics".into(),
compiler/rustc_target/src/spec/targets/riscv32emc_unknown_none_elf.rs+4-4
......@@ -1,6 +1,6 @@
11use crate::spec::{
2 Abi, Arch, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata,
3 TargetOptions,
2 Arch, Cc, CfgAbi, LinkerFlavor, Lld, LlvmAbi, PanicStrategy, RelocModel, Target,
3 TargetMetadata, TargetOptions,
44};
55
66pub(crate) fn target() -> Target {
......@@ -19,12 +19,12 @@ pub(crate) fn target() -> Target {
1919 arch: Arch::RiscV32,
2020
2121 options: TargetOptions {
22 abi: Abi::Ilp32e,
22 cfg_abi: CfgAbi::Ilp32e,
2323 linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
2424 linker: Some("rust-lld".into()),
2525 cpu: "generic-rv32".into(),
2626 // The ilp32e ABI specifies the `data_layout`
27 llvm_abiname: "ilp32e".into(),
27 llvm_abiname: LlvmAbi::Ilp32e,
2828 max_atomic_width: Some(32),
2929 atomic_cas: false,
3030 features: "+e,+m,+c,+forced-atomics".into(),
compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_gnu.rs+4-2
......@@ -1,6 +1,8 @@
11use std::borrow::Cow;
22
3use crate::spec::{Arch, CodeModel, SplitDebuginfo, Target, TargetMetadata, TargetOptions, base};
3use crate::spec::{
4 Arch, CodeModel, LlvmAbi, SplitDebuginfo, Target, TargetMetadata, TargetOptions, base,
5};
46
57pub(crate) fn target() -> Target {
68 Target {
......@@ -18,7 +20,7 @@ pub(crate) fn target() -> Target {
1820 code_model: Some(CodeModel::Medium),
1921 cpu: "generic-rv32".into(),
2022 features: "+m,+a,+f,+d,+c,+zicsr,+zifencei".into(),
21 llvm_abiname: "ilp32d".into(),
23 llvm_abiname: LlvmAbi::Ilp32d,
2224 max_atomic_width: Some(32),
2325 supported_split_debuginfo: Cow::Borrowed(&[SplitDebuginfo::Off]),
2426 ..base::linux_gnu::opts()
compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_musl.rs+4-2
......@@ -1,6 +1,8 @@
11use std::borrow::Cow;
22
3use crate::spec::{Arch, CodeModel, SplitDebuginfo, Target, TargetMetadata, TargetOptions, base};
3use crate::spec::{
4 Arch, CodeModel, LlvmAbi, SplitDebuginfo, Target, TargetMetadata, TargetOptions, base,
5};
46
57pub(crate) fn target() -> Target {
68 Target {
......@@ -18,7 +20,7 @@ pub(crate) fn target() -> Target {
1820 code_model: Some(CodeModel::Medium),
1921 cpu: "generic-rv32".into(),
2022 features: "+m,+a,+f,+d,+c,+zicsr,+zifencei".into(),
21 llvm_abiname: "ilp32d".into(),
23 llvm_abiname: LlvmAbi::Ilp32d,
2224 max_atomic_width: Some(32),
2325 supported_split_debuginfo: Cow::Borrowed(&[SplitDebuginfo::Off]),
2426 ..base::linux_musl::opts()
compiler/rustc_target/src/spec/targets/riscv32i_unknown_none_elf.rs+3-2
......@@ -1,5 +1,6 @@
11use crate::spec::{
2 Arch, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions,
2 Arch, Cc, LinkerFlavor, Lld, LlvmAbi, PanicStrategy, RelocModel, Target, TargetMetadata,
3 TargetOptions,
34};
45
56pub(crate) fn target() -> Target {
......@@ -22,7 +23,7 @@ pub(crate) fn target() -> Target {
2223 max_atomic_width: Some(32),
2324 atomic_cas: false,
2425 features: "+forced-atomics".into(),
25 llvm_abiname: "ilp32".into(),
26 llvm_abiname: LlvmAbi::Ilp32,
2627 panic_strategy: PanicStrategy::Abort,
2728 relocation_model: RelocModel::Static,
2829 emit_debug_gdb_scripts: false,
compiler/rustc_target/src/spec/targets/riscv32im_risc0_zkvm_elf.rs+2-2
......@@ -1,5 +1,5 @@
11use crate::spec::{
2 Arch, Cc, LinkerFlavor, Lld, Os, PanicStrategy, RelocModel, Target, TargetMetadata,
2 Arch, Cc, LinkerFlavor, Lld, LlvmAbi, Os, PanicStrategy, RelocModel, Target, TargetMetadata,
33 TargetOptions,
44};
55
......@@ -32,7 +32,7 @@ pub(crate) fn target() -> Target {
3232 atomic_cas: true,
3333
3434 features: "+m".into(),
35 llvm_abiname: "ilp32".into(),
35 llvm_abiname: LlvmAbi::Ilp32,
3636 executables: true,
3737 panic_strategy: PanicStrategy::Abort,
3838 relocation_model: RelocModel::Static,
compiler/rustc_target/src/spec/targets/riscv32im_unknown_none_elf.rs+3-2
......@@ -1,5 +1,6 @@
11use crate::spec::{
2 Arch, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions,
2 Arch, Cc, LinkerFlavor, Lld, LlvmAbi, PanicStrategy, RelocModel, Target, TargetMetadata,
3 TargetOptions,
34};
45
56pub(crate) fn target() -> Target {
......@@ -22,7 +23,7 @@ pub(crate) fn target() -> Target {
2223 max_atomic_width: Some(32),
2324 atomic_cas: false,
2425 features: "+m,+forced-atomics".into(),
25 llvm_abiname: "ilp32".into(),
26 llvm_abiname: LlvmAbi::Ilp32,
2627 panic_strategy: PanicStrategy::Abort,
2728 relocation_model: RelocModel::Static,
2829 emit_debug_gdb_scripts: false,
compiler/rustc_target/src/spec/targets/riscv32ima_unknown_none_elf.rs+3-2
......@@ -1,5 +1,6 @@
11use crate::spec::{
2 Arch, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions,
2 Arch, Cc, LinkerFlavor, Lld, LlvmAbi, PanicStrategy, RelocModel, Target, TargetMetadata,
3 TargetOptions,
34};
45
56pub(crate) fn target() -> Target {
......@@ -21,7 +22,7 @@ pub(crate) fn target() -> Target {
2122 cpu: "generic-rv32".into(),
2223 max_atomic_width: Some(32),
2324 features: "+m,+a".into(),
24 llvm_abiname: "ilp32".into(),
25 llvm_abiname: LlvmAbi::Ilp32,
2526 panic_strategy: PanicStrategy::Abort,
2627 relocation_model: RelocModel::Static,
2728 emit_debug_gdb_scripts: false,
compiler/rustc_target/src/spec/targets/riscv32imac_esp_espidf.rs+2-2
......@@ -1,5 +1,5 @@
11use crate::spec::{
2 Arch, Env, Os, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions, cvs,
2 Arch, Env, LlvmAbi, Os, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions, cvs,
33};
44
55pub(crate) fn target() -> Target {
......@@ -29,7 +29,7 @@ pub(crate) fn target() -> Target {
2929 atomic_cas: true,
3030
3131 features: "+m,+a,+c".into(),
32 llvm_abiname: "ilp32".into(),
32 llvm_abiname: LlvmAbi::Ilp32,
3333 panic_strategy: PanicStrategy::Abort,
3434 relocation_model: RelocModel::Static,
3535 emit_debug_gdb_scripts: false,
compiler/rustc_target/src/spec/targets/riscv32imac_unknown_none_elf.rs+3-2
......@@ -1,5 +1,6 @@
11use crate::spec::{
2 Arch, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions,
2 Arch, Cc, LinkerFlavor, Lld, LlvmAbi, PanicStrategy, RelocModel, Target, TargetMetadata,
3 TargetOptions,
34};
45
56pub(crate) fn target() -> Target {
......@@ -21,7 +22,7 @@ pub(crate) fn target() -> Target {
2122 cpu: "generic-rv32".into(),
2223 max_atomic_width: Some(32),
2324 features: "+m,+a,+c".into(),
24 llvm_abiname: "ilp32".into(),
25 llvm_abiname: LlvmAbi::Ilp32,
2526 panic_strategy: PanicStrategy::Abort,
2627 relocation_model: RelocModel::Static,
2728 emit_debug_gdb_scripts: false,
compiler/rustc_target/src/spec/targets/riscv32imac_unknown_nuttx_elf.rs+2-2
......@@ -1,5 +1,5 @@
11use crate::spec::{
2 Arch, Cc, LinkerFlavor, Lld, Os, PanicStrategy, RelocModel, Target, TargetMetadata,
2 Arch, Cc, LinkerFlavor, Lld, LlvmAbi, Os, PanicStrategy, RelocModel, Target, TargetMetadata,
33 TargetOptions, cvs,
44};
55
......@@ -24,7 +24,7 @@ pub(crate) fn target() -> Target {
2424 cpu: "generic-rv32".into(),
2525 max_atomic_width: Some(32),
2626 features: "+m,+a,+c".into(),
27 llvm_abiname: "ilp32".into(),
27 llvm_abiname: LlvmAbi::Ilp32,
2828 panic_strategy: PanicStrategy::Unwind,
2929 relocation_model: RelocModel::Static,
3030 ..Default::default()
compiler/rustc_target/src/spec/targets/riscv32imac_unknown_xous_elf.rs+2-2
......@@ -1,5 +1,5 @@
11use crate::spec::{
2 Arch, Cc, LinkerFlavor, Lld, Os, PanicStrategy, RelocModel, Target, TargetMetadata,
2 Arch, Cc, LinkerFlavor, Lld, LlvmAbi, Os, PanicStrategy, RelocModel, Target, TargetMetadata,
33 TargetOptions,
44};
55
......@@ -23,7 +23,7 @@ pub(crate) fn target() -> Target {
2323 cpu: "generic-rv32".into(),
2424 max_atomic_width: Some(32),
2525 features: "+m,+a,+c".into(),
26 llvm_abiname: "ilp32".into(),
26 llvm_abiname: LlvmAbi::Ilp32,
2727 panic_strategy: PanicStrategy::Unwind,
2828 relocation_model: RelocModel::Static,
2929 ..Default::default()
compiler/rustc_target/src/spec/targets/riscv32imafc_esp_espidf.rs+2-2
......@@ -1,5 +1,5 @@
11use crate::spec::{
2 Arch, Env, Os, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions, cvs,
2 Arch, Env, LlvmAbi, Os, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions, cvs,
33};
44
55pub(crate) fn target() -> Target {
......@@ -26,7 +26,7 @@ pub(crate) fn target() -> Target {
2626 max_atomic_width: Some(32),
2727 atomic_cas: true,
2828
29 llvm_abiname: "ilp32f".into(),
29 llvm_abiname: LlvmAbi::Ilp32f,
3030 features: "+m,+a,+c,+f".into(),
3131 panic_strategy: PanicStrategy::Abort,
3232 relocation_model: RelocModel::Static,
compiler/rustc_target/src/spec/targets/riscv32imafc_unknown_none_elf.rs+3-2
......@@ -1,5 +1,6 @@
11use crate::spec::{
2 Arch, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions,
2 Arch, Cc, LinkerFlavor, Lld, LlvmAbi, PanicStrategy, RelocModel, Target, TargetMetadata,
3 TargetOptions,
34};
45
56pub(crate) fn target() -> Target {
......@@ -20,7 +21,7 @@ pub(crate) fn target() -> Target {
2021 linker: Some("rust-lld".into()),
2122 cpu: "generic-rv32".into(),
2223 max_atomic_width: Some(32),
23 llvm_abiname: "ilp32f".into(),
24 llvm_abiname: LlvmAbi::Ilp32f,
2425 features: "+m,+a,+c,+f".into(),
2526 panic_strategy: PanicStrategy::Abort,
2627 relocation_model: RelocModel::Static,
compiler/rustc_target/src/spec/targets/riscv32imafc_unknown_nuttx_elf.rs+2-2
......@@ -1,5 +1,5 @@
11use crate::spec::{
2 Arch, Cc, LinkerFlavor, Lld, Os, PanicStrategy, RelocModel, Target, TargetMetadata,
2 Arch, Cc, LinkerFlavor, Lld, LlvmAbi, Os, PanicStrategy, RelocModel, Target, TargetMetadata,
33 TargetOptions, cvs,
44};
55
......@@ -23,7 +23,7 @@ pub(crate) fn target() -> Target {
2323 linker: Some("rust-lld".into()),
2424 cpu: "generic-rv32".into(),
2525 max_atomic_width: Some(32),
26 llvm_abiname: "ilp32f".into(),
26 llvm_abiname: LlvmAbi::Ilp32f,
2727 features: "+m,+a,+c,+f".into(),
2828 panic_strategy: PanicStrategy::Abort,
2929 relocation_model: RelocModel::Static,
compiler/rustc_target/src/spec/targets/riscv32imc_esp_espidf.rs+2-2
......@@ -1,5 +1,5 @@
11use crate::spec::{
2 Arch, Env, Os, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions, cvs,
2 Arch, Env, LlvmAbi, Os, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions, cvs,
33};
44
55pub(crate) fn target() -> Target {
......@@ -32,7 +32,7 @@ pub(crate) fn target() -> Target {
3232 atomic_cas: true,
3333
3434 features: "+m,+c".into(),
35 llvm_abiname: "ilp32".into(),
35 llvm_abiname: LlvmAbi::Ilp32,
3636 panic_strategy: PanicStrategy::Abort,
3737 relocation_model: RelocModel::Static,
3838 emit_debug_gdb_scripts: false,
compiler/rustc_target/src/spec/targets/riscv32imc_unknown_none_elf.rs+3-2
......@@ -1,5 +1,6 @@
11use crate::spec::{
2 Arch, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions,
2 Arch, Cc, LinkerFlavor, Lld, LlvmAbi, PanicStrategy, RelocModel, Target, TargetMetadata,
3 TargetOptions,
34};
45
56pub(crate) fn target() -> Target {
......@@ -22,7 +23,7 @@ pub(crate) fn target() -> Target {
2223 max_atomic_width: Some(32),
2324 atomic_cas: false,
2425 features: "+m,+c,+forced-atomics".into(),
25 llvm_abiname: "ilp32".into(),
26 llvm_abiname: LlvmAbi::Ilp32,
2627 panic_strategy: PanicStrategy::Abort,
2728 relocation_model: RelocModel::Static,
2829 emit_debug_gdb_scripts: false,
compiler/rustc_target/src/spec/targets/riscv32imc_unknown_nuttx_elf.rs+2-2
......@@ -1,5 +1,5 @@
11use crate::spec::{
2 Arch, Cc, LinkerFlavor, Lld, Os, PanicStrategy, RelocModel, Target, TargetMetadata,
2 Arch, Cc, LinkerFlavor, Lld, LlvmAbi, Os, PanicStrategy, RelocModel, Target, TargetMetadata,
33 TargetOptions, cvs,
44};
55
......@@ -24,7 +24,7 @@ pub(crate) fn target() -> Target {
2424 cpu: "generic-rv32".into(),
2525 max_atomic_width: Some(32),
2626 features: "+m,+c".into(),
27 llvm_abiname: "ilp32".into(),
27 llvm_abiname: LlvmAbi::Ilp32,
2828 panic_strategy: PanicStrategy::Unwind,
2929 relocation_model: RelocModel::Static,
3030 ..Default::default()
compiler/rustc_target/src/spec/targets/riscv64_linux_android.rs+3-2
......@@ -1,7 +1,8 @@
11use std::borrow::Cow;
22
33use crate::spec::{
4 Arch, CodeModel, SanitizerSet, SplitDebuginfo, Target, TargetMetadata, TargetOptions, base,
4 Arch, CodeModel, LlvmAbi, SanitizerSet, SplitDebuginfo, Target, TargetMetadata, TargetOptions,
5 base,
56};
67
78pub(crate) fn target() -> Target {
......@@ -20,7 +21,7 @@ pub(crate) fn target() -> Target {
2021 code_model: Some(CodeModel::Medium),
2122 cpu: "generic-rv64".into(),
2223 features: "+m,+a,+f,+d,+c,+b,+v,+zicsr,+zifencei".into(),
23 llvm_abiname: "lp64d".into(),
24 llvm_abiname: LlvmAbi::Lp64d,
2425 supported_sanitizers: SanitizerSet::ADDRESS,
2526 max_atomic_width: Some(64),
2627 supported_split_debuginfo: Cow::Borrowed(&[SplitDebuginfo::Off]),
compiler/rustc_target/src/spec/targets/riscv64_wrs_vxworks.rs+2-2
......@@ -1,4 +1,4 @@
1use crate::spec::{Arch, StackProbeType, Target, TargetMetadata, TargetOptions, base};
1use crate::spec::{Arch, LlvmAbi, StackProbeType, Target, TargetMetadata, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
......@@ -14,7 +14,7 @@ pub(crate) fn target() -> Target {
1414 arch: Arch::RiscV64,
1515 options: TargetOptions {
1616 cpu: "generic-rv64".into(),
17 llvm_abiname: "lp64d".into(),
17 llvm_abiname: LlvmAbi::Lp64d,
1818 max_atomic_width: Some(64),
1919 features: "+m,+a,+f,+d,+c,+zicsr,+zifencei".into(),
2020 stack_probes: StackProbeType::Inline,
compiler/rustc_target/src/spec/targets/riscv64a23_unknown_linux_gnu.rs+4-2
......@@ -1,6 +1,8 @@
11use std::borrow::Cow;
22
3use crate::spec::{Arch, CodeModel, SplitDebuginfo, Target, TargetMetadata, TargetOptions, base};
3use crate::spec::{
4 Arch, CodeModel, LlvmAbi, SplitDebuginfo, Target, TargetMetadata, TargetOptions, base,
5};
46
57pub(crate) fn target() -> Target {
68 Target {
......@@ -18,7 +20,7 @@ pub(crate) fn target() -> Target {
1820 code_model: Some(CodeModel::Medium),
1921 cpu: "generic-rv64".into(),
2022 features: "+rva23u64".into(),
21 llvm_abiname: "lp64d".into(),
23 llvm_abiname: LlvmAbi::Lp64d,
2224 max_atomic_width: Some(64),
2325 supported_split_debuginfo: Cow::Borrowed(&[SplitDebuginfo::Off]),
2426 ..base::linux_gnu::opts()
compiler/rustc_target/src/spec/targets/riscv64gc_unknown_freebsd.rs+2-2
......@@ -1,4 +1,4 @@
1use crate::spec::{Arch, CodeModel, Target, TargetMetadata, TargetOptions, base};
1use crate::spec::{Arch, CodeModel, LlvmAbi, Target, TargetMetadata, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
......@@ -16,7 +16,7 @@ pub(crate) fn target() -> Target {
1616 code_model: Some(CodeModel::Medium),
1717 cpu: "generic-rv64".into(),
1818 features: "+m,+a,+f,+d,+c,+zicsr,+zifencei".into(),
19 llvm_abiname: "lp64d".into(),
19 llvm_abiname: LlvmAbi::Lp64d,
2020 max_atomic_width: Some(64),
2121 ..base::freebsd::opts()
2222 },
compiler/rustc_target/src/spec/targets/riscv64gc_unknown_fuchsia.rs+4-2
......@@ -1,11 +1,13 @@
1use crate::spec::{Arch, CodeModel, SanitizerSet, StackProbeType, Target, TargetMetadata, base};
1use crate::spec::{
2 Arch, CodeModel, LlvmAbi, SanitizerSet, StackProbeType, Target, TargetMetadata, base,
3};
24
35pub(crate) fn target() -> Target {
46 let mut base = base::fuchsia::opts();
57 base.code_model = Some(CodeModel::Medium);
68 base.cpu = "generic-rv64".into();
79 base.features = "+m,+a,+f,+d,+c,+zicsr,+zifencei".into();
8 base.llvm_abiname = "lp64d".into();
10 base.llvm_abiname = LlvmAbi::Lp64d;
911 base.max_atomic_width = Some(64);
1012 base.stack_probes = StackProbeType::Inline;
1113 base.supported_sanitizers = SanitizerSet::SHADOWCALLSTACK;
compiler/rustc_target/src/spec/targets/riscv64gc_unknown_hermit.rs+2-2
......@@ -1,5 +1,5 @@
11use crate::spec::{
2 Arch, CodeModel, RelocModel, Target, TargetMetadata, TargetOptions, TlsModel, base,
2 Arch, CodeModel, LlvmAbi, RelocModel, Target, TargetMetadata, TargetOptions, TlsModel, base,
33};
44
55pub(crate) fn target() -> Target {
......@@ -21,7 +21,7 @@ pub(crate) fn target() -> Target {
2121 code_model: Some(CodeModel::Medium),
2222 tls_model: TlsModel::LocalExec,
2323 max_atomic_width: Some(64),
24 llvm_abiname: "lp64d".into(),
24 llvm_abiname: LlvmAbi::Lp64d,
2525 ..base::hermit::opts()
2626 },
2727 }
compiler/rustc_target/src/spec/targets/riscv64gc_unknown_linux_gnu.rs+4-2
......@@ -1,6 +1,8 @@
11use std::borrow::Cow;
22
3use crate::spec::{Arch, CodeModel, SplitDebuginfo, Target, TargetMetadata, TargetOptions, base};
3use crate::spec::{
4 Arch, CodeModel, LlvmAbi, SplitDebuginfo, Target, TargetMetadata, TargetOptions, base,
5};
46
57pub(crate) fn target() -> Target {
68 Target {
......@@ -18,7 +20,7 @@ pub(crate) fn target() -> Target {
1820 code_model: Some(CodeModel::Medium),
1921 cpu: "generic-rv64".into(),
2022 features: "+m,+a,+f,+d,+c,+zicsr,+zifencei".into(),
21 llvm_abiname: "lp64d".into(),
23 llvm_abiname: LlvmAbi::Lp64d,
2224 max_atomic_width: Some(64),
2325 supported_split_debuginfo: Cow::Borrowed(&[SplitDebuginfo::Off]),
2426 ..base::linux_gnu::opts()
compiler/rustc_target/src/spec/targets/riscv64gc_unknown_linux_musl.rs+4-2
......@@ -1,6 +1,8 @@
11use std::borrow::Cow;
22
3use crate::spec::{Arch, CodeModel, SplitDebuginfo, Target, TargetMetadata, TargetOptions, base};
3use crate::spec::{
4 Arch, CodeModel, LlvmAbi, SplitDebuginfo, Target, TargetMetadata, TargetOptions, base,
5};
46
57pub(crate) fn target() -> Target {
68 Target {
......@@ -18,7 +20,7 @@ pub(crate) fn target() -> Target {
1820 code_model: Some(CodeModel::Medium),
1921 cpu: "generic-rv64".into(),
2022 features: "+m,+a,+f,+d,+c,+zicsr,+zifencei".into(),
21 llvm_abiname: "lp64d".into(),
23 llvm_abiname: LlvmAbi::Lp64d,
2224 max_atomic_width: Some(64),
2325 supported_split_debuginfo: Cow::Borrowed(&[SplitDebuginfo::Off]),
2426 ..base::linux_musl::opts()
compiler/rustc_target/src/spec/targets/riscv64gc_unknown_managarm_mlibc.rs+2-2
......@@ -1,4 +1,4 @@
1use crate::spec::{Arch, CodeModel, Target, TargetOptions, base};
1use crate::spec::{Arch, CodeModel, LlvmAbi, Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
......@@ -16,7 +16,7 @@ pub(crate) fn target() -> Target {
1616 code_model: Some(CodeModel::Medium),
1717 cpu: "generic-rv64".into(),
1818 features: "+m,+a,+f,+d,+c".into(),
19 llvm_abiname: "lp64d".into(),
19 llvm_abiname: LlvmAbi::Lp64d,
2020 max_atomic_width: Some(64),
2121 ..base::managarm_mlibc::opts()
2222 },
compiler/rustc_target/src/spec/targets/riscv64gc_unknown_netbsd.rs+2-2
......@@ -1,4 +1,4 @@
1use crate::spec::{Arch, CodeModel, Target, TargetMetadata, TargetOptions, base};
1use crate::spec::{Arch, CodeModel, LlvmAbi, Target, TargetMetadata, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
......@@ -16,7 +16,7 @@ pub(crate) fn target() -> Target {
1616 code_model: Some(CodeModel::Medium),
1717 cpu: "generic-rv64".into(),
1818 features: "+m,+a,+f,+d,+c,+zicsr,+zifencei".into(),
19 llvm_abiname: "lp64d".into(),
19 llvm_abiname: LlvmAbi::Lp64d,
2020 max_atomic_width: Some(64),
2121 mcount: "__mcount".into(),
2222 ..base::netbsd::opts()
compiler/rustc_target/src/spec/targets/riscv64gc_unknown_none_elf.rs+3-3
......@@ -1,6 +1,6 @@
11use crate::spec::{
2 Arch, Cc, CodeModel, LinkerFlavor, Lld, PanicStrategy, RelocModel, SanitizerSet, Target,
3 TargetMetadata, TargetOptions,
2 Arch, Cc, CodeModel, LinkerFlavor, Lld, LlvmAbi, PanicStrategy, RelocModel, SanitizerSet,
3 Target, TargetMetadata, TargetOptions,
44};
55
66pub(crate) fn target() -> Target {
......@@ -19,7 +19,7 @@ pub(crate) fn target() -> Target {
1919 options: TargetOptions {
2020 linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
2121 linker: Some("rust-lld".into()),
22 llvm_abiname: "lp64d".into(),
22 llvm_abiname: LlvmAbi::Lp64d,
2323 cpu: "generic-rv64".into(),
2424 max_atomic_width: Some(64),
2525 features: "+m,+a,+f,+d,+c,+zicsr,+zifencei".into(),
compiler/rustc_target/src/spec/targets/riscv64gc_unknown_nuttx_elf.rs+3-3
......@@ -1,6 +1,6 @@
11use crate::spec::{
2 Arch, Cc, CodeModel, LinkerFlavor, Lld, Os, PanicStrategy, RelocModel, SanitizerSet, Target,
3 TargetMetadata, TargetOptions, cvs,
2 Arch, Cc, CodeModel, LinkerFlavor, Lld, LlvmAbi, Os, PanicStrategy, RelocModel, SanitizerSet,
3 Target, TargetMetadata, TargetOptions, cvs,
44};
55
66pub(crate) fn target() -> Target {
......@@ -21,7 +21,7 @@ pub(crate) fn target() -> Target {
2121 os: Os::NuttX,
2222 linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
2323 linker: Some("rust-lld".into()),
24 llvm_abiname: "lp64d".into(),
24 llvm_abiname: LlvmAbi::Lp64d,
2525 cpu: "generic-rv64".into(),
2626 max_atomic_width: Some(64),
2727 features: "+m,+a,+f,+d,+c,+zicsr,+zifencei".into(),
compiler/rustc_target/src/spec/targets/riscv64gc_unknown_openbsd.rs+2-2
......@@ -1,4 +1,4 @@
1use crate::spec::{Arch, CodeModel, Target, TargetMetadata, TargetOptions, base};
1use crate::spec::{Arch, CodeModel, LlvmAbi, Target, TargetMetadata, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
......@@ -16,7 +16,7 @@ pub(crate) fn target() -> Target {
1616 code_model: Some(CodeModel::Medium),
1717 cpu: "generic-rv64".into(),
1818 features: "+m,+a,+f,+d,+c,+zicsr,+zifencei".into(),
19 llvm_abiname: "lp64d".into(),
19 llvm_abiname: LlvmAbi::Lp64d,
2020 max_atomic_width: Some(64),
2121 ..base::openbsd::opts()
2222 },
compiler/rustc_target/src/spec/targets/riscv64gc_unknown_redox.rs+2-2
......@@ -1,11 +1,11 @@
1use crate::spec::{Arch, CodeModel, Target, TargetMetadata, base};
1use crate::spec::{Arch, CodeModel, LlvmAbi, Target, TargetMetadata, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::redox::opts();
55 base.code_model = Some(CodeModel::Medium);
66 base.cpu = "generic-rv64".into();
77 base.features = "+m,+a,+f,+d,+c".into();
8 base.llvm_abiname = "lp64d".into();
8 base.llvm_abiname = LlvmAbi::Lp64d;
99 base.plt_by_default = false;
1010 base.max_atomic_width = Some(64);
1111
compiler/rustc_target/src/spec/targets/riscv64im_unknown_none_elf.rs+3-3
......@@ -1,6 +1,6 @@
11use crate::spec::{
2 Arch, Cc, CodeModel, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata,
3 TargetOptions,
2 Arch, Cc, CodeModel, LinkerFlavor, Lld, LlvmAbi, PanicStrategy, RelocModel, Target,
3 TargetMetadata, TargetOptions,
44};
55
66pub(crate) fn target() -> Target {
......@@ -23,7 +23,7 @@ pub(crate) fn target() -> Target {
2323 max_atomic_width: Some(64),
2424 atomic_cas: false,
2525 features: "+m,+forced-atomics".into(),
26 llvm_abiname: "lp64".into(),
26 llvm_abiname: LlvmAbi::Lp64,
2727 panic_strategy: PanicStrategy::Abort,
2828 relocation_model: RelocModel::Static,
2929 code_model: Some(CodeModel::Medium),
compiler/rustc_target/src/spec/targets/riscv64imac_unknown_none_elf.rs+3-3
......@@ -1,6 +1,6 @@
11use crate::spec::{
2 Arch, Cc, CodeModel, LinkerFlavor, Lld, PanicStrategy, RelocModel, SanitizerSet, Target,
3 TargetMetadata, TargetOptions,
2 Arch, Cc, CodeModel, LinkerFlavor, Lld, LlvmAbi, PanicStrategy, RelocModel, SanitizerSet,
3 Target, TargetMetadata, TargetOptions,
44};
55
66pub(crate) fn target() -> Target {
......@@ -22,7 +22,7 @@ pub(crate) fn target() -> Target {
2222 cpu: "generic-rv64".into(),
2323 max_atomic_width: Some(64),
2424 features: "+m,+a,+c".into(),
25 llvm_abiname: "lp64".into(),
25 llvm_abiname: LlvmAbi::Lp64,
2626 panic_strategy: PanicStrategy::Abort,
2727 relocation_model: RelocModel::Static,
2828 code_model: Some(CodeModel::Medium),
compiler/rustc_target/src/spec/targets/riscv64imac_unknown_nuttx_elf.rs+3-3
......@@ -1,6 +1,6 @@
11use crate::spec::{
2 Arch, Cc, CodeModel, LinkerFlavor, Lld, Os, PanicStrategy, RelocModel, SanitizerSet, Target,
3 TargetMetadata, TargetOptions, cvs,
2 Arch, Cc, CodeModel, LinkerFlavor, Lld, LlvmAbi, Os, PanicStrategy, RelocModel, SanitizerSet,
3 Target, TargetMetadata, TargetOptions, cvs,
44};
55
66pub(crate) fn target() -> Target {
......@@ -24,7 +24,7 @@ pub(crate) fn target() -> Target {
2424 cpu: "generic-rv64".into(),
2525 max_atomic_width: Some(64),
2626 features: "+m,+a,+c".into(),
27 llvm_abiname: "lp64".into(),
27 llvm_abiname: LlvmAbi::Lp64,
2828 panic_strategy: PanicStrategy::Abort,
2929 relocation_model: RelocModel::Static,
3030 code_model: Some(CodeModel::Medium),
compiler/rustc_target/src/spec/targets/s390x_unknown_none_softfloat.rs+2-2
......@@ -1,13 +1,13 @@
11use rustc_abi::{Align, Endian};
22
33use crate::spec::{
4 Abi, Arch, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, RustcAbi, SanitizerSet,
4 Arch, Cc, CfgAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, RustcAbi, SanitizerSet,
55 StackProbeType, Target, TargetMetadata, TargetOptions,
66};
77
88pub(crate) fn target() -> Target {
99 let opts = TargetOptions {
10 abi: Abi::SoftFloat,
10 cfg_abi: CfgAbi::SoftFloat,
1111 cpu: "z10".into(),
1212 endian: Endian::Big,
1313 features: "+soft-float,-vector".into(),
compiler/rustc_target/src/spec/targets/thumbv4t_none_eabi.rs+2-2
......@@ -9,7 +9,7 @@
99//! The default link script is very likely wrong, so you should use
1010//! `-Clink-arg=-Tmy_script.ld` to override that with a correct linker script.
1111
12use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base, cvs};
12use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base, cvs};
1313
1414pub(crate) fn target() -> Target {
1515 Target {
......@@ -24,7 +24,7 @@ pub(crate) fn target() -> Target {
2424 arch: Arch::Arm,
2525 data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
2626 options: TargetOptions {
27 abi: Abi::Eabi,
27 cfg_abi: CfgAbi::Eabi,
2828 llvm_floatabi: Some(FloatAbi::Soft),
2929 asm_args: cvs!["-mthumb-interwork", "-march=armv4t", "-mlittle-endian",],
3030 features: "+soft-float,+strict-align".into(),
compiler/rustc_target/src/spec/targets/thumbv5te_none_eabi.rs+2-2
......@@ -1,6 +1,6 @@
11//! Targets the ARMv5TE architecture, with `t32` code by default.
22
3use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base, cvs};
3use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base, cvs};
44
55pub(crate) fn target() -> Target {
66 Target {
......@@ -15,7 +15,7 @@ pub(crate) fn target() -> Target {
1515 arch: Arch::Arm,
1616 data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
1717 options: TargetOptions {
18 abi: Abi::Eabi,
18 cfg_abi: CfgAbi::Eabi,
1919 llvm_floatabi: Some(FloatAbi::Soft),
2020 asm_args: cvs!["-mthumb-interwork", "-march=armv5te", "-mlittle-endian",],
2121 features: "+soft-float,+strict-align".into(),
compiler/rustc_target/src/spec/targets/thumbv6_none_eabi.rs+2-2
......@@ -1,6 +1,6 @@
11//! Targets the ARMv6K architecture, with `t32` code by default.
22
3use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base, cvs};
3use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base, cvs};
44
55pub(crate) fn target() -> Target {
66 Target {
......@@ -15,7 +15,7 @@ pub(crate) fn target() -> Target {
1515 arch: Arch::Arm,
1616 data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
1717 options: TargetOptions {
18 abi: Abi::Eabi,
18 cfg_abi: CfgAbi::Eabi,
1919 llvm_floatabi: Some(FloatAbi::Soft),
2020 asm_args: cvs!["-mthumb-interwork", "-march=armv6", "-mlittle-endian",],
2121 features: "+soft-float,+strict-align,+v6k".into(),
compiler/rustc_target/src/spec/targets/thumbv6m_none_eabi.rs+2-2
......@@ -1,6 +1,6 @@
11// Targets the Cortex-M0, Cortex-M0+ and Cortex-M1 processors (ARMv6-M architecture)
22
3use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
3use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
44
55pub(crate) fn target() -> Target {
66 Target {
......@@ -16,7 +16,7 @@ pub(crate) fn target() -> Target {
1616 arch: Arch::Arm,
1717
1818 options: TargetOptions {
19 abi: Abi::Eabi,
19 cfg_abi: CfgAbi::Eabi,
2020 llvm_floatabi: Some(FloatAbi::Soft),
2121 // The ARMv6-M architecture doesn't support unaligned loads/stores so we disable them
2222 // with +strict-align.
compiler/rustc_target/src/spec/targets/thumbv6m_nuttx_eabi.rs+2-2
......@@ -1,6 +1,6 @@
11// Targets the Cortex-M0, Cortex-M0+ and Cortex-M1 processors (ARMv6-M architecture)
22
3use crate::spec::{Abi, Arch, FloatAbi, Os, Target, TargetMetadata, TargetOptions, base, cvs};
3use crate::spec::{Arch, CfgAbi, FloatAbi, Os, Target, TargetMetadata, TargetOptions, base, cvs};
44
55pub(crate) fn target() -> Target {
66 Target {
......@@ -18,7 +18,7 @@ pub(crate) fn target() -> Target {
1818 options: TargetOptions {
1919 families: cvs!["unix"],
2020 os: Os::NuttX,
21 abi: Abi::Eabi,
21 cfg_abi: CfgAbi::Eabi,
2222 llvm_floatabi: Some(FloatAbi::Soft),
2323 // The ARMv6-M architecture doesn't support unaligned loads/stores so we disable them
2424 // with +strict-align.
compiler/rustc_target/src/spec/targets/thumbv7a_none_eabi.rs+2-2
......@@ -1,6 +1,6 @@
11// Targets the Little-endian Cortex-A8 (and similar) processors (ARMv7-A)
22
3use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
3use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
44
55pub(crate) fn target() -> Target {
66 Target {
......@@ -15,7 +15,7 @@ pub(crate) fn target() -> Target {
1515 data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
1616 arch: Arch::Arm,
1717 options: TargetOptions {
18 abi: Abi::Eabi,
18 cfg_abi: CfgAbi::Eabi,
1919 llvm_floatabi: Some(FloatAbi::Soft),
2020 features: "+soft-float,-neon,+strict-align".into(),
2121 max_atomic_width: Some(64),
compiler/rustc_target/src/spec/targets/thumbv7a_none_eabihf.rs+2-2
......@@ -1,6 +1,6 @@
11// Targets the Little-endian Cortex-A8 (and similar) processors (ARMv7-A)
22
3use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
3use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
44
55pub(crate) fn target() -> Target {
66 Target {
......@@ -15,7 +15,7 @@ pub(crate) fn target() -> Target {
1515 data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
1616 arch: Arch::Arm,
1717 options: TargetOptions {
18 abi: Abi::EabiHf,
18 cfg_abi: CfgAbi::EabiHf,
1919 llvm_floatabi: Some(FloatAbi::Hard),
2020 features: "+vfp3d16,-neon,+strict-align".into(),
2121 max_atomic_width: Some(64),
compiler/rustc_target/src/spec/targets/thumbv7a_nuttx_eabi.rs+2-2
......@@ -4,7 +4,7 @@
44// and will use software floating point operations. This matches the NuttX EABI
55// configuration without hardware floating point support.
66
7use crate::spec::{Abi, Arch, FloatAbi, Os, Target, TargetMetadata, TargetOptions, base, cvs};
7use crate::spec::{Arch, CfgAbi, FloatAbi, Os, Target, TargetMetadata, TargetOptions, base, cvs};
88
99pub(crate) fn target() -> Target {
1010 Target {
......@@ -22,7 +22,7 @@ pub(crate) fn target() -> Target {
2222 options: TargetOptions {
2323 families: cvs!["unix"],
2424 os: Os::NuttX,
25 abi: Abi::Eabi,
25 cfg_abi: CfgAbi::Eabi,
2626 llvm_floatabi: Some(FloatAbi::Soft),
2727 // Cortex-A7/A8/A9 with software floating point
2828 features: "+soft-float,-neon".into(),
compiler/rustc_target/src/spec/targets/thumbv7a_nuttx_eabihf.rs+2-2
......@@ -7,7 +7,7 @@
77// This target uses the "hard" floating convention (ABI) where floating point values
88// are passed to/from subroutines via FPU registers (S0, S1, D0, D1, etc.).
99
10use crate::spec::{Abi, Arch, FloatAbi, Os, Target, TargetMetadata, TargetOptions, base, cvs};
10use crate::spec::{Arch, CfgAbi, FloatAbi, Os, Target, TargetMetadata, TargetOptions, base, cvs};
1111
1212pub(crate) fn target() -> Target {
1313 Target {
......@@ -25,7 +25,7 @@ pub(crate) fn target() -> Target {
2525 options: TargetOptions {
2626 families: cvs!["unix"],
2727 os: Os::NuttX,
28 abi: Abi::EabiHf,
28 cfg_abi: CfgAbi::EabiHf,
2929 llvm_floatabi: Some(FloatAbi::Hard),
3030 // Cortex-A7/A8/A9 support VFPv3-D32/VFPv4-D32 with optional double-precision
3131 // and NEON SIMD instructions
compiler/rustc_target/src/spec/targets/thumbv7em_none_eabi.rs+2-2
......@@ -9,7 +9,7 @@
99// To opt-in to hardware accelerated floating point operations, you can use, for example,
1010// `-C target-feature=+vfp4` or `-C target-cpu=cortex-m4`.
1111
12use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
12use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
1313
1414pub(crate) fn target() -> Target {
1515 Target {
......@@ -25,7 +25,7 @@ pub(crate) fn target() -> Target {
2525 arch: Arch::Arm,
2626
2727 options: TargetOptions {
28 abi: Abi::Eabi,
28 cfg_abi: CfgAbi::Eabi,
2929 llvm_floatabi: Some(FloatAbi::Soft),
3030 max_atomic_width: Some(32),
3131 ..base::arm_none::opts()
compiler/rustc_target/src/spec/targets/thumbv7em_none_eabihf.rs+2-2
......@@ -8,7 +8,7 @@
88//
99// To opt into double precision hardware support, use the `-C target-feature=+fp64` flag.
1010
11use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
11use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
1212
1313pub(crate) fn target() -> Target {
1414 Target {
......@@ -24,7 +24,7 @@ pub(crate) fn target() -> Target {
2424 arch: Arch::Arm,
2525
2626 options: TargetOptions {
27 abi: Abi::EabiHf,
27 cfg_abi: CfgAbi::EabiHf,
2828 llvm_floatabi: Some(FloatAbi::Hard),
2929 // vfp4 is the lowest common denominator between the Cortex-M4F (vfp4) and the
3030 // Cortex-M7 (vfp5).
compiler/rustc_target/src/spec/targets/thumbv7em_nuttx_eabi.rs+2-2
......@@ -9,7 +9,7 @@
99// To opt-in to hardware accelerated floating point operations, you can use, for example,
1010// `-C target-feature=+vfp4` or `-C target-cpu=cortex-m4`.
1111
12use crate::spec::{Abi, Arch, FloatAbi, Os, Target, TargetMetadata, TargetOptions, base, cvs};
12use crate::spec::{Arch, CfgAbi, FloatAbi, Os, Target, TargetMetadata, TargetOptions, base, cvs};
1313
1414pub(crate) fn target() -> Target {
1515 Target {
......@@ -27,7 +27,7 @@ pub(crate) fn target() -> Target {
2727 options: TargetOptions {
2828 families: cvs!["unix"],
2929 os: Os::NuttX,
30 abi: Abi::Eabi,
30 cfg_abi: CfgAbi::Eabi,
3131 llvm_floatabi: Some(FloatAbi::Soft),
3232 max_atomic_width: Some(32),
3333 ..base::arm_none::opts()
compiler/rustc_target/src/spec/targets/thumbv7em_nuttx_eabihf.rs+2-2
......@@ -8,7 +8,7 @@
88//
99// To opt into double precision hardware support, use the `-C target-feature=+fp64` flag.
1010
11use crate::spec::{Abi, Arch, FloatAbi, Os, Target, TargetMetadata, TargetOptions, base, cvs};
11use crate::spec::{Arch, CfgAbi, FloatAbi, Os, Target, TargetMetadata, TargetOptions, base, cvs};
1212
1313pub(crate) fn target() -> Target {
1414 Target {
......@@ -26,7 +26,7 @@ pub(crate) fn target() -> Target {
2626 options: TargetOptions {
2727 families: cvs!["unix"],
2828 os: Os::NuttX,
29 abi: Abi::EabiHf,
29 cfg_abi: CfgAbi::EabiHf,
3030 llvm_floatabi: Some(FloatAbi::Hard),
3131 // vfp4 is the lowest common denominator between the Cortex-M4F (vfp4) and the
3232 // Cortex-M7 (vfp5).
compiler/rustc_target/src/spec/targets/thumbv7m_none_eabi.rs+2-2
......@@ -1,6 +1,6 @@
11// Targets the Cortex-M3 processor (ARMv7-M)
22
3use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
3use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
44
55pub(crate) fn target() -> Target {
66 Target {
......@@ -16,7 +16,7 @@ pub(crate) fn target() -> Target {
1616 arch: Arch::Arm,
1717
1818 options: TargetOptions {
19 abi: Abi::Eabi,
19 cfg_abi: CfgAbi::Eabi,
2020 llvm_floatabi: Some(FloatAbi::Soft),
2121 max_atomic_width: Some(32),
2222 ..base::arm_none::opts()
compiler/rustc_target/src/spec/targets/thumbv7m_nuttx_eabi.rs+2-2
......@@ -1,6 +1,6 @@
11// Targets the Cortex-M3 processor (ARMv7-M)
22
3use crate::spec::{Abi, Arch, FloatAbi, Os, Target, TargetMetadata, TargetOptions, base, cvs};
3use crate::spec::{Arch, CfgAbi, FloatAbi, Os, Target, TargetMetadata, TargetOptions, base, cvs};
44
55pub(crate) fn target() -> Target {
66 Target {
......@@ -18,7 +18,7 @@ pub(crate) fn target() -> Target {
1818 options: TargetOptions {
1919 families: cvs!["unix"],
2020 os: Os::NuttX,
21 abi: Abi::Eabi,
21 cfg_abi: CfgAbi::Eabi,
2222 llvm_floatabi: Some(FloatAbi::Soft),
2323 max_atomic_width: Some(32),
2424 ..base::arm_none::opts()
compiler/rustc_target/src/spec/targets/thumbv7neon_linux_androideabi.rs+2-2
......@@ -1,5 +1,5 @@
11use crate::spec::{
2 Abi, Arch, Cc, FloatAbi, LinkerFlavor, Lld, Target, TargetMetadata, TargetOptions, base,
2 Arch, Cc, CfgAbi, FloatAbi, LinkerFlavor, Lld, Target, TargetMetadata, TargetOptions, base,
33};
44
55// This target if is for the Android v7a ABI in thumb mode with
......@@ -25,7 +25,7 @@ pub(crate) fn target() -> Target {
2525 data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
2626 arch: Arch::Arm,
2727 options: TargetOptions {
28 abi: Abi::Eabi,
28 cfg_abi: CfgAbi::Eabi,
2929 llvm_floatabi: Some(FloatAbi::Soft),
3030 features: "+v7,+thumb-mode,+thumb2,+vfp3,+neon".into(),
3131 max_atomic_width: Some(64),
compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_gnueabihf.rs+2-2
......@@ -1,4 +1,4 @@
1use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
1use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
22
33// This target is for glibc Linux on ARMv7 with thumb mode enabled
44// (for consistency with Android and Debian-based distributions)
......@@ -21,7 +21,7 @@ pub(crate) fn target() -> Target {
2121 data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
2222 arch: Arch::Arm,
2323 options: TargetOptions {
24 abi: Abi::EabiHf,
24 cfg_abi: CfgAbi::EabiHf,
2525 llvm_floatabi: Some(FloatAbi::Hard),
2626 // Info about features at https://wiki.debian.org/ArmHardFloatPort
2727 features: "+v7,+thumb-mode,+thumb2,+vfp3,+neon".into(),
compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs+2-2
......@@ -1,4 +1,4 @@
1use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
1use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
22
33// This target is for musl Linux on ARMv7 with thumb mode enabled
44// (for consistency with Android and Debian-based distributions)
......@@ -22,7 +22,7 @@ pub(crate) fn target() -> Target {
2222 // Most of these settings are copied from the thumbv7neon_unknown_linux_gnueabihf
2323 // target.
2424 options: TargetOptions {
25 abi: Abi::EabiHf,
25 cfg_abi: CfgAbi::EabiHf,
2626 llvm_floatabi: Some(FloatAbi::Hard),
2727 features: "+v7,+thumb-mode,+thumb2,+vfp3,+neon".into(),
2828 max_atomic_width: Some(64),
compiler/rustc_target/src/spec/targets/thumbv7r_none_eabi.rs+2-2
......@@ -1,6 +1,6 @@
11// Targets the Little-endian Cortex-R4/R5 processor (ARMv7-R)
22
3use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
3use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
44
55pub(crate) fn target() -> Target {
66 Target {
......@@ -15,7 +15,7 @@ pub(crate) fn target() -> Target {
1515 data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
1616 arch: Arch::Arm,
1717 options: TargetOptions {
18 abi: Abi::Eabi,
18 cfg_abi: CfgAbi::Eabi,
1919 llvm_floatabi: Some(FloatAbi::Soft),
2020 max_atomic_width: Some(64),
2121 has_thumb_interworking: true,
compiler/rustc_target/src/spec/targets/thumbv7r_none_eabihf.rs+2-2
......@@ -1,6 +1,6 @@
11// Targets the Little-endian Cortex-R4F/R5F processor (ARMv7-R)
22
3use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
3use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
44
55pub(crate) fn target() -> Target {
66 Target {
......@@ -15,7 +15,7 @@ pub(crate) fn target() -> Target {
1515 data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
1616 arch: Arch::Arm,
1717 options: TargetOptions {
18 abi: Abi::EabiHf,
18 cfg_abi: CfgAbi::EabiHf,
1919 llvm_floatabi: Some(FloatAbi::Hard),
2020 features: "+vfp3d16".into(),
2121 max_atomic_width: Some(64),
compiler/rustc_target/src/spec/targets/thumbv8m_base_none_eabi.rs+2-2
......@@ -1,6 +1,6 @@
11// Targets the Cortex-M23 processor (Baseline ARMv8-M)
22
3use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
3use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
44
55pub(crate) fn target() -> Target {
66 Target {
......@@ -16,7 +16,7 @@ pub(crate) fn target() -> Target {
1616 arch: Arch::Arm,
1717
1818 options: TargetOptions {
19 abi: Abi::Eabi,
19 cfg_abi: CfgAbi::Eabi,
2020 llvm_floatabi: Some(FloatAbi::Soft),
2121 // ARMv8-M baseline doesn't support unaligned loads/stores so we disable them
2222 // with +strict-align.
compiler/rustc_target/src/spec/targets/thumbv8m_base_nuttx_eabi.rs+2-2
......@@ -1,6 +1,6 @@
11// Targets the Cortex-M23 processor (Baseline ARMv8-M)
22
3use crate::spec::{Abi, Arch, FloatAbi, Os, Target, TargetMetadata, TargetOptions, base, cvs};
3use crate::spec::{Arch, CfgAbi, FloatAbi, Os, Target, TargetMetadata, TargetOptions, base, cvs};
44
55pub(crate) fn target() -> Target {
66 Target {
......@@ -18,7 +18,7 @@ pub(crate) fn target() -> Target {
1818 options: TargetOptions {
1919 families: cvs!["unix"],
2020 os: Os::NuttX,
21 abi: Abi::Eabi,
21 cfg_abi: CfgAbi::Eabi,
2222 llvm_floatabi: Some(FloatAbi::Soft),
2323 // ARMv8-M baseline doesn't support unaligned loads/stores so we disable them
2424 // with +strict-align.
compiler/rustc_target/src/spec/targets/thumbv8m_main_none_eabi.rs+2-2
......@@ -1,7 +1,7 @@
11// Targets the Cortex-M33 processor (Armv8-M Mainline architecture profile),
22// without the Floating Point extension.
33
4use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
4use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
55
66pub(crate) fn target() -> Target {
77 Target {
......@@ -17,7 +17,7 @@ pub(crate) fn target() -> Target {
1717 arch: Arch::Arm,
1818
1919 options: TargetOptions {
20 abi: Abi::Eabi,
20 cfg_abi: CfgAbi::Eabi,
2121 llvm_floatabi: Some(FloatAbi::Soft),
2222 max_atomic_width: Some(32),
2323 ..base::arm_none::opts()
compiler/rustc_target/src/spec/targets/thumbv8m_main_none_eabihf.rs+2-2
......@@ -1,7 +1,7 @@
11// Targets the Cortex-M33 processor (Armv8-M Mainline architecture profile),
22// with the Floating Point extension.
33
4use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
4use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
55
66pub(crate) fn target() -> Target {
77 Target {
......@@ -17,7 +17,7 @@ pub(crate) fn target() -> Target {
1717 arch: Arch::Arm,
1818
1919 options: TargetOptions {
20 abi: Abi::EabiHf,
20 cfg_abi: CfgAbi::EabiHf,
2121 llvm_floatabi: Some(FloatAbi::Hard),
2222 // If the Floating Point extension is implemented in the Cortex-M33
2323 // processor, the Cortex-M33 Technical Reference Manual states that
compiler/rustc_target/src/spec/targets/thumbv8m_main_nuttx_eabi.rs+2-2
......@@ -1,7 +1,7 @@
11// Targets the Cortex-M33 processor (Armv8-M Mainline architecture profile),
22// without the Floating Point extension.
33
4use crate::spec::{Abi, Arch, FloatAbi, Os, Target, TargetMetadata, TargetOptions, base, cvs};
4use crate::spec::{Arch, CfgAbi, FloatAbi, Os, Target, TargetMetadata, TargetOptions, base, cvs};
55
66pub(crate) fn target() -> Target {
77 Target {
......@@ -19,7 +19,7 @@ pub(crate) fn target() -> Target {
1919 options: TargetOptions {
2020 families: cvs!["unix"],
2121 os: Os::NuttX,
22 abi: Abi::Eabi,
22 cfg_abi: CfgAbi::Eabi,
2323 llvm_floatabi: Some(FloatAbi::Soft),
2424 max_atomic_width: Some(32),
2525 ..base::arm_none::opts()
compiler/rustc_target/src/spec/targets/thumbv8m_main_nuttx_eabihf.rs+2-2
......@@ -1,7 +1,7 @@
11// Targets the Cortex-M33 processor (Armv8-M Mainline architecture profile),
22// with the Floating Point extension.
33
4use crate::spec::{Abi, Arch, FloatAbi, Os, Target, TargetMetadata, TargetOptions, base, cvs};
4use crate::spec::{Arch, CfgAbi, FloatAbi, Os, Target, TargetMetadata, TargetOptions, base, cvs};
55
66pub(crate) fn target() -> Target {
77 Target {
......@@ -19,7 +19,7 @@ pub(crate) fn target() -> Target {
1919 options: TargetOptions {
2020 families: cvs!["unix"],
2121 os: Os::NuttX,
22 abi: Abi::EabiHf,
22 cfg_abi: CfgAbi::EabiHf,
2323 llvm_floatabi: Some(FloatAbi::Hard),
2424 // If the Floating Point extension is implemented in the Cortex-M33
2525 // processor, the Cortex-M33 Technical Reference Manual states that
compiler/rustc_target/src/spec/targets/thumbv8r_none_eabihf.rs+2-2
......@@ -1,6 +1,6 @@
11// Targets the Little-endian Cortex-R52 processor (ARMv8-R)
22
3use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
3use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
44
55pub(crate) fn target() -> Target {
66 Target {
......@@ -16,7 +16,7 @@ pub(crate) fn target() -> Target {
1616 arch: Arch::Arm,
1717
1818 options: TargetOptions {
19 abi: Abi::EabiHf,
19 cfg_abi: CfgAbi::EabiHf,
2020 llvm_floatabi: Some(FloatAbi::Hard),
2121 // Armv8-R requires a minimum set of floating-point features equivalent to:
2222 // fp-armv8, SP-only, with 16 DP (32 SP) registers
compiler/rustc_target/src/spec/targets/x86_64_fortanix_unknown_sgx.rs+2-2
......@@ -1,7 +1,7 @@
11use std::borrow::Cow;
22
33use crate::spec::{
4 Abi, Arch, Cc, Env, LinkerFlavor, Lld, Os, Target, TargetMetadata, TargetOptions, cvs,
4 Arch, Cc, CfgAbi, Env, LinkerFlavor, Lld, Os, Target, TargetMetadata, TargetOptions, cvs,
55};
66
77pub(crate) fn target() -> Target {
......@@ -60,7 +60,7 @@ pub(crate) fn target() -> Target {
6060 os: Os::Unknown,
6161 env: Env::Sgx,
6262 vendor: "fortanix".into(),
63 abi: Abi::Fortanix,
63 cfg_abi: CfgAbi::Fortanix,
6464 linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
6565 linker: Some("rust-lld".into()),
6666 max_atomic_width: Some(64),
compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnux32.rs+4-2
......@@ -1,9 +1,11 @@
1use crate::spec::{Abi, Arch, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetMetadata, base};
1use crate::spec::{
2 Arch, Cc, CfgAbi, LinkerFlavor, Lld, StackProbeType, Target, TargetMetadata, base,
3};
24
35pub(crate) fn target() -> Target {
46 let mut base = base::linux_gnu::opts();
57 base.cpu = "x86-64".into();
6 base.abi = Abi::X32;
8 base.cfg_abi = CfgAbi::X32;
79 base.max_atomic_width = Some(64);
810 base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-mx32"]);
911 base.stack_probes = StackProbeType::Inline;
compiler/rustc_target/src/target_features.rs+11-11
......@@ -5,7 +5,7 @@ use rustc_data_structures::fx::{FxHashMap, FxHashSet};
55use rustc_macros::HashStable_Generic;
66use rustc_span::{Symbol, sym};
77
8use crate::spec::{Arch, FloatAbi, RustcAbi, Target};
8use crate::spec::{Arch, FloatAbi, LlvmAbi, RustcAbi, Target};
99
1010/// Features that control behaviour of rustc, rather than the codegen.
1111/// These exist globally and are not in the target-specific lists below.
......@@ -1174,20 +1174,20 @@ impl Target {
11741174 Arch::RiscV32 | Arch::RiscV64 => {
11751175 // RISC-V handles ABI in a very sane way, being fully explicit via `llvm_abiname`
11761176 // about what the intended ABI is.
1177 match &*self.llvm_abiname {
1178 "ilp32d" | "lp64d" => {
1177 match &self.llvm_abiname {
1178 LlvmAbi::Ilp32d | LlvmAbi::Lp64d => {
11791179 // Requires d (which implies f), incompatible with e and zfinx.
11801180 FeatureConstraints { required: &["d"], incompatible: &["e", "zfinx"] }
11811181 }
1182 "ilp32f" | "lp64f" => {
1182 LlvmAbi::Ilp32f | LlvmAbi::Lp64f => {
11831183 // Requires f, incompatible with e and zfinx.
11841184 FeatureConstraints { required: &["f"], incompatible: &["e", "zfinx"] }
11851185 }
1186 "ilp32" | "lp64" => {
1186 LlvmAbi::Ilp32 | LlvmAbi::Lp64 => {
11871187 // Requires nothing, incompatible with e.
11881188 FeatureConstraints { required: &[], incompatible: &["e"] }
11891189 }
1190 "ilp32e" => {
1190 LlvmAbi::Ilp32e => {
11911191 // ilp32e is documented to be incompatible with features that need aligned
11921192 // load/stores > 32 bits, like `d`. (One could also just generate more
11931193 // complicated code to align the stack when needed, but the RISCV
......@@ -1198,7 +1198,7 @@ impl Target {
11981198 // a program while the rest doesn't know they even exist.
11991199 FeatureConstraints { required: &[], incompatible: &["d"] }
12001200 }
1201 "lp64e" => {
1201 LlvmAbi::Lp64e => {
12021202 // As above, `e` is not required.
12031203 NOTHING
12041204 }
......@@ -1208,16 +1208,16 @@ impl Target {
12081208 Arch::LoongArch32 | Arch::LoongArch64 => {
12091209 // LoongArch handles ABI in a very sane way, being fully explicit via `llvm_abiname`
12101210 // about what the intended ABI is.
1211 match &*self.llvm_abiname {
1212 "ilp32d" | "lp64d" => {
1211 match &self.llvm_abiname {
1212 LlvmAbi::Ilp32d | LlvmAbi::Lp64d => {
12131213 // Requires d (which implies f), incompatible with nothing.
12141214 FeatureConstraints { required: &["d"], incompatible: &[] }
12151215 }
1216 "ilp32f" | "lp64f" => {
1216 LlvmAbi::Ilp32f | LlvmAbi::Lp64f => {
12171217 // Requires f, incompatible with nothing.
12181218 FeatureConstraints { required: &["f"], incompatible: &[] }
12191219 }
1220 "ilp32s" | "lp64s" => {
1220 LlvmAbi::Ilp32s | LlvmAbi::Lp64s => {
12211221 // The soft-float ABI does not require any features and is also not
12221222 // incompatible with any features. Rust targets explicitly specify the
12231223 // LLVM ABI names, which allows for enabling hard-float support even on
library/alloc/src/collections/binary_heap/mod.rs+31
......@@ -1364,6 +1364,37 @@ impl<T, A: Allocator> BinaryHeap<T, A> {
13641364 self.data.as_slice()
13651365 }
13661366
1367 /// Returns a mutable slice of all values in the underlying vector.
1368 ///
1369 /// # Safety
1370 ///
1371 /// The caller must ensure that the slice remains a max-heap, i.e. for all indices
1372 /// `0 < i < slice.len()`, `slice[(i - 1) / 2] >= slice[i]`, before the borrow ends
1373 /// and the binary heap is used.
1374 ///
1375 /// # Examples
1376 ///
1377 /// Basic usage:
1378 ///
1379 /// ```
1380 /// #![feature(binary_heap_as_mut_slice)]
1381 ///
1382 /// use std::collections::BinaryHeap;
1383 ///
1384 /// let mut heap = BinaryHeap::<u32>::from([1, 2, 3, 4, 5, 6, 7]);
1385 ///
1386 /// unsafe {
1387 /// for value in heap.as_mut_slice() {
1388 /// *value = (*value).saturating_mul(2);
1389 /// }
1390 /// }
1391 /// ```
1392 #[must_use]
1393 #[unstable(feature = "binary_heap_as_mut_slice", issue = "154009")]
1394 pub unsafe fn as_mut_slice(&mut self) -> &mut [T] {
1395 self.data.as_mut_slice()
1396 }
1397
13671398 /// Consumes the `BinaryHeap` and returns the underlying vector
13681399 /// in arbitrary order.
13691400 ///
library/alloc/src/collections/btree/append.rs-51
......@@ -1,38 +1,8 @@
11use core::alloc::Allocator;
2use core::iter::FusedIterator;
32
4use super::merge_iter::MergeIterInner;
53use super::node::{self, Root};
64
75impl<K, V> Root<K, V> {
8 /// Appends all key-value pairs from the union of two ascending iterators,
9 /// incrementing a `length` variable along the way. The latter makes it
10 /// easier for the caller to avoid a leak when a drop handler panicks.
11 ///
12 /// If both iterators produce the same key, this method drops the pair from
13 /// the left iterator and appends the pair from the right iterator.
14 ///
15 /// If you want the tree to end up in a strictly ascending order, like for
16 /// a `BTreeMap`, both iterators should produce keys in strictly ascending
17 /// order, each greater than all keys in the tree, including any keys
18 /// already in the tree upon entry.
19 pub(super) fn append_from_sorted_iters<I, A: Allocator + Clone>(
20 &mut self,
21 left: I,
22 right: I,
23 length: &mut usize,
24 alloc: A,
25 ) where
26 K: Ord,
27 I: Iterator<Item = (K, V)> + FusedIterator,
28 {
29 // We prepare to merge `left` and `right` into a sorted sequence in linear time.
30 let iter = MergeIter(MergeIterInner::new(left, right));
31
32 // Meanwhile, we build a tree from the sorted sequence in linear time.
33 self.bulk_push(iter, length, alloc)
34 }
35
366 /// Pushes all key-value pairs to the end of the tree, incrementing a
377 /// `length` variable along the way. The latter makes it easier for the
388 /// caller to avoid a leak when the iterator panicks.
......@@ -94,24 +64,3 @@ impl<K, V> Root<K, V> {
9464 self.fix_right_border_of_plentiful();
9565 }
9666}
97
98// An iterator for merging two sorted sequences into one
99struct MergeIter<K, V, I: Iterator<Item = (K, V)>>(MergeIterInner<I>);
100
101impl<K: Ord, V, I> Iterator for MergeIter<K, V, I>
102where
103 I: Iterator<Item = (K, V)> + FusedIterator,
104{
105 type Item = (K, V);
106
107 /// If two keys are equal, returns the key from the left and the value from the right.
108 fn next(&mut self) -> Option<(K, V)> {
109 let (a_next, b_next) = self.0.nexts(|a: &(K, V), b: &(K, V)| K::cmp(&a.0, &b.0));
110 match (a_next, b_next) {
111 (Some((a_k, _)), Some((_, b_v))) => Some((a_k, b_v)),
112 (Some(a), None) => Some(a),
113 (None, Some(b)) => Some(b),
114 (None, None) => None,
115 }
116 }
117}
library/alloc/src/collections/btree/map.rs+2-20
......@@ -1219,26 +1219,8 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
12191219 K: Ord,
12201220 A: Clone,
12211221 {
1222 // Do we have to append anything at all?
1223 if other.is_empty() {
1224 return;
1225 }
1226
1227 // We can just swap `self` and `other` if `self` is empty.
1228 if self.is_empty() {
1229 mem::swap(self, other);
1230 return;
1231 }
1232
1233 let self_iter = mem::replace(self, Self::new_in((*self.alloc).clone())).into_iter();
1234 let other_iter = mem::replace(other, Self::new_in((*self.alloc).clone())).into_iter();
1235 let root = self.root.get_or_insert_with(|| Root::new((*self.alloc).clone()));
1236 root.append_from_sorted_iters(
1237 self_iter,
1238 other_iter,
1239 &mut self.length,
1240 (*self.alloc).clone(),
1241 )
1222 let other = mem::replace(other, Self::new_in((*self.alloc).clone()));
1223 self.merge(other, |_key, _self_val, other_val| other_val);
12421224 }
12431225
12441226 /// Moves all elements from `other` into `self`, leaving `other` empty.
library/alloc/src/collections/btree/map/tests.rs+1-1
......@@ -2224,7 +2224,7 @@ fn test_append_drop_leak() {
22242224
22252225 catch_unwind(move || left.append(&mut right)).unwrap_err();
22262226 assert_eq!(a.dropped(), 1);
2227 assert_eq!(b.dropped(), 1); // should be 2 were it not for Rust issue #47949
2227 assert_eq!(b.dropped(), 2);
22282228 assert_eq!(c.dropped(), 2);
22292229}
22302230
library/core/src/iter/adapters/intersperse.rs+10-25
......@@ -1,5 +1,4 @@
11use crate::fmt;
2use crate::iter::{Fuse, FusedIterator};
32
43/// An iterator adapter that places a separator between all elements.
54///
......@@ -14,15 +13,7 @@ where
1413 started: bool,
1514 separator: I::Item,
1615 next_item: Option<I::Item>,
17 iter: Fuse<I>,
18}
19
20#[unstable(feature = "iter_intersperse", issue = "79524")]
21impl<I> FusedIterator for Intersperse<I>
22where
23 I: FusedIterator,
24 I::Item: Clone,
25{
16 iter: I,
2617}
2718
2819impl<I: Iterator> Intersperse<I>
......@@ -30,7 +21,7 @@ where
3021 I::Item: Clone,
3122{
3223 pub(in crate::iter) fn new(iter: I, separator: I::Item) -> Self {
33 Self { started: false, separator, next_item: None, iter: iter.fuse() }
24 Self { started: false, separator, next_item: None, iter }
3425 }
3526}
3627
......@@ -57,8 +48,9 @@ where
5748 }
5849 }
5950 } else {
60 self.started = true;
61 self.iter.next()
51 let item = self.iter.next();
52 self.started = item.is_some();
53 item
6254 }
6355 }
6456
......@@ -95,15 +87,7 @@ where
9587 started: bool,
9688 separator: G,
9789 next_item: Option<I::Item>,
98 iter: Fuse<I>,
99}
100
101#[unstable(feature = "iter_intersperse", issue = "79524")]
102impl<I, G> FusedIterator for IntersperseWith<I, G>
103where
104 I: FusedIterator,
105 G: FnMut() -> I::Item,
106{
90 iter: I,
10791}
10892
10993#[unstable(feature = "iter_intersperse", issue = "79524")]
......@@ -146,7 +130,7 @@ where
146130 G: FnMut() -> I::Item,
147131{
148132 pub(in crate::iter) fn new(iter: I, separator: G) -> Self {
149 Self { started: false, separator, next_item: None, iter: iter.fuse() }
133 Self { started: false, separator, next_item: None, iter }
150134 }
151135}
152136
......@@ -173,8 +157,9 @@ where
173157 }
174158 }
175159 } else {
176 self.started = true;
177 self.iter.next()
160 let item = self.iter.next();
161 self.started = item.is_some();
162 item
178163 }
179164 }
180165
library/core/src/iter/traits/iterator.rs+35-9
......@@ -635,11 +635,24 @@ pub const trait Iterator {
635635 /// of the original iterator.
636636 ///
637637 /// Specifically on fused iterators, it is guaranteed that the new iterator
638 /// places a copy of `separator` between adjacent `Some(_)` items. However,
639 /// for non-fused iterators, [`intersperse`] will create a new iterator that
640 /// is a fused version of the original iterator and place a copy of `separator`
641 /// between adjacent `Some(_)` items. This behavior for non-fused iterators
642 /// is subject to change.
638 /// places a copy of `separator` between *adjacent* `Some(_)` items. For non-fused iterators,
639 /// it is guaranteed that [`intersperse`] will create a new iterator that places a copy
640 /// of `separator` between `Some(_)` items, particularly just right before the subsequent
641 /// `Some(_)` item.
642 ///
643 /// For example, consider the following non-fused iterator:
644 ///
645 /// ```text
646 /// Some(1) -> Some(2) -> None -> Some(3) -> Some(4) -> ...
647 /// ```
648 ///
649 /// If this non-fused iterator were to be interspersed with `0`,
650 /// then the interspersed iterator will produce:
651 ///
652 /// ```text
653 /// Some(1) -> Some(0) -> Some(2) -> None -> Some(0) -> Some(3) -> Some(0) ->
654 /// Some(4) -> ...
655 /// ```
643656 ///
644657 /// In case `separator` does not implement [`Clone`] or needs to be
645658 /// computed every time, use [`intersperse_with`].
......@@ -688,10 +701,23 @@ pub const trait Iterator {
688701 ///
689702 /// Specifically on fused iterators, it is guaranteed that the new iterator
690703 /// places an item generated by `separator` between adjacent `Some(_)` items.
691 /// However, for non-fused iterators, [`intersperse_with`] will create a new
692 /// iterator that is a fused version of the original iterator and place an item
693 /// generated by `separator` between adjacent `Some(_)` items. This
694 /// behavior for non-fused iterators is subject to change.
704 /// For non-fused iterators, it is guaranteed that [`intersperse_with`] will
705 /// create a new iterator that places an item generated by `separator` between `Some(_)`
706 /// items, particularly just right before the subsequent `Some(_)` item.
707 ///
708 /// For example, consider the following non-fused iterator:
709 ///
710 /// ```text
711 /// Some(1) -> Some(2) -> None -> Some(3) -> Some(4) -> ...
712 /// ```
713 ///
714 /// If this non-fused iterator were to be interspersed with a `separator` closure
715 /// that returns `0` repeatedly, the interspersed iterator will produce:
716 ///
717 /// ```text
718 /// Some(1) -> Some(0) -> Some(2) -> None -> Some(0) -> Some(3) -> Some(0) ->
719 /// Some(4) -> ...
720 /// ```
695721 ///
696722 /// The `separator` closure will be called exactly once each time an item
697723 /// is placed between two adjacent items from the underlying iterator;
library/coretests/tests/array.rs+1-1
......@@ -646,7 +646,7 @@ fn array_mixed_equality_integers() {
646646
647647#[test]
648648fn array_mixed_equality_nans() {
649 let array3: [f32; 3] = [1.0, std::f32::NAN, 3.0];
649 let array3: [f32; 3] = [1.0, f32::NAN, 3.0];
650650
651651 let slice3: &[f32] = &{ array3 };
652652 assert!(!(array3 == slice3));
library/coretests/tests/iter/adapters/intersperse.rs+56-70
......@@ -153,10 +153,6 @@ fn test_try_fold_specialization_intersperse_err() {
153153 assert_eq!(iter.next(), None);
154154}
155155
156// FIXME(iter_intersperse): `intersperse` current behavior may change for
157// non-fused iterators, so this test will likely have to
158// be adjusted; see PR #152855 and issue #79524
159// if `intersperse` doesn't change, remove this FIXME.
160156#[test]
161157fn test_non_fused_iterator_intersperse() {
162158 #[derive(Debug)]
......@@ -183,24 +179,26 @@ fn test_non_fused_iterator_intersperse() {
183179 }
184180
185181 let counter = 0;
186 // places a 2 between `Some(_)` items
182 // places a 1 between `Some(_)` items
187183 let non_fused_iter = TestCounter { counter };
188 let mut intersperse_iter = non_fused_iter.intersperse(2);
189 // Since `intersperse` currently transforms the original
190 // iterator into a fused iterator, this intersperse_iter
191 // should always have `None`
192 for _ in 0..counter + 6 {
193 assert_eq!(intersperse_iter.next(), None);
194 }
184 let mut intersperse_iter = non_fused_iter.intersperse(1);
185 // Interspersed iter produces:
186 // `None` -> `Some(2)` -> `None` -> `Some(1)` -> Some(4)` -> `None` -> `Some(1)` ->
187 // `Some(6)` -> and then `None` endlessly
188 assert_eq!(intersperse_iter.next(), None);
189 assert_eq!(intersperse_iter.next(), Some(2));
190 assert_eq!(intersperse_iter.next(), None);
191 assert_eq!(intersperse_iter.next(), Some(1));
192 assert_eq!(intersperse_iter.next(), Some(4));
193 assert_eq!(intersperse_iter.next(), None);
194 assert_eq!(intersperse_iter.next(), Some(1));
195 assert_eq!(intersperse_iter.next(), Some(6));
196 assert_eq!(intersperse_iter.next(), None);
195197
196 // Extra check to make sure it is `None` after processing 6 items
198 // Extra check to make sure it is `None` after processing all items
197199 assert_eq!(intersperse_iter.next(), None);
198200}
199201
200// FIXME(iter_intersperse): `intersperse` current behavior may change for
201// non-fused iterators, so this test will likely have to
202// be adjusted; see PR #152855 and issue #79524
203// if `intersperse` doesn't change, remove this FIXME.
204202#[test]
205203fn test_non_fused_iterator_intersperse_2() {
206204 #[derive(Debug)]
......@@ -228,35 +226,26 @@ fn test_non_fused_iterator_intersperse_2() {
228226 }
229227
230228 let counter = 0;
231 // places a 2 between `Some(_)` items
229 // places a 100 between `Some(_)` items
232230 let non_fused_iter = TestCounter { counter };
233 let mut intersperse_iter = non_fused_iter.intersperse(2);
234 // Since `intersperse` currently transforms the original
235 // iterator into a fused iterator, this interspersed iter
236 // will be `Some(1)` -> `Some(2)` -> `Some(2)` -> and then
237 // `None` endlessly
238 let mut items_processed = 0;
239 for num in 0..counter + 6 {
240 if num < 3 {
241 if num % 2 != 0 {
242 assert_eq!(intersperse_iter.next(), Some(2));
243 } else {
244 items_processed += 1;
245 assert_eq!(intersperse_iter.next(), Some(items_processed));
246 }
247 } else {
248 assert_eq!(intersperse_iter.next(), None);
249 }
250 }
231 let mut intersperse_iter = non_fused_iter.intersperse(100);
232 // Interspersed iter produces:
233 // `Some(1)` -> `Some(100)` -> `Some(2)` -> `None` -> `Some(100)`
234 // -> `Some(4)` -> `Some(100)` -> `Some(5)` -> `None` endlessly
235 assert_eq!(intersperse_iter.next(), Some(1));
236 assert_eq!(intersperse_iter.next(), Some(100));
237 assert_eq!(intersperse_iter.next(), Some(2));
238 assert_eq!(intersperse_iter.next(), None);
239 assert_eq!(intersperse_iter.next(), Some(100));
240 assert_eq!(intersperse_iter.next(), Some(4));
241 assert_eq!(intersperse_iter.next(), Some(100));
242 assert_eq!(intersperse_iter.next(), Some(5));
243 assert_eq!(intersperse_iter.next(), None);
251244
252245 // Extra check to make sure it is `None` after processing 6 items
253246 assert_eq!(intersperse_iter.next(), None);
254247}
255248
256// FIXME(iter_intersperse): `intersperse_with` current behavior may change for
257// non-fused iterators, so this test will likely have to
258// be adjusted; see PR #152855 and issue #79524
259// if `intersperse_with` doesn't change, remove this FIXME.
260249#[test]
261250fn test_non_fused_iterator_intersperse_with() {
262251 #[derive(Debug)]
......@@ -285,22 +274,24 @@ fn test_non_fused_iterator_intersperse_with() {
285274 let counter = 0;
286275 let non_fused_iter = TestCounter { counter };
287276 // places a 2 between `Some(_)` items
288 let mut intersperse_iter = non_fused_iter.intersperse_with(|| 2);
289 // Since `intersperse` currently transforms the original
290 // iterator into a fused iterator, this intersperse_iter
291 // should always have `None`
292 for _ in 0..counter + 6 {
293 assert_eq!(intersperse_iter.next(), None);
294 }
277 let mut intersperse_iter = non_fused_iter.intersperse_with(|| 1);
278 // Interspersed iter produces:
279 // `None` -> `Some(2)` -> `None` -> `Some(1)` -> Some(4)` -> `None` -> `Some(1)` ->
280 // `Some(6)` -> and then `None` endlessly
281 assert_eq!(intersperse_iter.next(), None);
282 assert_eq!(intersperse_iter.next(), Some(2));
283 assert_eq!(intersperse_iter.next(), None);
284 assert_eq!(intersperse_iter.next(), Some(1));
285 assert_eq!(intersperse_iter.next(), Some(4));
286 assert_eq!(intersperse_iter.next(), None);
287 assert_eq!(intersperse_iter.next(), Some(1));
288 assert_eq!(intersperse_iter.next(), Some(6));
289 assert_eq!(intersperse_iter.next(), None);
295290
296291 // Extra check to make sure it is `None` after processing 6 items
297292 assert_eq!(intersperse_iter.next(), None);
298293}
299294
300// FIXME(iter_intersperse): `intersperse_with` current behavior may change for
301// non-fused iterators, so this test will likely have to
302// be adjusted; see PR #152855 and issue #79524
303// if `intersperse_with` doesn't change, remove this FIXME.
304295#[test]
305296fn test_non_fused_iterator_intersperse_with_2() {
306297 #[derive(Debug)]
......@@ -328,26 +319,21 @@ fn test_non_fused_iterator_intersperse_with_2() {
328319 }
329320
330321 let counter = 0;
331 // places a 2 between `Some(_)` items
322 // places a 100 between `Some(_)` items
332323 let non_fused_iter = TestCounter { counter };
333 let mut intersperse_iter = non_fused_iter.intersperse(2);
334 // Since `intersperse` currently transforms the original
335 // iterator into a fused iterator, this interspersed iter
336 // will be `Some(1)` -> `Some(2)` -> `Some(2)` -> and then
337 // `None` endlessly
338 let mut items_processed = 0;
339 for num in 0..counter + 6 {
340 if num < 3 {
341 if num % 2 != 0 {
342 assert_eq!(intersperse_iter.next(), Some(2));
343 } else {
344 items_processed += 1;
345 assert_eq!(intersperse_iter.next(), Some(items_processed));
346 }
347 } else {
348 assert_eq!(intersperse_iter.next(), None);
349 }
350 }
324 let mut intersperse_iter = non_fused_iter.intersperse_with(|| 100);
325 // Interspersed iter produces:
326 // `Some(1)` -> `Some(100)` -> `Some(2)` -> `None` -> `Some(100)`
327 // -> `Some(4)` -> `Some(100)` -> `Some(5)` -> `None` endlessly
328 assert_eq!(intersperse_iter.next(), Some(1));
329 assert_eq!(intersperse_iter.next(), Some(100));
330 assert_eq!(intersperse_iter.next(), Some(2));
331 assert_eq!(intersperse_iter.next(), None);
332 assert_eq!(intersperse_iter.next(), Some(100));
333 assert_eq!(intersperse_iter.next(), Some(4));
334 assert_eq!(intersperse_iter.next(), Some(100));
335 assert_eq!(intersperse_iter.next(), Some(5));
336 assert_eq!(intersperse_iter.next(), None);
351337
352338 // Extra check to make sure it is `None` after processing 6 items
353339 assert_eq!(intersperse_iter.next(), None);
library/coretests/tests/num/int_macros.rs+2-1
......@@ -2,7 +2,8 @@ macro_rules! int_module {
22 ($T:ident, $U:ident) => {
33 use core::num::ParseIntError;
44 use core::ops::{BitAnd, BitOr, BitXor, Not, Shl, Shr};
5 use core::$T::*;
5 const MAX: $T = $T::MAX;
6 const MIN: $T = $T::MIN;
67
78 const UMAX: $U = $U::MAX;
89
library/coretests/tests/num/uint_macros.rs+7-8
......@@ -2,15 +2,14 @@ macro_rules! uint_module {
22 ($T:ident) => {
33 use core::num::ParseIntError;
44 use core::ops::{BitAnd, BitOr, BitXor, Not, Shl, Shr};
5 use core::$T::*;
65
76 use crate::num;
87
98 #[test]
109 fn test_overflows() {
11 assert!(MAX > 0);
12 assert!(MIN <= 0);
13 assert!((MIN + MAX).wrapping_add(1) == 0);
10 assert!($T::MAX > 0);
11 assert!($T::MIN <= 0);
12 assert!(($T::MIN + $T::MAX).wrapping_add(1) == 0);
1413 }
1514
1615 #[test]
......@@ -25,7 +24,7 @@ macro_rules! uint_module {
2524 assert!(0b0110 as $T == (0b1100 as $T).bitxor(0b1010 as $T));
2625 assert!(0b1110 as $T == (0b0111 as $T).shl(1));
2726 assert!(0b0111 as $T == (0b1110 as $T).shr(1));
28 assert!(MAX - (0b1011 as $T) == (0b1011 as $T).not());
27 assert!($T::MAX - (0b1011 as $T) == (0b1011 as $T).not());
2928 }
3029
3130 const A: $T = 0b0101100;
......@@ -361,7 +360,7 @@ macro_rules! uint_module {
361360 assert_eq_const_safe!($T: R.wrapping_pow(2), 1 as $T);
362361 assert_eq_const_safe!(Option<$T>: R.checked_pow(2), None);
363362 assert_eq_const_safe!(($T, bool): R.overflowing_pow(2), (1 as $T, true));
364 assert_eq_const_safe!($T: R.saturating_pow(2), MAX);
363 assert_eq_const_safe!($T: R.saturating_pow(2), $T::MAX);
365364 }
366365 }
367366
......@@ -468,14 +467,14 @@ macro_rules! uint_module {
468467 fn test_next_multiple_of() {
469468 assert_eq_const_safe!($T: (16 as $T).next_multiple_of(8), 16);
470469 assert_eq_const_safe!($T: (23 as $T).next_multiple_of(8), 24);
471 assert_eq_const_safe!($T: MAX.next_multiple_of(1), MAX);
470 assert_eq_const_safe!($T: $T::MAX.next_multiple_of(1), $T::MAX);
472471 }
473472
474473 fn test_checked_next_multiple_of() {
475474 assert_eq_const_safe!(Option<$T>: (16 as $T).checked_next_multiple_of(8), Some(16));
476475 assert_eq_const_safe!(Option<$T>: (23 as $T).checked_next_multiple_of(8), Some(24));
477476 assert_eq_const_safe!(Option<$T>: (1 as $T).checked_next_multiple_of(0), None);
478 assert_eq_const_safe!(Option<$T>: MAX.checked_next_multiple_of(2), None);
477 assert_eq_const_safe!(Option<$T>: $T::MAX.checked_next_multiple_of(2), None);
479478 }
480479
481480 fn test_is_next_multiple_of() {
library/std/src/env.rs+10-10
......@@ -15,7 +15,7 @@ use crate::ffi::{OsStr, OsString};
1515use crate::num::NonZero;
1616use crate::ops::Try;
1717use crate::path::{Path, PathBuf};
18use crate::sys::{env as env_imp, os as os_imp};
18use crate::sys::{env as env_imp, paths as paths_imp};
1919use crate::{array, fmt, io, sys};
2020
2121/// Returns the current working directory as a [`PathBuf`].
......@@ -51,7 +51,7 @@ use crate::{array, fmt, io, sys};
5151#[doc(alias = "GetCurrentDirectory")]
5252#[stable(feature = "env", since = "1.0.0")]
5353pub fn current_dir() -> io::Result<PathBuf> {
54 os_imp::getcwd()
54 paths_imp::getcwd()
5555}
5656
5757/// Changes the current working directory to the specified path.
......@@ -78,7 +78,7 @@ pub fn current_dir() -> io::Result<PathBuf> {
7878#[doc(alias = "chdir", alias = "SetCurrentDirectory", alias = "SetCurrentDirectoryW")]
7979#[stable(feature = "env", since = "1.0.0")]
8080pub fn set_current_dir<P: AsRef<Path>>(path: P) -> io::Result<()> {
81 os_imp::chdir(path.as_ref())
81 paths_imp::chdir(path.as_ref())
8282}
8383
8484/// An iterator over a snapshot of the environment variables of this process.
......@@ -444,7 +444,7 @@ pub unsafe fn remove_var<K: AsRef<OsStr>>(key: K) {
444444#[must_use = "iterators are lazy and do nothing unless consumed"]
445445#[stable(feature = "env", since = "1.0.0")]
446446pub struct SplitPaths<'a> {
447 inner: os_imp::SplitPaths<'a>,
447 inner: paths_imp::SplitPaths<'a>,
448448}
449449
450450/// Parses input according to platform conventions for the `PATH`
......@@ -480,7 +480,7 @@ pub struct SplitPaths<'a> {
480480/// ```
481481#[stable(feature = "env", since = "1.0.0")]
482482pub fn split_paths<T: AsRef<OsStr> + ?Sized>(unparsed: &T) -> SplitPaths<'_> {
483 SplitPaths { inner: os_imp::split_paths(unparsed.as_ref()) }
483 SplitPaths { inner: paths_imp::split_paths(unparsed.as_ref()) }
484484}
485485
486486#[stable(feature = "env", since = "1.0.0")]
......@@ -508,7 +508,7 @@ impl fmt::Debug for SplitPaths<'_> {
508508#[derive(Debug)]
509509#[stable(feature = "env", since = "1.0.0")]
510510pub struct JoinPathsError {
511 inner: os_imp::JoinPathsError,
511 inner: paths_imp::JoinPathsError,
512512}
513513
514514/// Joins a collection of [`Path`]s appropriately for the `PATH`
......@@ -579,7 +579,7 @@ where
579579 I: IntoIterator<Item = T>,
580580 T: AsRef<OsStr>,
581581{
582 os_imp::join_paths(paths.into_iter()).map_err(|e| JoinPathsError { inner: e })
582 paths_imp::join_paths(paths.into_iter()).map_err(|e| JoinPathsError { inner: e })
583583}
584584
585585#[stable(feature = "env", since = "1.0.0")]
......@@ -641,7 +641,7 @@ impl Error for JoinPathsError {
641641#[must_use]
642642#[stable(feature = "env", since = "1.0.0")]
643643pub fn home_dir() -> Option<PathBuf> {
644 os_imp::home_dir()
644 paths_imp::home_dir()
645645}
646646
647647/// Returns the path of a temporary directory.
......@@ -701,7 +701,7 @@ pub fn home_dir() -> Option<PathBuf> {
701701#[doc(alias = "GetTempPath", alias = "GetTempPath2")]
702702#[stable(feature = "env", since = "1.0.0")]
703703pub fn temp_dir() -> PathBuf {
704 os_imp::temp_dir()
704 paths_imp::temp_dir()
705705}
706706
707707/// Returns the full filesystem path of the current running executable.
......@@ -752,7 +752,7 @@ pub fn temp_dir() -> PathBuf {
752752/// ```
753753#[stable(feature = "env", since = "1.0.0")]
754754pub fn current_exe() -> io::Result<PathBuf> {
755 os_imp::current_exe()
755 paths_imp::current_exe()
756756}
757757
758758/// An iterator over the arguments of a process, yielding a [`String`] value for
library/std/src/fs.rs+8-6
......@@ -815,7 +815,8 @@ impl File {
815815
816816 /// Acquire an exclusive lock on the file. Blocks until the lock can be acquired.
817817 ///
818 /// This acquires an exclusive lock; no other file handle to this file may acquire another lock.
818 /// This acquires an exclusive lock; no other file handle to this file, in this or any other
819 /// process, may acquire another lock.
819820 ///
820821 /// This lock may be advisory or mandatory. This lock is meant to interact with [`lock`],
821822 /// [`try_lock`], [`lock_shared`], [`try_lock_shared`], and [`unlock`]. Its interactions with
......@@ -868,8 +869,8 @@ impl File {
868869
869870 /// Acquire a shared (non-exclusive) lock on the file. Blocks until the lock can be acquired.
870871 ///
871 /// This acquires a shared lock; more than one file handle may hold a shared lock, but none may
872 /// hold an exclusive lock at the same time.
872 /// This acquires a shared lock; more than one file handle, in this or any other process, may
873 /// hold a shared lock, but none may hold an exclusive lock at the same time.
873874 ///
874875 /// This lock may be advisory or mandatory. This lock is meant to interact with [`lock`],
875876 /// [`try_lock`], [`lock_shared`], [`try_lock_shared`], and [`unlock`]. Its interactions with
......@@ -923,7 +924,8 @@ impl File {
923924 /// Returns `Err(TryLockError::WouldBlock)` if a different lock is already held on this file
924925 /// (via another handle/descriptor).
925926 ///
926 /// This acquires an exclusive lock; no other file handle to this file may acquire another lock.
927 /// This acquires an exclusive lock; no other file handle to this file, in this or any other
928 /// process, may acquire another lock.
927929 ///
928930 /// This lock may be advisory or mandatory. This lock is meant to interact with [`lock`],
929931 /// [`try_lock`], [`lock_shared`], [`try_lock_shared`], and [`unlock`]. Its interactions with
......@@ -987,8 +989,8 @@ impl File {
987989 /// Returns `Err(TryLockError::WouldBlock)` if a different lock is already held on this file
988990 /// (via another handle/descriptor).
989991 ///
990 /// This acquires a shared lock; more than one file handle may hold a shared lock, but none may
991 /// hold an exclusive lock at the same time.
992 /// This acquires a shared lock; more than one file handle, in this or any other process, may
993 /// hold a shared lock, but none may hold an exclusive lock at the same time.
992994 ///
993995 /// This lock may be advisory or mandatory. This lock is meant to interact with [`lock`],
994996 /// [`try_lock`], [`lock_shared`], [`try_lock_shared`], and [`unlock`]. Its interactions with
library/std/src/os/windows/fs.rs+23-12
......@@ -138,6 +138,8 @@ impl FileExt for fs::File {
138138}
139139
140140/// Windows-specific extensions to [`fs::OpenOptions`].
141// WARNING: This trait is not sealed. DON'T add any new methods!
142// Add them to OpenOptionsExt2 instead.
141143#[stable(feature = "open_options_ext", since = "1.10.0")]
142144pub trait OpenOptionsExt {
143145 /// Overrides the `dwDesiredAccess` argument to the call to [`CreateFile`]
......@@ -305,18 +307,6 @@ pub trait OpenOptionsExt {
305307 /// https://docs.microsoft.com/en-us/windows/win32/api/winnt/ne-winnt-security_impersonation_level
306308 #[stable(feature = "open_options_ext", since = "1.10.0")]
307309 fn security_qos_flags(&mut self, flags: u32) -> &mut Self;
308
309 /// If set to `true`, prevent the "last access time" of the file from being changed.
310 ///
311 /// Default to `false`.
312 #[unstable(feature = "windows_freeze_file_times", issue = "149715")]
313 fn freeze_last_access_time(&mut self, freeze: bool) -> &mut Self;
314
315 /// If set to `true`, prevent the "last write time" of the file from being changed.
316 ///
317 /// Default to `false`.
318 #[unstable(feature = "windows_freeze_file_times", issue = "149715")]
319 fn freeze_last_write_time(&mut self, freeze: bool) -> &mut Self;
320310}
321311
322312#[stable(feature = "open_options_ext", since = "1.10.0")]
......@@ -345,7 +335,28 @@ impl OpenOptionsExt for OpenOptions {
345335 self.as_inner_mut().security_qos_flags(flags);
346336 self
347337 }
338}
339
340#[unstable(feature = "windows_freeze_file_times", issue = "149715")]
341pub trait OpenOptionsExt2: Sealed {
342 /// If set to `true`, prevent the "last access time" of the file from being changed.
343 ///
344 /// Default to `false`.
345 #[unstable(feature = "windows_freeze_file_times", issue = "149715")]
346 fn freeze_last_access_time(&mut self, freeze: bool) -> &mut Self;
347
348 /// If set to `true`, prevent the "last write time" of the file from being changed.
349 ///
350 /// Default to `false`.
351 #[unstable(feature = "windows_freeze_file_times", issue = "149715")]
352 fn freeze_last_write_time(&mut self, freeze: bool) -> &mut Self;
353}
354
355#[unstable(feature = "sealed", issue = "none")]
356impl Sealed for OpenOptions {}
348357
358#[unstable(feature = "windows_freeze_file_times", issue = "149715")]
359impl OpenOptionsExt2 for OpenOptions {
349360 fn freeze_last_access_time(&mut self, freeze: bool) -> &mut Self {
350361 self.as_inner_mut().freeze_last_access_time(freeze);
351362 self
library/std/src/sys/args/windows.rs+1-1
......@@ -12,9 +12,9 @@ use crate::num::NonZero;
1212use crate::os::windows::prelude::*;
1313use crate::path::{Path, PathBuf};
1414use crate::sys::helpers::WStrUnits;
15use crate::sys::pal::os::current_exe;
1615use crate::sys::pal::{ensure_no_nuls, fill_utf16_buf};
1716use crate::sys::path::get_long_path;
17use crate::sys::paths::current_exe;
1818use crate::sys::{AsInner, c, to_u16s};
1919use crate::{io, iter, ptr};
2020
library/std/src/sys/env/unix.rs+18-1
......@@ -38,8 +38,25 @@ pub unsafe fn environ() -> *mut *const *const c_char {
3838 unsafe { libc::_NSGetEnviron() as *mut *const *const c_char }
3939}
4040
41// On FreeBSD, environ comes from CRT rather than libc
42#[cfg(target_os = "freebsd")]
43pub unsafe fn environ() -> *mut *const *const c_char {
44 use crate::sync::LazyLock;
45
46 struct Environ(*mut *const *const c_char);
47 unsafe impl Send for Environ {}
48 unsafe impl Sync for Environ {}
49
50 static ENVIRON: LazyLock<Environ> = LazyLock::new(|| {
51 Environ(unsafe {
52 libc::dlsym(libc::RTLD_DEFAULT, c"environ".as_ptr()) as *mut *const *const c_char
53 })
54 });
55 ENVIRON.0
56}
57
4158// Use the `environ` static which is part of POSIX.
42#[cfg(not(target_vendor = "apple"))]
59#[cfg(not(any(target_os = "freebsd", target_vendor = "apple")))]
4360pub unsafe fn environ() -> *mut *const *const c_char {
4461 unsafe extern "C" {
4562 static mut environ: *const *const c_char;
library/std/src/sys/io/error/windows.rs+3
......@@ -1,6 +1,9 @@
11use crate::sys::pal::{api, c};
22use crate::{io, ptr};
33
4#[cfg(test)]
5mod tests;
6
47pub fn errno() -> i32 {
58 api::get_last_error().code as i32
69}
library/std/src/sys/io/error/windows/tests.rs created+13
......@@ -0,0 +1,13 @@
1use crate::io::Error;
2use crate::sys::pal::c;
3
4// tests `error_string` above
5#[test]
6fn ntstatus_error() {
7 const STATUS_UNSUCCESSFUL: u32 = 0xc000_0001;
8 assert!(
9 !Error::from_raw_os_error((STATUS_UNSUCCESSFUL | c::FACILITY_NT_BIT) as _)
10 .to_string()
11 .contains("FormatMessageW() returned error")
12 );
13}
library/std/src/sys/mod.rs+1
......@@ -18,6 +18,7 @@ pub mod io;
1818pub mod net;
1919pub mod os_str;
2020pub mod path;
21pub mod paths;
2122pub mod pipe;
2223pub mod platform_version;
2324pub mod process;
library/std/src/sys/pal/hermit/mod.rs-1
......@@ -22,7 +22,6 @@ use crate::os::raw::c_char;
2222use crate::sys::env;
2323
2424pub mod futex;
25pub mod os;
2625pub mod time;
2726
2827pub fn unsupported<T>() -> io::Result<T> {
library/std/src/sys/pal/hermit/os.rs deleted-57
......@@ -1,57 +0,0 @@
1use crate::ffi::{OsStr, OsString};
2use crate::marker::PhantomData;
3use crate::path::{self, PathBuf};
4use crate::sys::unsupported;
5use crate::{fmt, io};
6
7pub fn getcwd() -> io::Result<PathBuf> {
8 Ok(PathBuf::from("/"))
9}
10
11pub fn chdir(_: &path::Path) -> io::Result<()> {
12 unsupported()
13}
14
15pub struct SplitPaths<'a>(!, PhantomData<&'a ()>);
16
17pub fn split_paths(_unparsed: &OsStr) -> SplitPaths<'_> {
18 panic!("unsupported")
19}
20
21impl<'a> Iterator for SplitPaths<'a> {
22 type Item = PathBuf;
23 fn next(&mut self) -> Option<PathBuf> {
24 self.0
25 }
26}
27
28#[derive(Debug)]
29pub struct JoinPathsError;
30
31pub fn join_paths<I, T>(_paths: I) -> Result<OsString, JoinPathsError>
32where
33 I: Iterator<Item = T>,
34 T: AsRef<OsStr>,
35{
36 Err(JoinPathsError)
37}
38
39impl fmt::Display for JoinPathsError {
40 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
41 "not supported on hermit yet".fmt(f)
42 }
43}
44
45impl crate::error::Error for JoinPathsError {}
46
47pub fn current_exe() -> io::Result<PathBuf> {
48 unsupported()
49}
50
51pub fn temp_dir() -> PathBuf {
52 PathBuf::from("/tmp")
53}
54
55pub fn home_dir() -> Option<PathBuf> {
56 None
57}
library/std/src/sys/pal/motor/mod.rs-2
......@@ -1,7 +1,5 @@
11#![allow(unsafe_op_in_unsafe_fn)]
22
3pub mod os;
4
53pub use moto_rt::futex;
64
75use crate::io;
library/std/src/sys/pal/motor/os.rs deleted-64
......@@ -1,64 +0,0 @@
1use super::map_motor_error;
2use crate::error::Error as StdError;
3use crate::ffi::{OsStr, OsString};
4use crate::marker::PhantomData;
5use crate::os::motor::ffi::OsStrExt;
6use crate::path::{self, PathBuf};
7use crate::{fmt, io};
8
9pub fn getcwd() -> io::Result<PathBuf> {
10 moto_rt::fs::getcwd().map(PathBuf::from).map_err(map_motor_error)
11}
12
13pub fn chdir(path: &path::Path) -> io::Result<()> {
14 moto_rt::fs::chdir(path.as_os_str().as_str()).map_err(map_motor_error)
15}
16
17pub struct SplitPaths<'a>(!, PhantomData<&'a ()>);
18
19pub fn split_paths(_unparsed: &OsStr) -> SplitPaths<'_> {
20 panic!("unsupported")
21}
22
23impl<'a> Iterator for SplitPaths<'a> {
24 type Item = PathBuf;
25 fn next(&mut self) -> Option<PathBuf> {
26 self.0
27 }
28}
29
30#[derive(Debug)]
31pub struct JoinPathsError;
32
33pub fn join_paths<I, T>(_paths: I) -> Result<OsString, JoinPathsError>
34where
35 I: Iterator<Item = T>,
36 T: AsRef<OsStr>,
37{
38 Err(JoinPathsError)
39}
40
41impl fmt::Display for JoinPathsError {
42 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
43 "not supported on this platform yet".fmt(f)
44 }
45}
46
47impl StdError for JoinPathsError {
48 #[allow(deprecated)]
49 fn description(&self) -> &str {
50 "not supported on this platform yet"
51 }
52}
53
54pub fn current_exe() -> io::Result<PathBuf> {
55 moto_rt::process::current_exe().map(PathBuf::from).map_err(map_motor_error)
56}
57
58pub fn temp_dir() -> PathBuf {
59 PathBuf::from(moto_rt::fs::TEMP_DIR)
60}
61
62pub fn home_dir() -> Option<PathBuf> {
63 None
64}
library/std/src/sys/pal/sgx/mod.rs-1
......@@ -10,7 +10,6 @@ use crate::sync::atomic::{Atomic, AtomicBool, Ordering};
1010
1111pub mod abi;
1212mod libunwind_integration;
13pub mod os;
1413pub mod thread_parking;
1514pub mod waitqueue;
1615
library/std/src/sys/pal/sgx/os.rs deleted-57
......@@ -1,57 +0,0 @@
1use crate::ffi::{OsStr, OsString};
2use crate::marker::PhantomData;
3use crate::path::{self, PathBuf};
4use crate::sys::{sgx_ineffective, unsupported};
5use crate::{fmt, io};
6
7pub fn getcwd() -> io::Result<PathBuf> {
8 unsupported()
9}
10
11pub fn chdir(_: &path::Path) -> io::Result<()> {
12 sgx_ineffective(())
13}
14
15pub struct SplitPaths<'a>(!, PhantomData<&'a ()>);
16
17pub fn split_paths(_unparsed: &OsStr) -> SplitPaths<'_> {
18 panic!("unsupported")
19}
20
21impl<'a> Iterator for SplitPaths<'a> {
22 type Item = PathBuf;
23 fn next(&mut self) -> Option<PathBuf> {
24 self.0
25 }
26}
27
28#[derive(Debug)]
29pub struct JoinPathsError;
30
31pub fn join_paths<I, T>(_paths: I) -> Result<OsString, JoinPathsError>
32where
33 I: Iterator<Item = T>,
34 T: AsRef<OsStr>,
35{
36 Err(JoinPathsError)
37}
38
39impl fmt::Display for JoinPathsError {
40 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
41 "not supported in SGX yet".fmt(f)
42 }
43}
44
45impl crate::error::Error for JoinPathsError {}
46
47pub fn current_exe() -> io::Result<PathBuf> {
48 unsupported()
49}
50
51pub fn temp_dir() -> PathBuf {
52 panic!("no filesystem in SGX")
53}
54
55pub fn home_dir() -> Option<PathBuf> {
56 None
57}
library/std/src/sys/pal/solid/mod.rs-1
......@@ -19,7 +19,6 @@ pub mod itron {
1919// `error` is `pub(crate)` so that it can be accessed by `itron/error.rs` as
2020// `crate::sys::error`
2121pub(crate) mod error;
22pub mod os;
2322pub use self::itron::thread_parking;
2423
2524// SAFETY: must be called only once during runtime initialization.
library/std/src/sys/pal/solid/os.rs deleted-56
......@@ -1,56 +0,0 @@
1use super::unsupported;
2use crate::ffi::{OsStr, OsString};
3use crate::path::{self, PathBuf};
4use crate::{fmt, io};
5
6pub fn getcwd() -> io::Result<PathBuf> {
7 unsupported()
8}
9
10pub fn chdir(_: &path::Path) -> io::Result<()> {
11 unsupported()
12}
13
14pub struct SplitPaths<'a>(&'a !);
15
16pub fn split_paths(_unparsed: &OsStr) -> SplitPaths<'_> {
17 panic!("unsupported")
18}
19
20impl<'a> Iterator for SplitPaths<'a> {
21 type Item = PathBuf;
22 fn next(&mut self) -> Option<PathBuf> {
23 *self.0
24 }
25}
26
27#[derive(Debug)]
28pub struct JoinPathsError;
29
30pub fn join_paths<I, T>(_paths: I) -> Result<OsString, JoinPathsError>
31where
32 I: Iterator<Item = T>,
33 T: AsRef<OsStr>,
34{
35 Err(JoinPathsError)
36}
37
38impl fmt::Display for JoinPathsError {
39 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
40 "not supported on this platform yet".fmt(f)
41 }
42}
43
44impl crate::error::Error for JoinPathsError {}
45
46pub fn current_exe() -> io::Result<PathBuf> {
47 unsupported()
48}
49
50pub fn temp_dir() -> PathBuf {
51 panic!("no standard temporary directory on this platform")
52}
53
54pub fn home_dir() -> Option<PathBuf> {
55 None
56}
library/std/src/sys/pal/teeos/mod.rs-1
......@@ -7,7 +7,6 @@
77#![allow(dead_code)]
88
99pub mod conf;
10pub mod os;
1110#[path = "../unix/time.rs"]
1211pub mod time;
1312
library/std/src/sys/pal/teeos/os.rs deleted-62
......@@ -1,62 +0,0 @@
1//! Implementation of `std::os` functionality for teeos
2
3use core::marker::PhantomData;
4
5use super::unsupported;
6use crate::ffi::{OsStr, OsString};
7use crate::path::PathBuf;
8use crate::{fmt, io, path};
9
10// Everything below are stubs and copied from unsupported.rs
11
12pub fn getcwd() -> io::Result<PathBuf> {
13 unsupported()
14}
15
16pub fn chdir(_: &path::Path) -> io::Result<()> {
17 unsupported()
18}
19
20pub struct SplitPaths<'a>(!, PhantomData<&'a ()>);
21
22pub fn split_paths(_unparsed: &OsStr) -> SplitPaths<'_> {
23 panic!("unsupported")
24}
25
26impl<'a> Iterator for SplitPaths<'a> {
27 type Item = PathBuf;
28 fn next(&mut self) -> Option<PathBuf> {
29 self.0
30 }
31}
32
33#[derive(Debug)]
34pub struct JoinPathsError;
35
36pub fn join_paths<I, T>(_paths: I) -> Result<OsString, JoinPathsError>
37where
38 I: Iterator<Item = T>,
39 T: AsRef<OsStr>,
40{
41 Err(JoinPathsError)
42}
43
44impl fmt::Display for JoinPathsError {
45 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
46 "not supported on this platform yet".fmt(f)
47 }
48}
49
50impl crate::error::Error for JoinPathsError {}
51
52pub fn current_exe() -> io::Result<PathBuf> {
53 unsupported()
54}
55
56pub fn temp_dir() -> PathBuf {
57 panic!("no filesystem on this platform")
58}
59
60pub fn home_dir() -> Option<PathBuf> {
61 None
62}
library/std/src/sys/pal/trusty/mod.rs-2
......@@ -3,7 +3,5 @@
33#[path = "../unsupported/common.rs"]
44#[deny(unsafe_op_in_unsafe_fn)]
55mod common;
6#[path = "../unsupported/os.rs"]
7pub mod os;
86
97pub use common::*;
library/std/src/sys/pal/uefi/mod.rs-1
......@@ -14,7 +14,6 @@
1414#![forbid(unsafe_op_in_unsafe_fn)]
1515
1616pub mod helpers;
17pub mod os;
1817pub mod system_time;
1918
2019#[cfg(test)]
library/std/src/sys/pal/uefi/os.rs deleted-123
......@@ -1,123 +0,0 @@
1use r_efi::efi::protocols::{device_path, loaded_image_device_path};
2
3use super::{helpers, unsupported_err};
4use crate::ffi::{OsStr, OsString};
5use crate::os::uefi::ffi::{OsStrExt, OsStringExt};
6use crate::path::{self, PathBuf};
7use crate::{fmt, io};
8
9const PATHS_SEP: u16 = b';' as u16;
10
11pub fn getcwd() -> io::Result<PathBuf> {
12 match helpers::open_shell() {
13 Some(shell) => {
14 // SAFETY: path_ptr is managed by UEFI shell and should not be deallocated
15 let path_ptr = unsafe { ((*shell.as_ptr()).get_cur_dir)(crate::ptr::null_mut()) };
16 helpers::os_string_from_raw(path_ptr)
17 .map(PathBuf::from)
18 .ok_or(io::const_error!(io::ErrorKind::InvalidData, "invalid path"))
19 }
20 None => {
21 let mut t = current_exe()?;
22 // SAFETY: This should never fail since the disk prefix will be present even for root
23 // executables
24 assert!(t.pop());
25 Ok(t)
26 }
27 }
28}
29
30pub fn chdir(p: &path::Path) -> io::Result<()> {
31 let shell = helpers::open_shell().ok_or(unsupported_err())?;
32
33 let mut p = helpers::os_string_to_raw(p.as_os_str())
34 .ok_or(io::const_error!(io::ErrorKind::InvalidData, "invalid path"))?;
35
36 let r = unsafe { ((*shell.as_ptr()).set_cur_dir)(crate::ptr::null_mut(), p.as_mut_ptr()) };
37 if r.is_error() { Err(io::Error::from_raw_os_error(r.as_usize())) } else { Ok(()) }
38}
39
40pub struct SplitPaths<'a> {
41 data: crate::os::uefi::ffi::EncodeWide<'a>,
42 must_yield: bool,
43}
44
45pub fn split_paths(unparsed: &OsStr) -> SplitPaths<'_> {
46 SplitPaths { data: unparsed.encode_wide(), must_yield: true }
47}
48
49impl<'a> Iterator for SplitPaths<'a> {
50 type Item = PathBuf;
51
52 fn next(&mut self) -> Option<PathBuf> {
53 let must_yield = self.must_yield;
54 self.must_yield = false;
55
56 let mut in_progress = Vec::new();
57 for b in self.data.by_ref() {
58 if b == PATHS_SEP {
59 self.must_yield = true;
60 break;
61 } else {
62 in_progress.push(b)
63 }
64 }
65
66 if !must_yield && in_progress.is_empty() {
67 None
68 } else {
69 Some(PathBuf::from(OsString::from_wide(&in_progress)))
70 }
71 }
72}
73
74#[derive(Debug)]
75pub struct JoinPathsError;
76
77// UEFI Shell Path variable is defined in Section 3.6.1
78// [UEFI Shell Specification](https://uefi.org/sites/default/files/resources/UEFI_Shell_2_2.pdf).
79pub fn join_paths<I, T>(paths: I) -> Result<OsString, JoinPathsError>
80where
81 I: Iterator<Item = T>,
82 T: AsRef<OsStr>,
83{
84 let mut joined = Vec::new();
85
86 for (i, path) in paths.enumerate() {
87 if i > 0 {
88 joined.push(PATHS_SEP)
89 }
90
91 let v = path.as_ref().encode_wide().collect::<Vec<u16>>();
92 if v.contains(&PATHS_SEP) {
93 return Err(JoinPathsError);
94 }
95
96 joined.extend_from_slice(&v);
97 }
98
99 Ok(OsString::from_wide(&joined))
100}
101
102impl fmt::Display for JoinPathsError {
103 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
104 "path segment contains `;`".fmt(f)
105 }
106}
107
108impl crate::error::Error for JoinPathsError {}
109
110pub fn current_exe() -> io::Result<PathBuf> {
111 let protocol = helpers::image_handle_protocol::<device_path::Protocol>(
112 loaded_image_device_path::PROTOCOL_GUID,
113 )?;
114 helpers::device_path_to_text(protocol).map(PathBuf::from)
115}
116
117pub fn temp_dir() -> PathBuf {
118 panic!("no filesystem on this platform")
119}
120
121pub fn home_dir() -> Option<PathBuf> {
122 None
123}
library/std/src/sys/pal/unix/mod.rs-1
......@@ -8,7 +8,6 @@ pub mod fuchsia;
88pub mod futex;
99#[cfg(target_os = "linux")]
1010pub mod linux;
11pub mod os;
1211pub mod stack_overflow;
1312pub mod sync;
1413pub mod thread_parking;
library/std/src/sys/pal/unix/os.rs deleted-471
......@@ -1,471 +0,0 @@
1//! Implementation of `std::os` functionality for unix systems
2
3#![allow(unused_imports)] // lots of cfg code here
4
5use libc::{c_char, c_int, c_void};
6
7use crate::ffi::{CStr, OsStr, OsString};
8use crate::os::unix::prelude::*;
9use crate::path::{self, PathBuf};
10use crate::sys::cvt;
11use crate::sys::helpers::run_path_with_cstr;
12use crate::{fmt, io, iter, mem, ptr, slice, str};
13
14const PATH_SEPARATOR: u8 = b':';
15
16#[cfg(target_os = "espidf")]
17pub fn getcwd() -> io::Result<PathBuf> {
18 Ok(PathBuf::from("/"))
19}
20
21#[cfg(not(target_os = "espidf"))]
22pub fn getcwd() -> io::Result<PathBuf> {
23 let mut buf = Vec::with_capacity(512);
24 loop {
25 unsafe {
26 let ptr = buf.as_mut_ptr() as *mut libc::c_char;
27 if !libc::getcwd(ptr, buf.capacity()).is_null() {
28 let len = CStr::from_ptr(buf.as_ptr() as *const libc::c_char).to_bytes().len();
29 buf.set_len(len);
30 buf.shrink_to_fit();
31 return Ok(PathBuf::from(OsString::from_vec(buf)));
32 } else {
33 let error = io::Error::last_os_error();
34 if error.raw_os_error() != Some(libc::ERANGE) {
35 return Err(error);
36 }
37 }
38
39 // Trigger the internal buffer resizing logic of `Vec` by requiring
40 // more space than the current capacity.
41 let cap = buf.capacity();
42 buf.set_len(cap);
43 buf.reserve(1);
44 }
45 }
46}
47
48#[cfg(target_os = "espidf")]
49pub fn chdir(_p: &path::Path) -> io::Result<()> {
50 super::unsupported::unsupported()
51}
52
53#[cfg(not(target_os = "espidf"))]
54pub fn chdir(p: &path::Path) -> io::Result<()> {
55 let result = run_path_with_cstr(p, &|p| unsafe { Ok(libc::chdir(p.as_ptr())) })?;
56 if result == 0 { Ok(()) } else { Err(io::Error::last_os_error()) }
57}
58
59// This can't just be `impl Iterator` because that requires `'a` to be live on
60// drop (see #146045).
61pub type SplitPaths<'a> = iter::Map<
62 slice::Split<'a, u8, impl FnMut(&u8) -> bool + 'static>,
63 impl FnMut(&[u8]) -> PathBuf + 'static,
64>;
65
66#[define_opaque(SplitPaths)]
67pub fn split_paths(unparsed: &OsStr) -> SplitPaths<'_> {
68 fn is_separator(&b: &u8) -> bool {
69 b == PATH_SEPARATOR
70 }
71
72 fn into_pathbuf(part: &[u8]) -> PathBuf {
73 PathBuf::from(OsStr::from_bytes(part))
74 }
75
76 unparsed.as_bytes().split(is_separator).map(into_pathbuf)
77}
78
79#[derive(Debug)]
80pub struct JoinPathsError;
81
82pub fn join_paths<I, T>(paths: I) -> Result<OsString, JoinPathsError>
83where
84 I: Iterator<Item = T>,
85 T: AsRef<OsStr>,
86{
87 let mut joined = Vec::new();
88
89 for (i, path) in paths.enumerate() {
90 let path = path.as_ref().as_bytes();
91 if i > 0 {
92 joined.push(PATH_SEPARATOR)
93 }
94 if path.contains(&PATH_SEPARATOR) {
95 return Err(JoinPathsError);
96 }
97 joined.extend_from_slice(path);
98 }
99 Ok(OsStringExt::from_vec(joined))
100}
101
102impl fmt::Display for JoinPathsError {
103 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
104 write!(f, "path segment contains separator `{}`", char::from(PATH_SEPARATOR))
105 }
106}
107
108impl crate::error::Error for JoinPathsError {}
109
110#[cfg(target_os = "aix")]
111pub fn current_exe() -> io::Result<PathBuf> {
112 #[cfg(test)]
113 use realstd::env;
114
115 #[cfg(not(test))]
116 use crate::env;
117 use crate::io;
118
119 let exe_path = env::args().next().ok_or(io::const_error!(
120 io::ErrorKind::NotFound,
121 "an executable path was not found because no arguments were provided through argv",
122 ))?;
123 let path = PathBuf::from(exe_path);
124 if path.is_absolute() {
125 return path.canonicalize();
126 }
127 // Search PWD to infer current_exe.
128 if let Some(pstr) = path.to_str()
129 && pstr.contains("/")
130 {
131 return getcwd().map(|cwd| cwd.join(path))?.canonicalize();
132 }
133 // Search PATH to infer current_exe.
134 if let Some(p) = env::var_os(OsStr::from_bytes("PATH".as_bytes())) {
135 for search_path in split_paths(&p) {
136 let pb = search_path.join(&path);
137 if pb.is_file()
138 && let Ok(metadata) = crate::fs::metadata(&pb)
139 && metadata.permissions().mode() & 0o111 != 0
140 {
141 return pb.canonicalize();
142 }
143 }
144 }
145 Err(io::const_error!(io::ErrorKind::NotFound, "an executable path was not found"))
146}
147
148#[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
149pub fn current_exe() -> io::Result<PathBuf> {
150 unsafe {
151 let mut mib = [
152 libc::CTL_KERN as c_int,
153 libc::KERN_PROC as c_int,
154 libc::KERN_PROC_PATHNAME as c_int,
155 -1 as c_int,
156 ];
157 let mut sz = 0;
158 cvt(libc::sysctl(
159 mib.as_mut_ptr(),
160 mib.len() as libc::c_uint,
161 ptr::null_mut(),
162 &mut sz,
163 ptr::null_mut(),
164 0,
165 ))?;
166 if sz == 0 {
167 return Err(io::Error::last_os_error());
168 }
169 let mut v: Vec<u8> = Vec::with_capacity(sz);
170 cvt(libc::sysctl(
171 mib.as_mut_ptr(),
172 mib.len() as libc::c_uint,
173 v.as_mut_ptr() as *mut libc::c_void,
174 &mut sz,
175 ptr::null_mut(),
176 0,
177 ))?;
178 if sz == 0 {
179 return Err(io::Error::last_os_error());
180 }
181 v.set_len(sz - 1); // chop off trailing NUL
182 Ok(PathBuf::from(OsString::from_vec(v)))
183 }
184}
185
186#[cfg(target_os = "netbsd")]
187pub fn current_exe() -> io::Result<PathBuf> {
188 fn sysctl() -> io::Result<PathBuf> {
189 unsafe {
190 let mib = [libc::CTL_KERN, libc::KERN_PROC_ARGS, -1, libc::KERN_PROC_PATHNAME];
191 let mut path_len: usize = 0;
192 cvt(libc::sysctl(
193 mib.as_ptr(),
194 mib.len() as libc::c_uint,
195 ptr::null_mut(),
196 &mut path_len,
197 ptr::null(),
198 0,
199 ))?;
200 if path_len <= 1 {
201 return Err(io::const_error!(
202 io::ErrorKind::Uncategorized,
203 "KERN_PROC_PATHNAME sysctl returned zero-length string",
204 ));
205 }
206 let mut path: Vec<u8> = Vec::with_capacity(path_len);
207 cvt(libc::sysctl(
208 mib.as_ptr(),
209 mib.len() as libc::c_uint,
210 path.as_ptr() as *mut libc::c_void,
211 &mut path_len,
212 ptr::null(),
213 0,
214 ))?;
215 path.set_len(path_len - 1); // chop off NUL
216 Ok(PathBuf::from(OsString::from_vec(path)))
217 }
218 }
219 fn procfs() -> io::Result<PathBuf> {
220 let curproc_exe = path::Path::new("/proc/curproc/exe");
221 if curproc_exe.is_file() {
222 return crate::fs::read_link(curproc_exe);
223 }
224 Err(io::const_error!(
225 io::ErrorKind::Uncategorized,
226 "/proc/curproc/exe doesn't point to regular file.",
227 ))
228 }
229 sysctl().or_else(|_| procfs())
230}
231
232#[cfg(target_os = "openbsd")]
233pub fn current_exe() -> io::Result<PathBuf> {
234 unsafe {
235 let mut mib = [libc::CTL_KERN, libc::KERN_PROC_ARGS, libc::getpid(), libc::KERN_PROC_ARGV];
236 let mib = mib.as_mut_ptr();
237 let mut argv_len = 0;
238 cvt(libc::sysctl(mib, 4, ptr::null_mut(), &mut argv_len, ptr::null_mut(), 0))?;
239 let mut argv = Vec::<*const libc::c_char>::with_capacity(argv_len as usize);
240 cvt(libc::sysctl(mib, 4, argv.as_mut_ptr() as *mut _, &mut argv_len, ptr::null_mut(), 0))?;
241 argv.set_len(argv_len as usize);
242 if argv[0].is_null() {
243 return Err(io::const_error!(io::ErrorKind::Uncategorized, "no current exe available"));
244 }
245 let argv0 = CStr::from_ptr(argv[0]).to_bytes();
246 if argv0[0] == b'.' || argv0.iter().any(|b| *b == b'/') {
247 crate::fs::canonicalize(OsStr::from_bytes(argv0))
248 } else {
249 Ok(PathBuf::from(OsStr::from_bytes(argv0)))
250 }
251 }
252}
253
254#[cfg(any(
255 target_os = "linux",
256 target_os = "cygwin",
257 target_os = "hurd",
258 target_os = "android",
259 target_os = "nuttx",
260 target_os = "emscripten"
261))]
262pub fn current_exe() -> io::Result<PathBuf> {
263 match crate::fs::read_link("/proc/self/exe") {
264 Err(ref e) if e.kind() == io::ErrorKind::NotFound => Err(io::const_error!(
265 io::ErrorKind::Uncategorized,
266 "no /proc/self/exe available. Is /proc mounted?",
267 )),
268 other => other,
269 }
270}
271
272#[cfg(target_os = "nto")]
273pub fn current_exe() -> io::Result<PathBuf> {
274 let mut e = crate::fs::read("/proc/self/exefile")?;
275 // Current versions of QNX Neutrino provide a null-terminated path.
276 // Ensure the trailing null byte is not returned here.
277 if let Some(0) = e.last() {
278 e.pop();
279 }
280 Ok(PathBuf::from(OsString::from_vec(e)))
281}
282
283#[cfg(target_vendor = "apple")]
284pub fn current_exe() -> io::Result<PathBuf> {
285 unsafe {
286 let mut sz: u32 = 0;
287 #[expect(deprecated)]
288 libc::_NSGetExecutablePath(ptr::null_mut(), &mut sz);
289 if sz == 0 {
290 return Err(io::Error::last_os_error());
291 }
292 let mut v: Vec<u8> = Vec::with_capacity(sz as usize);
293 #[expect(deprecated)]
294 let err = libc::_NSGetExecutablePath(v.as_mut_ptr() as *mut i8, &mut sz);
295 if err != 0 {
296 return Err(io::Error::last_os_error());
297 }
298 v.set_len(sz as usize - 1); // chop off trailing NUL
299 Ok(PathBuf::from(OsString::from_vec(v)))
300 }
301}
302
303#[cfg(any(target_os = "solaris", target_os = "illumos"))]
304pub fn current_exe() -> io::Result<PathBuf> {
305 if let Ok(path) = crate::fs::read_link("/proc/self/path/a.out") {
306 Ok(path)
307 } else {
308 unsafe {
309 let path = libc::getexecname();
310 if path.is_null() {
311 Err(io::Error::last_os_error())
312 } else {
313 let filename = CStr::from_ptr(path).to_bytes();
314 let path = PathBuf::from(<OsStr as OsStrExt>::from_bytes(filename));
315
316 // Prepend a current working directory to the path if
317 // it doesn't contain an absolute pathname.
318 if filename[0] == b'/' { Ok(path) } else { getcwd().map(|cwd| cwd.join(path)) }
319 }
320 }
321 }
322}
323
324#[cfg(target_os = "haiku")]
325pub fn current_exe() -> io::Result<PathBuf> {
326 let mut name = vec![0; libc::PATH_MAX as usize];
327 unsafe {
328 let result = libc::find_path(
329 crate::ptr::null_mut(),
330 libc::B_FIND_PATH_IMAGE_PATH,
331 crate::ptr::null_mut(),
332 name.as_mut_ptr(),
333 name.len(),
334 );
335 if result != libc::B_OK {
336 Err(io::const_error!(io::ErrorKind::Uncategorized, "error getting executable path"))
337 } else {
338 // find_path adds the null terminator.
339 let name = CStr::from_ptr(name.as_ptr()).to_bytes();
340 Ok(PathBuf::from(OsStr::from_bytes(name)))
341 }
342 }
343}
344
345#[cfg(target_os = "redox")]
346pub fn current_exe() -> io::Result<PathBuf> {
347 crate::fs::read_to_string("/scheme/sys/exe").map(PathBuf::from)
348}
349
350#[cfg(target_os = "rtems")]
351pub fn current_exe() -> io::Result<PathBuf> {
352 crate::fs::read_to_string("sys:exe").map(PathBuf::from)
353}
354
355#[cfg(target_os = "l4re")]
356pub fn current_exe() -> io::Result<PathBuf> {
357 Err(io::const_error!(io::ErrorKind::Unsupported, "not yet implemented!"))
358}
359
360#[cfg(target_os = "vxworks")]
361pub fn current_exe() -> io::Result<PathBuf> {
362 #[cfg(test)]
363 use realstd::env;
364
365 #[cfg(not(test))]
366 use crate::env;
367
368 let exe_path = env::args().next().unwrap();
369 let path = path::Path::new(&exe_path);
370 path.canonicalize()
371}
372
373#[cfg(any(target_os = "espidf", target_os = "horizon", target_os = "vita"))]
374pub fn current_exe() -> io::Result<PathBuf> {
375 super::unsupported::unsupported()
376}
377
378#[cfg(target_os = "fuchsia")]
379pub fn current_exe() -> io::Result<PathBuf> {
380 #[cfg(test)]
381 use realstd::env;
382
383 #[cfg(not(test))]
384 use crate::env;
385
386 let exe_path = env::args().next().ok_or(io::const_error!(
387 io::ErrorKind::Uncategorized,
388 "an executable path was not found because no arguments were provided through argv",
389 ))?;
390 let path = PathBuf::from(exe_path);
391
392 // Prepend the current working directory to the path if it's not absolute.
393 if !path.is_absolute() { getcwd().map(|cwd| cwd.join(path)) } else { Ok(path) }
394}
395
396#[cfg(all(target_vendor = "apple", not(miri)))]
397fn darwin_temp_dir() -> PathBuf {
398 crate::sys::pal::conf::confstr(libc::_CS_DARWIN_USER_TEMP_DIR, Some(64))
399 .map(PathBuf::from)
400 .unwrap_or_else(|_| {
401 // It failed for whatever reason (there are several possible reasons),
402 // so return the global one.
403 PathBuf::from("/tmp")
404 })
405}
406
407pub fn temp_dir() -> PathBuf {
408 crate::env::var_os("TMPDIR").map(PathBuf::from).unwrap_or_else(|| {
409 cfg_select! {
410 all(target_vendor = "apple", not(miri)) => darwin_temp_dir(),
411 target_os = "android" => PathBuf::from("/data/local/tmp"),
412 _ => PathBuf::from("/tmp"),
413 }
414 })
415}
416
417pub fn home_dir() -> Option<PathBuf> {
418 return crate::env::var_os("HOME")
419 .filter(|s| !s.is_empty())
420 .or_else(|| unsafe { fallback() })
421 .map(PathBuf::from);
422
423 #[cfg(any(
424 target_os = "android",
425 target_os = "emscripten",
426 target_os = "redox",
427 target_os = "vxworks",
428 target_os = "espidf",
429 target_os = "horizon",
430 target_os = "vita",
431 target_os = "nuttx",
432 all(target_vendor = "apple", not(target_os = "macos")),
433 ))]
434 unsafe fn fallback() -> Option<OsString> {
435 None
436 }
437 #[cfg(not(any(
438 target_os = "android",
439 target_os = "emscripten",
440 target_os = "redox",
441 target_os = "vxworks",
442 target_os = "espidf",
443 target_os = "horizon",
444 target_os = "vita",
445 target_os = "nuttx",
446 all(target_vendor = "apple", not(target_os = "macos")),
447 )))]
448 unsafe fn fallback() -> Option<OsString> {
449 let amt = match libc::sysconf(libc::_SC_GETPW_R_SIZE_MAX) {
450 n if n < 0 => 512 as usize,
451 n => n as usize,
452 };
453 let mut buf = Vec::with_capacity(amt);
454 let mut p = mem::MaybeUninit::<libc::passwd>::uninit();
455 let mut result = ptr::null_mut();
456 match libc::getpwuid_r(
457 libc::getuid(),
458 p.as_mut_ptr(),
459 buf.as_mut_ptr(),
460 buf.capacity(),
461 &mut result,
462 ) {
463 0 if !result.is_null() => {
464 let ptr = (*result).pw_dir as *const _;
465 let bytes = CStr::from_ptr(ptr).to_bytes().to_vec();
466 Some(OsStringExt::from_vec(bytes))
467 }
468 _ => None,
469 }
470 }
471}
library/std/src/sys/pal/unix/stack_overflow.rs+13
......@@ -429,6 +429,11 @@ mod imp {
429429
430430 #[forbid(unsafe_op_in_unsafe_fn)]
431431 unsafe fn install_main_guard_linux(page_size: usize) -> Option<Range<usize>> {
432 // See the corresponding conditional in init().
433 // Avoid stack_start_aligned, which makes slow syscalls to read /proc/self/maps
434 if cfg!(panic = "immediate-abort") {
435 return None;
436 }
432437 // Linux doesn't allocate the whole stack right away, and
433438 // the kernel has its own stack-guard mechanism to fault
434439 // when growing too close to an existing mapping. If we map
......@@ -456,6 +461,10 @@ mod imp {
456461 #[forbid(unsafe_op_in_unsafe_fn)]
457462 #[cfg(target_os = "freebsd")]
458463 unsafe fn install_main_guard_freebsd(page_size: usize) -> Option<Range<usize>> {
464 // See the corresponding conditional in install_main_guard_linux().
465 if cfg!(panic = "immediate-abort") {
466 return None;
467 }
459468 // FreeBSD's stack autogrows, and optionally includes a guard page
460469 // at the bottom. If we try to remap the bottom of the stack
461470 // ourselves, FreeBSD's guard page moves upwards. So we'll just use
......@@ -489,6 +498,10 @@ mod imp {
489498
490499 #[forbid(unsafe_op_in_unsafe_fn)]
491500 unsafe fn install_main_guard_bsds(page_size: usize) -> Option<Range<usize>> {
501 // See the corresponding conditional in install_main_guard_linux().
502 if cfg!(panic = "immediate-abort") {
503 return None;
504 }
492505 // OpenBSD stack already includes a guard page, and stack is
493506 // immutable.
494507 // NetBSD stack includes the guard page.
library/std/src/sys/pal/unsupported/mod.rs-2
......@@ -1,6 +1,4 @@
11#![deny(unsafe_op_in_unsafe_fn)]
22
3pub mod os;
4
53mod common;
64pub use common::*;
library/std/src/sys/pal/unsupported/os.rs deleted-57
......@@ -1,57 +0,0 @@
1use super::unsupported;
2use crate::ffi::{OsStr, OsString};
3use crate::marker::PhantomData;
4use crate::path::{self, PathBuf};
5use crate::{fmt, io};
6
7pub fn getcwd() -> io::Result<PathBuf> {
8 unsupported()
9}
10
11pub fn chdir(_: &path::Path) -> io::Result<()> {
12 unsupported()
13}
14
15pub struct SplitPaths<'a>(!, PhantomData<&'a ()>);
16
17pub fn split_paths(_unparsed: &OsStr) -> SplitPaths<'_> {
18 panic!("unsupported")
19}
20
21impl<'a> Iterator for SplitPaths<'a> {
22 type Item = PathBuf;
23 fn next(&mut self) -> Option<PathBuf> {
24 self.0
25 }
26}
27
28#[derive(Debug)]
29pub struct JoinPathsError;
30
31pub fn join_paths<I, T>(_paths: I) -> Result<OsString, JoinPathsError>
32where
33 I: Iterator<Item = T>,
34 T: AsRef<OsStr>,
35{
36 Err(JoinPathsError)
37}
38
39impl fmt::Display for JoinPathsError {
40 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
41 "not supported on this platform yet".fmt(f)
42 }
43}
44
45impl crate::error::Error for JoinPathsError {}
46
47pub fn current_exe() -> io::Result<PathBuf> {
48 unsupported()
49}
50
51pub fn temp_dir() -> PathBuf {
52 panic!("no filesystem on this platform")
53}
54
55pub fn home_dir() -> Option<PathBuf> {
56 None
57}
library/std/src/sys/pal/vexos/mod.rs-3
......@@ -1,6 +1,3 @@
1#[path = "../unsupported/os.rs"]
2pub mod os;
3
41#[expect(dead_code)]
52#[path = "../unsupported/common.rs"]
63mod unsupported_common;
library/std/src/sys/pal/wasi/mod.rs-1
......@@ -10,7 +10,6 @@ pub mod conf;
1010#[allow(unused)]
1111#[path = "../wasm/atomics/futex.rs"]
1212pub mod futex;
13pub mod os;
1413pub mod stack_overflow;
1514#[path = "../unix/time.rs"]
1615pub mod time;
library/std/src/sys/pal/wasi/os.rs deleted-87
......@@ -1,87 +0,0 @@
1#![forbid(unsafe_op_in_unsafe_fn)]
2
3use crate::ffi::{CStr, OsStr, OsString};
4use crate::marker::PhantomData;
5use crate::os::wasi::prelude::*;
6use crate::path::{self, PathBuf};
7use crate::sys::helpers::run_path_with_cstr;
8use crate::sys::unsupported;
9use crate::{fmt, io};
10
11pub fn getcwd() -> io::Result<PathBuf> {
12 let mut buf = Vec::with_capacity(512);
13 loop {
14 unsafe {
15 let ptr = buf.as_mut_ptr() as *mut libc::c_char;
16 if !libc::getcwd(ptr, buf.capacity()).is_null() {
17 let len = CStr::from_ptr(buf.as_ptr() as *const libc::c_char).to_bytes().len();
18 buf.set_len(len);
19 buf.shrink_to_fit();
20 return Ok(PathBuf::from(OsString::from_vec(buf)));
21 } else {
22 let error = io::Error::last_os_error();
23 if error.raw_os_error() != Some(libc::ERANGE) {
24 return Err(error);
25 }
26 }
27
28 // Trigger the internal buffer resizing logic of `Vec` by requiring
29 // more space than the current capacity.
30 let cap = buf.capacity();
31 buf.set_len(cap);
32 buf.reserve(1);
33 }
34 }
35}
36
37pub fn chdir(p: &path::Path) -> io::Result<()> {
38 let result = run_path_with_cstr(p, &|p| unsafe { Ok(libc::chdir(p.as_ptr())) })?;
39 match result == (0 as libc::c_int) {
40 true => Ok(()),
41 false => Err(io::Error::last_os_error()),
42 }
43}
44
45pub struct SplitPaths<'a>(!, PhantomData<&'a ()>);
46
47pub fn split_paths(_unparsed: &OsStr) -> SplitPaths<'_> {
48 panic!("unsupported")
49}
50
51impl<'a> Iterator for SplitPaths<'a> {
52 type Item = PathBuf;
53 fn next(&mut self) -> Option<PathBuf> {
54 self.0
55 }
56}
57
58#[derive(Debug)]
59pub struct JoinPathsError;
60
61pub fn join_paths<I, T>(_paths: I) -> Result<OsString, JoinPathsError>
62where
63 I: Iterator<Item = T>,
64 T: AsRef<OsStr>,
65{
66 Err(JoinPathsError)
67}
68
69impl fmt::Display for JoinPathsError {
70 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
71 "not supported on wasm yet".fmt(f)
72 }
73}
74
75impl crate::error::Error for JoinPathsError {}
76
77pub fn current_exe() -> io::Result<PathBuf> {
78 unsupported()
79}
80
81pub fn temp_dir() -> PathBuf {
82 panic!("no filesystem on wasm")
83}
84
85pub fn home_dir() -> Option<PathBuf> {
86 None
87}
library/std/src/sys/pal/wasm/mod.rs-3
......@@ -16,9 +16,6 @@
1616
1717#![deny(unsafe_op_in_unsafe_fn)]
1818
19#[path = "../unsupported/os.rs"]
20pub mod os;
21
2219#[cfg(target_feature = "atomics")]
2320#[path = "atomics/futex.rs"]
2421pub mod futex;
library/std/src/sys/pal/windows/mod.rs-1
......@@ -18,7 +18,6 @@ pub mod c;
1818#[cfg(not(target_vendor = "win7"))]
1919pub mod futex;
2020pub mod handle;
21pub mod os;
2221pub mod time;
2322cfg_select! {
2423 // We don't care about printing nice error messages for panic=immediate-abort
library/std/src/sys/pal/windows/os.rs deleted-190
......@@ -1,190 +0,0 @@
1//! Implementation of `std::os` functionality for Windows.
2
3#![allow(nonstandard_style)]
4
5#[cfg(test)]
6mod tests;
7
8use super::api;
9#[cfg(not(target_vendor = "uwp"))]
10use super::api::WinError;
11use crate::ffi::{OsStr, OsString};
12use crate::os::windows::ffi::EncodeWide;
13use crate::os::windows::prelude::*;
14use crate::path::{self, PathBuf};
15use crate::sys::pal::{c, cvt};
16use crate::{fmt, io, ptr};
17
18pub struct SplitPaths<'a> {
19 data: EncodeWide<'a>,
20 must_yield: bool,
21}
22
23pub fn split_paths(unparsed: &OsStr) -> SplitPaths<'_> {
24 SplitPaths { data: unparsed.encode_wide(), must_yield: true }
25}
26
27impl<'a> Iterator for SplitPaths<'a> {
28 type Item = PathBuf;
29 fn next(&mut self) -> Option<PathBuf> {
30 // On Windows, the PATH environment variable is semicolon separated.
31 // Double quotes are used as a way of introducing literal semicolons
32 // (since c:\some;dir is a valid Windows path). Double quotes are not
33 // themselves permitted in path names, so there is no way to escape a
34 // double quote. Quoted regions can appear in arbitrary locations, so
35 //
36 // c:\foo;c:\som"e;di"r;c:\bar
37 //
38 // Should parse as [c:\foo, c:\some;dir, c:\bar].
39 //
40 // (The above is based on testing; there is no clear reference available
41 // for the grammar.)
42
43 let must_yield = self.must_yield;
44 self.must_yield = false;
45
46 let mut in_progress = Vec::new();
47 let mut in_quote = false;
48 for b in self.data.by_ref() {
49 if b == '"' as u16 {
50 in_quote = !in_quote;
51 } else if b == ';' as u16 && !in_quote {
52 self.must_yield = true;
53 break;
54 } else {
55 in_progress.push(b)
56 }
57 }
58
59 if !must_yield && in_progress.is_empty() {
60 None
61 } else {
62 Some(super::os2path(&in_progress))
63 }
64 }
65}
66
67#[derive(Debug)]
68pub struct JoinPathsError;
69
70pub fn join_paths<I, T>(paths: I) -> Result<OsString, JoinPathsError>
71where
72 I: Iterator<Item = T>,
73 T: AsRef<OsStr>,
74{
75 let mut joined = Vec::new();
76 let sep = b';' as u16;
77
78 for (i, path) in paths.enumerate() {
79 let path = path.as_ref();
80 if i > 0 {
81 joined.push(sep)
82 }
83 let v = path.encode_wide().collect::<Vec<u16>>();
84 if v.contains(&(b'"' as u16)) {
85 return Err(JoinPathsError);
86 } else if v.contains(&sep) {
87 joined.push(b'"' as u16);
88 joined.extend_from_slice(&v[..]);
89 joined.push(b'"' as u16);
90 } else {
91 joined.extend_from_slice(&v[..]);
92 }
93 }
94
95 Ok(OsStringExt::from_wide(&joined[..]))
96}
97
98impl fmt::Display for JoinPathsError {
99 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
100 "path segment contains `\"`".fmt(f)
101 }
102}
103
104impl crate::error::Error for JoinPathsError {}
105
106pub fn current_exe() -> io::Result<PathBuf> {
107 super::fill_utf16_buf(
108 |buf, sz| unsafe { c::GetModuleFileNameW(ptr::null_mut(), buf, sz) },
109 super::os2path,
110 )
111}
112
113pub fn getcwd() -> io::Result<PathBuf> {
114 super::fill_utf16_buf(|buf, sz| unsafe { c::GetCurrentDirectoryW(sz, buf) }, super::os2path)
115}
116
117pub fn chdir(p: &path::Path) -> io::Result<()> {
118 let p: &OsStr = p.as_ref();
119 let mut p = p.encode_wide().collect::<Vec<_>>();
120 p.push(0);
121
122 cvt(unsafe { c::SetCurrentDirectoryW(p.as_ptr()) }).map(drop)
123}
124
125pub fn temp_dir() -> PathBuf {
126 super::fill_utf16_buf(|buf, sz| unsafe { c::GetTempPath2W(sz, buf) }, super::os2path).unwrap()
127}
128
129#[cfg(all(not(target_vendor = "uwp"), not(target_vendor = "win7")))]
130fn home_dir_crt() -> Option<PathBuf> {
131 unsafe {
132 // Defined in processthreadsapi.h.
133 const CURRENT_PROCESS_TOKEN: usize = -4_isize as usize;
134
135 super::fill_utf16_buf(
136 |buf, mut sz| {
137 // GetUserProfileDirectoryW does not quite use the usual protocol for
138 // negotiating the buffer size, so we have to translate.
139 match c::GetUserProfileDirectoryW(
140 ptr::without_provenance_mut(CURRENT_PROCESS_TOKEN),
141 buf,
142 &mut sz,
143 ) {
144 0 if api::get_last_error() != WinError::INSUFFICIENT_BUFFER => 0,
145 0 => sz,
146 _ => sz - 1, // sz includes the null terminator
147 }
148 },
149 super::os2path,
150 )
151 .ok()
152 }
153}
154
155#[cfg(target_vendor = "win7")]
156fn home_dir_crt() -> Option<PathBuf> {
157 unsafe {
158 use crate::sys::handle::Handle;
159
160 let me = c::GetCurrentProcess();
161 let mut token = ptr::null_mut();
162 if c::OpenProcessToken(me, c::TOKEN_READ, &mut token) == 0 {
163 return None;
164 }
165 let _handle = Handle::from_raw_handle(token);
166 super::fill_utf16_buf(
167 |buf, mut sz| {
168 match c::GetUserProfileDirectoryW(token, buf, &mut sz) {
169 0 if api::get_last_error() != WinError::INSUFFICIENT_BUFFER => 0,
170 0 => sz,
171 _ => sz - 1, // sz includes the null terminator
172 }
173 },
174 super::os2path,
175 )
176 .ok()
177 }
178}
179
180#[cfg(target_vendor = "uwp")]
181fn home_dir_crt() -> Option<PathBuf> {
182 None
183}
184
185pub fn home_dir() -> Option<PathBuf> {
186 crate::env::var_os("USERPROFILE")
187 .filter(|s| !s.is_empty())
188 .map(PathBuf::from)
189 .or_else(home_dir_crt)
190}
library/std/src/sys/pal/windows/os/tests.rs deleted-13
......@@ -1,13 +0,0 @@
1use crate::io::Error;
2use crate::sys::c;
3
4// tests `error_string` above
5#[test]
6fn ntstatus_error() {
7 const STATUS_UNSUCCESSFUL: u32 = 0xc000_0001;
8 assert!(
9 !Error::from_raw_os_error((STATUS_UNSUCCESSFUL | c::FACILITY_NT_BIT) as _)
10 .to_string()
11 .contains("FormatMessageW() returned error")
12 );
13}
library/std/src/sys/pal/xous/mod.rs-1
......@@ -1,6 +1,5 @@
11#![forbid(unsafe_op_in_unsafe_fn)]
22
3pub mod os;
43pub mod params;
54
65#[path = "../unsupported/common.rs"]
library/std/src/sys/pal/xous/os.rs deleted-57
......@@ -1,57 +0,0 @@
1use super::unsupported;
2use crate::ffi::{OsStr, OsString};
3use crate::marker::PhantomData;
4use crate::path::{self, PathBuf};
5use crate::{fmt, io};
6
7pub fn getcwd() -> io::Result<PathBuf> {
8 unsupported()
9}
10
11pub fn chdir(_: &path::Path) -> io::Result<()> {
12 unsupported()
13}
14
15pub struct SplitPaths<'a>(!, PhantomData<&'a ()>);
16
17pub fn split_paths(_unparsed: &OsStr) -> SplitPaths<'_> {
18 panic!("unsupported")
19}
20
21impl<'a> Iterator for SplitPaths<'a> {
22 type Item = PathBuf;
23 fn next(&mut self) -> Option<PathBuf> {
24 self.0
25 }
26}
27
28#[derive(Debug)]
29pub struct JoinPathsError;
30
31pub fn join_paths<I, T>(_paths: I) -> Result<OsString, JoinPathsError>
32where
33 I: Iterator<Item = T>,
34 T: AsRef<OsStr>,
35{
36 Err(JoinPathsError)
37}
38
39impl fmt::Display for JoinPathsError {
40 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
41 "not supported on this platform yet".fmt(f)
42 }
43}
44
45impl crate::error::Error for JoinPathsError {}
46
47pub fn current_exe() -> io::Result<PathBuf> {
48 unsupported()
49}
50
51pub fn temp_dir() -> PathBuf {
52 panic!("no filesystem on this platform")
53}
54
55pub fn home_dir() -> Option<PathBuf> {
56 None
57}
library/std/src/sys/pal/zkvm/mod.rs-1
......@@ -11,7 +11,6 @@
1111pub const WORD_SIZE: usize = size_of::<u32>();
1212
1313pub mod abi;
14pub mod os;
1514
1615use crate::io as std_io;
1716
library/std/src/sys/pal/zkvm/os.rs deleted-57
......@@ -1,57 +0,0 @@
1use super::unsupported;
2use crate::ffi::{OsStr, OsString};
3use crate::marker::PhantomData;
4use crate::path::{self, PathBuf};
5use crate::{fmt, io};
6
7pub fn getcwd() -> io::Result<PathBuf> {
8 unsupported()
9}
10
11pub fn chdir(_: &path::Path) -> io::Result<()> {
12 unsupported()
13}
14
15pub struct SplitPaths<'a>(!, PhantomData<&'a ()>);
16
17pub fn split_paths(_unparsed: &OsStr) -> SplitPaths<'_> {
18 panic!("unsupported")
19}
20
21impl<'a> Iterator for SplitPaths<'a> {
22 type Item = PathBuf;
23 fn next(&mut self) -> Option<PathBuf> {
24 self.0
25 }
26}
27
28#[derive(Debug)]
29pub struct JoinPathsError;
30
31pub fn join_paths<I, T>(_paths: I) -> Result<OsString, JoinPathsError>
32where
33 I: Iterator<Item = T>,
34 T: AsRef<OsStr>,
35{
36 Err(JoinPathsError)
37}
38
39impl fmt::Display for JoinPathsError {
40 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
41 "not supported on this platform yet".fmt(f)
42 }
43}
44
45impl crate::error::Error for JoinPathsError {}
46
47pub fn current_exe() -> io::Result<PathBuf> {
48 unsupported()
49}
50
51pub fn temp_dir() -> PathBuf {
52 panic!("no filesystem on this platform")
53}
54
55pub fn home_dir() -> Option<PathBuf> {
56 None
57}
library/std/src/sys/paths/hermit.rs created+10
......@@ -0,0 +1,10 @@
1use crate::io;
2use crate::path::PathBuf;
3
4pub fn getcwd() -> io::Result<PathBuf> {
5 Ok(PathBuf::from("/"))
6}
7
8pub fn temp_dir() -> PathBuf {
9 PathBuf::from("/tmp")
10}
library/std/src/sys/paths/mod.rs created+59
......@@ -0,0 +1,59 @@
1cfg_select! {
2 target_os = "hermit" => {
3 mod hermit;
4 #[expect(dead_code)]
5 mod unsupported;
6 mod imp {
7 pub use super::hermit::{getcwd, temp_dir};
8 pub use super::unsupported::{chdir, SplitPaths, split_paths, JoinPathsError, join_paths, current_exe, home_dir};
9 }
10 }
11 target_os = "motor" => {
12 mod motor;
13 #[expect(dead_code)]
14 mod unsupported;
15 mod imp {
16 pub use super::motor::{getcwd, chdir, current_exe, temp_dir};
17 pub use super::unsupported::{SplitPaths, split_paths, JoinPathsError, join_paths, home_dir};
18 }
19 }
20 all(target_vendor = "fortanix", target_env = "sgx") => {
21 mod sgx;
22 #[expect(dead_code)]
23 mod unsupported;
24 mod imp {
25 pub use super::sgx::chdir;
26 pub use super::unsupported::{getcwd, SplitPaths, split_paths, JoinPathsError, join_paths, current_exe, temp_dir, home_dir};
27 }
28 }
29 target_os = "uefi" => {
30 mod uefi;
31 use uefi as imp;
32 }
33 target_family = "unix" => {
34 mod unix;
35 use unix as imp;
36 }
37 target_os = "wasi" => {
38 mod wasi;
39 #[expect(dead_code)]
40 mod unsupported;
41 mod imp {
42 pub use super::wasi::{getcwd, chdir, temp_dir};
43 pub use super::unsupported::{current_exe, SplitPaths, split_paths, JoinPathsError, join_paths, home_dir};
44 }
45 }
46 target_os = "windows" => {
47 mod windows;
48 use windows as imp;
49 }
50 _ => {
51 mod unsupported;
52 use unsupported as imp;
53 }
54}
55
56pub use imp::{
57 JoinPathsError, SplitPaths, chdir, current_exe, getcwd, home_dir, join_paths, split_paths,
58 temp_dir,
59};
library/std/src/sys/paths/motor.rs created+20
......@@ -0,0 +1,20 @@
1use crate::io;
2use crate::os::motor::ffi::OsStrExt;
3use crate::path::{self, PathBuf};
4use crate::sys::pal::map_motor_error;
5
6pub fn getcwd() -> io::Result<PathBuf> {
7 moto_rt::fs::getcwd().map(PathBuf::from).map_err(map_motor_error)
8}
9
10pub fn chdir(path: &path::Path) -> io::Result<()> {
11 moto_rt::fs::chdir(path.as_os_str().as_str()).map_err(map_motor_error)
12}
13
14pub fn current_exe() -> io::Result<PathBuf> {
15 moto_rt::process::current_exe().map(PathBuf::from).map_err(map_motor_error)
16}
17
18pub fn temp_dir() -> PathBuf {
19 PathBuf::from(moto_rt::fs::TEMP_DIR)
20}
library/std/src/sys/paths/sgx.rs created+7
......@@ -0,0 +1,7 @@
1use crate::io;
2use crate::path::Path;
3use crate::sys::pal::sgx_ineffective;
4
5pub fn chdir(_: &Path) -> io::Result<()> {
6 sgx_ineffective(())
7}
library/std/src/sys/paths/uefi.rs created+123
......@@ -0,0 +1,123 @@
1use r_efi::efi::protocols::{device_path, loaded_image_device_path};
2
3use crate::ffi::{OsStr, OsString};
4use crate::os::uefi::ffi::{OsStrExt, OsStringExt};
5use crate::path::{self, PathBuf};
6use crate::sys::pal::{helpers, unsupported_err};
7use crate::{fmt, io};
8
9const PATHS_SEP: u16 = b';' as u16;
10
11pub fn getcwd() -> io::Result<PathBuf> {
12 match helpers::open_shell() {
13 Some(shell) => {
14 // SAFETY: path_ptr is managed by UEFI shell and should not be deallocated
15 let path_ptr = unsafe { ((*shell.as_ptr()).get_cur_dir)(crate::ptr::null_mut()) };
16 helpers::os_string_from_raw(path_ptr)
17 .map(PathBuf::from)
18 .ok_or(io::const_error!(io::ErrorKind::InvalidData, "invalid path"))
19 }
20 None => {
21 let mut t = current_exe()?;
22 // SAFETY: This should never fail since the disk prefix will be present even for root
23 // executables
24 assert!(t.pop());
25 Ok(t)
26 }
27 }
28}
29
30pub fn chdir(p: &path::Path) -> io::Result<()> {
31 let shell = helpers::open_shell().ok_or(unsupported_err())?;
32
33 let mut p = helpers::os_string_to_raw(p.as_os_str())
34 .ok_or(io::const_error!(io::ErrorKind::InvalidData, "invalid path"))?;
35
36 let r = unsafe { ((*shell.as_ptr()).set_cur_dir)(crate::ptr::null_mut(), p.as_mut_ptr()) };
37 if r.is_error() { Err(io::Error::from_raw_os_error(r.as_usize())) } else { Ok(()) }
38}
39
40pub struct SplitPaths<'a> {
41 data: crate::os::uefi::ffi::EncodeWide<'a>,
42 must_yield: bool,
43}
44
45pub fn split_paths(unparsed: &OsStr) -> SplitPaths<'_> {
46 SplitPaths { data: unparsed.encode_wide(), must_yield: true }
47}
48
49impl<'a> Iterator for SplitPaths<'a> {
50 type Item = PathBuf;
51
52 fn next(&mut self) -> Option<PathBuf> {
53 let must_yield = self.must_yield;
54 self.must_yield = false;
55
56 let mut in_progress = Vec::new();
57 for b in self.data.by_ref() {
58 if b == PATHS_SEP {
59 self.must_yield = true;
60 break;
61 } else {
62 in_progress.push(b)
63 }
64 }
65
66 if !must_yield && in_progress.is_empty() {
67 None
68 } else {
69 Some(PathBuf::from(OsString::from_wide(&in_progress)))
70 }
71 }
72}
73
74#[derive(Debug)]
75pub struct JoinPathsError;
76
77// UEFI Shell Path variable is defined in Section 3.6.1
78// [UEFI Shell Specification](https://uefi.org/sites/default/files/resources/UEFI_Shell_2_2.pdf).
79pub fn join_paths<I, T>(paths: I) -> Result<OsString, JoinPathsError>
80where
81 I: Iterator<Item = T>,
82 T: AsRef<OsStr>,
83{
84 let mut joined = Vec::new();
85
86 for (i, path) in paths.enumerate() {
87 if i > 0 {
88 joined.push(PATHS_SEP)
89 }
90
91 let v = path.as_ref().encode_wide().collect::<Vec<u16>>();
92 if v.contains(&PATHS_SEP) {
93 return Err(JoinPathsError);
94 }
95
96 joined.extend_from_slice(&v);
97 }
98
99 Ok(OsString::from_wide(&joined))
100}
101
102impl fmt::Display for JoinPathsError {
103 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
104 "path segment contains `;`".fmt(f)
105 }
106}
107
108impl crate::error::Error for JoinPathsError {}
109
110pub fn current_exe() -> io::Result<PathBuf> {
111 let protocol = helpers::image_handle_protocol::<device_path::Protocol>(
112 loaded_image_device_path::PROTOCOL_GUID,
113 )?;
114 helpers::device_path_to_text(protocol).map(PathBuf::from)
115}
116
117pub fn temp_dir() -> PathBuf {
118 panic!("UEFI doesn't have a dedicated temp directory")
119}
120
121pub fn home_dir() -> Option<PathBuf> {
122 None
123}
library/std/src/sys/paths/unix.rs created+471
......@@ -0,0 +1,471 @@
1//! Implementation of `std::os` functionality for unix systems
2
3#![allow(unused_imports)] // lots of cfg code here
4
5use libc::{c_char, c_int, c_void};
6
7use crate::ffi::{CStr, OsStr, OsString};
8use crate::os::unix::prelude::*;
9use crate::path::{self, PathBuf};
10use crate::sys::helpers::run_path_with_cstr;
11use crate::sys::pal::cvt;
12use crate::{fmt, io, iter, mem, ptr, slice, str};
13
14const PATH_SEPARATOR: u8 = b':';
15
16#[cfg(target_os = "espidf")]
17pub fn getcwd() -> io::Result<PathBuf> {
18 Ok(PathBuf::from("/"))
19}
20
21#[cfg(not(target_os = "espidf"))]
22pub fn getcwd() -> io::Result<PathBuf> {
23 let mut buf = Vec::with_capacity(512);
24 loop {
25 unsafe {
26 let ptr = buf.as_mut_ptr() as *mut libc::c_char;
27 if !libc::getcwd(ptr, buf.capacity()).is_null() {
28 let len = CStr::from_ptr(buf.as_ptr() as *const libc::c_char).to_bytes().len();
29 buf.set_len(len);
30 buf.shrink_to_fit();
31 return Ok(PathBuf::from(OsString::from_vec(buf)));
32 } else {
33 let error = io::Error::last_os_error();
34 if error.raw_os_error() != Some(libc::ERANGE) {
35 return Err(error);
36 }
37 }
38
39 // Trigger the internal buffer resizing logic of `Vec` by requiring
40 // more space than the current capacity.
41 let cap = buf.capacity();
42 buf.set_len(cap);
43 buf.reserve(1);
44 }
45 }
46}
47
48#[cfg(target_os = "espidf")]
49pub fn chdir(_p: &path::Path) -> io::Result<()> {
50 crate::sys::pal::unsupported::unsupported()
51}
52
53#[cfg(not(target_os = "espidf"))]
54pub fn chdir(p: &path::Path) -> io::Result<()> {
55 let result = run_path_with_cstr(p, &|p| unsafe { Ok(libc::chdir(p.as_ptr())) })?;
56 if result == 0 { Ok(()) } else { Err(io::Error::last_os_error()) }
57}
58
59// This can't just be `impl Iterator` because that requires `'a` to be live on
60// drop (see #146045).
61pub type SplitPaths<'a> = iter::Map<
62 slice::Split<'a, u8, impl FnMut(&u8) -> bool + 'static>,
63 impl FnMut(&[u8]) -> PathBuf + 'static,
64>;
65
66#[define_opaque(SplitPaths)]
67pub fn split_paths(unparsed: &OsStr) -> SplitPaths<'_> {
68 fn is_separator(&b: &u8) -> bool {
69 b == PATH_SEPARATOR
70 }
71
72 fn into_pathbuf(part: &[u8]) -> PathBuf {
73 PathBuf::from(OsStr::from_bytes(part))
74 }
75
76 unparsed.as_bytes().split(is_separator).map(into_pathbuf)
77}
78
79#[derive(Debug)]
80pub struct JoinPathsError;
81
82pub fn join_paths<I, T>(paths: I) -> Result<OsString, JoinPathsError>
83where
84 I: Iterator<Item = T>,
85 T: AsRef<OsStr>,
86{
87 let mut joined = Vec::new();
88
89 for (i, path) in paths.enumerate() {
90 let path = path.as_ref().as_bytes();
91 if i > 0 {
92 joined.push(PATH_SEPARATOR)
93 }
94 if path.contains(&PATH_SEPARATOR) {
95 return Err(JoinPathsError);
96 }
97 joined.extend_from_slice(path);
98 }
99 Ok(OsStringExt::from_vec(joined))
100}
101
102impl fmt::Display for JoinPathsError {
103 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
104 write!(f, "path segment contains separator `{}`", char::from(PATH_SEPARATOR))
105 }
106}
107
108impl crate::error::Error for JoinPathsError {}
109
110#[cfg(target_os = "aix")]
111pub fn current_exe() -> io::Result<PathBuf> {
112 #[cfg(test)]
113 use realstd::env;
114
115 #[cfg(not(test))]
116 use crate::env;
117 use crate::io;
118
119 let exe_path = env::args().next().ok_or(io::const_error!(
120 io::ErrorKind::NotFound,
121 "an executable path was not found because no arguments were provided through argv",
122 ))?;
123 let path = PathBuf::from(exe_path);
124 if path.is_absolute() {
125 return path.canonicalize();
126 }
127 // Search PWD to infer current_exe.
128 if let Some(pstr) = path.to_str()
129 && pstr.contains("/")
130 {
131 return getcwd().map(|cwd| cwd.join(path))?.canonicalize();
132 }
133 // Search PATH to infer current_exe.
134 if let Some(p) = env::var_os(OsStr::from_bytes("PATH".as_bytes())) {
135 for search_path in split_paths(&p) {
136 let pb = search_path.join(&path);
137 if pb.is_file()
138 && let Ok(metadata) = crate::fs::metadata(&pb)
139 && metadata.permissions().mode() & 0o111 != 0
140 {
141 return pb.canonicalize();
142 }
143 }
144 }
145 Err(io::const_error!(io::ErrorKind::NotFound, "an executable path was not found"))
146}
147
148#[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
149pub fn current_exe() -> io::Result<PathBuf> {
150 unsafe {
151 let mut mib = [
152 libc::CTL_KERN as c_int,
153 libc::KERN_PROC as c_int,
154 libc::KERN_PROC_PATHNAME as c_int,
155 -1 as c_int,
156 ];
157 let mut sz = 0;
158 cvt(libc::sysctl(
159 mib.as_mut_ptr(),
160 mib.len() as libc::c_uint,
161 ptr::null_mut(),
162 &mut sz,
163 ptr::null_mut(),
164 0,
165 ))?;
166 if sz == 0 {
167 return Err(io::Error::last_os_error());
168 }
169 let mut v: Vec<u8> = Vec::with_capacity(sz);
170 cvt(libc::sysctl(
171 mib.as_mut_ptr(),
172 mib.len() as libc::c_uint,
173 v.as_mut_ptr() as *mut libc::c_void,
174 &mut sz,
175 ptr::null_mut(),
176 0,
177 ))?;
178 if sz == 0 {
179 return Err(io::Error::last_os_error());
180 }
181 v.set_len(sz - 1); // chop off trailing NUL
182 Ok(PathBuf::from(OsString::from_vec(v)))
183 }
184}
185
186#[cfg(target_os = "netbsd")]
187pub fn current_exe() -> io::Result<PathBuf> {
188 fn sysctl() -> io::Result<PathBuf> {
189 unsafe {
190 let mib = [libc::CTL_KERN, libc::KERN_PROC_ARGS, -1, libc::KERN_PROC_PATHNAME];
191 let mut path_len: usize = 0;
192 cvt(libc::sysctl(
193 mib.as_ptr(),
194 mib.len() as libc::c_uint,
195 ptr::null_mut(),
196 &mut path_len,
197 ptr::null(),
198 0,
199 ))?;
200 if path_len <= 1 {
201 return Err(io::const_error!(
202 io::ErrorKind::Uncategorized,
203 "KERN_PROC_PATHNAME sysctl returned zero-length string",
204 ));
205 }
206 let mut path: Vec<u8> = Vec::with_capacity(path_len);
207 cvt(libc::sysctl(
208 mib.as_ptr(),
209 mib.len() as libc::c_uint,
210 path.as_ptr() as *mut libc::c_void,
211 &mut path_len,
212 ptr::null(),
213 0,
214 ))?;
215 path.set_len(path_len - 1); // chop off NUL
216 Ok(PathBuf::from(OsString::from_vec(path)))
217 }
218 }
219 fn procfs() -> io::Result<PathBuf> {
220 let curproc_exe = path::Path::new("/proc/curproc/exe");
221 if curproc_exe.is_file() {
222 return crate::fs::read_link(curproc_exe);
223 }
224 Err(io::const_error!(
225 io::ErrorKind::Uncategorized,
226 "/proc/curproc/exe doesn't point to regular file.",
227 ))
228 }
229 sysctl().or_else(|_| procfs())
230}
231
232#[cfg(target_os = "openbsd")]
233pub fn current_exe() -> io::Result<PathBuf> {
234 unsafe {
235 let mut mib = [libc::CTL_KERN, libc::KERN_PROC_ARGS, libc::getpid(), libc::KERN_PROC_ARGV];
236 let mib = mib.as_mut_ptr();
237 let mut argv_len = 0;
238 cvt(libc::sysctl(mib, 4, ptr::null_mut(), &mut argv_len, ptr::null_mut(), 0))?;
239 let mut argv = Vec::<*const libc::c_char>::with_capacity(argv_len as usize);
240 cvt(libc::sysctl(mib, 4, argv.as_mut_ptr() as *mut _, &mut argv_len, ptr::null_mut(), 0))?;
241 argv.set_len(argv_len as usize);
242 if argv[0].is_null() {
243 return Err(io::const_error!(io::ErrorKind::Uncategorized, "no current exe available"));
244 }
245 let argv0 = CStr::from_ptr(argv[0]).to_bytes();
246 if argv0[0] == b'.' || argv0.iter().any(|b| *b == b'/') {
247 crate::fs::canonicalize(OsStr::from_bytes(argv0))
248 } else {
249 Ok(PathBuf::from(OsStr::from_bytes(argv0)))
250 }
251 }
252}
253
254#[cfg(any(
255 target_os = "linux",
256 target_os = "cygwin",
257 target_os = "hurd",
258 target_os = "android",
259 target_os = "nuttx",
260 target_os = "emscripten"
261))]
262pub fn current_exe() -> io::Result<PathBuf> {
263 match crate::fs::read_link("/proc/self/exe") {
264 Err(ref e) if e.kind() == io::ErrorKind::NotFound => Err(io::const_error!(
265 io::ErrorKind::Uncategorized,
266 "no /proc/self/exe available. Is /proc mounted?",
267 )),
268 other => other,
269 }
270}
271
272#[cfg(target_os = "nto")]
273pub fn current_exe() -> io::Result<PathBuf> {
274 let mut e = crate::fs::read("/proc/self/exefile")?;
275 // Current versions of QNX Neutrino provide a null-terminated path.
276 // Ensure the trailing null byte is not returned here.
277 if let Some(0) = e.last() {
278 e.pop();
279 }
280 Ok(PathBuf::from(OsString::from_vec(e)))
281}
282
283#[cfg(target_vendor = "apple")]
284pub fn current_exe() -> io::Result<PathBuf> {
285 unsafe {
286 let mut sz: u32 = 0;
287 #[expect(deprecated)]
288 libc::_NSGetExecutablePath(ptr::null_mut(), &mut sz);
289 if sz == 0 {
290 return Err(io::Error::last_os_error());
291 }
292 let mut v: Vec<u8> = Vec::with_capacity(sz as usize);
293 #[expect(deprecated)]
294 let err = libc::_NSGetExecutablePath(v.as_mut_ptr() as *mut i8, &mut sz);
295 if err != 0 {
296 return Err(io::Error::last_os_error());
297 }
298 v.set_len(sz as usize - 1); // chop off trailing NUL
299 Ok(PathBuf::from(OsString::from_vec(v)))
300 }
301}
302
303#[cfg(any(target_os = "solaris", target_os = "illumos"))]
304pub fn current_exe() -> io::Result<PathBuf> {
305 if let Ok(path) = crate::fs::read_link("/proc/self/path/a.out") {
306 Ok(path)
307 } else {
308 unsafe {
309 let path = libc::getexecname();
310 if path.is_null() {
311 Err(io::Error::last_os_error())
312 } else {
313 let filename = CStr::from_ptr(path).to_bytes();
314 let path = PathBuf::from(<OsStr as OsStrExt>::from_bytes(filename));
315
316 // Prepend a current working directory to the path if
317 // it doesn't contain an absolute pathname.
318 if filename[0] == b'/' { Ok(path) } else { getcwd().map(|cwd| cwd.join(path)) }
319 }
320 }
321 }
322}
323
324#[cfg(target_os = "haiku")]
325pub fn current_exe() -> io::Result<PathBuf> {
326 let mut name = vec![0; libc::PATH_MAX as usize];
327 unsafe {
328 let result = libc::find_path(
329 crate::ptr::null_mut(),
330 libc::B_FIND_PATH_IMAGE_PATH,
331 crate::ptr::null_mut(),
332 name.as_mut_ptr(),
333 name.len(),
334 );
335 if result != libc::B_OK {
336 Err(io::const_error!(io::ErrorKind::Uncategorized, "error getting executable path"))
337 } else {
338 // find_path adds the null terminator.
339 let name = CStr::from_ptr(name.as_ptr()).to_bytes();
340 Ok(PathBuf::from(OsStr::from_bytes(name)))
341 }
342 }
343}
344
345#[cfg(target_os = "redox")]
346pub fn current_exe() -> io::Result<PathBuf> {
347 crate::fs::read_to_string("/scheme/sys/exe").map(PathBuf::from)
348}
349
350#[cfg(target_os = "rtems")]
351pub fn current_exe() -> io::Result<PathBuf> {
352 crate::fs::read_to_string("sys:exe").map(PathBuf::from)
353}
354
355#[cfg(target_os = "l4re")]
356pub fn current_exe() -> io::Result<PathBuf> {
357 Err(io::const_error!(io::ErrorKind::Unsupported, "not yet implemented!"))
358}
359
360#[cfg(target_os = "vxworks")]
361pub fn current_exe() -> io::Result<PathBuf> {
362 #[cfg(test)]
363 use realstd::env;
364
365 #[cfg(not(test))]
366 use crate::env;
367
368 let exe_path = env::args().next().unwrap();
369 let path = path::Path::new(&exe_path);
370 path.canonicalize()
371}
372
373#[cfg(any(target_os = "espidf", target_os = "horizon", target_os = "vita"))]
374pub fn current_exe() -> io::Result<PathBuf> {
375 crate::sys::pal::unsupported::unsupported()
376}
377
378#[cfg(target_os = "fuchsia")]
379pub fn current_exe() -> io::Result<PathBuf> {
380 #[cfg(test)]
381 use realstd::env;
382
383 #[cfg(not(test))]
384 use crate::env;
385
386 let exe_path = env::args().next().ok_or(io::const_error!(
387 io::ErrorKind::Uncategorized,
388 "an executable path was not found because no arguments were provided through argv",
389 ))?;
390 let path = PathBuf::from(exe_path);
391
392 // Prepend the current working directory to the path if it's not absolute.
393 if !path.is_absolute() { getcwd().map(|cwd| cwd.join(path)) } else { Ok(path) }
394}
395
396#[cfg(all(target_vendor = "apple", not(miri)))]
397fn darwin_temp_dir() -> PathBuf {
398 crate::sys::pal::conf::confstr(libc::_CS_DARWIN_USER_TEMP_DIR, Some(64))
399 .map(PathBuf::from)
400 .unwrap_or_else(|_| {
401 // It failed for whatever reason (there are several possible reasons),
402 // so return the global one.
403 PathBuf::from("/tmp")
404 })
405}
406
407pub fn temp_dir() -> PathBuf {
408 crate::env::var_os("TMPDIR").map(PathBuf::from).unwrap_or_else(|| {
409 cfg_select! {
410 all(target_vendor = "apple", not(miri)) => darwin_temp_dir(),
411 target_os = "android" => PathBuf::from("/data/local/tmp"),
412 _ => PathBuf::from("/tmp"),
413 }
414 })
415}
416
417pub fn home_dir() -> Option<PathBuf> {
418 return crate::env::var_os("HOME")
419 .filter(|s| !s.is_empty())
420 .or_else(|| unsafe { fallback() })
421 .map(PathBuf::from);
422
423 #[cfg(any(
424 target_os = "android",
425 target_os = "emscripten",
426 target_os = "redox",
427 target_os = "vxworks",
428 target_os = "espidf",
429 target_os = "horizon",
430 target_os = "vita",
431 target_os = "nuttx",
432 all(target_vendor = "apple", not(target_os = "macos")),
433 ))]
434 unsafe fn fallback() -> Option<OsString> {
435 None
436 }
437 #[cfg(not(any(
438 target_os = "android",
439 target_os = "emscripten",
440 target_os = "redox",
441 target_os = "vxworks",
442 target_os = "espidf",
443 target_os = "horizon",
444 target_os = "vita",
445 target_os = "nuttx",
446 all(target_vendor = "apple", not(target_os = "macos")),
447 )))]
448 unsafe fn fallback() -> Option<OsString> {
449 let amt = match libc::sysconf(libc::_SC_GETPW_R_SIZE_MAX) {
450 n if n < 0 => 512 as usize,
451 n => n as usize,
452 };
453 let mut buf = Vec::with_capacity(amt);
454 let mut p = mem::MaybeUninit::<libc::passwd>::uninit();
455 let mut result = ptr::null_mut();
456 match libc::getpwuid_r(
457 libc::getuid(),
458 p.as_mut_ptr(),
459 buf.as_mut_ptr(),
460 buf.capacity(),
461 &mut result,
462 ) {
463 0 if !result.is_null() => {
464 let ptr = (*result).pw_dir as *const _;
465 let bytes = CStr::from_ptr(ptr).to_bytes().to_vec();
466 Some(OsStringExt::from_vec(bytes))
467 }
468 _ => None,
469 }
470 }
471}
library/std/src/sys/paths/unsupported.rs created+57
......@@ -0,0 +1,57 @@
1use crate::ffi::{OsStr, OsString};
2use crate::marker::PhantomData;
3use crate::path::{self, PathBuf};
4use crate::sys::pal::unsupported;
5use crate::{fmt, io};
6
7pub fn getcwd() -> io::Result<PathBuf> {
8 unsupported()
9}
10
11pub fn chdir(_: &path::Path) -> io::Result<()> {
12 unsupported()
13}
14
15pub struct SplitPaths<'a>(!, PhantomData<&'a ()>);
16
17pub fn split_paths(_unparsed: &OsStr) -> SplitPaths<'_> {
18 panic!("unsupported")
19}
20
21impl<'a> Iterator for SplitPaths<'a> {
22 type Item = PathBuf;
23 fn next(&mut self) -> Option<PathBuf> {
24 self.0
25 }
26}
27
28#[derive(Debug)]
29pub struct JoinPathsError;
30
31pub fn join_paths<I, T>(_paths: I) -> Result<OsString, JoinPathsError>
32where
33 I: Iterator<Item = T>,
34 T: AsRef<OsStr>,
35{
36 Err(JoinPathsError)
37}
38
39impl fmt::Display for JoinPathsError {
40 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
41 "not supported on this platform yet".fmt(f)
42 }
43}
44
45impl crate::error::Error for JoinPathsError {}
46
47pub fn current_exe() -> io::Result<PathBuf> {
48 unsupported()
49}
50
51pub fn temp_dir() -> PathBuf {
52 panic!("no filesystem on this platform")
53}
54
55pub fn home_dir() -> Option<PathBuf> {
56 None
57}
library/std/src/sys/paths/wasi.rs created+45
......@@ -0,0 +1,45 @@
1#![forbid(unsafe_op_in_unsafe_fn)]
2
3use crate::ffi::{CStr, OsString};
4use crate::io;
5use crate::os::wasi::prelude::*;
6use crate::path::{self, PathBuf};
7use crate::sys::helpers::run_path_with_cstr;
8
9pub fn getcwd() -> io::Result<PathBuf> {
10 let mut buf = Vec::with_capacity(512);
11 loop {
12 unsafe {
13 let ptr = buf.as_mut_ptr() as *mut libc::c_char;
14 if !libc::getcwd(ptr, buf.capacity()).is_null() {
15 let len = CStr::from_ptr(buf.as_ptr() as *const libc::c_char).to_bytes().len();
16 buf.set_len(len);
17 buf.shrink_to_fit();
18 return Ok(PathBuf::from(OsString::from_vec(buf)));
19 } else {
20 let error = io::Error::last_os_error();
21 if error.raw_os_error() != Some(libc::ERANGE) {
22 return Err(error);
23 }
24 }
25
26 // Trigger the internal buffer resizing logic of `Vec` by requiring
27 // more space than the current capacity.
28 let cap = buf.capacity();
29 buf.set_len(cap);
30 buf.reserve(1);
31 }
32 }
33}
34
35pub fn chdir(p: &path::Path) -> io::Result<()> {
36 let result = run_path_with_cstr(p, &|p| unsafe { Ok(libc::chdir(p.as_ptr())) })?;
37 match result == (0 as libc::c_int) {
38 true => Ok(()),
39 false => Err(io::Error::last_os_error()),
40 }
41}
42
43pub fn temp_dir() -> PathBuf {
44 panic!("not supported by WASI yet")
45}
library/std/src/sys/paths/windows.rs created+179
......@@ -0,0 +1,179 @@
1//! Implementation of `std::os` functionality for Windows.
2
3#![allow(nonstandard_style)]
4
5use crate::ffi::{OsStr, OsString};
6use crate::os::windows::ffi::EncodeWide;
7use crate::os::windows::prelude::*;
8use crate::path::{self, PathBuf};
9#[cfg(not(target_vendor = "uwp"))]
10use crate::sys::pal::api::WinError;
11use crate::sys::pal::{api, c, cvt, fill_utf16_buf, os2path};
12use crate::{fmt, io, ptr};
13
14pub struct SplitPaths<'a> {
15 data: EncodeWide<'a>,
16 must_yield: bool,
17}
18
19pub fn split_paths(unparsed: &OsStr) -> SplitPaths<'_> {
20 SplitPaths { data: unparsed.encode_wide(), must_yield: true }
21}
22
23impl<'a> Iterator for SplitPaths<'a> {
24 type Item = PathBuf;
25 fn next(&mut self) -> Option<PathBuf> {
26 // On Windows, the PATH environment variable is semicolon separated.
27 // Double quotes are used as a way of introducing literal semicolons
28 // (since c:\some;dir is a valid Windows path). Double quotes are not
29 // themselves permitted in path names, so there is no way to escape a
30 // double quote. Quoted regions can appear in arbitrary locations, so
31 //
32 // c:\foo;c:\som"e;di"r;c:\bar
33 //
34 // Should parse as [c:\foo, c:\some;dir, c:\bar].
35 //
36 // (The above is based on testing; there is no clear reference available
37 // for the grammar.)
38
39 let must_yield = self.must_yield;
40 self.must_yield = false;
41
42 let mut in_progress = Vec::new();
43 let mut in_quote = false;
44 for b in self.data.by_ref() {
45 if b == '"' as u16 {
46 in_quote = !in_quote;
47 } else if b == ';' as u16 && !in_quote {
48 self.must_yield = true;
49 break;
50 } else {
51 in_progress.push(b)
52 }
53 }
54
55 if !must_yield && in_progress.is_empty() { None } else { Some(os2path(&in_progress)) }
56 }
57}
58
59#[derive(Debug)]
60pub struct JoinPathsError;
61
62pub fn join_paths<I, T>(paths: I) -> Result<OsString, JoinPathsError>
63where
64 I: Iterator<Item = T>,
65 T: AsRef<OsStr>,
66{
67 let mut joined = Vec::new();
68 let sep = b';' as u16;
69
70 for (i, path) in paths.enumerate() {
71 let path = path.as_ref();
72 if i > 0 {
73 joined.push(sep)
74 }
75 let v = path.encode_wide().collect::<Vec<u16>>();
76 if v.contains(&(b'"' as u16)) {
77 return Err(JoinPathsError);
78 } else if v.contains(&sep) {
79 joined.push(b'"' as u16);
80 joined.extend_from_slice(&v[..]);
81 joined.push(b'"' as u16);
82 } else {
83 joined.extend_from_slice(&v[..]);
84 }
85 }
86
87 Ok(OsStringExt::from_wide(&joined[..]))
88}
89
90impl fmt::Display for JoinPathsError {
91 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
92 "path segment contains `\"`".fmt(f)
93 }
94}
95
96impl crate::error::Error for JoinPathsError {}
97
98pub fn current_exe() -> io::Result<PathBuf> {
99 fill_utf16_buf(|buf, sz| unsafe { c::GetModuleFileNameW(ptr::null_mut(), buf, sz) }, os2path)
100}
101
102pub fn getcwd() -> io::Result<PathBuf> {
103 fill_utf16_buf(|buf, sz| unsafe { c::GetCurrentDirectoryW(sz, buf) }, os2path)
104}
105
106pub fn chdir(p: &path::Path) -> io::Result<()> {
107 let p: &OsStr = p.as_ref();
108 let mut p = p.encode_wide().collect::<Vec<_>>();
109 p.push(0);
110
111 cvt(unsafe { c::SetCurrentDirectoryW(p.as_ptr()) }).map(drop)
112}
113
114pub fn temp_dir() -> PathBuf {
115 fill_utf16_buf(|buf, sz| unsafe { c::GetTempPath2W(sz, buf) }, os2path).unwrap()
116}
117
118#[cfg(all(not(target_vendor = "uwp"), not(target_vendor = "win7")))]
119fn home_dir_crt() -> Option<PathBuf> {
120 unsafe {
121 // Defined in processthreadsapi.h.
122 const CURRENT_PROCESS_TOKEN: usize = -4_isize as usize;
123
124 fill_utf16_buf(
125 |buf, mut sz| {
126 // GetUserProfileDirectoryW does not quite use the usual protocol for
127 // negotiating the buffer size, so we have to translate.
128 match c::GetUserProfileDirectoryW(
129 ptr::without_provenance_mut(CURRENT_PROCESS_TOKEN),
130 buf,
131 &mut sz,
132 ) {
133 0 if api::get_last_error() != WinError::INSUFFICIENT_BUFFER => 0,
134 0 => sz,
135 _ => sz - 1, // sz includes the null terminator
136 }
137 },
138 os2path,
139 )
140 .ok()
141 }
142}
143
144#[cfg(target_vendor = "win7")]
145fn home_dir_crt() -> Option<PathBuf> {
146 unsafe {
147 use crate::sys::handle::Handle;
148
149 let me = c::GetCurrentProcess();
150 let mut token = ptr::null_mut();
151 if c::OpenProcessToken(me, c::TOKEN_READ, &mut token) == 0 {
152 return None;
153 }
154 let _handle = Handle::from_raw_handle(token);
155 fill_utf16_buf(
156 |buf, mut sz| {
157 match c::GetUserProfileDirectoryW(token, buf, &mut sz) {
158 0 if api::get_last_error() != WinError::INSUFFICIENT_BUFFER => 0,
159 0 => sz,
160 _ => sz - 1, // sz includes the null terminator
161 }
162 },
163 os2path,
164 )
165 .ok()
166 }
167}
168
169#[cfg(target_vendor = "uwp")]
170fn home_dir_crt() -> Option<PathBuf> {
171 None
172}
173
174pub fn home_dir() -> Option<PathBuf> {
175 crate::env::var_os("USERPROFILE")
176 .filter(|s| !s.is_empty())
177 .map(PathBuf::from)
178 .or_else(home_dir_crt)
179}
library/std/tests/sync/mpmc.rs-3
......@@ -475,7 +475,6 @@ fn stress_recv_timeout_two_threads() {
475475 });
476476
477477 let mut recv_count = 0;
478 let mut got_timeout = false;
479478 loop {
480479 match rx.recv_timeout(timeout) {
481480 Ok(n) => {
......@@ -483,7 +482,6 @@ fn stress_recv_timeout_two_threads() {
483482 recv_count += 1;
484483 }
485484 Err(RecvTimeoutError::Timeout) => {
486 got_timeout = true;
487485 continue;
488486 }
489487 Err(RecvTimeoutError::Disconnected) => break,
......@@ -491,7 +489,6 @@ fn stress_recv_timeout_two_threads() {
491489 }
492490
493491 assert_eq!(recv_count, stress);
494 assert!(got_timeout);
495492}
496493
497494#[test]
library/std/tests/sync/mpsc.rs-3
......@@ -438,7 +438,6 @@ fn stress_recv_timeout_two_threads() {
438438 });
439439
440440 let mut recv_count = 0;
441 let mut got_timeout = false;
442441 loop {
443442 match rx.recv_timeout(timeout) {
444443 Ok(n) => {
......@@ -446,7 +445,6 @@ fn stress_recv_timeout_two_threads() {
446445 recv_count += 1;
447446 }
448447 Err(RecvTimeoutError::Timeout) => {
449 got_timeout = true;
450448 continue;
451449 }
452450 Err(RecvTimeoutError::Disconnected) => break,
......@@ -454,7 +452,6 @@ fn stress_recv_timeout_two_threads() {
454452 }
455453
456454 assert_eq!(recv_count, stress);
457 assert!(got_timeout);
458455}
459456
460457#[test]
library/stdarch/crates/core_arch/src/mips/msa.rs-1
......@@ -9187,7 +9187,6 @@ mod tests {
91879187 core_arch::{mips::msa::*, simd::*},
91889188 mem,
91899189 };
9190 use std::{f32, f64};
91919190 use stdarch_test::simd_test;
91929191
91939192 #[simd_test(enable = "msa")]
src/tools/clippy/clippy_lints/src/functions/must_use.rs+3-3
......@@ -24,7 +24,7 @@ use super::{DOUBLE_MUST_USE, MUST_USE_CANDIDATE, MUST_USE_UNIT};
2424
2525pub(super) fn check_item<'tcx>(cx: &LateContext<'tcx>, item: &'tcx hir::Item<'_>) {
2626 let attrs = cx.tcx.hir_attrs(item.hir_id());
27 let attr = find_attr!(cx.tcx.hir_attrs(item.hir_id()), MustUse { span, reason } => (span, reason));
27 let attr = find_attr!(cx.tcx, item.hir_id(), MustUse { span, reason } => (span, reason));
2828 if let hir::ItemKind::Fn {
2929 ref sig,
3030 body: ref body_id,
......@@ -65,7 +65,7 @@ pub(super) fn check_impl_item<'tcx>(cx: &LateContext<'tcx>, item: &'tcx hir::Imp
6565 let is_public = cx.effective_visibilities.is_exported(item.owner_id.def_id);
6666 let fn_header_span = item.span.with_hi(sig.decl.output.span().hi());
6767 let attrs = cx.tcx.hir_attrs(item.hir_id());
68 let attr = find_attr!(cx.tcx.hir_attrs(item.hir_id()), MustUse { span, reason } => (span, reason));
68 let attr = find_attr!(cx.tcx, item.hir_id(), MustUse { span, reason } => (span, reason));
6969 if let Some((attr_span, reason)) = attr {
7070 check_needless_must_use(
7171 cx,
......@@ -98,7 +98,7 @@ pub(super) fn check_trait_item<'tcx>(cx: &LateContext<'tcx>, item: &'tcx hir::Tr
9898 let fn_header_span = item.span.with_hi(sig.decl.output.span().hi());
9999
100100 let attrs = cx.tcx.hir_attrs(item.hir_id());
101 let attr = find_attr!(cx.tcx.hir_attrs(item.hir_id()), MustUse { span, reason } => (span, reason));
101 let attr = find_attr!(cx.tcx, item.hir_id(), MustUse { span, reason } => (span, reason));
102102 if let Some((attr_span, reason)) = attr {
103103 check_needless_must_use(
104104 cx,
src/tools/clippy/clippy_lints/src/incompatible_msrv.rs+1-1
......@@ -269,5 +269,5 @@ impl<'tcx> LateLintPass<'tcx> for IncompatibleMsrv {
269269fn is_under_cfg_attribute(cx: &LateContext<'_>, hir_id: HirId) -> bool {
270270 cx.tcx
271271 .hir_parent_id_iter(hir_id)
272 .any(|id| find_attr!(cx.tcx.hir_attrs(id), CfgTrace(..) | CfgAttrTrace))
272 .any(|id| find_attr!(cx.tcx, id, CfgTrace(..) | CfgAttrTrace))
273273}
src/tools/clippy/clippy_lints/src/manual_non_exhaustive.rs+2-2
......@@ -92,7 +92,7 @@ impl<'tcx> LateLintPass<'tcx> for ManualNonExhaustive {
9292 .then_some((v.def_id, v.span))
9393 });
9494 if let Ok((id, span)) = iter.exactly_one()
95 && !find_attr!(cx.tcx.hir_attrs(item.hir_id()), NonExhaustive(..))
95 && !find_attr!(cx.tcx, item.hir_id(), NonExhaustive(..))
9696 {
9797 self.potential_enums.push((item.owner_id.def_id, id, item.span, span));
9898 }
......@@ -113,7 +113,7 @@ impl<'tcx> LateLintPass<'tcx> for ManualNonExhaustive {
113113 "this seems like a manual implementation of the non-exhaustive pattern",
114114 |diag| {
115115 if let Some(non_exhaustive_span) =
116 find_attr!(cx.tcx.hir_attrs(item.hir_id()), NonExhaustive(span) => *span)
116 find_attr!(cx.tcx, item.hir_id(), NonExhaustive(span) => *span)
117117 {
118118 diag.span_note(non_exhaustive_span, "the struct is already non-exhaustive");
119119 } else {
src/tools/clippy/clippy_lints/src/methods/is_empty.rs+1-1
......@@ -39,7 +39,7 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &'_ Expr<'_>, receiver: &Expr<'_
3939fn is_under_cfg(cx: &LateContext<'_>, id: HirId) -> bool {
4040 cx.tcx
4141 .hir_parent_id_iter(id)
42 .any(|id| find_attr!(cx.tcx.hir_attrs(id), CfgTrace(..)))
42 .any(|id| find_attr!(cx.tcx, id, CfgTrace(..)))
4343}
4444
4545/// Similar to [`clippy_utils::expr_or_init`], but does not go up the chain if the initialization
src/tools/clippy/clippy_utils/src/lib.rs+3-3
......@@ -1710,7 +1710,7 @@ pub fn has_attr(attrs: &[hir::Attribute], symbol: Symbol) -> bool {
17101710}
17111711
17121712pub fn has_repr_attr(cx: &LateContext<'_>, hir_id: HirId) -> bool {
1713 find_attr!(cx.tcx.hir_attrs(hir_id), Repr { .. })
1713 find_attr!(cx.tcx, hir_id, Repr { .. })
17141714}
17151715
17161716pub fn any_parent_has_attr(tcx: TyCtxt<'_>, node: HirId, symbol: Symbol) -> bool {
......@@ -2410,7 +2410,7 @@ fn with_test_item_names(tcx: TyCtxt<'_>, module: LocalModDefId, f: impl FnOnce(&
24102410 && let TyKind::Path(QPath::Resolved(_, path)) = ty.kind
24112411 // We could also check for the type name `test::TestDescAndFn`
24122412 && let Res::Def(DefKind::Struct, _) = path.res
2413 && find_attr!(tcx.hir_attrs(item.hir_id()), RustcTestMarker(..))
2413 && find_attr!(tcx, item.hir_id(), RustcTestMarker(..))
24142414 {
24152415 names.push(ident.name);
24162416 }
......@@ -2468,7 +2468,7 @@ pub fn is_test_function(tcx: TyCtxt<'_>, fn_def_id: LocalDefId) -> bool {
24682468/// This only checks directly applied attributes, to see if a node is inside a `#[cfg(test)]` parent
24692469/// use [`is_in_cfg_test`]
24702470pub fn is_cfg_test(tcx: TyCtxt<'_>, id: HirId) -> bool {
2471 if let Some(cfgs) = find_attr!(tcx.hir_attrs(id), CfgTrace(cfgs) => cfgs)
2471 if let Some(cfgs) = find_attr!(tcx, id, CfgTrace(cfgs) => cfgs)
24722472 && cfgs
24732473 .iter()
24742474 .any(|(cfg, _)| matches!(cfg, CfgEntry::NameValue { name: sym::test, .. }))
src/tools/compiletest/src/runtest.rs+8-1
......@@ -1919,8 +1919,15 @@ impl<'test> TestCx<'test> {
19191919 compiler.args(&["-A", "unused", "-W", "unused_attributes"]);
19201920 }
19211921
1922 // Allow tests to use internal features.
1922 // Allow tests to use internal and incomplete features.
19231923 compiler.args(&["-A", "internal_features"]);
1924 // FIXME(#154168); temporarily exclude some directories to make the transition easier
1925 if !input_file
1926 .iter()
1927 .any(|p| p == "traits" || p == "specialization" || p == "const-generics")
1928 {
1929 compiler.args(&["-A", "incomplete_features"]);
1930 }
19241931
19251932 // Allow tests to have unused parens and braces.
19261933 // Add #![deny(unused_parens, unused_braces)] to the test file if you want to
src/tools/rustfmt/src/vertical.rs+1-1
......@@ -198,7 +198,7 @@ fn struct_field_prefix_max_min_width<T: AlignedItem>(
198198 .rewrite_prefix(context, shape)
199199 .map(|field_str| trimmed_last_line_width(&field_str))
200200 })
201 .fold_ok((0, ::std::usize::MAX), |(max_len, min_len), len| {
201 .fold_ok((0, usize::MAX), |(max_len, min_len), len| {
202202 (cmp::max(max_len, len), cmp::min(min_len, len))
203203 })
204204 .unwrap_or((0, 0))
tests/run-make/compressed-debuginfo/rmake.rs+1-1
......@@ -23,7 +23,7 @@ fn check_compression(compression: &str, to_find: &str) {
2323 } else {
2424 assert_contains(
2525 stderr,
26 format!("unknown debuginfo compression algorithm {compression}"),
26 format!("unsupported debuginfo compression algorithm {compression}"),
2727 );
2828 }
2929 });
tests/ui/associated-consts/type-const-in-array-len-wrong-type.rs-3
......@@ -1,9 +1,6 @@
11#![feature(generic_const_exprs)]
2//~^ WARN the feature `generic_const_exprs` is incomplete
32#![feature(min_generic_const_args)]
4//~^ WARN the feature `min_generic_const_args` is incomplete
53#![feature(inherent_associated_types)]
6//~^ WARN the feature `inherent_associated_types` is incomplete
74
85struct OnDiskDirEntry<'a>(&'a ());
96
tests/ui/associated-consts/type-const-in-array-len-wrong-type.stderr+2-27
......@@ -1,35 +1,10 @@
1warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes
2 --> $DIR/type-const-in-array-len-wrong-type.rs:1:12
3 |
4LL | #![feature(generic_const_exprs)]
5 | ^^^^^^^^^^^^^^^^^^^
6 |
7 = note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
8 = note: `#[warn(incomplete_features)]` on by default
9
10warning: the feature `min_generic_const_args` is incomplete and may not be safe to use and/or cause compiler crashes
11 --> $DIR/type-const-in-array-len-wrong-type.rs:3:12
12 |
13LL | #![feature(min_generic_const_args)]
14 | ^^^^^^^^^^^^^^^^^^^^^^
15 |
16 = note: see issue #132980 <https://github.com/rust-lang/rust/issues/132980> for more information
17
18warning: the feature `inherent_associated_types` is incomplete and may not be safe to use and/or cause compiler crashes
19 --> $DIR/type-const-in-array-len-wrong-type.rs:5:12
20 |
21LL | #![feature(inherent_associated_types)]
22 | ^^^^^^^^^^^^^^^^^^^^^^^^^
23 |
24 = note: see issue #8995 <https://github.com/rust-lang/rust/issues/8995> for more information
25
261error: the constant `2` is not of type `usize`
27 --> $DIR/type-const-in-array-len-wrong-type.rs:13:26
2 --> $DIR/type-const-in-array-len-wrong-type.rs:10:26
283 |
294LL | fn lfn_contents() -> [char; Self::LFN_FRAGMENT_LEN] {
305 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `i64`
316 |
327 = note: the length of array `[char; 2]` must be type `usize`
338
34error: aborting due to 1 previous error; 3 warnings emitted
9error: aborting due to 1 previous error
3510
tests/ui/associated-consts/type-const-in-array-len.rs-2
......@@ -1,9 +1,7 @@
11//@ check-pass
22
33#![feature(min_generic_const_args)]
4//~^ WARN the feature `min_generic_const_args` is incomplete
54#![feature(inherent_associated_types)]
6//~^ WARN the feature `inherent_associated_types` is incomplete
75
86// Test case from #138226: generic impl with multiple type parameters
97struct Foo<A, B>(A, B);
tests/ui/associated-consts/type-const-in-array-len.stderr deleted-19
......@@ -1,19 +0,0 @@
1warning: the feature `min_generic_const_args` is incomplete and may not be safe to use and/or cause compiler crashes
2 --> $DIR/type-const-in-array-len.rs:3:12
3 |
4LL | #![feature(min_generic_const_args)]
5 | ^^^^^^^^^^^^^^^^^^^^^^
6 |
7 = note: see issue #132980 <https://github.com/rust-lang/rust/issues/132980> for more information
8 = note: `#[warn(incomplete_features)]` on by default
9
10warning: the feature `inherent_associated_types` is incomplete and may not be safe to use and/or cause compiler crashes
11 --> $DIR/type-const-in-array-len.rs:5:12
12 |
13LL | #![feature(inherent_associated_types)]
14 | ^^^^^^^^^^^^^^^^^^^^^^^^^
15 |
16 = note: see issue #8995 <https://github.com/rust-lang/rust/issues/8995> for more information
17
18warning: 2 warnings emitted
19
tests/ui/associated-inherent-types/hr-do-not-blame-outlives-static-ice.rs-1
......@@ -2,7 +2,6 @@
22
33// Regression test for #146467.
44#![feature(inherent_associated_types)]
5//~^ WARN the feature `inherent_associated_types` is incomplete
65
76struct Foo<T>(T);
87
tests/ui/associated-inherent-types/hr-do-not-blame-outlives-static-ice.stderr+4-13
......@@ -1,20 +1,11 @@
1warning: the feature `inherent_associated_types` is incomplete and may not be safe to use and/or cause compiler crashes
2 --> $DIR/hr-do-not-blame-outlives-static-ice.rs:4:12
3 |
4LL | #![feature(inherent_associated_types)]
5 | ^^^^^^^^^^^^^^^^^^^^^^^^^
6 |
7 = note: see issue #8995 <https://github.com/rust-lang/rust/issues/8995> for more information
8 = note: `#[warn(incomplete_features)]` on by default
9
101error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates
11 --> $DIR/hr-do-not-blame-outlives-static-ice.rs:9:6
2 --> $DIR/hr-do-not-blame-outlives-static-ice.rs:8:6
123 |
134LL | impl<'a> Foo<fn(&())> {
145 | ^^ unconstrained lifetime parameter
156
167error[E0308]: mismatched types
17 --> $DIR/hr-do-not-blame-outlives-static-ice.rs:14:11
8 --> $DIR/hr-do-not-blame-outlives-static-ice.rs:13:11
189 |
1910LL | fn foo(_: for<'a> fn(Foo<fn(&'a ())>::Assoc)) {}
2011 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
......@@ -23,12 +14,12 @@ LL | fn foo(_: for<'a> fn(Foo<fn(&'a ())>::Assoc)) {}
2314 found struct `Foo<for<'a> fn(&'a ())>`
2415
2516error: higher-ranked subtype error
26 --> $DIR/hr-do-not-blame-outlives-static-ice.rs:14:1
17 --> $DIR/hr-do-not-blame-outlives-static-ice.rs:13:1
2718 |
2819LL | fn foo(_: for<'a> fn(Foo<fn(&'a ())>::Assoc)) {}
2920 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3021
31error: aborting due to 3 previous errors; 1 warning emitted
22error: aborting due to 3 previous errors
3223
3324Some errors have detailed explanations: E0207, E0308.
3425For more information about an error, try `rustc --explain E0207`.
tests/ui/associated-inherent-types/variance-computation-requires-equality.rs-1
......@@ -1,7 +1,6 @@
11//@ check-pass
22
33#![feature(inherent_associated_types)]
4//~^ WARN the feature `inherent_associated_types` is incomplete
54
65struct D<T> {
76 a: T
tests/ui/associated-inherent-types/variance-computation-requires-equality.stderr deleted-11
......@@ -1,11 +0,0 @@
1warning: the feature `inherent_associated_types` is incomplete and may not be safe to use and/or cause compiler crashes
2 --> $DIR/variance-computation-requires-equality.rs:3:12
3 |
4LL | #![feature(inherent_associated_types)]
5 | ^^^^^^^^^^^^^^^^^^^^^^^^^
6 |
7 = note: see issue #8995 <https://github.com/rust-lang/rust/issues/8995> for more information
8 = note: `#[warn(incomplete_features)]` on by default
9
10warning: 1 warning emitted
11
tests/ui/associated-types/defaults-specialization.rs-1
......@@ -1,7 +1,6 @@
11//! Tests the interaction of associated type defaults and specialization.
22
33#![feature(associated_type_defaults, specialization)]
4//~^ WARN the feature `specialization` is incomplete
54
65trait Tr {
76 type Ty = u8;
tests/ui/associated-types/defaults-specialization.stderr+16-26
......@@ -1,21 +1,11 @@
1warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
2 --> $DIR/defaults-specialization.rs:3:38
3 |
4LL | #![feature(associated_type_defaults, specialization)]
5 | ^^^^^^^^^^^^^^
6 |
7 = note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
8 = help: consider using `min_specialization` instead, which is more stable and complete
9 = note: `#[warn(incomplete_features)]` on by default
10
111error[E0053]: method `make` has an incompatible type for trait
12 --> $DIR/defaults-specialization.rs:19:18
2 --> $DIR/defaults-specialization.rs:18:18
133 |
144LL | fn make() -> u8 { 0 }
155 | ^^ expected associated type, found `u8`
166 |
177note: type in trait
18 --> $DIR/defaults-specialization.rs:9:18
8 --> $DIR/defaults-specialization.rs:8:18
199 |
2010LL | fn make() -> Self::Ty {
2111 | ^^^^^^^^
......@@ -28,7 +18,7 @@ LL + fn make() -> <A<T> as Tr>::Ty { 0 }
2818 |
2919
3020error[E0053]: method `make` has an incompatible type for trait
31 --> $DIR/defaults-specialization.rs:35:18
21 --> $DIR/defaults-specialization.rs:34:18
3222 |
3323LL | default type Ty = bool;
3424 | --------------- associated type is `default` and may be overridden
......@@ -37,7 +27,7 @@ LL | fn make() -> bool { true }
3727 | ^^^^ expected associated type, found `bool`
3828 |
3929note: type in trait
40 --> $DIR/defaults-specialization.rs:9:18
30 --> $DIR/defaults-specialization.rs:8:18
4131 |
4232LL | fn make() -> Self::Ty {
4333 | ^^^^^^^^
......@@ -50,7 +40,7 @@ LL + fn make() -> <B<T> as Tr>::Ty { true }
5040 |
5141
5242error[E0308]: mismatched types
53 --> $DIR/defaults-specialization.rs:10:9
43 --> $DIR/defaults-specialization.rs:9:9
5444 |
5545LL | type Ty = u8;
5646 | ------- associated type defaults can't be assumed inside the trait defining them
......@@ -64,7 +54,7 @@ LL | 0u8
6454 found type `u8`
6555
6656error[E0308]: mismatched types
67 --> $DIR/defaults-specialization.rs:26:29
57 --> $DIR/defaults-specialization.rs:25:29
6858 |
6959LL | fn make() -> Self::Ty { 0u8 }
7060 | -------- ^^^ expected associated type, found `u8`
......@@ -79,7 +69,7 @@ LL | fn make() -> Self::Ty { 0u8 }
7969 see issue #152409 <https://github.com/rust-lang/rust/issues/152409> for more information
8070
8171error[E0308]: mismatched types
82 --> $DIR/defaults-specialization.rs:44:29
72 --> $DIR/defaults-specialization.rs:43:29
8373 |
8474LL | default type Ty = bool;
8575 | --------------- associated type is `default` and may be overridden
......@@ -95,7 +85,7 @@ LL | fn make() -> Self::Ty { true }
9585 see issue #152409 <https://github.com/rust-lang/rust/issues/152409> for more information
9686
9787error[E0308]: mismatched types
98 --> $DIR/defaults-specialization.rs:87:32
88 --> $DIR/defaults-specialization.rs:86:32
9989 |
10090LL | let _: <B<()> as Tr>::Ty = 0u8;
10191 | ----------------- ^^^ expected associated type, found `u8`
......@@ -105,13 +95,13 @@ LL | let _: <B<()> as Tr>::Ty = 0u8;
10595 = note: expected associated type `<B<()> as Tr>::Ty`
10696 found type `u8`
10797help: a method is available that returns `<B<()> as Tr>::Ty`
108 --> $DIR/defaults-specialization.rs:9:5
98 --> $DIR/defaults-specialization.rs:8:5
10999 |
110100LL | fn make() -> Self::Ty {
111101 | ^^^^^^^^^^^^^^^^^^^^^ consider calling `Tr::make`
112102
113103error[E0308]: mismatched types
114 --> $DIR/defaults-specialization.rs:88:32
104 --> $DIR/defaults-specialization.rs:87:32
115105 |
116106LL | let _: <B<()> as Tr>::Ty = true;
117107 | ----------------- ^^^^ expected associated type, found `bool`
......@@ -121,7 +111,7 @@ LL | let _: <B<()> as Tr>::Ty = true;
121111 = note: expected associated type `<B<()> as Tr>::Ty`
122112 found type `bool`
123113help: a method is available that returns `<B<()> as Tr>::Ty`
124 --> $DIR/defaults-specialization.rs:9:5
114 --> $DIR/defaults-specialization.rs:8:5
125115 |
126116LL | fn make() -> Self::Ty {
127117 | ^^^^^^^^^^^^^^^^^^^^^ consider calling `Tr::make`
......@@ -129,7 +119,7 @@ LL | fn make() -> Self::Ty {
129119 see issue #152409 <https://github.com/rust-lang/rust/issues/152409> for more information
130120
131121error[E0308]: mismatched types
132 --> $DIR/defaults-specialization.rs:89:33
122 --> $DIR/defaults-specialization.rs:88:33
133123 |
134124LL | let _: <B2<()> as Tr>::Ty = 0u8;
135125 | ------------------ ^^^ expected associated type, found `u8`
......@@ -139,13 +129,13 @@ LL | let _: <B2<()> as Tr>::Ty = 0u8;
139129 = note: expected associated type `<B2<()> as Tr>::Ty`
140130 found type `u8`
141131help: a method is available that returns `<B2<()> as Tr>::Ty`
142 --> $DIR/defaults-specialization.rs:9:5
132 --> $DIR/defaults-specialization.rs:8:5
143133 |
144134LL | fn make() -> Self::Ty {
145135 | ^^^^^^^^^^^^^^^^^^^^^ consider calling `Tr::make`
146136
147137error[E0308]: mismatched types
148 --> $DIR/defaults-specialization.rs:90:33
138 --> $DIR/defaults-specialization.rs:89:33
149139 |
150140LL | let _: <B2<()> as Tr>::Ty = true;
151141 | ------------------ ^^^^ expected associated type, found `bool`
......@@ -155,14 +145,14 @@ LL | let _: <B2<()> as Tr>::Ty = true;
155145 = note: expected associated type `<B2<()> as Tr>::Ty`
156146 found type `bool`
157147help: a method is available that returns `<B2<()> as Tr>::Ty`
158 --> $DIR/defaults-specialization.rs:9:5
148 --> $DIR/defaults-specialization.rs:8:5
159149 |
160150LL | fn make() -> Self::Ty {
161151 | ^^^^^^^^^^^^^^^^^^^^^ consider calling `Tr::make`
162152 = note: the associated type `<B2<()> as Tr>::Ty` is defined as `bool` in the implementation, but the where-bound `B2<()>` shadows this definition
163153 see issue #152409 <https://github.com/rust-lang/rust/issues/152409> for more information
164154
165error: aborting due to 9 previous errors; 1 warning emitted
155error: aborting due to 9 previous errors
166156
167157Some errors have detailed explanations: E0053, E0308.
168158For more information about an error, try `rustc --explain E0053`.
tests/ui/async-await/async-drop/foreign-fundamental.rs-1
......@@ -1,7 +1,6 @@
11//@ edition: 2018
22
33#![feature(async_drop)]
4//~^ WARN the feature `async_drop` is incomplete
54
65use std::future::AsyncDrop;
76use std::pin::Pin;
tests/ui/async-await/async-drop/foreign-fundamental.stderr+3-12
......@@ -1,24 +1,15 @@
1warning: the feature `async_drop` is incomplete and may not be safe to use and/or cause compiler crashes
2 --> $DIR/foreign-fundamental.rs:3:12
3 |
4LL | #![feature(async_drop)]
5 | ^^^^^^^^^^
6 |
7 = note: see issue #126482 <https://github.com/rust-lang/rust/issues/126482> for more information
8 = note: `#[warn(incomplete_features)]` on by default
9
101error[E0120]: the `AsyncDrop` trait may only be implemented for local structs, enums, and unions
11 --> $DIR/foreign-fundamental.rs:11:20
2 --> $DIR/foreign-fundamental.rs:10:20
123 |
134LL | impl AsyncDrop for &Foo {
145 | ^^^^ must be a struct, enum, or union in the current crate
156
167error[E0120]: the `AsyncDrop` trait may only be implemented for local structs, enums, and unions
17 --> $DIR/foreign-fundamental.rs:16:20
8 --> $DIR/foreign-fundamental.rs:15:20
189 |
1910LL | impl AsyncDrop for Pin<Foo> {
2011 | ^^^^^^^^ must be a struct, enum, or union in the current crate
2112
22error: aborting due to 2 previous errors; 1 warning emitted
13error: aborting due to 2 previous errors
2314
2415For more information about this error, try `rustc --explain E0120`.
tests/ui/async-await/dyn/mut-is-pointer-like.stderr+1-10
......@@ -1,12 +1,3 @@
1warning: the feature `async_fn_in_dyn_trait` is incomplete and may not be safe to use and/or cause compiler crashes
2 --> $DIR/mut-is-pointer-like.rs:6:12
3 |
4LL | #![feature(async_fn_in_dyn_trait)]
5 | ^^^^^^^^^^^^^^^^^^^^^
6 |
7 = note: see issue #133119 <https://github.com/rust-lang/rust/issues/133119> for more information
8 = note: `#[warn(incomplete_features)]` on by default
9
101error[E0038]: the trait `AsyncTrait` is not dyn compatible
112 --> $DIR/mut-is-pointer-like.rs:35:29
123 |
......@@ -24,6 +15,6 @@ LL | async fn async_dispatch(self: Pin<&mut Self>) -> Self::Output;
2415 | ^^^^^^^^^^^^^^ ...because method `async_dispatch` is `async`
2516 = help: consider moving `async_dispatch` to another trait
2617
27error: aborting due to 1 previous error; 1 warning emitted
18error: aborting due to 1 previous error
2819
2920For more information about this error, try `rustc --explain E0038`.
tests/ui/async-await/dyn/works.stderr+1-10
......@@ -1,12 +1,3 @@
1warning: the feature `async_fn_in_dyn_trait` is incomplete and may not be safe to use and/or cause compiler crashes
2 --> $DIR/works.rs:6:12
3 |
4LL | #![feature(async_fn_in_dyn_trait)]
5 | ^^^^^^^^^^^^^^^^^^^^^
6 |
7 = note: see issue #133119 <https://github.com/rust-lang/rust/issues/133119> for more information
8 = note: `#[warn(incomplete_features)]` on by default
9
101error[E0038]: the trait `AsyncTrait` is not dyn compatible
112 --> $DIR/works.rs:27:21
123 |
......@@ -24,6 +15,6 @@ LL | async fn async_dispatch(&self);
2415 = help: consider moving `async_dispatch` to another trait
2516 = help: only type `&'static str` implements `AsyncTrait`; consider using it directly instead.
2617
27error: aborting due to 1 previous error; 1 warning emitted
18error: aborting due to 1 previous error
2819
2920For more information about this error, try `rustc --explain E0038`.
tests/ui/async-await/dyn/wrong-size.stderr+1-10
......@@ -1,12 +1,3 @@
1warning: the feature `async_fn_in_dyn_trait` is incomplete and may not be safe to use and/or cause compiler crashes
2 --> $DIR/wrong-size.rs:4:12
3 |
4LL | #![feature(async_fn_in_dyn_trait)]
5 | ^^^^^^^^^^^^^^^^^^^^^
6 |
7 = note: see issue #133119 <https://github.com/rust-lang/rust/issues/133119> for more information
8 = note: `#[warn(incomplete_features)]` on by default
9
101error[E0038]: the trait `AsyncTrait` is not dyn compatible
112 --> $DIR/wrong-size.rs:21:17
123 |
......@@ -24,6 +15,6 @@ LL | async fn async_dispatch(&self);
2415 = help: consider moving `async_dispatch` to another trait
2516 = help: only type `&'static str` implements `AsyncTrait`; consider using it directly instead.
2617
27error: aborting due to 1 previous error; 1 warning emitted
18error: aborting due to 1 previous error
2819
2920For more information about this error, try `rustc --explain E0038`.
tests/ui/borrowck/generic_const_early_param.rs-1
......@@ -1,5 +1,4 @@
11#![feature(generic_const_exprs)]
2//~^ WARN the feature `generic_const_exprs` is incomplete
32
43struct DataWrapper<'static> {
54 //~^ ERROR invalid lifetime parameter name: `'static`
tests/ui/borrowck/generic_const_early_param.stderr+4-13
......@@ -1,11 +1,11 @@
11error[E0262]: invalid lifetime parameter name: `'static`
2 --> $DIR/generic_const_early_param.rs:4:20
2 --> $DIR/generic_const_early_param.rs:3:20
33 |
44LL | struct DataWrapper<'static> {
55 | ^^^^^^^ 'static is a reserved lifetime name
66
77error[E0261]: use of undeclared lifetime name `'a`
8 --> $DIR/generic_const_early_param.rs:6:12
8 --> $DIR/generic_const_early_param.rs:5:12
99 |
1010LL | data: &'a [u8; Self::SIZE],
1111 | ^^ undeclared lifetime
......@@ -16,7 +16,7 @@ LL | struct DataWrapper<'a, 'static> {
1616 | +++
1717
1818error[E0261]: use of undeclared lifetime name `'a`
19 --> $DIR/generic_const_early_param.rs:10:18
19 --> $DIR/generic_const_early_param.rs:9:18
2020 |
2121LL | impl DataWrapper<'a> {
2222 | ^^ undeclared lifetime
......@@ -26,16 +26,7 @@ help: consider introducing lifetime `'a` here
2626LL | impl<'a> DataWrapper<'a> {
2727 | ++++
2828
29warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes
30 --> $DIR/generic_const_early_param.rs:1:12
31 |
32LL | #![feature(generic_const_exprs)]
33 | ^^^^^^^^^^^^^^^^^^^
34 |
35 = note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
36 = note: `#[warn(incomplete_features)]` on by default
37
38error: aborting due to 3 previous errors; 1 warning emitted
29error: aborting due to 3 previous errors
3930
4031Some errors have detailed explanations: E0261, E0262.
4132For more information about an error, try `rustc --explain E0261`.
tests/ui/closures/binder/const-bound.rs-1
......@@ -1,5 +1,4 @@
11#![feature(closure_lifetime_binder, non_lifetime_binders)]
2//~^ WARN is incomplete and may not be safe to use
32
43fn main() {
54 for<const N: i32> || -> () {};
tests/ui/closures/binder/const-bound.stderr+3-12
......@@ -1,23 +1,14 @@
11error: late-bound const parameters cannot be used currently
2 --> $DIR/const-bound.rs:5:15
2 --> $DIR/const-bound.rs:4:15
33 |
44LL | for<const N: i32> || -> () {};
55 | ^
66
7warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
8 --> $DIR/const-bound.rs:1:37
9 |
10LL | #![feature(closure_lifetime_binder, non_lifetime_binders)]
11 | ^^^^^^^^^^^^^^^^^^^^
12 |
13 = note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
14 = note: `#[warn(incomplete_features)]` on by default
15
167error: late-bound const parameter not allowed on closures
17 --> $DIR/const-bound.rs:5:9
8 --> $DIR/const-bound.rs:4:9
189 |
1910LL | for<const N: i32> || -> () {};
2011 | ^^^^^^^^^^^^
2112
22error: aborting due to 2 previous errors; 1 warning emitted
13error: aborting due to 2 previous errors
2314
tests/ui/closures/binder/type-bound-2.rs-1
......@@ -1,5 +1,4 @@
11#![feature(closure_lifetime_binder, non_lifetime_binders)]
2//~^ WARN is incomplete and may not be safe to use
32
43fn main() {
54 for<T> || -> () {};
tests/ui/closures/binder/type-bound-2.stderr+2-11
......@@ -1,17 +1,8 @@
1warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
2 --> $DIR/type-bound-2.rs:1:37
3 |
4LL | #![feature(closure_lifetime_binder, non_lifetime_binders)]
5 | ^^^^^^^^^^^^^^^^^^^^
6 |
7 = note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
8 = note: `#[warn(incomplete_features)]` on by default
9
101error: late-bound type parameter not allowed on closures
11 --> $DIR/type-bound-2.rs:5:9
2 --> $DIR/type-bound-2.rs:4:9
123 |
134LL | for<T> || -> () {};
145 | ^
156
16error: aborting due to 1 previous error; 1 warning emitted
7error: aborting due to 1 previous error
178
tests/ui/closures/binder/type-bound.rs-1
......@@ -1,5 +1,4 @@
11#![feature(closure_lifetime_binder, non_lifetime_binders)]
2//~^ WARN is incomplete and may not be safe to use
32
43fn main() {
54 for<T> || -> T {};
tests/ui/closures/binder/type-bound.stderr+2-11
......@@ -1,17 +1,8 @@
1warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
2 --> $DIR/type-bound.rs:1:37
3 |
4LL | #![feature(closure_lifetime_binder, non_lifetime_binders)]
5 | ^^^^^^^^^^^^^^^^^^^^
6 |
7 = note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
8 = note: `#[warn(incomplete_features)]` on by default
9
101error: late-bound type parameter not allowed on closures
11 --> $DIR/type-bound.rs:5:9
2 --> $DIR/type-bound.rs:4:9
123 |
134LL | for<T> || -> T {};
145 | ^
156
16error: aborting due to 1 previous error; 1 warning emitted
7error: aborting due to 1 previous error
178
tests/ui/codegen/freeze-on-polymorphic-projection.rs-1
......@@ -2,7 +2,6 @@
22//@ compile-flags: -Copt-level=1 --crate-type=lib
33
44#![feature(specialization)]
5//~^ WARN the feature `specialization` is incomplete
65
76pub unsafe trait Storage {
87 type Handle;
tests/ui/codegen/freeze-on-polymorphic-projection.stderr deleted-12
......@@ -1,12 +0,0 @@
1warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
2 --> $DIR/freeze-on-polymorphic-projection.rs:4:12
3 |
4LL | #![feature(specialization)]
5 | ^^^^^^^^^^^^^^
6 |
7 = note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
8 = help: consider using `min_specialization` instead, which is more stable and complete
9 = note: `#[warn(incomplete_features)]` on by default
10
11warning: 1 warning emitted
12
tests/ui/coherence/coherence-doesnt-use-infcx-evaluate.rs-1
......@@ -5,7 +5,6 @@
55// since they are using a different infcx which doesn't preserve the intercrate flag.
66
77#![feature(specialization)]
8//~^ WARN the feature `specialization` is incomplete
98
109trait Assoc {
1110 type Output;
tests/ui/coherence/coherence-doesnt-use-infcx-evaluate.stderr deleted-12
......@@ -1,12 +0,0 @@
1warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
2 --> $DIR/coherence-doesnt-use-infcx-evaluate.rs:7:12
3 |
4LL | #![feature(specialization)]
5 | ^^^^^^^^^^^^^^
6 |
7 = note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
8 = help: consider using `min_specialization` instead, which is more stable and complete
9 = note: `#[warn(incomplete_features)]` on by default
10
11warning: 1 warning emitted
12
tests/ui/coherence/coherence-inherited-assoc-ty-cycle-err.rs-1
......@@ -4,7 +4,6 @@
44//
55// No we expect to run into a more user-friendly cycle error instead.
66#![feature(specialization)]
7//~^ WARN the feature `specialization` is incomplete
87
98trait Trait<T> { type Assoc; }
109//~^ ERROR E0391
tests/ui/coherence/coherence-inherited-assoc-ty-cycle-err.stderr+3-13
......@@ -1,27 +1,17 @@
1warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
2 --> $DIR/coherence-inherited-assoc-ty-cycle-err.rs:6:12
3 |
4LL | #![feature(specialization)]
5 | ^^^^^^^^^^^^^^
6 |
7 = note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
8 = help: consider using `min_specialization` instead, which is more stable and complete
9 = note: `#[warn(incomplete_features)]` on by default
10
111error[E0391]: cycle detected when building specialization graph of trait `Trait`
12 --> $DIR/coherence-inherited-assoc-ty-cycle-err.rs:9:1
2 --> $DIR/coherence-inherited-assoc-ty-cycle-err.rs:8:1
133 |
144LL | trait Trait<T> { type Assoc; }
155 | ^^^^^^^^^^^^^^
166 |
177 = note: ...which immediately requires building specialization graph of trait `Trait` again
188note: cycle used when coherence checking all impls of trait `Trait`
19 --> $DIR/coherence-inherited-assoc-ty-cycle-err.rs:9:1
9 --> $DIR/coherence-inherited-assoc-ty-cycle-err.rs:8:1
2010 |
2111LL | trait Trait<T> { type Assoc; }
2212 | ^^^^^^^^^^^^^^
2313 = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
2414
25error: aborting due to 1 previous error; 1 warning emitted
15error: aborting due to 1 previous error
2616
2717For more information about this error, try `rustc --explain E0391`.
tests/ui/coherence/negative-coherence/regions-in-canonical.rs-1
......@@ -1,7 +1,6 @@
11//@ check-pass
22
33#![feature(adt_const_params, unsized_const_params)]
4//~^ WARN the feature `unsized_const_params` is incomplete
54#![feature(with_negative_coherence, negative_impls)]
65
76pub trait A<const K: &'static str> {}
tests/ui/coherence/negative-coherence/regions-in-canonical.stderr deleted-11
......@@ -1,11 +0,0 @@
1warning: the feature `unsized_const_params` is incomplete and may not be safe to use and/or cause compiler crashes
2 --> $DIR/regions-in-canonical.rs:3:30
3 |
4LL | #![feature(adt_const_params, unsized_const_params)]
5 | ^^^^^^^^^^^^^^^^^^^^
6 |
7 = note: see issue #95174 <https://github.com/rust-lang/rust/issues/95174> for more information
8 = note: `#[warn(incomplete_features)]` on by default
9
10warning: 1 warning emitted
11
tests/ui/consts/escaping-bound-var.rs-1
......@@ -1,5 +1,4 @@
11#![feature(generic_const_exprs)]
2//~^ WARN the feature `generic_const_exprs` is incomplete
32
43fn test<'a>(
54 _: &'a (),
tests/ui/consts/escaping-bound-var.stderr+3-12
......@@ -1,14 +1,5 @@
1warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes
2 --> $DIR/escaping-bound-var.rs:1:12
3 |
4LL | #![feature(generic_const_exprs)]
5 | ^^^^^^^^^^^^^^^^^^^
6 |
7 = note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
8 = note: `#[warn(incomplete_features)]` on by default
9
101error: cannot capture late-bound lifetime in constant
11 --> $DIR/escaping-bound-var.rs:7:13
2 --> $DIR/escaping-bound-var.rs:6:13
123 |
134LL | fn test<'a>(
145 | -- lifetime defined here
......@@ -17,7 +8,7 @@ LL | let x: &'a ();
178 | ^^
189
1910error[E0308]: mismatched types
20 --> $DIR/escaping-bound-var.rs:6:6
11 --> $DIR/escaping-bound-var.rs:5:6
2112 |
2213LL | fn test<'a>(
2314 | ---- implicitly returns `()` as its body has no tail or `return` expression
......@@ -33,6 +24,6 @@ LL | | }] {
3324 1
3425}]`, found `()`
3526
36error: aborting due to 2 previous errors; 1 warning emitted
27error: aborting due to 2 previous errors
3728
3829For more information about this error, try `rustc --explain E0308`.
tests/ui/consts/issue-104396.rs-1
......@@ -2,7 +2,6 @@
22//@ check-pass
33
44#![feature(generic_const_exprs)]
5//~^ WARN the feature `generic_const_exprs` is incomplete
65
76#[inline(always)]
87fn from_fn_1<const N: usize, F: FnMut(usize) -> f32>(mut f: F) -> [f32; N] {
tests/ui/consts/issue-104396.stderr deleted-11
......@@ -1,11 +0,0 @@
1warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes
2 --> $DIR/issue-104396.rs:4:12
3 |
4LL | #![feature(generic_const_exprs)]
5 | ^^^^^^^^^^^^^^^^^^^
6 |
7 = note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
8 = note: `#[warn(incomplete_features)]` on by default
9
10warning: 1 warning emitted
11
tests/ui/consts/issue-90762.rs+1-1
......@@ -27,5 +27,5 @@ fn main() {
2727 for (i, b) in FOO.iter().enumerate() {
2828 assert!(b.load(Ordering::Relaxed), "{} not set", i);
2929 }
30 assert_eq!(BAR.fetch_add(1, Ordering::Relaxed), usize::max_value());
30 assert_eq!(BAR.fetch_add(1, Ordering::Relaxed), usize::MAX);
3131}
tests/ui/consts/refs_check_const_eq-issue-88384.rs-1
......@@ -1,6 +1,5 @@
11#![feature(fn_traits)]
22#![feature(adt_const_params, unsized_const_params)]
3//~^ WARNING the feature `unsized_const_params` is incomplete
43
54#[derive(PartialEq, Eq)]
65struct CompileTimeSettings {
tests/ui/consts/refs_check_const_eq-issue-88384.stderr+3-12
......@@ -1,14 +1,5 @@
1warning: the feature `unsized_const_params` is incomplete and may not be safe to use and/or cause compiler crashes
2 --> $DIR/refs_check_const_eq-issue-88384.rs:2:30
3 |
4LL | #![feature(adt_const_params, unsized_const_params)]
5 | ^^^^^^^^^^^^^^^^^^^^
6 |
7 = note: see issue #95174 <https://github.com/rust-lang/rust/issues/95174> for more information
8 = note: `#[warn(incomplete_features)]` on by default
9
101error[E0741]: `CompileTimeSettings` must implement `ConstParamTy` to be used as the type of a const generic parameter
11 --> $DIR/refs_check_const_eq-issue-88384.rs:10:21
2 --> $DIR/refs_check_const_eq-issue-88384.rs:9:21
123 |
134LL | struct Foo<const T: CompileTimeSettings>;
145 | ^^^^^^^^^^^^^^^^^^^
......@@ -20,7 +11,7 @@ LL | struct CompileTimeSettings {
2011 |
2112
2213error[E0741]: `CompileTimeSettings` must implement `ConstParamTy` to be used as the type of a const generic parameter
23 --> $DIR/refs_check_const_eq-issue-88384.rs:13:15
14 --> $DIR/refs_check_const_eq-issue-88384.rs:12:15
2415 |
2516LL | impl<const T: CompileTimeSettings> Foo<T> {
2617 | ^^^^^^^^^^^^^^^^^^^
......@@ -31,6 +22,6 @@ LL + #[derive(ConstParamTy)]
3122LL | struct CompileTimeSettings {
3223 |
3324
34error: aborting due to 2 previous errors; 1 warning emitted
25error: aborting due to 2 previous errors
3526
3627For more information about this error, try `rustc --explain E0741`.
tests/ui/consts/static-default-lifetime/generic-associated-const.rs-1
......@@ -1,6 +1,5 @@
11#![deny(elided_lifetimes_in_associated_constant)]
22#![feature(generic_const_items)]
3//~^ WARN the feature `generic_const_items` is incomplete
43
54struct A;
65impl A {
tests/ui/consts/static-default-lifetime/generic-associated-const.stderr+4-13
......@@ -1,5 +1,5 @@
11error[E0106]: missing lifetime specifier
2 --> $DIR/generic-associated-const.rs:15:29
2 --> $DIR/generic-associated-const.rs:14:29
33 |
44LL | const GAC_LIFETIME<'a>: &str = "";
55 | ^ expected named lifetime parameter
......@@ -9,23 +9,14 @@ help: consider using the `'a` lifetime
99LL | const GAC_LIFETIME<'a>: &'a str = "";
1010 | ++
1111
12warning: the feature `generic_const_items` is incomplete and may not be safe to use and/or cause compiler crashes
13 --> $DIR/generic-associated-const.rs:2:12
14 |
15LL | #![feature(generic_const_items)]
16 | ^^^^^^^^^^^^^^^^^^^
17 |
18 = note: see issue #113521 <https://github.com/rust-lang/rust/issues/113521> for more information
19 = note: `#[warn(incomplete_features)]` on by default
20
2112error: `&` without an explicit lifetime name cannot be used here
22 --> $DIR/generic-associated-const.rs:8:29
13 --> $DIR/generic-associated-const.rs:7:29
2314 |
2415LL | const GAC_LIFETIME<'a>: &str = "";
2516 | ^
2617 |
2718note: cannot automatically infer `'static` because of other lifetimes in scope
28 --> $DIR/generic-associated-const.rs:8:24
19 --> $DIR/generic-associated-const.rs:7:24
2920 |
3021LL | const GAC_LIFETIME<'a>: &str = "";
3122 | ^^
......@@ -41,6 +32,6 @@ help: use the `'static` lifetime
4132LL | const GAC_LIFETIME<'a>: &'static str = "";
4233 | +++++++
4334
44error: aborting due to 2 previous errors; 1 warning emitted
35error: aborting due to 2 previous errors
4536
4637For more information about this error, try `rustc --explain E0106`.
tests/ui/consts/trait_specialization.rs+1-1
......@@ -4,7 +4,7 @@
44// Tests that specialization does not cause optimizations running on polymorphic MIR to resolve
55// to a `default` implementation.
66
7#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
7#![feature(specialization)]
88
99trait Marker {}
1010
tests/ui/consts/trait_specialization.stderr deleted-12
......@@ -1,12 +0,0 @@
1warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
2 --> $DIR/trait_specialization.rs:7:12
3 |
4LL | #![feature(specialization)]
5 | ^^^^^^^^^^^^^^
6 |
7 = note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
8 = help: consider using `min_specialization` instead, which is more stable and complete
9 = note: `#[warn(incomplete_features)]` on by default
10
11warning: 1 warning emitted
12
tests/ui/contracts/incomplete-feature.rs+1
......@@ -4,6 +4,7 @@
44// This test specifically checks that the [incomplete_features] warning is
55// emitted when the `contracts` feature gate is enabled, so that it can be
66// marked as `expect`ed in other tests in order to reduce duplication.
7#![warn(incomplete_features)]
78#![feature(contracts)]
89//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features]
910extern crate core;
tests/ui/contracts/incomplete-feature.stderr+6-2
......@@ -1,11 +1,15 @@
11warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
2 --> $DIR/incomplete-feature.rs:7:12
2 --> $DIR/incomplete-feature.rs:8:12
33 |
44LL | #![feature(contracts)]
55 | ^^^^^^^^^
66 |
77 = note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
8 = note: `#[warn(incomplete_features)]` on by default
8note: the lint level is defined here
9 --> $DIR/incomplete-feature.rs:7:9
10 |
11LL | #![warn(incomplete_features)]
12 | ^^^^^^^^^^^^^^^^^^^
913
1014warning: 1 warning emitted
1115
tests/ui/error-codes/E0520.rs-1
......@@ -1,5 +1,4 @@
11#![feature(specialization)]
2//~^ WARN the feature `specialization` is incomplete
32
43trait SpaceLlama {
54 fn fly(&self);
tests/ui/error-codes/E0520.stderr+2-12
......@@ -1,15 +1,5 @@
1warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
2 --> $DIR/E0520.rs:1:12
3 |
4LL | #![feature(specialization)]
5 | ^^^^^^^^^^^^^^
6 |
7 = note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
8 = help: consider using `min_specialization` instead, which is more stable and complete
9 = note: `#[warn(incomplete_features)]` on by default
10
111error[E0520]: `fly` specializes an item from a parent `impl`, but that item is not marked `default`
12 --> $DIR/E0520.rs:17:5
2 --> $DIR/E0520.rs:16:5
133 |
144LL | impl<T: Clone> SpaceLlama for T {
155 | ------------------------------- parent `impl` is here
......@@ -19,6 +9,6 @@ LL | default fn fly(&self) {}
199 |
2010 = note: to specialize, `fly` in the parent `impl` must be marked `default`
2111
22error: aborting due to 1 previous error; 1 warning emitted
12error: aborting due to 1 previous error
2313
2414For more information about this error, try `rustc --explain E0520`.
tests/ui/error-codes/E0771.rs-1
......@@ -1,5 +1,4 @@
11#![feature(adt_const_params, unsized_const_params)]
2//~^ WARN the feature `unsized_const_params` is incomplete
32
43fn function_with_str<'a, const STRING: &'a str>() {} //~ ERROR E0770
54
tests/ui/error-codes/E0771.stderr+2-11
......@@ -1,18 +1,9 @@
11error[E0770]: the type of const parameters must not depend on other generic parameters
2 --> $DIR/E0771.rs:4:41
2 --> $DIR/E0771.rs:3:41
33 |
44LL | fn function_with_str<'a, const STRING: &'a str>() {}
55 | ^^ the type must not depend on the parameter `'a`
66
7warning: the feature `unsized_const_params` is incomplete and may not be safe to use and/or cause compiler crashes
8 --> $DIR/E0771.rs:1:30
9 |
10LL | #![feature(adt_const_params, unsized_const_params)]
11 | ^^^^^^^^^^^^^^^^^^^^
12 |
13 = note: see issue #95174 <https://github.com/rust-lang/rust/issues/95174> for more information
14 = note: `#[warn(incomplete_features)]` on by default
15
16error: aborting due to 1 previous error; 1 warning emitted
7error: aborting due to 1 previous error
178
189For more information about this error, try `rustc --explain E0770`.
tests/ui/feature-gates/feature-gate-effective-target-features.default.stderr+4-4
......@@ -1,5 +1,5 @@
11error[E0658]: the `#[force_target_feature]` attribute is an experimental feature
2 --> $DIR/feature-gate-effective-target-features.rs:13:5
2 --> $DIR/feature-gate-effective-target-features.rs:14:5
33 |
44LL | #[unsafe(force_target_feature(enable = "avx2"))]
55 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
......@@ -9,7 +9,7 @@ LL | #[unsafe(force_target_feature(enable = "avx2"))]
99 = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
1010
1111error: `#[target_feature(..)]` cannot be applied to safe trait method
12 --> $DIR/feature-gate-effective-target-features.rs:21:5
12 --> $DIR/feature-gate-effective-target-features.rs:22:5
1313 |
1414LL | #[target_feature(enable = "avx2")]
1515 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot be applied to safe trait method
......@@ -18,13 +18,13 @@ LL | fn foo(&self) {}
1818 | ------------- not an `unsafe` function
1919
2020error[E0053]: method `foo` has an incompatible type for trait
21 --> $DIR/feature-gate-effective-target-features.rs:23:5
21 --> $DIR/feature-gate-effective-target-features.rs:24:5
2222 |
2323LL | fn foo(&self) {}
2424 | ^^^^^^^^^^^^^ expected safe fn, found unsafe fn
2525 |
2626note: type in trait
27 --> $DIR/feature-gate-effective-target-features.rs:7:5
27 --> $DIR/feature-gate-effective-target-features.rs:8:5
2828 |
2929LL | fn foo(&self);
3030 | ^^^^^^^^^^^^^^
tests/ui/feature-gates/feature-gate-effective-target-features.feature.stderr+9-5
......@@ -1,14 +1,18 @@
11warning: the feature `effective_target_features` is incomplete and may not be safe to use and/or cause compiler crashes
2 --> $DIR/feature-gate-effective-target-features.rs:3:30
2 --> $DIR/feature-gate-effective-target-features.rs:4:30
33 |
44LL | #![cfg_attr(feature, feature(effective_target_features))]
55 | ^^^^^^^^^^^^^^^^^^^^^^^^^
66 |
77 = note: see issue #143352 <https://github.com/rust-lang/rust/issues/143352> for more information
8 = note: `#[warn(incomplete_features)]` on by default
8note: the lint level is defined here
9 --> $DIR/feature-gate-effective-target-features.rs:3:9
10 |
11LL | #![warn(incomplete_features)]
12 | ^^^^^^^^^^^^^^^^^^^
913
1014error: `#[target_feature(..)]` cannot be applied to safe trait method
11 --> $DIR/feature-gate-effective-target-features.rs:21:5
15 --> $DIR/feature-gate-effective-target-features.rs:22:5
1216 |
1317LL | #[target_feature(enable = "avx2")]
1418 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot be applied to safe trait method
......@@ -17,13 +21,13 @@ LL | fn foo(&self) {}
1721 | ------------- not an `unsafe` function
1822
1923error[E0053]: method `foo` has an incompatible type for trait
20 --> $DIR/feature-gate-effective-target-features.rs:23:5
24 --> $DIR/feature-gate-effective-target-features.rs:24:5
2125 |
2226LL | fn foo(&self) {}
2327 | ^^^^^^^^^^^^^ expected safe fn, found unsafe fn
2428 |
2529note: type in trait
26 --> $DIR/feature-gate-effective-target-features.rs:7:5
30 --> $DIR/feature-gate-effective-target-features.rs:8:5
2731 |
2832LL | fn foo(&self);
2933 | ^^^^^^^^^^^^^^
tests/ui/feature-gates/feature-gate-effective-target-features.rs+1
......@@ -1,5 +1,6 @@
11//@ revisions: default feature
22//@ only-x86_64
3#![warn(incomplete_features)]
34#![cfg_attr(feature, feature(effective_target_features))]
45//[feature]~^ WARN the feature `effective_target_features` is incomplete and may not be safe to use and/or cause compiler crashes
56
tests/ui/feature-gates/feature-gate-unsafe_fields.rs+1-1
......@@ -1,7 +1,7 @@
11//@ compile-flags: --crate-type=lib
22//@ revisions: with_gate without_gate
33//@ [with_gate] check-pass
4
4#![warn(incomplete_features)]
55#![cfg_attr(with_gate, feature(unsafe_fields))] //[with_gate]~ WARNING
66
77#[cfg(false)]
tests/ui/feature-gates/feature-gate-unsafe_fields.with_gate.stderr+5-1
......@@ -5,7 +5,11 @@ LL | #![cfg_attr(with_gate, feature(unsafe_fields))]
55 | ^^^^^^^^^^^^^
66 |
77 = note: see issue #132922 <https://github.com/rust-lang/rust/issues/132922> for more information
8 = note: `#[warn(incomplete_features)]` on by default
8note: the lint level is defined here
9 --> $DIR/feature-gate-unsafe_fields.rs:4:9
10 |
11LL | #![warn(incomplete_features)]
12 | ^^^^^^^^^^^^^^^^^^^
913
1014warning: 1 warning emitted
1115
tests/ui/generic-associated-types/issue-87429-specialization.rs-1
......@@ -1,7 +1,6 @@
11//@ check-fail
22
33#![feature(specialization)]
4//~^ WARN incomplete
54
65trait Family {
76 type Member<'a>: for<'b> PartialEq<Self::Member<'b>>;
tests/ui/generic-associated-types/issue-87429-specialization.stderr+3-13
......@@ -1,22 +1,12 @@
1warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
2 --> $DIR/issue-87429-specialization.rs:3:12
3 |
4LL | #![feature(specialization)]
5 | ^^^^^^^^^^^^^^
6 |
7 = note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
8 = help: consider using `min_specialization` instead, which is more stable and complete
9 = note: `#[warn(incomplete_features)]` on by default
10
111error[E0277]: can't compare `Foo` with `Foo`
12 --> $DIR/issue-87429-specialization.rs:20:31
2 --> $DIR/issue-87429-specialization.rs:19:31
133 |
144LL | default type Member<'a> = Foo;
155 | ^^^ no implementation for `Foo == Foo`
166 |
177 = help: the trait `PartialEq` is not implemented for `Foo`
188note: required by a bound in `Family::Member`
19 --> $DIR/issue-87429-specialization.rs:7:22
9 --> $DIR/issue-87429-specialization.rs:6:22
2010 |
2111LL | type Member<'a>: for<'b> PartialEq<Self::Member<'b>>;
2212 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Family::Member`
......@@ -26,6 +16,6 @@ LL + #[derive(PartialEq)]
2616LL | struct Foo;
2717 |
2818
29error: aborting due to 1 previous error; 1 warning emitted
19error: aborting due to 1 previous error
3020
3121For more information about this error, try `rustc --explain E0277`.
tests/ui/impl-restriction/recover-incorrect-impl-restriction.rs+1
......@@ -1,5 +1,6 @@
11//@ compile-flags: --crate-type=lib
22//@ revisions: with_gate without_gate
3#![warn(incomplete_features)]
34#![cfg_attr(with_gate, feature(impl_restriction))]
45//[with_gate]~^ WARN the feature `impl_restriction` is incomplete and may not be safe to use and/or cause compiler crashes
56#![feature(auto_traits, const_trait_impl)]
tests/ui/impl-restriction/recover-incorrect-impl-restriction.with_gate.stderr+12-8
......@@ -1,5 +1,5 @@
11error: incorrect `impl` restriction
2 --> $DIR/recover-incorrect-impl-restriction.rs:8:14
2 --> $DIR/recover-incorrect-impl-restriction.rs:9:14
33 |
44LL | pub impl(crate::foo) trait Baz {}
55 | ^^^^^^^^^^
......@@ -15,7 +15,7 @@ LL | pub impl(in crate::foo) trait Baz {}
1515 | ++
1616
1717error: incorrect `impl` restriction
18 --> $DIR/recover-incorrect-impl-restriction.rs:10:21
18 --> $DIR/recover-incorrect-impl-restriction.rs:11:21
1919 |
2020LL | pub unsafe impl(crate::foo) trait BazUnsafe {}
2121 | ^^^^^^^^^^
......@@ -31,7 +31,7 @@ LL | pub unsafe impl(in crate::foo) trait BazUnsafe {}
3131 | ++
3232
3333error: incorrect `impl` restriction
34 --> $DIR/recover-incorrect-impl-restriction.rs:12:19
34 --> $DIR/recover-incorrect-impl-restriction.rs:13:19
3535 |
3636LL | pub auto impl(crate::foo) trait BazAuto {}
3737 | ^^^^^^^^^^
......@@ -47,7 +47,7 @@ LL | pub auto impl(in crate::foo) trait BazAuto {}
4747 | ++
4848
4949error: incorrect `impl` restriction
50 --> $DIR/recover-incorrect-impl-restriction.rs:14:20
50 --> $DIR/recover-incorrect-impl-restriction.rs:15:20
5151 |
5252LL | pub const impl(crate::foo) trait BazConst {}
5353 | ^^^^^^^^^^
......@@ -63,7 +63,7 @@ LL | pub const impl(in crate::foo) trait BazConst {}
6363 | ++
6464
6565error: incorrect `impl` restriction
66 --> $DIR/recover-incorrect-impl-restriction.rs:16:27
66 --> $DIR/recover-incorrect-impl-restriction.rs:17:27
6767 |
6868LL | pub const unsafe impl(crate::foo) trait BazConstUnsafe {}
6969 | ^^^^^^^^^^
......@@ -79,7 +79,7 @@ LL | pub const unsafe impl(in crate::foo) trait BazConstUnsafe {}
7979 | ++
8080
8181error: incorrect `impl` restriction
82 --> $DIR/recover-incorrect-impl-restriction.rs:18:26
82 --> $DIR/recover-incorrect-impl-restriction.rs:19:26
8383 |
8484LL | pub unsafe auto impl(crate::foo) trait BazUnsafeAuto {}
8585 | ^^^^^^^^^^
......@@ -95,13 +95,17 @@ LL | pub unsafe auto impl(in crate::foo) trait BazUnsafeAuto {}
9595 | ++
9696
9797warning: the feature `impl_restriction` is incomplete and may not be safe to use and/or cause compiler crashes
98 --> $DIR/recover-incorrect-impl-restriction.rs:3:32
98 --> $DIR/recover-incorrect-impl-restriction.rs:4:32
9999 |
100100LL | #![cfg_attr(with_gate, feature(impl_restriction))]
101101 | ^^^^^^^^^^^^^^^^
102102 |
103103 = note: see issue #105077 <https://github.com/rust-lang/rust/issues/105077> for more information
104 = note: `#[warn(incomplete_features)]` on by default
104note: the lint level is defined here
105 --> $DIR/recover-incorrect-impl-restriction.rs:3:9
106 |
107LL | #![warn(incomplete_features)]
108 | ^^^^^^^^^^^^^^^^^^^
105109
106110error: aborting due to 6 previous errors; 1 warning emitted
107111
tests/ui/impl-restriction/recover-incorrect-impl-restriction.without_gate.stderr+12-12
......@@ -1,5 +1,5 @@
11error: incorrect `impl` restriction
2 --> $DIR/recover-incorrect-impl-restriction.rs:8:14
2 --> $DIR/recover-incorrect-impl-restriction.rs:9:14
33 |
44LL | pub impl(crate::foo) trait Baz {}
55 | ^^^^^^^^^^
......@@ -15,7 +15,7 @@ LL | pub impl(in crate::foo) trait Baz {}
1515 | ++
1616
1717error: incorrect `impl` restriction
18 --> $DIR/recover-incorrect-impl-restriction.rs:10:21
18 --> $DIR/recover-incorrect-impl-restriction.rs:11:21
1919 |
2020LL | pub unsafe impl(crate::foo) trait BazUnsafe {}
2121 | ^^^^^^^^^^
......@@ -31,7 +31,7 @@ LL | pub unsafe impl(in crate::foo) trait BazUnsafe {}
3131 | ++
3232
3333error: incorrect `impl` restriction
34 --> $DIR/recover-incorrect-impl-restriction.rs:12:19
34 --> $DIR/recover-incorrect-impl-restriction.rs:13:19
3535 |
3636LL | pub auto impl(crate::foo) trait BazAuto {}
3737 | ^^^^^^^^^^
......@@ -47,7 +47,7 @@ LL | pub auto impl(in crate::foo) trait BazAuto {}
4747 | ++
4848
4949error: incorrect `impl` restriction
50 --> $DIR/recover-incorrect-impl-restriction.rs:14:20
50 --> $DIR/recover-incorrect-impl-restriction.rs:15:20
5151 |
5252LL | pub const impl(crate::foo) trait BazConst {}
5353 | ^^^^^^^^^^
......@@ -63,7 +63,7 @@ LL | pub const impl(in crate::foo) trait BazConst {}
6363 | ++
6464
6565error: incorrect `impl` restriction
66 --> $DIR/recover-incorrect-impl-restriction.rs:16:27
66 --> $DIR/recover-incorrect-impl-restriction.rs:17:27
6767 |
6868LL | pub const unsafe impl(crate::foo) trait BazConstUnsafe {}
6969 | ^^^^^^^^^^
......@@ -79,7 +79,7 @@ LL | pub const unsafe impl(in crate::foo) trait BazConstUnsafe {}
7979 | ++
8080
8181error: incorrect `impl` restriction
82 --> $DIR/recover-incorrect-impl-restriction.rs:18:26
82 --> $DIR/recover-incorrect-impl-restriction.rs:19:26
8383 |
8484LL | pub unsafe auto impl(crate::foo) trait BazUnsafeAuto {}
8585 | ^^^^^^^^^^
......@@ -95,7 +95,7 @@ LL | pub unsafe auto impl(in crate::foo) trait BazUnsafeAuto {}
9595 | ++
9696
9797error[E0658]: `impl` restrictions are experimental
98 --> $DIR/recover-incorrect-impl-restriction.rs:8:9
98 --> $DIR/recover-incorrect-impl-restriction.rs:9:9
9999 |
100100LL | pub impl(crate::foo) trait Baz {}
101101 | ^^^^^^^^^^^^^^^^
......@@ -105,7 +105,7 @@ LL | pub impl(crate::foo) trait Baz {}
105105 = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
106106
107107error[E0658]: `impl` restrictions are experimental
108 --> $DIR/recover-incorrect-impl-restriction.rs:10:16
108 --> $DIR/recover-incorrect-impl-restriction.rs:11:16
109109 |
110110LL | pub unsafe impl(crate::foo) trait BazUnsafe {}
111111 | ^^^^^^^^^^^^^^^^
......@@ -115,7 +115,7 @@ LL | pub unsafe impl(crate::foo) trait BazUnsafe {}
115115 = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
116116
117117error[E0658]: `impl` restrictions are experimental
118 --> $DIR/recover-incorrect-impl-restriction.rs:12:14
118 --> $DIR/recover-incorrect-impl-restriction.rs:13:14
119119 |
120120LL | pub auto impl(crate::foo) trait BazAuto {}
121121 | ^^^^^^^^^^^^^^^^
......@@ -125,7 +125,7 @@ LL | pub auto impl(crate::foo) trait BazAuto {}
125125 = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
126126
127127error[E0658]: `impl` restrictions are experimental
128 --> $DIR/recover-incorrect-impl-restriction.rs:14:15
128 --> $DIR/recover-incorrect-impl-restriction.rs:15:15
129129 |
130130LL | pub const impl(crate::foo) trait BazConst {}
131131 | ^^^^^^^^^^^^^^^^
......@@ -135,7 +135,7 @@ LL | pub const impl(crate::foo) trait BazConst {}
135135 = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
136136
137137error[E0658]: `impl` restrictions are experimental
138 --> $DIR/recover-incorrect-impl-restriction.rs:16:22
138 --> $DIR/recover-incorrect-impl-restriction.rs:17:22
139139 |
140140LL | pub const unsafe impl(crate::foo) trait BazConstUnsafe {}
141141 | ^^^^^^^^^^^^^^^^
......@@ -145,7 +145,7 @@ LL | pub const unsafe impl(crate::foo) trait BazConstUnsafe {}
145145 = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
146146
147147error[E0658]: `impl` restrictions are experimental
148 --> $DIR/recover-incorrect-impl-restriction.rs:18:21
148 --> $DIR/recover-incorrect-impl-restriction.rs:19:21
149149 |
150150LL | pub unsafe auto impl(crate::foo) trait BazUnsafeAuto {}
151151 | ^^^^^^^^^^^^^^^^
tests/ui/impl-restriction/trait-alias-cannot-be-impl-restricted.rs+1
......@@ -1,5 +1,6 @@
11//@ compile-flags: --crate-type=lib
22//@ revisions: with_gate without_gate
3#![warn(incomplete_features)]
34#![cfg_attr(with_gate, feature(impl_restriction))]
45//[with_gate]~^ WARN the feature `impl_restriction` is incomplete and may not be safe to use and/or cause compiler crashes
56#![feature(auto_traits, const_trait_impl, trait_alias)]
tests/ui/impl-restriction/trait-alias-cannot-be-impl-restricted.with_gate.stderr+18-14
......@@ -1,83 +1,87 @@
11error: trait aliases cannot be `impl`-restricted
2 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:7:1
2 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:8:1
33 |
44LL | impl(crate) trait Alias = Copy;
55 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait aliases cannot be `impl`-restricted
66
77error: trait aliases cannot be `auto`
8 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:9:1
8 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:10:1
99 |
1010LL | auto impl(in crate) trait AutoAlias = Copy;
1111 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait aliases cannot be `auto`
1212
1313error: trait aliases cannot be `impl`-restricted
14 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:9:1
14 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:10:1
1515 |
1616LL | auto impl(in crate) trait AutoAlias = Copy;
1717 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait aliases cannot be `impl`-restricted
1818
1919error: trait aliases cannot be `unsafe`
20 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:12:1
20 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:13:1
2121 |
2222LL | unsafe impl(self) trait UnsafeAlias = Copy;
2323 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait aliases cannot be `unsafe`
2424
2525error: trait aliases cannot be `impl`-restricted
26 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:12:1
26 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:13:1
2727 |
2828LL | unsafe impl(self) trait UnsafeAlias = Copy;
2929 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait aliases cannot be `impl`-restricted
3030
3131error: trait aliases cannot be `impl`-restricted
32 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:15:1
32 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:16:1
3333 |
3434LL | const impl(in self) trait ConstAlias = Copy;
3535 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait aliases cannot be `impl`-restricted
3636
3737error: trait aliases cannot be `impl`-restricted
38 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:19:5
38 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:20:5
3939 |
4040LL | impl(super) trait InnerAlias = Copy;
4141 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait aliases cannot be `impl`-restricted
4242
4343error: trait aliases cannot be `unsafe`
44 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:21:5
44 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:22:5
4545 |
4646LL | const unsafe impl(in crate::foo) trait InnerConstUnsafeAlias = Copy;
4747 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait aliases cannot be `unsafe`
4848
4949error: trait aliases cannot be `impl`-restricted
50 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:21:5
50 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:22:5
5151 |
5252LL | const unsafe impl(in crate::foo) trait InnerConstUnsafeAlias = Copy;
5353 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait aliases cannot be `impl`-restricted
5454
5555error: trait aliases cannot be `auto`
56 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:24:5
56 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:25:5
5757 |
5858LL | unsafe auto impl(in crate::foo) trait InnerUnsafeAutoAlias = Copy;
5959 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait aliases cannot be `auto`
6060
6161error: trait aliases cannot be `unsafe`
62 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:24:5
62 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:25:5
6363 |
6464LL | unsafe auto impl(in crate::foo) trait InnerUnsafeAutoAlias = Copy;
6565 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait aliases cannot be `unsafe`
6666
6767error: trait aliases cannot be `impl`-restricted
68 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:24:5
68 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:25:5
6969 |
7070LL | unsafe auto impl(in crate::foo) trait InnerUnsafeAutoAlias = Copy;
7171 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait aliases cannot be `impl`-restricted
7272
7373warning: the feature `impl_restriction` is incomplete and may not be safe to use and/or cause compiler crashes
74 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:3:32
74 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:4:32
7575 |
7676LL | #![cfg_attr(with_gate, feature(impl_restriction))]
7777 | ^^^^^^^^^^^^^^^^
7878 |
7979 = note: see issue #105077 <https://github.com/rust-lang/rust/issues/105077> for more information
80 = note: `#[warn(incomplete_features)]` on by default
80note: the lint level is defined here
81 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:3:9
82 |
83LL | #![warn(incomplete_features)]
84 | ^^^^^^^^^^^^^^^^^^^
8185
8286error: aborting due to 12 previous errors; 1 warning emitted
8387
tests/ui/impl-restriction/trait-alias-cannot-be-impl-restricted.without_gate.stderr+19-19
......@@ -1,77 +1,77 @@
11error: trait aliases cannot be `impl`-restricted
2 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:7:1
2 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:8:1
33 |
44LL | impl(crate) trait Alias = Copy;
55 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait aliases cannot be `impl`-restricted
66
77error: trait aliases cannot be `auto`
8 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:9:1
8 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:10:1
99 |
1010LL | auto impl(in crate) trait AutoAlias = Copy;
1111 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait aliases cannot be `auto`
1212
1313error: trait aliases cannot be `impl`-restricted
14 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:9:1
14 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:10:1
1515 |
1616LL | auto impl(in crate) trait AutoAlias = Copy;
1717 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait aliases cannot be `impl`-restricted
1818
1919error: trait aliases cannot be `unsafe`
20 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:12:1
20 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:13:1
2121 |
2222LL | unsafe impl(self) trait UnsafeAlias = Copy;
2323 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait aliases cannot be `unsafe`
2424
2525error: trait aliases cannot be `impl`-restricted
26 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:12:1
26 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:13:1
2727 |
2828LL | unsafe impl(self) trait UnsafeAlias = Copy;
2929 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait aliases cannot be `impl`-restricted
3030
3131error: trait aliases cannot be `impl`-restricted
32 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:15:1
32 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:16:1
3333 |
3434LL | const impl(in self) trait ConstAlias = Copy;
3535 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait aliases cannot be `impl`-restricted
3636
3737error: trait aliases cannot be `impl`-restricted
38 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:19:5
38 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:20:5
3939 |
4040LL | impl(super) trait InnerAlias = Copy;
4141 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait aliases cannot be `impl`-restricted
4242
4343error: trait aliases cannot be `unsafe`
44 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:21:5
44 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:22:5
4545 |
4646LL | const unsafe impl(in crate::foo) trait InnerConstUnsafeAlias = Copy;
4747 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait aliases cannot be `unsafe`
4848
4949error: trait aliases cannot be `impl`-restricted
50 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:21:5
50 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:22:5
5151 |
5252LL | const unsafe impl(in crate::foo) trait InnerConstUnsafeAlias = Copy;
5353 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait aliases cannot be `impl`-restricted
5454
5555error: trait aliases cannot be `auto`
56 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:24:5
56 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:25:5
5757 |
5858LL | unsafe auto impl(in crate::foo) trait InnerUnsafeAutoAlias = Copy;
5959 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait aliases cannot be `auto`
6060
6161error: trait aliases cannot be `unsafe`
62 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:24:5
62 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:25:5
6363 |
6464LL | unsafe auto impl(in crate::foo) trait InnerUnsafeAutoAlias = Copy;
6565 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait aliases cannot be `unsafe`
6666
6767error: trait aliases cannot be `impl`-restricted
68 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:24:5
68 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:25:5
6969 |
7070LL | unsafe auto impl(in crate::foo) trait InnerUnsafeAutoAlias = Copy;
7171 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait aliases cannot be `impl`-restricted
7272
7373error[E0658]: `impl` restrictions are experimental
74 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:7:1
74 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:8:1
7575 |
7676LL | impl(crate) trait Alias = Copy;
7777 | ^^^^^^^^^^^
......@@ -81,7 +81,7 @@ LL | impl(crate) trait Alias = Copy;
8181 = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
8282
8383error[E0658]: `impl` restrictions are experimental
84 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:9:6
84 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:10:6
8585 |
8686LL | auto impl(in crate) trait AutoAlias = Copy;
8787 | ^^^^^^^^^^^^^^
......@@ -91,7 +91,7 @@ LL | auto impl(in crate) trait AutoAlias = Copy;
9191 = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
9292
9393error[E0658]: `impl` restrictions are experimental
94 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:12:8
94 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:13:8
9595 |
9696LL | unsafe impl(self) trait UnsafeAlias = Copy;
9797 | ^^^^^^^^^^
......@@ -101,7 +101,7 @@ LL | unsafe impl(self) trait UnsafeAlias = Copy;
101101 = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
102102
103103error[E0658]: `impl` restrictions are experimental
104 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:15:7
104 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:16:7
105105 |
106106LL | const impl(in self) trait ConstAlias = Copy;
107107 | ^^^^^^^^^^^^^
......@@ -111,7 +111,7 @@ LL | const impl(in self) trait ConstAlias = Copy;
111111 = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
112112
113113error[E0658]: `impl` restrictions are experimental
114 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:19:5
114 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:20:5
115115 |
116116LL | impl(super) trait InnerAlias = Copy;
117117 | ^^^^^^^^^^^
......@@ -121,7 +121,7 @@ LL | impl(super) trait InnerAlias = Copy;
121121 = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
122122
123123error[E0658]: `impl` restrictions are experimental
124 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:21:18
124 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:22:18
125125 |
126126LL | const unsafe impl(in crate::foo) trait InnerConstUnsafeAlias = Copy;
127127 | ^^^^^^^^^^^^^^^^^^^
......@@ -131,7 +131,7 @@ LL | const unsafe impl(in crate::foo) trait InnerConstUnsafeAlias = Copy;
131131 = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
132132
133133error[E0658]: `impl` restrictions are experimental
134 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:24:17
134 --> $DIR/trait-alias-cannot-be-impl-restricted.rs:25:17
135135 |
136136LL | unsafe auto impl(in crate::foo) trait InnerUnsafeAutoAlias = Copy;
137137 | ^^^^^^^^^^^^^^^^^^^
tests/ui/impl-trait/equality-rpass.rs+1-1
......@@ -1,6 +1,6 @@
11//@ run-pass
22
3#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
3#![feature(specialization)]
44
55trait Foo: std::fmt::Debug + Eq {}
66
tests/ui/impl-trait/equality-rpass.stderr deleted-12
......@@ -1,12 +0,0 @@
1warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
2 --> $DIR/equality-rpass.rs:3:12
3 |
4LL | #![feature(specialization)]
5 | ^^^^^^^^^^^^^^
6 |
7 = note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
8 = help: consider using `min_specialization` instead, which is more stable and complete
9 = note: `#[warn(incomplete_features)]` on by default
10
11warning: 1 warning emitted
12
tests/ui/impl-trait/equality.rs+1-1
......@@ -1,6 +1,6 @@
11//@ dont-require-annotations: NOTE
22
3#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
3#![feature(specialization)]
44
55trait Foo: Copy + ToString {}
66
tests/ui/impl-trait/equality.stderr+1-11
......@@ -1,13 +1,3 @@
1warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
2 --> $DIR/equality.rs:3:12
3 |
4LL | #![feature(specialization)]
5 | ^^^^^^^^^^^^^^
6 |
7 = note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
8 = help: consider using `min_specialization` instead, which is more stable and complete
9 = note: `#[warn(incomplete_features)]` on by default
10
111error[E0308]: mismatched types
122 --> $DIR/equality.rs:17:5
133 |
......@@ -48,7 +38,7 @@ help: the following other types implement trait `Add<Rhs>`
4838 = note: `&u32` implements `Add`
4939 = note: this error originates in the macro `add_impl` (in Nightly builds, run with -Z macro-backtrace for more info)
5040
51error: aborting due to 2 previous errors; 1 warning emitted
41error: aborting due to 2 previous errors
5242
5343Some errors have detailed explanations: E0277, E0308.
5444For more information about an error, try `rustc --explain E0277`.
tests/ui/impl-trait/equality2.rs+1-1
......@@ -1,6 +1,6 @@
11//@ dont-require-annotations: NOTE
22
3#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
3#![feature(specialization)]
44
55trait Foo: Copy + ToString {}
66
tests/ui/impl-trait/equality2.stderr+1-11
......@@ -1,13 +1,3 @@
1warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
2 --> $DIR/equality2.rs:3:12
3 |
4LL | #![feature(specialization)]
5 | ^^^^^^^^^^^^^^
6 |
7 = note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
8 = help: consider using `min_specialization` instead, which is more stable and complete
9 = note: `#[warn(incomplete_features)]` on by default
10
111error[E0308]: mismatched types
122 --> $DIR/equality2.rs:27:18
133 |
......@@ -72,6 +62,6 @@ LL | x.0);
7262 found opaque type `impl Foo` (`u32`)
7363 = note: distinct uses of `impl Trait` result in different opaque types
7464
75error: aborting due to 4 previous errors; 1 warning emitted
65error: aborting due to 4 previous errors
7666
7767For more information about this error, try `rustc --explain E0308`.
tests/ui/impl-trait/in-trait/alias-bounds-when-not-wf.rs-1
......@@ -1,7 +1,6 @@
11//@ compile-flags: -Znext-solver
22
33#![feature(lazy_type_alias)]
4//~^ WARN the feature `lazy_type_alias` is incomplete
54
65trait Foo {}
76
tests/ui/impl-trait/in-trait/alias-bounds-when-not-wf.stderr+8-17
......@@ -1,53 +1,44 @@
1warning: the feature `lazy_type_alias` is incomplete and may not be safe to use and/or cause compiler crashes
2 --> $DIR/alias-bounds-when-not-wf.rs:3:12
3 |
4LL | #![feature(lazy_type_alias)]
5 | ^^^^^^^^^^^^^^^
6 |
7 = note: see issue #112792 <https://github.com/rust-lang/rust/issues/112792> for more information
8 = note: `#[warn(incomplete_features)]` on by default
9
101error[E0277]: the trait bound `usize: Foo` is not satisfied
11 --> $DIR/alias-bounds-when-not-wf.rs:16:15
2 --> $DIR/alias-bounds-when-not-wf.rs:15:15
123 |
134LL | fn hello(_: W<A<usize>>) {}
145 | ^^^^^^^^ the trait `Foo` is not implemented for `usize`
156 |
167help: this trait has no implementations, consider adding one
17 --> $DIR/alias-bounds-when-not-wf.rs:6:1
8 --> $DIR/alias-bounds-when-not-wf.rs:5:1
189 |
1910LL | trait Foo {}
2011 | ^^^^^^^^^
2112note: required by a bound in `A`
22 --> $DIR/alias-bounds-when-not-wf.rs:8:11
13 --> $DIR/alias-bounds-when-not-wf.rs:7:11
2314 |
2415LL | type A<T: Foo> = T;
2516 | ^^^ required by this bound in `A`
2617
2718error[E0277]: the trait bound `usize: Foo` is not satisfied
28 --> $DIR/alias-bounds-when-not-wf.rs:16:10
19 --> $DIR/alias-bounds-when-not-wf.rs:15:10
2920 |
3021LL | fn hello(_: W<A<usize>>) {}
3122 | ^ the trait `Foo` is not implemented for `usize`
3223 |
3324help: this trait has no implementations, consider adding one
34 --> $DIR/alias-bounds-when-not-wf.rs:6:1
25 --> $DIR/alias-bounds-when-not-wf.rs:5:1
3526 |
3627LL | trait Foo {}
3728 | ^^^^^^^^^
3829
3930error[E0277]: the trait bound `usize: Foo` is not satisfied
40 --> $DIR/alias-bounds-when-not-wf.rs:16:1
31 --> $DIR/alias-bounds-when-not-wf.rs:15:1
4132 |
4233LL | fn hello(_: W<A<usize>>) {}
4334 | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `usize`
4435 |
4536help: this trait has no implementations, consider adding one
46 --> $DIR/alias-bounds-when-not-wf.rs:6:1
37 --> $DIR/alias-bounds-when-not-wf.rs:5:1
4738 |
4839LL | trait Foo {}
4940 | ^^^^^^^^^
5041
51error: aborting due to 3 previous errors; 1 warning emitted
42error: aborting due to 3 previous errors
5243
5344For more information about this error, try `rustc --explain E0277`.
tests/ui/issues/issue-44056.rs deleted-7
......@@ -1,7 +0,0 @@
1//@ build-pass (FIXME(55996): should be run on targets supporting avx)
2//@ only-x86_64
3//@ no-prefer-dynamic
4//@ compile-flags: -Ctarget-feature=+avx -Clto
5//@ ignore-backends: gcc
6
7fn main() {}
tests/ui/issues/issue-51947.rs deleted-17
......@@ -1,17 +0,0 @@
1//@ build-pass
2
3#![crate_type = "lib"]
4#![feature(linkage)]
5
6// MergeFunctions will merge these via an anonymous internal
7// backing function, which must be named if ThinLTO buffers are used
8
9#[linkage = "weak"]
10pub fn fn1(a: u32, b: u32, c: u32) -> u32 {
11 a + b + c
12}
13
14#[linkage = "weak"]
15pub fn fn2(a: u32, b: u32, c: u32) -> u32 {
16 a + b + c
17}
tests/ui/layout/gce-rigid-const-in-array-len.rs+1-1
......@@ -12,7 +12,7 @@
1212//! constant.
1313
1414#![feature(rustc_attrs)]
15#![feature(generic_const_exprs)] //~ WARNING: the feature `generic_const_exprs` is incomplete
15#![feature(generic_const_exprs)]
1616#![feature(trivial_bounds)]
1717
1818#![crate_type = "lib"]
tests/ui/layout/gce-rigid-const-in-array-len.stderr+1-10
......@@ -1,17 +1,8 @@
1warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes
2 --> $DIR/gce-rigid-const-in-array-len.rs:15:12
3 |
4LL | #![feature(generic_const_exprs)]
5 | ^^^^^^^^^^^^^^^^^^^
6 |
7 = note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
8 = note: `#[warn(incomplete_features)]` on by default
9
101error: the type `[u8; <u8 as A>::B]` has an unknown layout
112 --> $DIR/gce-rigid-const-in-array-len.rs:25:1
123 |
134LL | struct S([u8; <u8 as A>::B])
145 | ^^^^^^^^
156
16error: aborting due to 1 previous error; 1 warning emitted
7error: aborting due to 1 previous error
178
tests/ui/lazy-type-alias/bad-lazy-type-alias.rs-1
......@@ -1,7 +1,6 @@
11// regression test for #127351
22
33#![feature(lazy_type_alias)]
4//~^ WARN the feature `lazy_type_alias` is incomplete
54
65type ExplicitTypeOutlives<T> = T;
76
tests/ui/lazy-type-alias/bad-lazy-type-alias.stderr+3-12
......@@ -1,20 +1,11 @@
1warning: the feature `lazy_type_alias` is incomplete and may not be safe to use and/or cause compiler crashes
2 --> $DIR/bad-lazy-type-alias.rs:3:12
3 |
4LL | #![feature(lazy_type_alias)]
5 | ^^^^^^^^^^^^^^^
6 |
7 = note: see issue #112792 <https://github.com/rust-lang/rust/issues/112792> for more information
8 = note: `#[warn(incomplete_features)]` on by default
9
101error[E0107]: missing generics for type alias `ExplicitTypeOutlives`
11 --> $DIR/bad-lazy-type-alias.rs:9:24
2 --> $DIR/bad-lazy-type-alias.rs:8:24
123 |
134LL | _significant_drop: ExplicitTypeOutlives,
145 | ^^^^^^^^^^^^^^^^^^^^ expected 1 generic argument
156 |
167note: type alias defined here, with 1 generic parameter: `T`
17 --> $DIR/bad-lazy-type-alias.rs:6:6
8 --> $DIR/bad-lazy-type-alias.rs:5:6
189 |
1910LL | type ExplicitTypeOutlives<T> = T;
2011 | ^^^^^^^^^^^^^^^^^^^^ -
......@@ -23,6 +14,6 @@ help: add missing generic argument
2314LL | _significant_drop: ExplicitTypeOutlives<T>,
2415 | +++
2516
26error: aborting due to 1 previous error; 1 warning emitted
17error: aborting due to 1 previous error
2718
2819For more information about this error, try `rustc --explain E0107`.
tests/ui/lazy-type-alias/coerce-behind-lazy.current.stderr deleted-11
......@@ -1,11 +0,0 @@
1warning: the feature `lazy_type_alias` is incomplete and may not be safe to use and/or cause compiler crashes
2 --> $DIR/coerce-behind-lazy.rs:6:12
3 |
4LL | #![feature(lazy_type_alias)]
5 | ^^^^^^^^^^^^^^^
6 |
7 = note: see issue #112792 <https://github.com/rust-lang/rust/issues/112792> for more information
8 = note: `#[warn(incomplete_features)]` on by default
9
10warning: 1 warning emitted
11
tests/ui/lazy-type-alias/coerce-behind-lazy.next.stderr deleted-11
......@@ -1,11 +0,0 @@
1warning: the feature `lazy_type_alias` is incomplete and may not be safe to use and/or cause compiler crashes
2 --> $DIR/coerce-behind-lazy.rs:6:12
3 |
4LL | #![feature(lazy_type_alias)]
5 | ^^^^^^^^^^^^^^^
6 |
7 = note: see issue #112792 <https://github.com/rust-lang/rust/issues/112792> for more information
8 = note: `#[warn(incomplete_features)]` on by default
9
10warning: 1 warning emitted
11
tests/ui/lazy-type-alias/coerce-behind-lazy.rs-1
......@@ -4,7 +4,6 @@
44//@[next] compile-flags: -Znext-solver
55
66#![feature(lazy_type_alias)]
7//~^ WARN the feature `lazy_type_alias` is incomplete
87
98use std::any::Any;
109
tests/ui/lazy-type-alias/enum-variant.rs-1
......@@ -2,7 +2,6 @@
22//@ check-pass
33
44#![feature(lazy_type_alias)]
5//~^ WARN the feature `lazy_type_alias` is incomplete and may not be safe to use
65
76enum Enum {
87 Unit,
tests/ui/lazy-type-alias/enum-variant.stderr deleted-11
......@@ -1,11 +0,0 @@
1warning: the feature `lazy_type_alias` is incomplete and may not be safe to use and/or cause compiler crashes
2 --> $DIR/enum-variant.rs:4:12
3 |
4LL | #![feature(lazy_type_alias)]
5 | ^^^^^^^^^^^^^^^
6 |
7 = note: see issue #112792 <https://github.com/rust-lang/rust/issues/112792> for more information
8 = note: `#[warn(incomplete_features)]` on by default
9
10warning: 1 warning emitted
11
tests/ui/lto/lto-avx-target-feature.rs created+8
......@@ -0,0 +1,8 @@
1//! regression test for <https://github.com/rust-lang/rust/issues/44056>
2//@ build-pass (FIXME(55996): should be run on targets supporting avx)
3//@ only-x86_64
4//@ no-prefer-dynamic
5//@ compile-flags: -Ctarget-feature=+avx -Clto
6//@ ignore-backends: gcc
7
8fn main() {}
tests/ui/lto/lto-weak-merge-functions.rs created+18
......@@ -0,0 +1,18 @@
1//! regression test for <https://github.com/rust-lang/rust/issues/51947>
2//@ build-pass
3
4#![crate_type = "lib"]
5#![feature(linkage)]
6
7// MergeFunctions will merge these via an anonymous internal
8// backing function, which must be named if ThinLTO buffers are used
9
10#[linkage = "weak"]
11pub fn fn1(a: u32, b: u32, c: u32) -> u32 {
12 a + b + c
13}
14
15#[linkage = "weak"]
16pub fn fn2(a: u32, b: u32, c: u32) -> u32 {
17 a + b + c
18}
tests/ui/marker_trait_attr/overlap-doesnt-conflict-with-specialization.rs+1-1
......@@ -1,7 +1,7 @@
11//@ run-pass
22
33#![feature(marker_trait_attr)]
4#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
4#![feature(specialization)]
55
66#[marker]
77trait MyMarker {}
tests/ui/marker_trait_attr/overlap-doesnt-conflict-with-specialization.stderr deleted-12
......@@ -1,12 +0,0 @@
1warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
2 --> $DIR/overlap-doesnt-conflict-with-specialization.rs:4:12
3 |
4LL | #![feature(specialization)]
5 | ^^^^^^^^^^^^^^
6 |
7 = note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
8 = help: consider using `min_specialization` instead, which is more stable and complete
9 = note: `#[warn(incomplete_features)]` on by default
10
11warning: 1 warning emitted
12
tests/ui/missing/undeclared-generic-parameter.rs created+5
......@@ -0,0 +1,5 @@
1struct A;
2impl A<B> {}
3//~^ ERROR cannot find type `B` in this scope
4//~| ERROR struct takes 0 generic arguments but 1 generic argument was supplied
5fn main() {}
tests/ui/missing/undeclared-generic-parameter.stderr created+36
......@@ -0,0 +1,36 @@
1error[E0425]: cannot find type `B` in this scope
2 --> $DIR/undeclared-generic-parameter.rs:2:8
3 |
4LL | struct A;
5 | --------- similarly named struct `A` defined here
6LL | impl A<B> {}
7 | ^
8 |
9help: a struct with a similar name exists
10 |
11LL - impl A<B> {}
12LL + impl A<A> {}
13 |
14help: you might be missing a type parameter
15 |
16LL | impl<B> A<B> {}
17 | +++
18
19error[E0107]: struct takes 0 generic arguments but 1 generic argument was supplied
20 --> $DIR/undeclared-generic-parameter.rs:2:6
21 |
22LL | impl A<B> {}
23 | ^--- help: remove the unnecessary generics
24 | |
25 | expected 0 generic arguments
26 |
27note: struct defined here, with 0 generic parameters
28 --> $DIR/undeclared-generic-parameter.rs:1:8
29 |
30LL | struct A;
31 | ^
32
33error: aborting due to 2 previous errors
34
35Some errors have detailed explanations: E0107, E0425.
36For more information about an error, try `rustc --explain E0107`.
tests/ui/parser/assoc/assoc-static-semantic-fail.rs-1
......@@ -1,7 +1,6 @@
11// Semantically, we do not allow e.g., `static X: u8 = 0;` as an associated item.
22
33#![feature(specialization)]
4//~^ WARN the feature `specialization` is incomplete
54
65fn main() {}
76
tests/ui/parser/assoc/assoc-static-semantic-fail.stderr+25-35
......@@ -1,17 +1,17 @@
11error: associated `static` items are not allowed
2 --> $DIR/assoc-static-semantic-fail.rs:10:5
2 --> $DIR/assoc-static-semantic-fail.rs:9:5
33 |
44LL | static IA: u8 = 0;
55 | ^^^^^^^^^^^^^^^^^^
66
77error: associated `static` items are not allowed
8 --> $DIR/assoc-static-semantic-fail.rs:12:5
8 --> $DIR/assoc-static-semantic-fail.rs:11:5
99 |
1010LL | static IB: u8;
1111 | ^^^^^^^^^^^^^^
1212
1313error: a static item cannot be `default`
14 --> $DIR/assoc-static-semantic-fail.rs:15:5
14 --> $DIR/assoc-static-semantic-fail.rs:14:5
1515 |
1616LL | default static IC: u8 = 0;
1717 | ^^^^^^^ `default` because of this
......@@ -19,13 +19,13 @@ LL | default static IC: u8 = 0;
1919 = note: only associated `fn`, `const`, and `type` items can be `default`
2020
2121error: associated `static` items are not allowed
22 --> $DIR/assoc-static-semantic-fail.rs:15:5
22 --> $DIR/assoc-static-semantic-fail.rs:14:5
2323 |
2424LL | default static IC: u8 = 0;
2525 | ^^^^^^^^^^^^^^^^^^^^^^^^^^
2626
2727error: a static item cannot be `default`
28 --> $DIR/assoc-static-semantic-fail.rs:18:16
28 --> $DIR/assoc-static-semantic-fail.rs:17:16
2929 |
3030LL | pub(crate) default static ID: u8;
3131 | ^^^^^^^ `default` because of this
......@@ -33,25 +33,25 @@ LL | pub(crate) default static ID: u8;
3333 = note: only associated `fn`, `const`, and `type` items can be `default`
3434
3535error: associated `static` items are not allowed
36 --> $DIR/assoc-static-semantic-fail.rs:18:5
36 --> $DIR/assoc-static-semantic-fail.rs:17:5
3737 |
3838LL | pub(crate) default static ID: u8;
3939 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4040
4141error: associated `static` items are not allowed
42 --> $DIR/assoc-static-semantic-fail.rs:25:5
42 --> $DIR/assoc-static-semantic-fail.rs:24:5
4343 |
4444LL | static TA: u8 = 0;
4545 | ^^^^^^^^^^^^^^^^^^
4646
4747error: associated `static` items are not allowed
48 --> $DIR/assoc-static-semantic-fail.rs:27:5
48 --> $DIR/assoc-static-semantic-fail.rs:26:5
4949 |
5050LL | static TB: u8;
5151 | ^^^^^^^^^^^^^^
5252
5353error: a static item cannot be `default`
54 --> $DIR/assoc-static-semantic-fail.rs:29:5
54 --> $DIR/assoc-static-semantic-fail.rs:28:5
5555 |
5656LL | default static TC: u8 = 0;
5757 | ^^^^^^^ `default` because of this
......@@ -59,13 +59,13 @@ LL | default static TC: u8 = 0;
5959 = note: only associated `fn`, `const`, and `type` items can be `default`
6060
6161error: associated `static` items are not allowed
62 --> $DIR/assoc-static-semantic-fail.rs:29:5
62 --> $DIR/assoc-static-semantic-fail.rs:28:5
6363 |
6464LL | default static TC: u8 = 0;
6565 | ^^^^^^^^^^^^^^^^^^^^^^^^^^
6666
6767error: a static item cannot be `default`
68 --> $DIR/assoc-static-semantic-fail.rs:32:16
68 --> $DIR/assoc-static-semantic-fail.rs:31:16
6969 |
7070LL | pub(crate) default static TD: u8;
7171 | ^^^^^^^ `default` because of this
......@@ -73,25 +73,25 @@ LL | pub(crate) default static TD: u8;
7373 = note: only associated `fn`, `const`, and `type` items can be `default`
7474
7575error: associated `static` items are not allowed
76 --> $DIR/assoc-static-semantic-fail.rs:32:5
76 --> $DIR/assoc-static-semantic-fail.rs:31:5
7777 |
7878LL | pub(crate) default static TD: u8;
7979 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
8080
8181error: associated `static` items are not allowed
82 --> $DIR/assoc-static-semantic-fail.rs:39:5
82 --> $DIR/assoc-static-semantic-fail.rs:38:5
8383 |
8484LL | static TA: u8 = 0;
8585 | ^^^^^^^^^^^^^^^^^^
8686
8787error: associated `static` items are not allowed
88 --> $DIR/assoc-static-semantic-fail.rs:41:5
88 --> $DIR/assoc-static-semantic-fail.rs:40:5
8989 |
9090LL | static TB: u8;
9191 | ^^^^^^^^^^^^^^
9292
9393error: a static item cannot be `default`
94 --> $DIR/assoc-static-semantic-fail.rs:44:5
94 --> $DIR/assoc-static-semantic-fail.rs:43:5
9595 |
9696LL | default static TC: u8 = 0;
9797 | ^^^^^^^ `default` because of this
......@@ -99,13 +99,13 @@ LL | default static TC: u8 = 0;
9999 = note: only associated `fn`, `const`, and `type` items can be `default`
100100
101101error: associated `static` items are not allowed
102 --> $DIR/assoc-static-semantic-fail.rs:44:5
102 --> $DIR/assoc-static-semantic-fail.rs:43:5
103103 |
104104LL | default static TC: u8 = 0;
105105 | ^^^^^^^^^^^^^^^^^^^^^^^^^^
106106
107107error: a static item cannot be `default`
108 --> $DIR/assoc-static-semantic-fail.rs:47:9
108 --> $DIR/assoc-static-semantic-fail.rs:46:9
109109 |
110110LL | pub default static TD: u8;
111111 | ^^^^^^^ `default` because of this
......@@ -113,13 +113,13 @@ LL | pub default static TD: u8;
113113 = note: only associated `fn`, `const`, and `type` items can be `default`
114114
115115error: associated `static` items are not allowed
116 --> $DIR/assoc-static-semantic-fail.rs:47:5
116 --> $DIR/assoc-static-semantic-fail.rs:46:5
117117 |
118118LL | pub default static TD: u8;
119119 | ^^^^^^^^^^^^^^^^^^^^^^^^^^
120120
121121error: associated constant in `impl` without body
122 --> $DIR/assoc-static-semantic-fail.rs:12:5
122 --> $DIR/assoc-static-semantic-fail.rs:11:5
123123 |
124124LL | static IB: u8;
125125 | ^^^^^^^^^^^^^-
......@@ -127,7 +127,7 @@ LL | static IB: u8;
127127 | help: provide a definition for the constant: `= <expr>;`
128128
129129error: associated constant in `impl` without body
130 --> $DIR/assoc-static-semantic-fail.rs:18:5
130 --> $DIR/assoc-static-semantic-fail.rs:17:5
131131 |
132132LL | pub(crate) default static ID: u8;
133133 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
......@@ -135,7 +135,7 @@ LL | pub(crate) default static ID: u8;
135135 | help: provide a definition for the constant: `= <expr>;`
136136
137137error[E0449]: visibility qualifiers are not permitted here
138 --> $DIR/assoc-static-semantic-fail.rs:32:5
138 --> $DIR/assoc-static-semantic-fail.rs:31:5
139139 |
140140LL | pub(crate) default static TD: u8;
141141 | ^^^^^^^^^^ help: remove the qualifier
......@@ -143,7 +143,7 @@ LL | pub(crate) default static TD: u8;
143143 = note: trait items always share the visibility of their trait
144144
145145error: associated constant in `impl` without body
146 --> $DIR/assoc-static-semantic-fail.rs:41:5
146 --> $DIR/assoc-static-semantic-fail.rs:40:5
147147 |
148148LL | static TB: u8;
149149 | ^^^^^^^^^^^^^-
......@@ -151,7 +151,7 @@ LL | static TB: u8;
151151 | help: provide a definition for the constant: `= <expr>;`
152152
153153error: associated constant in `impl` without body
154 --> $DIR/assoc-static-semantic-fail.rs:47:5
154 --> $DIR/assoc-static-semantic-fail.rs:46:5
155155 |
156156LL | pub default static TD: u8;
157157 | ^^^^^^^^^^^^^^^^^^^^^^^^^-
......@@ -159,23 +159,13 @@ LL | pub default static TD: u8;
159159 | help: provide a definition for the constant: `= <expr>;`
160160
161161error[E0449]: visibility qualifiers are not permitted here
162 --> $DIR/assoc-static-semantic-fail.rs:47:5
162 --> $DIR/assoc-static-semantic-fail.rs:46:5
163163 |
164164LL | pub default static TD: u8;
165165 | ^^^ help: remove the qualifier
166166 |
167167 = note: trait items always share the visibility of their trait
168168
169warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
170 --> $DIR/assoc-static-semantic-fail.rs:3:12
171 |
172LL | #![feature(specialization)]
173 | ^^^^^^^^^^^^^^
174 |
175 = note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
176 = help: consider using `min_specialization` instead, which is more stable and complete
177 = note: `#[warn(incomplete_features)]` on by default
178
179error: aborting due to 24 previous errors; 1 warning emitted
169error: aborting due to 24 previous errors
180170
181171For more information about this error, try `rustc --explain E0449`.
tests/ui/parser/default.rs-1
......@@ -1,7 +1,6 @@
11// Test successful and unsuccessful parsing of the `default` contextual keyword
22
33#![feature(specialization)]
4//~^ WARN the feature `specialization` is incomplete
54
65trait Foo {
76 fn foo<T: Default>() -> T;
tests/ui/parser/default.stderr+5-15
......@@ -1,5 +1,5 @@
11error: `default` is not followed by an item
2 --> $DIR/default.rs:23:5
2 --> $DIR/default.rs:22:5
33 |
44LL | default pub fn foo<T: Default>() -> T { T::default() }
55 | ^^^^^^^ the `default` qualifier
......@@ -7,7 +7,7 @@ LL | default pub fn foo<T: Default>() -> T { T::default() }
77 = note: only `fn`, `const`, `type`, or `impl` items may be prefixed by `default`
88
99error: non-item in item list
10 --> $DIR/default.rs:23:13
10 --> $DIR/default.rs:22:13
1111 |
1212LL | impl Foo for u32 {
1313 | - item list starts here
......@@ -18,25 +18,15 @@ LL | }
1818 | - item list ends here
1919
2020error[E0449]: visibility qualifiers are not permitted here
21 --> $DIR/default.rs:17:5
21 --> $DIR/default.rs:16:5
2222 |
2323LL | pub default fn foo<T: Default>() -> T {
2424 | ^^^ help: remove the qualifier
2525 |
2626 = note: trait items always share the visibility of their trait
2727
28warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
29 --> $DIR/default.rs:3:12
30 |
31LL | #![feature(specialization)]
32 | ^^^^^^^^^^^^^^
33 |
34 = note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
35 = help: consider using `min_specialization` instead, which is more stable and complete
36 = note: `#[warn(incomplete_features)]` on by default
37
3828error[E0046]: not all trait items implemented, missing: `foo`
39 --> $DIR/default.rs:22:1
29 --> $DIR/default.rs:21:1
4030 |
4131LL | fn foo<T: Default>() -> T;
4232 | -------------------------- `foo` from trait
......@@ -44,7 +34,7 @@ LL | fn foo<T: Default>() -> T;
4434LL | impl Foo for u32 {
4535 | ^^^^^^^^^^^^^^^^ missing `foo` in implementation
4636
47error: aborting due to 4 previous errors; 1 warning emitted
37error: aborting due to 4 previous errors
4838
4939Some errors have detailed explanations: E0046, E0449.
5040For more information about an error, try `rustc --explain E0046`.
tests/ui/parser/defaultness-invalid-places-fail-semantic.rs+1-1
......@@ -1,4 +1,4 @@
1#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
1#![feature(specialization)]
22
33fn main() {}
44
tests/ui/parser/defaultness-invalid-places-fail-semantic.stderr+1-11
......@@ -70,15 +70,5 @@ LL | default fn h() {}
7070 | |
7171 | `default` because of this
7272
73warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
74 --> $DIR/defaultness-invalid-places-fail-semantic.rs:1:12
75 |
76LL | #![feature(specialization)]
77 | ^^^^^^^^^^^^^^
78 |
79 = note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
80 = help: consider using `min_specialization` instead, which is more stable and complete
81 = note: `#[warn(incomplete_features)]` on by default
82
83error: aborting due to 9 previous errors; 1 warning emitted
73error: aborting due to 9 previous errors
8474
tests/ui/pattern/usefulness/empty-types.exhaustive_patterns.stderr+50-50
......@@ -1,5 +1,5 @@
11error: unreachable pattern
2 --> $DIR/empty-types.rs:48:9
2 --> $DIR/empty-types.rs:47:9
33 |
44LL | _ => {}
55 | ^------
......@@ -9,13 +9,13 @@ LL | _ => {}
99 |
1010 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
1111note: the lint level is defined here
12 --> $DIR/empty-types.rs:14:9
12 --> $DIR/empty-types.rs:13:9
1313 |
1414LL | #![deny(unreachable_patterns)]
1515 | ^^^^^^^^^^^^^^^^^^^^
1616
1717error: unreachable pattern
18 --> $DIR/empty-types.rs:51:9
18 --> $DIR/empty-types.rs:50:9
1919 |
2020LL | _x => {}
2121 | ^^------
......@@ -26,7 +26,7 @@ LL | _x => {}
2626 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
2727
2828error[E0004]: non-exhaustive patterns: type `&!` is non-empty
29 --> $DIR/empty-types.rs:55:11
29 --> $DIR/empty-types.rs:54:11
3030 |
3131LL | match ref_never {}
3232 | ^^^^^^^^^
......@@ -41,7 +41,7 @@ LL ~ }
4141 |
4242
4343error: unreachable pattern
44 --> $DIR/empty-types.rs:69:9
44 --> $DIR/empty-types.rs:68:9
4545 |
4646LL | (_, _) => {}
4747 | ^^^^^^------
......@@ -52,7 +52,7 @@ LL | (_, _) => {}
5252 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
5353
5454error: unreachable pattern
55 --> $DIR/empty-types.rs:75:9
55 --> $DIR/empty-types.rs:74:9
5656 |
5757LL | _ => {}
5858 | ^------
......@@ -63,7 +63,7 @@ LL | _ => {}
6363 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
6464
6565error: unreachable pattern
66 --> $DIR/empty-types.rs:78:9
66 --> $DIR/empty-types.rs:77:9
6767 |
6868LL | (_, _) => {}
6969 | ^^^^^^------
......@@ -74,7 +74,7 @@ LL | (_, _) => {}
7474 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
7575
7676error: unreachable pattern
77 --> $DIR/empty-types.rs:82:9
77 --> $DIR/empty-types.rs:81:9
7878 |
7979LL | _ => {}
8080 | ^------
......@@ -85,7 +85,7 @@ LL | _ => {}
8585 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
8686
8787error[E0004]: non-exhaustive patterns: `Ok(_)` not covered
88 --> $DIR/empty-types.rs:86:11
88 --> $DIR/empty-types.rs:85:11
8989 |
9090LL | match res_u32_never {}
9191 | ^^^^^^^^^^^^^ pattern `Ok(_)` not covered
......@@ -104,7 +104,7 @@ LL ~ }
104104 |
105105
106106error: unreachable pattern
107 --> $DIR/empty-types.rs:93:9
107 --> $DIR/empty-types.rs:92:9
108108 |
109109LL | Err(_) => {}
110110 | ^^^^^^------
......@@ -115,7 +115,7 @@ LL | Err(_) => {}
115115 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
116116
117117error: unreachable pattern
118 --> $DIR/empty-types.rs:98:9
118 --> $DIR/empty-types.rs:97:9
119119 |
120120LL | Err(_) => {}
121121 | ^^^^^^------
......@@ -126,7 +126,7 @@ LL | Err(_) => {}
126126 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
127127
128128error[E0004]: non-exhaustive patterns: `Ok(1_u32..=u32::MAX)` not covered
129 --> $DIR/empty-types.rs:95:11
129 --> $DIR/empty-types.rs:94:11
130130 |
131131LL | match res_u32_never {
132132 | ^^^^^^^^^^^^^ pattern `Ok(1_u32..=u32::MAX)` not covered
......@@ -144,7 +144,7 @@ LL ~ Ok(1_u32..=u32::MAX) => todo!()
144144 |
145145
146146error[E0005]: refutable pattern in local binding
147 --> $DIR/empty-types.rs:101:9
147 --> $DIR/empty-types.rs:100:9
148148 |
149149LL | let Ok(_x) = res_u32_never.as_ref();
150150 | ^^^^^^ pattern `Err(_)` not covered
......@@ -158,7 +158,7 @@ LL | let Ok(_x) = res_u32_never.as_ref() else { todo!() };
158158 | ++++++++++++++++
159159
160160error: unreachable pattern
161 --> $DIR/empty-types.rs:111:9
161 --> $DIR/empty-types.rs:110:9
162162 |
163163LL | _ => {}
164164 | ^------
......@@ -169,7 +169,7 @@ LL | _ => {}
169169 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
170170
171171error: unreachable pattern
172 --> $DIR/empty-types.rs:114:9
172 --> $DIR/empty-types.rs:113:9
173173 |
174174LL | Ok(_) => {}
175175 | ^^^^^------
......@@ -180,7 +180,7 @@ LL | Ok(_) => {}
180180 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
181181
182182error: unreachable pattern
183 --> $DIR/empty-types.rs:117:9
183 --> $DIR/empty-types.rs:116:9
184184 |
185185LL | Ok(_) => {}
186186 | ^^^^^------
......@@ -191,7 +191,7 @@ LL | Ok(_) => {}
191191 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
192192
193193error: unreachable pattern
194 --> $DIR/empty-types.rs:118:9
194 --> $DIR/empty-types.rs:117:9
195195 |
196196LL | _ => {}
197197 | ^------
......@@ -202,7 +202,7 @@ LL | _ => {}
202202 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
203203
204204error: unreachable pattern
205 --> $DIR/empty-types.rs:121:9
205 --> $DIR/empty-types.rs:120:9
206206 |
207207LL | Ok(_) => {}
208208 | ^^^^^------
......@@ -213,7 +213,7 @@ LL | Ok(_) => {}
213213 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
214214
215215error: unreachable pattern
216 --> $DIR/empty-types.rs:122:9
216 --> $DIR/empty-types.rs:121:9
217217 |
218218LL | Err(_) => {}
219219 | ^^^^^^------
......@@ -224,7 +224,7 @@ LL | Err(_) => {}
224224 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
225225
226226error: unreachable pattern
227 --> $DIR/empty-types.rs:131:13
227 --> $DIR/empty-types.rs:130:13
228228 |
229229LL | _ => {}
230230 | ^------
......@@ -235,7 +235,7 @@ LL | _ => {}
235235 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
236236
237237error: unreachable pattern
238 --> $DIR/empty-types.rs:134:13
238 --> $DIR/empty-types.rs:133:13
239239 |
240240LL | _ if false => {}
241241 | ^---------------
......@@ -246,7 +246,7 @@ LL | _ if false => {}
246246 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
247247
248248error: unreachable pattern
249 --> $DIR/empty-types.rs:142:13
249 --> $DIR/empty-types.rs:141:13
250250 |
251251LL | Some(_) => {}
252252 | ^^^^^^^------
......@@ -257,7 +257,7 @@ LL | Some(_) => {}
257257 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
258258
259259error: unreachable pattern
260 --> $DIR/empty-types.rs:146:13
260 --> $DIR/empty-types.rs:145:13
261261 |
262262LL | None => {}
263263 | ---- matches all the relevant values
......@@ -265,7 +265,7 @@ LL | _ => {}
265265 | ^ no value can reach this
266266
267267error: unreachable pattern
268 --> $DIR/empty-types.rs:198:13
268 --> $DIR/empty-types.rs:197:13
269269 |
270270LL | _ => {}
271271 | ^------
......@@ -276,7 +276,7 @@ LL | _ => {}
276276 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
277277
278278error: unreachable pattern
279 --> $DIR/empty-types.rs:203:13
279 --> $DIR/empty-types.rs:202:13
280280 |
281281LL | _ => {}
282282 | ^------
......@@ -287,7 +287,7 @@ LL | _ => {}
287287 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
288288
289289error: unreachable pattern
290 --> $DIR/empty-types.rs:208:13
290 --> $DIR/empty-types.rs:207:13
291291 |
292292LL | _ => {}
293293 | ^------
......@@ -298,7 +298,7 @@ LL | _ => {}
298298 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
299299
300300error: unreachable pattern
301 --> $DIR/empty-types.rs:213:13
301 --> $DIR/empty-types.rs:212:13
302302 |
303303LL | _ => {}
304304 | ^------
......@@ -309,7 +309,7 @@ LL | _ => {}
309309 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
310310
311311error: unreachable pattern
312 --> $DIR/empty-types.rs:219:13
312 --> $DIR/empty-types.rs:218:13
313313 |
314314LL | _ => {}
315315 | ^------
......@@ -320,7 +320,7 @@ LL | _ => {}
320320 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
321321
322322error: unreachable pattern
323 --> $DIR/empty-types.rs:280:9
323 --> $DIR/empty-types.rs:279:9
324324 |
325325LL | _ => {}
326326 | ^------
......@@ -331,7 +331,7 @@ LL | _ => {}
331331 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
332332
333333error: unreachable pattern
334 --> $DIR/empty-types.rs:283:9
334 --> $DIR/empty-types.rs:282:9
335335 |
336336LL | (_, _) => {}
337337 | ^^^^^^------
......@@ -342,7 +342,7 @@ LL | (_, _) => {}
342342 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
343343
344344error: unreachable pattern
345 --> $DIR/empty-types.rs:286:9
345 --> $DIR/empty-types.rs:285:9
346346 |
347347LL | Ok(_) => {}
348348 | ^^^^^------
......@@ -353,7 +353,7 @@ LL | Ok(_) => {}
353353 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
354354
355355error: unreachable pattern
356 --> $DIR/empty-types.rs:287:9
356 --> $DIR/empty-types.rs:286:9
357357 |
358358LL | Err(_) => {}
359359 | ^^^^^^------
......@@ -364,7 +364,7 @@ LL | Err(_) => {}
364364 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
365365
366366error[E0004]: non-exhaustive patterns: type `&[!]` is non-empty
367 --> $DIR/empty-types.rs:326:11
367 --> $DIR/empty-types.rs:325:11
368368 |
369369LL | match slice_never {}
370370 | ^^^^^^^^^^^
......@@ -378,7 +378,7 @@ LL ~ }
378378 |
379379
380380error[E0004]: non-exhaustive patterns: `&[]` not covered
381 --> $DIR/empty-types.rs:337:11
381 --> $DIR/empty-types.rs:336:11
382382 |
383383LL | match slice_never {
384384 | ^^^^^^^^^^^ pattern `&[]` not covered
......@@ -391,7 +391,7 @@ LL + &[] => todo!()
391391 |
392392
393393error[E0004]: non-exhaustive patterns: `&[]` not covered
394 --> $DIR/empty-types.rs:351:11
394 --> $DIR/empty-types.rs:350:11
395395 |
396396LL | match slice_never {
397397 | ^^^^^^^^^^^ pattern `&[]` not covered
......@@ -405,7 +405,7 @@ LL + &[] => todo!()
405405 |
406406
407407error[E0004]: non-exhaustive patterns: type `[!]` is non-empty
408 --> $DIR/empty-types.rs:358:11
408 --> $DIR/empty-types.rs:357:11
409409 |
410410LL | match *slice_never {}
411411 | ^^^^^^^^^^^^
......@@ -419,7 +419,7 @@ LL ~ }
419419 |
420420
421421error: unreachable pattern
422 --> $DIR/empty-types.rs:367:9
422 --> $DIR/empty-types.rs:366:9
423423 |
424424LL | _ => {}
425425 | ^------
......@@ -430,7 +430,7 @@ LL | _ => {}
430430 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
431431
432432error: unreachable pattern
433 --> $DIR/empty-types.rs:370:9
433 --> $DIR/empty-types.rs:369:9
434434 |
435435LL | [_, _, _] => {}
436436 | ^^^^^^^^^------
......@@ -441,7 +441,7 @@ LL | [_, _, _] => {}
441441 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
442442
443443error: unreachable pattern
444 --> $DIR/empty-types.rs:373:9
444 --> $DIR/empty-types.rs:372:9
445445 |
446446LL | [_, ..] => {}
447447 | ^^^^^^^------
......@@ -452,7 +452,7 @@ LL | [_, ..] => {}
452452 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
453453
454454error[E0004]: non-exhaustive patterns: type `[!; 0]` is non-empty
455 --> $DIR/empty-types.rs:387:11
455 --> $DIR/empty-types.rs:386:11
456456 |
457457LL | match array_0_never {}
458458 | ^^^^^^^^^^^^^
......@@ -466,7 +466,7 @@ LL ~ }
466466 |
467467
468468error: unreachable pattern
469 --> $DIR/empty-types.rs:394:9
469 --> $DIR/empty-types.rs:393:9
470470 |
471471LL | [] => {}
472472 | -- matches all the relevant values
......@@ -474,7 +474,7 @@ LL | _ => {}
474474 | ^ no value can reach this
475475
476476error[E0004]: non-exhaustive patterns: `[]` not covered
477 --> $DIR/empty-types.rs:396:11
477 --> $DIR/empty-types.rs:395:11
478478 |
479479LL | match array_0_never {
480480 | ^^^^^^^^^^^^^ pattern `[]` not covered
......@@ -488,7 +488,7 @@ LL + [] => todo!()
488488 |
489489
490490error: unreachable pattern
491 --> $DIR/empty-types.rs:415:9
491 --> $DIR/empty-types.rs:414:9
492492 |
493493LL | Some(_) => {}
494494 | ^^^^^^^------
......@@ -499,7 +499,7 @@ LL | Some(_) => {}
499499 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
500500
501501error: unreachable pattern
502 --> $DIR/empty-types.rs:420:9
502 --> $DIR/empty-types.rs:419:9
503503 |
504504LL | Some(_a) => {}
505505 | ^^^^^^^^------
......@@ -510,7 +510,7 @@ LL | Some(_a) => {}
510510 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
511511
512512error: unreachable pattern
513 --> $DIR/empty-types.rs:425:9
513 --> $DIR/empty-types.rs:424:9
514514 |
515515LL | None => {}
516516 | ---- matches all the relevant values
......@@ -519,7 +519,7 @@ LL | _ => {}
519519 | ^ no value can reach this
520520
521521error: unreachable pattern
522 --> $DIR/empty-types.rs:430:9
522 --> $DIR/empty-types.rs:429:9
523523 |
524524LL | None => {}
525525 | ---- matches all the relevant values
......@@ -528,7 +528,7 @@ LL | _a => {}
528528 | ^^ no value can reach this
529529
530530error: unreachable pattern
531 --> $DIR/empty-types.rs:602:9
531 --> $DIR/empty-types.rs:601:9
532532 |
533533LL | _ => {}
534534 | ^------
......@@ -539,7 +539,7 @@ LL | _ => {}
539539 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
540540
541541error: unreachable pattern
542 --> $DIR/empty-types.rs:605:9
542 --> $DIR/empty-types.rs:604:9
543543 |
544544LL | _x => {}
545545 | ^^------
......@@ -550,7 +550,7 @@ LL | _x => {}
550550 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
551551
552552error: unreachable pattern
553 --> $DIR/empty-types.rs:608:9
553 --> $DIR/empty-types.rs:607:9
554554 |
555555LL | _ if false => {}
556556 | ^---------------
......@@ -561,7 +561,7 @@ LL | _ if false => {}
561561 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
562562
563563error: unreachable pattern
564 --> $DIR/empty-types.rs:611:9
564 --> $DIR/empty-types.rs:610:9
565565 |
566566LL | _x if false => {}
567567 | ^^---------------
tests/ui/pattern/usefulness/empty-types.never_pats.stderr+44-53
......@@ -1,14 +1,5 @@
1warning: the feature `never_patterns` is incomplete and may not be safe to use and/or cause compiler crashes
2 --> $DIR/empty-types.rs:11:33
3 |
4LL | #![cfg_attr(never_pats, feature(never_patterns))]
5 | ^^^^^^^^^^^^^^
6 |
7 = note: see issue #118155 <https://github.com/rust-lang/rust/issues/118155> for more information
8 = note: `#[warn(incomplete_features)]` on by default
9
101error: unreachable pattern
11 --> $DIR/empty-types.rs:48:9
2 --> $DIR/empty-types.rs:47:9
123 |
134LL | _ => {}
145 | ^------
......@@ -18,13 +9,13 @@ LL | _ => {}
189 |
1910 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
2011note: the lint level is defined here
21 --> $DIR/empty-types.rs:14:9
12 --> $DIR/empty-types.rs:13:9
2213 |
2314LL | #![deny(unreachable_patterns)]
2415 | ^^^^^^^^^^^^^^^^^^^^
2516
2617error: unreachable pattern
27 --> $DIR/empty-types.rs:51:9
18 --> $DIR/empty-types.rs:50:9
2819 |
2920LL | _x => {}
3021 | ^^------
......@@ -35,7 +26,7 @@ LL | _x => {}
3526 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
3627
3728error[E0004]: non-exhaustive patterns: type `&!` is non-empty
38 --> $DIR/empty-types.rs:55:11
29 --> $DIR/empty-types.rs:54:11
3930 |
4031LL | match ref_never {}
4132 | ^^^^^^^^^
......@@ -50,7 +41,7 @@ LL ~ }
5041 |
5142
5243error: unreachable pattern
53 --> $DIR/empty-types.rs:82:9
44 --> $DIR/empty-types.rs:81:9
5445 |
5546LL | _ => {}
5647 | ^------
......@@ -61,7 +52,7 @@ LL | _ => {}
6152 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
6253
6354error[E0004]: non-exhaustive patterns: `Ok(_)` not covered
64 --> $DIR/empty-types.rs:86:11
55 --> $DIR/empty-types.rs:85:11
6556 |
6657LL | match res_u32_never {}
6758 | ^^^^^^^^^^^^^ pattern `Ok(_)` not covered
......@@ -80,7 +71,7 @@ LL ~ }
8071 |
8172
8273error[E0004]: non-exhaustive patterns: `Ok(1_u32..=u32::MAX)` not covered
83 --> $DIR/empty-types.rs:95:11
74 --> $DIR/empty-types.rs:94:11
8475 |
8576LL | match res_u32_never {
8677 | ^^^^^^^^^^^^^ pattern `Ok(1_u32..=u32::MAX)` not covered
......@@ -98,7 +89,7 @@ LL ~ Ok(1_u32..=u32::MAX) => todo!()
9889 |
9990
10091error[E0005]: refutable pattern in local binding
101 --> $DIR/empty-types.rs:101:9
92 --> $DIR/empty-types.rs:100:9
10293 |
10394LL | let Ok(_x) = res_u32_never.as_ref();
10495 | ^^^^^^ pattern `Err(_)` not covered
......@@ -112,7 +103,7 @@ LL | let Ok(_x) = res_u32_never.as_ref() else { todo!() };
112103 | ++++++++++++++++
113104
114105error[E0005]: refutable pattern in local binding
115 --> $DIR/empty-types.rs:105:9
106 --> $DIR/empty-types.rs:104:9
116107 |
117108LL | let Ok(_x) = &res_u32_never;
118109 | ^^^^^^ pattern `&Err(!)` not covered
......@@ -126,7 +117,7 @@ LL | let Ok(_x) = &res_u32_never else { todo!() };
126117 | ++++++++++++++++
127118
128119error: unreachable pattern
129 --> $DIR/empty-types.rs:131:13
120 --> $DIR/empty-types.rs:130:13
130121 |
131122LL | _ => {}
132123 | ^------
......@@ -137,7 +128,7 @@ LL | _ => {}
137128 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
138129
139130error: unreachable pattern
140 --> $DIR/empty-types.rs:134:13
131 --> $DIR/empty-types.rs:133:13
141132 |
142133LL | _ if false => {}
143134 | ^---------------
......@@ -148,7 +139,7 @@ LL | _ if false => {}
148139 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
149140
150141error[E0004]: non-exhaustive patterns: `Some(!)` not covered
151 --> $DIR/empty-types.rs:155:15
142 --> $DIR/empty-types.rs:154:15
152143 |
153144LL | match *ref_opt_void {
154145 | ^^^^^^^^^^^^^ pattern `Some(!)` not covered
......@@ -167,7 +158,7 @@ LL + Some(!)
167158 |
168159
169160error: unreachable pattern
170 --> $DIR/empty-types.rs:198:13
161 --> $DIR/empty-types.rs:197:13
171162 |
172163LL | _ => {}
173164 | ^------
......@@ -178,7 +169,7 @@ LL | _ => {}
178169 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
179170
180171error: unreachable pattern
181 --> $DIR/empty-types.rs:203:13
172 --> $DIR/empty-types.rs:202:13
182173 |
183174LL | _ => {}
184175 | ^------
......@@ -189,7 +180,7 @@ LL | _ => {}
189180 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
190181
191182error: unreachable pattern
192 --> $DIR/empty-types.rs:208:13
183 --> $DIR/empty-types.rs:207:13
193184 |
194185LL | _ => {}
195186 | ^------
......@@ -200,7 +191,7 @@ LL | _ => {}
200191 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
201192
202193error: unreachable pattern
203 --> $DIR/empty-types.rs:213:13
194 --> $DIR/empty-types.rs:212:13
204195 |
205196LL | _ => {}
206197 | ^------
......@@ -211,7 +202,7 @@ LL | _ => {}
211202 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
212203
213204error: unreachable pattern
214 --> $DIR/empty-types.rs:219:13
205 --> $DIR/empty-types.rs:218:13
215206 |
216207LL | _ => {}
217208 | ^------
......@@ -222,7 +213,7 @@ LL | _ => {}
222213 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
223214
224215error: unreachable pattern
225 --> $DIR/empty-types.rs:280:9
216 --> $DIR/empty-types.rs:279:9
226217 |
227218LL | _ => {}
228219 | ^------
......@@ -233,7 +224,7 @@ LL | _ => {}
233224 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
234225
235226error[E0005]: refutable pattern in local binding
236 --> $DIR/empty-types.rs:296:13
227 --> $DIR/empty-types.rs:295:13
237228 |
238229LL | let Ok(_) = *ptr_result_never_err;
239230 | ^^^^^ pattern `Err(!)` not covered
......@@ -247,7 +238,7 @@ LL | if let Ok(_) = *ptr_result_never_err { todo!() };
247238 | ++ +++++++++++
248239
249240error[E0004]: non-exhaustive patterns: type `(u32, !)` is non-empty
250 --> $DIR/empty-types.rs:315:11
241 --> $DIR/empty-types.rs:314:11
251242 |
252243LL | match *x {}
253244 | ^^
......@@ -261,7 +252,7 @@ LL ~ }
261252 |
262253
263254error[E0004]: non-exhaustive patterns: type `(!, !)` is non-empty
264 --> $DIR/empty-types.rs:317:11
255 --> $DIR/empty-types.rs:316:11
265256 |
266257LL | match *x {}
267258 | ^^
......@@ -275,7 +266,7 @@ LL ~ }
275266 |
276267
277268error[E0004]: non-exhaustive patterns: `Ok(!)` and `Err(!)` not covered
278 --> $DIR/empty-types.rs:319:11
269 --> $DIR/empty-types.rs:318:11
279270 |
280271LL | match *x {}
281272 | ^^ patterns `Ok(!)` and `Err(!)` not covered
......@@ -297,7 +288,7 @@ LL ~ }
297288 |
298289
299290error[E0004]: non-exhaustive patterns: type `[!; 3]` is non-empty
300 --> $DIR/empty-types.rs:321:11
291 --> $DIR/empty-types.rs:320:11
301292 |
302293LL | match *x {}
303294 | ^^
......@@ -311,7 +302,7 @@ LL ~ }
311302 |
312303
313304error[E0004]: non-exhaustive patterns: type `&[!]` is non-empty
314 --> $DIR/empty-types.rs:326:11
305 --> $DIR/empty-types.rs:325:11
315306 |
316307LL | match slice_never {}
317308 | ^^^^^^^^^^^
......@@ -325,7 +316,7 @@ LL ~ }
325316 |
326317
327318error[E0004]: non-exhaustive patterns: `&[!, ..]` not covered
328 --> $DIR/empty-types.rs:328:11
319 --> $DIR/empty-types.rs:327:11
329320 |
330321LL | match slice_never {
331322 | ^^^^^^^^^^^ pattern `&[!, ..]` not covered
......@@ -339,7 +330,7 @@ LL + &[!, ..]
339330 |
340331
341332error[E0004]: non-exhaustive patterns: `&[]`, `&[!]` and `&[!, !]` not covered
342 --> $DIR/empty-types.rs:337:11
333 --> $DIR/empty-types.rs:336:11
343334 |
344335LL | match slice_never {
345336 | ^^^^^^^^^^^ patterns `&[]`, `&[!]` and `&[!, !]` not covered
......@@ -352,7 +343,7 @@ LL + &[] | &[!] | &[!, !] => todo!()
352343 |
353344
354345error[E0004]: non-exhaustive patterns: `&[]` and `&[!, ..]` not covered
355 --> $DIR/empty-types.rs:351:11
346 --> $DIR/empty-types.rs:350:11
356347 |
357348LL | match slice_never {
358349 | ^^^^^^^^^^^ patterns `&[]` and `&[!, ..]` not covered
......@@ -366,7 +357,7 @@ LL + &[] | &[!, ..] => todo!()
366357 |
367358
368359error[E0004]: non-exhaustive patterns: type `[!]` is non-empty
369 --> $DIR/empty-types.rs:358:11
360 --> $DIR/empty-types.rs:357:11
370361 |
371362LL | match *slice_never {}
372363 | ^^^^^^^^^^^^
......@@ -380,7 +371,7 @@ LL ~ }
380371 |
381372
382373error[E0004]: non-exhaustive patterns: type `[!; 0]` is non-empty
383 --> $DIR/empty-types.rs:387:11
374 --> $DIR/empty-types.rs:386:11
384375 |
385376LL | match array_0_never {}
386377 | ^^^^^^^^^^^^^
......@@ -394,7 +385,7 @@ LL ~ }
394385 |
395386
396387error: unreachable pattern
397 --> $DIR/empty-types.rs:394:9
388 --> $DIR/empty-types.rs:393:9
398389 |
399390LL | [] => {}
400391 | -- matches all the relevant values
......@@ -402,7 +393,7 @@ LL | _ => {}
402393 | ^ no value can reach this
403394
404395error[E0004]: non-exhaustive patterns: `[]` not covered
405 --> $DIR/empty-types.rs:396:11
396 --> $DIR/empty-types.rs:395:11
406397 |
407398LL | match array_0_never {
408399 | ^^^^^^^^^^^^^ pattern `[]` not covered
......@@ -416,7 +407,7 @@ LL + [] => todo!()
416407 |
417408
418409error[E0004]: non-exhaustive patterns: `&Some(!)` not covered
419 --> $DIR/empty-types.rs:450:11
410 --> $DIR/empty-types.rs:449:11
420411 |
421412LL | match ref_opt_never {
422413 | ^^^^^^^^^^^^^ pattern `&Some(!)` not covered
......@@ -435,7 +426,7 @@ LL + &Some(!)
435426 |
436427
437428error[E0004]: non-exhaustive patterns: `Some(!)` not covered
438 --> $DIR/empty-types.rs:491:11
429 --> $DIR/empty-types.rs:490:11
439430 |
440431LL | match *ref_opt_never {
441432 | ^^^^^^^^^^^^^^ pattern `Some(!)` not covered
......@@ -454,7 +445,7 @@ LL + Some(!)
454445 |
455446
456447error[E0004]: non-exhaustive patterns: `Err(!)` not covered
457 --> $DIR/empty-types.rs:539:11
448 --> $DIR/empty-types.rs:538:11
458449 |
459450LL | match *ref_res_never {
460451 | ^^^^^^^^^^^^^^ pattern `Err(!)` not covered
......@@ -473,7 +464,7 @@ LL + Err(!)
473464 |
474465
475466error[E0004]: non-exhaustive patterns: `Err(!)` not covered
476 --> $DIR/empty-types.rs:550:11
467 --> $DIR/empty-types.rs:549:11
477468 |
478469LL | match *ref_res_never {
479470 | ^^^^^^^^^^^^^^ pattern `Err(!)` not covered
......@@ -492,7 +483,7 @@ LL + Err(!)
492483 |
493484
494485error[E0004]: non-exhaustive patterns: type `(u32, !)` is non-empty
495 --> $DIR/empty-types.rs:569:11
486 --> $DIR/empty-types.rs:568:11
496487 |
497488LL | match *ref_tuple_half_never {}
498489 | ^^^^^^^^^^^^^^^^^^^^^
......@@ -506,7 +497,7 @@ LL ~ }
506497 |
507498
508499error: unreachable pattern
509 --> $DIR/empty-types.rs:602:9
500 --> $DIR/empty-types.rs:601:9
510501 |
511502LL | _ => {}
512503 | ^------
......@@ -517,7 +508,7 @@ LL | _ => {}
517508 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
518509
519510error: unreachable pattern
520 --> $DIR/empty-types.rs:605:9
511 --> $DIR/empty-types.rs:604:9
521512 |
522513LL | _x => {}
523514 | ^^------
......@@ -528,7 +519,7 @@ LL | _x => {}
528519 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
529520
530521error: unreachable pattern
531 --> $DIR/empty-types.rs:608:9
522 --> $DIR/empty-types.rs:607:9
532523 |
533524LL | _ if false => {}
534525 | ^---------------
......@@ -539,7 +530,7 @@ LL | _ if false => {}
539530 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
540531
541532error: unreachable pattern
542 --> $DIR/empty-types.rs:611:9
533 --> $DIR/empty-types.rs:610:9
543534 |
544535LL | _x if false => {}
545536 | ^^---------------
......@@ -550,7 +541,7 @@ LL | _x if false => {}
550541 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
551542
552543error[E0004]: non-exhaustive patterns: `&!` not covered
553 --> $DIR/empty-types.rs:636:11
544 --> $DIR/empty-types.rs:635:11
554545 |
555546LL | match ref_never {
556547 | ^^^^^^^^^ pattern `&!` not covered
......@@ -566,7 +557,7 @@ LL + &!
566557 |
567558
568559error[E0004]: non-exhaustive patterns: `Ok(!)` not covered
569 --> $DIR/empty-types.rs:652:11
560 --> $DIR/empty-types.rs:651:11
570561 |
571562LL | match *ref_result_never {
572563 | ^^^^^^^^^^^^^^^^^ pattern `Ok(!)` not covered
......@@ -585,7 +576,7 @@ LL + Ok(!)
585576 |
586577
587578error[E0004]: non-exhaustive patterns: `Some(!)` not covered
588 --> $DIR/empty-types.rs:672:11
579 --> $DIR/empty-types.rs:671:11
589580 |
590581LL | match *x {
591582 | ^^ pattern `Some(!)` not covered
......@@ -603,7 +594,7 @@ LL ~ None => {},
603594LL + Some(!)
604595 |
605596
606error: aborting due to 42 previous errors; 1 warning emitted
597error: aborting due to 42 previous errors
607598
608599Some errors have detailed explanations: E0004, E0005.
609600For more information about an error, try `rustc --explain E0004`.
tests/ui/pattern/usefulness/empty-types.normal.stderr+43-43
......@@ -1,5 +1,5 @@
11error: unreachable pattern
2 --> $DIR/empty-types.rs:48:9
2 --> $DIR/empty-types.rs:47:9
33 |
44LL | _ => {}
55 | ^------
......@@ -9,13 +9,13 @@ LL | _ => {}
99 |
1010 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
1111note: the lint level is defined here
12 --> $DIR/empty-types.rs:14:9
12 --> $DIR/empty-types.rs:13:9
1313 |
1414LL | #![deny(unreachable_patterns)]
1515 | ^^^^^^^^^^^^^^^^^^^^
1616
1717error: unreachable pattern
18 --> $DIR/empty-types.rs:51:9
18 --> $DIR/empty-types.rs:50:9
1919 |
2020LL | _x => {}
2121 | ^^------
......@@ -26,7 +26,7 @@ LL | _x => {}
2626 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
2727
2828error[E0004]: non-exhaustive patterns: type `&!` is non-empty
29 --> $DIR/empty-types.rs:55:11
29 --> $DIR/empty-types.rs:54:11
3030 |
3131LL | match ref_never {}
3232 | ^^^^^^^^^
......@@ -41,7 +41,7 @@ LL ~ }
4141 |
4242
4343error: unreachable pattern
44 --> $DIR/empty-types.rs:82:9
44 --> $DIR/empty-types.rs:81:9
4545 |
4646LL | _ => {}
4747 | ^------
......@@ -52,7 +52,7 @@ LL | _ => {}
5252 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
5353
5454error[E0004]: non-exhaustive patterns: `Ok(_)` not covered
55 --> $DIR/empty-types.rs:86:11
55 --> $DIR/empty-types.rs:85:11
5656 |
5757LL | match res_u32_never {}
5858 | ^^^^^^^^^^^^^ pattern `Ok(_)` not covered
......@@ -71,7 +71,7 @@ LL ~ }
7171 |
7272
7373error[E0004]: non-exhaustive patterns: `Ok(1_u32..=u32::MAX)` not covered
74 --> $DIR/empty-types.rs:95:11
74 --> $DIR/empty-types.rs:94:11
7575 |
7676LL | match res_u32_never {
7777 | ^^^^^^^^^^^^^ pattern `Ok(1_u32..=u32::MAX)` not covered
......@@ -89,7 +89,7 @@ LL ~ Ok(1_u32..=u32::MAX) => todo!()
8989 |
9090
9191error[E0005]: refutable pattern in local binding
92 --> $DIR/empty-types.rs:101:9
92 --> $DIR/empty-types.rs:100:9
9393 |
9494LL | let Ok(_x) = res_u32_never.as_ref();
9595 | ^^^^^^ pattern `Err(_)` not covered
......@@ -103,7 +103,7 @@ LL | let Ok(_x) = res_u32_never.as_ref() else { todo!() };
103103 | ++++++++++++++++
104104
105105error[E0005]: refutable pattern in local binding
106 --> $DIR/empty-types.rs:105:9
106 --> $DIR/empty-types.rs:104:9
107107 |
108108LL | let Ok(_x) = &res_u32_never;
109109 | ^^^^^^ pattern `&Err(_)` not covered
......@@ -117,7 +117,7 @@ LL | let Ok(_x) = &res_u32_never else { todo!() };
117117 | ++++++++++++++++
118118
119119error: unreachable pattern
120 --> $DIR/empty-types.rs:131:13
120 --> $DIR/empty-types.rs:130:13
121121 |
122122LL | _ => {}
123123 | ^------
......@@ -128,7 +128,7 @@ LL | _ => {}
128128 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
129129
130130error: unreachable pattern
131 --> $DIR/empty-types.rs:134:13
131 --> $DIR/empty-types.rs:133:13
132132 |
133133LL | _ if false => {}
134134 | ^---------------
......@@ -139,7 +139,7 @@ LL | _ if false => {}
139139 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
140140
141141error[E0004]: non-exhaustive patterns: `Some(_)` not covered
142 --> $DIR/empty-types.rs:155:15
142 --> $DIR/empty-types.rs:154:15
143143 |
144144LL | match *ref_opt_void {
145145 | ^^^^^^^^^^^^^ pattern `Some(_)` not covered
......@@ -158,7 +158,7 @@ LL + Some(_) => todo!()
158158 |
159159
160160error: unreachable pattern
161 --> $DIR/empty-types.rs:198:13
161 --> $DIR/empty-types.rs:197:13
162162 |
163163LL | _ => {}
164164 | ^------
......@@ -169,7 +169,7 @@ LL | _ => {}
169169 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
170170
171171error: unreachable pattern
172 --> $DIR/empty-types.rs:203:13
172 --> $DIR/empty-types.rs:202:13
173173 |
174174LL | _ => {}
175175 | ^------
......@@ -180,7 +180,7 @@ LL | _ => {}
180180 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
181181
182182error: unreachable pattern
183 --> $DIR/empty-types.rs:208:13
183 --> $DIR/empty-types.rs:207:13
184184 |
185185LL | _ => {}
186186 | ^------
......@@ -191,7 +191,7 @@ LL | _ => {}
191191 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
192192
193193error: unreachable pattern
194 --> $DIR/empty-types.rs:213:13
194 --> $DIR/empty-types.rs:212:13
195195 |
196196LL | _ => {}
197197 | ^------
......@@ -202,7 +202,7 @@ LL | _ => {}
202202 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
203203
204204error: unreachable pattern
205 --> $DIR/empty-types.rs:219:13
205 --> $DIR/empty-types.rs:218:13
206206 |
207207LL | _ => {}
208208 | ^------
......@@ -213,7 +213,7 @@ LL | _ => {}
213213 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
214214
215215error: unreachable pattern
216 --> $DIR/empty-types.rs:280:9
216 --> $DIR/empty-types.rs:279:9
217217 |
218218LL | _ => {}
219219 | ^------
......@@ -224,7 +224,7 @@ LL | _ => {}
224224 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
225225
226226error[E0005]: refutable pattern in local binding
227 --> $DIR/empty-types.rs:296:13
227 --> $DIR/empty-types.rs:295:13
228228 |
229229LL | let Ok(_) = *ptr_result_never_err;
230230 | ^^^^^ pattern `Err(_)` not covered
......@@ -238,7 +238,7 @@ LL | if let Ok(_) = *ptr_result_never_err { todo!() };
238238 | ++ +++++++++++
239239
240240error[E0004]: non-exhaustive patterns: type `(u32, !)` is non-empty
241 --> $DIR/empty-types.rs:315:11
241 --> $DIR/empty-types.rs:314:11
242242 |
243243LL | match *x {}
244244 | ^^
......@@ -252,7 +252,7 @@ LL ~ }
252252 |
253253
254254error[E0004]: non-exhaustive patterns: type `(!, !)` is non-empty
255 --> $DIR/empty-types.rs:317:11
255 --> $DIR/empty-types.rs:316:11
256256 |
257257LL | match *x {}
258258 | ^^
......@@ -266,7 +266,7 @@ LL ~ }
266266 |
267267
268268error[E0004]: non-exhaustive patterns: `Ok(_)` and `Err(_)` not covered
269 --> $DIR/empty-types.rs:319:11
269 --> $DIR/empty-types.rs:318:11
270270 |
271271LL | match *x {}
272272 | ^^ patterns `Ok(_)` and `Err(_)` not covered
......@@ -288,7 +288,7 @@ LL ~ }
288288 |
289289
290290error[E0004]: non-exhaustive patterns: type `[!; 3]` is non-empty
291 --> $DIR/empty-types.rs:321:11
291 --> $DIR/empty-types.rs:320:11
292292 |
293293LL | match *x {}
294294 | ^^
......@@ -302,7 +302,7 @@ LL ~ }
302302 |
303303
304304error[E0004]: non-exhaustive patterns: type `&[!]` is non-empty
305 --> $DIR/empty-types.rs:326:11
305 --> $DIR/empty-types.rs:325:11
306306 |
307307LL | match slice_never {}
308308 | ^^^^^^^^^^^
......@@ -316,7 +316,7 @@ LL ~ }
316316 |
317317
318318error[E0004]: non-exhaustive patterns: `&[_, ..]` not covered
319 --> $DIR/empty-types.rs:328:11
319 --> $DIR/empty-types.rs:327:11
320320 |
321321LL | match slice_never {
322322 | ^^^^^^^^^^^ pattern `&[_, ..]` not covered
......@@ -330,7 +330,7 @@ LL + &[_, ..] => todo!()
330330 |
331331
332332error[E0004]: non-exhaustive patterns: `&[]`, `&[_]` and `&[_, _]` not covered
333 --> $DIR/empty-types.rs:337:11
333 --> $DIR/empty-types.rs:336:11
334334 |
335335LL | match slice_never {
336336 | ^^^^^^^^^^^ patterns `&[]`, `&[_]` and `&[_, _]` not covered
......@@ -343,7 +343,7 @@ LL + &[] | &[_] | &[_, _] => todo!()
343343 |
344344
345345error[E0004]: non-exhaustive patterns: `&[]` and `&[_, ..]` not covered
346 --> $DIR/empty-types.rs:351:11
346 --> $DIR/empty-types.rs:350:11
347347 |
348348LL | match slice_never {
349349 | ^^^^^^^^^^^ patterns `&[]` and `&[_, ..]` not covered
......@@ -357,7 +357,7 @@ LL + &[] | &[_, ..] => todo!()
357357 |
358358
359359error[E0004]: non-exhaustive patterns: type `[!]` is non-empty
360 --> $DIR/empty-types.rs:358:11
360 --> $DIR/empty-types.rs:357:11
361361 |
362362LL | match *slice_never {}
363363 | ^^^^^^^^^^^^
......@@ -371,7 +371,7 @@ LL ~ }
371371 |
372372
373373error[E0004]: non-exhaustive patterns: type `[!; 0]` is non-empty
374 --> $DIR/empty-types.rs:387:11
374 --> $DIR/empty-types.rs:386:11
375375 |
376376LL | match array_0_never {}
377377 | ^^^^^^^^^^^^^
......@@ -385,7 +385,7 @@ LL ~ }
385385 |
386386
387387error: unreachable pattern
388 --> $DIR/empty-types.rs:394:9
388 --> $DIR/empty-types.rs:393:9
389389 |
390390LL | [] => {}
391391 | -- matches all the relevant values
......@@ -393,7 +393,7 @@ LL | _ => {}
393393 | ^ no value can reach this
394394
395395error[E0004]: non-exhaustive patterns: `[]` not covered
396 --> $DIR/empty-types.rs:396:11
396 --> $DIR/empty-types.rs:395:11
397397 |
398398LL | match array_0_never {
399399 | ^^^^^^^^^^^^^ pattern `[]` not covered
......@@ -407,7 +407,7 @@ LL + [] => todo!()
407407 |
408408
409409error[E0004]: non-exhaustive patterns: `&Some(_)` not covered
410 --> $DIR/empty-types.rs:450:11
410 --> $DIR/empty-types.rs:449:11
411411 |
412412LL | match ref_opt_never {
413413 | ^^^^^^^^^^^^^ pattern `&Some(_)` not covered
......@@ -426,7 +426,7 @@ LL + &Some(_) => todo!()
426426 |
427427
428428error[E0004]: non-exhaustive patterns: `Some(_)` not covered
429 --> $DIR/empty-types.rs:491:11
429 --> $DIR/empty-types.rs:490:11
430430 |
431431LL | match *ref_opt_never {
432432 | ^^^^^^^^^^^^^^ pattern `Some(_)` not covered
......@@ -445,7 +445,7 @@ LL + Some(_) => todo!()
445445 |
446446
447447error[E0004]: non-exhaustive patterns: `Err(_)` not covered
448 --> $DIR/empty-types.rs:539:11
448 --> $DIR/empty-types.rs:538:11
449449 |
450450LL | match *ref_res_never {
451451 | ^^^^^^^^^^^^^^ pattern `Err(_)` not covered
......@@ -464,7 +464,7 @@ LL + Err(_) => todo!()
464464 |
465465
466466error[E0004]: non-exhaustive patterns: `Err(_)` not covered
467 --> $DIR/empty-types.rs:550:11
467 --> $DIR/empty-types.rs:549:11
468468 |
469469LL | match *ref_res_never {
470470 | ^^^^^^^^^^^^^^ pattern `Err(_)` not covered
......@@ -483,7 +483,7 @@ LL + Err(_) => todo!()
483483 |
484484
485485error[E0004]: non-exhaustive patterns: type `(u32, !)` is non-empty
486 --> $DIR/empty-types.rs:569:11
486 --> $DIR/empty-types.rs:568:11
487487 |
488488LL | match *ref_tuple_half_never {}
489489 | ^^^^^^^^^^^^^^^^^^^^^
......@@ -497,7 +497,7 @@ LL ~ }
497497 |
498498
499499error: unreachable pattern
500 --> $DIR/empty-types.rs:602:9
500 --> $DIR/empty-types.rs:601:9
501501 |
502502LL | _ => {}
503503 | ^------
......@@ -508,7 +508,7 @@ LL | _ => {}
508508 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
509509
510510error: unreachable pattern
511 --> $DIR/empty-types.rs:605:9
511 --> $DIR/empty-types.rs:604:9
512512 |
513513LL | _x => {}
514514 | ^^------
......@@ -519,7 +519,7 @@ LL | _x => {}
519519 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
520520
521521error: unreachable pattern
522 --> $DIR/empty-types.rs:608:9
522 --> $DIR/empty-types.rs:607:9
523523 |
524524LL | _ if false => {}
525525 | ^---------------
......@@ -530,7 +530,7 @@ LL | _ if false => {}
530530 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
531531
532532error: unreachable pattern
533 --> $DIR/empty-types.rs:611:9
533 --> $DIR/empty-types.rs:610:9
534534 |
535535LL | _x if false => {}
536536 | ^^---------------
......@@ -541,7 +541,7 @@ LL | _x if false => {}
541541 = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
542542
543543error[E0004]: non-exhaustive patterns: `&_` not covered
544 --> $DIR/empty-types.rs:636:11
544 --> $DIR/empty-types.rs:635:11
545545 |
546546LL | match ref_never {
547547 | ^^^^^^^^^ pattern `&_` not covered
......@@ -557,7 +557,7 @@ LL + &_ => todo!()
557557 |
558558
559559error[E0004]: non-exhaustive patterns: `Ok(_)` not covered
560 --> $DIR/empty-types.rs:652:11
560 --> $DIR/empty-types.rs:651:11
561561 |
562562LL | match *ref_result_never {
563563 | ^^^^^^^^^^^^^^^^^ pattern `Ok(_)` not covered
......@@ -576,7 +576,7 @@ LL + Ok(_) => todo!()
576576 |
577577
578578error[E0004]: non-exhaustive patterns: `Some(_)` not covered
579 --> $DIR/empty-types.rs:672:11
579 --> $DIR/empty-types.rs:671:11
580580 |
581581LL | match *x {
582582 | ^^ pattern `Some(_)` not covered
tests/ui/pattern/usefulness/empty-types.rs-1
......@@ -9,7 +9,6 @@
99#![feature(never_type)]
1010#![cfg_attr(exhaustive_patterns, feature(exhaustive_patterns))]
1111#![cfg_attr(never_pats, feature(never_patterns))]
12//[never_pats]~^ WARN the feature `never_patterns` is incomplete
1312#![allow(dead_code, unreachable_code)]
1413#![deny(unreachable_patterns)]
1514
tests/ui/pin-ergonomics/coerce-non-pointer-pin.rs-1
......@@ -1,7 +1,6 @@
11//@ check-pass
22
33#![feature(pin_ergonomics)]
4//~^ WARN the feature `pin_ergonomics` is incomplete
54
65use std::pin::Pin;
76
tests/ui/pin-ergonomics/coerce-non-pointer-pin.stderr deleted-11
......@@ -1,11 +0,0 @@
1warning: the feature `pin_ergonomics` is incomplete and may not be safe to use and/or cause compiler crashes
2 --> $DIR/coerce-non-pointer-pin.rs:3:12
3 |
4LL | #![feature(pin_ergonomics)]
5 | ^^^^^^^^^^^^^^
6 |
7 = note: see issue #130494 <https://github.com/rust-lang/rust/issues/130494> for more information
8 = note: `#[warn(incomplete_features)]` on by default
9
10warning: 1 warning emitted
11
tests/ui/privacy/private-in-public-warn.rs+6-6
......@@ -49,10 +49,10 @@ mod traits {
4949 fn f<T: PrivTr>(arg: T) {}
5050 //~^ ERROR trait `traits::PrivTr` is more private than the item `traits::Tr3::f`
5151 fn g() -> impl PrivTr;
52 //~^ ERROR trait `traits::PrivTr` is more private than the item `traits::Tr3::g::{anon_assoc#0}`
52 //~^ ERROR private trait `traits::PrivTr` in public interface
5353 //~| ERROR trait `traits::PrivTr` is more private than the item `traits::Tr3::g::{anon_assoc#0}`
5454 fn h() -> impl PrivTr {}
55 //~^ ERROR trait `traits::PrivTr` is more private than the item `traits::Tr3::h::{anon_assoc#0}`
55 //~^ ERROR private trait `traits::PrivTr` in public interface
5656 //~| ERROR trait `traits::PrivTr` is more private than the item `traits::Tr3::h::{anon_assoc#0}`
5757 }
5858 impl<T: PrivTr> Pub<T> {} //~ ERROR trait `traits::PrivTr` is more private than the item `traits::Pub<T>`
......@@ -93,13 +93,13 @@ mod generics {
9393
9494 pub trait Tr5 {
9595 fn required() -> impl PrivTr<Priv<()>>;
96 //~^ ERROR trait `generics::PrivTr<generics::Priv<()>>` is more private than the item `Tr5::required::{anon_assoc#0}`
97 //~| ERROR type `generics::Priv<()>` is more private than the item `Tr5::required::{anon_assoc#0}`
96 //~^ ERROR private trait `generics::PrivTr<generics::Priv<()>>` in public interface
97 //~| ERROR private type `generics::Priv<()>` in public interface
9898 //~| ERROR trait `generics::PrivTr<generics::Priv<()>>` is more private than the item `Tr5::required::{anon_assoc#0}`
9999 //~| ERROR type `generics::Priv<()>` is more private than the item `Tr5::required::{anon_assoc#0}`
100100 fn provided() -> impl PrivTr<Priv<()>> {}
101 //~^ ERROR trait `generics::PrivTr<generics::Priv<()>>` is more private than the item `Tr5::provided::{anon_assoc#0}`
102 //~| ERROR type `generics::Priv<()>` is more private than the item `Tr5::provided::{anon_assoc#0}`
101 //~^ ERROR private trait `generics::PrivTr<generics::Priv<()>>` in public interface
102 //~| ERROR private type `generics::Priv<()>` in public interface
103103 //~| ERROR trait `generics::PrivTr<generics::Priv<()>>` is more private than the item `Tr5::provided::{anon_assoc#0}`
104104 //~| ERROR type `generics::Priv<()>` is more private than the item `Tr5::provided::{anon_assoc#0}`
105105 }
tests/ui/privacy/private-in-public-warn.stderr+30-48
......@@ -194,17 +194,14 @@ note: but trait `traits::PrivTr` is only usable at visibility `pub(self)`
194194LL | trait PrivTr {}
195195 | ^^^^^^^^^^^^
196196
197error: trait `traits::PrivTr` is more private than the item `traits::Tr3::g::{anon_assoc#0}`
197error[E0446]: private trait `traits::PrivTr` in public interface
198198 --> $DIR/private-in-public-warn.rs:51:19
199199 |
200LL | fn g() -> impl PrivTr;
201 | ^^^^^^^^^^^ opaque type `traits::Tr3::g::{anon_assoc#0}` is reachable at visibility `pub(crate)`
202 |
203note: but trait `traits::PrivTr` is only usable at visibility `pub(self)`
204 --> $DIR/private-in-public-warn.rs:37:5
205 |
206200LL | trait PrivTr {}
207 | ^^^^^^^^^^^^
201 | ------------ `traits::PrivTr` declared as private
202...
203LL | fn g() -> impl PrivTr;
204 | ^^^^^^^^^^^ can't leak private trait
208205
209206error: trait `traits::PrivTr` is more private than the item `traits::Tr3::g::{anon_assoc#0}`
210207 --> $DIR/private-in-public-warn.rs:51:19
......@@ -218,17 +215,14 @@ note: but trait `traits::PrivTr` is only usable at visibility `pub(self)`
218215LL | trait PrivTr {}
219216 | ^^^^^^^^^^^^
220217
221error: trait `traits::PrivTr` is more private than the item `traits::Tr3::h::{anon_assoc#0}`
218error[E0446]: private trait `traits::PrivTr` in public interface
222219 --> $DIR/private-in-public-warn.rs:54:19
223220 |
224LL | fn h() -> impl PrivTr {}
225 | ^^^^^^^^^^^ opaque type `traits::Tr3::h::{anon_assoc#0}` is reachable at visibility `pub(crate)`
226 |
227note: but trait `traits::PrivTr` is only usable at visibility `pub(self)`
228 --> $DIR/private-in-public-warn.rs:37:5
229 |
230221LL | trait PrivTr {}
231 | ^^^^^^^^^^^^
222 | ------------ `traits::PrivTr` declared as private
223...
224LL | fn h() -> impl PrivTr {}
225 | ^^^^^^^^^^^ can't leak private trait
232226
233227error: trait `traits::PrivTr` is more private than the item `traits::Tr3::h::{anon_assoc#0}`
234228 --> $DIR/private-in-public-warn.rs:54:19
......@@ -350,29 +344,23 @@ note: but type `generics::Priv` is only usable at visibility `pub(self)`
350344LL | struct Priv<T = u8>(T);
351345 | ^^^^^^^^^^^^^^^^^^^
352346
353error: trait `generics::PrivTr<generics::Priv<()>>` is more private than the item `Tr5::required::{anon_assoc#0}`
347error[E0446]: private trait `generics::PrivTr<generics::Priv<()>>` in public interface
354348 --> $DIR/private-in-public-warn.rs:95:26
355349 |
356LL | fn required() -> impl PrivTr<Priv<()>>;
357 | ^^^^^^^^^^^^^^^^^^^^^ opaque type `Tr5::required::{anon_assoc#0}` is reachable at visibility `pub(crate)`
358 |
359note: but trait `generics::PrivTr<generics::Priv<()>>` is only usable at visibility `pub(self)`
360 --> $DIR/private-in-public-warn.rs:84:5
361 |
362350LL | trait PrivTr<T> {}
363 | ^^^^^^^^^^^^^^^
351 | --------------- `generics::PrivTr<generics::Priv<()>>` declared as private
352...
353LL | fn required() -> impl PrivTr<Priv<()>>;
354 | ^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
364355
365error: type `generics::Priv<()>` is more private than the item `Tr5::required::{anon_assoc#0}`
356error[E0446]: private type `generics::Priv<()>` in public interface
366357 --> $DIR/private-in-public-warn.rs:95:26
367358 |
368LL | fn required() -> impl PrivTr<Priv<()>>;
369 | ^^^^^^^^^^^^^^^^^^^^^ opaque type `Tr5::required::{anon_assoc#0}` is reachable at visibility `pub(crate)`
370 |
371note: but type `generics::Priv<()>` is only usable at visibility `pub(self)`
372 --> $DIR/private-in-public-warn.rs:82:5
373 |
374359LL | struct Priv<T = u8>(T);
375 | ^^^^^^^^^^^^^^^^^^^
360 | ------------------- `generics::Priv<()>` declared as private
361...
362LL | fn required() -> impl PrivTr<Priv<()>>;
363 | ^^^^^^^^^^^^^^^^^^^^^ can't leak private type
376364
377365error: trait `generics::PrivTr<generics::Priv<()>>` is more private than the item `Tr5::required::{anon_assoc#0}`
378366 --> $DIR/private-in-public-warn.rs:95:26
......@@ -398,29 +386,23 @@ note: but type `generics::Priv<()>` is only usable at visibility `pub(self)`
398386LL | struct Priv<T = u8>(T);
399387 | ^^^^^^^^^^^^^^^^^^^
400388
401error: trait `generics::PrivTr<generics::Priv<()>>` is more private than the item `Tr5::provided::{anon_assoc#0}`
389error[E0446]: private trait `generics::PrivTr<generics::Priv<()>>` in public interface
402390 --> $DIR/private-in-public-warn.rs:100:26
403391 |
404LL | fn provided() -> impl PrivTr<Priv<()>> {}
405 | ^^^^^^^^^^^^^^^^^^^^^ opaque type `Tr5::provided::{anon_assoc#0}` is reachable at visibility `pub(crate)`
406 |
407note: but trait `generics::PrivTr<generics::Priv<()>>` is only usable at visibility `pub(self)`
408 --> $DIR/private-in-public-warn.rs:84:5
409 |
410392LL | trait PrivTr<T> {}
411 | ^^^^^^^^^^^^^^^
393 | --------------- `generics::PrivTr<generics::Priv<()>>` declared as private
394...
395LL | fn provided() -> impl PrivTr<Priv<()>> {}
396 | ^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
412397
413error: type `generics::Priv<()>` is more private than the item `Tr5::provided::{anon_assoc#0}`
398error[E0446]: private type `generics::Priv<()>` in public interface
414399 --> $DIR/private-in-public-warn.rs:100:26
415400 |
416LL | fn provided() -> impl PrivTr<Priv<()>> {}
417 | ^^^^^^^^^^^^^^^^^^^^^ opaque type `Tr5::provided::{anon_assoc#0}` is reachable at visibility `pub(crate)`
418 |
419note: but type `generics::Priv<()>` is only usable at visibility `pub(self)`
420 --> $DIR/private-in-public-warn.rs:82:5
421 |
422401LL | struct Priv<T = u8>(T);
423 | ^^^^^^^^^^^^^^^^^^^
402 | ------------------- `generics::Priv<()>` declared as private
403...
404LL | fn provided() -> impl PrivTr<Priv<()>> {}
405 | ^^^^^^^^^^^^^^^^^^^^^ can't leak private type
424406
425407error: trait `generics::PrivTr<generics::Priv<()>>` is more private than the item `Tr5::provided::{anon_assoc#0}`
426408 --> $DIR/private-in-public-warn.rs:100:26
tests/ui/resolve/auxiliary/open-ns-mod-my_api.rs created+9
......@@ -0,0 +1,9 @@
1pub mod utils {
2 pub fn root_helper() {
3 println!("root_helper");
4 }
5}
6
7pub fn root_function() -> String {
8 "my_api root!".to_string()
9}
tests/ui/resolve/auxiliary/open-ns-my_api.rs created+3
......@@ -0,0 +1,3 @@
1pub fn root_function() -> String {
2 "my_api root!".to_string()
3}
tests/ui/resolve/auxiliary/open-ns-my_api_core.rs created+15
......@@ -0,0 +1,15 @@
1// #![crate_name = "my_api::core"]
2
3pub mod util {
4 pub fn core_mod_fn() -> String {
5 format!("core_fn from my_api::core::util",)
6 }
7}
8
9pub fn core_fn() -> String {
10 format!("core_fn from my_api::core!",)
11}
12
13pub fn core_fn2() -> String {
14 format!("core_fn2 from my_api::core!",)
15}
tests/ui/resolve/auxiliary/open-ns-my_api_utils.rs created+13
......@@ -0,0 +1,13 @@
1pub mod util {
2 pub fn util_mod_helper() -> String {
3 format!("Helper from my_api::utils::util",)
4 }
5}
6
7pub fn utils_helper() -> String {
8 format!("Helper from my_api::utils!",)
9}
10
11pub fn get_u32() -> u32 {
12 1
13}
tests/ui/resolve/open-ns-1.rs created+19
......@@ -0,0 +1,19 @@
1//@ aux-crate:my_api=open-ns-my_api.rs
2//@ aux-crate:my_api::utils=open-ns-my_api_utils.rs
3//@ aux-crate:my_api::core=open-ns-my_api_core.rs
4//@ compile-flags: -Z namespaced-crates
5//@ edition: 2024
6
7use my_api::root_function;
8use my_api::utils::util;
9//~^ ERROR unresolved import `my_api::utils`
10
11fn main() {
12 let _ = root_function();
13 let _ = my_api::root_function();
14 let _ = my_api::utils::utils_helper();
15 //~^ ERROR cannot find `utils` in `my_api` [E0433]
16 let _ = util::util_mod_helper();
17 let _ = my_api::core::core_fn();
18 //~^ ERROR cannot find `core` in `my_api` [E0433]
19}
tests/ui/resolve/open-ns-1.stderr created+22
......@@ -0,0 +1,22 @@
1error[E0432]: unresolved import `my_api::utils`
2 --> $DIR/open-ns-1.rs:8:13
3 |
4LL | use my_api::utils::util;
5 | ^^^^^ could not find `utils` in `my_api`
6
7error[E0433]: cannot find `utils` in `my_api`
8 --> $DIR/open-ns-1.rs:14:21
9 |
10LL | let _ = my_api::utils::utils_helper();
11 | ^^^^^ could not find `utils` in `my_api`
12
13error[E0433]: cannot find `core` in `my_api`
14 --> $DIR/open-ns-1.rs:17:21
15 |
16LL | let _ = my_api::core::core_fn();
17 | ^^^^ could not find `core` in `my_api`
18
19error: aborting due to 3 previous errors
20
21Some errors have detailed explanations: E0432, E0433.
22For more information about an error, try `rustc --explain E0432`.
tests/ui/resolve/open-ns-10.rs created+8
......@@ -0,0 +1,8 @@
1// Tests that namespaced crate names are limited to two segments
2
3//@ aux-crate: nscrate::three::segments=open-ns-my_api_utils.rs
4//@ compile-flags: -Z namespaced-crates
5//@ edition: 2024
6//~? ERROR crate name `nscrate::three::segments` passed to `--extern` can have at most two segments.
7
8fn main() {}
tests/ui/resolve/open-ns-10.stderr created+2
......@@ -0,0 +1,2 @@
1error: crate name `nscrate::three::segments` passed to `--extern` can have at most two segments.
2
tests/ui/resolve/open-ns-11.rs created+12
......@@ -0,0 +1,12 @@
1// Tests that std has higher precedence than an open module with the same name.
2
3//@ aux-crate: std::utils=open-ns-my_api_utils.rs
4//@ compile-flags: -Z namespaced-crates
5//@ edition: 2024
6
7use std::utils::get_u32;
8//~^ ERROR unresolved import `std::utils`
9
10fn main() {
11 let _ = get_u32();
12}
tests/ui/resolve/open-ns-11.stderr created+9
......@@ -0,0 +1,9 @@
1error[E0432]: unresolved import `std::utils`
2 --> $DIR/open-ns-11.rs:7:10
3 |
4LL | use std::utils::get_u32;
5 | ^^^^^ could not find `utils` in `std`
6
7error: aborting due to 1 previous error
8
9For more information about this error, try `rustc --explain E0432`.
tests/ui/resolve/open-ns-2.rs created+18
......@@ -0,0 +1,18 @@
1//@ aux-crate: my_api=open-ns-my_api.rs
2//@ aux-crate: my_api::utils=open-ns-my_api_utils.rs
3//@ aux-crate: my_api::core=open-ns-my_api_core.rs
4//@ compile-flags: -Z namespaced-crates
5//@ edition: 2024
6
7use my_api::core::{core_fn, core_fn2};
8//~^ ERROR unresolved import `my_api::core` [E0432]
9use my_api::utils::*;
10//~^ ERROR unresolved import `my_api::utils` [E0432]
11use my_api::*;
12
13fn main() {
14 let _ = root_function();
15 let _ = utils_helper();
16 let _ = core_fn();
17 let _ = core_fn2();
18}
tests/ui/resolve/open-ns-2.stderr created+15
......@@ -0,0 +1,15 @@
1error[E0432]: unresolved import `my_api::core`
2 --> $DIR/open-ns-2.rs:7:13
3 |
4LL | use my_api::core::{core_fn, core_fn2};
5 | ^^^^ could not find `core` in `my_api`
6
7error[E0432]: unresolved import `my_api::utils`
8 --> $DIR/open-ns-2.rs:9:13
9 |
10LL | use my_api::utils::*;
11 | ^^^^^ could not find `utils` in `my_api`
12
13error: aborting due to 2 previous errors
14
15For more information about this error, try `rustc --explain E0432`.
tests/ui/resolve/open-ns-3.rs created+14
......@@ -0,0 +1,14 @@
1// This test should fail with `utils_helper` being unresolvable in `my_api::utils`.
2// If a crate contains a module that overlaps with a namespaced crate name, then
3// the namespaced crate will not be used in name resolution.
4
5//@ aux-crate: my_api::utils=open-ns-my_api_utils.rs
6//@ aux-crate: my_api=open-ns-mod-my_api.rs
7//@ compile-flags: -Z namespaced-crates
8//@ edition: 2024
9
10fn main() {
11 let _ = my_api::utils::root_helper();
12 let _ = my_api::utils::utils_helper();
13 //~^ ERROR cannot find function `utils_helper` in module `my_api::utils` [E0425]
14}
tests/ui/resolve/open-ns-3.stderr created+19
......@@ -0,0 +1,19 @@
1error[E0425]: cannot find function `utils_helper` in module `my_api::utils`
2 --> $DIR/open-ns-3.rs:12:28
3 |
4LL | let _ = my_api::utils::utils_helper();
5 | ^^^^^^^^^^^^ not found in `my_api::utils`
6 |
7help: consider importing this function
8 |
9LL + use my_api::utils::utils_helper;
10 |
11help: if you import `utils_helper`, refer to it directly
12 |
13LL - let _ = my_api::utils::utils_helper();
14LL + let _ = utils_helper();
15 |
16
17error: aborting due to 1 previous error
18
19For more information about this error, try `rustc --explain E0425`.
tests/ui/resolve/open-ns-4.rs created+12
......@@ -0,0 +1,12 @@
1// This tests that namespaced crates are shadowed.
2
3//@ aux-crate: my_api=open-ns-my_api.rs
4//@ aux-crate: my_api::utils=open-ns-my_api_utils.rs
5//@ compile-flags: -Z namespaced-crates
6//@ edition: 2024
7
8fn main() {
9 let _ = my_api::root_function();
10 let _ = my_api::utils::utils_helper();
11 //~^ ERROR cannot find `utils` in `my_api` [E0433]
12}
tests/ui/resolve/open-ns-4.stderr created+9
......@@ -0,0 +1,9 @@
1error[E0433]: cannot find `utils` in `my_api`
2 --> $DIR/open-ns-4.rs:10:21
3 |
4LL | let _ = my_api::utils::utils_helper();
5 | ^^^^^ could not find `utils` in `my_api`
6
7error: aborting due to 1 previous error
8
9For more information about this error, try `rustc --explain E0433`.
tests/ui/resolve/open-ns-5.rs created+18
......@@ -0,0 +1,18 @@
1// Tests that namespaced crate names work inside macros.
2
3//@ aux-crate: my_api::utils=open-ns-my_api_utils.rs
4//@ compile-flags: -Z namespaced-crates
5//@ edition: 2024
6//@ check-pass
7
8macro_rules! import_and_call {
9 ($import_path:path, $fn_name:ident) => {{
10 use $import_path;
11 $fn_name();
12 }};
13}
14
15fn main() {
16 import_and_call!(my_api::utils::utils_helper, utils_helper);
17 let _x = 4 + 5;
18}
tests/ui/resolve/open-ns-6.rs created+13
......@@ -0,0 +1,13 @@
1// Tests that open modules are resolvable.
2
3//@ aux-crate: my_api::utils=open-ns-my_api_utils.rs
4//@ compile-flags: -Z namespaced-crates
5//@ edition: 2024
6//@ check-pass
7
8use my_api;
9use my_api::utils::utils_helper;
10
11fn main() {
12 let _ = utils_helper();
13}
tests/ui/resolve/open-ns-7.rs created+14
......@@ -0,0 +1,14 @@
1// Tests that namespaced crates cannot be resolved if shadowed.
2
3//@ aux-crate: my_api=open-ns-my_api.rs
4//@ aux-crate: my_api::utils=open-ns-my_api_utils.rs
5//@ compile-flags: -Z namespaced-crates
6//@ edition: 2024
7
8use my_api::utils::utils_helper;
9//~^ ERROR unresolved import `my_api::utils` [E0432]
10
11fn main() {
12 let _ = my_api::utils::utils_helper();
13 //~^ ERROR cannot find `utils` in `my_api` [E0433]
14}
tests/ui/resolve/open-ns-7.stderr created+16
......@@ -0,0 +1,16 @@
1error[E0432]: unresolved import `my_api::utils`
2 --> $DIR/open-ns-7.rs:8:13
3 |
4LL | use my_api::utils::utils_helper;
5 | ^^^^^ could not find `utils` in `my_api`
6
7error[E0433]: cannot find `utils` in `my_api`
8 --> $DIR/open-ns-7.rs:12:21
9 |
10LL | let _ = my_api::utils::utils_helper();
11 | ^^^^^ could not find `utils` in `my_api`
12
13error: aborting due to 2 previous errors
14
15Some errors have detailed explanations: E0432, E0433.
16For more information about an error, try `rustc --explain E0432`.
tests/ui/resolve/open-ns-8.rs created+23
......@@ -0,0 +1,23 @@
1// Tests that a macro-generated item has higher precendence than a namespaced crate
2//@ aux-crate: my_api::utils=open-ns-my_api_utils.rs
3//@ compile-flags: -Z namespaced-crates
4//@ edition: 2024
5//@ check-pass
6
7macro_rules! define {
8 () => {
9 pub mod my_api {
10 pub mod utils {
11 pub fn get_u32() -> u32 {
12 2
13 }
14 }
15 }
16 };
17}
18
19fn main() {
20 define!();
21 let res = my_api::utils::get_u32();
22 assert_eq!(res, 2);
23}
tests/ui/resolve/open-ns-9.rs created+25
......@@ -0,0 +1,25 @@
1//@ aux-crate: my_api::utils=open-ns-my_api_utils.rs
2//@ compile-flags: -Z namespaced-crates
3//@ edition: 2024
4
5use my_api::utils::get_u32;
6//~^ ERROR `my_api` is ambiguous [E0659]
7
8macro_rules! define {
9 () => {
10 pub mod my_api {
11 pub mod utils {
12 pub fn get_u32() -> u32 {
13 2
14 }
15 }
16 }
17 };
18}
19
20define!();
21
22fn main() {
23 let val = get_u32();
24 assert_eq!(val, 2);
25}
tests/ui/resolve/open-ns-9.stderr created+27
......@@ -0,0 +1,27 @@
1error[E0659]: `my_api` is ambiguous
2 --> $DIR/open-ns-9.rs:5:5
3 |
4LL | use my_api::utils::get_u32;
5 | ^^^^^^ ambiguous name
6 |
7 = note: ambiguous because of a conflict between a macro-expanded name and a less macro-expanded name from outer scope during import or macro resolution
8 = note: `my_api` could refer to a namespaced crate passed with `--extern`
9note: `my_api` could also refer to the module defined here
10 --> $DIR/open-ns-9.rs:10:9
11 |
12LL | / pub mod my_api {
13LL | | pub mod utils {
14LL | | pub fn get_u32() -> u32 {
15LL | | 2
16... |
17LL | | }
18 | |_________^
19...
20LL | define!();
21 | --------- in this macro invocation
22 = help: use `crate::my_api` to refer to this module unambiguously
23 = note: this error originates in the macro `define` (in Nightly builds, run with -Z macro-backtrace for more info)
24
25error: aborting due to 1 previous error
26
27For more information about this error, try `rustc --explain E0659`.
tests/ui/rfcs/rfc-0000-never_patterns/never-pattern-is-a-read.rs-1
......@@ -1,7 +1,6 @@
11// Make sure we consider `!` to be a union read.
22
33#![feature(never_type, never_patterns)]
4//~^ WARN the feature `never_patterns` is incomplete
54
65union U {
76 a: !,
tests/ui/rfcs/rfc-0000-never_patterns/never-pattern-is-a-read.stderr+2-11
......@@ -1,20 +1,11 @@
1warning: the feature `never_patterns` is incomplete and may not be safe to use and/or cause compiler crashes
2 --> $DIR/never-pattern-is-a-read.rs:3:24
3 |
4LL | #![feature(never_type, never_patterns)]
5 | ^^^^^^^^^^^^^^
6 |
7 = note: see issue #118155 <https://github.com/rust-lang/rust/issues/118155> for more information
8 = note: `#[warn(incomplete_features)]` on by default
9
101error[E0133]: access to union field is unsafe and requires unsafe function or block
11 --> $DIR/never-pattern-is-a-read.rs:12:16
2 --> $DIR/never-pattern-is-a-read.rs:11:16
123 |
134LL | let U { a: ! } = u;
145 | ^ access to union field
156 |
167 = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
178
18error: aborting due to 1 previous error; 1 warning emitted
9error: aborting due to 1 previous error
1910
2011For more information about this error, try `rustc --explain E0133`.
tests/ui/transmutability/dont-assume-err-is-yes-issue-126377.rs-1
......@@ -1,6 +1,5 @@
11#![feature(transmutability)]
22#![feature(generic_const_exprs)]
3//~^ WARN the feature `generic_const_exprs` is incomplete
43
54use std::mem::{Assume, TransmuteFrom};
65
tests/ui/transmutability/dont-assume-err-is-yes-issue-126377.stderr+4-13
......@@ -1,26 +1,17 @@
1warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes
2 --> $DIR/dont-assume-err-is-yes-issue-126377.rs:2:12
3 |
4LL | #![feature(generic_const_exprs)]
5 | ^^^^^^^^^^^^^^^^^^^
6 |
7 = note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
8 = note: `#[warn(incomplete_features)]` on by default
9
101error[E0308]: mismatched types
11 --> $DIR/dont-assume-err-is-yes-issue-126377.rs:14:23
2 --> $DIR/dont-assume-err-is-yes-issue-126377.rs:13:23
123 |
134LL | is_transmutable::<{}>();
145 | ^^ expected `bool`, found `()`
156
167error[E0277]: the trait bound `(): TransmuteFrom<(), { Assume::SAFETY }>` is not satisfied
17 --> $DIR/dont-assume-err-is-yes-issue-126377.rs:14:23
8 --> $DIR/dont-assume-err-is-yes-issue-126377.rs:13:23
189 |
1910LL | is_transmutable::<{}>();
2011 | ^^ the nightly-only, unstable trait `TransmuteFrom<(), { Assume::SAFETY }>` is not implemented for `()`
2112 |
2213note: required by a bound in `is_transmutable`
23 --> $DIR/dont-assume-err-is-yes-issue-126377.rs:9:9
14 --> $DIR/dont-assume-err-is-yes-issue-126377.rs:8:9
2415 |
2516LL | pub fn is_transmutable<const ASSUME_ALIGNMENT: bool>()
2617 | --------------- required by a bound in this function
......@@ -28,7 +19,7 @@ LL | where
2819LL | (): TransmuteFrom<(), { Assume::SAFETY }>,
2920 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable`
3021
31error: aborting due to 2 previous errors; 1 warning emitted
22error: aborting due to 2 previous errors
3223
3324Some errors have detailed explanations: E0277, E0308.
3425For more information about an error, try `rustc --explain E0277`.
tests/ui/transmutability/non_scalar_alignment_value.rs-1
......@@ -1,5 +1,4 @@
11#![feature(min_generic_const_args)]
2//~^ WARN the feature `min_generic_const_args` is incomplete
32
43#![feature(transmutability)]
54
tests/ui/transmutability/non_scalar_alignment_value.stderr+5-14
......@@ -1,35 +1,26 @@
1warning: the feature `min_generic_const_args` is incomplete and may not be safe to use and/or cause compiler crashes
2 --> $DIR/non_scalar_alignment_value.rs:1:12
3 |
4LL | #![feature(min_generic_const_args)]
5 | ^^^^^^^^^^^^^^^^^^^^^^
6 |
7 = note: see issue #132980 <https://github.com/rust-lang/rust/issues/132980> for more information
8 = note: `#[warn(incomplete_features)]` on by default
9
101error: struct expression with missing field initialiser for `alignment`
11 --> $DIR/non_scalar_alignment_value.rs:15:32
2 --> $DIR/non_scalar_alignment_value.rs:14:32
123 |
134LL | alignment: Assume {},
145 | ^^^^^^^^^
156
167error: struct expression with missing field initialiser for `lifetimes`
17 --> $DIR/non_scalar_alignment_value.rs:15:32
8 --> $DIR/non_scalar_alignment_value.rs:14:32
189 |
1910LL | alignment: Assume {},
2011 | ^^^^^^^^^
2112
2213error: struct expression with missing field initialiser for `safety`
23 --> $DIR/non_scalar_alignment_value.rs:15:32
14 --> $DIR/non_scalar_alignment_value.rs:14:32
2415 |
2516LL | alignment: Assume {},
2617 | ^^^^^^^^^
2718
2819error: struct expression with missing field initialiser for `validity`
29 --> $DIR/non_scalar_alignment_value.rs:15:32
20 --> $DIR/non_scalar_alignment_value.rs:14:32
3021 |
3122LL | alignment: Assume {},
3223 | ^^^^^^^^^
3324
34error: aborting due to 4 previous errors; 1 warning emitted
25error: aborting due to 4 previous errors
3526
tests/ui/unsafe-binders/binder-sized-crit.rs-1
......@@ -1,7 +1,6 @@
11//@ check-pass
22
33#![feature(unsafe_binders)]
4//~^ WARN the feature `unsafe_binders` is incomplete
54
65use std::unsafe_binder::wrap_binder;
76
tests/ui/unsafe-binders/binder-sized-crit.stderr deleted-11
......@@ -1,11 +0,0 @@
1warning: the feature `unsafe_binders` is incomplete and may not be safe to use and/or cause compiler crashes
2 --> $DIR/binder-sized-crit.rs:3:12
3 |
4LL | #![feature(unsafe_binders)]
5 | ^^^^^^^^^^^^^^
6 |
7 = note: see issue #130516 <https://github.com/rust-lang/rust/issues/130516> for more information
8 = note: `#[warn(incomplete_features)]` on by default
9
10warning: 1 warning emitted
11
tests/ui/unsafe-binders/expr.rs-1
......@@ -1,7 +1,6 @@
11//@ check-pass
22
33#![feature(unsafe_binders)]
4//~^ WARN the feature `unsafe_binders` is incomplete
54
65use std::unsafe_binder::{wrap_binder, unwrap_binder};
76
tests/ui/unsafe-binders/expr.stderr deleted-11
......@@ -1,11 +0,0 @@
1warning: the feature `unsafe_binders` is incomplete and may not be safe to use and/or cause compiler crashes
2 --> $DIR/expr.rs:3:12
3 |
4LL | #![feature(unsafe_binders)]
5 | ^^^^^^^^^^^^^^
6 |
7 = note: see issue #130516 <https://github.com/rust-lang/rust/issues/130516> for more information
8 = note: `#[warn(incomplete_features)]` on by default
9
10warning: 1 warning emitted
11
tests/ui/unsafe-binders/lifetime-resolution.rs-1
......@@ -1,5 +1,4 @@
11#![feature(unsafe_binders)]
2//~^ WARN the feature `unsafe_binders` is incomplete
32
43fn foo<'a>() {
54 let good: unsafe<'b> &'a &'b ();
tests/ui/unsafe-binders/lifetime-resolution.stderr+3-12
......@@ -1,5 +1,5 @@
11error[E0261]: use of undeclared lifetime name `'missing`
2 --> $DIR/lifetime-resolution.rs:7:28
2 --> $DIR/lifetime-resolution.rs:6:28
33 |
44LL | let missing: unsafe<> &'missing ();
55 | ^^^^^^^^ undeclared lifetime
......@@ -15,7 +15,7 @@ LL | fn foo<'missing, 'a>() {
1515 | +++++++++
1616
1717error[E0401]: can't use generic parameters from outer item
18 --> $DIR/lifetime-resolution.rs:11:30
18 --> $DIR/lifetime-resolution.rs:10:30
1919 |
2020LL | fn foo<'a>() {
2121 | -- lifetime parameter from outer item
......@@ -32,16 +32,7 @@ help: consider introducing lifetime `'a` here
3232LL | fn inner<'a, 'b>() {
3333 | +++
3434
35warning: the feature `unsafe_binders` is incomplete and may not be safe to use and/or cause compiler crashes
36 --> $DIR/lifetime-resolution.rs:1:12
37 |
38LL | #![feature(unsafe_binders)]
39 | ^^^^^^^^^^^^^^
40 |
41 = note: see issue #130516 <https://github.com/rust-lang/rust/issues/130516> for more information
42 = note: `#[warn(incomplete_features)]` on by default
43
44error: aborting due to 2 previous errors; 1 warning emitted
35error: aborting due to 2 previous errors
4536
4637Some errors have detailed explanations: E0261, E0401.
4738For more information about an error, try `rustc --explain E0261`.
tests/ui/unsafe-binders/mismatch.rs-1
......@@ -1,5 +1,4 @@
11#![feature(unsafe_binders)]
2//~^ WARN the feature `unsafe_binders` is incomplete
32
43use std::unsafe_binder::{wrap_binder, unwrap_binder};
54
tests/ui/unsafe-binders/mismatch.stderr+6-15
......@@ -1,14 +1,5 @@
1warning: the feature `unsafe_binders` is incomplete and may not be safe to use and/or cause compiler crashes
2 --> $DIR/mismatch.rs:1:12
3 |
4LL | #![feature(unsafe_binders)]
5 | ^^^^^^^^^^^^^^
6 |
7 = note: see issue #130516 <https://github.com/rust-lang/rust/issues/130516> for more information
8 = note: `#[warn(incomplete_features)]` on by default
9
101error[E0308]: mismatched types
11 --> $DIR/mismatch.rs:7:46
2 --> $DIR/mismatch.rs:6:46
123 |
134LL | let _: unsafe<'a> &'a i32 = wrap_binder!(&());
145 | ^^^ expected `&i32`, found `&()`
......@@ -17,7 +8,7 @@ LL | let _: unsafe<'a> &'a i32 = wrap_binder!(&());
178 found reference `&()`
189
1910error: `wrap_binder!()` can only wrap into unsafe binder, not `i32`
20 --> $DIR/mismatch.rs:12:18
11 --> $DIR/mismatch.rs:11:18
2112 |
2213LL | let _: i32 = wrap_binder!(&());
2314 | ^^^^^^^^^^^^^^^^^
......@@ -26,7 +17,7 @@ LL | let _: i32 = wrap_binder!(&());
2617 = note: this error originates in the macro `wrap_binder` (in Nightly builds, run with -Z macro-backtrace for more info)
2718
2819error: expected unsafe binder, found integer as input of `unwrap_binder!()`
29 --> $DIR/mismatch.rs:18:20
20 --> $DIR/mismatch.rs:17:20
3021 |
3122LL | unwrap_binder!(y);
3223 | ^
......@@ -34,7 +25,7 @@ LL | unwrap_binder!(y);
3425 = note: only an unsafe binder type can be unwrapped
3526
3627error[E0282]: type annotations needed
37 --> $DIR/mismatch.rs:23:9
28 --> $DIR/mismatch.rs:22:9
3829 |
3930LL | let unknown = Default::default();
4031 | ^^^^^^^
......@@ -48,12 +39,12 @@ LL | let unknown: /* Type */ = Default::default();
4839 | ++++++++++++
4940
5041error[E0282]: type annotations needed
51 --> $DIR/mismatch.rs:29:26
42 --> $DIR/mismatch.rs:28:26
5243 |
5344LL | let x = wrap_binder!(&42);
5445 | ^^^ cannot infer type
5546
56error: aborting due to 5 previous errors; 1 warning emitted
47error: aborting due to 5 previous errors
5748
5849Some errors have detailed explanations: E0282, E0308.
5950For more information about an error, try `rustc --explain E0282`.
tests/ui/unsafe-binders/moves.rs-1
......@@ -1,5 +1,4 @@
11#![feature(unsafe_binders)]
2//~^ WARN the feature `unsafe_binders` is incomplete
32
43use std::mem::{ManuallyDrop, drop};
54use std::unsafe_binder::{unwrap_binder, wrap_binder};
tests/ui/unsafe-binders/moves.stderr+5-14
......@@ -1,14 +1,5 @@
1warning: the feature `unsafe_binders` is incomplete and may not be safe to use and/or cause compiler crashes
2 --> $DIR/moves.rs:1:12
3 |
4LL | #![feature(unsafe_binders)]
5 | ^^^^^^^^^^^^^^
6 |
7 = note: see issue #130516 <https://github.com/rust-lang/rust/issues/130516> for more information
8 = note: `#[warn(incomplete_features)]` on by default
9
101error[E0382]: use of moved value: `base`
11 --> $DIR/moves.rs:15:14
2 --> $DIR/moves.rs:14:14
123 |
134LL | let base = NotCopy::default();
145 | ---- move occurs because `base` has type `ManuallyDrop<NotCopyInner>`, which does not implement the `Copy` trait
......@@ -18,7 +9,7 @@ LL | drop(base);
189 | ^^^^ value used here after move
1910 |
2011note: if `NotCopyInner` implemented `Clone`, you could clone the value
21 --> $DIR/moves.rs:8:1
12 --> $DIR/moves.rs:7:1
2213 |
2314LL | struct NotCopyInner;
2415 | ^^^^^^^^^^^^^^^^^^^ consider implementing `Clone` for this type
......@@ -27,7 +18,7 @@ LL | let binder: unsafe<> NotCopy = wrap_binder!(base);
2718 | ---- you could clone this value
2819
2920error[E0382]: use of moved value: `binder`
30 --> $DIR/moves.rs:24:14
21 --> $DIR/moves.rs:23:14
3122 |
3223LL | drop(unwrap_binder!(binder));
3324 | ---------------------- value moved here
......@@ -38,7 +29,7 @@ LL | drop(unwrap_binder!(binder));
3829 = note: this error originates in the macro `unwrap_binder` (in Nightly builds, run with -Z macro-backtrace for more info)
3930
4031error[E0382]: use of moved value: `binder.0`
41 --> $DIR/moves.rs:36:14
32 --> $DIR/moves.rs:35:14
4233 |
4334LL | drop(unwrap_binder!(binder).0);
4435 | ------------------------ value moved here
......@@ -48,6 +39,6 @@ LL | drop(unwrap_binder!(binder).0);
4839 |
4940 = note: move occurs because `binder.0` has type `ManuallyDrop<NotCopyInner>`, which does not implement the `Copy` trait
5041
51error: aborting due to 3 previous errors; 1 warning emitted
42error: aborting due to 3 previous errors
5243
5344For more information about this error, try `rustc --explain E0382`.
tests/ui/unsafe-binders/simple.rs-1
......@@ -1,7 +1,6 @@
11//@ check-pass
22
33#![feature(unsafe_binders)]
4//~^ WARN the feature `unsafe_binders` is incomplete
54
65fn main() {
76 let x: unsafe<'a> &'a ();
tests/ui/unsafe-binders/simple.stderr deleted-11
......@@ -1,11 +0,0 @@
1warning: the feature `unsafe_binders` is incomplete and may not be safe to use and/or cause compiler crashes
2 --> $DIR/simple.rs:3:12
3 |
4LL | #![feature(unsafe_binders)]
5 | ^^^^^^^^^^^^^^
6 |
7 = note: see issue #130516 <https://github.com/rust-lang/rust/issues/130516> for more information
8 = note: `#[warn(incomplete_features)]` on by default
9
10warning: 1 warning emitted
11
tests/ui/unsafe-binders/type-mismatch.rs-1
......@@ -1,5 +1,4 @@
11#![feature(unsafe_binders)]
2//~^ WARN the feature `unsafe_binders` is incomplete
32
43fn main() {
54 let x: unsafe<> i32 = 0;
tests/ui/unsafe-binders/type-mismatch.stderr+3-12
......@@ -1,14 +1,5 @@
1warning: the feature `unsafe_binders` is incomplete and may not be safe to use and/or cause compiler crashes
2 --> $DIR/type-mismatch.rs:1:12
3 |
4LL | #![feature(unsafe_binders)]
5 | ^^^^^^^^^^^^^^
6 |
7 = note: see issue #130516 <https://github.com/rust-lang/rust/issues/130516> for more information
8 = note: `#[warn(incomplete_features)]` on by default
9
101error[E0308]: mismatched types
11 --> $DIR/type-mismatch.rs:5:27
2 --> $DIR/type-mismatch.rs:4:27
123 |
134LL | let x: unsafe<> i32 = 0;
145 | ------------ ^ expected `unsafe<> i32`, found integer
......@@ -19,7 +10,7 @@ LL | let x: unsafe<> i32 = 0;
1910 found type `{integer}`
2011
2112error[E0308]: mismatched types
22 --> $DIR/type-mismatch.rs:7:33
13 --> $DIR/type-mismatch.rs:6:33
2314 |
2415LL | let x: unsafe<'a> &'a i32 = &0;
2516 | ------------------ ^^ expected `unsafe<'a> &i32`, found `&{integer}`
......@@ -29,6 +20,6 @@ LL | let x: unsafe<'a> &'a i32 = &0;
2920 = note: expected unsafe binder `unsafe<'a> &'a i32`
3021 found reference `&{integer}`
3122
32error: aborting due to 2 previous errors; 1 warning emitted
23error: aborting due to 2 previous errors
3324
3425For more information about this error, try `rustc --explain E0308`.
tests/ui/unsafe-binders/unsafe-binders-debuginfo.rs-1
......@@ -3,7 +3,6 @@
33//@ compile-flags: -Cdebuginfo=2
44//@ ignore-backends: gcc
55#![feature(unsafe_binders)]
6//~^ WARN the feature `unsafe_binders` is incomplete
76
87use std::unsafe_binder::wrap_binder;
98fn main() {
tests/ui/unsafe-binders/unsafe-binders-debuginfo.stderr deleted-11
......@@ -1,11 +0,0 @@
1warning: the feature `unsafe_binders` is incomplete and may not be safe to use and/or cause compiler crashes
2 --> $DIR/unsafe-binders-debuginfo.rs:5:12
3 |
4LL | #![feature(unsafe_binders)]
5 | ^^^^^^^^^^^^^^
6 |
7 = note: see issue #130516 <https://github.com/rust-lang/rust/issues/130516> for more information
8 = note: `#[warn(incomplete_features)]` on by default
9
10warning: 1 warning emitted
11
typos.toml+1
......@@ -48,6 +48,7 @@ unstalled = "unstalled" # short for un-stalled
4848# the non-empty form can be automatically fixed by `--bless`.
4949#
5050# tidy-alphabetical-start
51atomicaly = "atomically"
5152definitinon = "definition"
5253dependy = ""
5354similarlty = "similarity"