| author | bors <bors@rust-lang.org> 2026-03-23 11:17:44 UTC |
| committer | bors <bors@rust-lang.org> 2026-03-23 11:17:44 UTC |
| log | 13e2abaac846b2680ae93e1b3bd9fe7fe1b9a7fe |
| tree | 2478b2e426d0a6f627f6b1a35ddde5d64e648cdd |
| parent | bbe853615821442ef11d6cd42a30a73432b38d89 |
| parent | baffc5e9bc04e11efe911cf6c56c2792d5cebb4a |
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> |
| 262 | 262 | Guillaume Gomez <guillaume1.gomez@gmail.com> ggomez <ggomez@ggo.ifr.lan> |
| 263 | 263 | Guillaume Gomez <guillaume1.gomez@gmail.com> Guillaume Gomez <ggomez@ggo.ifr.lan> |
| 264 | 264 | Guillaume Gomez <guillaume1.gomez@gmail.com> Guillaume Gomez <guillaume.gomez@huawei.com> |
| 265 | Guillaume Gomez <guillaume1.gomez@gmail.com> Guillaume Gomez <contact@guillaume-gomez.fr> | |
| 265 | 266 | gnzlbg <gonzalobg88@gmail.com> <gnzlbg@users.noreply.github.com> |
| 266 | 267 | hamidreza kalbasi <hamidrezakalbasi@protonmail.com> |
| 267 | 268 | Hanna 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}; |
| 46 | 46 | use rustc_session::Session; |
| 47 | 47 | use rustc_session::config::OutputFilenames; |
| 48 | 48 | use rustc_span::{Symbol, sym}; |
| 49 | use rustc_target::spec::{Abi, Arch, Env, Os}; | |
| 49 | use rustc_target::spec::{Arch, CfgAbi, Env, Os}; | |
| 50 | 50 | |
| 51 | 51 | pub use crate::config::*; |
| 52 | 52 | use crate::prelude::*; |
| ... | ... | @@ -178,7 +178,7 @@ impl CodegenBackend for CraneliftCodegenBackend { |
| 178 | 178 | let has_reliable_f16_f128 = !(sess.target.arch == Arch::X86_64 |
| 179 | 179 | && sess.target.os == Os::Windows |
| 180 | 180 | && sess.target.env == Env::Gnu |
| 181 | && sess.target.abi != Abi::Llvm); | |
| 181 | && sess.target.cfg_abi != CfgAbi::Llvm); | |
| 182 | 182 | |
| 183 | 183 | // FIXME(f128): f128 math operations need f128 math symbols, which currently aren't always |
| 184 | 184 | // 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; |
| 36 | 36 | use crate::common::AsCCharPtr; |
| 37 | 37 | use crate::errors::{ |
| 38 | 38 | CopyBitcode, FromLlvmDiag, FromLlvmOptimizationDiag, LlvmError, ParseTargetMachineConfig, |
| 39 | UnknownCompression, WithLlvmError, WriteBytecode, | |
| 39 | UnsupportedCompression, WithLlvmError, WriteBytecode, | |
| 40 | 40 | }; |
| 41 | 41 | use crate::llvm::diagnostic::OptimizationDiagnosticKind::*; |
| 42 | 42 | use crate::llvm::{self, DiagnosticInfo}; |
| ... | ... | @@ -225,7 +225,7 @@ pub(crate) fn target_machine_factory( |
| 225 | 225 | let triple = SmallCStr::new(&versioned_llvm_target(sess)); |
| 226 | 226 | let cpu = SmallCStr::new(llvm_util::target_cpu(sess)); |
| 227 | 227 | 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()); | |
| 229 | 229 | let trap_unreachable = |
| 230 | 230 | sess.opts.unstable_opts.trap_unreachable.unwrap_or(sess.target.trap_unreachable); |
| 231 | 231 | let emit_stack_size_section = sess.opts.unstable_opts.emit_stack_sizes; |
| ... | ... | @@ -248,7 +248,7 @@ pub(crate) fn target_machine_factory( |
| 248 | 248 | if llvm::LLVMRustLLVMHasZlibCompression() { |
| 249 | 249 | llvm::CompressionKind::Zlib |
| 250 | 250 | } else { |
| 251 | sess.dcx().emit_warn(UnknownCompression { algorithm: "zlib" }); | |
| 251 | sess.dcx().emit_warn(UnsupportedCompression { algorithm: "zlib" }); | |
| 252 | 252 | llvm::CompressionKind::None |
| 253 | 253 | } |
| 254 | 254 | } |
| ... | ... | @@ -256,7 +256,7 @@ pub(crate) fn target_machine_factory( |
| 256 | 256 | if llvm::LLVMRustLLVMHasZstdCompression() { |
| 257 | 257 | llvm::CompressionKind::Zstd |
| 258 | 258 | } else { |
| 259 | sess.dcx().emit_warn(UnknownCompression { algorithm: "zstd" }); | |
| 259 | sess.dcx().emit_warn(UnsupportedCompression { algorithm: "zstd" }); | |
| 260 | 260 | llvm::CompressionKind::None |
| 261 | 261 | } |
| 262 | 262 | } |
compiler/rustc_codegen_llvm/src/context.rs+4-5| ... | ... | @@ -28,7 +28,7 @@ use rustc_session::config::{ |
| 28 | 28 | use rustc_span::{DUMMY_SP, Span, Spanned, Symbol}; |
| 29 | 29 | use rustc_symbol_mangling::mangle_internal_symbol; |
| 30 | 30 | use rustc_target::spec::{ |
| 31 | Abi, Arch, Env, HasTargetSpec, Os, RelocModel, SmallDataThresholdSupport, Target, TlsModel, | |
| 31 | Arch, CfgAbi, Env, HasTargetSpec, Os, RelocModel, SmallDataThresholdSupport, Target, TlsModel, | |
| 32 | 32 | }; |
| 33 | 33 | use smallvec::SmallVec; |
| 34 | 34 | |
| ... | ... | @@ -344,7 +344,7 @@ pub(crate) unsafe fn create_module<'ll>( |
| 344 | 344 | if sess.target.is_like_msvc |
| 345 | 345 | || (sess.target.options.os == Os::Windows |
| 346 | 346 | && sess.target.options.env == Env::Gnu |
| 347 | && sess.target.options.abi == Abi::Llvm) | |
| 347 | && sess.target.options.cfg_abi == CfgAbi::Llvm) | |
| 348 | 348 | { |
| 349 | 349 | match sess.opts.cg.control_flow_guard { |
| 350 | 350 | CFGuard::Disabled => {} |
| ... | ... | @@ -509,14 +509,13 @@ pub(crate) unsafe fn create_module<'ll>( |
| 509 | 509 | // to workaround lld as the LTO plugin not |
| 510 | 510 | // correctly setting target-abi for the LTO object |
| 511 | 511 | // FIXME: https://github.com/llvm/llvm-project/issues/50591 |
| 512 | // If llvm_abiname is empty, emit nothing. | |
| 513 | 512 | 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) { | |
| 515 | 514 | llvm::add_module_flag_str( |
| 516 | 515 | llmod, |
| 517 | 516 | llvm::ModuleFlagMergeBehavior::Error, |
| 518 | 517 | "target-abi", |
| 519 | llvm_abiname, | |
| 518 | llvm_abiname.desc(), | |
| 520 | 519 | ); |
| 521 | 520 | } |
| 522 | 521 |
compiler/rustc_codegen_llvm/src/errors.rs+2-2| ... | ... | @@ -182,9 +182,9 @@ pub(crate) struct CopyBitcode { |
| 182 | 182 | |
| 183 | 183 | #[derive(Diagnostic)] |
| 184 | 184 | #[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" | |
| 186 | 186 | )] |
| 187 | pub(crate) struct UnknownCompression { | |
| 187 | pub(crate) struct UnsupportedCompression { | |
| 188 | 188 | pub algorithm: &'static str, |
| 189 | 189 | } |
| 190 | 190 |
compiler/rustc_codegen_llvm/src/llvm_util.rs+8-4| ... | ... | @@ -16,7 +16,7 @@ use rustc_middle::bug; |
| 16 | 16 | use rustc_session::Session; |
| 17 | 17 | use rustc_session::config::{PrintKind, PrintRequest}; |
| 18 | 18 | use rustc_target::spec::{ |
| 19 | Abi, Arch, Env, MergeFunctions, Os, PanicStrategy, SmallDataThresholdSupport, | |
| 19 | Arch, CfgAbi, Env, MergeFunctions, Os, PanicStrategy, SmallDataThresholdSupport, | |
| 20 | 20 | }; |
| 21 | 21 | use smallvec::{SmallVec, smallvec}; |
| 22 | 22 | |
| ... | ... | @@ -362,7 +362,7 @@ fn update_target_reliable_float_cfg(sess: &Session, cfg: &mut TargetConfig) { |
| 362 | 362 | let target_arch = &sess.target.arch; |
| 363 | 363 | let target_os = &sess.target.options.os; |
| 364 | 364 | let target_env = &sess.target.options.env; |
| 365 | let target_abi = &sess.target.options.abi; | |
| 365 | let target_abi = &sess.target.options.cfg_abi; | |
| 366 | 366 | let target_pointer_width = sess.target.pointer_width; |
| 367 | 367 | let version = get_version(); |
| 368 | 368 | let (major, _, _) = version; |
| ... | ... | @@ -371,7 +371,9 @@ fn update_target_reliable_float_cfg(sess: &Session, cfg: &mut TargetConfig) { |
| 371 | 371 | // Unsupported <https://github.com/llvm/llvm-project/issues/94434> (fixed in llvm22) |
| 372 | 372 | (Arch::Arm64EC, _) if major < 22 => false, |
| 373 | 373 | // 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 | } | |
| 375 | 377 | // Infinite recursion <https://github.com/llvm/llvm-project/issues/97981> |
| 376 | 378 | (Arch::CSky, _) if major < 22 => false, // (fixed in llvm22) |
| 377 | 379 | (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) { |
| 397 | 399 | // ABI unsupported <https://github.com/llvm/llvm-project/issues/41838> (fixed in llvm22) |
| 398 | 400 | (Arch::Sparc, _) if major < 22 => false, |
| 399 | 401 | // 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 | } | |
| 401 | 405 | // There are no known problems on other platforms, so the only requirement is that symbols |
| 402 | 406 | // are available. `compiler-builtins` provides all symbols required for core `f128` |
| 403 | 407 | // 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::{ |
| 8 | 8 | use rustc_middle::bug; |
| 9 | 9 | use rustc_middle::ty::Ty; |
| 10 | 10 | use rustc_middle::ty::layout::{HasTyCtxt, LayoutOf, TyAndLayout}; |
| 11 | use rustc_target::spec::{Arch, Env, RustcAbi}; | |
| 11 | use rustc_target::spec::{Arch, Env, LlvmAbi, RustcAbi}; | |
| 12 | 12 | |
| 13 | 13 | use crate::builder::Builder; |
| 14 | 14 | use crate::llvm::{Type, Value}; |
| ... | ... | @@ -1077,7 +1077,7 @@ pub(super) fn emit_va_arg<'ll, 'tcx>( |
| 1077 | 1077 | AllowHigherAlign::Yes, |
| 1078 | 1078 | ForceRightAdjust::Yes, |
| 1079 | 1079 | ), |
| 1080 | Arch::RiscV32 if target.llvm_abiname == "ilp32e" => { | |
| 1080 | Arch::RiscV32 if target.llvm_abiname == LlvmAbi::Ilp32e => { | |
| 1081 | 1081 | // FIXME: clang manually adjusts the alignment for this ABI. It notes: |
| 1082 | 1082 | // |
| 1083 | 1083 | // > 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}; |
| 47 | 47 | use rustc_span::Symbol; |
| 48 | 48 | use rustc_target::spec::crt_objects::CrtObjects; |
| 49 | 49 | use rustc_target::spec::{ |
| 50 | Abi, BinaryFormat, Cc, Env, LinkOutputKind, LinkSelfContainedComponents, | |
| 50 | BinaryFormat, Cc, CfgAbi, Env, LinkOutputKind, LinkSelfContainedComponents, | |
| 51 | 51 | LinkSelfContainedDefault, LinkerFeatures, LinkerFlavor, LinkerFlavorCli, Lld, Os, RelocModel, |
| 52 | 52 | RelroLevel, SanitizerSet, SplitDebuginfo, |
| 53 | 53 | }; |
| ... | ... | @@ -1917,7 +1917,7 @@ fn self_contained_components( |
| 1917 | 1917 | LinkSelfContainedDefault::InferredForMusl => sess.crt_static(Some(crate_type)), |
| 1918 | 1918 | LinkSelfContainedDefault::InferredForMingw => { |
| 1919 | 1919 | sess.host == sess.target |
| 1920 | && sess.target.abi != Abi::Uwp | |
| 1920 | && sess.target.cfg_abi != CfgAbi::Uwp | |
| 1921 | 1921 | && detect_self_contained_mingw(sess, linker) |
| 1922 | 1922 | } |
| 1923 | 1923 | } |
compiler/rustc_codegen_ssa/src/back/linker.rs+3-3| ... | ... | @@ -18,7 +18,7 @@ use rustc_middle::middle::exported_symbols::{ |
| 18 | 18 | use rustc_middle::ty::TyCtxt; |
| 19 | 19 | use rustc_session::Session; |
| 20 | 20 | use rustc_session::config::{self, CrateType, DebugInfo, LinkerPluginLto, Lto, OptLevel, Strip}; |
| 21 | use rustc_target::spec::{Abi, Arch, Cc, LinkOutputKind, LinkerFlavor, Lld, Os}; | |
| 21 | use rustc_target::spec::{Arch, Cc, CfgAbi, LinkOutputKind, LinkerFlavor, Lld, Os}; | |
| 22 | 22 | use tracing::{debug, warn}; |
| 23 | 23 | |
| 24 | 24 | use super::command::Command; |
| ... | ... | @@ -84,7 +84,7 @@ pub(crate) fn get_linker<'a>( |
| 84 | 84 | // To comply with the Windows App Certification Kit, |
| 85 | 85 | // MSVC needs to link with the Store versions of the runtime libraries (vcruntime, msvcrt, etc). |
| 86 | 86 | 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 { | |
| 88 | 88 | if let Some(ref tool) = msvc_tool { |
| 89 | 89 | let original_path = tool.path(); |
| 90 | 90 | if let Some(root_lib_path) = original_path.ancestors().nth(4) { |
| ... | ... | @@ -135,7 +135,7 @@ pub(crate) fn get_linker<'a>( |
| 135 | 135 | |
| 136 | 136 | // FIXME: Move `/LIBPATH` addition for uwp targets from the linker construction |
| 137 | 137 | // 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); | |
| 139 | 139 | match flavor { |
| 140 | 140 | LinkerFlavor::Unix(Cc::No) if sess.target.os == Os::L4Re => { |
| 141 | 141 | 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; |
| 20 | 20 | use rustc_middle::bug; |
| 21 | 21 | use rustc_session::Session; |
| 22 | 22 | use rustc_span::sym; |
| 23 | use rustc_target::spec::{Abi, Os, RelocModel, Target, ef_avr_arch}; | |
| 23 | use rustc_target::spec::{CfgAbi, LlvmAbi, Os, RelocModel, Target, ef_avr_arch}; | |
| 24 | 24 | use tracing::debug; |
| 25 | 25 | |
| 26 | 26 | use super::apple; |
| ... | ... | @@ -295,10 +295,10 @@ pub(super) fn elf_e_flags(architecture: Architecture, sess: &Session) -> u32 { |
| 295 | 295 | }; |
| 296 | 296 | |
| 297 | 297 | // 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 => {} | |
| 302 | 302 | // The rest is invalid (which is already ensured by the target spec check). |
| 303 | 303 | s => bug!("invalid LLVM ABI `{}` for MIPS target", s), |
| 304 | 304 | }; |
| ... | ... | @@ -336,12 +336,12 @@ pub(super) fn elf_e_flags(architecture: Architecture, sess: &Session) -> u32 { |
| 336 | 336 | |
| 337 | 337 | // Set the appropriate flag based on ABI |
| 338 | 338 | // 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, | |
| 343 | 343 | // 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, | |
| 345 | 345 | _ => bug!("unknown RISC-V ABI name"), |
| 346 | 346 | } |
| 347 | 347 | |
| ... | ... | @@ -353,10 +353,10 @@ pub(super) fn elf_e_flags(architecture: Architecture, sess: &Session) -> u32 { |
| 353 | 353 | |
| 354 | 354 | // Set the appropriate flag based on ABI |
| 355 | 355 | // 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, | |
| 360 | 360 | _ => bug!("unknown LoongArch ABI name"), |
| 361 | 361 | } |
| 362 | 362 | |
| ... | ... | @@ -372,7 +372,7 @@ pub(super) fn elf_e_flags(architecture: Architecture, sess: &Session) -> u32 { |
| 372 | 372 | } |
| 373 | 373 | } |
| 374 | 374 | Architecture::Csky => { |
| 375 | if matches!(sess.target.options.abi, Abi::AbiV2) { | |
| 375 | if matches!(sess.target.options.cfg_abi, CfgAbi::AbiV2) { | |
| 376 | 376 | elf::EF_CSKY_ABIV2 |
| 377 | 377 | } else { |
| 378 | 378 | elf::EF_CSKY_ABIV1 |
| ... | ... | @@ -383,14 +383,14 @@ pub(super) fn elf_e_flags(architecture: Architecture, sess: &Session) -> u32 { |
| 383 | 383 | const EF_PPC64_ABI_ELF_V1: u32 = 1; |
| 384 | 384 | const EF_PPC64_ABI_ELF_V2: u32 = 2; |
| 385 | 385 | |
| 386 | match sess.target.options.llvm_abiname.as_ref() { | |
| 386 | match sess.target.options.llvm_abiname { | |
| 387 | 387 | // If the flags do not correctly indicate the ABI, |
| 388 | 388 | // linkers such as ld.lld assume that the ppc64 object files are always ELFv2 |
| 389 | 389 | // 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"); | |
| 394 | 394 | } |
| 395 | 395 | // Fall back |
| 396 | 396 | _ => EF_PPC64_ABI_UNKNOWN, |
compiler/rustc_codegen_ssa/src/common.rs+2-2| ... | ... | @@ -7,7 +7,7 @@ use rustc_middle::ty::{self, Instance, TyCtxt}; |
| 7 | 7 | use rustc_middle::{bug, mir, span_bug}; |
| 8 | 8 | use rustc_session::cstore::{DllCallingConvention, DllImport, DllImportSymbolType}; |
| 9 | 9 | use rustc_span::Span; |
| 10 | use rustc_target::spec::{Abi, Env, Os, Target}; | |
| 10 | use rustc_target::spec::{CfgAbi, Env, Os, Target}; | |
| 11 | 11 | |
| 12 | 12 | use crate::traits::*; |
| 13 | 13 | |
| ... | ... | @@ -171,7 +171,7 @@ pub fn asm_const_to_str<'tcx>( |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | pub 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 | |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | pub 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 { |
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | 39 | 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) { | |
| 41 | 41 | Constness::NotConst |
| 42 | 42 | } else { |
| 43 | 43 | tcx.trait_def(tcx.local_parent(def_id)).constness |
compiler/rustc_feature/src/unstable.rs+1-1| ... | ... | @@ -473,7 +473,7 @@ declare_features! ( |
| 473 | 473 | /// Allows giving non-const impls custom diagnostic messages if attempted to be used as const |
| 474 | 474 | (unstable, diagnostic_on_const, "1.93.0", Some(143874)), |
| 475 | 475 | /// 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)), | |
| 477 | 477 | /// Allows `#[doc(cfg(...))]`. |
| 478 | 478 | (unstable, doc_cfg, "1.21.0", Some(43781)), |
| 479 | 479 | /// Allows `#[doc(masked)]`. |
compiler/rustc_hir/src/attrs/mod.rs+19-7| ... | ... | @@ -13,6 +13,15 @@ pub mod diagnostic; |
| 13 | 13 | mod encode_cross_crate; |
| 14 | 14 | mod pretty_printing; |
| 15 | 15 | |
| 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`. | |
| 21 | pub trait HasAttrs<'tcx, Tcx> { | |
| 22 | fn get_attrs(self, tcx: &Tcx) -> &'tcx [crate::Attribute]; | |
| 23 | } | |
| 24 | ||
| 16 | 25 | /// Finds attributes in sequences of attributes by pattern matching. |
| 17 | 26 | /// |
| 18 | 27 | /// A little like `matches` but for attributes. |
| ... | ... | @@ -34,10 +43,12 @@ mod pretty_printing; |
| 34 | 43 | /// |
| 35 | 44 | /// As a convenience, this macro can do that for you! |
| 36 | 45 | /// |
| 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`). | |
| 38 | 48 | /// |
| 39 | 49 | /// ```rust,ignore (illustrative) |
| 40 | 50 | /// find_attr!(tcx, def_id, <pattern>) |
| 51 | /// find_attr!(tcx, hir_id, <pattern>) | |
| 41 | 52 | /// ``` |
| 42 | 53 | /// |
| 43 | 54 | /// Another common case is finding attributes applied to the root of the current crate. |
| ... | ... | @@ -55,13 +66,14 @@ macro_rules! find_attr { |
| 55 | 66 | $crate::find_attr!($tcx.hir_krate_attrs(), $pattern $(if $guard)? => $e) |
| 56 | 67 | }; |
| 57 | 68 | |
| 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() | |
| 60 | 71 | }; |
| 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 | ) | |
| 65 | 77 | }}; |
| 66 | 78 | |
| 67 | 79 |
compiler/rustc_hir/src/def.rs+16-3| ... | ... | @@ -590,6 +590,13 @@ pub enum Res<Id = hir::HirId> { |
| 590 | 590 | /// **Belongs to the type namespace.** |
| 591 | 591 | ToolMod, |
| 592 | 592 | |
| 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 | ||
| 593 | 600 | // Macro namespace |
| 594 | 601 | /// An attribute that is *not* implemented via macro. |
| 595 | 602 | /// E.g., `#[inline]` and `#[rustfmt::skip]`, which are essentially directives, |
| ... | ... | @@ -838,6 +845,7 @@ impl<Id> Res<Id> { |
| 838 | 845 | | Res::SelfTyAlias { .. } |
| 839 | 846 | | Res::SelfCtor(..) |
| 840 | 847 | | Res::ToolMod |
| 848 | | Res::OpenMod(..) | |
| 841 | 849 | | Res::NonMacroAttr(..) |
| 842 | 850 | | Res::Err => None, |
| 843 | 851 | } |
| ... | ... | @@ -869,6 +877,7 @@ impl<Id> Res<Id> { |
| 869 | 877 | Res::Local(..) => "local variable", |
| 870 | 878 | Res::SelfTyParam { .. } | Res::SelfTyAlias { .. } => "self type", |
| 871 | 879 | Res::ToolMod => "tool module", |
| 880 | Res::OpenMod(..) => "namespaced crate", | |
| 872 | 881 | Res::NonMacroAttr(attr_kind) => attr_kind.descr(), |
| 873 | 882 | Res::Err => "unresolved item", |
| 874 | 883 | } |
| ... | ... | @@ -895,6 +904,7 @@ impl<Id> Res<Id> { |
| 895 | 904 | Res::SelfTyAlias { alias_to, is_trait_impl } |
| 896 | 905 | } |
| 897 | 906 | Res::ToolMod => Res::ToolMod, |
| 907 | Res::OpenMod(sym) => Res::OpenMod(sym), | |
| 898 | 908 | Res::NonMacroAttr(attr_kind) => Res::NonMacroAttr(attr_kind), |
| 899 | 909 | Res::Err => Res::Err, |
| 900 | 910 | } |
| ... | ... | @@ -911,6 +921,7 @@ impl<Id> Res<Id> { |
| 911 | 921 | Res::SelfTyAlias { alias_to, is_trait_impl } |
| 912 | 922 | } |
| 913 | 923 | Res::ToolMod => Res::ToolMod, |
| 924 | Res::OpenMod(sym) => Res::OpenMod(sym), | |
| 914 | 925 | Res::NonMacroAttr(attr_kind) => Res::NonMacroAttr(attr_kind), |
| 915 | 926 | Res::Err => Res::Err, |
| 916 | 927 | }) |
| ... | ... | @@ -936,9 +947,11 @@ impl<Id> Res<Id> { |
| 936 | 947 | pub fn ns(&self) -> Option<Namespace> { |
| 937 | 948 | match self { |
| 938 | 949 | 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), | |
| 942 | 955 | Res::SelfCtor(..) | Res::Local(..) => Some(Namespace::ValueNS), |
| 943 | 956 | Res::NonMacroAttr(..) => Some(Namespace::MacroNS), |
| 944 | 957 | Res::Err => None, |
compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs+1| ... | ... | @@ -2830,6 +2830,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { |
| 2830 | 2830 | | Res::SelfCtor(_) |
| 2831 | 2831 | | Res::Local(_) |
| 2832 | 2832 | | Res::ToolMod |
| 2833 | | Res::OpenMod(..) | |
| 2833 | 2834 | | Res::NonMacroAttr(_) |
| 2834 | 2835 | | Res::Err) => Const::new_error_with_message( |
| 2835 | 2836 | tcx, |
compiler/rustc_hir_typeck/src/loops.rs+2-2| ... | ... | @@ -207,7 +207,7 @@ impl<'hir> Visitor<'hir> for CheckLoopVisitor<'hir> { |
| 207 | 207 | }; |
| 208 | 208 | |
| 209 | 209 | // 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(_)) { | |
| 211 | 211 | let Some(label) = break_destination.label else { |
| 212 | 212 | let span = e.span; |
| 213 | 213 | self.tcx.dcx().emit_fatal(ConstContinueBadLabel { span }); |
| ... | ... | @@ -420,7 +420,7 @@ impl<'hir> CheckLoopVisitor<'hir> { |
| 420 | 420 | e: &'hir hir::Expr<'hir>, |
| 421 | 421 | body: &'hir hir::Block<'hir>, |
| 422 | 422 | ) -> Option<Destination> { |
| 423 | if !find_attr!(self.tcx.hir_attrs(e.hir_id), LoopMatch(_)) { | |
| 423 | if !find_attr!(self.tcx, e.hir_id, LoopMatch(_)) { | |
| 424 | 424 | return None; |
| 425 | 425 | } |
| 426 | 426 |
compiler/rustc_interface/src/proc_macro_decls.rs+1-1| ... | ... | @@ -7,7 +7,7 @@ fn proc_macro_decls_static(tcx: TyCtxt<'_>, (): ()) -> Option<LocalDefId> { |
| 7 | 7 | let mut decls = None; |
| 8 | 8 | |
| 9 | 9 | 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) { | |
| 11 | 11 | decls = Some(id.owner_id.def_id); |
| 12 | 12 | } |
| 13 | 13 | } |
compiler/rustc_metadata/src/native_libs.rs+3-3| ... | ... | @@ -19,7 +19,7 @@ use rustc_session::cstore::{ |
| 19 | 19 | use rustc_session::search_paths::PathKind; |
| 20 | 20 | use rustc_span::Symbol; |
| 21 | 21 | use rustc_span::def_id::{DefId, LOCAL_CRATE}; |
| 22 | use rustc_target::spec::{Abi, Arch, BinaryFormat, Env, LinkSelfContainedComponents, Os}; | |
| 22 | use rustc_target::spec::{Arch, BinaryFormat, CfgAbi, Env, LinkSelfContainedComponents, Os}; | |
| 23 | 23 | |
| 24 | 24 | use crate::errors; |
| 25 | 25 | |
| ... | ... | @@ -73,14 +73,14 @@ pub fn walk_native_lib_search_dirs<R>( |
| 73 | 73 | // FIXME: On AIX this also has the side-effect of making the list of library search paths |
| 74 | 74 | // non-empty, which is needed or the linker may decide to record the LIBPATH env, if |
| 75 | 75 | // 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 | |
| 77 | 77 | || sess.target.os == Os::Linux |
| 78 | 78 | || sess.target.os == Os::Fuchsia |
| 79 | 79 | || sess.target.is_like_aix |
| 80 | 80 | || sess.target.is_like_darwin && !sess.sanitizers().is_empty() |
| 81 | 81 | || sess.target.os == Os::Windows |
| 82 | 82 | && sess.target.env == Env::Gnu |
| 83 | && sess.target.abi == Abi::Llvm | |
| 83 | && sess.target.cfg_abi == CfgAbi::Llvm | |
| 84 | 84 | { |
| 85 | 85 | f(&sess.target_tlib_path.dir, false)?; |
| 86 | 86 | } |
compiler/rustc_middle/src/dep_graph/graph.rs+40-23| ... | ... | @@ -164,9 +164,10 @@ impl DepGraph { |
| 164 | 164 | ); |
| 165 | 165 | assert_eq!(red_node_index, DepNodeIndex::FOREVER_RED_NODE); |
| 166 | 166 | 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); | |
| 170 | 171 | } |
| 171 | 172 | |
| 172 | 173 | DepGraph { |
| ... | ... | @@ -1415,28 +1416,29 @@ impl DepNodeColorMap { |
| 1415 | 1416 | if value <= DepNodeIndex::MAX_AS_U32 { Some(DepNodeIndex::from_u32(value)) } else { None } |
| 1416 | 1417 | } |
| 1417 | 1418 | |
| 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. | |
| 1420 | 1421 | /// |
| 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. | |
| 1424 | 1424 | #[inline(always)] |
| 1425 | pub(super) fn try_mark( | |
| 1425 | pub(super) fn try_set_color( | |
| 1426 | 1426 | &self, |
| 1427 | 1427 | 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( | |
| 1433 | 1431 | 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 | }, | |
| 1435 | 1436 | Ordering::Relaxed, |
| 1436 | 1437 | Ordering::Relaxed, |
| 1437 | 1438 | ) { |
| 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) }, | |
| 1440 | 1442 | } |
| 1441 | 1443 | } |
| 1442 | 1444 | |
| ... | ... | @@ -1454,13 +1456,28 @@ impl DepNodeColorMap { |
| 1454 | 1456 | DepNodeColor::Unknown |
| 1455 | 1457 | } |
| 1456 | 1458 | } |
| 1459 | } | |
| 1457 | 1460 | |
| 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)] | |
| 1463 | pub(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)] | |
| 1473 | pub(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 }, | |
| 1464 | 1481 | } |
| 1465 | 1482 | |
| 1466 | 1483 | #[inline(never)] |
compiler/rustc_middle/src/dep_graph/serialized.rs+15-12| ... | ... | @@ -43,7 +43,7 @@ use std::cell::RefCell; |
| 43 | 43 | use std::cmp::max; |
| 44 | 44 | use std::sync::Arc; |
| 45 | 45 | use std::sync::atomic::Ordering; |
| 46 | use std::{iter, mem, u64}; | |
| 46 | use std::{iter, mem}; | |
| 47 | 47 | |
| 48 | 48 | use rustc_data_structures::fingerprint::{Fingerprint, PackedFingerprint}; |
| 49 | 49 | use rustc_data_structures::fx::FxHashMap; |
| ... | ... | @@ -58,7 +58,7 @@ use rustc_serialize::{Decodable, Decoder, Encodable, Encoder}; |
| 58 | 58 | use rustc_session::Session; |
| 59 | 59 | use tracing::{debug, instrument}; |
| 60 | 60 | |
| 61 | use super::graph::{CurrentDepGraph, DepNodeColorMap}; | |
| 61 | use super::graph::{CurrentDepGraph, DepNodeColorMap, DesiredColor, TrySetColorResult}; | |
| 62 | 62 | use super::retained::RetainedDepGraph; |
| 63 | 63 | use super::{DepKind, DepNode, DepNodeIndex}; |
| 64 | 64 | use crate::dep_graph::edges::EdgesVec; |
| ... | ... | @@ -905,13 +905,14 @@ impl GraphEncoder { |
| 905 | 905 | let mut local = self.status.local.borrow_mut(); |
| 906 | 906 | |
| 907 | 907 | let index = self.status.next_index(&mut *local); |
| 908 | let color = if is_green { DesiredColor::Green { index } } else { DesiredColor::Red }; | |
| 908 | 909 | |
| 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 | |
| 910 | 911 | // 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, | |
| 915 | 916 | } |
| 916 | 917 | |
| 917 | 918 | self.status.bump_index(&mut *local); |
| ... | ... | @@ -923,7 +924,8 @@ impl GraphEncoder { |
| 923 | 924 | /// from the previous dep graph and expects all edges to already have a new dep node index |
| 924 | 925 | /// assigned. |
| 925 | 926 | /// |
| 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. | |
| 927 | 929 | #[inline] |
| 928 | 930 | pub(crate) fn send_promoted( |
| 929 | 931 | &self, |
| ... | ... | @@ -935,10 +937,10 @@ impl GraphEncoder { |
| 935 | 937 | let mut local = self.status.local.borrow_mut(); |
| 936 | 938 | let index = self.status.next_index(&mut *local); |
| 937 | 939 | |
| 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` | |
| 939 | 941 | // 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 => { | |
| 942 | 944 | self.status.bump_index(&mut *local); |
| 943 | 945 | self.status.encode_promoted_node( |
| 944 | 946 | index, |
| ... | ... | @@ -949,7 +951,8 @@ impl GraphEncoder { |
| 949 | 951 | ); |
| 950 | 952 | Some(index) |
| 951 | 953 | } |
| 952 | Err(dep_node_index) => dep_node_index, | |
| 954 | TrySetColorResult::AlreadyRed => None, | |
| 955 | TrySetColorResult::AlreadyGreen { index } => Some(index), | |
| 953 | 956 | } |
| 954 | 957 | } |
| 955 | 958 |
compiler/rustc_middle/src/ty/mod.rs+30| ... | ... | @@ -2172,6 +2172,36 @@ impl<'tcx> TyCtxt<'tcx> { |
| 2172 | 2172 | } |
| 2173 | 2173 | } |
| 2174 | 2174 | |
| 2175 | // `HasAttrs` impls: allow `find_attr!(tcx, id, ...)` to work with both DefId-like types and HirId. | |
| 2176 | ||
| 2177 | impl<'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 | ||
| 2187 | impl<'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 | ||
| 2193 | impl<'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 | ||
| 2199 | impl<'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 | ||
| 2175 | 2205 | pub fn provide(providers: &mut Providers) { |
| 2176 | 2206 | closure::provide(providers); |
| 2177 | 2207 | context::provide(providers); |
compiler/rustc_mir_build/src/builder/mod.rs+1-1| ... | ... | @@ -491,7 +491,7 @@ fn construct_fn<'tcx>( |
| 491 | 491 | }; |
| 492 | 492 | |
| 493 | 493 | 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)) | |
| 495 | 495 | { |
| 496 | 496 | return custom::build_custom_mir( |
| 497 | 497 | tcx, |
compiler/rustc_mir_build/src/thir/cx/expr.rs+2-2| ... | ... | @@ -917,7 +917,7 @@ impl<'tcx> ThirBuildCx<'tcx> { |
| 917 | 917 | hir::ExprKind::Ret(v) => ExprKind::Return { value: v.map(|v| self.mirror_expr(v)) }, |
| 918 | 918 | hir::ExprKind::Become(call) => ExprKind::Become { value: self.mirror_expr(call) }, |
| 919 | 919 | 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(_)) { | |
| 921 | 921 | match dest.target_id { |
| 922 | 922 | Ok(target_id) => { |
| 923 | 923 | let (Some(value), Some(_)) = (value, dest.label) else { |
| ... | ... | @@ -982,7 +982,7 @@ impl<'tcx> ThirBuildCx<'tcx> { |
| 982 | 982 | match_source, |
| 983 | 983 | }, |
| 984 | 984 | 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(_)) { | |
| 986 | 986 | let dcx = self.tcx.dcx(); |
| 987 | 987 | |
| 988 | 988 | // 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> { |
| 104 | 104 | typing_env: ty::TypingEnv::non_body_analysis(tcx, def), |
| 105 | 105 | typeck_results, |
| 106 | 106 | 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(..)), | |
| 108 | 108 | } |
| 109 | 109 | } |
| 110 | 110 |
compiler/rustc_passes/src/dead.rs+1-1| ... | ... | @@ -157,7 +157,7 @@ impl<'tcx> MarkSymbolVisitor<'tcx> { |
| 157 | 157 | Res::Def(_, def_id) => self.check_def_id(def_id), |
| 158 | 158 | Res::SelfTyParam { trait_: t } => self.check_def_id(t), |
| 159 | 159 | 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 => {} | |
| 161 | 161 | } |
| 162 | 162 | } |
| 163 | 163 |
compiler/rustc_privacy/src/lib.rs+3-2| ... | ... | @@ -1595,13 +1595,14 @@ impl<'tcx> PrivateItemsInPublicInterfacesChecker<'_, 'tcx> { |
| 1595 | 1595 | let mut check = self.check(item.def_id.expect_local(), vis, effective_vis); |
| 1596 | 1596 | |
| 1597 | 1597 | 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; | |
| 1599 | 1599 | check.generics().predicates(); |
| 1600 | 1600 | if assoc_has_type_of(self.tcx, item) { |
| 1601 | check.hard_error = check.hard_error && item.defaultness(self.tcx).has_value(); | |
| 1602 | 1601 | check.ty(); |
| 1603 | 1602 | } |
| 1604 | 1603 | 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. | |
| 1605 | 1606 | check.hard_error = false; |
| 1606 | 1607 | check.bounds(); |
| 1607 | 1608 | } |
compiler/rustc_resolve/src/build_reduced_graph.rs+1| ... | ... | @@ -357,6 +357,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 357 | 357 | | Res::SelfTyParam { .. } |
| 358 | 358 | | Res::SelfTyAlias { .. } |
| 359 | 359 | | Res::SelfCtor(..) |
| 360 | | Res::OpenMod(..) | |
| 360 | 361 | | Res::Err => bug!("unexpected resolution: {:?}", res), |
| 361 | 362 | } |
| 362 | 363 | } |
compiler/rustc_resolve/src/diagnostics.rs+4-3| ... | ... | @@ -1740,8 +1740,8 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 1740 | 1740 | Res::Def(DefKind::Macro(kinds), _) => { |
| 1741 | 1741 | format!("{} {}", kinds.article(), kinds.descr()) |
| 1742 | 1742 | } |
| 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. | |
| 1745 | 1745 | continue; |
| 1746 | 1746 | } |
| 1747 | 1747 | Res::Def(DefKind::Trait, _) if macro_kind == MacroKind::Derive => { |
| ... | ... | @@ -1978,7 +1978,8 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 1978 | 1978 | let (built_in, from) = match scope { |
| 1979 | 1979 | Scope::StdLibPrelude | Scope::MacroUsePrelude => ("", " from prelude"), |
| 1980 | 1980 | 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(..)) => | |
| 1982 | 1983 | { |
| 1983 | 1984 | ("", " passed with `--extern`") |
| 1984 | 1985 | } |
compiler/rustc_resolve/src/ident.rs+13-3| ... | ... | @@ -26,7 +26,7 @@ use crate::{ |
| 26 | 26 | AmbiguityError, AmbiguityKind, AmbiguityWarning, BindingKey, CmResolver, Decl, DeclKind, |
| 27 | 27 | Determinacy, Finalize, IdentKey, ImportKind, LateDecl, Module, ModuleKind, ModuleOrUniformRoot, |
| 28 | 28 | ParentScope, PathResult, PrivacyError, Res, ResolutionError, Resolver, Scope, ScopeSet, |
| 29 | Segment, Stage, Used, errors, | |
| 29 | Segment, Stage, Symbol, Used, errors, | |
| 30 | 30 | }; |
| 31 | 31 | |
| 32 | 32 | #[derive(Copy, Clone)] |
| ... | ... | @@ -386,7 +386,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 386 | 386 | } |
| 387 | 387 | |
| 388 | 388 | /// Resolve an identifier in the specified set of scopes. |
| 389 | #[instrument(level = "debug", skip(self))] | |
| 390 | 389 | pub(crate) fn resolve_ident_in_scope_set<'r>( |
| 391 | 390 | self: CmResolver<'r, 'ra, 'tcx>, |
| 392 | 391 | orig_ident: Ident, |
| ... | ... | @@ -976,6 +975,14 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 976 | 975 | ignore_import, |
| 977 | 976 | ) |
| 978 | 977 | } |
| 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 | } | |
| 979 | 986 | ModuleOrUniformRoot::ModuleAndExternPrelude(module) => self.resolve_ident_in_scope_set( |
| 980 | 987 | ident, |
| 981 | 988 | ScopeSet::ModuleAndExternPrelude(ns, module), |
| ... | ... | @@ -1962,7 +1969,10 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 1962 | 1969 | } |
| 1963 | 1970 | |
| 1964 | 1971 | 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() { | |
| 1966 | 1976 | if self.mods_with_parse_errors.contains(&def_id) { |
| 1967 | 1977 | module_had_parse_errors = true; |
| 1968 | 1978 | } |
compiler/rustc_resolve/src/imports.rs+1-1| ... | ... | @@ -41,7 +41,7 @@ type Res = def::Res<NodeId>; |
| 41 | 41 | |
| 42 | 42 | /// A potential import declaration in the process of being planted into a module. |
| 43 | 43 | /// 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)] | |
| 45 | 45 | pub(crate) enum PendingDecl<'ra> { |
| 46 | 46 | Ready(Option<Decl<'ra>>), |
| 47 | 47 | #[default] |
compiler/rustc_resolve/src/late/diagnostics.rs+1-1| ... | ... | @@ -3381,7 +3381,7 @@ impl<'ast, 'ra, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> { |
| 3381 | 3381 | && def_id.is_local() |
| 3382 | 3382 | && let Some(local_def_id) = def_id.as_local() |
| 3383 | 3383 | && 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) | |
| 3385 | 3385 | && let GenericParamKind::Const { ty, .. } = &target_param.kind |
| 3386 | 3386 | && let TyKind::Path(_, path) = &ty.kind |
| 3387 | 3387 | { |
compiler/rustc_resolve/src/lib.rs+101-43| ... | ... | @@ -61,6 +61,7 @@ use rustc_hir::definitions::DisambiguatorState; |
| 61 | 61 | use rustc_hir::{PrimTy, TraitCandidate, find_attr}; |
| 62 | 62 | use rustc_index::bit_set::DenseBitSet; |
| 63 | 63 | use rustc_metadata::creader::CStore; |
| 64 | use rustc_middle::bug; | |
| 64 | 65 | use rustc_middle::metadata::{AmbigModChild, ModChild, Reexport}; |
| 65 | 66 | use rustc_middle::middle::privacy::EffectiveVisibilities; |
| 66 | 67 | use rustc_middle::query::Providers; |
| ... | ... | @@ -445,6 +446,11 @@ enum ModuleOrUniformRoot<'ra> { |
| 445 | 446 | /// Used only for resolving single-segment imports. The reason it exists is that import paths |
| 446 | 447 | /// are always split into two parts, the first of which should be some kind of module. |
| 447 | 448 | 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), | |
| 448 | 454 | } |
| 449 | 455 | |
| 450 | 456 | #[derive(Debug)] |
| ... | ... | @@ -1105,13 +1111,20 @@ impl<'ra> DeclData<'ra> { |
| 1105 | 1111 | } |
| 1106 | 1112 | } |
| 1107 | 1113 | |
| 1114 | #[derive(Debug)] | |
| 1108 | 1115 | struct ExternPreludeEntry<'ra> { |
| 1109 | 1116 | /// Name declaration from an `extern crate` item. |
| 1110 | 1117 | /// The boolean flag is true is `item_decl` is non-redundant, happens either when |
| 1111 | 1118 | /// `flag_decl` is `None`, or when `extern crate` introducing `item_decl` used renaming. |
| 1112 | 1119 | item_decl: Option<(Decl<'ra>, Span, /* introduced by item */ bool)>, |
| 1113 | 1120 | /// 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 | >, | |
| 1115 | 1128 | } |
| 1116 | 1129 | |
| 1117 | 1130 | impl ExternPreludeEntry<'_> { |
| ... | ... | @@ -1122,7 +1135,14 @@ impl ExternPreludeEntry<'_> { |
| 1122 | 1135 | fn flag() -> Self { |
| 1123 | 1136 | ExternPreludeEntry { |
| 1124 | 1137 | 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))), | |
| 1126 | 1146 | } |
| 1127 | 1147 | } |
| 1128 | 1148 | |
| ... | ... | @@ -1643,35 +1663,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 1643 | 1663 | let mut invocation_parents = FxHashMap::default(); |
| 1644 | 1664 | invocation_parents.insert(LocalExpnId::ROOT, InvocationParent::ROOT); |
| 1645 | 1665 | |
| 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); | |
| 1675 | 1667 | let registered_tools = tcx.registered_tools(()); |
| 1676 | 1668 | let edition = tcx.sess.edition(); |
| 1677 | 1669 | |
| ... | ... | @@ -2326,10 +2318,10 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 2326 | 2318 | ) -> Option<Decl<'ra>> { |
| 2327 | 2319 | let entry = self.extern_prelude.get(&ident); |
| 2328 | 2320 | 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(); | |
| 2330 | 2322 | let decl = match pending_decl { |
| 2331 | 2323 | PendingDecl::Ready(decl) => { |
| 2332 | if finalize && !finalized { | |
| 2324 | if finalize && !finalized && !is_open { | |
| 2333 | 2325 | self.cstore_mut().process_path_extern( |
| 2334 | 2326 | self.tcx, |
| 2335 | 2327 | ident.name, |
| ... | ... | @@ -2340,18 +2332,28 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 2340 | 2332 | } |
| 2341 | 2333 | PendingDecl::Pending => { |
| 2342 | 2334 | 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)) | |
| 2345 | 2338 | } 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 | } | |
| 2352 | 2354 | } |
| 2353 | 2355 | }; |
| 2354 | flag_decl.set((PendingDecl::Ready(decl), finalize || finalized)); | |
| 2356 | flag_decl.set((PendingDecl::Ready(decl), finalize || finalized, is_open)); | |
| 2355 | 2357 | decl.or_else(|| finalize.then_some(self.dummy_decl)) |
| 2356 | 2358 | }) |
| 2357 | 2359 | } |
| ... | ... | @@ -2393,7 +2395,9 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 2393 | 2395 | PathResult::Module(ModuleOrUniformRoot::ExternPrelude) | PathResult::Failed { .. } => { |
| 2394 | 2396 | None |
| 2395 | 2397 | } |
| 2396 | PathResult::Module(..) | PathResult::Indeterminate => unreachable!(), | |
| 2398 | path_result @ (PathResult::Module(..) | PathResult::Indeterminate) => { | |
| 2399 | bug!("got invalid path_result: {path_result:?}") | |
| 2400 | } | |
| 2397 | 2401 | } |
| 2398 | 2402 | } |
| 2399 | 2403 | |
| ... | ... | @@ -2511,6 +2515,60 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 2511 | 2515 | } |
| 2512 | 2516 | } |
| 2513 | 2517 | |
| 2518 | fn 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 | ||
| 2514 | 2572 | fn names_to_string(names: impl Iterator<Item = Symbol>) -> String { |
| 2515 | 2573 | let mut result = String::new(); |
| 2516 | 2574 | 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 { |
| 239 | 239 | ins_none!(sym::sanitizer_cfi_normalize_integers); |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | ins_sym!(sym::target_abi, sess.target.abi.desc_symbol()); | |
| 242 | ins_sym!(sym::target_abi, sess.target.cfg_abi.desc_symbol()); | |
| 243 | 243 | ins_sym!(sym::target_arch, sess.target.arch.desc_symbol()); |
| 244 | 244 | ins_str!(sym::target_endian, sess.target.endian.as_str()); |
| 245 | 245 | ins_sym!(sym::target_env, sess.target.env.desc_symbol()); |
| ... | ... | @@ -447,7 +447,7 @@ impl CheckCfg { |
| 447 | 447 | }; |
| 448 | 448 | |
| 449 | 449 | 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()); | |
| 451 | 451 | values_target_arch.insert(target.arch.desc_symbol()); |
| 452 | 452 | values_target_endian.insert(Symbol::intern(target.options.endian.as_str())); |
| 453 | 453 | 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>( |
| 43 | 43 | } |
| 44 | 44 | }; |
| 45 | 45 | |
| 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 | ||
| 46 | 53 | if !valid_crate_name(&crate_name, unstable_opts) { |
| 47 | 54 | let mut error = early_dcx.early_struct_fatal(format!( |
| 48 | 55 | "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}; |
| 5 | 5 | use rustc_macros::{Decodable, Encodable, HashStable_Generic}; |
| 6 | 6 | use rustc_span::Symbol; |
| 7 | 7 | |
| 8 | use crate::spec::{Abi, Arch, RelocModel, Target}; | |
| 8 | use crate::spec::{Arch, CfgAbi, RelocModel, Target}; | |
| 9 | 9 | |
| 10 | 10 | pub struct ModifierInfo { |
| 11 | 11 | pub modifier: char, |
| ... | ... | @@ -1001,7 +1001,7 @@ impl InlineAsmClobberAbi { |
| 1001 | 1001 | _ => Err(&["C", "system", "efiapi"]), |
| 1002 | 1002 | }, |
| 1003 | 1003 | 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 { | |
| 1005 | 1005 | InlineAsmClobberAbi::PowerPCSPE |
| 1006 | 1006 | } else { |
| 1007 | 1007 | InlineAsmClobberAbi::PowerPC |
compiler/rustc_target/src/asm/powerpc.rs+9-5| ... | ... | @@ -4,7 +4,7 @@ use rustc_data_structures::fx::FxIndexSet; |
| 4 | 4 | use rustc_span::Symbol; |
| 5 | 5 | |
| 6 | 6 | use super::{InlineAsmArch, InlineAsmType, ModifierInfo}; |
| 7 | use crate::spec::{Abi, RelocModel, Target}; | |
| 7 | use crate::spec::{CfgAbi, RelocModel, Target}; | |
| 8 | 8 | |
| 9 | 9 | def_reg_class! { |
| 10 | 10 | PowerPC PowerPCInlineAsmRegClass { |
| ... | ... | @@ -105,9 +105,9 @@ fn reserved_v20to31( |
| 105 | 105 | _is_clobber: bool, |
| 106 | 106 | ) -> Result<(), &'static str> { |
| 107 | 107 | 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(()), | |
| 111 | 111 | abi => unreachable!("unrecognized AIX ABI: {abi}"), |
| 112 | 112 | } |
| 113 | 113 | } else { |
| ... | ... | @@ -122,7 +122,11 @@ fn spe_acc_target_check( |
| 122 | 122 | target: &Target, |
| 123 | 123 | _is_clobber: bool, |
| 124 | 124 | ) -> 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 | } | |
| 126 | 130 | } |
| 127 | 131 | |
| 128 | 132 | def_regs! { |
compiler/rustc_target/src/callconv/loongarch.rs+4-4| ... | ... | @@ -4,7 +4,7 @@ use rustc_abi::{ |
| 4 | 4 | }; |
| 5 | 5 | |
| 6 | 6 | use crate::callconv::{ArgAbi, ArgExtension, CastTarget, FnAbi, PassMode, Uniform}; |
| 7 | use crate::spec::HasTargetSpec; | |
| 7 | use crate::spec::{HasTargetSpec, LlvmAbi}; | |
| 8 | 8 | |
| 9 | 9 | #[derive(Copy, Clone)] |
| 10 | 10 | enum RegPassKind { |
| ... | ... | @@ -415,9 +415,9 @@ where |
| 415 | 415 | C: HasDataLayout + HasTargetSpec, |
| 416 | 416 | { |
| 417 | 417 | 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, | |
| 421 | 421 | _ => 0, |
| 422 | 422 | }; |
| 423 | 423 |
compiler/rustc_target/src/callconv/powerpc64.rs+3-3| ... | ... | @@ -5,7 +5,7 @@ |
| 5 | 5 | use rustc_abi::{Endian, HasDataLayout, TyAbiInterface}; |
| 6 | 6 | |
| 7 | 7 | use crate::callconv::{Align, ArgAbi, FnAbi, Reg, RegKind, Uniform}; |
| 8 | use crate::spec::{HasTargetSpec, Os}; | |
| 8 | use crate::spec::{HasTargetSpec, LlvmAbi, Os}; | |
| 9 | 9 | |
| 10 | 10 | #[derive(Debug, Clone, Copy, PartialEq)] |
| 11 | 11 | enum ABI { |
| ... | ... | @@ -106,9 +106,9 @@ where |
| 106 | 106 | Ty: TyAbiInterface<'a, C> + Copy, |
| 107 | 107 | C: HasDataLayout + HasTargetSpec, |
| 108 | 108 | { |
| 109 | let abi = if cx.target_spec().options.llvm_abiname == "elfv2" { | |
| 109 | let abi = if cx.target_spec().options.llvm_abiname == LlvmAbi::ElfV2 { | |
| 110 | 110 | ELFv2 |
| 111 | } else if cx.target_spec().options.llvm_abiname == "elfv1" { | |
| 111 | } else if cx.target_spec().options.llvm_abiname == LlvmAbi::ElfV1 { | |
| 112 | 112 | ELFv1 |
| 113 | 113 | } else if cx.target_spec().os == Os::Aix { |
| 114 | 114 | AIX |
compiler/rustc_target/src/callconv/riscv.rs+4-4| ... | ... | @@ -10,7 +10,7 @@ use rustc_abi::{ |
| 10 | 10 | }; |
| 11 | 11 | |
| 12 | 12 | use crate::callconv::{ArgAbi, ArgExtension, CastTarget, FnAbi, PassMode, Uniform}; |
| 13 | use crate::spec::HasTargetSpec; | |
| 13 | use crate::spec::{HasTargetSpec, LlvmAbi}; | |
| 14 | 14 | |
| 15 | 15 | #[derive(Copy, Clone)] |
| 16 | 16 | enum RegPassKind { |
| ... | ... | @@ -419,9 +419,9 @@ where |
| 419 | 419 | Ty: TyAbiInterface<'a, C> + Copy, |
| 420 | 420 | C: HasDataLayout + HasTargetSpec, |
| 421 | 421 | { |
| 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, | |
| 425 | 425 | _ => 0, |
| 426 | 426 | }; |
| 427 | 427 | let xlen = cx.data_layout().pointer_size().bits(); |
compiler/rustc_target/src/spec/base/aix.rs+3-3| ... | ... | @@ -1,13 +1,13 @@ |
| 1 | 1 | use rustc_abi::Endian; |
| 2 | 2 | |
| 3 | 3 | use 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, | |
| 6 | 6 | }; |
| 7 | 7 | |
| 8 | 8 | pub(crate) fn opts() -> TargetOptions { |
| 9 | 9 | TargetOptions { |
| 10 | abi: Abi::VecExtAbi, | |
| 10 | cfg_abi: CfgAbi::VecExtAbi, | |
| 11 | 11 | code_model: Some(CodeModel::Large), |
| 12 | 12 | cpu: "pwr7".into(), |
| 13 | 13 | os: Os::Aix, |
compiler/rustc_target/src/spec/base/apple/mod.rs+6-6| ... | ... | @@ -4,7 +4,7 @@ use std::num::ParseIntError; |
| 4 | 4 | use std::str::FromStr; |
| 5 | 5 | |
| 6 | 6 | use crate::spec::{ |
| 7 | Abi, BinaryFormat, Cc, DebuginfoKind, Env, FloatAbi, FramePointer, LinkerFlavor, Lld, Os, | |
| 7 | BinaryFormat, Cc, CfgAbi, DebuginfoKind, Env, FloatAbi, FramePointer, LinkerFlavor, Lld, Os, | |
| 8 | 8 | RustcAbi, SplitDebuginfo, StackProbeType, StaticCow, Target, TargetOptions, cvs, |
| 9 | 9 | }; |
| 10 | 10 | |
| ... | ... | @@ -108,11 +108,11 @@ impl TargetEnv { |
| 108 | 108 | // |
| 109 | 109 | // But let's continue setting them for backwards compatibility. |
| 110 | 110 | // FIXME(madsmtm): Warn about using these in the future. |
| 111 | fn target_abi(self) -> Abi { | |
| 111 | fn target_abi(self) -> CfgAbi { | |
| 112 | 112 | 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, | |
| 116 | 116 | } |
| 117 | 117 | } |
| 118 | 118 | } |
| ... | ... | @@ -135,7 +135,7 @@ pub(crate) fn base( |
| 135 | 135 | }, |
| 136 | 136 | os, |
| 137 | 137 | env: env.target_env(), |
| 138 | abi: env.target_abi(), | |
| 138 | cfg_abi: env.target_abi(), | |
| 139 | 139 | cpu: arch.target_cpu(env).into(), |
| 140 | 140 | link_env_remove, |
| 141 | 141 | vendor: "apple".into(), |
compiler/rustc_target/src/spec/base/apple/tests.rs+2-2| ... | ... | @@ -4,7 +4,7 @@ use crate::spec::targets::{ |
| 4 | 4 | aarch64_apple_watchos_sim, i686_apple_darwin, x86_64_apple_darwin, x86_64_apple_ios, |
| 5 | 5 | x86_64_apple_tvos, x86_64_apple_watchos_sim, |
| 6 | 6 | }; |
| 7 | use crate::spec::{Abi, Env}; | |
| 7 | use crate::spec::{CfgAbi, Env}; | |
| 8 | 8 | |
| 9 | 9 | #[test] |
| 10 | 10 | fn simulator_targets_set_env() { |
| ... | ... | @@ -21,7 +21,7 @@ fn simulator_targets_set_env() { |
| 21 | 21 | for target in &all_sim_targets { |
| 22 | 22 | assert_eq!(target.env, Env::Sim); |
| 23 | 23 | // Ensure backwards compat |
| 24 | assert_eq!(target.abi, Abi::Sim); | |
| 24 | assert_eq!(target.cfg_abi, CfgAbi::Sim); | |
| 25 | 25 | } |
| 26 | 26 | } |
| 27 | 27 |
compiler/rustc_target/src/spec/base/windows_gnullvm.rs+2-2| ... | ... | @@ -2,7 +2,7 @@ use std::borrow::Cow; |
| 2 | 2 | |
| 3 | 3 | use crate::spec::crt_objects::pre_mingw_self_contained; |
| 4 | 4 | use crate::spec::{ |
| 5 | Abi, BinaryFormat, Cc, DebuginfoKind, Env, LinkSelfContainedDefault, LinkerFlavor, Lld, Os, | |
| 5 | BinaryFormat, Cc, CfgAbi, DebuginfoKind, Env, LinkSelfContainedDefault, LinkerFlavor, Lld, Os, | |
| 6 | 6 | SplitDebuginfo, TargetOptions, add_link_args, cvs, |
| 7 | 7 | }; |
| 8 | 8 | |
| ... | ... | @@ -26,7 +26,7 @@ pub(crate) fn opts() -> TargetOptions { |
| 26 | 26 | os: Os::Windows, |
| 27 | 27 | env: Env::Gnu, |
| 28 | 28 | vendor: "pc".into(), |
| 29 | abi: Abi::Llvm, | |
| 29 | cfg_abi: CfgAbi::Llvm, | |
| 30 | 30 | linker: Some("clang".into()), |
| 31 | 31 | dynamic_linking: true, |
| 32 | 32 | dll_tls_export: false, |
compiler/rustc_target/src/spec/base/windows_uwp_gnu.rs+2-2| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | use crate::spec::{Abi, Cc, LinkArgs, LinkerFlavor, Lld, TargetOptions, add_link_args, base}; | |
| 1 | use crate::spec::{Cc, CfgAbi, LinkArgs, LinkerFlavor, Lld, TargetOptions, add_link_args, base}; | |
| 2 | 2 | |
| 3 | 3 | pub(crate) fn opts() -> TargetOptions { |
| 4 | 4 | let base = base::windows_gnu::opts(); |
| ... | ... | @@ -23,7 +23,7 @@ pub(crate) fn opts() -> TargetOptions { |
| 23 | 23 | let late_link_args_static = LinkArgs::new(); |
| 24 | 24 | |
| 25 | 25 | TargetOptions { |
| 26 | abi: Abi::Uwp, | |
| 26 | cfg_abi: CfgAbi::Uwp, | |
| 27 | 27 | vendor: "uwp".into(), |
| 28 | 28 | limit_rdylib_exports: false, |
| 29 | 29 | late_link_args, |
compiler/rustc_target/src/spec/base/windows_uwp_msvc.rs+2-2| ... | ... | @@ -1,8 +1,8 @@ |
| 1 | use crate::spec::{Abi, LinkerFlavor, Lld, TargetOptions, base}; | |
| 1 | use crate::spec::{CfgAbi, LinkerFlavor, Lld, TargetOptions, base}; | |
| 2 | 2 | |
| 3 | 3 | pub(crate) fn opts() -> TargetOptions { |
| 4 | 4 | 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() }; | |
| 6 | 6 | |
| 7 | 7 | opts.add_pre_link_args(LinkerFlavor::Msvc(Lld::No), &["/APPCONTAINER", "mincore.lib"]); |
| 8 | 8 |
compiler/rustc_target/src/spec/json.rs+8-6| ... | ... | @@ -5,14 +5,14 @@ use rustc_abi::{Align, AlignFromBytesError}; |
| 5 | 5 | |
| 6 | 6 | use super::crt_objects::CrtObjects; |
| 7 | 7 | use super::{ |
| 8 | Abi, Arch, BinaryFormat, CodeModel, DebuginfoKind, Env, FloatAbi, FramePointer, LinkArgsCli, | |
| 8 | Arch, BinaryFormat, CfgAbi, CodeModel, DebuginfoKind, Env, FloatAbi, FramePointer, LinkArgsCli, | |
| 9 | 9 | LinkSelfContainedComponents, LinkSelfContainedDefault, LinkerFlavorCli, LldFlavor, |
| 10 | 10 | MergeFunctions, Os, PanicStrategy, RelocModel, RelroLevel, RustcAbi, SanitizerSet, |
| 11 | 11 | SmallDataThresholdSupport, SplitDebuginfo, StackProbeType, StaticCow, SymbolVisibility, Target, |
| 12 | 12 | TargetKind, TargetOptions, TargetWarnings, TlsModel, |
| 13 | 13 | }; |
| 14 | 14 | use crate::json::{Json, ToJson}; |
| 15 | use crate::spec::AbiMap; | |
| 15 | use crate::spec::{AbiMap, LlvmAbi}; | |
| 16 | 16 | |
| 17 | 17 | impl Target { |
| 18 | 18 | /// Loads a target descriptor from a JSON object. |
| ... | ... | @@ -69,7 +69,9 @@ impl Target { |
| 69 | 69 | forward_opt!(c_enum_min_bits); // if None, matches c_int_width |
| 70 | 70 | forward!(os); |
| 71 | 71 | forward!(env); |
| 72 | forward!(abi); | |
| 72 | if let Some(abi) = json.abi { | |
| 73 | base.cfg_abi = abi; | |
| 74 | } | |
| 73 | 75 | forward!(vendor); |
| 74 | 76 | forward_opt!(linker); |
| 75 | 77 | forward!(linker_flavor_json); |
| ... | ... | @@ -297,7 +299,7 @@ impl ToJson for Target { |
| 297 | 299 | target_option_val!(c_int_width, "target-c-int-width"); |
| 298 | 300 | target_option_val!(os); |
| 299 | 301 | target_option_val!(env); |
| 300 | target_option_val!(abi); | |
| 302 | target_option_val!(cfg_abi, "abi"); | |
| 301 | 303 | target_option_val!(vendor); |
| 302 | 304 | target_option_val!(linker); |
| 303 | 305 | target_option_val!(linker_flavor_json, "linker-flavor"); |
| ... | ... | @@ -505,7 +507,7 @@ struct TargetSpecJson { |
| 505 | 507 | c_enum_min_bits: Option<u64>, |
| 506 | 508 | os: Option<Os>, |
| 507 | 509 | env: Option<Env>, |
| 508 | abi: Option<Abi>, | |
| 510 | abi: Option<CfgAbi>, | |
| 509 | 511 | vendor: Option<StaticCow<str>>, |
| 510 | 512 | linker: Option<StaticCow<str>>, |
| 511 | 513 | #[serde(rename = "linker-flavor")] |
| ... | ... | @@ -609,7 +611,7 @@ struct TargetSpecJson { |
| 609 | 611 | #[serde(rename = "target-mcount")] |
| 610 | 612 | mcount: Option<StaticCow<str>>, |
| 611 | 613 | llvm_mcount_intrinsic: Option<StaticCow<str>>, |
| 612 | llvm_abiname: Option<StaticCow<str>>, | |
| 614 | llvm_abiname: Option<LlvmAbi>, | |
| 613 | 615 | llvm_floatabi: Option<FloatAbi>, |
| 614 | 616 | rustc_abi: Option<RustcAbi>, |
| 615 | 617 | relax_elf_relocations: Option<bool>, |
compiler/rustc_target/src/spec/mod.rs+193-104| ... | ... | @@ -2065,7 +2065,10 @@ impl Env { |
| 2065 | 2065 | } |
| 2066 | 2066 | |
| 2067 | 2067 | crate::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 { | |
| 2069 | 2072 | Abi64 = "abi64", |
| 2070 | 2073 | AbiV2 = "abiv2", |
| 2071 | 2074 | AbiV2Hf = "abiv2hf", |
| ... | ... | @@ -2090,12 +2093,40 @@ crate::target_spec_enum! { |
| 2090 | 2093 | other_variant = Other; |
| 2091 | 2094 | } |
| 2092 | 2095 | |
| 2093 | impl Abi { | |
| 2096 | impl CfgAbi { | |
| 2094 | 2097 | pub fn desc_symbol(&self) -> Symbol { |
| 2095 | 2098 | Symbol::intern(self.desc()) |
| 2096 | 2099 | } |
| 2097 | 2100 | } |
| 2098 | 2101 | |
| 2102 | crate::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 | ||
| 2099 | 2130 | /// Everything `rustc` knows about how to compile for a specific target. |
| 2100 | 2131 | /// |
| 2101 | 2132 | /// Every field here must be specified, and has no default value. |
| ... | ... | @@ -2221,13 +2252,18 @@ pub struct TargetOptions { |
| 2221 | 2252 | pub os: Os, |
| 2222 | 2253 | /// Environment name to use for conditional compilation (`target_env`). Defaults to [`Env::Unspecified`]. |
| 2223 | 2254 | 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, | |
| 2231 | 2267 | /// Vendor name to use for conditional compilation (`target_vendor`). Defaults to "unknown". |
| 2232 | 2268 | #[rustc_lint_opt_deny_field_access( |
| 2233 | 2269 | "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 { |
| 2537 | 2573 | |
| 2538 | 2574 | /// LLVM ABI name, corresponds to the '-mabi' parameter available in multilib C compilers |
| 2539 | 2575 | /// 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, | |
| 2541 | 2577 | |
| 2542 | 2578 | /// Control the float ABI to use, for architectures that support it. The only architecture we |
| 2543 | 2579 | /// 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 { |
| 2550 | 2586 | /// Picks a specific ABI for this target. This is *not* just for "Rust" ABI functions, |
| 2551 | 2587 | /// it can also affect "C" ABI functions; the point is that this flag is interpreted by |
| 2552 | 2588 | /// rustc and not forwarded to LLVM. |
| 2553 | /// So far, this is only used on x86. | |
| 2554 | 2589 | pub rustc_abi: Option<RustcAbi>, |
| 2555 | 2590 | |
| 2556 | 2591 | /// Whether or not RelaxElfRelocation flag will be passed to the linker |
| ... | ... | @@ -2739,7 +2774,7 @@ impl Default for TargetOptions { |
| 2739 | 2774 | c_int_width: 32, |
| 2740 | 2775 | os: Os::None, |
| 2741 | 2776 | env: Env::Unspecified, |
| 2742 | abi: Abi::Unspecified, | |
| 2777 | cfg_abi: CfgAbi::Unspecified, | |
| 2743 | 2778 | vendor: "unknown".into(), |
| 2744 | 2779 | linker: option_env!("CFG_DEFAULT_LINKER").map(|s| s.into()), |
| 2745 | 2780 | linker_flavor: LinkerFlavor::Gnu(Cc::Yes, Lld::No), |
| ... | ... | @@ -2835,7 +2870,7 @@ impl Default for TargetOptions { |
| 2835 | 2870 | merge_functions: MergeFunctions::Aliases, |
| 2836 | 2871 | mcount: "mcount".into(), |
| 2837 | 2872 | llvm_mcount_intrinsic: None, |
| 2838 | llvm_abiname: "".into(), | |
| 2873 | llvm_abiname: LlvmAbi::Unspecified, | |
| 2839 | 2874 | llvm_floatabi: None, |
| 2840 | 2875 | rustc_abi: None, |
| 2841 | 2876 | relax_elf_relocations: false, |
| ... | ... | @@ -3183,71 +3218,106 @@ impl Target { |
| 3183 | 3218 | ); |
| 3184 | 3219 | } |
| 3185 | 3220 | |
| 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 | ||
| 3186 | 3242 | // Check ABI flag consistency, for the architectures where we have proper ABI treatment. |
| 3187 | 3243 | // To ensure targets are trated consistently, please consult with the team before allowing |
| 3188 | 3244 | // new cases. |
| 3189 | 3245 | match self.arch { |
| 3190 | 3246 | 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 | ); | |
| 3192 | 3251 | check!(self.llvm_floatabi.is_none(), "`llvm_floatabi` is unused on x86-32"); |
| 3193 | 3252 | check_matches!( |
| 3194 | (&self.rustc_abi, &self.abi), | |
| 3253 | (&self.rustc_abi, &self.cfg_abi), | |
| 3195 | 3254 | // FIXME: we do not currently set a target_abi for softfloat targets here, |
| 3196 | 3255 | // 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 | ), | |
| 3202 | 3267 | "invalid x86-32 Rust-specific ABI and `cfg(target_abi)` combination:\n\ |
| 3203 | 3268 | Rust-specific ABI: {:?}\n\ |
| 3204 | 3269 | cfg(target_abi): {}", |
| 3205 | 3270 | self.rustc_abi, |
| 3206 | self.abi, | |
| 3271 | self.cfg_abi, | |
| 3207 | 3272 | ); |
| 3208 | 3273 | } |
| 3209 | 3274 | 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 | ); | |
| 3211 | 3279 | check!(self.llvm_floatabi.is_none(), "`llvm_floatabi` is unused on x86-64"); |
| 3212 | 3280 | // FIXME: we do not currently set a target_abi for softfloat targets here, but we |
| 3213 | 3281 | // probably should, so we already allow it. |
| 3214 | 3282 | // FIXME: Ensure that target_abi = "x32" correlates with actually using that ABI. |
| 3215 | 3283 | // Do any of the others need a similar check? |
| 3216 | 3284 | 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 | ), | |
| 3230 | 3300 | "invalid x86-64 Rust-specific ABI and `cfg(target_abi)` combination:\n\ |
| 3231 | 3301 | Rust-specific ABI: {:?}\n\ |
| 3232 | 3302 | cfg(target_abi): {}", |
| 3233 | 3303 | self.rustc_abi, |
| 3234 | self.abi, | |
| 3304 | self.cfg_abi, | |
| 3235 | 3305 | ); |
| 3236 | 3306 | } |
| 3237 | 3307 | Arch::RiscV32 => { |
| 3238 | 3308 | check!(self.llvm_floatabi.is_none(), "`llvm_floatabi` is unused on RISC-V"); |
| 3239 | 3309 | check!(self.rustc_abi.is_none(), "`rustc_abi` is unused on RISC-V"); |
| 3240 | 3310 | 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), | |
| 3246 | 3316 | "invalid RISC-V ABI name and `cfg(target_abi)` combination:\n\ |
| 3247 | 3317 | ABI name: {}\n\ |
| 3248 | 3318 | cfg(target_abi): {}", |
| 3249 | 3319 | self.llvm_abiname, |
| 3250 | self.abi, | |
| 3320 | self.cfg_abi, | |
| 3251 | 3321 | ); |
| 3252 | 3322 | } |
| 3253 | 3323 | Arch::RiscV64 => { |
| ... | ... | @@ -3255,68 +3325,77 @@ impl Target { |
| 3255 | 3325 | check!(self.llvm_floatabi.is_none(), "`llvm_floatabi` is unused on RISC-V"); |
| 3256 | 3326 | check!(self.rustc_abi.is_none(), "`rustc_abi` is unused on RISC-V"); |
| 3257 | 3327 | 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(_)), | |
| 3263 | 3333 | "invalid RISC-V ABI name and `cfg(target_abi)` combination:\n\ |
| 3264 | 3334 | ABI name: {}\n\ |
| 3265 | 3335 | cfg(target_abi): {}", |
| 3266 | 3336 | self.llvm_abiname, |
| 3267 | self.abi, | |
| 3337 | self.cfg_abi, | |
| 3268 | 3338 | ); |
| 3269 | 3339 | } |
| 3270 | 3340 | 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 | ); | |
| 3272 | 3345 | check!(self.rustc_abi.is_none(), "`rustc_abi` is unused on ARM"); |
| 3273 | 3346 | check_matches!( |
| 3274 | (&self.llvm_floatabi, &self.abi), | |
| 3347 | (&self.llvm_floatabi, &self.cfg_abi), | |
| 3275 | 3348 | ( |
| 3276 | 3349 | 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), | |
| 3279 | 3352 | "Invalid combination of float ABI and `cfg(target_abi)` for ARM target\n\ |
| 3280 | 3353 | float ABI: {:?}\n\ |
| 3281 | 3354 | cfg(target_abi): {}", |
| 3282 | 3355 | self.llvm_floatabi, |
| 3283 | self.abi, | |
| 3356 | self.cfg_abi, | |
| 3284 | 3357 | ) |
| 3285 | 3358 | } |
| 3286 | 3359 | 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 | ); | |
| 3288 | 3364 | check!(self.llvm_floatabi.is_none(), "`llvm_floatabi` is unused on aarch64"); |
| 3289 | 3365 | // FIXME: Ensure that target_abi = "ilp32" correlates with actually using that ABI. |
| 3290 | 3366 | // Do any of the others need a similar check? |
| 3291 | 3367 | 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) | |
| 3294 | 3370 | | ( |
| 3295 | 3371 | 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(_) | |
| 3303 | 3379 | ), |
| 3304 | 3380 | "invalid aarch64 Rust-specific ABI and `cfg(target_abi)` combination:\n\ |
| 3305 | 3381 | Rust-specific ABI: {:?}\n\ |
| 3306 | 3382 | cfg(target_abi): {}", |
| 3307 | 3383 | self.rustc_abi, |
| 3308 | self.abi, | |
| 3384 | self.cfg_abi, | |
| 3309 | 3385 | ); |
| 3310 | 3386 | } |
| 3311 | 3387 | 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 | ); | |
| 3313 | 3392 | check!(self.llvm_floatabi.is_none(), "`llvm_floatabi` is unused on PowerPC"); |
| 3314 | 3393 | check!(self.rustc_abi.is_none(), "`rustc_abi` is unused on PowerPC"); |
| 3315 | 3394 | // FIXME: Check that `target_abi` matches the actually configured ABI (with or |
| 3316 | 3395 | // without SPE). |
| 3317 | 3396 | check_matches!( |
| 3318 | self.abi, | |
| 3319 | Abi::Spe | Abi::Unspecified | Abi::Other(_), | |
| 3397 | self.cfg_abi, | |
| 3398 | CfgAbi::Spe | CfgAbi::Unspecified | CfgAbi::Other(_), | |
| 3320 | 3399 | "invalid `target_abi` for PowerPC" |
| 3321 | 3400 | ); |
| 3322 | 3401 | } |
| ... | ... | @@ -3328,116 +3407,123 @@ impl Target { |
| 3328 | 3407 | // FIXME: Check that `target_abi` matches the actually configured ABI |
| 3329 | 3408 | // (vec-default vs vec-ext). |
| 3330 | 3409 | 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), | |
| 3333 | 3412 | "invalid PowerPC64 AIX ABI name and `cfg(target_abi)` combination:\n\ |
| 3334 | 3413 | ABI name: {}\n\ |
| 3335 | 3414 | cfg(target_abi): {}", |
| 3336 | 3415 | self.llvm_abiname, |
| 3337 | self.abi, | |
| 3416 | self.cfg_abi, | |
| 3338 | 3417 | ); |
| 3339 | 3418 | } else if self.endian == Endian::Big { |
| 3340 | 3419 | 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), | |
| 3343 | 3422 | "invalid PowerPC64 big-endian ABI name and `cfg(target_abi)` combination:\n\ |
| 3344 | 3423 | ABI name: {}\n\ |
| 3345 | 3424 | cfg(target_abi): {}", |
| 3346 | 3425 | self.llvm_abiname, |
| 3347 | self.abi, | |
| 3426 | self.cfg_abi, | |
| 3348 | 3427 | ); |
| 3349 | 3428 | } else { |
| 3350 | 3429 | check_matches!( |
| 3351 | (&*self.llvm_abiname, &self.abi), | |
| 3352 | ("elfv2", Abi::ElfV2), | |
| 3430 | (&self.llvm_abiname, &self.cfg_abi), | |
| 3431 | (LlvmAbi::ElfV2, CfgAbi::ElfV2), | |
| 3353 | 3432 | "invalid PowerPC64 little-endian ABI name and `cfg(target_abi)` combination:\n\ |
| 3354 | 3433 | ABI name: {}\n\ |
| 3355 | 3434 | cfg(target_abi): {}", |
| 3356 | 3435 | self.llvm_abiname, |
| 3357 | self.abi, | |
| 3436 | self.cfg_abi, | |
| 3358 | 3437 | ); |
| 3359 | 3438 | } |
| 3360 | 3439 | } |
| 3361 | 3440 | 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 | ); | |
| 3363 | 3445 | check!(self.llvm_floatabi.is_none(), "`llvm_floatabi` is unused on s390x"); |
| 3364 | 3446 | 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(_)), | |
| 3368 | 3450 | "invalid s390x Rust-specific ABI and `cfg(target_abi)` combination:\n\ |
| 3369 | 3451 | Rust-specific ABI: {:?}\n\ |
| 3370 | 3452 | cfg(target_abi): {}", |
| 3371 | 3453 | self.rustc_abi, |
| 3372 | self.abi, | |
| 3454 | self.cfg_abi, | |
| 3373 | 3455 | ); |
| 3374 | 3456 | } |
| 3375 | 3457 | Arch::LoongArch32 => { |
| 3376 | 3458 | check!(self.llvm_floatabi.is_none(), "`llvm_floatabi` is unused on LoongArch"); |
| 3377 | 3459 | check!(self.rustc_abi.is_none(), "`rustc_abi` is unused on LoongArch"); |
| 3378 | 3460 | 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(_)), | |
| 3383 | 3465 | "invalid LoongArch ABI name and `cfg(target_abi)` combination:\n\ |
| 3384 | 3466 | ABI name: {}\n\ |
| 3385 | 3467 | cfg(target_abi): {}", |
| 3386 | 3468 | self.llvm_abiname, |
| 3387 | self.abi, | |
| 3469 | self.cfg_abi, | |
| 3388 | 3470 | ); |
| 3389 | 3471 | } |
| 3390 | 3472 | Arch::LoongArch64 => { |
| 3391 | 3473 | check!(self.llvm_floatabi.is_none(), "`llvm_floatabi` is unused on LoongArch"); |
| 3392 | 3474 | check!(self.rustc_abi.is_none(), "`rustc_abi` is unused on LoongArch"); |
| 3393 | 3475 | 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(_)), | |
| 3398 | 3480 | "invalid LoongArch ABI name and `cfg(target_abi)` combination:\n\ |
| 3399 | 3481 | ABI name: {}\n\ |
| 3400 | 3482 | cfg(target_abi): {}", |
| 3401 | 3483 | self.llvm_abiname, |
| 3402 | self.abi, | |
| 3484 | self.cfg_abi, | |
| 3403 | 3485 | ); |
| 3404 | 3486 | } |
| 3405 | 3487 | Arch::Mips | Arch::Mips32r6 => { |
| 3406 | 3488 | check!(self.llvm_floatabi.is_none(), "`llvm_floatabi` is unused on MIPS"); |
| 3407 | 3489 | check!(self.rustc_abi.is_none(), "`rustc_abi` is unused on MIPS"); |
| 3408 | 3490 | 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(_)), | |
| 3411 | 3493 | "invalid MIPS ABI name and `cfg(target_abi)` combination:\n\ |
| 3412 | 3494 | ABI name: {}\n\ |
| 3413 | 3495 | cfg(target_abi): {}", |
| 3414 | 3496 | self.llvm_abiname, |
| 3415 | self.abi, | |
| 3497 | self.cfg_abi, | |
| 3416 | 3498 | ); |
| 3417 | 3499 | } |
| 3418 | 3500 | Arch::Mips64 | Arch::Mips64r6 => { |
| 3419 | 3501 | check!(self.llvm_floatabi.is_none(), "`llvm_floatabi` is unused on MIPS"); |
| 3420 | 3502 | check!(self.rustc_abi.is_none(), "`rustc_abi` is unused on MIPS"); |
| 3421 | 3503 | check_matches!( |
| 3422 | (&*self.llvm_abiname, &self.abi), | |
| 3504 | (&self.llvm_abiname, &self.cfg_abi), | |
| 3423 | 3505 | // No in-tree targets use "n32" but at least for now we let out-of-tree targets |
| 3424 | 3506 | // experiment with that. |
| 3425 | ("n64", Abi::Abi64) | ("n32", Abi::Unspecified | Abi::Other(_)), | |
| 3507 | (LlvmAbi::N64, CfgAbi::Abi64) | |
| 3508 | | (LlvmAbi::N32, CfgAbi::Unspecified | CfgAbi::Other(_)), | |
| 3426 | 3509 | "invalid MIPS ABI name and `cfg(target_abi)` combination:\n\ |
| 3427 | 3510 | ABI name: {}\n\ |
| 3428 | 3511 | cfg(target_abi): {}", |
| 3429 | 3512 | self.llvm_abiname, |
| 3430 | self.abi, | |
| 3513 | self.cfg_abi, | |
| 3431 | 3514 | ); |
| 3432 | 3515 | } |
| 3433 | 3516 | 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 | ); | |
| 3435 | 3521 | check!(self.llvm_floatabi.is_none(), "`llvm_floatabi` is unused on CSky"); |
| 3436 | 3522 | check!(self.rustc_abi.is_none(), "`rustc_abi` is unused on CSky"); |
| 3437 | 3523 | // FIXME: Check that `target_abi` matches the actually configured ABI (v2 vs v2hf). |
| 3438 | 3524 | check_matches!( |
| 3439 | self.abi, | |
| 3440 | Abi::AbiV2 | Abi::AbiV2Hf, | |
| 3525 | self.cfg_abi, | |
| 3526 | CfgAbi::AbiV2 | CfgAbi::AbiV2Hf, | |
| 3441 | 3527 | "invalid `target_abi` for CSky" |
| 3442 | 3528 | ); |
| 3443 | 3529 | } |
| ... | ... | @@ -3446,11 +3532,14 @@ impl Target { |
| 3446 | 3532 | // Ensure consistency among built-in targets, but give JSON targets the opportunity |
| 3447 | 3533 | // to experiment with these. |
| 3448 | 3534 | 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 | ); | |
| 3450 | 3539 | check!(self.llvm_floatabi.is_none(), "`llvm_floatabi` is unused on {arch}"); |
| 3451 | 3540 | check_matches!( |
| 3452 | self.abi, | |
| 3453 | Abi::Unspecified | Abi::Other(_), | |
| 3541 | self.cfg_abi, | |
| 3542 | CfgAbi::Unspecified | CfgAbi::Other(_), | |
| 3454 | 3543 | "`target_abi` is unused on {arch}" |
| 3455 | 3544 | ); |
| 3456 | 3545 | } |
| ... | ... | @@ -3665,7 +3754,7 @@ impl Target { |
| 3665 | 3754 | // it using a custom target specification. N32 |
| 3666 | 3755 | // is an ILP32 ABI like the Aarch64_Ilp32 |
| 3667 | 3756 | // 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 { | |
| 3669 | 3758 | Architecture::Mips64_N32 |
| 3670 | 3759 | } else { |
| 3671 | 3760 | Architecture::Mips64 |
compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu_ilp32.rs+2-2| ... | ... | @@ -1,7 +1,7 @@ |
| 1 | 1 | use rustc_abi::Endian; |
| 2 | 2 | |
| 3 | 3 | use crate::spec::{ |
| 4 | Abi, Arch, FramePointer, StackProbeType, Target, TargetMetadata, TargetOptions, base, | |
| 4 | Arch, CfgAbi, FramePointer, StackProbeType, Target, TargetMetadata, TargetOptions, base, | |
| 5 | 5 | }; |
| 6 | 6 | |
| 7 | 7 | pub(crate) fn target() -> Target { |
| ... | ... | @@ -20,7 +20,7 @@ pub(crate) fn target() -> Target { |
| 20 | 20 | 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(), |
| 21 | 21 | arch: Arch::AArch64, |
| 22 | 22 | options: TargetOptions { |
| 23 | abi: Abi::Ilp32, | |
| 23 | cfg_abi: CfgAbi::Ilp32, | |
| 24 | 24 | features: "+v8a,+outline-atomics".into(), |
| 25 | 25 | // the AAPCS64 expects use of non-leaf frame pointers per |
| 26 | 26 | // 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 @@ |
| 8 | 8 | use rustc_abi::Endian; |
| 9 | 9 | |
| 10 | 10 | use crate::spec::{ |
| 11 | Abi, Arch, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, RustcAbi, SanitizerSet, | |
| 11 | Arch, Cc, CfgAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, RustcAbi, SanitizerSet, | |
| 12 | 12 | StackProbeType, Target, TargetMetadata, TargetOptions, |
| 13 | 13 | }; |
| 14 | 14 | |
| 15 | 15 | pub(crate) fn target() -> Target { |
| 16 | 16 | let opts = TargetOptions { |
| 17 | abi: Abi::SoftFloat, | |
| 17 | cfg_abi: CfgAbi::SoftFloat, | |
| 18 | 18 | rustc_abi: Some(RustcAbi::Softfloat), |
| 19 | 19 | linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes), |
| 20 | 20 | linker: Some("rust-lld".into()), |
compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu_ilp32.rs+2-2| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | use crate::spec::{ |
| 2 | Abi, Arch, FramePointer, StackProbeType, Target, TargetMetadata, TargetOptions, base, | |
| 2 | Arch, CfgAbi, FramePointer, StackProbeType, Target, TargetMetadata, TargetOptions, base, | |
| 3 | 3 | }; |
| 4 | 4 | |
| 5 | 5 | pub(crate) fn target() -> Target { |
| ... | ... | @@ -15,7 +15,7 @@ pub(crate) fn target() -> Target { |
| 15 | 15 | 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(), |
| 16 | 16 | arch: Arch::AArch64, |
| 17 | 17 | options: TargetOptions { |
| 18 | abi: Abi::Ilp32, | |
| 18 | cfg_abi: CfgAbi::Ilp32, | |
| 19 | 19 | features: "+v8a,+outline-atomics".into(), |
| 20 | 20 | // the AAPCS64 expects use of non-leaf frame pointers per |
| 21 | 21 | // 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 @@ |
| 7 | 7 | // For example, `-C target-cpu=cortex-a53`. |
| 8 | 8 | |
| 9 | 9 | use crate::spec::{ |
| 10 | Abi, Arch, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, RustcAbi, SanitizerSet, | |
| 10 | Arch, Cc, CfgAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, RustcAbi, SanitizerSet, | |
| 11 | 11 | StackProbeType, Target, TargetMetadata, TargetOptions, |
| 12 | 12 | }; |
| 13 | 13 | |
| 14 | 14 | pub(crate) fn target() -> Target { |
| 15 | 15 | let opts = TargetOptions { |
| 16 | abi: Abi::SoftFloat, | |
| 16 | cfg_abi: CfgAbi::SoftFloat, | |
| 17 | 17 | rustc_abi: Some(RustcAbi::Softfloat), |
| 18 | 18 | linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes), |
| 19 | 19 | linker: Some("rust-lld".into()), |
compiler/rustc_target/src/spec/targets/aarch64v8r_unknown_none_softfloat.rs+2-2| ... | ... | @@ -1,11 +1,11 @@ |
| 1 | 1 | use crate::spec::{ |
| 2 | Abi, Arch, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, RustcAbi, SanitizerSet, | |
| 2 | Arch, Cc, CfgAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, RustcAbi, SanitizerSet, | |
| 3 | 3 | StackProbeType, Target, TargetMetadata, TargetOptions, |
| 4 | 4 | }; |
| 5 | 5 | |
| 6 | 6 | pub(crate) fn target() -> Target { |
| 7 | 7 | let opts = TargetOptions { |
| 8 | abi: Abi::SoftFloat, | |
| 8 | cfg_abi: CfgAbi::SoftFloat, | |
| 9 | 9 | rustc_abi: Some(RustcAbi::Softfloat), |
| 10 | 10 | linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes), |
| 11 | 11 | linker: Some("rust-lld".into()), |
compiler/rustc_target/src/spec/targets/arm_linux_androideabi.rs+4-2| ... | ... | @@ -1,4 +1,6 @@ |
| 1 | use crate::spec::{Abi, Arch, FloatAbi, SanitizerSet, Target, TargetMetadata, TargetOptions, base}; | |
| 1 | use crate::spec::{ | |
| 2 | Arch, CfgAbi, FloatAbi, SanitizerSet, Target, TargetMetadata, TargetOptions, base, | |
| 3 | }; | |
| 2 | 4 | |
| 3 | 5 | pub(crate) fn target() -> Target { |
| 4 | 6 | Target { |
| ... | ... | @@ -13,7 +15,7 @@ pub(crate) fn target() -> Target { |
| 13 | 15 | data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(), |
| 14 | 16 | arch: Arch::Arm, |
| 15 | 17 | options: TargetOptions { |
| 16 | abi: Abi::Eabi, | |
| 18 | cfg_abi: CfgAbi::Eabi, | |
| 17 | 19 | llvm_floatabi: Some(FloatAbi::Soft), |
| 18 | 20 | // https://developer.android.com/ndk/guides/abis.html#armeabi |
| 19 | 21 | features: "+strict-align,+v5te".into(), |
compiler/rustc_target/src/spec/targets/arm_unknown_linux_gnueabi.rs+2-2| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 1 | use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 2 | 2 | |
| 3 | 3 | pub(crate) fn target() -> Target { |
| 4 | 4 | Target { |
| ... | ... | @@ -13,7 +13,7 @@ pub(crate) fn target() -> Target { |
| 13 | 13 | data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(), |
| 14 | 14 | arch: Arch::Arm, |
| 15 | 15 | options: TargetOptions { |
| 16 | abi: Abi::Eabi, | |
| 16 | cfg_abi: CfgAbi::Eabi, | |
| 17 | 17 | llvm_floatabi: Some(FloatAbi::Soft), |
| 18 | 18 | features: "+strict-align,+v6".into(), |
| 19 | 19 | max_atomic_width: Some(64), |
compiler/rustc_target/src/spec/targets/arm_unknown_linux_gnueabihf.rs+2-2| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 1 | use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 2 | 2 | |
| 3 | 3 | pub(crate) fn target() -> Target { |
| 4 | 4 | Target { |
| ... | ... | @@ -13,7 +13,7 @@ pub(crate) fn target() -> Target { |
| 13 | 13 | data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(), |
| 14 | 14 | arch: Arch::Arm, |
| 15 | 15 | options: TargetOptions { |
| 16 | abi: Abi::EabiHf, | |
| 16 | cfg_abi: CfgAbi::EabiHf, | |
| 17 | 17 | llvm_floatabi: Some(FloatAbi::Hard), |
| 18 | 18 | features: "+strict-align,+v6,+vfp2".into(), |
| 19 | 19 | max_atomic_width: Some(64), |
compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs+2-2| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 1 | use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 2 | 2 | |
| 3 | 3 | pub(crate) fn target() -> Target { |
| 4 | 4 | Target { |
| ... | ... | @@ -13,7 +13,7 @@ pub(crate) fn target() -> Target { |
| 13 | 13 | data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(), |
| 14 | 14 | arch: Arch::Arm, |
| 15 | 15 | options: TargetOptions { |
| 16 | abi: Abi::Eabi, | |
| 16 | cfg_abi: CfgAbi::Eabi, | |
| 17 | 17 | llvm_floatabi: Some(FloatAbi::Soft), |
| 18 | 18 | // Most of these settings are copied from the arm_unknown_linux_gnueabi |
| 19 | 19 | // target. |
compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs+2-2| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 1 | use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 2 | 2 | |
| 3 | 3 | pub(crate) fn target() -> Target { |
| 4 | 4 | Target { |
| ... | ... | @@ -13,7 +13,7 @@ pub(crate) fn target() -> Target { |
| 13 | 13 | data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(), |
| 14 | 14 | arch: Arch::Arm, |
| 15 | 15 | options: TargetOptions { |
| 16 | abi: Abi::EabiHf, | |
| 16 | cfg_abi: CfgAbi::EabiHf, | |
| 17 | 17 | llvm_floatabi: Some(FloatAbi::Hard), |
| 18 | 18 | // Most of these settings are copied from the arm_unknown_linux_gnueabihf |
| 19 | 19 | // target. |
compiler/rustc_target/src/spec/targets/armeb_unknown_linux_gnueabi.rs+2-2| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | use rustc_abi::Endian; |
| 2 | 2 | |
| 3 | use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 3 | use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 4 | 4 | |
| 5 | 5 | pub(crate) fn target() -> Target { |
| 6 | 6 | Target { |
| ... | ... | @@ -15,7 +15,7 @@ pub(crate) fn target() -> Target { |
| 15 | 15 | data_layout: "E-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(), |
| 16 | 16 | arch: Arch::Arm, |
| 17 | 17 | options: TargetOptions { |
| 18 | abi: Abi::Eabi, | |
| 18 | cfg_abi: CfgAbi::Eabi, | |
| 19 | 19 | llvm_floatabi: Some(FloatAbi::Soft), |
| 20 | 20 | features: "+strict-align,+v8,+crc".into(), |
| 21 | 21 | endian: Endian::Big, |
compiler/rustc_target/src/spec/targets/armebv7r_none_eabi.rs+3-3| ... | ... | @@ -3,8 +3,8 @@ |
| 3 | 3 | use rustc_abi::Endian; |
| 4 | 4 | |
| 5 | 5 | use 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, | |
| 8 | 8 | }; |
| 9 | 9 | |
| 10 | 10 | pub(crate) fn target() -> Target { |
| ... | ... | @@ -20,7 +20,7 @@ pub(crate) fn target() -> Target { |
| 20 | 20 | data_layout: "E-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(), |
| 21 | 21 | arch: Arch::Arm, |
| 22 | 22 | options: TargetOptions { |
| 23 | abi: Abi::Eabi, | |
| 23 | cfg_abi: CfgAbi::Eabi, | |
| 24 | 24 | llvm_floatabi: Some(FloatAbi::Soft), |
| 25 | 25 | endian: Endian::Big, |
| 26 | 26 | linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes), |
compiler/rustc_target/src/spec/targets/armebv7r_none_eabihf.rs+3-3| ... | ... | @@ -3,8 +3,8 @@ |
| 3 | 3 | use rustc_abi::Endian; |
| 4 | 4 | |
| 5 | 5 | use 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, | |
| 8 | 8 | }; |
| 9 | 9 | |
| 10 | 10 | pub(crate) fn target() -> Target { |
| ... | ... | @@ -20,7 +20,7 @@ pub(crate) fn target() -> Target { |
| 20 | 20 | data_layout: "E-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(), |
| 21 | 21 | arch: Arch::Arm, |
| 22 | 22 | options: TargetOptions { |
| 23 | abi: Abi::EabiHf, | |
| 23 | cfg_abi: CfgAbi::EabiHf, | |
| 24 | 24 | llvm_floatabi: Some(FloatAbi::Hard), |
| 25 | 25 | endian: Endian::Big, |
| 26 | 26 | linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes), |
compiler/rustc_target/src/spec/targets/armv4t_none_eabi.rs+2-2| ... | ... | @@ -9,7 +9,7 @@ |
| 9 | 9 | //! The default link script is very likely wrong, so you should use |
| 10 | 10 | //! `-Clink-arg=-Tmy_script.ld` to override that with a correct linker script. |
| 11 | 11 | |
| 12 | use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base, cvs}; | |
| 12 | use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base, cvs}; | |
| 13 | 13 | |
| 14 | 14 | pub(crate) fn target() -> Target { |
| 15 | 15 | Target { |
| ... | ... | @@ -24,7 +24,7 @@ pub(crate) fn target() -> Target { |
| 24 | 24 | arch: Arch::Arm, |
| 25 | 25 | data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(), |
| 26 | 26 | options: TargetOptions { |
| 27 | abi: Abi::Eabi, | |
| 27 | cfg_abi: CfgAbi::Eabi, | |
| 28 | 28 | llvm_floatabi: Some(FloatAbi::Soft), |
| 29 | 29 | asm_args: cvs!["-mthumb-interwork", "-march=armv4t", "-mlittle-endian",], |
| 30 | 30 | features: "+soft-float,+strict-align".into(), |
compiler/rustc_target/src/spec/targets/armv4t_unknown_linux_gnueabi.rs+2-2| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 1 | use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 2 | 2 | |
| 3 | 3 | pub(crate) fn target() -> Target { |
| 4 | 4 | Target { |
| ... | ... | @@ -13,7 +13,7 @@ pub(crate) fn target() -> Target { |
| 13 | 13 | data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(), |
| 14 | 14 | arch: Arch::Arm, |
| 15 | 15 | options: TargetOptions { |
| 16 | abi: Abi::Eabi, | |
| 16 | cfg_abi: CfgAbi::Eabi, | |
| 17 | 17 | llvm_floatabi: Some(FloatAbi::Soft), |
| 18 | 18 | features: "+soft-float,+strict-align".into(), |
| 19 | 19 | // Atomic operations provided by compiler-builtins |
compiler/rustc_target/src/spec/targets/armv5te_none_eabi.rs+2-2| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | //! Targets the ARMv5TE architecture, with `a32` code by default. |
| 2 | 2 | |
| 3 | use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base, cvs}; | |
| 3 | use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base, cvs}; | |
| 4 | 4 | |
| 5 | 5 | pub(crate) fn target() -> Target { |
| 6 | 6 | Target { |
| ... | ... | @@ -15,7 +15,7 @@ pub(crate) fn target() -> Target { |
| 15 | 15 | arch: Arch::Arm, |
| 16 | 16 | data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(), |
| 17 | 17 | options: TargetOptions { |
| 18 | abi: Abi::Eabi, | |
| 18 | cfg_abi: CfgAbi::Eabi, | |
| 19 | 19 | llvm_floatabi: Some(FloatAbi::Soft), |
| 20 | 20 | asm_args: cvs!["-mthumb-interwork", "-march=armv5te", "-mlittle-endian",], |
| 21 | 21 | features: "+soft-float,+strict-align".into(), |
compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_gnueabi.rs+2-2| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 1 | use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 2 | 2 | |
| 3 | 3 | pub(crate) fn target() -> Target { |
| 4 | 4 | Target { |
| ... | ... | @@ -13,7 +13,7 @@ pub(crate) fn target() -> Target { |
| 13 | 13 | data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(), |
| 14 | 14 | arch: Arch::Arm, |
| 15 | 15 | options: TargetOptions { |
| 16 | abi: Abi::Eabi, | |
| 16 | cfg_abi: CfgAbi::Eabi, | |
| 17 | 17 | llvm_floatabi: Some(FloatAbi::Soft), |
| 18 | 18 | features: "+soft-float,+strict-align".into(), |
| 19 | 19 | // Atomic operations provided by compiler-builtins |
compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_musleabi.rs+2-2| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 1 | use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 2 | 2 | |
| 3 | 3 | pub(crate) fn target() -> Target { |
| 4 | 4 | Target { |
| ... | ... | @@ -13,7 +13,7 @@ pub(crate) fn target() -> Target { |
| 13 | 13 | data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(), |
| 14 | 14 | arch: Arch::Arm, |
| 15 | 15 | options: TargetOptions { |
| 16 | abi: Abi::Eabi, | |
| 16 | cfg_abi: CfgAbi::Eabi, | |
| 17 | 17 | llvm_floatabi: Some(FloatAbi::Soft), |
| 18 | 18 | features: "+soft-float,+strict-align".into(), |
| 19 | 19 | // Atomic operations provided by compiler-builtins |
compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_uclibceabi.rs+2-2| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 1 | use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 2 | 2 | |
| 3 | 3 | pub(crate) fn target() -> Target { |
| 4 | 4 | Target { |
| ... | ... | @@ -13,7 +13,7 @@ pub(crate) fn target() -> Target { |
| 13 | 13 | data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(), |
| 14 | 14 | arch: Arch::Arm, |
| 15 | 15 | options: TargetOptions { |
| 16 | abi: Abi::Eabi, | |
| 16 | cfg_abi: CfgAbi::Eabi, | |
| 17 | 17 | llvm_floatabi: Some(FloatAbi::Soft), |
| 18 | 18 | features: "+soft-float,+strict-align".into(), |
| 19 | 19 | // Atomic operations provided by compiler-builtins |
compiler/rustc_target/src/spec/targets/armv6_none_eabi.rs+2-2| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | //! Targets the ARMv6K architecture, with `a32` code by default. |
| 2 | 2 | |
| 3 | use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base, cvs}; | |
| 3 | use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base, cvs}; | |
| 4 | 4 | |
| 5 | 5 | pub(crate) fn target() -> Target { |
| 6 | 6 | Target { |
| ... | ... | @@ -15,7 +15,7 @@ pub(crate) fn target() -> Target { |
| 15 | 15 | arch: Arch::Arm, |
| 16 | 16 | data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(), |
| 17 | 17 | options: TargetOptions { |
| 18 | abi: Abi::Eabi, | |
| 18 | cfg_abi: CfgAbi::Eabi, | |
| 19 | 19 | llvm_floatabi: Some(FloatAbi::Soft), |
| 20 | 20 | asm_args: cvs!["-mthumb-interwork", "-march=armv6", "-mlittle-endian",], |
| 21 | 21 | features: "+soft-float,+strict-align,+v6k".into(), |
compiler/rustc_target/src/spec/targets/armv6_none_eabihf.rs+2-2| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | //! Targets the ARMv6K architecture, with `a32` code by default, and hard-float ABI |
| 2 | 2 | |
| 3 | use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base, cvs}; | |
| 3 | use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base, cvs}; | |
| 4 | 4 | |
| 5 | 5 | pub(crate) fn target() -> Target { |
| 6 | 6 | Target { |
| ... | ... | @@ -15,7 +15,7 @@ pub(crate) fn target() -> Target { |
| 15 | 15 | arch: Arch::Arm, |
| 16 | 16 | data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(), |
| 17 | 17 | options: TargetOptions { |
| 18 | abi: Abi::EabiHf, | |
| 18 | cfg_abi: CfgAbi::EabiHf, | |
| 19 | 19 | llvm_floatabi: Some(FloatAbi::Hard), |
| 20 | 20 | asm_args: cvs!["-mthumb-interwork", "-march=armv6", "-mlittle-endian",], |
| 21 | 21 | features: "+strict-align,+v6k,+vfp2,-d32".into(), |
compiler/rustc_target/src/spec/targets/armv6_unknown_freebsd.rs+2-2| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 1 | use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 2 | 2 | |
| 3 | 3 | pub(crate) fn target() -> Target { |
| 4 | 4 | Target { |
| ... | ... | @@ -13,7 +13,7 @@ pub(crate) fn target() -> Target { |
| 13 | 13 | data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(), |
| 14 | 14 | arch: Arch::Arm, |
| 15 | 15 | options: TargetOptions { |
| 16 | abi: Abi::EabiHf, | |
| 16 | cfg_abi: CfgAbi::EabiHf, | |
| 17 | 17 | llvm_floatabi: Some(FloatAbi::Hard), |
| 18 | 18 | features: "+v6,+vfp2".into(), |
| 19 | 19 | max_atomic_width: Some(64), |
compiler/rustc_target/src/spec/targets/armv6_unknown_netbsd_eabihf.rs+2-2| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 1 | use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 2 | 2 | |
| 3 | 3 | pub(crate) fn target() -> Target { |
| 4 | 4 | Target { |
| ... | ... | @@ -13,7 +13,7 @@ pub(crate) fn target() -> Target { |
| 13 | 13 | data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(), |
| 14 | 14 | arch: Arch::Arm, |
| 15 | 15 | options: TargetOptions { |
| 16 | abi: Abi::EabiHf, | |
| 16 | cfg_abi: CfgAbi::EabiHf, | |
| 17 | 17 | llvm_floatabi: Some(FloatAbi::Hard), |
| 18 | 18 | features: "+v6,+vfp2".into(), |
| 19 | 19 | max_atomic_width: Some(64), |
compiler/rustc_target/src/spec/targets/armv6k_nintendo_3ds.rs+2-2| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | use 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, | |
| 3 | 3 | TargetOptions, cvs, |
| 4 | 4 | }; |
| 5 | 5 | |
| ... | ... | @@ -29,7 +29,7 @@ pub(crate) fn target() -> Target { |
| 29 | 29 | env: Env::Newlib, |
| 30 | 30 | vendor: "nintendo".into(), |
| 31 | 31 | cpu: "mpcore".into(), |
| 32 | abi: Abi::EabiHf, | |
| 32 | cfg_abi: CfgAbi::EabiHf, | |
| 33 | 33 | llvm_floatabi: Some(FloatAbi::Hard), |
| 34 | 34 | families: cvs!["unix"], |
| 35 | 35 | linker: Some("arm-none-eabi-gcc".into()), |
compiler/rustc_target/src/spec/targets/armv7_linux_androideabi.rs+2-2| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | use crate::spec::{ |
| 2 | Abi, Arch, Cc, FloatAbi, LinkerFlavor, Lld, SanitizerSet, Target, TargetMetadata, | |
| 2 | Arch, Cc, CfgAbi, FloatAbi, LinkerFlavor, Lld, SanitizerSet, Target, TargetMetadata, | |
| 3 | 3 | TargetOptions, base, |
| 4 | 4 | }; |
| 5 | 5 | |
| ... | ... | @@ -26,7 +26,7 @@ pub(crate) fn target() -> Target { |
| 26 | 26 | data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(), |
| 27 | 27 | arch: Arch::Arm, |
| 28 | 28 | options: TargetOptions { |
| 29 | abi: Abi::Eabi, | |
| 29 | cfg_abi: CfgAbi::Eabi, | |
| 30 | 30 | llvm_floatabi: Some(FloatAbi::Soft), |
| 31 | 31 | features: "+v7,+thumb-mode,+thumb2,+vfp3d16,-neon".into(), |
| 32 | 32 | supported_sanitizers: SanitizerSet::ADDRESS, |
compiler/rustc_target/src/spec/targets/armv7_rtems_eabihf.rs+2-2| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | use 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, | |
| 3 | 3 | TargetMetadata, TargetOptions, cvs, |
| 4 | 4 | }; |
| 5 | 5 | |
| ... | ... | @@ -19,7 +19,7 @@ pub(crate) fn target() -> Target { |
| 19 | 19 | options: TargetOptions { |
| 20 | 20 | os: Os::Rtems, |
| 21 | 21 | families: cvs!["unix"], |
| 22 | abi: Abi::EabiHf, | |
| 22 | cfg_abi: CfgAbi::EabiHf, | |
| 23 | 23 | llvm_floatabi: Some(FloatAbi::Hard), |
| 24 | 24 | linker_flavor: LinkerFlavor::Gnu(Cc::Yes, Lld::No), |
| 25 | 25 | linker: None, |
compiler/rustc_target/src/spec/targets/armv7_sony_vita_newlibeabihf.rs+2-2| ... | ... | @@ -1,7 +1,7 @@ |
| 1 | 1 | use rustc_abi::Endian; |
| 2 | 2 | |
| 3 | 3 | use 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, | |
| 5 | 5 | TargetOptions, cvs, |
| 6 | 6 | }; |
| 7 | 7 | |
| ... | ... | @@ -34,7 +34,7 @@ pub(crate) fn target() -> Target { |
| 34 | 34 | c_int_width: 32, |
| 35 | 35 | env: Env::Newlib, |
| 36 | 36 | vendor: "sony".into(), |
| 37 | abi: Abi::EabiHf, | |
| 37 | cfg_abi: CfgAbi::EabiHf, | |
| 38 | 38 | llvm_floatabi: Some(FloatAbi::Hard), |
| 39 | 39 | linker_flavor: LinkerFlavor::Gnu(Cc::Yes, Lld::No), |
| 40 | 40 | no_default_libraries: false, |
compiler/rustc_target/src/spec/targets/armv7_unknown_freebsd.rs+2-2| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 1 | use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 2 | 2 | |
| 3 | 3 | pub(crate) fn target() -> Target { |
| 4 | 4 | Target { |
| ... | ... | @@ -13,7 +13,7 @@ pub(crate) fn target() -> Target { |
| 13 | 13 | data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(), |
| 14 | 14 | arch: Arch::Arm, |
| 15 | 15 | options: TargetOptions { |
| 16 | abi: Abi::EabiHf, | |
| 16 | cfg_abi: CfgAbi::EabiHf, | |
| 17 | 17 | llvm_floatabi: Some(FloatAbi::Hard), |
| 18 | 18 | features: "+v7,+vfp3d16,+thumb2,-neon".into(), |
| 19 | 19 | max_atomic_width: Some(64), |
compiler/rustc_target/src/spec/targets/armv7_unknown_linux_gnueabi.rs+2-2| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 1 | use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 2 | 2 | |
| 3 | 3 | // This target is for glibc Linux on ARMv7 without thumb-mode, NEON or |
| 4 | 4 | // hardfloat. |
| ... | ... | @@ -16,7 +16,7 @@ pub(crate) fn target() -> Target { |
| 16 | 16 | data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(), |
| 17 | 17 | arch: Arch::Arm, |
| 18 | 18 | options: TargetOptions { |
| 19 | abi: Abi::Eabi, | |
| 19 | cfg_abi: CfgAbi::Eabi, | |
| 20 | 20 | llvm_floatabi: Some(FloatAbi::Soft), |
| 21 | 21 | features: "+v7,+thumb2,+soft-float,-neon".into(), |
| 22 | 22 | max_atomic_width: Some(64), |
compiler/rustc_target/src/spec/targets/armv7_unknown_linux_gnueabihf.rs+2-2| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 1 | use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 2 | 2 | |
| 3 | 3 | // This target is for glibc Linux on ARMv7 without NEON or |
| 4 | 4 | // thumb-mode. See the thumbv7neon variant for enabling both. |
| ... | ... | @@ -16,7 +16,7 @@ pub(crate) fn target() -> Target { |
| 16 | 16 | data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(), |
| 17 | 17 | arch: Arch::Arm, |
| 18 | 18 | options: TargetOptions { |
| 19 | abi: Abi::EabiHf, | |
| 19 | cfg_abi: CfgAbi::EabiHf, | |
| 20 | 20 | llvm_floatabi: Some(FloatAbi::Hard), |
| 21 | 21 | // Info about features at https://wiki.debian.org/ArmHardFloatPort |
| 22 | 22 | features: "+v7,+vfp3d16,+thumb2,-neon".into(), |
compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabi.rs+2-2| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 1 | use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 2 | 2 | |
| 3 | 3 | // This target is for musl Linux on ARMv7 without thumb-mode, NEON or |
| 4 | 4 | // hardfloat. |
| ... | ... | @@ -19,7 +19,7 @@ pub(crate) fn target() -> Target { |
| 19 | 19 | arch: Arch::Arm, |
| 20 | 20 | |
| 21 | 21 | options: TargetOptions { |
| 22 | abi: Abi::Eabi, | |
| 22 | cfg_abi: CfgAbi::Eabi, | |
| 23 | 23 | llvm_floatabi: Some(FloatAbi::Soft), |
| 24 | 24 | features: "+v7,+thumb2,+soft-float,-neon".into(), |
| 25 | 25 | max_atomic_width: Some(64), |
compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs+2-2| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 1 | use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 2 | 2 | |
| 3 | 3 | // This target is for musl Linux on ARMv7 without thumb-mode or NEON. |
| 4 | 4 | |
| ... | ... | @@ -18,7 +18,7 @@ pub(crate) fn target() -> Target { |
| 18 | 18 | // Most of these settings are copied from the armv7_unknown_linux_gnueabihf |
| 19 | 19 | // target. |
| 20 | 20 | options: TargetOptions { |
| 21 | abi: Abi::EabiHf, | |
| 21 | cfg_abi: CfgAbi::EabiHf, | |
| 22 | 22 | llvm_floatabi: Some(FloatAbi::Hard), |
| 23 | 23 | features: "+v7,+vfp3d16,+thumb2,-neon".into(), |
| 24 | 24 | max_atomic_width: Some(64), |
compiler/rustc_target/src/spec/targets/armv7_unknown_linux_ohos.rs+2-2| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 1 | use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 2 | 2 | |
| 3 | 3 | // This target is for OpenHarmony on ARMv7 Linux with thumb-mode, but no NEON or |
| 4 | 4 | // hardfloat. |
| ... | ... | @@ -19,7 +19,7 @@ pub(crate) fn target() -> Target { |
| 19 | 19 | arch: Arch::Arm, |
| 20 | 20 | |
| 21 | 21 | options: TargetOptions { |
| 22 | abi: Abi::Eabi, | |
| 22 | cfg_abi: CfgAbi::Eabi, | |
| 23 | 23 | llvm_floatabi: Some(FloatAbi::Soft), |
| 24 | 24 | features: "+v7,+thumb2,+soft-float,-neon".into(), |
| 25 | 25 | max_atomic_width: Some(64), |
compiler/rustc_target/src/spec/targets/armv7_unknown_linux_uclibceabi.rs+2-2| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 1 | use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 2 | 2 | |
| 3 | 3 | // This target is for uclibc Linux on ARMv7 without NEON, |
| 4 | 4 | // thumb-mode or hardfloat. |
| ... | ... | @@ -18,7 +18,7 @@ pub(crate) fn target() -> Target { |
| 18 | 18 | arch: Arch::Arm, |
| 19 | 19 | |
| 20 | 20 | options: TargetOptions { |
| 21 | abi: Abi::Eabi, | |
| 21 | cfg_abi: CfgAbi::Eabi, | |
| 22 | 22 | llvm_floatabi: Some(FloatAbi::Soft), |
| 23 | 23 | features: "+v7,+thumb2,+soft-float,-neon".into(), |
| 24 | 24 | cpu: "generic".into(), |
compiler/rustc_target/src/spec/targets/armv7_unknown_linux_uclibceabihf.rs+2-2| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 1 | use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 2 | 2 | |
| 3 | 3 | // This target is for uclibc Linux on ARMv7 without NEON or |
| 4 | 4 | // thumb-mode. See the thumbv7neon variant for enabling both. |
| ... | ... | @@ -23,7 +23,7 @@ pub(crate) fn target() -> Target { |
| 23 | 23 | cpu: "generic".into(), |
| 24 | 24 | max_atomic_width: Some(64), |
| 25 | 25 | mcount: "_mcount".into(), |
| 26 | abi: Abi::EabiHf, | |
| 26 | cfg_abi: CfgAbi::EabiHf, | |
| 27 | 27 | llvm_floatabi: Some(FloatAbi::Hard), |
| 28 | 28 | ..base |
| 29 | 29 | }, |
compiler/rustc_target/src/spec/targets/armv7_unknown_netbsd_eabihf.rs+2-2| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 1 | use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 2 | 2 | |
| 3 | 3 | pub(crate) fn target() -> Target { |
| 4 | 4 | Target { |
| ... | ... | @@ -13,7 +13,7 @@ pub(crate) fn target() -> Target { |
| 13 | 13 | data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(), |
| 14 | 14 | arch: Arch::Arm, |
| 15 | 15 | options: TargetOptions { |
| 16 | abi: Abi::EabiHf, | |
| 16 | cfg_abi: CfgAbi::EabiHf, | |
| 17 | 17 | llvm_floatabi: Some(FloatAbi::Hard), |
| 18 | 18 | features: "+v7,+vfp3d16,+thumb2,-neon".into(), |
| 19 | 19 | max_atomic_width: Some(64), |
compiler/rustc_target/src/spec/targets/armv7_unknown_trusty.rs+2-2| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | use crate::spec::{ |
| 2 | Abi, Arch, FloatAbi, LinkSelfContainedDefault, Os, PanicStrategy, RelroLevel, Target, | |
| 2 | Arch, CfgAbi, FloatAbi, LinkSelfContainedDefault, Os, PanicStrategy, RelroLevel, Target, | |
| 3 | 3 | TargetMetadata, TargetOptions, |
| 4 | 4 | }; |
| 5 | 5 | |
| ... | ... | @@ -19,7 +19,7 @@ pub(crate) fn target() -> Target { |
| 19 | 19 | data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(), |
| 20 | 20 | arch: Arch::Arm, |
| 21 | 21 | options: TargetOptions { |
| 22 | abi: Abi::Eabi, | |
| 22 | cfg_abi: CfgAbi::Eabi, | |
| 23 | 23 | llvm_floatabi: Some(FloatAbi::Soft), |
| 24 | 24 | features: "+v7,+thumb2,+soft-float,-neon".into(), |
| 25 | 25 | max_atomic_width: Some(64), |
compiler/rustc_target/src/spec/targets/armv7_wrs_vxworks_eabihf.rs+2-2| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 1 | use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 2 | 2 | |
| 3 | 3 | pub(crate) fn target() -> Target { |
| 4 | 4 | Target { |
| ... | ... | @@ -13,7 +13,7 @@ pub(crate) fn target() -> Target { |
| 13 | 13 | data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(), |
| 14 | 14 | arch: Arch::Arm, |
| 15 | 15 | options: TargetOptions { |
| 16 | abi: Abi::EabiHf, | |
| 16 | cfg_abi: CfgAbi::EabiHf, | |
| 17 | 17 | llvm_floatabi: Some(FloatAbi::Hard), |
| 18 | 18 | // Info about features at https://wiki.debian.org/ArmHardFloatPort |
| 19 | 19 | features: "+v7,+vfp3d16,+thumb2,-neon".into(), |
compiler/rustc_target/src/spec/targets/armv7a_kmc_solid_asp3_eabi.rs+4-2| ... | ... | @@ -1,4 +1,6 @@ |
| 1 | use crate::spec::{Abi, Arch, FloatAbi, RelocModel, Target, TargetMetadata, TargetOptions, base}; | |
| 1 | use crate::spec::{ | |
| 2 | Arch, CfgAbi, FloatAbi, RelocModel, Target, TargetMetadata, TargetOptions, base, | |
| 3 | }; | |
| 2 | 4 | |
| 3 | 5 | pub(crate) fn target() -> Target { |
| 4 | 6 | let base = base::solid::opts(); |
| ... | ... | @@ -14,7 +16,7 @@ pub(crate) fn target() -> Target { |
| 14 | 16 | data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(), |
| 15 | 17 | arch: Arch::Arm, |
| 16 | 18 | options: TargetOptions { |
| 17 | abi: Abi::Eabi, | |
| 19 | cfg_abi: CfgAbi::Eabi, | |
| 18 | 20 | llvm_floatabi: Some(FloatAbi::Soft), |
| 19 | 21 | linker: Some("arm-kmc-eabi-gcc".into()), |
| 20 | 22 | 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 @@ |
| 1 | use crate::spec::{Abi, Arch, FloatAbi, RelocModel, Target, TargetMetadata, TargetOptions, base}; | |
| 1 | use crate::spec::{ | |
| 2 | Arch, CfgAbi, FloatAbi, RelocModel, Target, TargetMetadata, TargetOptions, base, | |
| 3 | }; | |
| 2 | 4 | |
| 3 | 5 | pub(crate) fn target() -> Target { |
| 4 | 6 | let base = base::solid::opts(); |
| ... | ... | @@ -14,7 +16,7 @@ pub(crate) fn target() -> Target { |
| 14 | 16 | data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(), |
| 15 | 17 | arch: Arch::Arm, |
| 16 | 18 | options: TargetOptions { |
| 17 | abi: Abi::EabiHf, | |
| 19 | cfg_abi: CfgAbi::EabiHf, | |
| 18 | 20 | llvm_floatabi: Some(FloatAbi::Hard), |
| 19 | 21 | linker: Some("arm-kmc-eabi-gcc".into()), |
| 20 | 22 | features: "+v7,+vfp3d16,+thumb2,-neon".into(), |
compiler/rustc_target/src/spec/targets/armv7a_none_eabi.rs+2-2| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | // Targets the Little-endian Cortex-A8 (and similar) processors (ARMv7-A) |
| 2 | 2 | |
| 3 | use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 3 | use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 4 | 4 | |
| 5 | 5 | pub(crate) fn target() -> Target { |
| 6 | 6 | Target { |
| ... | ... | @@ -15,7 +15,7 @@ pub(crate) fn target() -> Target { |
| 15 | 15 | data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(), |
| 16 | 16 | arch: Arch::Arm, |
| 17 | 17 | options: TargetOptions { |
| 18 | abi: Abi::Eabi, | |
| 18 | cfg_abi: CfgAbi::Eabi, | |
| 19 | 19 | llvm_floatabi: Some(FloatAbi::Soft), |
| 20 | 20 | features: "+soft-float,-neon,+strict-align".into(), |
| 21 | 21 | max_atomic_width: Some(64), |
compiler/rustc_target/src/spec/targets/armv7a_none_eabihf.rs+2-2| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | // Targets the Little-endian Cortex-A8 (and similar) processors (ARMv7-A) |
| 2 | 2 | |
| 3 | use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 3 | use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 4 | 4 | |
| 5 | 5 | pub(crate) fn target() -> Target { |
| 6 | 6 | Target { |
| ... | ... | @@ -15,7 +15,7 @@ pub(crate) fn target() -> Target { |
| 15 | 15 | data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(), |
| 16 | 16 | arch: Arch::Arm, |
| 17 | 17 | options: TargetOptions { |
| 18 | abi: Abi::EabiHf, | |
| 18 | cfg_abi: CfgAbi::EabiHf, | |
| 19 | 19 | llvm_floatabi: Some(FloatAbi::Hard), |
| 20 | 20 | features: "+vfp3d16,-neon,+strict-align".into(), |
| 21 | 21 | max_atomic_width: Some(64), |
compiler/rustc_target/src/spec/targets/armv7a_nuttx_eabi.rs+2-2| ... | ... | @@ -5,13 +5,13 @@ |
| 5 | 5 | // configuration without hardware floating point support. |
| 6 | 6 | |
| 7 | 7 | use crate::spec::{ |
| 8 | Abi, Arch, Cc, FloatAbi, LinkerFlavor, Lld, Os, PanicStrategy, RelocModel, Target, | |
| 8 | Arch, Cc, CfgAbi, FloatAbi, LinkerFlavor, Lld, Os, PanicStrategy, RelocModel, Target, | |
| 9 | 9 | TargetMetadata, TargetOptions, cvs, |
| 10 | 10 | }; |
| 11 | 11 | |
| 12 | 12 | pub(crate) fn target() -> Target { |
| 13 | 13 | let opts = TargetOptions { |
| 14 | abi: Abi::Eabi, | |
| 14 | cfg_abi: CfgAbi::Eabi, | |
| 15 | 15 | llvm_floatabi: Some(FloatAbi::Soft), |
| 16 | 16 | linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes), |
| 17 | 17 | linker: Some("rust-lld".into()), |
compiler/rustc_target/src/spec/targets/armv7a_nuttx_eabihf.rs+2-2| ... | ... | @@ -5,13 +5,13 @@ |
| 5 | 5 | // configuration with hardware floating point support. |
| 6 | 6 | |
| 7 | 7 | use crate::spec::{ |
| 8 | Abi, Arch, Cc, FloatAbi, LinkerFlavor, Lld, Os, PanicStrategy, RelocModel, Target, | |
| 8 | Arch, Cc, CfgAbi, FloatAbi, LinkerFlavor, Lld, Os, PanicStrategy, RelocModel, Target, | |
| 9 | 9 | TargetMetadata, TargetOptions, cvs, |
| 10 | 10 | }; |
| 11 | 11 | |
| 12 | 12 | pub(crate) fn target() -> Target { |
| 13 | 13 | let opts = TargetOptions { |
| 14 | abi: Abi::EabiHf, | |
| 14 | cfg_abi: CfgAbi::EabiHf, | |
| 15 | 15 | llvm_floatabi: Some(FloatAbi::Hard), |
| 16 | 16 | linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes), |
| 17 | 17 | linker: Some("rust-lld".into()), |
compiler/rustc_target/src/spec/targets/armv7a_vex_v5.rs+2-2| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | use 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, | |
| 3 | 3 | TargetMetadata, TargetOptions, |
| 4 | 4 | }; |
| 5 | 5 | |
| ... | ... | @@ -11,7 +11,7 @@ pub(crate) fn target() -> Target { |
| 11 | 11 | env: Env::V5, |
| 12 | 12 | os: Os::VexOs, |
| 13 | 13 | cpu: "cortex-a9".into(), |
| 14 | abi: Abi::EabiHf, | |
| 14 | cfg_abi: CfgAbi::EabiHf, | |
| 15 | 15 | is_like_vexos: true, |
| 16 | 16 | llvm_floatabi: Some(FloatAbi::Hard), |
| 17 | 17 | linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes), |
compiler/rustc_target/src/spec/targets/armv7r_none_eabi.rs+2-2| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | // Targets the Little-endian Cortex-R4/R5 processor (ARMv7-R) |
| 2 | 2 | |
| 3 | use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 3 | use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 4 | 4 | |
| 5 | 5 | pub(crate) fn target() -> Target { |
| 6 | 6 | Target { |
| ... | ... | @@ -15,7 +15,7 @@ pub(crate) fn target() -> Target { |
| 15 | 15 | data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(), |
| 16 | 16 | arch: Arch::Arm, |
| 17 | 17 | options: TargetOptions { |
| 18 | abi: Abi::Eabi, | |
| 18 | cfg_abi: CfgAbi::Eabi, | |
| 19 | 19 | llvm_floatabi: Some(FloatAbi::Soft), |
| 20 | 20 | max_atomic_width: Some(64), |
| 21 | 21 | has_thumb_interworking: true, |
compiler/rustc_target/src/spec/targets/armv7r_none_eabihf.rs+2-2| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | // Targets the Little-endian Cortex-R4F/R5F processor (ARMv7-R) |
| 2 | 2 | |
| 3 | use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 3 | use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 4 | 4 | |
| 5 | 5 | pub(crate) fn target() -> Target { |
| 6 | 6 | Target { |
| ... | ... | @@ -15,7 +15,7 @@ pub(crate) fn target() -> Target { |
| 15 | 15 | data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(), |
| 16 | 16 | arch: Arch::Arm, |
| 17 | 17 | options: TargetOptions { |
| 18 | abi: Abi::EabiHf, | |
| 18 | cfg_abi: CfgAbi::EabiHf, | |
| 19 | 19 | llvm_floatabi: Some(FloatAbi::Hard), |
| 20 | 20 | features: "+vfp3d16".into(), |
| 21 | 21 | max_atomic_width: Some(64), |
compiler/rustc_target/src/spec/targets/armv8r_none_eabihf.rs+2-2| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | // Targets the Little-endian Cortex-R52 processor (ARMv8-R) |
| 2 | 2 | |
| 3 | use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 3 | use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 4 | 4 | |
| 5 | 5 | pub(crate) fn target() -> Target { |
| 6 | 6 | Target { |
| ... | ... | @@ -16,7 +16,7 @@ pub(crate) fn target() -> Target { |
| 16 | 16 | arch: Arch::Arm, |
| 17 | 17 | |
| 18 | 18 | options: TargetOptions { |
| 19 | abi: Abi::EabiHf, | |
| 19 | cfg_abi: CfgAbi::EabiHf, | |
| 20 | 20 | llvm_floatabi: Some(FloatAbi::Hard), |
| 21 | 21 | // Armv8-R requires a minimum set of floating-point features equivalent to: |
| 22 | 22 | // 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 @@ |
| 1 | use crate::spec::{Abi, Arch, Cc, LinkerFlavor, Lld, Target, TargetMetadata, TargetOptions, base}; | |
| 1 | use crate::spec::{ | |
| 2 | Arch, Cc, CfgAbi, LinkerFlavor, Lld, Target, TargetMetadata, TargetOptions, base, | |
| 3 | }; | |
| 2 | 4 | |
| 3 | 5 | // This target is for glibc Linux on Csky |
| 4 | 6 | |
| ... | ... | @@ -16,7 +18,7 @@ pub(crate) fn target() -> Target { |
| 16 | 18 | 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(), |
| 17 | 19 | arch: Arch::CSky, |
| 18 | 20 | options: TargetOptions { |
| 19 | abi: Abi::AbiV2, | |
| 21 | cfg_abi: CfgAbi::AbiV2, | |
| 20 | 22 | features: "+2e3,+3e7,+7e10,+cache,+dsp1e2,+dspe60,+e1,+e2,+edsp,+elrw,+hard-tp,+high-registers,+hwdiv,+mp,+mp1e2,+nvic,+trust".into(), |
| 21 | 23 | late_link_args: TargetOptions::link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-l:libatomic.a"]), |
| 22 | 24 | max_atomic_width: Some(32), |
compiler/rustc_target/src/spec/targets/csky_unknown_linux_gnuabiv2hf.rs+4-2| ... | ... | @@ -1,4 +1,6 @@ |
| 1 | use crate::spec::{Abi, Arch, Cc, LinkerFlavor, Lld, Target, TargetMetadata, TargetOptions, base}; | |
| 1 | use crate::spec::{ | |
| 2 | Arch, Cc, CfgAbi, LinkerFlavor, Lld, Target, TargetMetadata, TargetOptions, base, | |
| 3 | }; | |
| 2 | 4 | |
| 3 | 5 | // This target is for glibc Linux on Csky |
| 4 | 6 | |
| ... | ... | @@ -16,7 +18,7 @@ pub(crate) fn target() -> Target { |
| 16 | 18 | 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(), |
| 17 | 19 | arch: Arch::CSky, |
| 18 | 20 | options: TargetOptions { |
| 19 | abi: Abi::AbiV2Hf, | |
| 21 | cfg_abi: CfgAbi::AbiV2Hf, | |
| 20 | 22 | cpu: "ck860fv".into(), |
| 21 | 23 | 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(), |
| 22 | 24 | 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 @@ |
| 1 | 1 | use crate::spec::{ |
| 2 | Arch, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions, | |
| 2 | Arch, Cc, LinkerFlavor, Lld, LlvmAbi, PanicStrategy, RelocModel, Target, TargetMetadata, | |
| 3 | TargetOptions, | |
| 3 | 4 | }; |
| 4 | 5 | |
| 5 | 6 | pub(crate) fn target() -> Target { |
| ... | ... | @@ -19,7 +20,7 @@ pub(crate) fn target() -> Target { |
| 19 | 20 | features: "+f,+d".into(), |
| 20 | 21 | linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes), |
| 21 | 22 | linker: Some("rust-lld".into()), |
| 22 | llvm_abiname: "ilp32d".into(), | |
| 23 | llvm_abiname: LlvmAbi::Ilp32d, | |
| 23 | 24 | max_atomic_width: Some(32), |
| 24 | 25 | relocation_model: RelocModel::Static, |
| 25 | 26 | panic_strategy: PanicStrategy::Abort, |
compiler/rustc_target/src/spec/targets/loongarch32_unknown_none_softfloat.rs+4-4| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | use 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, | |
| 4 | 4 | }; |
| 5 | 5 | |
| 6 | 6 | pub(crate) fn target() -> Target { |
| ... | ... | @@ -18,10 +18,10 @@ pub(crate) fn target() -> Target { |
| 18 | 18 | options: TargetOptions { |
| 19 | 19 | cpu: "generic".into(), |
| 20 | 20 | features: "-f,-d".into(), |
| 21 | abi: Abi::SoftFloat, | |
| 21 | cfg_abi: CfgAbi::SoftFloat, | |
| 22 | 22 | linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes), |
| 23 | 23 | linker: Some("rust-lld".into()), |
| 24 | llvm_abiname: "ilp32s".into(), | |
| 24 | llvm_abiname: LlvmAbi::Ilp32s, | |
| 25 | 25 | max_atomic_width: Some(32), |
| 26 | 26 | relocation_model: RelocModel::Static, |
| 27 | 27 | panic_strategy: PanicStrategy::Abort, |
compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_gnu.rs+4-2| ... | ... | @@ -1,4 +1,6 @@ |
| 1 | use crate::spec::{Arch, CodeModel, SanitizerSet, Target, TargetMetadata, TargetOptions, base}; | |
| 1 | use crate::spec::{ | |
| 2 | Arch, CodeModel, LlvmAbi, SanitizerSet, Target, TargetMetadata, TargetOptions, base, | |
| 3 | }; | |
| 2 | 4 | |
| 3 | 5 | pub(crate) fn target() -> Target { |
| 4 | 6 | Target { |
| ... | ... | @@ -16,7 +18,7 @@ pub(crate) fn target() -> Target { |
| 16 | 18 | code_model: Some(CodeModel::Medium), |
| 17 | 19 | cpu: "generic".into(), |
| 18 | 20 | features: "+f,+d,+lsx,+relax".into(), |
| 19 | llvm_abiname: "lp64d".into(), | |
| 21 | llvm_abiname: LlvmAbi::Lp64d, | |
| 20 | 22 | max_atomic_width: Some(64), |
| 21 | 23 | supported_sanitizers: SanitizerSet::ADDRESS |
| 22 | 24 | | SanitizerSet::CFI |
compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_musl.rs+4-2| ... | ... | @@ -1,4 +1,6 @@ |
| 1 | use crate::spec::{Arch, CodeModel, SanitizerSet, Target, TargetMetadata, TargetOptions, base}; | |
| 1 | use crate::spec::{ | |
| 2 | Arch, CodeModel, LlvmAbi, SanitizerSet, Target, TargetMetadata, TargetOptions, base, | |
| 3 | }; | |
| 2 | 4 | |
| 3 | 5 | pub(crate) fn target() -> Target { |
| 4 | 6 | Target { |
| ... | ... | @@ -16,7 +18,7 @@ pub(crate) fn target() -> Target { |
| 16 | 18 | code_model: Some(CodeModel::Medium), |
| 17 | 19 | cpu: "generic".into(), |
| 18 | 20 | features: "+f,+d,+lsx,+relax".into(), |
| 19 | llvm_abiname: "lp64d".into(), | |
| 21 | llvm_abiname: LlvmAbi::Lp64d, | |
| 20 | 22 | max_atomic_width: Some(64), |
| 21 | 23 | crt_static_default: false, |
| 22 | 24 | supported_sanitizers: SanitizerSet::ADDRESS |
compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_ohos.rs+4-2| ... | ... | @@ -1,4 +1,6 @@ |
| 1 | use crate::spec::{Arch, CodeModel, SanitizerSet, Target, TargetMetadata, TargetOptions, base}; | |
| 1 | use crate::spec::{ | |
| 2 | Arch, CodeModel, LlvmAbi, SanitizerSet, Target, TargetMetadata, TargetOptions, base, | |
| 3 | }; | |
| 2 | 4 | |
| 3 | 5 | pub(crate) fn target() -> Target { |
| 4 | 6 | Target { |
| ... | ... | @@ -16,7 +18,7 @@ pub(crate) fn target() -> Target { |
| 16 | 18 | code_model: Some(CodeModel::Medium), |
| 17 | 19 | cpu: "generic".into(), |
| 18 | 20 | features: "+f,+d,+lsx,+relax".into(), |
| 19 | llvm_abiname: "lp64d".into(), | |
| 21 | llvm_abiname: LlvmAbi::Lp64d, | |
| 20 | 22 | max_atomic_width: Some(64), |
| 21 | 23 | supported_sanitizers: SanitizerSet::ADDRESS |
| 22 | 24 | | SanitizerSet::CFI |
compiler/rustc_target/src/spec/targets/loongarch64_unknown_none.rs+3-3| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | use 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, | |
| 4 | 4 | }; |
| 5 | 5 | |
| 6 | 6 | pub(crate) fn target() -> Target { |
| ... | ... | @@ -20,7 +20,7 @@ pub(crate) fn target() -> Target { |
| 20 | 20 | features: "+f,+d,-lsx".into(), |
| 21 | 21 | linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes), |
| 22 | 22 | linker: Some("rust-lld".into()), |
| 23 | llvm_abiname: "lp64d".into(), | |
| 23 | llvm_abiname: LlvmAbi::Lp64d, | |
| 24 | 24 | max_atomic_width: Some(64), |
| 25 | 25 | relocation_model: RelocModel::Static, |
| 26 | 26 | panic_strategy: PanicStrategy::Abort, |
compiler/rustc_target/src/spec/targets/loongarch64_unknown_none_softfloat.rs+4-4| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | use 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, | |
| 4 | 4 | }; |
| 5 | 5 | |
| 6 | 6 | pub(crate) fn target() -> Target { |
| ... | ... | @@ -18,10 +18,10 @@ pub(crate) fn target() -> Target { |
| 18 | 18 | options: TargetOptions { |
| 19 | 19 | cpu: "generic".into(), |
| 20 | 20 | features: "-f,-d".into(), |
| 21 | abi: Abi::SoftFloat, | |
| 21 | cfg_abi: CfgAbi::SoftFloat, | |
| 22 | 22 | linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes), |
| 23 | 23 | linker: Some("rust-lld".into()), |
| 24 | llvm_abiname: "lp64s".into(), | |
| 24 | llvm_abiname: LlvmAbi::Lp64s, | |
| 25 | 25 | max_atomic_width: Some(64), |
| 26 | 26 | relocation_model: RelocModel::Static, |
| 27 | 27 | panic_strategy: PanicStrategy::Abort, |
compiler/rustc_target/src/spec/targets/mips64_openwrt_linux_musl.rs+3-3| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | |
| 3 | 3 | use rustc_abi::Endian; |
| 4 | 4 | |
| 5 | use crate::spec::{Abi, Arch, Target, TargetMetadata, TargetOptions, base}; | |
| 5 | use crate::spec::{Arch, CfgAbi, LlvmAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 6 | 6 | |
| 7 | 7 | pub(crate) fn target() -> Target { |
| 8 | 8 | let mut base = base::linux_musl::opts(); |
| ... | ... | @@ -24,10 +24,10 @@ pub(crate) fn target() -> Target { |
| 24 | 24 | arch: Arch::Mips64, |
| 25 | 25 | options: TargetOptions { |
| 26 | 26 | vendor: "openwrt".into(), |
| 27 | abi: Abi::Abi64, | |
| 27 | cfg_abi: CfgAbi::Abi64, | |
| 28 | 28 | endian: Endian::Big, |
| 29 | 29 | mcount: "_mcount".into(), |
| 30 | llvm_abiname: "n64".into(), | |
| 30 | llvm_abiname: LlvmAbi::N64, | |
| 31 | 31 | ..base |
| 32 | 32 | }, |
| 33 | 33 | } |
compiler/rustc_target/src/spec/targets/mips64_unknown_linux_gnuabi64.rs+3-3| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | use rustc_abi::Endian; |
| 2 | 2 | |
| 3 | use crate::spec::{Abi, Arch, Target, TargetMetadata, TargetOptions, base}; | |
| 3 | use crate::spec::{Arch, CfgAbi, LlvmAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 4 | 4 | |
| 5 | 5 | pub(crate) fn target() -> Target { |
| 6 | 6 | Target { |
| ... | ... | @@ -15,14 +15,14 @@ pub(crate) fn target() -> Target { |
| 15 | 15 | data_layout: "E-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(), |
| 16 | 16 | arch: Arch::Mips64, |
| 17 | 17 | options: TargetOptions { |
| 18 | abi: Abi::Abi64, | |
| 18 | cfg_abi: CfgAbi::Abi64, | |
| 19 | 19 | endian: Endian::Big, |
| 20 | 20 | // NOTE(mips64r2) matches C toolchain |
| 21 | 21 | cpu: "mips64r2".into(), |
| 22 | 22 | features: "+mips64r2,+xgot".into(), |
| 23 | 23 | max_atomic_width: Some(64), |
| 24 | 24 | mcount: "_mcount".into(), |
| 25 | llvm_abiname: "n64".into(), | |
| 25 | llvm_abiname: LlvmAbi::N64, | |
| 26 | 26 | |
| 27 | 27 | ..base::linux_gnu::opts() |
| 28 | 28 | }, |
compiler/rustc_target/src/spec/targets/mips64_unknown_linux_muslabi64.rs+3-3| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | use rustc_abi::Endian; |
| 2 | 2 | |
| 3 | use crate::spec::{Abi, Arch, Target, TargetMetadata, TargetOptions, base}; | |
| 3 | use crate::spec::{Arch, CfgAbi, LlvmAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 4 | 4 | |
| 5 | 5 | pub(crate) fn target() -> Target { |
| 6 | 6 | let mut base = base::linux_musl::opts(); |
| ... | ... | @@ -20,10 +20,10 @@ pub(crate) fn target() -> Target { |
| 20 | 20 | data_layout: "E-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(), |
| 21 | 21 | arch: Arch::Mips64, |
| 22 | 22 | options: TargetOptions { |
| 23 | abi: Abi::Abi64, | |
| 23 | cfg_abi: CfgAbi::Abi64, | |
| 24 | 24 | endian: Endian::Big, |
| 25 | 25 | mcount: "_mcount".into(), |
| 26 | llvm_abiname: "n64".into(), | |
| 26 | llvm_abiname: LlvmAbi::N64, | |
| 27 | 27 | ..base |
| 28 | 28 | }, |
| 29 | 29 | } |
compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_gnuabi64.rs+3-3| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | use crate::spec::{Abi, Arch, Target, TargetMetadata, TargetOptions, base}; | |
| 1 | use crate::spec::{Arch, CfgAbi, LlvmAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 2 | 2 | |
| 3 | 3 | pub(crate) fn target() -> Target { |
| 4 | 4 | Target { |
| ... | ... | @@ -13,13 +13,13 @@ pub(crate) fn target() -> Target { |
| 13 | 13 | data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(), |
| 14 | 14 | arch: Arch::Mips64, |
| 15 | 15 | options: TargetOptions { |
| 16 | abi: Abi::Abi64, | |
| 16 | cfg_abi: CfgAbi::Abi64, | |
| 17 | 17 | // NOTE(mips64r2) matches C toolchain |
| 18 | 18 | cpu: "mips64r2".into(), |
| 19 | 19 | features: "+mips64r2,+xgot".into(), |
| 20 | 20 | max_atomic_width: Some(64), |
| 21 | 21 | mcount: "_mcount".into(), |
| 22 | llvm_abiname: "n64".into(), | |
| 22 | llvm_abiname: LlvmAbi::N64, | |
| 23 | 23 | |
| 24 | 24 | ..base::linux_gnu::opts() |
| 25 | 25 | }, |
compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_muslabi64.rs+3-3| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | use crate::spec::{Abi, Arch, Target, TargetMetadata, TargetOptions, base}; | |
| 1 | use crate::spec::{Arch, CfgAbi, LlvmAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 2 | 2 | |
| 3 | 3 | pub(crate) fn target() -> Target { |
| 4 | 4 | let mut base = base::linux_musl::opts(); |
| ... | ... | @@ -18,9 +18,9 @@ pub(crate) fn target() -> Target { |
| 18 | 18 | data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(), |
| 19 | 19 | arch: Arch::Mips64, |
| 20 | 20 | options: TargetOptions { |
| 21 | abi: Abi::Abi64, | |
| 21 | cfg_abi: CfgAbi::Abi64, | |
| 22 | 22 | mcount: "_mcount".into(), |
| 23 | llvm_abiname: "n64".into(), | |
| 23 | llvm_abiname: LlvmAbi::N64, | |
| 24 | 24 | ..base |
| 25 | 25 | }, |
| 26 | 26 | } |
compiler/rustc_target/src/spec/targets/mips_mti_none_elf.rs+3-2| ... | ... | @@ -1,7 +1,8 @@ |
| 1 | 1 | use rustc_abi::Endian; |
| 2 | 2 | |
| 3 | 3 | use crate::spec::{ |
| 4 | Arch, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions, | |
| 4 | Arch, Cc, LinkerFlavor, Lld, LlvmAbi, PanicStrategy, RelocModel, Target, TargetMetadata, | |
| 5 | TargetOptions, | |
| 5 | 6 | }; |
| 6 | 7 | |
| 7 | 8 | pub(crate) fn target() -> Target { |
| ... | ... | @@ -24,7 +25,7 @@ pub(crate) fn target() -> Target { |
| 24 | 25 | endian: Endian::Big, |
| 25 | 26 | cpu: "mips32r2".into(), |
| 26 | 27 | |
| 27 | llvm_abiname: "o32".into(), | |
| 28 | llvm_abiname: LlvmAbi::O32, | |
| 28 | 29 | max_atomic_width: Some(32), |
| 29 | 30 | |
| 30 | 31 | features: "+mips32r2,+soft-float,+noabicalls".into(), |
compiler/rustc_target/src/spec/targets/mips_unknown_linux_gnu.rs+2-2| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | use rustc_abi::Endian; |
| 2 | 2 | |
| 3 | use crate::spec::{Arch, Target, TargetMetadata, TargetOptions, base}; | |
| 3 | use crate::spec::{Arch, LlvmAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 4 | 4 | |
| 5 | 5 | pub(crate) fn target() -> Target { |
| 6 | 6 | Target { |
| ... | ... | @@ -18,7 +18,7 @@ pub(crate) fn target() -> Target { |
| 18 | 18 | endian: Endian::Big, |
| 19 | 19 | cpu: "mips32r2".into(), |
| 20 | 20 | features: "+mips32r2,+fpxx,+nooddspreg".into(), |
| 21 | llvm_abiname: "o32".into(), | |
| 21 | llvm_abiname: LlvmAbi::O32, | |
| 22 | 22 | max_atomic_width: Some(32), |
| 23 | 23 | mcount: "_mcount".into(), |
| 24 | 24 |
compiler/rustc_target/src/spec/targets/mips_unknown_linux_musl.rs+2-2| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | use rustc_abi::Endian; |
| 2 | 2 | |
| 3 | use crate::spec::{Arch, Target, TargetMetadata, TargetOptions, base}; | |
| 3 | use crate::spec::{Arch, LlvmAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 4 | 4 | |
| 5 | 5 | pub(crate) fn target() -> Target { |
| 6 | 6 | let mut base = base::linux_musl::opts(); |
| ... | ... | @@ -20,7 +20,7 @@ pub(crate) fn target() -> Target { |
| 20 | 20 | arch: Arch::Mips, |
| 21 | 21 | options: TargetOptions { |
| 22 | 22 | endian: Endian::Big, |
| 23 | llvm_abiname: "o32".into(), | |
| 23 | llvm_abiname: LlvmAbi::O32, | |
| 24 | 24 | mcount: "_mcount".into(), |
| 25 | 25 | ..base |
| 26 | 26 | }, |
compiler/rustc_target/src/spec/targets/mips_unknown_linux_uclibc.rs+2-2| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | use rustc_abi::Endian; |
| 2 | 2 | |
| 3 | use crate::spec::{Arch, Target, TargetMetadata, TargetOptions, base}; | |
| 3 | use crate::spec::{Arch, LlvmAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 4 | 4 | |
| 5 | 5 | pub(crate) fn target() -> Target { |
| 6 | 6 | Target { |
| ... | ... | @@ -18,7 +18,7 @@ pub(crate) fn target() -> Target { |
| 18 | 18 | endian: Endian::Big, |
| 19 | 19 | cpu: "mips32r2".into(), |
| 20 | 20 | features: "+mips32r2,+soft-float".into(), |
| 21 | llvm_abiname: "o32".into(), | |
| 21 | llvm_abiname: LlvmAbi::O32, | |
| 22 | 22 | max_atomic_width: Some(32), |
| 23 | 23 | mcount: "_mcount".into(), |
| 24 | 24 |
compiler/rustc_target/src/spec/targets/mipsel_mti_none_elf.rs+3-2| ... | ... | @@ -1,7 +1,8 @@ |
| 1 | 1 | use rustc_abi::Endian; |
| 2 | 2 | |
| 3 | 3 | use crate::spec::{ |
| 4 | Arch, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions, | |
| 4 | Arch, Cc, LinkerFlavor, Lld, LlvmAbi, PanicStrategy, RelocModel, Target, TargetMetadata, | |
| 5 | TargetOptions, | |
| 5 | 6 | }; |
| 6 | 7 | |
| 7 | 8 | pub(crate) fn target() -> Target { |
| ... | ... | @@ -24,7 +25,7 @@ pub(crate) fn target() -> Target { |
| 24 | 25 | endian: Endian::Little, |
| 25 | 26 | cpu: "mips32r2".into(), |
| 26 | 27 | |
| 27 | llvm_abiname: "o32".into(), | |
| 28 | llvm_abiname: LlvmAbi::O32, | |
| 28 | 29 | max_atomic_width: Some(32), |
| 29 | 30 | |
| 30 | 31 | features: "+mips32r2,+soft-float,+noabicalls".into(), |
compiler/rustc_target/src/spec/targets/mipsel_sony_psp.rs+3-2| ... | ... | @@ -1,5 +1,6 @@ |
| 1 | 1 | use 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, | |
| 3 | 4 | }; |
| 4 | 5 | |
| 5 | 6 | // The PSP has custom linker requirements. |
| ... | ... | @@ -36,7 +37,7 @@ pub(crate) fn target() -> Target { |
| 36 | 37 | |
| 37 | 38 | // PSP does not support trap-on-condition instructions. |
| 38 | 39 | llvm_args: cvs!["-mno-check-zero-division"], |
| 39 | llvm_abiname: "o32".into(), | |
| 40 | llvm_abiname: LlvmAbi::O32, | |
| 40 | 41 | pre_link_args, |
| 41 | 42 | link_script: Some(LINKER_SCRIPT.into()), |
| 42 | 43 | ..Default::default() |
compiler/rustc_target/src/spec/targets/mipsel_sony_psx.rs+2-2| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | use crate::spec::{ |
| 2 | Arch, Cc, LinkerFlavor, Lld, Os, PanicStrategy, RelocModel, Target, TargetMetadata, | |
| 2 | Arch, Cc, LinkerFlavor, Lld, LlvmAbi, Os, PanicStrategy, RelocModel, Target, TargetMetadata, | |
| 3 | 3 | TargetOptions, cvs, |
| 4 | 4 | }; |
| 5 | 5 | |
| ... | ... | @@ -41,7 +41,7 @@ pub(crate) fn target() -> Target { |
| 41 | 41 | |
| 42 | 42 | // PSX does not support trap-on-condition instructions. |
| 43 | 43 | llvm_args: cvs!["-mno-check-zero-division"], |
| 44 | llvm_abiname: "o32".into(), | |
| 44 | llvm_abiname: LlvmAbi::O32, | |
| 45 | 45 | panic_strategy: PanicStrategy::Abort, |
| 46 | 46 | ..Default::default() |
| 47 | 47 | }, |
compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_gnu.rs+2-2| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | use crate::spec::{Arch, Target, TargetMetadata, TargetOptions, base}; | |
| 1 | use crate::spec::{Arch, LlvmAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 2 | 2 | |
| 3 | 3 | pub(crate) fn target() -> Target { |
| 4 | 4 | Target { |
| ... | ... | @@ -16,7 +16,7 @@ pub(crate) fn target() -> Target { |
| 16 | 16 | options: TargetOptions { |
| 17 | 17 | cpu: "mips32r2".into(), |
| 18 | 18 | features: "+mips32r2,+fpxx,+nooddspreg".into(), |
| 19 | llvm_abiname: "o32".into(), | |
| 19 | llvm_abiname: LlvmAbi::O32, | |
| 20 | 20 | max_atomic_width: Some(32), |
| 21 | 21 | mcount: "_mcount".into(), |
| 22 | 22 |
compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_musl.rs+2-2| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | use crate::spec::{Arch, Target, TargetMetadata, TargetOptions, base}; | |
| 1 | use crate::spec::{Arch, LlvmAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 2 | 2 | |
| 3 | 3 | pub(crate) fn target() -> Target { |
| 4 | 4 | let mut base = base::linux_musl::opts(); |
| ... | ... | @@ -16,6 +16,6 @@ pub(crate) fn target() -> Target { |
| 16 | 16 | pointer_width: 32, |
| 17 | 17 | data_layout: "e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".into(), |
| 18 | 18 | 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 }, | |
| 20 | 20 | } |
| 21 | 21 | } |
compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_uclibc.rs+2-2| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | use crate::spec::{Arch, Target, TargetMetadata, TargetOptions, base}; | |
| 1 | use crate::spec::{Arch, LlvmAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 2 | 2 | |
| 3 | 3 | pub(crate) fn target() -> Target { |
| 4 | 4 | Target { |
| ... | ... | @@ -16,7 +16,7 @@ pub(crate) fn target() -> Target { |
| 16 | 16 | options: TargetOptions { |
| 17 | 17 | cpu: "mips32r2".into(), |
| 18 | 18 | features: "+mips32r2,+soft-float".into(), |
| 19 | llvm_abiname: "o32".into(), | |
| 19 | llvm_abiname: LlvmAbi::O32, | |
| 20 | 20 | max_atomic_width: Some(32), |
| 21 | 21 | mcount: "_mcount".into(), |
| 22 | 22 |
compiler/rustc_target/src/spec/targets/mipsel_unknown_netbsd.rs+2-2| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | use rustc_abi::Endian; |
| 2 | 2 | |
| 3 | use crate::spec::{Arch, Target, TargetMetadata, TargetOptions, base}; | |
| 3 | use crate::spec::{Arch, LlvmAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 4 | 4 | |
| 5 | 5 | pub(crate) fn target() -> Target { |
| 6 | 6 | let mut base = base::netbsd::opts(); |
| ... | ... | @@ -20,7 +20,7 @@ pub(crate) fn target() -> Target { |
| 20 | 20 | arch: Arch::Mips, |
| 21 | 21 | options: TargetOptions { |
| 22 | 22 | features: "+soft-float".into(), |
| 23 | llvm_abiname: "o32".into(), | |
| 23 | llvm_abiname: LlvmAbi::O32, | |
| 24 | 24 | mcount: "__mcount".into(), |
| 25 | 25 | endian: Endian::Little, |
| 26 | 26 | ..base |
compiler/rustc_target/src/spec/targets/mipsel_unknown_none.rs+3-2| ... | ... | @@ -3,7 +3,8 @@ |
| 3 | 3 | //! Can be used for MIPS M4K core (e.g. on PIC32MX devices) |
| 4 | 4 | |
| 5 | 5 | use crate::spec::{ |
| 6 | Arch, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions, | |
| 6 | Arch, Cc, LinkerFlavor, Lld, LlvmAbi, PanicStrategy, RelocModel, Target, TargetMetadata, | |
| 7 | TargetOptions, | |
| 7 | 8 | }; |
| 8 | 9 | |
| 9 | 10 | pub(crate) fn target() -> Target { |
| ... | ... | @@ -23,7 +24,7 @@ pub(crate) fn target() -> Target { |
| 23 | 24 | linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes), |
| 24 | 25 | cpu: "mips32r2".into(), |
| 25 | 26 | features: "+mips32r2,+soft-float,+noabicalls".into(), |
| 26 | llvm_abiname: "o32".into(), | |
| 27 | llvm_abiname: LlvmAbi::O32, | |
| 27 | 28 | max_atomic_width: Some(32), |
| 28 | 29 | linker: Some("rust-lld".into()), |
| 29 | 30 | panic_strategy: PanicStrategy::Abort, |
compiler/rustc_target/src/spec/targets/mipsisa32r6_unknown_linux_gnu.rs+2-2| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | use rustc_abi::Endian; |
| 2 | 2 | |
| 3 | use crate::spec::{Arch, Target, TargetMetadata, TargetOptions, base}; | |
| 3 | use crate::spec::{Arch, LlvmAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 4 | 4 | |
| 5 | 5 | pub(crate) fn target() -> Target { |
| 6 | 6 | Target { |
| ... | ... | @@ -18,7 +18,7 @@ pub(crate) fn target() -> Target { |
| 18 | 18 | endian: Endian::Big, |
| 19 | 19 | cpu: "mips32r6".into(), |
| 20 | 20 | features: "+mips32r6".into(), |
| 21 | llvm_abiname: "o32".into(), | |
| 21 | llvm_abiname: LlvmAbi::O32, | |
| 22 | 22 | max_atomic_width: Some(32), |
| 23 | 23 | mcount: "_mcount".into(), |
| 24 | 24 |
compiler/rustc_target/src/spec/targets/mipsisa32r6el_unknown_linux_gnu.rs+2-2| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | use crate::spec::{Arch, Target, TargetMetadata, TargetOptions, base}; | |
| 1 | use crate::spec::{Arch, LlvmAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 2 | 2 | |
| 3 | 3 | pub(crate) fn target() -> Target { |
| 4 | 4 | Target { |
| ... | ... | @@ -16,7 +16,7 @@ pub(crate) fn target() -> Target { |
| 16 | 16 | options: TargetOptions { |
| 17 | 17 | cpu: "mips32r6".into(), |
| 18 | 18 | features: "+mips32r6".into(), |
| 19 | llvm_abiname: "o32".into(), | |
| 19 | llvm_abiname: LlvmAbi::O32, | |
| 20 | 20 | max_atomic_width: Some(32), |
| 21 | 21 | mcount: "_mcount".into(), |
| 22 | 22 |
compiler/rustc_target/src/spec/targets/mipsisa64r6_unknown_linux_gnuabi64.rs+3-3| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | use rustc_abi::Endian; |
| 2 | 2 | |
| 3 | use crate::spec::{Abi, Arch, Target, TargetMetadata, TargetOptions, base}; | |
| 3 | use crate::spec::{Arch, CfgAbi, LlvmAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 4 | 4 | |
| 5 | 5 | pub(crate) fn target() -> Target { |
| 6 | 6 | Target { |
| ... | ... | @@ -15,14 +15,14 @@ pub(crate) fn target() -> Target { |
| 15 | 15 | data_layout: "E-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(), |
| 16 | 16 | arch: Arch::Mips64r6, |
| 17 | 17 | options: TargetOptions { |
| 18 | abi: Abi::Abi64, | |
| 18 | cfg_abi: CfgAbi::Abi64, | |
| 19 | 19 | endian: Endian::Big, |
| 20 | 20 | // NOTE(mips64r6) matches C toolchain |
| 21 | 21 | cpu: "mips64r6".into(), |
| 22 | 22 | features: "+mips64r6".into(), |
| 23 | 23 | max_atomic_width: Some(64), |
| 24 | 24 | mcount: "_mcount".into(), |
| 25 | llvm_abiname: "n64".into(), | |
| 25 | llvm_abiname: LlvmAbi::N64, | |
| 26 | 26 | |
| 27 | 27 | ..base::linux_gnu::opts() |
| 28 | 28 | }, |
compiler/rustc_target/src/spec/targets/mipsisa64r6el_unknown_linux_gnuabi64.rs+3-3| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | use crate::spec::{Abi, Arch, Target, TargetMetadata, TargetOptions, base}; | |
| 1 | use crate::spec::{Arch, CfgAbi, LlvmAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 2 | 2 | |
| 3 | 3 | pub(crate) fn target() -> Target { |
| 4 | 4 | Target { |
| ... | ... | @@ -13,13 +13,13 @@ pub(crate) fn target() -> Target { |
| 13 | 13 | data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(), |
| 14 | 14 | arch: Arch::Mips64r6, |
| 15 | 15 | options: TargetOptions { |
| 16 | abi: Abi::Abi64, | |
| 16 | cfg_abi: CfgAbi::Abi64, | |
| 17 | 17 | // NOTE(mips64r6) matches C toolchain |
| 18 | 18 | cpu: "mips64r6".into(), |
| 19 | 19 | features: "+mips64r6".into(), |
| 20 | 20 | max_atomic_width: Some(64), |
| 21 | 21 | mcount: "_mcount".into(), |
| 22 | llvm_abiname: "n64".into(), | |
| 22 | llvm_abiname: LlvmAbi::N64, | |
| 23 | 23 | |
| 24 | 24 | ..base::linux_gnu::opts() |
| 25 | 25 | }, |
compiler/rustc_target/src/spec/targets/powerpc64_unknown_freebsd.rs+4-3| ... | ... | @@ -1,7 +1,8 @@ |
| 1 | 1 | use rustc_abi::Endian; |
| 2 | 2 | |
| 3 | 3 | use 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, | |
| 5 | 6 | }; |
| 6 | 7 | |
| 7 | 8 | pub(crate) fn target() -> Target { |
| ... | ... | @@ -10,8 +11,8 @@ pub(crate) fn target() -> Target { |
| 10 | 11 | base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]); |
| 11 | 12 | base.max_atomic_width = Some(64); |
| 12 | 13 | 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; | |
| 15 | 16 | |
| 16 | 17 | Target { |
| 17 | 18 | llvm_target: "powerpc64-unknown-freebsd".into(), |
compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_gnu.rs+4-3| ... | ... | @@ -1,7 +1,8 @@ |
| 1 | 1 | use rustc_abi::Endian; |
| 2 | 2 | |
| 3 | 3 | use 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, | |
| 5 | 6 | }; |
| 6 | 7 | |
| 7 | 8 | pub(crate) fn target() -> Target { |
| ... | ... | @@ -10,8 +11,8 @@ pub(crate) fn target() -> Target { |
| 10 | 11 | base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]); |
| 11 | 12 | base.max_atomic_width = Some(64); |
| 12 | 13 | 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; | |
| 15 | 16 | |
| 16 | 17 | Target { |
| 17 | 18 | llvm_target: "powerpc64-unknown-linux-gnu".into(), |
compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_musl.rs+4-3| ... | ... | @@ -1,7 +1,8 @@ |
| 1 | 1 | use rustc_abi::Endian; |
| 2 | 2 | |
| 3 | 3 | use 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, | |
| 5 | 6 | }; |
| 6 | 7 | |
| 7 | 8 | pub(crate) fn target() -> Target { |
| ... | ... | @@ -10,8 +11,8 @@ pub(crate) fn target() -> Target { |
| 10 | 11 | base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]); |
| 11 | 12 | base.max_atomic_width = Some(64); |
| 12 | 13 | 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; | |
| 15 | 16 | |
| 16 | 17 | Target { |
| 17 | 18 | llvm_target: "powerpc64-unknown-linux-musl".into(), |
compiler/rustc_target/src/spec/targets/powerpc64_unknown_openbsd.rs+4-3| ... | ... | @@ -1,7 +1,8 @@ |
| 1 | 1 | use rustc_abi::Endian; |
| 2 | 2 | |
| 3 | 3 | use 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, | |
| 5 | 6 | }; |
| 6 | 7 | |
| 7 | 8 | pub(crate) fn target() -> Target { |
| ... | ... | @@ -10,8 +11,8 @@ pub(crate) fn target() -> Target { |
| 10 | 11 | base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]); |
| 11 | 12 | base.max_atomic_width = Some(64); |
| 12 | 13 | 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; | |
| 15 | 16 | |
| 16 | 17 | Target { |
| 17 | 18 | llvm_target: "powerpc64-unknown-openbsd".into(), |
compiler/rustc_target/src/spec/targets/powerpc64_wrs_vxworks.rs+4-3| ... | ... | @@ -1,7 +1,8 @@ |
| 1 | 1 | use rustc_abi::Endian; |
| 2 | 2 | |
| 3 | 3 | use 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, | |
| 5 | 6 | }; |
| 6 | 7 | |
| 7 | 8 | pub(crate) fn target() -> Target { |
| ... | ... | @@ -10,8 +11,8 @@ pub(crate) fn target() -> Target { |
| 10 | 11 | base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]); |
| 11 | 12 | base.max_atomic_width = Some(64); |
| 12 | 13 | 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; | |
| 15 | 16 | |
| 16 | 17 | Target { |
| 17 | 18 | llvm_target: "powerpc64-unknown-linux-gnu".into(), |
compiler/rustc_target/src/spec/targets/powerpc64le_unknown_freebsd.rs+4-3| ... | ... | @@ -1,5 +1,6 @@ |
| 1 | 1 | use 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, | |
| 3 | 4 | }; |
| 4 | 5 | |
| 5 | 6 | pub(crate) fn target() -> Target { |
| ... | ... | @@ -8,8 +9,8 @@ pub(crate) fn target() -> Target { |
| 8 | 9 | base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]); |
| 9 | 10 | base.max_atomic_width = Some(64); |
| 10 | 11 | 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; | |
| 13 | 14 | |
| 14 | 15 | Target { |
| 15 | 16 | llvm_target: "powerpc64le-unknown-freebsd".into(), |
compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_gnu.rs+4-3| ... | ... | @@ -1,5 +1,6 @@ |
| 1 | 1 | use 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, | |
| 3 | 4 | }; |
| 4 | 5 | |
| 5 | 6 | pub(crate) fn target() -> Target { |
| ... | ... | @@ -8,8 +9,8 @@ pub(crate) fn target() -> Target { |
| 8 | 9 | base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]); |
| 9 | 10 | base.max_atomic_width = Some(64); |
| 10 | 11 | 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; | |
| 13 | 14 | |
| 14 | 15 | Target { |
| 15 | 16 | llvm_target: "powerpc64le-unknown-linux-gnu".into(), |
compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_musl.rs+4-3| ... | ... | @@ -1,5 +1,6 @@ |
| 1 | 1 | use 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, | |
| 3 | 4 | }; |
| 4 | 5 | |
| 5 | 6 | pub(crate) fn target() -> Target { |
| ... | ... | @@ -10,8 +11,8 @@ pub(crate) fn target() -> Target { |
| 10 | 11 | base.stack_probes = StackProbeType::Inline; |
| 11 | 12 | // FIXME(compiler-team#422): musl targets should be dynamically linked by default. |
| 12 | 13 | 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; | |
| 15 | 16 | |
| 16 | 17 | Target { |
| 17 | 18 | llvm_target: "powerpc64le-unknown-linux-musl".into(), |
compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_gnuspe.rs+3-2| ... | ... | @@ -1,7 +1,8 @@ |
| 1 | 1 | use rustc_abi::Endian; |
| 2 | 2 | |
| 3 | 3 | use 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, | |
| 5 | 6 | }; |
| 6 | 7 | |
| 7 | 8 | pub(crate) fn target() -> Target { |
| ... | ... | @@ -22,7 +23,7 @@ pub(crate) fn target() -> Target { |
| 22 | 23 | data_layout: "E-m:e-p:32:32-Fn32-i64:64-n32".into(), |
| 23 | 24 | arch: Arch::PowerPC, |
| 24 | 25 | options: TargetOptions { |
| 25 | abi: Abi::Spe, | |
| 26 | cfg_abi: CfgAbi::Spe, | |
| 26 | 27 | endian: Endian::Big, |
| 27 | 28 | features: "+secure-plt,+msync".into(), |
| 28 | 29 | mcount: "_mcount".into(), |
compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_muslspe.rs+3-2| ... | ... | @@ -1,7 +1,8 @@ |
| 1 | 1 | use rustc_abi::Endian; |
| 2 | 2 | |
| 3 | 3 | use 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, | |
| 5 | 6 | }; |
| 6 | 7 | |
| 7 | 8 | pub(crate) fn target() -> Target { |
| ... | ... | @@ -22,7 +23,7 @@ pub(crate) fn target() -> Target { |
| 22 | 23 | data_layout: "E-m:e-p:32:32-Fn32-i64:64-n32".into(), |
| 23 | 24 | arch: Arch::PowerPC, |
| 24 | 25 | options: TargetOptions { |
| 25 | abi: Abi::Spe, | |
| 26 | cfg_abi: CfgAbi::Spe, | |
| 26 | 27 | endian: Endian::Big, |
| 27 | 28 | features: "+msync".into(), |
| 28 | 29 | mcount: "_mcount".into(), |
compiler/rustc_target/src/spec/targets/powerpc_wrs_vxworks_spe.rs+3-2| ... | ... | @@ -1,7 +1,8 @@ |
| 1 | 1 | use rustc_abi::Endian; |
| 2 | 2 | |
| 3 | 3 | use 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, | |
| 5 | 6 | }; |
| 6 | 7 | |
| 7 | 8 | pub(crate) fn target() -> Target { |
| ... | ... | @@ -22,7 +23,7 @@ pub(crate) fn target() -> Target { |
| 22 | 23 | data_layout: "E-m:e-p:32:32-Fn32-i64:64-n32".into(), |
| 23 | 24 | arch: Arch::PowerPC, |
| 24 | 25 | options: TargetOptions { |
| 25 | abi: Abi::Spe, | |
| 26 | cfg_abi: CfgAbi::Spe, | |
| 26 | 27 | endian: Endian::Big, |
| 27 | 28 | // feature msync would disable instruction 'fsync' which is not supported by fsl_p1p2 |
| 28 | 29 | features: "+secure-plt,+msync".into(), |
compiler/rustc_target/src/spec/targets/riscv32_wrs_vxworks.rs+2-2| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | use crate::spec::{Arch, StackProbeType, Target, TargetMetadata, TargetOptions, base}; | |
| 1 | use crate::spec::{Arch, LlvmAbi, StackProbeType, Target, TargetMetadata, TargetOptions, base}; | |
| 2 | 2 | |
| 3 | 3 | pub(crate) fn target() -> Target { |
| 4 | 4 | Target { |
| ... | ... | @@ -14,7 +14,7 @@ pub(crate) fn target() -> Target { |
| 14 | 14 | arch: Arch::RiscV32, |
| 15 | 15 | options: TargetOptions { |
| 16 | 16 | cpu: "generic-rv32".into(), |
| 17 | llvm_abiname: "ilp32d".into(), | |
| 17 | llvm_abiname: LlvmAbi::Ilp32d, | |
| 18 | 18 | max_atomic_width: Some(32), |
| 19 | 19 | features: "+m,+a,+f,+d,+c,+zicsr,+zifencei".into(), |
| 20 | 20 | stack_probes: StackProbeType::Inline, |
compiler/rustc_target/src/spec/targets/riscv32e_unknown_none_elf.rs+4-4| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | use 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, | |
| 4 | 4 | }; |
| 5 | 5 | |
| 6 | 6 | pub(crate) fn target() -> Target { |
| ... | ... | @@ -19,12 +19,12 @@ pub(crate) fn target() -> Target { |
| 19 | 19 | arch: Arch::RiscV32, |
| 20 | 20 | |
| 21 | 21 | options: TargetOptions { |
| 22 | abi: Abi::Ilp32e, | |
| 22 | cfg_abi: CfgAbi::Ilp32e, | |
| 23 | 23 | linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes), |
| 24 | 24 | linker: Some("rust-lld".into()), |
| 25 | 25 | cpu: "generic-rv32".into(), |
| 26 | 26 | // The ilp32e ABI specifies the `data_layout` |
| 27 | llvm_abiname: "ilp32e".into(), | |
| 27 | llvm_abiname: LlvmAbi::Ilp32e, | |
| 28 | 28 | max_atomic_width: Some(32), |
| 29 | 29 | atomic_cas: false, |
| 30 | 30 | features: "+e,+forced-atomics".into(), |
compiler/rustc_target/src/spec/targets/riscv32em_unknown_none_elf.rs+4-4| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | use 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, | |
| 4 | 4 | }; |
| 5 | 5 | |
| 6 | 6 | pub(crate) fn target() -> Target { |
| ... | ... | @@ -19,12 +19,12 @@ pub(crate) fn target() -> Target { |
| 19 | 19 | arch: Arch::RiscV32, |
| 20 | 20 | |
| 21 | 21 | options: TargetOptions { |
| 22 | abi: Abi::Ilp32e, | |
| 22 | cfg_abi: CfgAbi::Ilp32e, | |
| 23 | 23 | linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes), |
| 24 | 24 | linker: Some("rust-lld".into()), |
| 25 | 25 | cpu: "generic-rv32".into(), |
| 26 | 26 | // The ilp32e ABI specifies the `data_layout` |
| 27 | llvm_abiname: "ilp32e".into(), | |
| 27 | llvm_abiname: LlvmAbi::Ilp32e, | |
| 28 | 28 | max_atomic_width: Some(32), |
| 29 | 29 | atomic_cas: false, |
| 30 | 30 | features: "+e,+m,+forced-atomics".into(), |
compiler/rustc_target/src/spec/targets/riscv32emc_unknown_none_elf.rs+4-4| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | use 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, | |
| 4 | 4 | }; |
| 5 | 5 | |
| 6 | 6 | pub(crate) fn target() -> Target { |
| ... | ... | @@ -19,12 +19,12 @@ pub(crate) fn target() -> Target { |
| 19 | 19 | arch: Arch::RiscV32, |
| 20 | 20 | |
| 21 | 21 | options: TargetOptions { |
| 22 | abi: Abi::Ilp32e, | |
| 22 | cfg_abi: CfgAbi::Ilp32e, | |
| 23 | 23 | linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes), |
| 24 | 24 | linker: Some("rust-lld".into()), |
| 25 | 25 | cpu: "generic-rv32".into(), |
| 26 | 26 | // The ilp32e ABI specifies the `data_layout` |
| 27 | llvm_abiname: "ilp32e".into(), | |
| 27 | llvm_abiname: LlvmAbi::Ilp32e, | |
| 28 | 28 | max_atomic_width: Some(32), |
| 29 | 29 | atomic_cas: false, |
| 30 | 30 | features: "+e,+m,+c,+forced-atomics".into(), |
compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_gnu.rs+4-2| ... | ... | @@ -1,6 +1,8 @@ |
| 1 | 1 | use std::borrow::Cow; |
| 2 | 2 | |
| 3 | use crate::spec::{Arch, CodeModel, SplitDebuginfo, Target, TargetMetadata, TargetOptions, base}; | |
| 3 | use crate::spec::{ | |
| 4 | Arch, CodeModel, LlvmAbi, SplitDebuginfo, Target, TargetMetadata, TargetOptions, base, | |
| 5 | }; | |
| 4 | 6 | |
| 5 | 7 | pub(crate) fn target() -> Target { |
| 6 | 8 | Target { |
| ... | ... | @@ -18,7 +20,7 @@ pub(crate) fn target() -> Target { |
| 18 | 20 | code_model: Some(CodeModel::Medium), |
| 19 | 21 | cpu: "generic-rv32".into(), |
| 20 | 22 | features: "+m,+a,+f,+d,+c,+zicsr,+zifencei".into(), |
| 21 | llvm_abiname: "ilp32d".into(), | |
| 23 | llvm_abiname: LlvmAbi::Ilp32d, | |
| 22 | 24 | max_atomic_width: Some(32), |
| 23 | 25 | supported_split_debuginfo: Cow::Borrowed(&[SplitDebuginfo::Off]), |
| 24 | 26 | ..base::linux_gnu::opts() |
compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_musl.rs+4-2| ... | ... | @@ -1,6 +1,8 @@ |
| 1 | 1 | use std::borrow::Cow; |
| 2 | 2 | |
| 3 | use crate::spec::{Arch, CodeModel, SplitDebuginfo, Target, TargetMetadata, TargetOptions, base}; | |
| 3 | use crate::spec::{ | |
| 4 | Arch, CodeModel, LlvmAbi, SplitDebuginfo, Target, TargetMetadata, TargetOptions, base, | |
| 5 | }; | |
| 4 | 6 | |
| 5 | 7 | pub(crate) fn target() -> Target { |
| 6 | 8 | Target { |
| ... | ... | @@ -18,7 +20,7 @@ pub(crate) fn target() -> Target { |
| 18 | 20 | code_model: Some(CodeModel::Medium), |
| 19 | 21 | cpu: "generic-rv32".into(), |
| 20 | 22 | features: "+m,+a,+f,+d,+c,+zicsr,+zifencei".into(), |
| 21 | llvm_abiname: "ilp32d".into(), | |
| 23 | llvm_abiname: LlvmAbi::Ilp32d, | |
| 22 | 24 | max_atomic_width: Some(32), |
| 23 | 25 | supported_split_debuginfo: Cow::Borrowed(&[SplitDebuginfo::Off]), |
| 24 | 26 | ..base::linux_musl::opts() |
compiler/rustc_target/src/spec/targets/riscv32i_unknown_none_elf.rs+3-2| ... | ... | @@ -1,5 +1,6 @@ |
| 1 | 1 | use crate::spec::{ |
| 2 | Arch, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions, | |
| 2 | Arch, Cc, LinkerFlavor, Lld, LlvmAbi, PanicStrategy, RelocModel, Target, TargetMetadata, | |
| 3 | TargetOptions, | |
| 3 | 4 | }; |
| 4 | 5 | |
| 5 | 6 | pub(crate) fn target() -> Target { |
| ... | ... | @@ -22,7 +23,7 @@ pub(crate) fn target() -> Target { |
| 22 | 23 | max_atomic_width: Some(32), |
| 23 | 24 | atomic_cas: false, |
| 24 | 25 | features: "+forced-atomics".into(), |
| 25 | llvm_abiname: "ilp32".into(), | |
| 26 | llvm_abiname: LlvmAbi::Ilp32, | |
| 26 | 27 | panic_strategy: PanicStrategy::Abort, |
| 27 | 28 | relocation_model: RelocModel::Static, |
| 28 | 29 | emit_debug_gdb_scripts: false, |
compiler/rustc_target/src/spec/targets/riscv32im_risc0_zkvm_elf.rs+2-2| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | use crate::spec::{ |
| 2 | Arch, Cc, LinkerFlavor, Lld, Os, PanicStrategy, RelocModel, Target, TargetMetadata, | |
| 2 | Arch, Cc, LinkerFlavor, Lld, LlvmAbi, Os, PanicStrategy, RelocModel, Target, TargetMetadata, | |
| 3 | 3 | TargetOptions, |
| 4 | 4 | }; |
| 5 | 5 | |
| ... | ... | @@ -32,7 +32,7 @@ pub(crate) fn target() -> Target { |
| 32 | 32 | atomic_cas: true, |
| 33 | 33 | |
| 34 | 34 | features: "+m".into(), |
| 35 | llvm_abiname: "ilp32".into(), | |
| 35 | llvm_abiname: LlvmAbi::Ilp32, | |
| 36 | 36 | executables: true, |
| 37 | 37 | panic_strategy: PanicStrategy::Abort, |
| 38 | 38 | relocation_model: RelocModel::Static, |
compiler/rustc_target/src/spec/targets/riscv32im_unknown_none_elf.rs+3-2| ... | ... | @@ -1,5 +1,6 @@ |
| 1 | 1 | use crate::spec::{ |
| 2 | Arch, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions, | |
| 2 | Arch, Cc, LinkerFlavor, Lld, LlvmAbi, PanicStrategy, RelocModel, Target, TargetMetadata, | |
| 3 | TargetOptions, | |
| 3 | 4 | }; |
| 4 | 5 | |
| 5 | 6 | pub(crate) fn target() -> Target { |
| ... | ... | @@ -22,7 +23,7 @@ pub(crate) fn target() -> Target { |
| 22 | 23 | max_atomic_width: Some(32), |
| 23 | 24 | atomic_cas: false, |
| 24 | 25 | features: "+m,+forced-atomics".into(), |
| 25 | llvm_abiname: "ilp32".into(), | |
| 26 | llvm_abiname: LlvmAbi::Ilp32, | |
| 26 | 27 | panic_strategy: PanicStrategy::Abort, |
| 27 | 28 | relocation_model: RelocModel::Static, |
| 28 | 29 | emit_debug_gdb_scripts: false, |
compiler/rustc_target/src/spec/targets/riscv32ima_unknown_none_elf.rs+3-2| ... | ... | @@ -1,5 +1,6 @@ |
| 1 | 1 | use crate::spec::{ |
| 2 | Arch, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions, | |
| 2 | Arch, Cc, LinkerFlavor, Lld, LlvmAbi, PanicStrategy, RelocModel, Target, TargetMetadata, | |
| 3 | TargetOptions, | |
| 3 | 4 | }; |
| 4 | 5 | |
| 5 | 6 | pub(crate) fn target() -> Target { |
| ... | ... | @@ -21,7 +22,7 @@ pub(crate) fn target() -> Target { |
| 21 | 22 | cpu: "generic-rv32".into(), |
| 22 | 23 | max_atomic_width: Some(32), |
| 23 | 24 | features: "+m,+a".into(), |
| 24 | llvm_abiname: "ilp32".into(), | |
| 25 | llvm_abiname: LlvmAbi::Ilp32, | |
| 25 | 26 | panic_strategy: PanicStrategy::Abort, |
| 26 | 27 | relocation_model: RelocModel::Static, |
| 27 | 28 | emit_debug_gdb_scripts: false, |
compiler/rustc_target/src/spec/targets/riscv32imac_esp_espidf.rs+2-2| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | use crate::spec::{ |
| 2 | Arch, Env, Os, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions, cvs, | |
| 2 | Arch, Env, LlvmAbi, Os, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions, cvs, | |
| 3 | 3 | }; |
| 4 | 4 | |
| 5 | 5 | pub(crate) fn target() -> Target { |
| ... | ... | @@ -29,7 +29,7 @@ pub(crate) fn target() -> Target { |
| 29 | 29 | atomic_cas: true, |
| 30 | 30 | |
| 31 | 31 | features: "+m,+a,+c".into(), |
| 32 | llvm_abiname: "ilp32".into(), | |
| 32 | llvm_abiname: LlvmAbi::Ilp32, | |
| 33 | 33 | panic_strategy: PanicStrategy::Abort, |
| 34 | 34 | relocation_model: RelocModel::Static, |
| 35 | 35 | emit_debug_gdb_scripts: false, |
compiler/rustc_target/src/spec/targets/riscv32imac_unknown_none_elf.rs+3-2| ... | ... | @@ -1,5 +1,6 @@ |
| 1 | 1 | use crate::spec::{ |
| 2 | Arch, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions, | |
| 2 | Arch, Cc, LinkerFlavor, Lld, LlvmAbi, PanicStrategy, RelocModel, Target, TargetMetadata, | |
| 3 | TargetOptions, | |
| 3 | 4 | }; |
| 4 | 5 | |
| 5 | 6 | pub(crate) fn target() -> Target { |
| ... | ... | @@ -21,7 +22,7 @@ pub(crate) fn target() -> Target { |
| 21 | 22 | cpu: "generic-rv32".into(), |
| 22 | 23 | max_atomic_width: Some(32), |
| 23 | 24 | features: "+m,+a,+c".into(), |
| 24 | llvm_abiname: "ilp32".into(), | |
| 25 | llvm_abiname: LlvmAbi::Ilp32, | |
| 25 | 26 | panic_strategy: PanicStrategy::Abort, |
| 26 | 27 | relocation_model: RelocModel::Static, |
| 27 | 28 | emit_debug_gdb_scripts: false, |
compiler/rustc_target/src/spec/targets/riscv32imac_unknown_nuttx_elf.rs+2-2| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | use crate::spec::{ |
| 2 | Arch, Cc, LinkerFlavor, Lld, Os, PanicStrategy, RelocModel, Target, TargetMetadata, | |
| 2 | Arch, Cc, LinkerFlavor, Lld, LlvmAbi, Os, PanicStrategy, RelocModel, Target, TargetMetadata, | |
| 3 | 3 | TargetOptions, cvs, |
| 4 | 4 | }; |
| 5 | 5 | |
| ... | ... | @@ -24,7 +24,7 @@ pub(crate) fn target() -> Target { |
| 24 | 24 | cpu: "generic-rv32".into(), |
| 25 | 25 | max_atomic_width: Some(32), |
| 26 | 26 | features: "+m,+a,+c".into(), |
| 27 | llvm_abiname: "ilp32".into(), | |
| 27 | llvm_abiname: LlvmAbi::Ilp32, | |
| 28 | 28 | panic_strategy: PanicStrategy::Unwind, |
| 29 | 29 | relocation_model: RelocModel::Static, |
| 30 | 30 | ..Default::default() |
compiler/rustc_target/src/spec/targets/riscv32imac_unknown_xous_elf.rs+2-2| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | use crate::spec::{ |
| 2 | Arch, Cc, LinkerFlavor, Lld, Os, PanicStrategy, RelocModel, Target, TargetMetadata, | |
| 2 | Arch, Cc, LinkerFlavor, Lld, LlvmAbi, Os, PanicStrategy, RelocModel, Target, TargetMetadata, | |
| 3 | 3 | TargetOptions, |
| 4 | 4 | }; |
| 5 | 5 | |
| ... | ... | @@ -23,7 +23,7 @@ pub(crate) fn target() -> Target { |
| 23 | 23 | cpu: "generic-rv32".into(), |
| 24 | 24 | max_atomic_width: Some(32), |
| 25 | 25 | features: "+m,+a,+c".into(), |
| 26 | llvm_abiname: "ilp32".into(), | |
| 26 | llvm_abiname: LlvmAbi::Ilp32, | |
| 27 | 27 | panic_strategy: PanicStrategy::Unwind, |
| 28 | 28 | relocation_model: RelocModel::Static, |
| 29 | 29 | ..Default::default() |
compiler/rustc_target/src/spec/targets/riscv32imafc_esp_espidf.rs+2-2| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | use crate::spec::{ |
| 2 | Arch, Env, Os, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions, cvs, | |
| 2 | Arch, Env, LlvmAbi, Os, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions, cvs, | |
| 3 | 3 | }; |
| 4 | 4 | |
| 5 | 5 | pub(crate) fn target() -> Target { |
| ... | ... | @@ -26,7 +26,7 @@ pub(crate) fn target() -> Target { |
| 26 | 26 | max_atomic_width: Some(32), |
| 27 | 27 | atomic_cas: true, |
| 28 | 28 | |
| 29 | llvm_abiname: "ilp32f".into(), | |
| 29 | llvm_abiname: LlvmAbi::Ilp32f, | |
| 30 | 30 | features: "+m,+a,+c,+f".into(), |
| 31 | 31 | panic_strategy: PanicStrategy::Abort, |
| 32 | 32 | relocation_model: RelocModel::Static, |
compiler/rustc_target/src/spec/targets/riscv32imafc_unknown_none_elf.rs+3-2| ... | ... | @@ -1,5 +1,6 @@ |
| 1 | 1 | use crate::spec::{ |
| 2 | Arch, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions, | |
| 2 | Arch, Cc, LinkerFlavor, Lld, LlvmAbi, PanicStrategy, RelocModel, Target, TargetMetadata, | |
| 3 | TargetOptions, | |
| 3 | 4 | }; |
| 4 | 5 | |
| 5 | 6 | pub(crate) fn target() -> Target { |
| ... | ... | @@ -20,7 +21,7 @@ pub(crate) fn target() -> Target { |
| 20 | 21 | linker: Some("rust-lld".into()), |
| 21 | 22 | cpu: "generic-rv32".into(), |
| 22 | 23 | max_atomic_width: Some(32), |
| 23 | llvm_abiname: "ilp32f".into(), | |
| 24 | llvm_abiname: LlvmAbi::Ilp32f, | |
| 24 | 25 | features: "+m,+a,+c,+f".into(), |
| 25 | 26 | panic_strategy: PanicStrategy::Abort, |
| 26 | 27 | relocation_model: RelocModel::Static, |
compiler/rustc_target/src/spec/targets/riscv32imafc_unknown_nuttx_elf.rs+2-2| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | use crate::spec::{ |
| 2 | Arch, Cc, LinkerFlavor, Lld, Os, PanicStrategy, RelocModel, Target, TargetMetadata, | |
| 2 | Arch, Cc, LinkerFlavor, Lld, LlvmAbi, Os, PanicStrategy, RelocModel, Target, TargetMetadata, | |
| 3 | 3 | TargetOptions, cvs, |
| 4 | 4 | }; |
| 5 | 5 | |
| ... | ... | @@ -23,7 +23,7 @@ pub(crate) fn target() -> Target { |
| 23 | 23 | linker: Some("rust-lld".into()), |
| 24 | 24 | cpu: "generic-rv32".into(), |
| 25 | 25 | max_atomic_width: Some(32), |
| 26 | llvm_abiname: "ilp32f".into(), | |
| 26 | llvm_abiname: LlvmAbi::Ilp32f, | |
| 27 | 27 | features: "+m,+a,+c,+f".into(), |
| 28 | 28 | panic_strategy: PanicStrategy::Abort, |
| 29 | 29 | relocation_model: RelocModel::Static, |
compiler/rustc_target/src/spec/targets/riscv32imc_esp_espidf.rs+2-2| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | use crate::spec::{ |
| 2 | Arch, Env, Os, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions, cvs, | |
| 2 | Arch, Env, LlvmAbi, Os, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions, cvs, | |
| 3 | 3 | }; |
| 4 | 4 | |
| 5 | 5 | pub(crate) fn target() -> Target { |
| ... | ... | @@ -32,7 +32,7 @@ pub(crate) fn target() -> Target { |
| 32 | 32 | atomic_cas: true, |
| 33 | 33 | |
| 34 | 34 | features: "+m,+c".into(), |
| 35 | llvm_abiname: "ilp32".into(), | |
| 35 | llvm_abiname: LlvmAbi::Ilp32, | |
| 36 | 36 | panic_strategy: PanicStrategy::Abort, |
| 37 | 37 | relocation_model: RelocModel::Static, |
| 38 | 38 | emit_debug_gdb_scripts: false, |
compiler/rustc_target/src/spec/targets/riscv32imc_unknown_none_elf.rs+3-2| ... | ... | @@ -1,5 +1,6 @@ |
| 1 | 1 | use crate::spec::{ |
| 2 | Arch, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions, | |
| 2 | Arch, Cc, LinkerFlavor, Lld, LlvmAbi, PanicStrategy, RelocModel, Target, TargetMetadata, | |
| 3 | TargetOptions, | |
| 3 | 4 | }; |
| 4 | 5 | |
| 5 | 6 | pub(crate) fn target() -> Target { |
| ... | ... | @@ -22,7 +23,7 @@ pub(crate) fn target() -> Target { |
| 22 | 23 | max_atomic_width: Some(32), |
| 23 | 24 | atomic_cas: false, |
| 24 | 25 | features: "+m,+c,+forced-atomics".into(), |
| 25 | llvm_abiname: "ilp32".into(), | |
| 26 | llvm_abiname: LlvmAbi::Ilp32, | |
| 26 | 27 | panic_strategy: PanicStrategy::Abort, |
| 27 | 28 | relocation_model: RelocModel::Static, |
| 28 | 29 | emit_debug_gdb_scripts: false, |
compiler/rustc_target/src/spec/targets/riscv32imc_unknown_nuttx_elf.rs+2-2| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | use crate::spec::{ |
| 2 | Arch, Cc, LinkerFlavor, Lld, Os, PanicStrategy, RelocModel, Target, TargetMetadata, | |
| 2 | Arch, Cc, LinkerFlavor, Lld, LlvmAbi, Os, PanicStrategy, RelocModel, Target, TargetMetadata, | |
| 3 | 3 | TargetOptions, cvs, |
| 4 | 4 | }; |
| 5 | 5 | |
| ... | ... | @@ -24,7 +24,7 @@ pub(crate) fn target() -> Target { |
| 24 | 24 | cpu: "generic-rv32".into(), |
| 25 | 25 | max_atomic_width: Some(32), |
| 26 | 26 | features: "+m,+c".into(), |
| 27 | llvm_abiname: "ilp32".into(), | |
| 27 | llvm_abiname: LlvmAbi::Ilp32, | |
| 28 | 28 | panic_strategy: PanicStrategy::Unwind, |
| 29 | 29 | relocation_model: RelocModel::Static, |
| 30 | 30 | ..Default::default() |
compiler/rustc_target/src/spec/targets/riscv64_linux_android.rs+3-2| ... | ... | @@ -1,7 +1,8 @@ |
| 1 | 1 | use std::borrow::Cow; |
| 2 | 2 | |
| 3 | 3 | use crate::spec::{ |
| 4 | Arch, CodeModel, SanitizerSet, SplitDebuginfo, Target, TargetMetadata, TargetOptions, base, | |
| 4 | Arch, CodeModel, LlvmAbi, SanitizerSet, SplitDebuginfo, Target, TargetMetadata, TargetOptions, | |
| 5 | base, | |
| 5 | 6 | }; |
| 6 | 7 | |
| 7 | 8 | pub(crate) fn target() -> Target { |
| ... | ... | @@ -20,7 +21,7 @@ pub(crate) fn target() -> Target { |
| 20 | 21 | code_model: Some(CodeModel::Medium), |
| 21 | 22 | cpu: "generic-rv64".into(), |
| 22 | 23 | features: "+m,+a,+f,+d,+c,+b,+v,+zicsr,+zifencei".into(), |
| 23 | llvm_abiname: "lp64d".into(), | |
| 24 | llvm_abiname: LlvmAbi::Lp64d, | |
| 24 | 25 | supported_sanitizers: SanitizerSet::ADDRESS, |
| 25 | 26 | max_atomic_width: Some(64), |
| 26 | 27 | supported_split_debuginfo: Cow::Borrowed(&[SplitDebuginfo::Off]), |
compiler/rustc_target/src/spec/targets/riscv64_wrs_vxworks.rs+2-2| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | use crate::spec::{Arch, StackProbeType, Target, TargetMetadata, TargetOptions, base}; | |
| 1 | use crate::spec::{Arch, LlvmAbi, StackProbeType, Target, TargetMetadata, TargetOptions, base}; | |
| 2 | 2 | |
| 3 | 3 | pub(crate) fn target() -> Target { |
| 4 | 4 | Target { |
| ... | ... | @@ -14,7 +14,7 @@ pub(crate) fn target() -> Target { |
| 14 | 14 | arch: Arch::RiscV64, |
| 15 | 15 | options: TargetOptions { |
| 16 | 16 | cpu: "generic-rv64".into(), |
| 17 | llvm_abiname: "lp64d".into(), | |
| 17 | llvm_abiname: LlvmAbi::Lp64d, | |
| 18 | 18 | max_atomic_width: Some(64), |
| 19 | 19 | features: "+m,+a,+f,+d,+c,+zicsr,+zifencei".into(), |
| 20 | 20 | stack_probes: StackProbeType::Inline, |
compiler/rustc_target/src/spec/targets/riscv64a23_unknown_linux_gnu.rs+4-2| ... | ... | @@ -1,6 +1,8 @@ |
| 1 | 1 | use std::borrow::Cow; |
| 2 | 2 | |
| 3 | use crate::spec::{Arch, CodeModel, SplitDebuginfo, Target, TargetMetadata, TargetOptions, base}; | |
| 3 | use crate::spec::{ | |
| 4 | Arch, CodeModel, LlvmAbi, SplitDebuginfo, Target, TargetMetadata, TargetOptions, base, | |
| 5 | }; | |
| 4 | 6 | |
| 5 | 7 | pub(crate) fn target() -> Target { |
| 6 | 8 | Target { |
| ... | ... | @@ -18,7 +20,7 @@ pub(crate) fn target() -> Target { |
| 18 | 20 | code_model: Some(CodeModel::Medium), |
| 19 | 21 | cpu: "generic-rv64".into(), |
| 20 | 22 | features: "+rva23u64".into(), |
| 21 | llvm_abiname: "lp64d".into(), | |
| 23 | llvm_abiname: LlvmAbi::Lp64d, | |
| 22 | 24 | max_atomic_width: Some(64), |
| 23 | 25 | supported_split_debuginfo: Cow::Borrowed(&[SplitDebuginfo::Off]), |
| 24 | 26 | ..base::linux_gnu::opts() |
compiler/rustc_target/src/spec/targets/riscv64gc_unknown_freebsd.rs+2-2| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | use crate::spec::{Arch, CodeModel, Target, TargetMetadata, TargetOptions, base}; | |
| 1 | use crate::spec::{Arch, CodeModel, LlvmAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 2 | 2 | |
| 3 | 3 | pub(crate) fn target() -> Target { |
| 4 | 4 | Target { |
| ... | ... | @@ -16,7 +16,7 @@ pub(crate) fn target() -> Target { |
| 16 | 16 | code_model: Some(CodeModel::Medium), |
| 17 | 17 | cpu: "generic-rv64".into(), |
| 18 | 18 | features: "+m,+a,+f,+d,+c,+zicsr,+zifencei".into(), |
| 19 | llvm_abiname: "lp64d".into(), | |
| 19 | llvm_abiname: LlvmAbi::Lp64d, | |
| 20 | 20 | max_atomic_width: Some(64), |
| 21 | 21 | ..base::freebsd::opts() |
| 22 | 22 | }, |
compiler/rustc_target/src/spec/targets/riscv64gc_unknown_fuchsia.rs+4-2| ... | ... | @@ -1,11 +1,13 @@ |
| 1 | use crate::spec::{Arch, CodeModel, SanitizerSet, StackProbeType, Target, TargetMetadata, base}; | |
| 1 | use crate::spec::{ | |
| 2 | Arch, CodeModel, LlvmAbi, SanitizerSet, StackProbeType, Target, TargetMetadata, base, | |
| 3 | }; | |
| 2 | 4 | |
| 3 | 5 | pub(crate) fn target() -> Target { |
| 4 | 6 | let mut base = base::fuchsia::opts(); |
| 5 | 7 | base.code_model = Some(CodeModel::Medium); |
| 6 | 8 | base.cpu = "generic-rv64".into(); |
| 7 | 9 | base.features = "+m,+a,+f,+d,+c,+zicsr,+zifencei".into(); |
| 8 | base.llvm_abiname = "lp64d".into(); | |
| 10 | base.llvm_abiname = LlvmAbi::Lp64d; | |
| 9 | 11 | base.max_atomic_width = Some(64); |
| 10 | 12 | base.stack_probes = StackProbeType::Inline; |
| 11 | 13 | base.supported_sanitizers = SanitizerSet::SHADOWCALLSTACK; |
compiler/rustc_target/src/spec/targets/riscv64gc_unknown_hermit.rs+2-2| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | use crate::spec::{ |
| 2 | Arch, CodeModel, RelocModel, Target, TargetMetadata, TargetOptions, TlsModel, base, | |
| 2 | Arch, CodeModel, LlvmAbi, RelocModel, Target, TargetMetadata, TargetOptions, TlsModel, base, | |
| 3 | 3 | }; |
| 4 | 4 | |
| 5 | 5 | pub(crate) fn target() -> Target { |
| ... | ... | @@ -21,7 +21,7 @@ pub(crate) fn target() -> Target { |
| 21 | 21 | code_model: Some(CodeModel::Medium), |
| 22 | 22 | tls_model: TlsModel::LocalExec, |
| 23 | 23 | max_atomic_width: Some(64), |
| 24 | llvm_abiname: "lp64d".into(), | |
| 24 | llvm_abiname: LlvmAbi::Lp64d, | |
| 25 | 25 | ..base::hermit::opts() |
| 26 | 26 | }, |
| 27 | 27 | } |
compiler/rustc_target/src/spec/targets/riscv64gc_unknown_linux_gnu.rs+4-2| ... | ... | @@ -1,6 +1,8 @@ |
| 1 | 1 | use std::borrow::Cow; |
| 2 | 2 | |
| 3 | use crate::spec::{Arch, CodeModel, SplitDebuginfo, Target, TargetMetadata, TargetOptions, base}; | |
| 3 | use crate::spec::{ | |
| 4 | Arch, CodeModel, LlvmAbi, SplitDebuginfo, Target, TargetMetadata, TargetOptions, base, | |
| 5 | }; | |
| 4 | 6 | |
| 5 | 7 | pub(crate) fn target() -> Target { |
| 6 | 8 | Target { |
| ... | ... | @@ -18,7 +20,7 @@ pub(crate) fn target() -> Target { |
| 18 | 20 | code_model: Some(CodeModel::Medium), |
| 19 | 21 | cpu: "generic-rv64".into(), |
| 20 | 22 | features: "+m,+a,+f,+d,+c,+zicsr,+zifencei".into(), |
| 21 | llvm_abiname: "lp64d".into(), | |
| 23 | llvm_abiname: LlvmAbi::Lp64d, | |
| 22 | 24 | max_atomic_width: Some(64), |
| 23 | 25 | supported_split_debuginfo: Cow::Borrowed(&[SplitDebuginfo::Off]), |
| 24 | 26 | ..base::linux_gnu::opts() |
compiler/rustc_target/src/spec/targets/riscv64gc_unknown_linux_musl.rs+4-2| ... | ... | @@ -1,6 +1,8 @@ |
| 1 | 1 | use std::borrow::Cow; |
| 2 | 2 | |
| 3 | use crate::spec::{Arch, CodeModel, SplitDebuginfo, Target, TargetMetadata, TargetOptions, base}; | |
| 3 | use crate::spec::{ | |
| 4 | Arch, CodeModel, LlvmAbi, SplitDebuginfo, Target, TargetMetadata, TargetOptions, base, | |
| 5 | }; | |
| 4 | 6 | |
| 5 | 7 | pub(crate) fn target() -> Target { |
| 6 | 8 | Target { |
| ... | ... | @@ -18,7 +20,7 @@ pub(crate) fn target() -> Target { |
| 18 | 20 | code_model: Some(CodeModel::Medium), |
| 19 | 21 | cpu: "generic-rv64".into(), |
| 20 | 22 | features: "+m,+a,+f,+d,+c,+zicsr,+zifencei".into(), |
| 21 | llvm_abiname: "lp64d".into(), | |
| 23 | llvm_abiname: LlvmAbi::Lp64d, | |
| 22 | 24 | max_atomic_width: Some(64), |
| 23 | 25 | supported_split_debuginfo: Cow::Borrowed(&[SplitDebuginfo::Off]), |
| 24 | 26 | ..base::linux_musl::opts() |
compiler/rustc_target/src/spec/targets/riscv64gc_unknown_managarm_mlibc.rs+2-2| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | use crate::spec::{Arch, CodeModel, Target, TargetOptions, base}; | |
| 1 | use crate::spec::{Arch, CodeModel, LlvmAbi, Target, TargetOptions, base}; | |
| 2 | 2 | |
| 3 | 3 | pub(crate) fn target() -> Target { |
| 4 | 4 | Target { |
| ... | ... | @@ -16,7 +16,7 @@ pub(crate) fn target() -> Target { |
| 16 | 16 | code_model: Some(CodeModel::Medium), |
| 17 | 17 | cpu: "generic-rv64".into(), |
| 18 | 18 | features: "+m,+a,+f,+d,+c".into(), |
| 19 | llvm_abiname: "lp64d".into(), | |
| 19 | llvm_abiname: LlvmAbi::Lp64d, | |
| 20 | 20 | max_atomic_width: Some(64), |
| 21 | 21 | ..base::managarm_mlibc::opts() |
| 22 | 22 | }, |
compiler/rustc_target/src/spec/targets/riscv64gc_unknown_netbsd.rs+2-2| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | use crate::spec::{Arch, CodeModel, Target, TargetMetadata, TargetOptions, base}; | |
| 1 | use crate::spec::{Arch, CodeModel, LlvmAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 2 | 2 | |
| 3 | 3 | pub(crate) fn target() -> Target { |
| 4 | 4 | Target { |
| ... | ... | @@ -16,7 +16,7 @@ pub(crate) fn target() -> Target { |
| 16 | 16 | code_model: Some(CodeModel::Medium), |
| 17 | 17 | cpu: "generic-rv64".into(), |
| 18 | 18 | features: "+m,+a,+f,+d,+c,+zicsr,+zifencei".into(), |
| 19 | llvm_abiname: "lp64d".into(), | |
| 19 | llvm_abiname: LlvmAbi::Lp64d, | |
| 20 | 20 | max_atomic_width: Some(64), |
| 21 | 21 | mcount: "__mcount".into(), |
| 22 | 22 | ..base::netbsd::opts() |
compiler/rustc_target/src/spec/targets/riscv64gc_unknown_none_elf.rs+3-3| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | use 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, | |
| 4 | 4 | }; |
| 5 | 5 | |
| 6 | 6 | pub(crate) fn target() -> Target { |
| ... | ... | @@ -19,7 +19,7 @@ pub(crate) fn target() -> Target { |
| 19 | 19 | options: TargetOptions { |
| 20 | 20 | linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes), |
| 21 | 21 | linker: Some("rust-lld".into()), |
| 22 | llvm_abiname: "lp64d".into(), | |
| 22 | llvm_abiname: LlvmAbi::Lp64d, | |
| 23 | 23 | cpu: "generic-rv64".into(), |
| 24 | 24 | max_atomic_width: Some(64), |
| 25 | 25 | 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 @@ |
| 1 | 1 | use 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, | |
| 4 | 4 | }; |
| 5 | 5 | |
| 6 | 6 | pub(crate) fn target() -> Target { |
| ... | ... | @@ -21,7 +21,7 @@ pub(crate) fn target() -> Target { |
| 21 | 21 | os: Os::NuttX, |
| 22 | 22 | linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes), |
| 23 | 23 | linker: Some("rust-lld".into()), |
| 24 | llvm_abiname: "lp64d".into(), | |
| 24 | llvm_abiname: LlvmAbi::Lp64d, | |
| 25 | 25 | cpu: "generic-rv64".into(), |
| 26 | 26 | max_atomic_width: Some(64), |
| 27 | 27 | 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 @@ |
| 1 | use crate::spec::{Arch, CodeModel, Target, TargetMetadata, TargetOptions, base}; | |
| 1 | use crate::spec::{Arch, CodeModel, LlvmAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 2 | 2 | |
| 3 | 3 | pub(crate) fn target() -> Target { |
| 4 | 4 | Target { |
| ... | ... | @@ -16,7 +16,7 @@ pub(crate) fn target() -> Target { |
| 16 | 16 | code_model: Some(CodeModel::Medium), |
| 17 | 17 | cpu: "generic-rv64".into(), |
| 18 | 18 | features: "+m,+a,+f,+d,+c,+zicsr,+zifencei".into(), |
| 19 | llvm_abiname: "lp64d".into(), | |
| 19 | llvm_abiname: LlvmAbi::Lp64d, | |
| 20 | 20 | max_atomic_width: Some(64), |
| 21 | 21 | ..base::openbsd::opts() |
| 22 | 22 | }, |
compiler/rustc_target/src/spec/targets/riscv64gc_unknown_redox.rs+2-2| ... | ... | @@ -1,11 +1,11 @@ |
| 1 | use crate::spec::{Arch, CodeModel, Target, TargetMetadata, base}; | |
| 1 | use crate::spec::{Arch, CodeModel, LlvmAbi, Target, TargetMetadata, base}; | |
| 2 | 2 | |
| 3 | 3 | pub(crate) fn target() -> Target { |
| 4 | 4 | let mut base = base::redox::opts(); |
| 5 | 5 | base.code_model = Some(CodeModel::Medium); |
| 6 | 6 | base.cpu = "generic-rv64".into(); |
| 7 | 7 | base.features = "+m,+a,+f,+d,+c".into(); |
| 8 | base.llvm_abiname = "lp64d".into(); | |
| 8 | base.llvm_abiname = LlvmAbi::Lp64d; | |
| 9 | 9 | base.plt_by_default = false; |
| 10 | 10 | base.max_atomic_width = Some(64); |
| 11 | 11 |
compiler/rustc_target/src/spec/targets/riscv64im_unknown_none_elf.rs+3-3| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | use 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, | |
| 4 | 4 | }; |
| 5 | 5 | |
| 6 | 6 | pub(crate) fn target() -> Target { |
| ... | ... | @@ -23,7 +23,7 @@ pub(crate) fn target() -> Target { |
| 23 | 23 | max_atomic_width: Some(64), |
| 24 | 24 | atomic_cas: false, |
| 25 | 25 | features: "+m,+forced-atomics".into(), |
| 26 | llvm_abiname: "lp64".into(), | |
| 26 | llvm_abiname: LlvmAbi::Lp64, | |
| 27 | 27 | panic_strategy: PanicStrategy::Abort, |
| 28 | 28 | relocation_model: RelocModel::Static, |
| 29 | 29 | code_model: Some(CodeModel::Medium), |
compiler/rustc_target/src/spec/targets/riscv64imac_unknown_none_elf.rs+3-3| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | use 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, | |
| 4 | 4 | }; |
| 5 | 5 | |
| 6 | 6 | pub(crate) fn target() -> Target { |
| ... | ... | @@ -22,7 +22,7 @@ pub(crate) fn target() -> Target { |
| 22 | 22 | cpu: "generic-rv64".into(), |
| 23 | 23 | max_atomic_width: Some(64), |
| 24 | 24 | features: "+m,+a,+c".into(), |
| 25 | llvm_abiname: "lp64".into(), | |
| 25 | llvm_abiname: LlvmAbi::Lp64, | |
| 26 | 26 | panic_strategy: PanicStrategy::Abort, |
| 27 | 27 | relocation_model: RelocModel::Static, |
| 28 | 28 | code_model: Some(CodeModel::Medium), |
compiler/rustc_target/src/spec/targets/riscv64imac_unknown_nuttx_elf.rs+3-3| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | use 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, | |
| 4 | 4 | }; |
| 5 | 5 | |
| 6 | 6 | pub(crate) fn target() -> Target { |
| ... | ... | @@ -24,7 +24,7 @@ pub(crate) fn target() -> Target { |
| 24 | 24 | cpu: "generic-rv64".into(), |
| 25 | 25 | max_atomic_width: Some(64), |
| 26 | 26 | features: "+m,+a,+c".into(), |
| 27 | llvm_abiname: "lp64".into(), | |
| 27 | llvm_abiname: LlvmAbi::Lp64, | |
| 28 | 28 | panic_strategy: PanicStrategy::Abort, |
| 29 | 29 | relocation_model: RelocModel::Static, |
| 30 | 30 | code_model: Some(CodeModel::Medium), |
compiler/rustc_target/src/spec/targets/s390x_unknown_none_softfloat.rs+2-2| ... | ... | @@ -1,13 +1,13 @@ |
| 1 | 1 | use rustc_abi::{Align, Endian}; |
| 2 | 2 | |
| 3 | 3 | use crate::spec::{ |
| 4 | Abi, Arch, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, RustcAbi, SanitizerSet, | |
| 4 | Arch, Cc, CfgAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, RustcAbi, SanitizerSet, | |
| 5 | 5 | StackProbeType, Target, TargetMetadata, TargetOptions, |
| 6 | 6 | }; |
| 7 | 7 | |
| 8 | 8 | pub(crate) fn target() -> Target { |
| 9 | 9 | let opts = TargetOptions { |
| 10 | abi: Abi::SoftFloat, | |
| 10 | cfg_abi: CfgAbi::SoftFloat, | |
| 11 | 11 | cpu: "z10".into(), |
| 12 | 12 | endian: Endian::Big, |
| 13 | 13 | features: "+soft-float,-vector".into(), |
compiler/rustc_target/src/spec/targets/thumbv4t_none_eabi.rs+2-2| ... | ... | @@ -9,7 +9,7 @@ |
| 9 | 9 | //! The default link script is very likely wrong, so you should use |
| 10 | 10 | //! `-Clink-arg=-Tmy_script.ld` to override that with a correct linker script. |
| 11 | 11 | |
| 12 | use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base, cvs}; | |
| 12 | use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base, cvs}; | |
| 13 | 13 | |
| 14 | 14 | pub(crate) fn target() -> Target { |
| 15 | 15 | Target { |
| ... | ... | @@ -24,7 +24,7 @@ pub(crate) fn target() -> Target { |
| 24 | 24 | arch: Arch::Arm, |
| 25 | 25 | data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(), |
| 26 | 26 | options: TargetOptions { |
| 27 | abi: Abi::Eabi, | |
| 27 | cfg_abi: CfgAbi::Eabi, | |
| 28 | 28 | llvm_floatabi: Some(FloatAbi::Soft), |
| 29 | 29 | asm_args: cvs!["-mthumb-interwork", "-march=armv4t", "-mlittle-endian",], |
| 30 | 30 | features: "+soft-float,+strict-align".into(), |
compiler/rustc_target/src/spec/targets/thumbv5te_none_eabi.rs+2-2| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | //! Targets the ARMv5TE architecture, with `t32` code by default. |
| 2 | 2 | |
| 3 | use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base, cvs}; | |
| 3 | use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base, cvs}; | |
| 4 | 4 | |
| 5 | 5 | pub(crate) fn target() -> Target { |
| 6 | 6 | Target { |
| ... | ... | @@ -15,7 +15,7 @@ pub(crate) fn target() -> Target { |
| 15 | 15 | arch: Arch::Arm, |
| 16 | 16 | data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(), |
| 17 | 17 | options: TargetOptions { |
| 18 | abi: Abi::Eabi, | |
| 18 | cfg_abi: CfgAbi::Eabi, | |
| 19 | 19 | llvm_floatabi: Some(FloatAbi::Soft), |
| 20 | 20 | asm_args: cvs!["-mthumb-interwork", "-march=armv5te", "-mlittle-endian",], |
| 21 | 21 | features: "+soft-float,+strict-align".into(), |
compiler/rustc_target/src/spec/targets/thumbv6_none_eabi.rs+2-2| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | //! Targets the ARMv6K architecture, with `t32` code by default. |
| 2 | 2 | |
| 3 | use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base, cvs}; | |
| 3 | use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base, cvs}; | |
| 4 | 4 | |
| 5 | 5 | pub(crate) fn target() -> Target { |
| 6 | 6 | Target { |
| ... | ... | @@ -15,7 +15,7 @@ pub(crate) fn target() -> Target { |
| 15 | 15 | arch: Arch::Arm, |
| 16 | 16 | data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(), |
| 17 | 17 | options: TargetOptions { |
| 18 | abi: Abi::Eabi, | |
| 18 | cfg_abi: CfgAbi::Eabi, | |
| 19 | 19 | llvm_floatabi: Some(FloatAbi::Soft), |
| 20 | 20 | asm_args: cvs!["-mthumb-interwork", "-march=armv6", "-mlittle-endian",], |
| 21 | 21 | features: "+soft-float,+strict-align,+v6k".into(), |
compiler/rustc_target/src/spec/targets/thumbv6m_none_eabi.rs+2-2| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | // Targets the Cortex-M0, Cortex-M0+ and Cortex-M1 processors (ARMv6-M architecture) |
| 2 | 2 | |
| 3 | use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 3 | use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 4 | 4 | |
| 5 | 5 | pub(crate) fn target() -> Target { |
| 6 | 6 | Target { |
| ... | ... | @@ -16,7 +16,7 @@ pub(crate) fn target() -> Target { |
| 16 | 16 | arch: Arch::Arm, |
| 17 | 17 | |
| 18 | 18 | options: TargetOptions { |
| 19 | abi: Abi::Eabi, | |
| 19 | cfg_abi: CfgAbi::Eabi, | |
| 20 | 20 | llvm_floatabi: Some(FloatAbi::Soft), |
| 21 | 21 | // The ARMv6-M architecture doesn't support unaligned loads/stores so we disable them |
| 22 | 22 | // with +strict-align. |
compiler/rustc_target/src/spec/targets/thumbv6m_nuttx_eabi.rs+2-2| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | // Targets the Cortex-M0, Cortex-M0+ and Cortex-M1 processors (ARMv6-M architecture) |
| 2 | 2 | |
| 3 | use crate::spec::{Abi, Arch, FloatAbi, Os, Target, TargetMetadata, TargetOptions, base, cvs}; | |
| 3 | use crate::spec::{Arch, CfgAbi, FloatAbi, Os, Target, TargetMetadata, TargetOptions, base, cvs}; | |
| 4 | 4 | |
| 5 | 5 | pub(crate) fn target() -> Target { |
| 6 | 6 | Target { |
| ... | ... | @@ -18,7 +18,7 @@ pub(crate) fn target() -> Target { |
| 18 | 18 | options: TargetOptions { |
| 19 | 19 | families: cvs!["unix"], |
| 20 | 20 | os: Os::NuttX, |
| 21 | abi: Abi::Eabi, | |
| 21 | cfg_abi: CfgAbi::Eabi, | |
| 22 | 22 | llvm_floatabi: Some(FloatAbi::Soft), |
| 23 | 23 | // The ARMv6-M architecture doesn't support unaligned loads/stores so we disable them |
| 24 | 24 | // with +strict-align. |
compiler/rustc_target/src/spec/targets/thumbv7a_none_eabi.rs+2-2| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | // Targets the Little-endian Cortex-A8 (and similar) processors (ARMv7-A) |
| 2 | 2 | |
| 3 | use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 3 | use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 4 | 4 | |
| 5 | 5 | pub(crate) fn target() -> Target { |
| 6 | 6 | Target { |
| ... | ... | @@ -15,7 +15,7 @@ pub(crate) fn target() -> Target { |
| 15 | 15 | data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(), |
| 16 | 16 | arch: Arch::Arm, |
| 17 | 17 | options: TargetOptions { |
| 18 | abi: Abi::Eabi, | |
| 18 | cfg_abi: CfgAbi::Eabi, | |
| 19 | 19 | llvm_floatabi: Some(FloatAbi::Soft), |
| 20 | 20 | features: "+soft-float,-neon,+strict-align".into(), |
| 21 | 21 | max_atomic_width: Some(64), |
compiler/rustc_target/src/spec/targets/thumbv7a_none_eabihf.rs+2-2| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | // Targets the Little-endian Cortex-A8 (and similar) processors (ARMv7-A) |
| 2 | 2 | |
| 3 | use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 3 | use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 4 | 4 | |
| 5 | 5 | pub(crate) fn target() -> Target { |
| 6 | 6 | Target { |
| ... | ... | @@ -15,7 +15,7 @@ pub(crate) fn target() -> Target { |
| 15 | 15 | data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(), |
| 16 | 16 | arch: Arch::Arm, |
| 17 | 17 | options: TargetOptions { |
| 18 | abi: Abi::EabiHf, | |
| 18 | cfg_abi: CfgAbi::EabiHf, | |
| 19 | 19 | llvm_floatabi: Some(FloatAbi::Hard), |
| 20 | 20 | features: "+vfp3d16,-neon,+strict-align".into(), |
| 21 | 21 | max_atomic_width: Some(64), |
compiler/rustc_target/src/spec/targets/thumbv7a_nuttx_eabi.rs+2-2| ... | ... | @@ -4,7 +4,7 @@ |
| 4 | 4 | // and will use software floating point operations. This matches the NuttX EABI |
| 5 | 5 | // configuration without hardware floating point support. |
| 6 | 6 | |
| 7 | use crate::spec::{Abi, Arch, FloatAbi, Os, Target, TargetMetadata, TargetOptions, base, cvs}; | |
| 7 | use crate::spec::{Arch, CfgAbi, FloatAbi, Os, Target, TargetMetadata, TargetOptions, base, cvs}; | |
| 8 | 8 | |
| 9 | 9 | pub(crate) fn target() -> Target { |
| 10 | 10 | Target { |
| ... | ... | @@ -22,7 +22,7 @@ pub(crate) fn target() -> Target { |
| 22 | 22 | options: TargetOptions { |
| 23 | 23 | families: cvs!["unix"], |
| 24 | 24 | os: Os::NuttX, |
| 25 | abi: Abi::Eabi, | |
| 25 | cfg_abi: CfgAbi::Eabi, | |
| 26 | 26 | llvm_floatabi: Some(FloatAbi::Soft), |
| 27 | 27 | // Cortex-A7/A8/A9 with software floating point |
| 28 | 28 | features: "+soft-float,-neon".into(), |
compiler/rustc_target/src/spec/targets/thumbv7a_nuttx_eabihf.rs+2-2| ... | ... | @@ -7,7 +7,7 @@ |
| 7 | 7 | // This target uses the "hard" floating convention (ABI) where floating point values |
| 8 | 8 | // are passed to/from subroutines via FPU registers (S0, S1, D0, D1, etc.). |
| 9 | 9 | |
| 10 | use crate::spec::{Abi, Arch, FloatAbi, Os, Target, TargetMetadata, TargetOptions, base, cvs}; | |
| 10 | use crate::spec::{Arch, CfgAbi, FloatAbi, Os, Target, TargetMetadata, TargetOptions, base, cvs}; | |
| 11 | 11 | |
| 12 | 12 | pub(crate) fn target() -> Target { |
| 13 | 13 | Target { |
| ... | ... | @@ -25,7 +25,7 @@ pub(crate) fn target() -> Target { |
| 25 | 25 | options: TargetOptions { |
| 26 | 26 | families: cvs!["unix"], |
| 27 | 27 | os: Os::NuttX, |
| 28 | abi: Abi::EabiHf, | |
| 28 | cfg_abi: CfgAbi::EabiHf, | |
| 29 | 29 | llvm_floatabi: Some(FloatAbi::Hard), |
| 30 | 30 | // Cortex-A7/A8/A9 support VFPv3-D32/VFPv4-D32 with optional double-precision |
| 31 | 31 | // and NEON SIMD instructions |
compiler/rustc_target/src/spec/targets/thumbv7em_none_eabi.rs+2-2| ... | ... | @@ -9,7 +9,7 @@ |
| 9 | 9 | // To opt-in to hardware accelerated floating point operations, you can use, for example, |
| 10 | 10 | // `-C target-feature=+vfp4` or `-C target-cpu=cortex-m4`. |
| 11 | 11 | |
| 12 | use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 12 | use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 13 | 13 | |
| 14 | 14 | pub(crate) fn target() -> Target { |
| 15 | 15 | Target { |
| ... | ... | @@ -25,7 +25,7 @@ pub(crate) fn target() -> Target { |
| 25 | 25 | arch: Arch::Arm, |
| 26 | 26 | |
| 27 | 27 | options: TargetOptions { |
| 28 | abi: Abi::Eabi, | |
| 28 | cfg_abi: CfgAbi::Eabi, | |
| 29 | 29 | llvm_floatabi: Some(FloatAbi::Soft), |
| 30 | 30 | max_atomic_width: Some(32), |
| 31 | 31 | ..base::arm_none::opts() |
compiler/rustc_target/src/spec/targets/thumbv7em_none_eabihf.rs+2-2| ... | ... | @@ -8,7 +8,7 @@ |
| 8 | 8 | // |
| 9 | 9 | // To opt into double precision hardware support, use the `-C target-feature=+fp64` flag. |
| 10 | 10 | |
| 11 | use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 11 | use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 12 | 12 | |
| 13 | 13 | pub(crate) fn target() -> Target { |
| 14 | 14 | Target { |
| ... | ... | @@ -24,7 +24,7 @@ pub(crate) fn target() -> Target { |
| 24 | 24 | arch: Arch::Arm, |
| 25 | 25 | |
| 26 | 26 | options: TargetOptions { |
| 27 | abi: Abi::EabiHf, | |
| 27 | cfg_abi: CfgAbi::EabiHf, | |
| 28 | 28 | llvm_floatabi: Some(FloatAbi::Hard), |
| 29 | 29 | // vfp4 is the lowest common denominator between the Cortex-M4F (vfp4) and the |
| 30 | 30 | // Cortex-M7 (vfp5). |
compiler/rustc_target/src/spec/targets/thumbv7em_nuttx_eabi.rs+2-2| ... | ... | @@ -9,7 +9,7 @@ |
| 9 | 9 | // To opt-in to hardware accelerated floating point operations, you can use, for example, |
| 10 | 10 | // `-C target-feature=+vfp4` or `-C target-cpu=cortex-m4`. |
| 11 | 11 | |
| 12 | use crate::spec::{Abi, Arch, FloatAbi, Os, Target, TargetMetadata, TargetOptions, base, cvs}; | |
| 12 | use crate::spec::{Arch, CfgAbi, FloatAbi, Os, Target, TargetMetadata, TargetOptions, base, cvs}; | |
| 13 | 13 | |
| 14 | 14 | pub(crate) fn target() -> Target { |
| 15 | 15 | Target { |
| ... | ... | @@ -27,7 +27,7 @@ pub(crate) fn target() -> Target { |
| 27 | 27 | options: TargetOptions { |
| 28 | 28 | families: cvs!["unix"], |
| 29 | 29 | os: Os::NuttX, |
| 30 | abi: Abi::Eabi, | |
| 30 | cfg_abi: CfgAbi::Eabi, | |
| 31 | 31 | llvm_floatabi: Some(FloatAbi::Soft), |
| 32 | 32 | max_atomic_width: Some(32), |
| 33 | 33 | ..base::arm_none::opts() |
compiler/rustc_target/src/spec/targets/thumbv7em_nuttx_eabihf.rs+2-2| ... | ... | @@ -8,7 +8,7 @@ |
| 8 | 8 | // |
| 9 | 9 | // To opt into double precision hardware support, use the `-C target-feature=+fp64` flag. |
| 10 | 10 | |
| 11 | use crate::spec::{Abi, Arch, FloatAbi, Os, Target, TargetMetadata, TargetOptions, base, cvs}; | |
| 11 | use crate::spec::{Arch, CfgAbi, FloatAbi, Os, Target, TargetMetadata, TargetOptions, base, cvs}; | |
| 12 | 12 | |
| 13 | 13 | pub(crate) fn target() -> Target { |
| 14 | 14 | Target { |
| ... | ... | @@ -26,7 +26,7 @@ pub(crate) fn target() -> Target { |
| 26 | 26 | options: TargetOptions { |
| 27 | 27 | families: cvs!["unix"], |
| 28 | 28 | os: Os::NuttX, |
| 29 | abi: Abi::EabiHf, | |
| 29 | cfg_abi: CfgAbi::EabiHf, | |
| 30 | 30 | llvm_floatabi: Some(FloatAbi::Hard), |
| 31 | 31 | // vfp4 is the lowest common denominator between the Cortex-M4F (vfp4) and the |
| 32 | 32 | // Cortex-M7 (vfp5). |
compiler/rustc_target/src/spec/targets/thumbv7m_none_eabi.rs+2-2| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | // Targets the Cortex-M3 processor (ARMv7-M) |
| 2 | 2 | |
| 3 | use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 3 | use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 4 | 4 | |
| 5 | 5 | pub(crate) fn target() -> Target { |
| 6 | 6 | Target { |
| ... | ... | @@ -16,7 +16,7 @@ pub(crate) fn target() -> Target { |
| 16 | 16 | arch: Arch::Arm, |
| 17 | 17 | |
| 18 | 18 | options: TargetOptions { |
| 19 | abi: Abi::Eabi, | |
| 19 | cfg_abi: CfgAbi::Eabi, | |
| 20 | 20 | llvm_floatabi: Some(FloatAbi::Soft), |
| 21 | 21 | max_atomic_width: Some(32), |
| 22 | 22 | ..base::arm_none::opts() |
compiler/rustc_target/src/spec/targets/thumbv7m_nuttx_eabi.rs+2-2| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | // Targets the Cortex-M3 processor (ARMv7-M) |
| 2 | 2 | |
| 3 | use crate::spec::{Abi, Arch, FloatAbi, Os, Target, TargetMetadata, TargetOptions, base, cvs}; | |
| 3 | use crate::spec::{Arch, CfgAbi, FloatAbi, Os, Target, TargetMetadata, TargetOptions, base, cvs}; | |
| 4 | 4 | |
| 5 | 5 | pub(crate) fn target() -> Target { |
| 6 | 6 | Target { |
| ... | ... | @@ -18,7 +18,7 @@ pub(crate) fn target() -> Target { |
| 18 | 18 | options: TargetOptions { |
| 19 | 19 | families: cvs!["unix"], |
| 20 | 20 | os: Os::NuttX, |
| 21 | abi: Abi::Eabi, | |
| 21 | cfg_abi: CfgAbi::Eabi, | |
| 22 | 22 | llvm_floatabi: Some(FloatAbi::Soft), |
| 23 | 23 | max_atomic_width: Some(32), |
| 24 | 24 | ..base::arm_none::opts() |
compiler/rustc_target/src/spec/targets/thumbv7neon_linux_androideabi.rs+2-2| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | use crate::spec::{ |
| 2 | Abi, Arch, Cc, FloatAbi, LinkerFlavor, Lld, Target, TargetMetadata, TargetOptions, base, | |
| 2 | Arch, Cc, CfgAbi, FloatAbi, LinkerFlavor, Lld, Target, TargetMetadata, TargetOptions, base, | |
| 3 | 3 | }; |
| 4 | 4 | |
| 5 | 5 | // This target if is for the Android v7a ABI in thumb mode with |
| ... | ... | @@ -25,7 +25,7 @@ pub(crate) fn target() -> Target { |
| 25 | 25 | data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(), |
| 26 | 26 | arch: Arch::Arm, |
| 27 | 27 | options: TargetOptions { |
| 28 | abi: Abi::Eabi, | |
| 28 | cfg_abi: CfgAbi::Eabi, | |
| 29 | 29 | llvm_floatabi: Some(FloatAbi::Soft), |
| 30 | 30 | features: "+v7,+thumb-mode,+thumb2,+vfp3,+neon".into(), |
| 31 | 31 | max_atomic_width: Some(64), |
compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_gnueabihf.rs+2-2| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 1 | use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 2 | 2 | |
| 3 | 3 | // This target is for glibc Linux on ARMv7 with thumb mode enabled |
| 4 | 4 | // (for consistency with Android and Debian-based distributions) |
| ... | ... | @@ -21,7 +21,7 @@ pub(crate) fn target() -> Target { |
| 21 | 21 | data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(), |
| 22 | 22 | arch: Arch::Arm, |
| 23 | 23 | options: TargetOptions { |
| 24 | abi: Abi::EabiHf, | |
| 24 | cfg_abi: CfgAbi::EabiHf, | |
| 25 | 25 | llvm_floatabi: Some(FloatAbi::Hard), |
| 26 | 26 | // Info about features at https://wiki.debian.org/ArmHardFloatPort |
| 27 | 27 | 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 @@ |
| 1 | use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 1 | use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 2 | 2 | |
| 3 | 3 | // This target is for musl Linux on ARMv7 with thumb mode enabled |
| 4 | 4 | // (for consistency with Android and Debian-based distributions) |
| ... | ... | @@ -22,7 +22,7 @@ pub(crate) fn target() -> Target { |
| 22 | 22 | // Most of these settings are copied from the thumbv7neon_unknown_linux_gnueabihf |
| 23 | 23 | // target. |
| 24 | 24 | options: TargetOptions { |
| 25 | abi: Abi::EabiHf, | |
| 25 | cfg_abi: CfgAbi::EabiHf, | |
| 26 | 26 | llvm_floatabi: Some(FloatAbi::Hard), |
| 27 | 27 | features: "+v7,+thumb-mode,+thumb2,+vfp3,+neon".into(), |
| 28 | 28 | max_atomic_width: Some(64), |
compiler/rustc_target/src/spec/targets/thumbv7r_none_eabi.rs+2-2| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | // Targets the Little-endian Cortex-R4/R5 processor (ARMv7-R) |
| 2 | 2 | |
| 3 | use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 3 | use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 4 | 4 | |
| 5 | 5 | pub(crate) fn target() -> Target { |
| 6 | 6 | Target { |
| ... | ... | @@ -15,7 +15,7 @@ pub(crate) fn target() -> Target { |
| 15 | 15 | data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(), |
| 16 | 16 | arch: Arch::Arm, |
| 17 | 17 | options: TargetOptions { |
| 18 | abi: Abi::Eabi, | |
| 18 | cfg_abi: CfgAbi::Eabi, | |
| 19 | 19 | llvm_floatabi: Some(FloatAbi::Soft), |
| 20 | 20 | max_atomic_width: Some(64), |
| 21 | 21 | has_thumb_interworking: true, |
compiler/rustc_target/src/spec/targets/thumbv7r_none_eabihf.rs+2-2| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | // Targets the Little-endian Cortex-R4F/R5F processor (ARMv7-R) |
| 2 | 2 | |
| 3 | use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 3 | use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 4 | 4 | |
| 5 | 5 | pub(crate) fn target() -> Target { |
| 6 | 6 | Target { |
| ... | ... | @@ -15,7 +15,7 @@ pub(crate) fn target() -> Target { |
| 15 | 15 | data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(), |
| 16 | 16 | arch: Arch::Arm, |
| 17 | 17 | options: TargetOptions { |
| 18 | abi: Abi::EabiHf, | |
| 18 | cfg_abi: CfgAbi::EabiHf, | |
| 19 | 19 | llvm_floatabi: Some(FloatAbi::Hard), |
| 20 | 20 | features: "+vfp3d16".into(), |
| 21 | 21 | max_atomic_width: Some(64), |
compiler/rustc_target/src/spec/targets/thumbv8m_base_none_eabi.rs+2-2| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | // Targets the Cortex-M23 processor (Baseline ARMv8-M) |
| 2 | 2 | |
| 3 | use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 3 | use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 4 | 4 | |
| 5 | 5 | pub(crate) fn target() -> Target { |
| 6 | 6 | Target { |
| ... | ... | @@ -16,7 +16,7 @@ pub(crate) fn target() -> Target { |
| 16 | 16 | arch: Arch::Arm, |
| 17 | 17 | |
| 18 | 18 | options: TargetOptions { |
| 19 | abi: Abi::Eabi, | |
| 19 | cfg_abi: CfgAbi::Eabi, | |
| 20 | 20 | llvm_floatabi: Some(FloatAbi::Soft), |
| 21 | 21 | // ARMv8-M baseline doesn't support unaligned loads/stores so we disable them |
| 22 | 22 | // with +strict-align. |
compiler/rustc_target/src/spec/targets/thumbv8m_base_nuttx_eabi.rs+2-2| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | // Targets the Cortex-M23 processor (Baseline ARMv8-M) |
| 2 | 2 | |
| 3 | use crate::spec::{Abi, Arch, FloatAbi, Os, Target, TargetMetadata, TargetOptions, base, cvs}; | |
| 3 | use crate::spec::{Arch, CfgAbi, FloatAbi, Os, Target, TargetMetadata, TargetOptions, base, cvs}; | |
| 4 | 4 | |
| 5 | 5 | pub(crate) fn target() -> Target { |
| 6 | 6 | Target { |
| ... | ... | @@ -18,7 +18,7 @@ pub(crate) fn target() -> Target { |
| 18 | 18 | options: TargetOptions { |
| 19 | 19 | families: cvs!["unix"], |
| 20 | 20 | os: Os::NuttX, |
| 21 | abi: Abi::Eabi, | |
| 21 | cfg_abi: CfgAbi::Eabi, | |
| 22 | 22 | llvm_floatabi: Some(FloatAbi::Soft), |
| 23 | 23 | // ARMv8-M baseline doesn't support unaligned loads/stores so we disable them |
| 24 | 24 | // with +strict-align. |
compiler/rustc_target/src/spec/targets/thumbv8m_main_none_eabi.rs+2-2| ... | ... | @@ -1,7 +1,7 @@ |
| 1 | 1 | // Targets the Cortex-M33 processor (Armv8-M Mainline architecture profile), |
| 2 | 2 | // without the Floating Point extension. |
| 3 | 3 | |
| 4 | use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 4 | use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 5 | 5 | |
| 6 | 6 | pub(crate) fn target() -> Target { |
| 7 | 7 | Target { |
| ... | ... | @@ -17,7 +17,7 @@ pub(crate) fn target() -> Target { |
| 17 | 17 | arch: Arch::Arm, |
| 18 | 18 | |
| 19 | 19 | options: TargetOptions { |
| 20 | abi: Abi::Eabi, | |
| 20 | cfg_abi: CfgAbi::Eabi, | |
| 21 | 21 | llvm_floatabi: Some(FloatAbi::Soft), |
| 22 | 22 | max_atomic_width: Some(32), |
| 23 | 23 | ..base::arm_none::opts() |
compiler/rustc_target/src/spec/targets/thumbv8m_main_none_eabihf.rs+2-2| ... | ... | @@ -1,7 +1,7 @@ |
| 1 | 1 | // Targets the Cortex-M33 processor (Armv8-M Mainline architecture profile), |
| 2 | 2 | // with the Floating Point extension. |
| 3 | 3 | |
| 4 | use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 4 | use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 5 | 5 | |
| 6 | 6 | pub(crate) fn target() -> Target { |
| 7 | 7 | Target { |
| ... | ... | @@ -17,7 +17,7 @@ pub(crate) fn target() -> Target { |
| 17 | 17 | arch: Arch::Arm, |
| 18 | 18 | |
| 19 | 19 | options: TargetOptions { |
| 20 | abi: Abi::EabiHf, | |
| 20 | cfg_abi: CfgAbi::EabiHf, | |
| 21 | 21 | llvm_floatabi: Some(FloatAbi::Hard), |
| 22 | 22 | // If the Floating Point extension is implemented in the Cortex-M33 |
| 23 | 23 | // 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 @@ |
| 1 | 1 | // Targets the Cortex-M33 processor (Armv8-M Mainline architecture profile), |
| 2 | 2 | // without the Floating Point extension. |
| 3 | 3 | |
| 4 | use crate::spec::{Abi, Arch, FloatAbi, Os, Target, TargetMetadata, TargetOptions, base, cvs}; | |
| 4 | use crate::spec::{Arch, CfgAbi, FloatAbi, Os, Target, TargetMetadata, TargetOptions, base, cvs}; | |
| 5 | 5 | |
| 6 | 6 | pub(crate) fn target() -> Target { |
| 7 | 7 | Target { |
| ... | ... | @@ -19,7 +19,7 @@ pub(crate) fn target() -> Target { |
| 19 | 19 | options: TargetOptions { |
| 20 | 20 | families: cvs!["unix"], |
| 21 | 21 | os: Os::NuttX, |
| 22 | abi: Abi::Eabi, | |
| 22 | cfg_abi: CfgAbi::Eabi, | |
| 23 | 23 | llvm_floatabi: Some(FloatAbi::Soft), |
| 24 | 24 | max_atomic_width: Some(32), |
| 25 | 25 | ..base::arm_none::opts() |
compiler/rustc_target/src/spec/targets/thumbv8m_main_nuttx_eabihf.rs+2-2| ... | ... | @@ -1,7 +1,7 @@ |
| 1 | 1 | // Targets the Cortex-M33 processor (Armv8-M Mainline architecture profile), |
| 2 | 2 | // with the Floating Point extension. |
| 3 | 3 | |
| 4 | use crate::spec::{Abi, Arch, FloatAbi, Os, Target, TargetMetadata, TargetOptions, base, cvs}; | |
| 4 | use crate::spec::{Arch, CfgAbi, FloatAbi, Os, Target, TargetMetadata, TargetOptions, base, cvs}; | |
| 5 | 5 | |
| 6 | 6 | pub(crate) fn target() -> Target { |
| 7 | 7 | Target { |
| ... | ... | @@ -19,7 +19,7 @@ pub(crate) fn target() -> Target { |
| 19 | 19 | options: TargetOptions { |
| 20 | 20 | families: cvs!["unix"], |
| 21 | 21 | os: Os::NuttX, |
| 22 | abi: Abi::EabiHf, | |
| 22 | cfg_abi: CfgAbi::EabiHf, | |
| 23 | 23 | llvm_floatabi: Some(FloatAbi::Hard), |
| 24 | 24 | // If the Floating Point extension is implemented in the Cortex-M33 |
| 25 | 25 | // 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 @@ |
| 1 | 1 | // Targets the Little-endian Cortex-R52 processor (ARMv8-R) |
| 2 | 2 | |
| 3 | use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 3 | use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base}; | |
| 4 | 4 | |
| 5 | 5 | pub(crate) fn target() -> Target { |
| 6 | 6 | Target { |
| ... | ... | @@ -16,7 +16,7 @@ pub(crate) fn target() -> Target { |
| 16 | 16 | arch: Arch::Arm, |
| 17 | 17 | |
| 18 | 18 | options: TargetOptions { |
| 19 | abi: Abi::EabiHf, | |
| 19 | cfg_abi: CfgAbi::EabiHf, | |
| 20 | 20 | llvm_floatabi: Some(FloatAbi::Hard), |
| 21 | 21 | // Armv8-R requires a minimum set of floating-point features equivalent to: |
| 22 | 22 | // 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 @@ |
| 1 | 1 | use std::borrow::Cow; |
| 2 | 2 | |
| 3 | 3 | use 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, | |
| 5 | 5 | }; |
| 6 | 6 | |
| 7 | 7 | pub(crate) fn target() -> Target { |
| ... | ... | @@ -60,7 +60,7 @@ pub(crate) fn target() -> Target { |
| 60 | 60 | os: Os::Unknown, |
| 61 | 61 | env: Env::Sgx, |
| 62 | 62 | vendor: "fortanix".into(), |
| 63 | abi: Abi::Fortanix, | |
| 63 | cfg_abi: CfgAbi::Fortanix, | |
| 64 | 64 | linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes), |
| 65 | 65 | linker: Some("rust-lld".into()), |
| 66 | 66 | max_atomic_width: Some(64), |
compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnux32.rs+4-2| ... | ... | @@ -1,9 +1,11 @@ |
| 1 | use crate::spec::{Abi, Arch, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetMetadata, base}; | |
| 1 | use crate::spec::{ | |
| 2 | Arch, Cc, CfgAbi, LinkerFlavor, Lld, StackProbeType, Target, TargetMetadata, base, | |
| 3 | }; | |
| 2 | 4 | |
| 3 | 5 | pub(crate) fn target() -> Target { |
| 4 | 6 | let mut base = base::linux_gnu::opts(); |
| 5 | 7 | base.cpu = "x86-64".into(); |
| 6 | base.abi = Abi::X32; | |
| 8 | base.cfg_abi = CfgAbi::X32; | |
| 7 | 9 | base.max_atomic_width = Some(64); |
| 8 | 10 | base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-mx32"]); |
| 9 | 11 | 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}; |
| 5 | 5 | use rustc_macros::HashStable_Generic; |
| 6 | 6 | use rustc_span::{Symbol, sym}; |
| 7 | 7 | |
| 8 | use crate::spec::{Arch, FloatAbi, RustcAbi, Target}; | |
| 8 | use crate::spec::{Arch, FloatAbi, LlvmAbi, RustcAbi, Target}; | |
| 9 | 9 | |
| 10 | 10 | /// Features that control behaviour of rustc, rather than the codegen. |
| 11 | 11 | /// These exist globally and are not in the target-specific lists below. |
| ... | ... | @@ -1174,20 +1174,20 @@ impl Target { |
| 1174 | 1174 | Arch::RiscV32 | Arch::RiscV64 => { |
| 1175 | 1175 | // RISC-V handles ABI in a very sane way, being fully explicit via `llvm_abiname` |
| 1176 | 1176 | // about what the intended ABI is. |
| 1177 | match &*self.llvm_abiname { | |
| 1178 | "ilp32d" | "lp64d" => { | |
| 1177 | match &self.llvm_abiname { | |
| 1178 | LlvmAbi::Ilp32d | LlvmAbi::Lp64d => { | |
| 1179 | 1179 | // Requires d (which implies f), incompatible with e and zfinx. |
| 1180 | 1180 | FeatureConstraints { required: &["d"], incompatible: &["e", "zfinx"] } |
| 1181 | 1181 | } |
| 1182 | "ilp32f" | "lp64f" => { | |
| 1182 | LlvmAbi::Ilp32f | LlvmAbi::Lp64f => { | |
| 1183 | 1183 | // Requires f, incompatible with e and zfinx. |
| 1184 | 1184 | FeatureConstraints { required: &["f"], incompatible: &["e", "zfinx"] } |
| 1185 | 1185 | } |
| 1186 | "ilp32" | "lp64" => { | |
| 1186 | LlvmAbi::Ilp32 | LlvmAbi::Lp64 => { | |
| 1187 | 1187 | // Requires nothing, incompatible with e. |
| 1188 | 1188 | FeatureConstraints { required: &[], incompatible: &["e"] } |
| 1189 | 1189 | } |
| 1190 | "ilp32e" => { | |
| 1190 | LlvmAbi::Ilp32e => { | |
| 1191 | 1191 | // ilp32e is documented to be incompatible with features that need aligned |
| 1192 | 1192 | // load/stores > 32 bits, like `d`. (One could also just generate more |
| 1193 | 1193 | // complicated code to align the stack when needed, but the RISCV |
| ... | ... | @@ -1198,7 +1198,7 @@ impl Target { |
| 1198 | 1198 | // a program while the rest doesn't know they even exist. |
| 1199 | 1199 | FeatureConstraints { required: &[], incompatible: &["d"] } |
| 1200 | 1200 | } |
| 1201 | "lp64e" => { | |
| 1201 | LlvmAbi::Lp64e => { | |
| 1202 | 1202 | // As above, `e` is not required. |
| 1203 | 1203 | NOTHING |
| 1204 | 1204 | } |
| ... | ... | @@ -1208,16 +1208,16 @@ impl Target { |
| 1208 | 1208 | Arch::LoongArch32 | Arch::LoongArch64 => { |
| 1209 | 1209 | // LoongArch handles ABI in a very sane way, being fully explicit via `llvm_abiname` |
| 1210 | 1210 | // about what the intended ABI is. |
| 1211 | match &*self.llvm_abiname { | |
| 1212 | "ilp32d" | "lp64d" => { | |
| 1211 | match &self.llvm_abiname { | |
| 1212 | LlvmAbi::Ilp32d | LlvmAbi::Lp64d => { | |
| 1213 | 1213 | // Requires d (which implies f), incompatible with nothing. |
| 1214 | 1214 | FeatureConstraints { required: &["d"], incompatible: &[] } |
| 1215 | 1215 | } |
| 1216 | "ilp32f" | "lp64f" => { | |
| 1216 | LlvmAbi::Ilp32f | LlvmAbi::Lp64f => { | |
| 1217 | 1217 | // Requires f, incompatible with nothing. |
| 1218 | 1218 | FeatureConstraints { required: &["f"], incompatible: &[] } |
| 1219 | 1219 | } |
| 1220 | "ilp32s" | "lp64s" => { | |
| 1220 | LlvmAbi::Ilp32s | LlvmAbi::Lp64s => { | |
| 1221 | 1221 | // The soft-float ABI does not require any features and is also not |
| 1222 | 1222 | // incompatible with any features. Rust targets explicitly specify the |
| 1223 | 1223 | // 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> { |
| 1364 | 1364 | self.data.as_slice() |
| 1365 | 1365 | } |
| 1366 | 1366 | |
| 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 | ||
| 1367 | 1398 | /// Consumes the `BinaryHeap` and returns the underlying vector |
| 1368 | 1399 | /// in arbitrary order. |
| 1369 | 1400 | /// |
library/alloc/src/collections/btree/append.rs-51| ... | ... | @@ -1,38 +1,8 @@ |
| 1 | 1 | use core::alloc::Allocator; |
| 2 | use core::iter::FusedIterator; | |
| 3 | 2 | |
| 4 | use super::merge_iter::MergeIterInner; | |
| 5 | 3 | use super::node::{self, Root}; |
| 6 | 4 | |
| 7 | 5 | impl<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 | ||
| 36 | 6 | /// Pushes all key-value pairs to the end of the tree, incrementing a |
| 37 | 7 | /// `length` variable along the way. The latter makes it easier for the |
| 38 | 8 | /// caller to avoid a leak when the iterator panicks. |
| ... | ... | @@ -94,24 +64,3 @@ impl<K, V> Root<K, V> { |
| 94 | 64 | self.fix_right_border_of_plentiful(); |
| 95 | 65 | } |
| 96 | 66 | } |
| 97 | ||
| 98 | // An iterator for merging two sorted sequences into one | |
| 99 | struct MergeIter<K, V, I: Iterator<Item = (K, V)>>(MergeIterInner<I>); | |
| 100 | ||
| 101 | impl<K: Ord, V, I> Iterator for MergeIter<K, V, I> | |
| 102 | where | |
| 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> { |
| 1219 | 1219 | K: Ord, |
| 1220 | 1220 | A: Clone, |
| 1221 | 1221 | { |
| 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); | |
| 1242 | 1224 | } |
| 1243 | 1225 | |
| 1244 | 1226 | /// 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() { |
| 2224 | 2224 | |
| 2225 | 2225 | catch_unwind(move || left.append(&mut right)).unwrap_err(); |
| 2226 | 2226 | 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); | |
| 2228 | 2228 | assert_eq!(c.dropped(), 2); |
| 2229 | 2229 | } |
| 2230 | 2230 |
library/core/src/iter/adapters/intersperse.rs+10-25| ... | ... | @@ -1,5 +1,4 @@ |
| 1 | 1 | use crate::fmt; |
| 2 | use crate::iter::{Fuse, FusedIterator}; | |
| 3 | 2 | |
| 4 | 3 | /// An iterator adapter that places a separator between all elements. |
| 5 | 4 | /// |
| ... | ... | @@ -14,15 +13,7 @@ where |
| 14 | 13 | started: bool, |
| 15 | 14 | separator: I::Item, |
| 16 | 15 | next_item: Option<I::Item>, |
| 17 | iter: Fuse<I>, | |
| 18 | } | |
| 19 | ||
| 20 | #[unstable(feature = "iter_intersperse", issue = "79524")] | |
| 21 | impl<I> FusedIterator for Intersperse<I> | |
| 22 | where | |
| 23 | I: FusedIterator, | |
| 24 | I::Item: Clone, | |
| 25 | { | |
| 16 | iter: I, | |
| 26 | 17 | } |
| 27 | 18 | |
| 28 | 19 | impl<I: Iterator> Intersperse<I> |
| ... | ... | @@ -30,7 +21,7 @@ where |
| 30 | 21 | I::Item: Clone, |
| 31 | 22 | { |
| 32 | 23 | 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 } | |
| 34 | 25 | } |
| 35 | 26 | } |
| 36 | 27 | |
| ... | ... | @@ -57,8 +48,9 @@ where |
| 57 | 48 | } |
| 58 | 49 | } |
| 59 | 50 | } else { |
| 60 | self.started = true; | |
| 61 | self.iter.next() | |
| 51 | let item = self.iter.next(); | |
| 52 | self.started = item.is_some(); | |
| 53 | item | |
| 62 | 54 | } |
| 63 | 55 | } |
| 64 | 56 | |
| ... | ... | @@ -95,15 +87,7 @@ where |
| 95 | 87 | started: bool, |
| 96 | 88 | separator: G, |
| 97 | 89 | next_item: Option<I::Item>, |
| 98 | iter: Fuse<I>, | |
| 99 | } | |
| 100 | ||
| 101 | #[unstable(feature = "iter_intersperse", issue = "79524")] | |
| 102 | impl<I, G> FusedIterator for IntersperseWith<I, G> | |
| 103 | where | |
| 104 | I: FusedIterator, | |
| 105 | G: FnMut() -> I::Item, | |
| 106 | { | |
| 90 | iter: I, | |
| 107 | 91 | } |
| 108 | 92 | |
| 109 | 93 | #[unstable(feature = "iter_intersperse", issue = "79524")] |
| ... | ... | @@ -146,7 +130,7 @@ where |
| 146 | 130 | G: FnMut() -> I::Item, |
| 147 | 131 | { |
| 148 | 132 | 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 } | |
| 150 | 134 | } |
| 151 | 135 | } |
| 152 | 136 | |
| ... | ... | @@ -173,8 +157,9 @@ where |
| 173 | 157 | } |
| 174 | 158 | } |
| 175 | 159 | } else { |
| 176 | self.started = true; | |
| 177 | self.iter.next() | |
| 160 | let item = self.iter.next(); | |
| 161 | self.started = item.is_some(); | |
| 162 | item | |
| 178 | 163 | } |
| 179 | 164 | } |
| 180 | 165 |
library/core/src/iter/traits/iterator.rs+35-9| ... | ... | @@ -635,11 +635,24 @@ pub const trait Iterator { |
| 635 | 635 | /// of the original iterator. |
| 636 | 636 | /// |
| 637 | 637 | /// 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 | /// ``` | |
| 643 | 656 | /// |
| 644 | 657 | /// In case `separator` does not implement [`Clone`] or needs to be |
| 645 | 658 | /// computed every time, use [`intersperse_with`]. |
| ... | ... | @@ -688,10 +701,23 @@ pub const trait Iterator { |
| 688 | 701 | /// |
| 689 | 702 | /// Specifically on fused iterators, it is guaranteed that the new iterator |
| 690 | 703 | /// 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 | /// ``` | |
| 695 | 721 | /// |
| 696 | 722 | /// The `separator` closure will be called exactly once each time an item |
| 697 | 723 | /// 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() { |
| 646 | 646 | |
| 647 | 647 | #[test] |
| 648 | 648 | fn 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]; | |
| 650 | 650 | |
| 651 | 651 | let slice3: &[f32] = &{ array3 }; |
| 652 | 652 | assert!(!(array3 == slice3)); |
library/coretests/tests/iter/adapters/intersperse.rs+56-70| ... | ... | @@ -153,10 +153,6 @@ fn test_try_fold_specialization_intersperse_err() { |
| 153 | 153 | assert_eq!(iter.next(), None); |
| 154 | 154 | } |
| 155 | 155 | |
| 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. | |
| 160 | 156 | #[test] |
| 161 | 157 | fn test_non_fused_iterator_intersperse() { |
| 162 | 158 | #[derive(Debug)] |
| ... | ... | @@ -183,24 +179,26 @@ fn test_non_fused_iterator_intersperse() { |
| 183 | 179 | } |
| 184 | 180 | |
| 185 | 181 | let counter = 0; |
| 186 | // places a 2 between `Some(_)` items | |
| 182 | // places a 1 between `Some(_)` items | |
| 187 | 183 | 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); | |
| 195 | 197 | |
| 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 | |
| 197 | 199 | assert_eq!(intersperse_iter.next(), None); |
| 198 | 200 | } |
| 199 | 201 | |
| 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. | |
| 204 | 202 | #[test] |
| 205 | 203 | fn test_non_fused_iterator_intersperse_2() { |
| 206 | 204 | #[derive(Debug)] |
| ... | ... | @@ -228,35 +226,26 @@ fn test_non_fused_iterator_intersperse_2() { |
| 228 | 226 | } |
| 229 | 227 | |
| 230 | 228 | let counter = 0; |
| 231 | // places a 2 between `Some(_)` items | |
| 229 | // places a 100 between `Some(_)` items | |
| 232 | 230 | 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); | |
| 251 | 244 | |
| 252 | 245 | // Extra check to make sure it is `None` after processing 6 items |
| 253 | 246 | assert_eq!(intersperse_iter.next(), None); |
| 254 | 247 | } |
| 255 | 248 | |
| 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. | |
| 260 | 249 | #[test] |
| 261 | 250 | fn test_non_fused_iterator_intersperse_with() { |
| 262 | 251 | #[derive(Debug)] |
| ... | ... | @@ -285,22 +274,24 @@ fn test_non_fused_iterator_intersperse_with() { |
| 285 | 274 | let counter = 0; |
| 286 | 275 | let non_fused_iter = TestCounter { counter }; |
| 287 | 276 | // 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); | |
| 295 | 290 | |
| 296 | 291 | // Extra check to make sure it is `None` after processing 6 items |
| 297 | 292 | assert_eq!(intersperse_iter.next(), None); |
| 298 | 293 | } |
| 299 | 294 | |
| 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. | |
| 304 | 295 | #[test] |
| 305 | 296 | fn test_non_fused_iterator_intersperse_with_2() { |
| 306 | 297 | #[derive(Debug)] |
| ... | ... | @@ -328,26 +319,21 @@ fn test_non_fused_iterator_intersperse_with_2() { |
| 328 | 319 | } |
| 329 | 320 | |
| 330 | 321 | let counter = 0; |
| 331 | // places a 2 between `Some(_)` items | |
| 322 | // places a 100 between `Some(_)` items | |
| 332 | 323 | 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); | |
| 351 | 337 | |
| 352 | 338 | // Extra check to make sure it is `None` after processing 6 items |
| 353 | 339 | assert_eq!(intersperse_iter.next(), None); |
library/coretests/tests/num/int_macros.rs+2-1| ... | ... | @@ -2,7 +2,8 @@ macro_rules! int_module { |
| 2 | 2 | ($T:ident, $U:ident) => { |
| 3 | 3 | use core::num::ParseIntError; |
| 4 | 4 | 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; | |
| 6 | 7 | |
| 7 | 8 | const UMAX: $U = $U::MAX; |
| 8 | 9 |
library/coretests/tests/num/uint_macros.rs+7-8| ... | ... | @@ -2,15 +2,14 @@ macro_rules! uint_module { |
| 2 | 2 | ($T:ident) => { |
| 3 | 3 | use core::num::ParseIntError; |
| 4 | 4 | use core::ops::{BitAnd, BitOr, BitXor, Not, Shl, Shr}; |
| 5 | use core::$T::*; | |
| 6 | 5 | |
| 7 | 6 | use crate::num; |
| 8 | 7 | |
| 9 | 8 | #[test] |
| 10 | 9 | 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); | |
| 14 | 13 | } |
| 15 | 14 | |
| 16 | 15 | #[test] |
| ... | ... | @@ -25,7 +24,7 @@ macro_rules! uint_module { |
| 25 | 24 | assert!(0b0110 as $T == (0b1100 as $T).bitxor(0b1010 as $T)); |
| 26 | 25 | assert!(0b1110 as $T == (0b0111 as $T).shl(1)); |
| 27 | 26 | 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()); | |
| 29 | 28 | } |
| 30 | 29 | |
| 31 | 30 | const A: $T = 0b0101100; |
| ... | ... | @@ -361,7 +360,7 @@ macro_rules! uint_module { |
| 361 | 360 | assert_eq_const_safe!($T: R.wrapping_pow(2), 1 as $T); |
| 362 | 361 | assert_eq_const_safe!(Option<$T>: R.checked_pow(2), None); |
| 363 | 362 | 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); | |
| 365 | 364 | } |
| 366 | 365 | } |
| 367 | 366 | |
| ... | ... | @@ -468,14 +467,14 @@ macro_rules! uint_module { |
| 468 | 467 | fn test_next_multiple_of() { |
| 469 | 468 | assert_eq_const_safe!($T: (16 as $T).next_multiple_of(8), 16); |
| 470 | 469 | 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); | |
| 472 | 471 | } |
| 473 | 472 | |
| 474 | 473 | fn test_checked_next_multiple_of() { |
| 475 | 474 | assert_eq_const_safe!(Option<$T>: (16 as $T).checked_next_multiple_of(8), Some(16)); |
| 476 | 475 | assert_eq_const_safe!(Option<$T>: (23 as $T).checked_next_multiple_of(8), Some(24)); |
| 477 | 476 | 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); | |
| 479 | 478 | } |
| 480 | 479 | |
| 481 | 480 | fn test_is_next_multiple_of() { |
library/std/src/env.rs+10-10| ... | ... | @@ -15,7 +15,7 @@ use crate::ffi::{OsStr, OsString}; |
| 15 | 15 | use crate::num::NonZero; |
| 16 | 16 | use crate::ops::Try; |
| 17 | 17 | use crate::path::{Path, PathBuf}; |
| 18 | use crate::sys::{env as env_imp, os as os_imp}; | |
| 18 | use crate::sys::{env as env_imp, paths as paths_imp}; | |
| 19 | 19 | use crate::{array, fmt, io, sys}; |
| 20 | 20 | |
| 21 | 21 | /// Returns the current working directory as a [`PathBuf`]. |
| ... | ... | @@ -51,7 +51,7 @@ use crate::{array, fmt, io, sys}; |
| 51 | 51 | #[doc(alias = "GetCurrentDirectory")] |
| 52 | 52 | #[stable(feature = "env", since = "1.0.0")] |
| 53 | 53 | pub fn current_dir() -> io::Result<PathBuf> { |
| 54 | os_imp::getcwd() | |
| 54 | paths_imp::getcwd() | |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /// Changes the current working directory to the specified path. |
| ... | ... | @@ -78,7 +78,7 @@ pub fn current_dir() -> io::Result<PathBuf> { |
| 78 | 78 | #[doc(alias = "chdir", alias = "SetCurrentDirectory", alias = "SetCurrentDirectoryW")] |
| 79 | 79 | #[stable(feature = "env", since = "1.0.0")] |
| 80 | 80 | pub 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()) | |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /// 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) { |
| 444 | 444 | #[must_use = "iterators are lazy and do nothing unless consumed"] |
| 445 | 445 | #[stable(feature = "env", since = "1.0.0")] |
| 446 | 446 | pub struct SplitPaths<'a> { |
| 447 | inner: os_imp::SplitPaths<'a>, | |
| 447 | inner: paths_imp::SplitPaths<'a>, | |
| 448 | 448 | } |
| 449 | 449 | |
| 450 | 450 | /// Parses input according to platform conventions for the `PATH` |
| ... | ... | @@ -480,7 +480,7 @@ pub struct SplitPaths<'a> { |
| 480 | 480 | /// ``` |
| 481 | 481 | #[stable(feature = "env", since = "1.0.0")] |
| 482 | 482 | pub 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()) } | |
| 484 | 484 | } |
| 485 | 485 | |
| 486 | 486 | #[stable(feature = "env", since = "1.0.0")] |
| ... | ... | @@ -508,7 +508,7 @@ impl fmt::Debug for SplitPaths<'_> { |
| 508 | 508 | #[derive(Debug)] |
| 509 | 509 | #[stable(feature = "env", since = "1.0.0")] |
| 510 | 510 | pub struct JoinPathsError { |
| 511 | inner: os_imp::JoinPathsError, | |
| 511 | inner: paths_imp::JoinPathsError, | |
| 512 | 512 | } |
| 513 | 513 | |
| 514 | 514 | /// Joins a collection of [`Path`]s appropriately for the `PATH` |
| ... | ... | @@ -579,7 +579,7 @@ where |
| 579 | 579 | I: IntoIterator<Item = T>, |
| 580 | 580 | T: AsRef<OsStr>, |
| 581 | 581 | { |
| 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 }) | |
| 583 | 583 | } |
| 584 | 584 | |
| 585 | 585 | #[stable(feature = "env", since = "1.0.0")] |
| ... | ... | @@ -641,7 +641,7 @@ impl Error for JoinPathsError { |
| 641 | 641 | #[must_use] |
| 642 | 642 | #[stable(feature = "env", since = "1.0.0")] |
| 643 | 643 | pub fn home_dir() -> Option<PathBuf> { |
| 644 | os_imp::home_dir() | |
| 644 | paths_imp::home_dir() | |
| 645 | 645 | } |
| 646 | 646 | |
| 647 | 647 | /// Returns the path of a temporary directory. |
| ... | ... | @@ -701,7 +701,7 @@ pub fn home_dir() -> Option<PathBuf> { |
| 701 | 701 | #[doc(alias = "GetTempPath", alias = "GetTempPath2")] |
| 702 | 702 | #[stable(feature = "env", since = "1.0.0")] |
| 703 | 703 | pub fn temp_dir() -> PathBuf { |
| 704 | os_imp::temp_dir() | |
| 704 | paths_imp::temp_dir() | |
| 705 | 705 | } |
| 706 | 706 | |
| 707 | 707 | /// Returns the full filesystem path of the current running executable. |
| ... | ... | @@ -752,7 +752,7 @@ pub fn temp_dir() -> PathBuf { |
| 752 | 752 | /// ``` |
| 753 | 753 | #[stable(feature = "env", since = "1.0.0")] |
| 754 | 754 | pub fn current_exe() -> io::Result<PathBuf> { |
| 755 | os_imp::current_exe() | |
| 755 | paths_imp::current_exe() | |
| 756 | 756 | } |
| 757 | 757 | |
| 758 | 758 | /// 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 { |
| 815 | 815 | |
| 816 | 816 | /// Acquire an exclusive lock on the file. Blocks until the lock can be acquired. |
| 817 | 817 | /// |
| 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. | |
| 819 | 820 | /// |
| 820 | 821 | /// This lock may be advisory or mandatory. This lock is meant to interact with [`lock`], |
| 821 | 822 | /// [`try_lock`], [`lock_shared`], [`try_lock_shared`], and [`unlock`]. Its interactions with |
| ... | ... | @@ -868,8 +869,8 @@ impl File { |
| 868 | 869 | |
| 869 | 870 | /// Acquire a shared (non-exclusive) lock on the file. Blocks until the lock can be acquired. |
| 870 | 871 | /// |
| 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. | |
| 873 | 874 | /// |
| 874 | 875 | /// This lock may be advisory or mandatory. This lock is meant to interact with [`lock`], |
| 875 | 876 | /// [`try_lock`], [`lock_shared`], [`try_lock_shared`], and [`unlock`]. Its interactions with |
| ... | ... | @@ -923,7 +924,8 @@ impl File { |
| 923 | 924 | /// Returns `Err(TryLockError::WouldBlock)` if a different lock is already held on this file |
| 924 | 925 | /// (via another handle/descriptor). |
| 925 | 926 | /// |
| 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. | |
| 927 | 929 | /// |
| 928 | 930 | /// This lock may be advisory or mandatory. This lock is meant to interact with [`lock`], |
| 929 | 931 | /// [`try_lock`], [`lock_shared`], [`try_lock_shared`], and [`unlock`]. Its interactions with |
| ... | ... | @@ -987,8 +989,8 @@ impl File { |
| 987 | 989 | /// Returns `Err(TryLockError::WouldBlock)` if a different lock is already held on this file |
| 988 | 990 | /// (via another handle/descriptor). |
| 989 | 991 | /// |
| 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. | |
| 992 | 994 | /// |
| 993 | 995 | /// This lock may be advisory or mandatory. This lock is meant to interact with [`lock`], |
| 994 | 996 | /// [`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 { |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | /// 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. | |
| 141 | 143 | #[stable(feature = "open_options_ext", since = "1.10.0")] |
| 142 | 144 | pub trait OpenOptionsExt { |
| 143 | 145 | /// Overrides the `dwDesiredAccess` argument to the call to [`CreateFile`] |
| ... | ... | @@ -305,18 +307,6 @@ pub trait OpenOptionsExt { |
| 305 | 307 | /// https://docs.microsoft.com/en-us/windows/win32/api/winnt/ne-winnt-security_impersonation_level |
| 306 | 308 | #[stable(feature = "open_options_ext", since = "1.10.0")] |
| 307 | 309 | 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; | |
| 320 | 310 | } |
| 321 | 311 | |
| 322 | 312 | #[stable(feature = "open_options_ext", since = "1.10.0")] |
| ... | ... | @@ -345,7 +335,28 @@ impl OpenOptionsExt for OpenOptions { |
| 345 | 335 | self.as_inner_mut().security_qos_flags(flags); |
| 346 | 336 | self |
| 347 | 337 | } |
| 338 | } | |
| 339 | ||
| 340 | #[unstable(feature = "windows_freeze_file_times", issue = "149715")] | |
| 341 | pub 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")] | |
| 356 | impl Sealed for OpenOptions {} | |
| 348 | 357 | |
| 358 | #[unstable(feature = "windows_freeze_file_times", issue = "149715")] | |
| 359 | impl OpenOptionsExt2 for OpenOptions { | |
| 349 | 360 | fn freeze_last_access_time(&mut self, freeze: bool) -> &mut Self { |
| 350 | 361 | self.as_inner_mut().freeze_last_access_time(freeze); |
| 351 | 362 | self |
library/std/src/sys/args/windows.rs+1-1| ... | ... | @@ -12,9 +12,9 @@ use crate::num::NonZero; |
| 12 | 12 | use crate::os::windows::prelude::*; |
| 13 | 13 | use crate::path::{Path, PathBuf}; |
| 14 | 14 | use crate::sys::helpers::WStrUnits; |
| 15 | use crate::sys::pal::os::current_exe; | |
| 16 | 15 | use crate::sys::pal::{ensure_no_nuls, fill_utf16_buf}; |
| 17 | 16 | use crate::sys::path::get_long_path; |
| 17 | use crate::sys::paths::current_exe; | |
| 18 | 18 | use crate::sys::{AsInner, c, to_u16s}; |
| 19 | 19 | use crate::{io, iter, ptr}; |
| 20 | 20 |
library/std/src/sys/env/unix.rs+18-1| ... | ... | @@ -38,8 +38,25 @@ pub unsafe fn environ() -> *mut *const *const c_char { |
| 38 | 38 | unsafe { libc::_NSGetEnviron() as *mut *const *const c_char } |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | // On FreeBSD, environ comes from CRT rather than libc | |
| 42 | #[cfg(target_os = "freebsd")] | |
| 43 | pub 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 | ||
| 41 | 58 | // 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")))] | |
| 43 | 60 | pub unsafe fn environ() -> *mut *const *const c_char { |
| 44 | 61 | unsafe extern "C" { |
| 45 | 62 | static mut environ: *const *const c_char; |
library/std/src/sys/io/error/windows.rs+3| ... | ... | @@ -1,6 +1,9 @@ |
| 1 | 1 | use crate::sys::pal::{api, c}; |
| 2 | 2 | use crate::{io, ptr}; |
| 3 | 3 | |
| 4 | #[cfg(test)] | |
| 5 | mod tests; | |
| 6 | ||
| 4 | 7 | pub fn errno() -> i32 { |
| 5 | 8 | api::get_last_error().code as i32 |
| 6 | 9 | } |
library/std/src/sys/io/error/windows/tests.rs created+13| ... | ... | @@ -0,0 +1,13 @@ |
| 1 | use crate::io::Error; | |
| 2 | use crate::sys::pal::c; | |
| 3 | ||
| 4 | // tests `error_string` above | |
| 5 | #[test] | |
| 6 | fn 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; |
| 18 | 18 | pub mod net; |
| 19 | 19 | pub mod os_str; |
| 20 | 20 | pub mod path; |
| 21 | pub mod paths; | |
| 21 | 22 | pub mod pipe; |
| 22 | 23 | pub mod platform_version; |
| 23 | 24 | pub mod process; |
library/std/src/sys/pal/hermit/mod.rs-1| ... | ... | @@ -22,7 +22,6 @@ use crate::os::raw::c_char; |
| 22 | 22 | use crate::sys::env; |
| 23 | 23 | |
| 24 | 24 | pub mod futex; |
| 25 | pub mod os; | |
| 26 | 25 | pub mod time; |
| 27 | 26 | |
| 28 | 27 | pub fn unsupported<T>() -> io::Result<T> { |
library/std/src/sys/pal/hermit/os.rs deleted-57| ... | ... | @@ -1,57 +0,0 @@ |
| 1 | use crate::ffi::{OsStr, OsString}; | |
| 2 | use crate::marker::PhantomData; | |
| 3 | use crate::path::{self, PathBuf}; | |
| 4 | use crate::sys::unsupported; | |
| 5 | use crate::{fmt, io}; | |
| 6 | ||
| 7 | pub fn getcwd() -> io::Result<PathBuf> { | |
| 8 | Ok(PathBuf::from("/")) | |
| 9 | } | |
| 10 | ||
| 11 | pub fn chdir(_: &path::Path) -> io::Result<()> { | |
| 12 | unsupported() | |
| 13 | } | |
| 14 | ||
| 15 | pub struct SplitPaths<'a>(!, PhantomData<&'a ()>); | |
| 16 | ||
| 17 | pub fn split_paths(_unparsed: &OsStr) -> SplitPaths<'_> { | |
| 18 | panic!("unsupported") | |
| 19 | } | |
| 20 | ||
| 21 | impl<'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)] | |
| 29 | pub struct JoinPathsError; | |
| 30 | ||
| 31 | pub fn join_paths<I, T>(_paths: I) -> Result<OsString, JoinPathsError> | |
| 32 | where | |
| 33 | I: Iterator<Item = T>, | |
| 34 | T: AsRef<OsStr>, | |
| 35 | { | |
| 36 | Err(JoinPathsError) | |
| 37 | } | |
| 38 | ||
| 39 | impl 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 | ||
| 45 | impl crate::error::Error for JoinPathsError {} | |
| 46 | ||
| 47 | pub fn current_exe() -> io::Result<PathBuf> { | |
| 48 | unsupported() | |
| 49 | } | |
| 50 | ||
| 51 | pub fn temp_dir() -> PathBuf { | |
| 52 | PathBuf::from("/tmp") | |
| 53 | } | |
| 54 | ||
| 55 | pub fn home_dir() -> Option<PathBuf> { | |
| 56 | None | |
| 57 | } |
library/std/src/sys/pal/motor/mod.rs-2| ... | ... | @@ -1,7 +1,5 @@ |
| 1 | 1 | #![allow(unsafe_op_in_unsafe_fn)] |
| 2 | 2 | |
| 3 | pub mod os; | |
| 4 | ||
| 5 | 3 | pub use moto_rt::futex; |
| 6 | 4 | |
| 7 | 5 | use crate::io; |
library/std/src/sys/pal/motor/os.rs deleted-64| ... | ... | @@ -1,64 +0,0 @@ |
| 1 | use super::map_motor_error; | |
| 2 | use crate::error::Error as StdError; | |
| 3 | use crate::ffi::{OsStr, OsString}; | |
| 4 | use crate::marker::PhantomData; | |
| 5 | use crate::os::motor::ffi::OsStrExt; | |
| 6 | use crate::path::{self, PathBuf}; | |
| 7 | use crate::{fmt, io}; | |
| 8 | ||
| 9 | pub fn getcwd() -> io::Result<PathBuf> { | |
| 10 | moto_rt::fs::getcwd().map(PathBuf::from).map_err(map_motor_error) | |
| 11 | } | |
| 12 | ||
| 13 | pub 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 | ||
| 17 | pub struct SplitPaths<'a>(!, PhantomData<&'a ()>); | |
| 18 | ||
| 19 | pub fn split_paths(_unparsed: &OsStr) -> SplitPaths<'_> { | |
| 20 | panic!("unsupported") | |
| 21 | } | |
| 22 | ||
| 23 | impl<'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)] | |
| 31 | pub struct JoinPathsError; | |
| 32 | ||
| 33 | pub fn join_paths<I, T>(_paths: I) -> Result<OsString, JoinPathsError> | |
| 34 | where | |
| 35 | I: Iterator<Item = T>, | |
| 36 | T: AsRef<OsStr>, | |
| 37 | { | |
| 38 | Err(JoinPathsError) | |
| 39 | } | |
| 40 | ||
| 41 | impl 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 | ||
| 47 | impl StdError for JoinPathsError { | |
| 48 | #[allow(deprecated)] | |
| 49 | fn description(&self) -> &str { | |
| 50 | "not supported on this platform yet" | |
| 51 | } | |
| 52 | } | |
| 53 | ||
| 54 | pub fn current_exe() -> io::Result<PathBuf> { | |
| 55 | moto_rt::process::current_exe().map(PathBuf::from).map_err(map_motor_error) | |
| 56 | } | |
| 57 | ||
| 58 | pub fn temp_dir() -> PathBuf { | |
| 59 | PathBuf::from(moto_rt::fs::TEMP_DIR) | |
| 60 | } | |
| 61 | ||
| 62 | pub 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}; |
| 10 | 10 | |
| 11 | 11 | pub mod abi; |
| 12 | 12 | mod libunwind_integration; |
| 13 | pub mod os; | |
| 14 | 13 | pub mod thread_parking; |
| 15 | 14 | pub mod waitqueue; |
| 16 | 15 |
library/std/src/sys/pal/sgx/os.rs deleted-57| ... | ... | @@ -1,57 +0,0 @@ |
| 1 | use crate::ffi::{OsStr, OsString}; | |
| 2 | use crate::marker::PhantomData; | |
| 3 | use crate::path::{self, PathBuf}; | |
| 4 | use crate::sys::{sgx_ineffective, unsupported}; | |
| 5 | use crate::{fmt, io}; | |
| 6 | ||
| 7 | pub fn getcwd() -> io::Result<PathBuf> { | |
| 8 | unsupported() | |
| 9 | } | |
| 10 | ||
| 11 | pub fn chdir(_: &path::Path) -> io::Result<()> { | |
| 12 | sgx_ineffective(()) | |
| 13 | } | |
| 14 | ||
| 15 | pub struct SplitPaths<'a>(!, PhantomData<&'a ()>); | |
| 16 | ||
| 17 | pub fn split_paths(_unparsed: &OsStr) -> SplitPaths<'_> { | |
| 18 | panic!("unsupported") | |
| 19 | } | |
| 20 | ||
| 21 | impl<'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)] | |
| 29 | pub struct JoinPathsError; | |
| 30 | ||
| 31 | pub fn join_paths<I, T>(_paths: I) -> Result<OsString, JoinPathsError> | |
| 32 | where | |
| 33 | I: Iterator<Item = T>, | |
| 34 | T: AsRef<OsStr>, | |
| 35 | { | |
| 36 | Err(JoinPathsError) | |
| 37 | } | |
| 38 | ||
| 39 | impl 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 | ||
| 45 | impl crate::error::Error for JoinPathsError {} | |
| 46 | ||
| 47 | pub fn current_exe() -> io::Result<PathBuf> { | |
| 48 | unsupported() | |
| 49 | } | |
| 50 | ||
| 51 | pub fn temp_dir() -> PathBuf { | |
| 52 | panic!("no filesystem in SGX") | |
| 53 | } | |
| 54 | ||
| 55 | pub fn home_dir() -> Option<PathBuf> { | |
| 56 | None | |
| 57 | } |
library/std/src/sys/pal/solid/mod.rs-1| ... | ... | @@ -19,7 +19,6 @@ pub mod itron { |
| 19 | 19 | // `error` is `pub(crate)` so that it can be accessed by `itron/error.rs` as |
| 20 | 20 | // `crate::sys::error` |
| 21 | 21 | pub(crate) mod error; |
| 22 | pub mod os; | |
| 23 | 22 | pub use self::itron::thread_parking; |
| 24 | 23 | |
| 25 | 24 | // SAFETY: must be called only once during runtime initialization. |
library/std/src/sys/pal/solid/os.rs deleted-56| ... | ... | @@ -1,56 +0,0 @@ |
| 1 | use super::unsupported; | |
| 2 | use crate::ffi::{OsStr, OsString}; | |
| 3 | use crate::path::{self, PathBuf}; | |
| 4 | use crate::{fmt, io}; | |
| 5 | ||
| 6 | pub fn getcwd() -> io::Result<PathBuf> { | |
| 7 | unsupported() | |
| 8 | } | |
| 9 | ||
| 10 | pub fn chdir(_: &path::Path) -> io::Result<()> { | |
| 11 | unsupported() | |
| 12 | } | |
| 13 | ||
| 14 | pub struct SplitPaths<'a>(&'a !); | |
| 15 | ||
| 16 | pub fn split_paths(_unparsed: &OsStr) -> SplitPaths<'_> { | |
| 17 | panic!("unsupported") | |
| 18 | } | |
| 19 | ||
| 20 | impl<'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)] | |
| 28 | pub struct JoinPathsError; | |
| 29 | ||
| 30 | pub fn join_paths<I, T>(_paths: I) -> Result<OsString, JoinPathsError> | |
| 31 | where | |
| 32 | I: Iterator<Item = T>, | |
| 33 | T: AsRef<OsStr>, | |
| 34 | { | |
| 35 | Err(JoinPathsError) | |
| 36 | } | |
| 37 | ||
| 38 | impl 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 | ||
| 44 | impl crate::error::Error for JoinPathsError {} | |
| 45 | ||
| 46 | pub fn current_exe() -> io::Result<PathBuf> { | |
| 47 | unsupported() | |
| 48 | } | |
| 49 | ||
| 50 | pub fn temp_dir() -> PathBuf { | |
| 51 | panic!("no standard temporary directory on this platform") | |
| 52 | } | |
| 53 | ||
| 54 | pub fn home_dir() -> Option<PathBuf> { | |
| 55 | None | |
| 56 | } |
library/std/src/sys/pal/teeos/mod.rs-1| ... | ... | @@ -7,7 +7,6 @@ |
| 7 | 7 | #![allow(dead_code)] |
| 8 | 8 | |
| 9 | 9 | pub mod conf; |
| 10 | pub mod os; | |
| 11 | 10 | #[path = "../unix/time.rs"] |
| 12 | 11 | pub mod time; |
| 13 | 12 |
library/std/src/sys/pal/teeos/os.rs deleted-62| ... | ... | @@ -1,62 +0,0 @@ |
| 1 | //! Implementation of `std::os` functionality for teeos | |
| 2 | ||
| 3 | use core::marker::PhantomData; | |
| 4 | ||
| 5 | use super::unsupported; | |
| 6 | use crate::ffi::{OsStr, OsString}; | |
| 7 | use crate::path::PathBuf; | |
| 8 | use crate::{fmt, io, path}; | |
| 9 | ||
| 10 | // Everything below are stubs and copied from unsupported.rs | |
| 11 | ||
| 12 | pub fn getcwd() -> io::Result<PathBuf> { | |
| 13 | unsupported() | |
| 14 | } | |
| 15 | ||
| 16 | pub fn chdir(_: &path::Path) -> io::Result<()> { | |
| 17 | unsupported() | |
| 18 | } | |
| 19 | ||
| 20 | pub struct SplitPaths<'a>(!, PhantomData<&'a ()>); | |
| 21 | ||
| 22 | pub fn split_paths(_unparsed: &OsStr) -> SplitPaths<'_> { | |
| 23 | panic!("unsupported") | |
| 24 | } | |
| 25 | ||
| 26 | impl<'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)] | |
| 34 | pub struct JoinPathsError; | |
| 35 | ||
| 36 | pub fn join_paths<I, T>(_paths: I) -> Result<OsString, JoinPathsError> | |
| 37 | where | |
| 38 | I: Iterator<Item = T>, | |
| 39 | T: AsRef<OsStr>, | |
| 40 | { | |
| 41 | Err(JoinPathsError) | |
| 42 | } | |
| 43 | ||
| 44 | impl 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 | ||
| 50 | impl crate::error::Error for JoinPathsError {} | |
| 51 | ||
| 52 | pub fn current_exe() -> io::Result<PathBuf> { | |
| 53 | unsupported() | |
| 54 | } | |
| 55 | ||
| 56 | pub fn temp_dir() -> PathBuf { | |
| 57 | panic!("no filesystem on this platform") | |
| 58 | } | |
| 59 | ||
| 60 | pub fn home_dir() -> Option<PathBuf> { | |
| 61 | None | |
| 62 | } |
library/std/src/sys/pal/trusty/mod.rs-2| ... | ... | @@ -3,7 +3,5 @@ |
| 3 | 3 | #[path = "../unsupported/common.rs"] |
| 4 | 4 | #[deny(unsafe_op_in_unsafe_fn)] |
| 5 | 5 | mod common; |
| 6 | #[path = "../unsupported/os.rs"] | |
| 7 | pub mod os; | |
| 8 | 6 | |
| 9 | 7 | pub use common::*; |
library/std/src/sys/pal/uefi/mod.rs-1| ... | ... | @@ -14,7 +14,6 @@ |
| 14 | 14 | #![forbid(unsafe_op_in_unsafe_fn)] |
| 15 | 15 | |
| 16 | 16 | pub mod helpers; |
| 17 | pub mod os; | |
| 18 | 17 | pub mod system_time; |
| 19 | 18 | |
| 20 | 19 | #[cfg(test)] |
library/std/src/sys/pal/uefi/os.rs deleted-123| ... | ... | @@ -1,123 +0,0 @@ |
| 1 | use r_efi::efi::protocols::{device_path, loaded_image_device_path}; | |
| 2 | ||
| 3 | use super::{helpers, unsupported_err}; | |
| 4 | use crate::ffi::{OsStr, OsString}; | |
| 5 | use crate::os::uefi::ffi::{OsStrExt, OsStringExt}; | |
| 6 | use crate::path::{self, PathBuf}; | |
| 7 | use crate::{fmt, io}; | |
| 8 | ||
| 9 | const PATHS_SEP: u16 = b';' as u16; | |
| 10 | ||
| 11 | pub 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 | ||
| 30 | pub 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 | ||
| 40 | pub struct SplitPaths<'a> { | |
| 41 | data: crate::os::uefi::ffi::EncodeWide<'a>, | |
| 42 | must_yield: bool, | |
| 43 | } | |
| 44 | ||
| 45 | pub fn split_paths(unparsed: &OsStr) -> SplitPaths<'_> { | |
| 46 | SplitPaths { data: unparsed.encode_wide(), must_yield: true } | |
| 47 | } | |
| 48 | ||
| 49 | impl<'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)] | |
| 75 | pub 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). | |
| 79 | pub fn join_paths<I, T>(paths: I) -> Result<OsString, JoinPathsError> | |
| 80 | where | |
| 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 | ||
| 102 | impl fmt::Display for JoinPathsError { | |
| 103 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | |
| 104 | "path segment contains `;`".fmt(f) | |
| 105 | } | |
| 106 | } | |
| 107 | ||
| 108 | impl crate::error::Error for JoinPathsError {} | |
| 109 | ||
| 110 | pub 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 | ||
| 117 | pub fn temp_dir() -> PathBuf { | |
| 118 | panic!("no filesystem on this platform") | |
| 119 | } | |
| 120 | ||
| 121 | pub fn home_dir() -> Option<PathBuf> { | |
| 122 | None | |
| 123 | } |
library/std/src/sys/pal/unix/mod.rs-1| ... | ... | @@ -8,7 +8,6 @@ pub mod fuchsia; |
| 8 | 8 | pub mod futex; |
| 9 | 9 | #[cfg(target_os = "linux")] |
| 10 | 10 | pub mod linux; |
| 11 | pub mod os; | |
| 12 | 11 | pub mod stack_overflow; |
| 13 | 12 | pub mod sync; |
| 14 | 13 | pub 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 | ||
| 5 | use libc::{c_char, c_int, c_void}; | |
| 6 | ||
| 7 | use crate::ffi::{CStr, OsStr, OsString}; | |
| 8 | use crate::os::unix::prelude::*; | |
| 9 | use crate::path::{self, PathBuf}; | |
| 10 | use crate::sys::cvt; | |
| 11 | use crate::sys::helpers::run_path_with_cstr; | |
| 12 | use crate::{fmt, io, iter, mem, ptr, slice, str}; | |
| 13 | ||
| 14 | const PATH_SEPARATOR: u8 = b':'; | |
| 15 | ||
| 16 | #[cfg(target_os = "espidf")] | |
| 17 | pub fn getcwd() -> io::Result<PathBuf> { | |
| 18 | Ok(PathBuf::from("/")) | |
| 19 | } | |
| 20 | ||
| 21 | #[cfg(not(target_os = "espidf"))] | |
| 22 | pub 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")] | |
| 49 | pub fn chdir(_p: &path::Path) -> io::Result<()> { | |
| 50 | super::unsupported::unsupported() | |
| 51 | } | |
| 52 | ||
| 53 | #[cfg(not(target_os = "espidf"))] | |
| 54 | pub 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). | |
| 61 | pub 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)] | |
| 67 | pub 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)] | |
| 80 | pub struct JoinPathsError; | |
| 81 | ||
| 82 | pub fn join_paths<I, T>(paths: I) -> Result<OsString, JoinPathsError> | |
| 83 | where | |
| 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 | ||
| 102 | impl 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 | ||
| 108 | impl crate::error::Error for JoinPathsError {} | |
| 109 | ||
| 110 | #[cfg(target_os = "aix")] | |
| 111 | pub 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"))] | |
| 149 | pub 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")] | |
| 187 | pub 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")] | |
| 233 | pub 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 | ))] | |
| 262 | pub 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")] | |
| 273 | pub 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")] | |
| 284 | pub 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"))] | |
| 304 | pub 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")] | |
| 325 | pub 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")] | |
| 346 | pub 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")] | |
| 351 | pub fn current_exe() -> io::Result<PathBuf> { | |
| 352 | crate::fs::read_to_string("sys:exe").map(PathBuf::from) | |
| 353 | } | |
| 354 | ||
| 355 | #[cfg(target_os = "l4re")] | |
| 356 | pub fn current_exe() -> io::Result<PathBuf> { | |
| 357 | Err(io::const_error!(io::ErrorKind::Unsupported, "not yet implemented!")) | |
| 358 | } | |
| 359 | ||
| 360 | #[cfg(target_os = "vxworks")] | |
| 361 | pub 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"))] | |
| 374 | pub fn current_exe() -> io::Result<PathBuf> { | |
| 375 | super::unsupported::unsupported() | |
| 376 | } | |
| 377 | ||
| 378 | #[cfg(target_os = "fuchsia")] | |
| 379 | pub 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)))] | |
| 397 | fn 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 | ||
| 407 | pub 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 | ||
| 417 | pub 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 { |
| 429 | 429 | |
| 430 | 430 | #[forbid(unsafe_op_in_unsafe_fn)] |
| 431 | 431 | 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 | } | |
| 432 | 437 | // Linux doesn't allocate the whole stack right away, and |
| 433 | 438 | // the kernel has its own stack-guard mechanism to fault |
| 434 | 439 | // when growing too close to an existing mapping. If we map |
| ... | ... | @@ -456,6 +461,10 @@ mod imp { |
| 456 | 461 | #[forbid(unsafe_op_in_unsafe_fn)] |
| 457 | 462 | #[cfg(target_os = "freebsd")] |
| 458 | 463 | 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 | } | |
| 459 | 468 | // FreeBSD's stack autogrows, and optionally includes a guard page |
| 460 | 469 | // at the bottom. If we try to remap the bottom of the stack |
| 461 | 470 | // ourselves, FreeBSD's guard page moves upwards. So we'll just use |
| ... | ... | @@ -489,6 +498,10 @@ mod imp { |
| 489 | 498 | |
| 490 | 499 | #[forbid(unsafe_op_in_unsafe_fn)] |
| 491 | 500 | 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 | } | |
| 492 | 505 | // OpenBSD stack already includes a guard page, and stack is |
| 493 | 506 | // immutable. |
| 494 | 507 | // NetBSD stack includes the guard page. |
library/std/src/sys/pal/unsupported/mod.rs-2| ... | ... | @@ -1,6 +1,4 @@ |
| 1 | 1 | #![deny(unsafe_op_in_unsafe_fn)] |
| 2 | 2 | |
| 3 | pub mod os; | |
| 4 | ||
| 5 | 3 | mod common; |
| 6 | 4 | pub use common::*; |
library/std/src/sys/pal/unsupported/os.rs deleted-57| ... | ... | @@ -1,57 +0,0 @@ |
| 1 | use super::unsupported; | |
| 2 | use crate::ffi::{OsStr, OsString}; | |
| 3 | use crate::marker::PhantomData; | |
| 4 | use crate::path::{self, PathBuf}; | |
| 5 | use crate::{fmt, io}; | |
| 6 | ||
| 7 | pub fn getcwd() -> io::Result<PathBuf> { | |
| 8 | unsupported() | |
| 9 | } | |
| 10 | ||
| 11 | pub fn chdir(_: &path::Path) -> io::Result<()> { | |
| 12 | unsupported() | |
| 13 | } | |
| 14 | ||
| 15 | pub struct SplitPaths<'a>(!, PhantomData<&'a ()>); | |
| 16 | ||
| 17 | pub fn split_paths(_unparsed: &OsStr) -> SplitPaths<'_> { | |
| 18 | panic!("unsupported") | |
| 19 | } | |
| 20 | ||
| 21 | impl<'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)] | |
| 29 | pub struct JoinPathsError; | |
| 30 | ||
| 31 | pub fn join_paths<I, T>(_paths: I) -> Result<OsString, JoinPathsError> | |
| 32 | where | |
| 33 | I: Iterator<Item = T>, | |
| 34 | T: AsRef<OsStr>, | |
| 35 | { | |
| 36 | Err(JoinPathsError) | |
| 37 | } | |
| 38 | ||
| 39 | impl 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 | ||
| 45 | impl crate::error::Error for JoinPathsError {} | |
| 46 | ||
| 47 | pub fn current_exe() -> io::Result<PathBuf> { | |
| 48 | unsupported() | |
| 49 | } | |
| 50 | ||
| 51 | pub fn temp_dir() -> PathBuf { | |
| 52 | panic!("no filesystem on this platform") | |
| 53 | } | |
| 54 | ||
| 55 | pub 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"] | |
| 2 | pub mod os; | |
| 3 | ||
| 4 | 1 | #[expect(dead_code)] |
| 5 | 2 | #[path = "../unsupported/common.rs"] |
| 6 | 3 | mod unsupported_common; |
library/std/src/sys/pal/wasi/mod.rs-1| ... | ... | @@ -10,7 +10,6 @@ pub mod conf; |
| 10 | 10 | #[allow(unused)] |
| 11 | 11 | #[path = "../wasm/atomics/futex.rs"] |
| 12 | 12 | pub mod futex; |
| 13 | pub mod os; | |
| 14 | 13 | pub mod stack_overflow; |
| 15 | 14 | #[path = "../unix/time.rs"] |
| 16 | 15 | pub mod time; |
library/std/src/sys/pal/wasi/os.rs deleted-87| ... | ... | @@ -1,87 +0,0 @@ |
| 1 | #![forbid(unsafe_op_in_unsafe_fn)] | |
| 2 | ||
| 3 | use crate::ffi::{CStr, OsStr, OsString}; | |
| 4 | use crate::marker::PhantomData; | |
| 5 | use crate::os::wasi::prelude::*; | |
| 6 | use crate::path::{self, PathBuf}; | |
| 7 | use crate::sys::helpers::run_path_with_cstr; | |
| 8 | use crate::sys::unsupported; | |
| 9 | use crate::{fmt, io}; | |
| 10 | ||
| 11 | pub 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 | ||
| 37 | pub 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 | ||
| 45 | pub struct SplitPaths<'a>(!, PhantomData<&'a ()>); | |
| 46 | ||
| 47 | pub fn split_paths(_unparsed: &OsStr) -> SplitPaths<'_> { | |
| 48 | panic!("unsupported") | |
| 49 | } | |
| 50 | ||
| 51 | impl<'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)] | |
| 59 | pub struct JoinPathsError; | |
| 60 | ||
| 61 | pub fn join_paths<I, T>(_paths: I) -> Result<OsString, JoinPathsError> | |
| 62 | where | |
| 63 | I: Iterator<Item = T>, | |
| 64 | T: AsRef<OsStr>, | |
| 65 | { | |
| 66 | Err(JoinPathsError) | |
| 67 | } | |
| 68 | ||
| 69 | impl 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 | ||
| 75 | impl crate::error::Error for JoinPathsError {} | |
| 76 | ||
| 77 | pub fn current_exe() -> io::Result<PathBuf> { | |
| 78 | unsupported() | |
| 79 | } | |
| 80 | ||
| 81 | pub fn temp_dir() -> PathBuf { | |
| 82 | panic!("no filesystem on wasm") | |
| 83 | } | |
| 84 | ||
| 85 | pub fn home_dir() -> Option<PathBuf> { | |
| 86 | None | |
| 87 | } |
library/std/src/sys/pal/wasm/mod.rs-3| ... | ... | @@ -16,9 +16,6 @@ |
| 16 | 16 | |
| 17 | 17 | #![deny(unsafe_op_in_unsafe_fn)] |
| 18 | 18 | |
| 19 | #[path = "../unsupported/os.rs"] | |
| 20 | pub mod os; | |
| 21 | ||
| 22 | 19 | #[cfg(target_feature = "atomics")] |
| 23 | 20 | #[path = "atomics/futex.rs"] |
| 24 | 21 | pub mod futex; |
library/std/src/sys/pal/windows/mod.rs-1| ... | ... | @@ -18,7 +18,6 @@ pub mod c; |
| 18 | 18 | #[cfg(not(target_vendor = "win7"))] |
| 19 | 19 | pub mod futex; |
| 20 | 20 | pub mod handle; |
| 21 | pub mod os; | |
| 22 | 21 | pub mod time; |
| 23 | 22 | cfg_select! { |
| 24 | 23 | // 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)] | |
| 6 | mod tests; | |
| 7 | ||
| 8 | use super::api; | |
| 9 | #[cfg(not(target_vendor = "uwp"))] | |
| 10 | use super::api::WinError; | |
| 11 | use crate::ffi::{OsStr, OsString}; | |
| 12 | use crate::os::windows::ffi::EncodeWide; | |
| 13 | use crate::os::windows::prelude::*; | |
| 14 | use crate::path::{self, PathBuf}; | |
| 15 | use crate::sys::pal::{c, cvt}; | |
| 16 | use crate::{fmt, io, ptr}; | |
| 17 | ||
| 18 | pub struct SplitPaths<'a> { | |
| 19 | data: EncodeWide<'a>, | |
| 20 | must_yield: bool, | |
| 21 | } | |
| 22 | ||
| 23 | pub fn split_paths(unparsed: &OsStr) -> SplitPaths<'_> { | |
| 24 | SplitPaths { data: unparsed.encode_wide(), must_yield: true } | |
| 25 | } | |
| 26 | ||
| 27 | impl<'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)] | |
| 68 | pub struct JoinPathsError; | |
| 69 | ||
| 70 | pub fn join_paths<I, T>(paths: I) -> Result<OsString, JoinPathsError> | |
| 71 | where | |
| 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 | ||
| 98 | impl fmt::Display for JoinPathsError { | |
| 99 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | |
| 100 | "path segment contains `\"`".fmt(f) | |
| 101 | } | |
| 102 | } | |
| 103 | ||
| 104 | impl crate::error::Error for JoinPathsError {} | |
| 105 | ||
| 106 | pub 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 | ||
| 113 | pub fn getcwd() -> io::Result<PathBuf> { | |
| 114 | super::fill_utf16_buf(|buf, sz| unsafe { c::GetCurrentDirectoryW(sz, buf) }, super::os2path) | |
| 115 | } | |
| 116 | ||
| 117 | pub 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 | ||
| 125 | pub 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")))] | |
| 130 | fn 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")] | |
| 156 | fn 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")] | |
| 181 | fn home_dir_crt() -> Option<PathBuf> { | |
| 182 | None | |
| 183 | } | |
| 184 | ||
| 185 | pub 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 @@ |
| 1 | use crate::io::Error; | |
| 2 | use crate::sys::c; | |
| 3 | ||
| 4 | // tests `error_string` above | |
| 5 | #[test] | |
| 6 | fn 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 @@ |
| 1 | 1 | #![forbid(unsafe_op_in_unsafe_fn)] |
| 2 | 2 | |
| 3 | pub mod os; | |
| 4 | 3 | pub mod params; |
| 5 | 4 | |
| 6 | 5 | #[path = "../unsupported/common.rs"] |
library/std/src/sys/pal/xous/os.rs deleted-57| ... | ... | @@ -1,57 +0,0 @@ |
| 1 | use super::unsupported; | |
| 2 | use crate::ffi::{OsStr, OsString}; | |
| 3 | use crate::marker::PhantomData; | |
| 4 | use crate::path::{self, PathBuf}; | |
| 5 | use crate::{fmt, io}; | |
| 6 | ||
| 7 | pub fn getcwd() -> io::Result<PathBuf> { | |
| 8 | unsupported() | |
| 9 | } | |
| 10 | ||
| 11 | pub fn chdir(_: &path::Path) -> io::Result<()> { | |
| 12 | unsupported() | |
| 13 | } | |
| 14 | ||
| 15 | pub struct SplitPaths<'a>(!, PhantomData<&'a ()>); | |
| 16 | ||
| 17 | pub fn split_paths(_unparsed: &OsStr) -> SplitPaths<'_> { | |
| 18 | panic!("unsupported") | |
| 19 | } | |
| 20 | ||
| 21 | impl<'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)] | |
| 29 | pub struct JoinPathsError; | |
| 30 | ||
| 31 | pub fn join_paths<I, T>(_paths: I) -> Result<OsString, JoinPathsError> | |
| 32 | where | |
| 33 | I: Iterator<Item = T>, | |
| 34 | T: AsRef<OsStr>, | |
| 35 | { | |
| 36 | Err(JoinPathsError) | |
| 37 | } | |
| 38 | ||
| 39 | impl 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 | ||
| 45 | impl crate::error::Error for JoinPathsError {} | |
| 46 | ||
| 47 | pub fn current_exe() -> io::Result<PathBuf> { | |
| 48 | unsupported() | |
| 49 | } | |
| 50 | ||
| 51 | pub fn temp_dir() -> PathBuf { | |
| 52 | panic!("no filesystem on this platform") | |
| 53 | } | |
| 54 | ||
| 55 | pub fn home_dir() -> Option<PathBuf> { | |
| 56 | None | |
| 57 | } |
library/std/src/sys/pal/zkvm/mod.rs-1| ... | ... | @@ -11,7 +11,6 @@ |
| 11 | 11 | pub const WORD_SIZE: usize = size_of::<u32>(); |
| 12 | 12 | |
| 13 | 13 | pub mod abi; |
| 14 | pub mod os; | |
| 15 | 14 | |
| 16 | 15 | use crate::io as std_io; |
| 17 | 16 |
library/std/src/sys/pal/zkvm/os.rs deleted-57| ... | ... | @@ -1,57 +0,0 @@ |
| 1 | use super::unsupported; | |
| 2 | use crate::ffi::{OsStr, OsString}; | |
| 3 | use crate::marker::PhantomData; | |
| 4 | use crate::path::{self, PathBuf}; | |
| 5 | use crate::{fmt, io}; | |
| 6 | ||
| 7 | pub fn getcwd() -> io::Result<PathBuf> { | |
| 8 | unsupported() | |
| 9 | } | |
| 10 | ||
| 11 | pub fn chdir(_: &path::Path) -> io::Result<()> { | |
| 12 | unsupported() | |
| 13 | } | |
| 14 | ||
| 15 | pub struct SplitPaths<'a>(!, PhantomData<&'a ()>); | |
| 16 | ||
| 17 | pub fn split_paths(_unparsed: &OsStr) -> SplitPaths<'_> { | |
| 18 | panic!("unsupported") | |
| 19 | } | |
| 20 | ||
| 21 | impl<'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)] | |
| 29 | pub struct JoinPathsError; | |
| 30 | ||
| 31 | pub fn join_paths<I, T>(_paths: I) -> Result<OsString, JoinPathsError> | |
| 32 | where | |
| 33 | I: Iterator<Item = T>, | |
| 34 | T: AsRef<OsStr>, | |
| 35 | { | |
| 36 | Err(JoinPathsError) | |
| 37 | } | |
| 38 | ||
| 39 | impl 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 | ||
| 45 | impl crate::error::Error for JoinPathsError {} | |
| 46 | ||
| 47 | pub fn current_exe() -> io::Result<PathBuf> { | |
| 48 | unsupported() | |
| 49 | } | |
| 50 | ||
| 51 | pub fn temp_dir() -> PathBuf { | |
| 52 | panic!("no filesystem on this platform") | |
| 53 | } | |
| 54 | ||
| 55 | pub fn home_dir() -> Option<PathBuf> { | |
| 56 | None | |
| 57 | } |
library/std/src/sys/paths/hermit.rs created+10| ... | ... | @@ -0,0 +1,10 @@ |
| 1 | use crate::io; | |
| 2 | use crate::path::PathBuf; | |
| 3 | ||
| 4 | pub fn getcwd() -> io::Result<PathBuf> { | |
| 5 | Ok(PathBuf::from("/")) | |
| 6 | } | |
| 7 | ||
| 8 | pub fn temp_dir() -> PathBuf { | |
| 9 | PathBuf::from("/tmp") | |
| 10 | } |
library/std/src/sys/paths/mod.rs created+59| ... | ... | @@ -0,0 +1,59 @@ |
| 1 | cfg_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 | ||
| 56 | pub 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 @@ |
| 1 | use crate::io; | |
| 2 | use crate::os::motor::ffi::OsStrExt; | |
| 3 | use crate::path::{self, PathBuf}; | |
| 4 | use crate::sys::pal::map_motor_error; | |
| 5 | ||
| 6 | pub fn getcwd() -> io::Result<PathBuf> { | |
| 7 | moto_rt::fs::getcwd().map(PathBuf::from).map_err(map_motor_error) | |
| 8 | } | |
| 9 | ||
| 10 | pub 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 | ||
| 14 | pub fn current_exe() -> io::Result<PathBuf> { | |
| 15 | moto_rt::process::current_exe().map(PathBuf::from).map_err(map_motor_error) | |
| 16 | } | |
| 17 | ||
| 18 | pub 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 @@ |
| 1 | use crate::io; | |
| 2 | use crate::path::Path; | |
| 3 | use crate::sys::pal::sgx_ineffective; | |
| 4 | ||
| 5 | pub fn chdir(_: &Path) -> io::Result<()> { | |
| 6 | sgx_ineffective(()) | |
| 7 | } |
library/std/src/sys/paths/uefi.rs created+123| ... | ... | @@ -0,0 +1,123 @@ |
| 1 | use r_efi::efi::protocols::{device_path, loaded_image_device_path}; | |
| 2 | ||
| 3 | use crate::ffi::{OsStr, OsString}; | |
| 4 | use crate::os::uefi::ffi::{OsStrExt, OsStringExt}; | |
| 5 | use crate::path::{self, PathBuf}; | |
| 6 | use crate::sys::pal::{helpers, unsupported_err}; | |
| 7 | use crate::{fmt, io}; | |
| 8 | ||
| 9 | const PATHS_SEP: u16 = b';' as u16; | |
| 10 | ||
| 11 | pub 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 | ||
| 30 | pub 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 | ||
| 40 | pub struct SplitPaths<'a> { | |
| 41 | data: crate::os::uefi::ffi::EncodeWide<'a>, | |
| 42 | must_yield: bool, | |
| 43 | } | |
| 44 | ||
| 45 | pub fn split_paths(unparsed: &OsStr) -> SplitPaths<'_> { | |
| 46 | SplitPaths { data: unparsed.encode_wide(), must_yield: true } | |
| 47 | } | |
| 48 | ||
| 49 | impl<'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)] | |
| 75 | pub 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). | |
| 79 | pub fn join_paths<I, T>(paths: I) -> Result<OsString, JoinPathsError> | |
| 80 | where | |
| 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 | ||
| 102 | impl fmt::Display for JoinPathsError { | |
| 103 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | |
| 104 | "path segment contains `;`".fmt(f) | |
| 105 | } | |
| 106 | } | |
| 107 | ||
| 108 | impl crate::error::Error for JoinPathsError {} | |
| 109 | ||
| 110 | pub 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 | ||
| 117 | pub fn temp_dir() -> PathBuf { | |
| 118 | panic!("UEFI doesn't have a dedicated temp directory") | |
| 119 | } | |
| 120 | ||
| 121 | pub 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 | ||
| 5 | use libc::{c_char, c_int, c_void}; | |
| 6 | ||
| 7 | use crate::ffi::{CStr, OsStr, OsString}; | |
| 8 | use crate::os::unix::prelude::*; | |
| 9 | use crate::path::{self, PathBuf}; | |
| 10 | use crate::sys::helpers::run_path_with_cstr; | |
| 11 | use crate::sys::pal::cvt; | |
| 12 | use crate::{fmt, io, iter, mem, ptr, slice, str}; | |
| 13 | ||
| 14 | const PATH_SEPARATOR: u8 = b':'; | |
| 15 | ||
| 16 | #[cfg(target_os = "espidf")] | |
| 17 | pub fn getcwd() -> io::Result<PathBuf> { | |
| 18 | Ok(PathBuf::from("/")) | |
| 19 | } | |
| 20 | ||
| 21 | #[cfg(not(target_os = "espidf"))] | |
| 22 | pub 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")] | |
| 49 | pub fn chdir(_p: &path::Path) -> io::Result<()> { | |
| 50 | crate::sys::pal::unsupported::unsupported() | |
| 51 | } | |
| 52 | ||
| 53 | #[cfg(not(target_os = "espidf"))] | |
| 54 | pub 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). | |
| 61 | pub 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)] | |
| 67 | pub 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)] | |
| 80 | pub struct JoinPathsError; | |
| 81 | ||
| 82 | pub fn join_paths<I, T>(paths: I) -> Result<OsString, JoinPathsError> | |
| 83 | where | |
| 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 | ||
| 102 | impl 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 | ||
| 108 | impl crate::error::Error for JoinPathsError {} | |
| 109 | ||
| 110 | #[cfg(target_os = "aix")] | |
| 111 | pub 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"))] | |
| 149 | pub 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")] | |
| 187 | pub 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")] | |
| 233 | pub 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 | ))] | |
| 262 | pub 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")] | |
| 273 | pub 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")] | |
| 284 | pub 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"))] | |
| 304 | pub 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")] | |
| 325 | pub 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")] | |
| 346 | pub 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")] | |
| 351 | pub fn current_exe() -> io::Result<PathBuf> { | |
| 352 | crate::fs::read_to_string("sys:exe").map(PathBuf::from) | |
| 353 | } | |
| 354 | ||
| 355 | #[cfg(target_os = "l4re")] | |
| 356 | pub fn current_exe() -> io::Result<PathBuf> { | |
| 357 | Err(io::const_error!(io::ErrorKind::Unsupported, "not yet implemented!")) | |
| 358 | } | |
| 359 | ||
| 360 | #[cfg(target_os = "vxworks")] | |
| 361 | pub 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"))] | |
| 374 | pub fn current_exe() -> io::Result<PathBuf> { | |
| 375 | crate::sys::pal::unsupported::unsupported() | |
| 376 | } | |
| 377 | ||
| 378 | #[cfg(target_os = "fuchsia")] | |
| 379 | pub 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)))] | |
| 397 | fn 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 | ||
| 407 | pub 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 | ||
| 417 | pub 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 @@ |
| 1 | use crate::ffi::{OsStr, OsString}; | |
| 2 | use crate::marker::PhantomData; | |
| 3 | use crate::path::{self, PathBuf}; | |
| 4 | use crate::sys::pal::unsupported; | |
| 5 | use crate::{fmt, io}; | |
| 6 | ||
| 7 | pub fn getcwd() -> io::Result<PathBuf> { | |
| 8 | unsupported() | |
| 9 | } | |
| 10 | ||
| 11 | pub fn chdir(_: &path::Path) -> io::Result<()> { | |
| 12 | unsupported() | |
| 13 | } | |
| 14 | ||
| 15 | pub struct SplitPaths<'a>(!, PhantomData<&'a ()>); | |
| 16 | ||
| 17 | pub fn split_paths(_unparsed: &OsStr) -> SplitPaths<'_> { | |
| 18 | panic!("unsupported") | |
| 19 | } | |
| 20 | ||
| 21 | impl<'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)] | |
| 29 | pub struct JoinPathsError; | |
| 30 | ||
| 31 | pub fn join_paths<I, T>(_paths: I) -> Result<OsString, JoinPathsError> | |
| 32 | where | |
| 33 | I: Iterator<Item = T>, | |
| 34 | T: AsRef<OsStr>, | |
| 35 | { | |
| 36 | Err(JoinPathsError) | |
| 37 | } | |
| 38 | ||
| 39 | impl 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 | ||
| 45 | impl crate::error::Error for JoinPathsError {} | |
| 46 | ||
| 47 | pub fn current_exe() -> io::Result<PathBuf> { | |
| 48 | unsupported() | |
| 49 | } | |
| 50 | ||
| 51 | pub fn temp_dir() -> PathBuf { | |
| 52 | panic!("no filesystem on this platform") | |
| 53 | } | |
| 54 | ||
| 55 | pub 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 | ||
| 3 | use crate::ffi::{CStr, OsString}; | |
| 4 | use crate::io; | |
| 5 | use crate::os::wasi::prelude::*; | |
| 6 | use crate::path::{self, PathBuf}; | |
| 7 | use crate::sys::helpers::run_path_with_cstr; | |
| 8 | ||
| 9 | pub 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 | ||
| 35 | pub 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 | ||
| 43 | pub 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 | ||
| 5 | use crate::ffi::{OsStr, OsString}; | |
| 6 | use crate::os::windows::ffi::EncodeWide; | |
| 7 | use crate::os::windows::prelude::*; | |
| 8 | use crate::path::{self, PathBuf}; | |
| 9 | #[cfg(not(target_vendor = "uwp"))] | |
| 10 | use crate::sys::pal::api::WinError; | |
| 11 | use crate::sys::pal::{api, c, cvt, fill_utf16_buf, os2path}; | |
| 12 | use crate::{fmt, io, ptr}; | |
| 13 | ||
| 14 | pub struct SplitPaths<'a> { | |
| 15 | data: EncodeWide<'a>, | |
| 16 | must_yield: bool, | |
| 17 | } | |
| 18 | ||
| 19 | pub fn split_paths(unparsed: &OsStr) -> SplitPaths<'_> { | |
| 20 | SplitPaths { data: unparsed.encode_wide(), must_yield: true } | |
| 21 | } | |
| 22 | ||
| 23 | impl<'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)] | |
| 60 | pub struct JoinPathsError; | |
| 61 | ||
| 62 | pub fn join_paths<I, T>(paths: I) -> Result<OsString, JoinPathsError> | |
| 63 | where | |
| 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 | ||
| 90 | impl fmt::Display for JoinPathsError { | |
| 91 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | |
| 92 | "path segment contains `\"`".fmt(f) | |
| 93 | } | |
| 94 | } | |
| 95 | ||
| 96 | impl crate::error::Error for JoinPathsError {} | |
| 97 | ||
| 98 | pub fn current_exe() -> io::Result<PathBuf> { | |
| 99 | fill_utf16_buf(|buf, sz| unsafe { c::GetModuleFileNameW(ptr::null_mut(), buf, sz) }, os2path) | |
| 100 | } | |
| 101 | ||
| 102 | pub fn getcwd() -> io::Result<PathBuf> { | |
| 103 | fill_utf16_buf(|buf, sz| unsafe { c::GetCurrentDirectoryW(sz, buf) }, os2path) | |
| 104 | } | |
| 105 | ||
| 106 | pub 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 | ||
| 114 | pub 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")))] | |
| 119 | fn 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")] | |
| 145 | fn 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")] | |
| 170 | fn home_dir_crt() -> Option<PathBuf> { | |
| 171 | None | |
| 172 | } | |
| 173 | ||
| 174 | pub 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() { |
| 475 | 475 | }); |
| 476 | 476 | |
| 477 | 477 | let mut recv_count = 0; |
| 478 | let mut got_timeout = false; | |
| 479 | 478 | loop { |
| 480 | 479 | match rx.recv_timeout(timeout) { |
| 481 | 480 | Ok(n) => { |
| ... | ... | @@ -483,7 +482,6 @@ fn stress_recv_timeout_two_threads() { |
| 483 | 482 | recv_count += 1; |
| 484 | 483 | } |
| 485 | 484 | Err(RecvTimeoutError::Timeout) => { |
| 486 | got_timeout = true; | |
| 487 | 485 | continue; |
| 488 | 486 | } |
| 489 | 487 | Err(RecvTimeoutError::Disconnected) => break, |
| ... | ... | @@ -491,7 +489,6 @@ fn stress_recv_timeout_two_threads() { |
| 491 | 489 | } |
| 492 | 490 | |
| 493 | 491 | assert_eq!(recv_count, stress); |
| 494 | assert!(got_timeout); | |
| 495 | 492 | } |
| 496 | 493 | |
| 497 | 494 | #[test] |
library/std/tests/sync/mpsc.rs-3| ... | ... | @@ -438,7 +438,6 @@ fn stress_recv_timeout_two_threads() { |
| 438 | 438 | }); |
| 439 | 439 | |
| 440 | 440 | let mut recv_count = 0; |
| 441 | let mut got_timeout = false; | |
| 442 | 441 | loop { |
| 443 | 442 | match rx.recv_timeout(timeout) { |
| 444 | 443 | Ok(n) => { |
| ... | ... | @@ -446,7 +445,6 @@ fn stress_recv_timeout_two_threads() { |
| 446 | 445 | recv_count += 1; |
| 447 | 446 | } |
| 448 | 447 | Err(RecvTimeoutError::Timeout) => { |
| 449 | got_timeout = true; | |
| 450 | 448 | continue; |
| 451 | 449 | } |
| 452 | 450 | Err(RecvTimeoutError::Disconnected) => break, |
| ... | ... | @@ -454,7 +452,6 @@ fn stress_recv_timeout_two_threads() { |
| 454 | 452 | } |
| 455 | 453 | |
| 456 | 454 | assert_eq!(recv_count, stress); |
| 457 | assert!(got_timeout); | |
| 458 | 455 | } |
| 459 | 456 | |
| 460 | 457 | #[test] |
library/stdarch/crates/core_arch/src/mips/msa.rs-1| ... | ... | @@ -9187,7 +9187,6 @@ mod tests { |
| 9187 | 9187 | core_arch::{mips::msa::*, simd::*}, |
| 9188 | 9188 | mem, |
| 9189 | 9189 | }; |
| 9190 | use std::{f32, f64}; | |
| 9191 | 9190 | use stdarch_test::simd_test; |
| 9192 | 9191 | |
| 9193 | 9192 | #[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}; |
| 24 | 24 | |
| 25 | 25 | pub(super) fn check_item<'tcx>(cx: &LateContext<'tcx>, item: &'tcx hir::Item<'_>) { |
| 26 | 26 | 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)); | |
| 28 | 28 | if let hir::ItemKind::Fn { |
| 29 | 29 | ref sig, |
| 30 | 30 | body: ref body_id, |
| ... | ... | @@ -65,7 +65,7 @@ pub(super) fn check_impl_item<'tcx>(cx: &LateContext<'tcx>, item: &'tcx hir::Imp |
| 65 | 65 | let is_public = cx.effective_visibilities.is_exported(item.owner_id.def_id); |
| 66 | 66 | let fn_header_span = item.span.with_hi(sig.decl.output.span().hi()); |
| 67 | 67 | 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)); | |
| 69 | 69 | if let Some((attr_span, reason)) = attr { |
| 70 | 70 | check_needless_must_use( |
| 71 | 71 | cx, |
| ... | ... | @@ -98,7 +98,7 @@ pub(super) fn check_trait_item<'tcx>(cx: &LateContext<'tcx>, item: &'tcx hir::Tr |
| 98 | 98 | let fn_header_span = item.span.with_hi(sig.decl.output.span().hi()); |
| 99 | 99 | |
| 100 | 100 | 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)); | |
| 102 | 102 | if let Some((attr_span, reason)) = attr { |
| 103 | 103 | check_needless_must_use( |
| 104 | 104 | cx, |
src/tools/clippy/clippy_lints/src/incompatible_msrv.rs+1-1| ... | ... | @@ -269,5 +269,5 @@ impl<'tcx> LateLintPass<'tcx> for IncompatibleMsrv { |
| 269 | 269 | fn is_under_cfg_attribute(cx: &LateContext<'_>, hir_id: HirId) -> bool { |
| 270 | 270 | cx.tcx |
| 271 | 271 | .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)) | |
| 273 | 273 | } |
src/tools/clippy/clippy_lints/src/manual_non_exhaustive.rs+2-2| ... | ... | @@ -92,7 +92,7 @@ impl<'tcx> LateLintPass<'tcx> for ManualNonExhaustive { |
| 92 | 92 | .then_some((v.def_id, v.span)) |
| 93 | 93 | }); |
| 94 | 94 | 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(..)) | |
| 96 | 96 | { |
| 97 | 97 | self.potential_enums.push((item.owner_id.def_id, id, item.span, span)); |
| 98 | 98 | } |
| ... | ... | @@ -113,7 +113,7 @@ impl<'tcx> LateLintPass<'tcx> for ManualNonExhaustive { |
| 113 | 113 | "this seems like a manual implementation of the non-exhaustive pattern", |
| 114 | 114 | |diag| { |
| 115 | 115 | 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) | |
| 117 | 117 | { |
| 118 | 118 | diag.span_note(non_exhaustive_span, "the struct is already non-exhaustive"); |
| 119 | 119 | } 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<'_ |
| 39 | 39 | fn is_under_cfg(cx: &LateContext<'_>, id: HirId) -> bool { |
| 40 | 40 | cx.tcx |
| 41 | 41 | .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(..))) | |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /// 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 { |
| 1710 | 1710 | } |
| 1711 | 1711 | |
| 1712 | 1712 | pub 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 { .. }) | |
| 1714 | 1714 | } |
| 1715 | 1715 | |
| 1716 | 1716 | pub 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(& |
| 2410 | 2410 | && let TyKind::Path(QPath::Resolved(_, path)) = ty.kind |
| 2411 | 2411 | // We could also check for the type name `test::TestDescAndFn` |
| 2412 | 2412 | && 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(..)) | |
| 2414 | 2414 | { |
| 2415 | 2415 | names.push(ident.name); |
| 2416 | 2416 | } |
| ... | ... | @@ -2468,7 +2468,7 @@ pub fn is_test_function(tcx: TyCtxt<'_>, fn_def_id: LocalDefId) -> bool { |
| 2468 | 2468 | /// This only checks directly applied attributes, to see if a node is inside a `#[cfg(test)]` parent |
| 2469 | 2469 | /// use [`is_in_cfg_test`] |
| 2470 | 2470 | pub 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) | |
| 2472 | 2472 | && cfgs |
| 2473 | 2473 | .iter() |
| 2474 | 2474 | .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> { |
| 1919 | 1919 | compiler.args(&["-A", "unused", "-W", "unused_attributes"]); |
| 1920 | 1920 | } |
| 1921 | 1921 | |
| 1922 | // Allow tests to use internal features. | |
| 1922 | // Allow tests to use internal and incomplete features. | |
| 1923 | 1923 | 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 | } | |
| 1924 | 1931 | |
| 1925 | 1932 | // Allow tests to have unused parens and braces. |
| 1926 | 1933 | // 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>( |
| 198 | 198 | .rewrite_prefix(context, shape) |
| 199 | 199 | .map(|field_str| trimmed_last_line_width(&field_str)) |
| 200 | 200 | }) |
| 201 | .fold_ok((0, ::std::usize::MAX), |(max_len, min_len), len| { | |
| 201 | .fold_ok((0, usize::MAX), |(max_len, min_len), len| { | |
| 202 | 202 | (cmp::max(max_len, len), cmp::min(min_len, len)) |
| 203 | 203 | }) |
| 204 | 204 | .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) { |
| 23 | 23 | } else { |
| 24 | 24 | assert_contains( |
| 25 | 25 | stderr, |
| 26 | format!("unknown debuginfo compression algorithm {compression}"), | |
| 26 | format!("unsupported debuginfo compression algorithm {compression}"), | |
| 27 | 27 | ); |
| 28 | 28 | } |
| 29 | 29 | }); |
tests/ui/associated-consts/type-const-in-array-len-wrong-type.rs-3| ... | ... | @@ -1,9 +1,6 @@ |
| 1 | 1 | #![feature(generic_const_exprs)] |
| 2 | //~^ WARN the feature `generic_const_exprs` is incomplete | |
| 3 | 2 | #![feature(min_generic_const_args)] |
| 4 | //~^ WARN the feature `min_generic_const_args` is incomplete | |
| 5 | 3 | #![feature(inherent_associated_types)] |
| 6 | //~^ WARN the feature `inherent_associated_types` is incomplete | |
| 7 | 4 | |
| 8 | 5 | struct OnDiskDirEntry<'a>(&'a ()); |
| 9 | 6 |
tests/ui/associated-consts/type-const-in-array-len-wrong-type.stderr+2-27| ... | ... | @@ -1,35 +1,10 @@ |
| 1 | warning: 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 | | | |
| 4 | LL | #![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 | ||
| 10 | warning: 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 | | | |
| 13 | LL | #![feature(min_generic_const_args)] | |
| 14 | | ^^^^^^^^^^^^^^^^^^^^^^ | |
| 15 | | | |
| 16 | = note: see issue #132980 <https://github.com/rust-lang/rust/issues/132980> for more information | |
| 17 | ||
| 18 | warning: 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 | | | |
| 21 | LL | #![feature(inherent_associated_types)] | |
| 22 | | ^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 23 | | | |
| 24 | = note: see issue #8995 <https://github.com/rust-lang/rust/issues/8995> for more information | |
| 25 | ||
| 26 | 1 | error: 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 | |
| 28 | 3 | | |
| 29 | 4 | LL | fn lfn_contents() -> [char; Self::LFN_FRAGMENT_LEN] { |
| 30 | 5 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `i64` |
| 31 | 6 | | |
| 32 | 7 | = note: the length of array `[char; 2]` must be type `usize` |
| 33 | 8 | |
| 34 | error: aborting due to 1 previous error; 3 warnings emitted | |
| 9 | error: aborting due to 1 previous error | |
| 35 | 10 |
tests/ui/associated-consts/type-const-in-array-len.rs-2| ... | ... | @@ -1,9 +1,7 @@ |
| 1 | 1 | //@ check-pass |
| 2 | 2 | |
| 3 | 3 | #![feature(min_generic_const_args)] |
| 4 | //~^ WARN the feature `min_generic_const_args` is incomplete | |
| 5 | 4 | #![feature(inherent_associated_types)] |
| 6 | //~^ WARN the feature `inherent_associated_types` is incomplete | |
| 7 | 5 | |
| 8 | 6 | // Test case from #138226: generic impl with multiple type parameters |
| 9 | 7 | struct Foo<A, B>(A, B); |
tests/ui/associated-consts/type-const-in-array-len.stderr deleted-19| ... | ... | @@ -1,19 +0,0 @@ |
| 1 | warning: 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 | | | |
| 4 | LL | #![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 | ||
| 10 | warning: 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 | | | |
| 13 | LL | #![feature(inherent_associated_types)] | |
| 14 | | ^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 15 | | | |
| 16 | = note: see issue #8995 <https://github.com/rust-lang/rust/issues/8995> for more information | |
| 17 | ||
| 18 | warning: 2 warnings emitted | |
| 19 |
tests/ui/associated-inherent-types/hr-do-not-blame-outlives-static-ice.rs-1| ... | ... | @@ -2,7 +2,6 @@ |
| 2 | 2 | |
| 3 | 3 | // Regression test for #146467. |
| 4 | 4 | #![feature(inherent_associated_types)] |
| 5 | //~^ WARN the feature `inherent_associated_types` is incomplete | |
| 6 | 5 | |
| 7 | 6 | struct Foo<T>(T); |
| 8 | 7 |
tests/ui/associated-inherent-types/hr-do-not-blame-outlives-static-ice.stderr+4-13| ... | ... | @@ -1,20 +1,11 @@ |
| 1 | warning: 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 | | | |
| 4 | LL | #![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 | ||
| 10 | 1 | error[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 | |
| 12 | 3 | | |
| 13 | 4 | LL | impl<'a> Foo<fn(&())> { |
| 14 | 5 | | ^^ unconstrained lifetime parameter |
| 15 | 6 | |
| 16 | 7 | error[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 | |
| 18 | 9 | | |
| 19 | 10 | LL | fn foo(_: for<'a> fn(Foo<fn(&'a ())>::Assoc)) {} |
| 20 | 11 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other |
| ... | ... | @@ -23,12 +14,12 @@ LL | fn foo(_: for<'a> fn(Foo<fn(&'a ())>::Assoc)) {} |
| 23 | 14 | found struct `Foo<for<'a> fn(&'a ())>` |
| 24 | 15 | |
| 25 | 16 | error: 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 | |
| 27 | 18 | | |
| 28 | 19 | LL | fn foo(_: for<'a> fn(Foo<fn(&'a ())>::Assoc)) {} |
| 29 | 20 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 30 | 21 | |
| 31 | error: aborting due to 3 previous errors; 1 warning emitted | |
| 22 | error: aborting due to 3 previous errors | |
| 32 | 23 | |
| 33 | 24 | Some errors have detailed explanations: E0207, E0308. |
| 34 | 25 | For more information about an error, try `rustc --explain E0207`. |
tests/ui/associated-inherent-types/variance-computation-requires-equality.rs-1| ... | ... | @@ -1,7 +1,6 @@ |
| 1 | 1 | //@ check-pass |
| 2 | 2 | |
| 3 | 3 | #![feature(inherent_associated_types)] |
| 4 | //~^ WARN the feature `inherent_associated_types` is incomplete | |
| 5 | 4 | |
| 6 | 5 | struct D<T> { |
| 7 | 6 | a: T |
tests/ui/associated-inherent-types/variance-computation-requires-equality.stderr deleted-11| ... | ... | @@ -1,11 +0,0 @@ |
| 1 | warning: 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 | | | |
| 4 | LL | #![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 | ||
| 10 | warning: 1 warning emitted | |
| 11 |
tests/ui/associated-types/defaults-specialization.rs-1| ... | ... | @@ -1,7 +1,6 @@ |
| 1 | 1 | //! Tests the interaction of associated type defaults and specialization. |
| 2 | 2 | |
| 3 | 3 | #![feature(associated_type_defaults, specialization)] |
| 4 | //~^ WARN the feature `specialization` is incomplete | |
| 5 | 4 | |
| 6 | 5 | trait Tr { |
| 7 | 6 | type Ty = u8; |
tests/ui/associated-types/defaults-specialization.stderr+16-26| ... | ... | @@ -1,21 +1,11 @@ |
| 1 | warning: 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 | | | |
| 4 | LL | #![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 | ||
| 11 | 1 | error[E0053]: method `make` has an incompatible type for trait |
| 12 | --> $DIR/defaults-specialization.rs:19:18 | |
| 2 | --> $DIR/defaults-specialization.rs:18:18 | |
| 13 | 3 | | |
| 14 | 4 | LL | fn make() -> u8 { 0 } |
| 15 | 5 | | ^^ expected associated type, found `u8` |
| 16 | 6 | | |
| 17 | 7 | note: type in trait |
| 18 | --> $DIR/defaults-specialization.rs:9:18 | |
| 8 | --> $DIR/defaults-specialization.rs:8:18 | |
| 19 | 9 | | |
| 20 | 10 | LL | fn make() -> Self::Ty { |
| 21 | 11 | | ^^^^^^^^ |
| ... | ... | @@ -28,7 +18,7 @@ LL + fn make() -> <A<T> as Tr>::Ty { 0 } |
| 28 | 18 | | |
| 29 | 19 | |
| 30 | 20 | error[E0053]: method `make` has an incompatible type for trait |
| 31 | --> $DIR/defaults-specialization.rs:35:18 | |
| 21 | --> $DIR/defaults-specialization.rs:34:18 | |
| 32 | 22 | | |
| 33 | 23 | LL | default type Ty = bool; |
| 34 | 24 | | --------------- associated type is `default` and may be overridden |
| ... | ... | @@ -37,7 +27,7 @@ LL | fn make() -> bool { true } |
| 37 | 27 | | ^^^^ expected associated type, found `bool` |
| 38 | 28 | | |
| 39 | 29 | note: type in trait |
| 40 | --> $DIR/defaults-specialization.rs:9:18 | |
| 30 | --> $DIR/defaults-specialization.rs:8:18 | |
| 41 | 31 | | |
| 42 | 32 | LL | fn make() -> Self::Ty { |
| 43 | 33 | | ^^^^^^^^ |
| ... | ... | @@ -50,7 +40,7 @@ LL + fn make() -> <B<T> as Tr>::Ty { true } |
| 50 | 40 | | |
| 51 | 41 | |
| 52 | 42 | error[E0308]: mismatched types |
| 53 | --> $DIR/defaults-specialization.rs:10:9 | |
| 43 | --> $DIR/defaults-specialization.rs:9:9 | |
| 54 | 44 | | |
| 55 | 45 | LL | type Ty = u8; |
| 56 | 46 | | ------- associated type defaults can't be assumed inside the trait defining them |
| ... | ... | @@ -64,7 +54,7 @@ LL | 0u8 |
| 64 | 54 | found type `u8` |
| 65 | 55 | |
| 66 | 56 | error[E0308]: mismatched types |
| 67 | --> $DIR/defaults-specialization.rs:26:29 | |
| 57 | --> $DIR/defaults-specialization.rs:25:29 | |
| 68 | 58 | | |
| 69 | 59 | LL | fn make() -> Self::Ty { 0u8 } |
| 70 | 60 | | -------- ^^^ expected associated type, found `u8` |
| ... | ... | @@ -79,7 +69,7 @@ LL | fn make() -> Self::Ty { 0u8 } |
| 79 | 69 | see issue #152409 <https://github.com/rust-lang/rust/issues/152409> for more information |
| 80 | 70 | |
| 81 | 71 | error[E0308]: mismatched types |
| 82 | --> $DIR/defaults-specialization.rs:44:29 | |
| 72 | --> $DIR/defaults-specialization.rs:43:29 | |
| 83 | 73 | | |
| 84 | 74 | LL | default type Ty = bool; |
| 85 | 75 | | --------------- associated type is `default` and may be overridden |
| ... | ... | @@ -95,7 +85,7 @@ LL | fn make() -> Self::Ty { true } |
| 95 | 85 | see issue #152409 <https://github.com/rust-lang/rust/issues/152409> for more information |
| 96 | 86 | |
| 97 | 87 | error[E0308]: mismatched types |
| 98 | --> $DIR/defaults-specialization.rs:87:32 | |
| 88 | --> $DIR/defaults-specialization.rs:86:32 | |
| 99 | 89 | | |
| 100 | 90 | LL | let _: <B<()> as Tr>::Ty = 0u8; |
| 101 | 91 | | ----------------- ^^^ expected associated type, found `u8` |
| ... | ... | @@ -105,13 +95,13 @@ LL | let _: <B<()> as Tr>::Ty = 0u8; |
| 105 | 95 | = note: expected associated type `<B<()> as Tr>::Ty` |
| 106 | 96 | found type `u8` |
| 107 | 97 | help: a method is available that returns `<B<()> as Tr>::Ty` |
| 108 | --> $DIR/defaults-specialization.rs:9:5 | |
| 98 | --> $DIR/defaults-specialization.rs:8:5 | |
| 109 | 99 | | |
| 110 | 100 | LL | fn make() -> Self::Ty { |
| 111 | 101 | | ^^^^^^^^^^^^^^^^^^^^^ consider calling `Tr::make` |
| 112 | 102 | |
| 113 | 103 | error[E0308]: mismatched types |
| 114 | --> $DIR/defaults-specialization.rs:88:32 | |
| 104 | --> $DIR/defaults-specialization.rs:87:32 | |
| 115 | 105 | | |
| 116 | 106 | LL | let _: <B<()> as Tr>::Ty = true; |
| 117 | 107 | | ----------------- ^^^^ expected associated type, found `bool` |
| ... | ... | @@ -121,7 +111,7 @@ LL | let _: <B<()> as Tr>::Ty = true; |
| 121 | 111 | = note: expected associated type `<B<()> as Tr>::Ty` |
| 122 | 112 | found type `bool` |
| 123 | 113 | help: a method is available that returns `<B<()> as Tr>::Ty` |
| 124 | --> $DIR/defaults-specialization.rs:9:5 | |
| 114 | --> $DIR/defaults-specialization.rs:8:5 | |
| 125 | 115 | | |
| 126 | 116 | LL | fn make() -> Self::Ty { |
| 127 | 117 | | ^^^^^^^^^^^^^^^^^^^^^ consider calling `Tr::make` |
| ... | ... | @@ -129,7 +119,7 @@ LL | fn make() -> Self::Ty { |
| 129 | 119 | see issue #152409 <https://github.com/rust-lang/rust/issues/152409> for more information |
| 130 | 120 | |
| 131 | 121 | error[E0308]: mismatched types |
| 132 | --> $DIR/defaults-specialization.rs:89:33 | |
| 122 | --> $DIR/defaults-specialization.rs:88:33 | |
| 133 | 123 | | |
| 134 | 124 | LL | let _: <B2<()> as Tr>::Ty = 0u8; |
| 135 | 125 | | ------------------ ^^^ expected associated type, found `u8` |
| ... | ... | @@ -139,13 +129,13 @@ LL | let _: <B2<()> as Tr>::Ty = 0u8; |
| 139 | 129 | = note: expected associated type `<B2<()> as Tr>::Ty` |
| 140 | 130 | found type `u8` |
| 141 | 131 | help: a method is available that returns `<B2<()> as Tr>::Ty` |
| 142 | --> $DIR/defaults-specialization.rs:9:5 | |
| 132 | --> $DIR/defaults-specialization.rs:8:5 | |
| 143 | 133 | | |
| 144 | 134 | LL | fn make() -> Self::Ty { |
| 145 | 135 | | ^^^^^^^^^^^^^^^^^^^^^ consider calling `Tr::make` |
| 146 | 136 | |
| 147 | 137 | error[E0308]: mismatched types |
| 148 | --> $DIR/defaults-specialization.rs:90:33 | |
| 138 | --> $DIR/defaults-specialization.rs:89:33 | |
| 149 | 139 | | |
| 150 | 140 | LL | let _: <B2<()> as Tr>::Ty = true; |
| 151 | 141 | | ------------------ ^^^^ expected associated type, found `bool` |
| ... | ... | @@ -155,14 +145,14 @@ LL | let _: <B2<()> as Tr>::Ty = true; |
| 155 | 145 | = note: expected associated type `<B2<()> as Tr>::Ty` |
| 156 | 146 | found type `bool` |
| 157 | 147 | help: a method is available that returns `<B2<()> as Tr>::Ty` |
| 158 | --> $DIR/defaults-specialization.rs:9:5 | |
| 148 | --> $DIR/defaults-specialization.rs:8:5 | |
| 159 | 149 | | |
| 160 | 150 | LL | fn make() -> Self::Ty { |
| 161 | 151 | | ^^^^^^^^^^^^^^^^^^^^^ consider calling `Tr::make` |
| 162 | 152 | = note: the associated type `<B2<()> as Tr>::Ty` is defined as `bool` in the implementation, but the where-bound `B2<()>` shadows this definition |
| 163 | 153 | see issue #152409 <https://github.com/rust-lang/rust/issues/152409> for more information |
| 164 | 154 | |
| 165 | error: aborting due to 9 previous errors; 1 warning emitted | |
| 155 | error: aborting due to 9 previous errors | |
| 166 | 156 | |
| 167 | 157 | Some errors have detailed explanations: E0053, E0308. |
| 168 | 158 | For more information about an error, try `rustc --explain E0053`. |
tests/ui/async-await/async-drop/foreign-fundamental.rs-1| ... | ... | @@ -1,7 +1,6 @@ |
| 1 | 1 | //@ edition: 2018 |
| 2 | 2 | |
| 3 | 3 | #![feature(async_drop)] |
| 4 | //~^ WARN the feature `async_drop` is incomplete | |
| 5 | 4 | |
| 6 | 5 | use std::future::AsyncDrop; |
| 7 | 6 | use std::pin::Pin; |
tests/ui/async-await/async-drop/foreign-fundamental.stderr+3-12| ... | ... | @@ -1,24 +1,15 @@ |
| 1 | warning: 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 | | | |
| 4 | LL | #![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 | ||
| 10 | 1 | error[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 | |
| 12 | 3 | | |
| 13 | 4 | LL | impl AsyncDrop for &Foo { |
| 14 | 5 | | ^^^^ must be a struct, enum, or union in the current crate |
| 15 | 6 | |
| 16 | 7 | error[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 | |
| 18 | 9 | | |
| 19 | 10 | LL | impl AsyncDrop for Pin<Foo> { |
| 20 | 11 | | ^^^^^^^^ must be a struct, enum, or union in the current crate |
| 21 | 12 | |
| 22 | error: aborting due to 2 previous errors; 1 warning emitted | |
| 13 | error: aborting due to 2 previous errors | |
| 23 | 14 | |
| 24 | 15 | For 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 @@ |
| 1 | warning: 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 | | | |
| 4 | LL | #![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 | ||
| 10 | 1 | error[E0038]: the trait `AsyncTrait` is not dyn compatible |
| 11 | 2 | --> $DIR/mut-is-pointer-like.rs:35:29 |
| 12 | 3 | | |
| ... | ... | @@ -24,6 +15,6 @@ LL | async fn async_dispatch(self: Pin<&mut Self>) -> Self::Output; |
| 24 | 15 | | ^^^^^^^^^^^^^^ ...because method `async_dispatch` is `async` |
| 25 | 16 | = help: consider moving `async_dispatch` to another trait |
| 26 | 17 | |
| 27 | error: aborting due to 1 previous error; 1 warning emitted | |
| 18 | error: aborting due to 1 previous error | |
| 28 | 19 | |
| 29 | 20 | For more information about this error, try `rustc --explain E0038`. |
tests/ui/async-await/dyn/works.stderr+1-10| ... | ... | @@ -1,12 +1,3 @@ |
| 1 | warning: 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 | | | |
| 4 | LL | #![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 | ||
| 10 | 1 | error[E0038]: the trait `AsyncTrait` is not dyn compatible |
| 11 | 2 | --> $DIR/works.rs:27:21 |
| 12 | 3 | | |
| ... | ... | @@ -24,6 +15,6 @@ LL | async fn async_dispatch(&self); |
| 24 | 15 | = help: consider moving `async_dispatch` to another trait |
| 25 | 16 | = help: only type `&'static str` implements `AsyncTrait`; consider using it directly instead. |
| 26 | 17 | |
| 27 | error: aborting due to 1 previous error; 1 warning emitted | |
| 18 | error: aborting due to 1 previous error | |
| 28 | 19 | |
| 29 | 20 | For more information about this error, try `rustc --explain E0038`. |
tests/ui/async-await/dyn/wrong-size.stderr+1-10| ... | ... | @@ -1,12 +1,3 @@ |
| 1 | warning: 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 | | | |
| 4 | LL | #![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 | ||
| 10 | 1 | error[E0038]: the trait `AsyncTrait` is not dyn compatible |
| 11 | 2 | --> $DIR/wrong-size.rs:21:17 |
| 12 | 3 | | |
| ... | ... | @@ -24,6 +15,6 @@ LL | async fn async_dispatch(&self); |
| 24 | 15 | = help: consider moving `async_dispatch` to another trait |
| 25 | 16 | = help: only type `&'static str` implements `AsyncTrait`; consider using it directly instead. |
| 26 | 17 | |
| 27 | error: aborting due to 1 previous error; 1 warning emitted | |
| 18 | error: aborting due to 1 previous error | |
| 28 | 19 | |
| 29 | 20 | For more information about this error, try `rustc --explain E0038`. |
tests/ui/borrowck/generic_const_early_param.rs-1| ... | ... | @@ -1,5 +1,4 @@ |
| 1 | 1 | #![feature(generic_const_exprs)] |
| 2 | //~^ WARN the feature `generic_const_exprs` is incomplete | |
| 3 | 2 | |
| 4 | 3 | struct DataWrapper<'static> { |
| 5 | 4 | //~^ ERROR invalid lifetime parameter name: `'static` |
tests/ui/borrowck/generic_const_early_param.stderr+4-13| ... | ... | @@ -1,11 +1,11 @@ |
| 1 | 1 | error[E0262]: invalid lifetime parameter name: `'static` |
| 2 | --> $DIR/generic_const_early_param.rs:4:20 | |
| 2 | --> $DIR/generic_const_early_param.rs:3:20 | |
| 3 | 3 | | |
| 4 | 4 | LL | struct DataWrapper<'static> { |
| 5 | 5 | | ^^^^^^^ 'static is a reserved lifetime name |
| 6 | 6 | |
| 7 | 7 | error[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 | |
| 9 | 9 | | |
| 10 | 10 | LL | data: &'a [u8; Self::SIZE], |
| 11 | 11 | | ^^ undeclared lifetime |
| ... | ... | @@ -16,7 +16,7 @@ LL | struct DataWrapper<'a, 'static> { |
| 16 | 16 | | +++ |
| 17 | 17 | |
| 18 | 18 | error[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 | |
| 20 | 20 | | |
| 21 | 21 | LL | impl DataWrapper<'a> { |
| 22 | 22 | | ^^ undeclared lifetime |
| ... | ... | @@ -26,16 +26,7 @@ help: consider introducing lifetime `'a` here |
| 26 | 26 | LL | impl<'a> DataWrapper<'a> { |
| 27 | 27 | | ++++ |
| 28 | 28 | |
| 29 | warning: 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 | | | |
| 32 | LL | #![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 | ||
| 38 | error: aborting due to 3 previous errors; 1 warning emitted | |
| 29 | error: aborting due to 3 previous errors | |
| 39 | 30 | |
| 40 | 31 | Some errors have detailed explanations: E0261, E0262. |
| 41 | 32 | For more information about an error, try `rustc --explain E0261`. |
tests/ui/closures/binder/const-bound.rs-1| ... | ... | @@ -1,5 +1,4 @@ |
| 1 | 1 | #![feature(closure_lifetime_binder, non_lifetime_binders)] |
| 2 | //~^ WARN is incomplete and may not be safe to use | |
| 3 | 2 | |
| 4 | 3 | fn main() { |
| 5 | 4 | for<const N: i32> || -> () {}; |
tests/ui/closures/binder/const-bound.stderr+3-12| ... | ... | @@ -1,23 +1,14 @@ |
| 1 | 1 | error: late-bound const parameters cannot be used currently |
| 2 | --> $DIR/const-bound.rs:5:15 | |
| 2 | --> $DIR/const-bound.rs:4:15 | |
| 3 | 3 | | |
| 4 | 4 | LL | for<const N: i32> || -> () {}; |
| 5 | 5 | | ^ |
| 6 | 6 | |
| 7 | warning: 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 | | | |
| 10 | LL | #![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 | ||
| 16 | 7 | error: late-bound const parameter not allowed on closures |
| 17 | --> $DIR/const-bound.rs:5:9 | |
| 8 | --> $DIR/const-bound.rs:4:9 | |
| 18 | 9 | | |
| 19 | 10 | LL | for<const N: i32> || -> () {}; |
| 20 | 11 | | ^^^^^^^^^^^^ |
| 21 | 12 | |
| 22 | error: aborting due to 2 previous errors; 1 warning emitted | |
| 13 | error: aborting due to 2 previous errors | |
| 23 | 14 |
tests/ui/closures/binder/type-bound-2.rs-1| ... | ... | @@ -1,5 +1,4 @@ |
| 1 | 1 | #![feature(closure_lifetime_binder, non_lifetime_binders)] |
| 2 | //~^ WARN is incomplete and may not be safe to use | |
| 3 | 2 | |
| 4 | 3 | fn main() { |
| 5 | 4 | for<T> || -> () {}; |
tests/ui/closures/binder/type-bound-2.stderr+2-11| ... | ... | @@ -1,17 +1,8 @@ |
| 1 | warning: 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 | | | |
| 4 | LL | #![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 | ||
| 10 | 1 | error: late-bound type parameter not allowed on closures |
| 11 | --> $DIR/type-bound-2.rs:5:9 | |
| 2 | --> $DIR/type-bound-2.rs:4:9 | |
| 12 | 3 | | |
| 13 | 4 | LL | for<T> || -> () {}; |
| 14 | 5 | | ^ |
| 15 | 6 | |
| 16 | error: aborting due to 1 previous error; 1 warning emitted | |
| 7 | error: aborting due to 1 previous error | |
| 17 | 8 |
tests/ui/closures/binder/type-bound.rs-1| ... | ... | @@ -1,5 +1,4 @@ |
| 1 | 1 | #![feature(closure_lifetime_binder, non_lifetime_binders)] |
| 2 | //~^ WARN is incomplete and may not be safe to use | |
| 3 | 2 | |
| 4 | 3 | fn main() { |
| 5 | 4 | for<T> || -> T {}; |
tests/ui/closures/binder/type-bound.stderr+2-11| ... | ... | @@ -1,17 +1,8 @@ |
| 1 | warning: 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 | | | |
| 4 | LL | #![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 | ||
| 10 | 1 | error: late-bound type parameter not allowed on closures |
| 11 | --> $DIR/type-bound.rs:5:9 | |
| 2 | --> $DIR/type-bound.rs:4:9 | |
| 12 | 3 | | |
| 13 | 4 | LL | for<T> || -> T {}; |
| 14 | 5 | | ^ |
| 15 | 6 | |
| 16 | error: aborting due to 1 previous error; 1 warning emitted | |
| 7 | error: aborting due to 1 previous error | |
| 17 | 8 |
tests/ui/codegen/freeze-on-polymorphic-projection.rs-1| ... | ... | @@ -2,7 +2,6 @@ |
| 2 | 2 | //@ compile-flags: -Copt-level=1 --crate-type=lib |
| 3 | 3 | |
| 4 | 4 | #![feature(specialization)] |
| 5 | //~^ WARN the feature `specialization` is incomplete | |
| 6 | 5 | |
| 7 | 6 | pub unsafe trait Storage { |
| 8 | 7 | type Handle; |
tests/ui/codegen/freeze-on-polymorphic-projection.stderr deleted-12| ... | ... | @@ -1,12 +0,0 @@ |
| 1 | warning: 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 | | | |
| 4 | LL | #![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 | ||
| 11 | warning: 1 warning emitted | |
| 12 |
tests/ui/coherence/coherence-doesnt-use-infcx-evaluate.rs-1| ... | ... | @@ -5,7 +5,6 @@ |
| 5 | 5 | // since they are using a different infcx which doesn't preserve the intercrate flag. |
| 6 | 6 | |
| 7 | 7 | #![feature(specialization)] |
| 8 | //~^ WARN the feature `specialization` is incomplete | |
| 9 | 8 | |
| 10 | 9 | trait Assoc { |
| 11 | 10 | type Output; |
tests/ui/coherence/coherence-doesnt-use-infcx-evaluate.stderr deleted-12| ... | ... | @@ -1,12 +0,0 @@ |
| 1 | warning: 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 | | | |
| 4 | LL | #![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 | ||
| 11 | warning: 1 warning emitted | |
| 12 |
tests/ui/coherence/coherence-inherited-assoc-ty-cycle-err.rs-1| ... | ... | @@ -4,7 +4,6 @@ |
| 4 | 4 | // |
| 5 | 5 | // No we expect to run into a more user-friendly cycle error instead. |
| 6 | 6 | #![feature(specialization)] |
| 7 | //~^ WARN the feature `specialization` is incomplete | |
| 8 | 7 | |
| 9 | 8 | trait Trait<T> { type Assoc; } |
| 10 | 9 | //~^ ERROR E0391 |
tests/ui/coherence/coherence-inherited-assoc-ty-cycle-err.stderr+3-13| ... | ... | @@ -1,27 +1,17 @@ |
| 1 | warning: 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 | | | |
| 4 | LL | #![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 | ||
| 11 | 1 | error[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 | |
| 13 | 3 | | |
| 14 | 4 | LL | trait Trait<T> { type Assoc; } |
| 15 | 5 | | ^^^^^^^^^^^^^^ |
| 16 | 6 | | |
| 17 | 7 | = note: ...which immediately requires building specialization graph of trait `Trait` again |
| 18 | 8 | note: 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 | |
| 20 | 10 | | |
| 21 | 11 | LL | trait Trait<T> { type Assoc; } |
| 22 | 12 | | ^^^^^^^^^^^^^^ |
| 23 | 13 | = 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 |
| 24 | 14 | |
| 25 | error: aborting due to 1 previous error; 1 warning emitted | |
| 15 | error: aborting due to 1 previous error | |
| 26 | 16 | |
| 27 | 17 | For more information about this error, try `rustc --explain E0391`. |
tests/ui/coherence/negative-coherence/regions-in-canonical.rs-1| ... | ... | @@ -1,7 +1,6 @@ |
| 1 | 1 | //@ check-pass |
| 2 | 2 | |
| 3 | 3 | #![feature(adt_const_params, unsized_const_params)] |
| 4 | //~^ WARN the feature `unsized_const_params` is incomplete | |
| 5 | 4 | #![feature(with_negative_coherence, negative_impls)] |
| 6 | 5 | |
| 7 | 6 | pub trait A<const K: &'static str> {} |
tests/ui/coherence/negative-coherence/regions-in-canonical.stderr deleted-11| ... | ... | @@ -1,11 +0,0 @@ |
| 1 | warning: 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 | | | |
| 4 | LL | #![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 | ||
| 10 | warning: 1 warning emitted | |
| 11 |
tests/ui/consts/escaping-bound-var.rs-1| ... | ... | @@ -1,5 +1,4 @@ |
| 1 | 1 | #![feature(generic_const_exprs)] |
| 2 | //~^ WARN the feature `generic_const_exprs` is incomplete | |
| 3 | 2 | |
| 4 | 3 | fn test<'a>( |
| 5 | 4 | _: &'a (), |
tests/ui/consts/escaping-bound-var.stderr+3-12| ... | ... | @@ -1,14 +1,5 @@ |
| 1 | warning: 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 | | | |
| 4 | LL | #![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 | ||
| 10 | 1 | error: cannot capture late-bound lifetime in constant |
| 11 | --> $DIR/escaping-bound-var.rs:7:13 | |
| 2 | --> $DIR/escaping-bound-var.rs:6:13 | |
| 12 | 3 | | |
| 13 | 4 | LL | fn test<'a>( |
| 14 | 5 | | -- lifetime defined here |
| ... | ... | @@ -17,7 +8,7 @@ LL | let x: &'a (); |
| 17 | 8 | | ^^ |
| 18 | 9 | |
| 19 | 10 | error[E0308]: mismatched types |
| 20 | --> $DIR/escaping-bound-var.rs:6:6 | |
| 11 | --> $DIR/escaping-bound-var.rs:5:6 | |
| 21 | 12 | | |
| 22 | 13 | LL | fn test<'a>( |
| 23 | 14 | | ---- implicitly returns `()` as its body has no tail or `return` expression |
| ... | ... | @@ -33,6 +24,6 @@ LL | | }] { |
| 33 | 24 | 1 |
| 34 | 25 | }]`, found `()` |
| 35 | 26 | |
| 36 | error: aborting due to 2 previous errors; 1 warning emitted | |
| 27 | error: aborting due to 2 previous errors | |
| 37 | 28 | |
| 38 | 29 | For more information about this error, try `rustc --explain E0308`. |
tests/ui/consts/issue-104396.rs-1| ... | ... | @@ -2,7 +2,6 @@ |
| 2 | 2 | //@ check-pass |
| 3 | 3 | |
| 4 | 4 | #![feature(generic_const_exprs)] |
| 5 | //~^ WARN the feature `generic_const_exprs` is incomplete | |
| 6 | 5 | |
| 7 | 6 | #[inline(always)] |
| 8 | 7 | fn 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 @@ |
| 1 | warning: 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 | | | |
| 4 | LL | #![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 | ||
| 10 | warning: 1 warning emitted | |
| 11 |
tests/ui/consts/issue-90762.rs+1-1| ... | ... | @@ -27,5 +27,5 @@ fn main() { |
| 27 | 27 | for (i, b) in FOO.iter().enumerate() { |
| 28 | 28 | assert!(b.load(Ordering::Relaxed), "{} not set", i); |
| 29 | 29 | } |
| 30 | assert_eq!(BAR.fetch_add(1, Ordering::Relaxed), usize::max_value()); | |
| 30 | assert_eq!(BAR.fetch_add(1, Ordering::Relaxed), usize::MAX); | |
| 31 | 31 | } |
tests/ui/consts/refs_check_const_eq-issue-88384.rs-1| ... | ... | @@ -1,6 +1,5 @@ |
| 1 | 1 | #![feature(fn_traits)] |
| 2 | 2 | #![feature(adt_const_params, unsized_const_params)] |
| 3 | //~^ WARNING the feature `unsized_const_params` is incomplete | |
| 4 | 3 | |
| 5 | 4 | #[derive(PartialEq, Eq)] |
| 6 | 5 | struct CompileTimeSettings { |
tests/ui/consts/refs_check_const_eq-issue-88384.stderr+3-12| ... | ... | @@ -1,14 +1,5 @@ |
| 1 | warning: 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 | | | |
| 4 | LL | #![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 | ||
| 10 | 1 | error[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 | |
| 12 | 3 | | |
| 13 | 4 | LL | struct Foo<const T: CompileTimeSettings>; |
| 14 | 5 | | ^^^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -20,7 +11,7 @@ LL | struct CompileTimeSettings { |
| 20 | 11 | | |
| 21 | 12 | |
| 22 | 13 | error[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 | |
| 24 | 15 | | |
| 25 | 16 | LL | impl<const T: CompileTimeSettings> Foo<T> { |
| 26 | 17 | | ^^^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -31,6 +22,6 @@ LL + #[derive(ConstParamTy)] |
| 31 | 22 | LL | struct CompileTimeSettings { |
| 32 | 23 | | |
| 33 | 24 | |
| 34 | error: aborting due to 2 previous errors; 1 warning emitted | |
| 25 | error: aborting due to 2 previous errors | |
| 35 | 26 | |
| 36 | 27 | For more information about this error, try `rustc --explain E0741`. |
tests/ui/consts/static-default-lifetime/generic-associated-const.rs-1| ... | ... | @@ -1,6 +1,5 @@ |
| 1 | 1 | #![deny(elided_lifetimes_in_associated_constant)] |
| 2 | 2 | #![feature(generic_const_items)] |
| 3 | //~^ WARN the feature `generic_const_items` is incomplete | |
| 4 | 3 | |
| 5 | 4 | struct A; |
| 6 | 5 | impl A { |
tests/ui/consts/static-default-lifetime/generic-associated-const.stderr+4-13| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | error[E0106]: missing lifetime specifier |
| 2 | --> $DIR/generic-associated-const.rs:15:29 | |
| 2 | --> $DIR/generic-associated-const.rs:14:29 | |
| 3 | 3 | | |
| 4 | 4 | LL | const GAC_LIFETIME<'a>: &str = ""; |
| 5 | 5 | | ^ expected named lifetime parameter |
| ... | ... | @@ -9,23 +9,14 @@ help: consider using the `'a` lifetime |
| 9 | 9 | LL | const GAC_LIFETIME<'a>: &'a str = ""; |
| 10 | 10 | | ++ |
| 11 | 11 | |
| 12 | warning: 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 | | | |
| 15 | LL | #![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 | ||
| 21 | 12 | error: `&` 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 | |
| 23 | 14 | | |
| 24 | 15 | LL | const GAC_LIFETIME<'a>: &str = ""; |
| 25 | 16 | | ^ |
| 26 | 17 | | |
| 27 | 18 | note: 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 | |
| 29 | 20 | | |
| 30 | 21 | LL | const GAC_LIFETIME<'a>: &str = ""; |
| 31 | 22 | | ^^ |
| ... | ... | @@ -41,6 +32,6 @@ help: use the `'static` lifetime |
| 41 | 32 | LL | const GAC_LIFETIME<'a>: &'static str = ""; |
| 42 | 33 | | +++++++ |
| 43 | 34 | |
| 44 | error: aborting due to 2 previous errors; 1 warning emitted | |
| 35 | error: aborting due to 2 previous errors | |
| 45 | 36 | |
| 46 | 37 | For more information about this error, try `rustc --explain E0106`. |
tests/ui/consts/trait_specialization.rs+1-1| ... | ... | @@ -4,7 +4,7 @@ |
| 4 | 4 | // Tests that specialization does not cause optimizations running on polymorphic MIR to resolve |
| 5 | 5 | // to a `default` implementation. |
| 6 | 6 | |
| 7 | #![feature(specialization)] //~ WARN the feature `specialization` is incomplete | |
| 7 | #![feature(specialization)] | |
| 8 | 8 | |
| 9 | 9 | trait Marker {} |
| 10 | 10 |
tests/ui/consts/trait_specialization.stderr deleted-12| ... | ... | @@ -1,12 +0,0 @@ |
| 1 | warning: 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 | | | |
| 4 | LL | #![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 | ||
| 11 | warning: 1 warning emitted | |
| 12 |
tests/ui/contracts/incomplete-feature.rs+1| ... | ... | @@ -4,6 +4,7 @@ |
| 4 | 4 | // This test specifically checks that the [incomplete_features] warning is |
| 5 | 5 | // emitted when the `contracts` feature gate is enabled, so that it can be |
| 6 | 6 | // marked as `expect`ed in other tests in order to reduce duplication. |
| 7 | #![warn(incomplete_features)] | |
| 7 | 8 | #![feature(contracts)] |
| 8 | 9 | //~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] |
| 9 | 10 | extern crate core; |
tests/ui/contracts/incomplete-feature.stderr+6-2| ... | ... | @@ -1,11 +1,15 @@ |
| 1 | 1 | warning: 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 | |
| 3 | 3 | | |
| 4 | 4 | LL | #![feature(contracts)] |
| 5 | 5 | | ^^^^^^^^^ |
| 6 | 6 | | |
| 7 | 7 | = note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information |
| 8 | = note: `#[warn(incomplete_features)]` on by default | |
| 8 | note: the lint level is defined here | |
| 9 | --> $DIR/incomplete-feature.rs:7:9 | |
| 10 | | | |
| 11 | LL | #![warn(incomplete_features)] | |
| 12 | | ^^^^^^^^^^^^^^^^^^^ | |
| 9 | 13 | |
| 10 | 14 | warning: 1 warning emitted |
| 11 | 15 |
tests/ui/error-codes/E0520.rs-1| ... | ... | @@ -1,5 +1,4 @@ |
| 1 | 1 | #![feature(specialization)] |
| 2 | //~^ WARN the feature `specialization` is incomplete | |
| 3 | 2 | |
| 4 | 3 | trait SpaceLlama { |
| 5 | 4 | fn fly(&self); |
tests/ui/error-codes/E0520.stderr+2-12| ... | ... | @@ -1,15 +1,5 @@ |
| 1 | warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes | |
| 2 | --> $DIR/E0520.rs:1:12 | |
| 3 | | | |
| 4 | LL | #![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 | ||
| 11 | 1 | error[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 | |
| 13 | 3 | | |
| 14 | 4 | LL | impl<T: Clone> SpaceLlama for T { |
| 15 | 5 | | ------------------------------- parent `impl` is here |
| ... | ... | @@ -19,6 +9,6 @@ LL | default fn fly(&self) {} |
| 19 | 9 | | |
| 20 | 10 | = note: to specialize, `fly` in the parent `impl` must be marked `default` |
| 21 | 11 | |
| 22 | error: aborting due to 1 previous error; 1 warning emitted | |
| 12 | error: aborting due to 1 previous error | |
| 23 | 13 | |
| 24 | 14 | For more information about this error, try `rustc --explain E0520`. |
tests/ui/error-codes/E0771.rs-1| ... | ... | @@ -1,5 +1,4 @@ |
| 1 | 1 | #![feature(adt_const_params, unsized_const_params)] |
| 2 | //~^ WARN the feature `unsized_const_params` is incomplete | |
| 3 | 2 | |
| 4 | 3 | fn function_with_str<'a, const STRING: &'a str>() {} //~ ERROR E0770 |
| 5 | 4 |
tests/ui/error-codes/E0771.stderr+2-11| ... | ... | @@ -1,18 +1,9 @@ |
| 1 | 1 | error[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 | |
| 3 | 3 | | |
| 4 | 4 | LL | fn function_with_str<'a, const STRING: &'a str>() {} |
| 5 | 5 | | ^^ the type must not depend on the parameter `'a` |
| 6 | 6 | |
| 7 | warning: 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 | | | |
| 10 | LL | #![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 | ||
| 16 | error: aborting due to 1 previous error; 1 warning emitted | |
| 7 | error: aborting due to 1 previous error | |
| 17 | 8 | |
| 18 | 9 | For 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 @@ |
| 1 | 1 | error[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 | |
| 3 | 3 | | |
| 4 | 4 | LL | #[unsafe(force_target_feature(enable = "avx2"))] |
| 5 | 5 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -9,7 +9,7 @@ LL | #[unsafe(force_target_feature(enable = "avx2"))] |
| 9 | 9 | = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date |
| 10 | 10 | |
| 11 | 11 | error: `#[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 | |
| 13 | 13 | | |
| 14 | 14 | LL | #[target_feature(enable = "avx2")] |
| 15 | 15 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot be applied to safe trait method |
| ... | ... | @@ -18,13 +18,13 @@ LL | fn foo(&self) {} |
| 18 | 18 | | ------------- not an `unsafe` function |
| 19 | 19 | |
| 20 | 20 | error[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 | |
| 22 | 22 | | |
| 23 | 23 | LL | fn foo(&self) {} |
| 24 | 24 | | ^^^^^^^^^^^^^ expected safe fn, found unsafe fn |
| 25 | 25 | | |
| 26 | 26 | note: type in trait |
| 27 | --> $DIR/feature-gate-effective-target-features.rs:7:5 | |
| 27 | --> $DIR/feature-gate-effective-target-features.rs:8:5 | |
| 28 | 28 | | |
| 29 | 29 | LL | fn foo(&self); |
| 30 | 30 | | ^^^^^^^^^^^^^^ |
tests/ui/feature-gates/feature-gate-effective-target-features.feature.stderr+9-5| ... | ... | @@ -1,14 +1,18 @@ |
| 1 | 1 | warning: 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 | |
| 3 | 3 | | |
| 4 | 4 | LL | #![cfg_attr(feature, feature(effective_target_features))] |
| 5 | 5 | | ^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 6 | 6 | | |
| 7 | 7 | = note: see issue #143352 <https://github.com/rust-lang/rust/issues/143352> for more information |
| 8 | = note: `#[warn(incomplete_features)]` on by default | |
| 8 | note: the lint level is defined here | |
| 9 | --> $DIR/feature-gate-effective-target-features.rs:3:9 | |
| 10 | | | |
| 11 | LL | #![warn(incomplete_features)] | |
| 12 | | ^^^^^^^^^^^^^^^^^^^ | |
| 9 | 13 | |
| 10 | 14 | error: `#[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 | |
| 12 | 16 | | |
| 13 | 17 | LL | #[target_feature(enable = "avx2")] |
| 14 | 18 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot be applied to safe trait method |
| ... | ... | @@ -17,13 +21,13 @@ LL | fn foo(&self) {} |
| 17 | 21 | | ------------- not an `unsafe` function |
| 18 | 22 | |
| 19 | 23 | error[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 | |
| 21 | 25 | | |
| 22 | 26 | LL | fn foo(&self) {} |
| 23 | 27 | | ^^^^^^^^^^^^^ expected safe fn, found unsafe fn |
| 24 | 28 | | |
| 25 | 29 | note: type in trait |
| 26 | --> $DIR/feature-gate-effective-target-features.rs:7:5 | |
| 30 | --> $DIR/feature-gate-effective-target-features.rs:8:5 | |
| 27 | 31 | | |
| 28 | 32 | LL | fn foo(&self); |
| 29 | 33 | | ^^^^^^^^^^^^^^ |
tests/ui/feature-gates/feature-gate-effective-target-features.rs+1| ... | ... | @@ -1,5 +1,6 @@ |
| 1 | 1 | //@ revisions: default feature |
| 2 | 2 | //@ only-x86_64 |
| 3 | #![warn(incomplete_features)] | |
| 3 | 4 | #![cfg_attr(feature, feature(effective_target_features))] |
| 4 | 5 | //[feature]~^ WARN the feature `effective_target_features` is incomplete and may not be safe to use and/or cause compiler crashes |
| 5 | 6 |
tests/ui/feature-gates/feature-gate-unsafe_fields.rs+1-1| ... | ... | @@ -1,7 +1,7 @@ |
| 1 | 1 | //@ compile-flags: --crate-type=lib |
| 2 | 2 | //@ revisions: with_gate without_gate |
| 3 | 3 | //@ [with_gate] check-pass |
| 4 | ||
| 4 | #![warn(incomplete_features)] | |
| 5 | 5 | #![cfg_attr(with_gate, feature(unsafe_fields))] //[with_gate]~ WARNING |
| 6 | 6 | |
| 7 | 7 | #[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))] |
| 5 | 5 | | ^^^^^^^^^^^^^ |
| 6 | 6 | | |
| 7 | 7 | = note: see issue #132922 <https://github.com/rust-lang/rust/issues/132922> for more information |
| 8 | = note: `#[warn(incomplete_features)]` on by default | |
| 8 | note: the lint level is defined here | |
| 9 | --> $DIR/feature-gate-unsafe_fields.rs:4:9 | |
| 10 | | | |
| 11 | LL | #![warn(incomplete_features)] | |
| 12 | | ^^^^^^^^^^^^^^^^^^^ | |
| 9 | 13 | |
| 10 | 14 | warning: 1 warning emitted |
| 11 | 15 |
tests/ui/generic-associated-types/issue-87429-specialization.rs-1| ... | ... | @@ -1,7 +1,6 @@ |
| 1 | 1 | //@ check-fail |
| 2 | 2 | |
| 3 | 3 | #![feature(specialization)] |
| 4 | //~^ WARN incomplete | |
| 5 | 4 | |
| 6 | 5 | trait Family { |
| 7 | 6 | type Member<'a>: for<'b> PartialEq<Self::Member<'b>>; |
tests/ui/generic-associated-types/issue-87429-specialization.stderr+3-13| ... | ... | @@ -1,22 +1,12 @@ |
| 1 | warning: 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 | | | |
| 4 | LL | #![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 | ||
| 11 | 1 | error[E0277]: can't compare `Foo` with `Foo` |
| 12 | --> $DIR/issue-87429-specialization.rs:20:31 | |
| 2 | --> $DIR/issue-87429-specialization.rs:19:31 | |
| 13 | 3 | | |
| 14 | 4 | LL | default type Member<'a> = Foo; |
| 15 | 5 | | ^^^ no implementation for `Foo == Foo` |
| 16 | 6 | | |
| 17 | 7 | = help: the trait `PartialEq` is not implemented for `Foo` |
| 18 | 8 | note: required by a bound in `Family::Member` |
| 19 | --> $DIR/issue-87429-specialization.rs:7:22 | |
| 9 | --> $DIR/issue-87429-specialization.rs:6:22 | |
| 20 | 10 | | |
| 21 | 11 | LL | type Member<'a>: for<'b> PartialEq<Self::Member<'b>>; |
| 22 | 12 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Family::Member` |
| ... | ... | @@ -26,6 +16,6 @@ LL + #[derive(PartialEq)] |
| 26 | 16 | LL | struct Foo; |
| 27 | 17 | | |
| 28 | 18 | |
| 29 | error: aborting due to 1 previous error; 1 warning emitted | |
| 19 | error: aborting due to 1 previous error | |
| 30 | 20 | |
| 31 | 21 | For more information about this error, try `rustc --explain E0277`. |
tests/ui/impl-restriction/recover-incorrect-impl-restriction.rs+1| ... | ... | @@ -1,5 +1,6 @@ |
| 1 | 1 | //@ compile-flags: --crate-type=lib |
| 2 | 2 | //@ revisions: with_gate without_gate |
| 3 | #![warn(incomplete_features)] | |
| 3 | 4 | #![cfg_attr(with_gate, feature(impl_restriction))] |
| 4 | 5 | //[with_gate]~^ WARN the feature `impl_restriction` is incomplete and may not be safe to use and/or cause compiler crashes |
| 5 | 6 | #![feature(auto_traits, const_trait_impl)] |
tests/ui/impl-restriction/recover-incorrect-impl-restriction.with_gate.stderr+12-8| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | error: incorrect `impl` restriction |
| 2 | --> $DIR/recover-incorrect-impl-restriction.rs:8:14 | |
| 2 | --> $DIR/recover-incorrect-impl-restriction.rs:9:14 | |
| 3 | 3 | | |
| 4 | 4 | LL | pub impl(crate::foo) trait Baz {} |
| 5 | 5 | | ^^^^^^^^^^ |
| ... | ... | @@ -15,7 +15,7 @@ LL | pub impl(in crate::foo) trait Baz {} |
| 15 | 15 | | ++ |
| 16 | 16 | |
| 17 | 17 | error: incorrect `impl` restriction |
| 18 | --> $DIR/recover-incorrect-impl-restriction.rs:10:21 | |
| 18 | --> $DIR/recover-incorrect-impl-restriction.rs:11:21 | |
| 19 | 19 | | |
| 20 | 20 | LL | pub unsafe impl(crate::foo) trait BazUnsafe {} |
| 21 | 21 | | ^^^^^^^^^^ |
| ... | ... | @@ -31,7 +31,7 @@ LL | pub unsafe impl(in crate::foo) trait BazUnsafe {} |
| 31 | 31 | | ++ |
| 32 | 32 | |
| 33 | 33 | error: incorrect `impl` restriction |
| 34 | --> $DIR/recover-incorrect-impl-restriction.rs:12:19 | |
| 34 | --> $DIR/recover-incorrect-impl-restriction.rs:13:19 | |
| 35 | 35 | | |
| 36 | 36 | LL | pub auto impl(crate::foo) trait BazAuto {} |
| 37 | 37 | | ^^^^^^^^^^ |
| ... | ... | @@ -47,7 +47,7 @@ LL | pub auto impl(in crate::foo) trait BazAuto {} |
| 47 | 47 | | ++ |
| 48 | 48 | |
| 49 | 49 | error: incorrect `impl` restriction |
| 50 | --> $DIR/recover-incorrect-impl-restriction.rs:14:20 | |
| 50 | --> $DIR/recover-incorrect-impl-restriction.rs:15:20 | |
| 51 | 51 | | |
| 52 | 52 | LL | pub const impl(crate::foo) trait BazConst {} |
| 53 | 53 | | ^^^^^^^^^^ |
| ... | ... | @@ -63,7 +63,7 @@ LL | pub const impl(in crate::foo) trait BazConst {} |
| 63 | 63 | | ++ |
| 64 | 64 | |
| 65 | 65 | error: incorrect `impl` restriction |
| 66 | --> $DIR/recover-incorrect-impl-restriction.rs:16:27 | |
| 66 | --> $DIR/recover-incorrect-impl-restriction.rs:17:27 | |
| 67 | 67 | | |
| 68 | 68 | LL | pub const unsafe impl(crate::foo) trait BazConstUnsafe {} |
| 69 | 69 | | ^^^^^^^^^^ |
| ... | ... | @@ -79,7 +79,7 @@ LL | pub const unsafe impl(in crate::foo) trait BazConstUnsafe {} |
| 79 | 79 | | ++ |
| 80 | 80 | |
| 81 | 81 | error: incorrect `impl` restriction |
| 82 | --> $DIR/recover-incorrect-impl-restriction.rs:18:26 | |
| 82 | --> $DIR/recover-incorrect-impl-restriction.rs:19:26 | |
| 83 | 83 | | |
| 84 | 84 | LL | pub unsafe auto impl(crate::foo) trait BazUnsafeAuto {} |
| 85 | 85 | | ^^^^^^^^^^ |
| ... | ... | @@ -95,13 +95,17 @@ LL | pub unsafe auto impl(in crate::foo) trait BazUnsafeAuto {} |
| 95 | 95 | | ++ |
| 96 | 96 | |
| 97 | 97 | warning: 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 | |
| 99 | 99 | | |
| 100 | 100 | LL | #![cfg_attr(with_gate, feature(impl_restriction))] |
| 101 | 101 | | ^^^^^^^^^^^^^^^^ |
| 102 | 102 | | |
| 103 | 103 | = note: see issue #105077 <https://github.com/rust-lang/rust/issues/105077> for more information |
| 104 | = note: `#[warn(incomplete_features)]` on by default | |
| 104 | note: the lint level is defined here | |
| 105 | --> $DIR/recover-incorrect-impl-restriction.rs:3:9 | |
| 106 | | | |
| 107 | LL | #![warn(incomplete_features)] | |
| 108 | | ^^^^^^^^^^^^^^^^^^^ | |
| 105 | 109 | |
| 106 | 110 | error: aborting due to 6 previous errors; 1 warning emitted |
| 107 | 111 |
tests/ui/impl-restriction/recover-incorrect-impl-restriction.without_gate.stderr+12-12| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | error: incorrect `impl` restriction |
| 2 | --> $DIR/recover-incorrect-impl-restriction.rs:8:14 | |
| 2 | --> $DIR/recover-incorrect-impl-restriction.rs:9:14 | |
| 3 | 3 | | |
| 4 | 4 | LL | pub impl(crate::foo) trait Baz {} |
| 5 | 5 | | ^^^^^^^^^^ |
| ... | ... | @@ -15,7 +15,7 @@ LL | pub impl(in crate::foo) trait Baz {} |
| 15 | 15 | | ++ |
| 16 | 16 | |
| 17 | 17 | error: incorrect `impl` restriction |
| 18 | --> $DIR/recover-incorrect-impl-restriction.rs:10:21 | |
| 18 | --> $DIR/recover-incorrect-impl-restriction.rs:11:21 | |
| 19 | 19 | | |
| 20 | 20 | LL | pub unsafe impl(crate::foo) trait BazUnsafe {} |
| 21 | 21 | | ^^^^^^^^^^ |
| ... | ... | @@ -31,7 +31,7 @@ LL | pub unsafe impl(in crate::foo) trait BazUnsafe {} |
| 31 | 31 | | ++ |
| 32 | 32 | |
| 33 | 33 | error: incorrect `impl` restriction |
| 34 | --> $DIR/recover-incorrect-impl-restriction.rs:12:19 | |
| 34 | --> $DIR/recover-incorrect-impl-restriction.rs:13:19 | |
| 35 | 35 | | |
| 36 | 36 | LL | pub auto impl(crate::foo) trait BazAuto {} |
| 37 | 37 | | ^^^^^^^^^^ |
| ... | ... | @@ -47,7 +47,7 @@ LL | pub auto impl(in crate::foo) trait BazAuto {} |
| 47 | 47 | | ++ |
| 48 | 48 | |
| 49 | 49 | error: incorrect `impl` restriction |
| 50 | --> $DIR/recover-incorrect-impl-restriction.rs:14:20 | |
| 50 | --> $DIR/recover-incorrect-impl-restriction.rs:15:20 | |
| 51 | 51 | | |
| 52 | 52 | LL | pub const impl(crate::foo) trait BazConst {} |
| 53 | 53 | | ^^^^^^^^^^ |
| ... | ... | @@ -63,7 +63,7 @@ LL | pub const impl(in crate::foo) trait BazConst {} |
| 63 | 63 | | ++ |
| 64 | 64 | |
| 65 | 65 | error: incorrect `impl` restriction |
| 66 | --> $DIR/recover-incorrect-impl-restriction.rs:16:27 | |
| 66 | --> $DIR/recover-incorrect-impl-restriction.rs:17:27 | |
| 67 | 67 | | |
| 68 | 68 | LL | pub const unsafe impl(crate::foo) trait BazConstUnsafe {} |
| 69 | 69 | | ^^^^^^^^^^ |
| ... | ... | @@ -79,7 +79,7 @@ LL | pub const unsafe impl(in crate::foo) trait BazConstUnsafe {} |
| 79 | 79 | | ++ |
| 80 | 80 | |
| 81 | 81 | error: incorrect `impl` restriction |
| 82 | --> $DIR/recover-incorrect-impl-restriction.rs:18:26 | |
| 82 | --> $DIR/recover-incorrect-impl-restriction.rs:19:26 | |
| 83 | 83 | | |
| 84 | 84 | LL | pub unsafe auto impl(crate::foo) trait BazUnsafeAuto {} |
| 85 | 85 | | ^^^^^^^^^^ |
| ... | ... | @@ -95,7 +95,7 @@ LL | pub unsafe auto impl(in crate::foo) trait BazUnsafeAuto {} |
| 95 | 95 | | ++ |
| 96 | 96 | |
| 97 | 97 | error[E0658]: `impl` restrictions are experimental |
| 98 | --> $DIR/recover-incorrect-impl-restriction.rs:8:9 | |
| 98 | --> $DIR/recover-incorrect-impl-restriction.rs:9:9 | |
| 99 | 99 | | |
| 100 | 100 | LL | pub impl(crate::foo) trait Baz {} |
| 101 | 101 | | ^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -105,7 +105,7 @@ LL | pub impl(crate::foo) trait Baz {} |
| 105 | 105 | = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date |
| 106 | 106 | |
| 107 | 107 | error[E0658]: `impl` restrictions are experimental |
| 108 | --> $DIR/recover-incorrect-impl-restriction.rs:10:16 | |
| 108 | --> $DIR/recover-incorrect-impl-restriction.rs:11:16 | |
| 109 | 109 | | |
| 110 | 110 | LL | pub unsafe impl(crate::foo) trait BazUnsafe {} |
| 111 | 111 | | ^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -115,7 +115,7 @@ LL | pub unsafe impl(crate::foo) trait BazUnsafe {} |
| 115 | 115 | = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date |
| 116 | 116 | |
| 117 | 117 | error[E0658]: `impl` restrictions are experimental |
| 118 | --> $DIR/recover-incorrect-impl-restriction.rs:12:14 | |
| 118 | --> $DIR/recover-incorrect-impl-restriction.rs:13:14 | |
| 119 | 119 | | |
| 120 | 120 | LL | pub auto impl(crate::foo) trait BazAuto {} |
| 121 | 121 | | ^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -125,7 +125,7 @@ LL | pub auto impl(crate::foo) trait BazAuto {} |
| 125 | 125 | = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date |
| 126 | 126 | |
| 127 | 127 | error[E0658]: `impl` restrictions are experimental |
| 128 | --> $DIR/recover-incorrect-impl-restriction.rs:14:15 | |
| 128 | --> $DIR/recover-incorrect-impl-restriction.rs:15:15 | |
| 129 | 129 | | |
| 130 | 130 | LL | pub const impl(crate::foo) trait BazConst {} |
| 131 | 131 | | ^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -135,7 +135,7 @@ LL | pub const impl(crate::foo) trait BazConst {} |
| 135 | 135 | = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date |
| 136 | 136 | |
| 137 | 137 | error[E0658]: `impl` restrictions are experimental |
| 138 | --> $DIR/recover-incorrect-impl-restriction.rs:16:22 | |
| 138 | --> $DIR/recover-incorrect-impl-restriction.rs:17:22 | |
| 139 | 139 | | |
| 140 | 140 | LL | pub const unsafe impl(crate::foo) trait BazConstUnsafe {} |
| 141 | 141 | | ^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -145,7 +145,7 @@ LL | pub const unsafe impl(crate::foo) trait BazConstUnsafe {} |
| 145 | 145 | = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date |
| 146 | 146 | |
| 147 | 147 | error[E0658]: `impl` restrictions are experimental |
| 148 | --> $DIR/recover-incorrect-impl-restriction.rs:18:21 | |
| 148 | --> $DIR/recover-incorrect-impl-restriction.rs:19:21 | |
| 149 | 149 | | |
| 150 | 150 | LL | pub unsafe auto impl(crate::foo) trait BazUnsafeAuto {} |
| 151 | 151 | | ^^^^^^^^^^^^^^^^ |
tests/ui/impl-restriction/trait-alias-cannot-be-impl-restricted.rs+1| ... | ... | @@ -1,5 +1,6 @@ |
| 1 | 1 | //@ compile-flags: --crate-type=lib |
| 2 | 2 | //@ revisions: with_gate without_gate |
| 3 | #![warn(incomplete_features)] | |
| 3 | 4 | #![cfg_attr(with_gate, feature(impl_restriction))] |
| 4 | 5 | //[with_gate]~^ WARN the feature `impl_restriction` is incomplete and may not be safe to use and/or cause compiler crashes |
| 5 | 6 | #![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 @@ |
| 1 | 1 | error: 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 | |
| 3 | 3 | | |
| 4 | 4 | LL | impl(crate) trait Alias = Copy; |
| 5 | 5 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait aliases cannot be `impl`-restricted |
| 6 | 6 | |
| 7 | 7 | error: 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 | |
| 9 | 9 | | |
| 10 | 10 | LL | auto impl(in crate) trait AutoAlias = Copy; |
| 11 | 11 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait aliases cannot be `auto` |
| 12 | 12 | |
| 13 | 13 | error: 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 | |
| 15 | 15 | | |
| 16 | 16 | LL | auto impl(in crate) trait AutoAlias = Copy; |
| 17 | 17 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait aliases cannot be `impl`-restricted |
| 18 | 18 | |
| 19 | 19 | error: 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 | |
| 21 | 21 | | |
| 22 | 22 | LL | unsafe impl(self) trait UnsafeAlias = Copy; |
| 23 | 23 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait aliases cannot be `unsafe` |
| 24 | 24 | |
| 25 | 25 | error: 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 | |
| 27 | 27 | | |
| 28 | 28 | LL | unsafe impl(self) trait UnsafeAlias = Copy; |
| 29 | 29 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait aliases cannot be `impl`-restricted |
| 30 | 30 | |
| 31 | 31 | error: 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 | |
| 33 | 33 | | |
| 34 | 34 | LL | const impl(in self) trait ConstAlias = Copy; |
| 35 | 35 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait aliases cannot be `impl`-restricted |
| 36 | 36 | |
| 37 | 37 | error: 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 | |
| 39 | 39 | | |
| 40 | 40 | LL | impl(super) trait InnerAlias = Copy; |
| 41 | 41 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait aliases cannot be `impl`-restricted |
| 42 | 42 | |
| 43 | 43 | error: 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 | |
| 45 | 45 | | |
| 46 | 46 | LL | const unsafe impl(in crate::foo) trait InnerConstUnsafeAlias = Copy; |
| 47 | 47 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait aliases cannot be `unsafe` |
| 48 | 48 | |
| 49 | 49 | error: 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 | |
| 51 | 51 | | |
| 52 | 52 | LL | const unsafe impl(in crate::foo) trait InnerConstUnsafeAlias = Copy; |
| 53 | 53 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait aliases cannot be `impl`-restricted |
| 54 | 54 | |
| 55 | 55 | error: 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 | |
| 57 | 57 | | |
| 58 | 58 | LL | unsafe auto impl(in crate::foo) trait InnerUnsafeAutoAlias = Copy; |
| 59 | 59 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait aliases cannot be `auto` |
| 60 | 60 | |
| 61 | 61 | error: 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 | |
| 63 | 63 | | |
| 64 | 64 | LL | unsafe auto impl(in crate::foo) trait InnerUnsafeAutoAlias = Copy; |
| 65 | 65 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait aliases cannot be `unsafe` |
| 66 | 66 | |
| 67 | 67 | error: 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 | |
| 69 | 69 | | |
| 70 | 70 | LL | unsafe auto impl(in crate::foo) trait InnerUnsafeAutoAlias = Copy; |
| 71 | 71 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait aliases cannot be `impl`-restricted |
| 72 | 72 | |
| 73 | 73 | warning: 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 | |
| 75 | 75 | | |
| 76 | 76 | LL | #![cfg_attr(with_gate, feature(impl_restriction))] |
| 77 | 77 | | ^^^^^^^^^^^^^^^^ |
| 78 | 78 | | |
| 79 | 79 | = note: see issue #105077 <https://github.com/rust-lang/rust/issues/105077> for more information |
| 80 | = note: `#[warn(incomplete_features)]` on by default | |
| 80 | note: the lint level is defined here | |
| 81 | --> $DIR/trait-alias-cannot-be-impl-restricted.rs:3:9 | |
| 82 | | | |
| 83 | LL | #![warn(incomplete_features)] | |
| 84 | | ^^^^^^^^^^^^^^^^^^^ | |
| 81 | 85 | |
| 82 | 86 | error: aborting due to 12 previous errors; 1 warning emitted |
| 83 | 87 |
tests/ui/impl-restriction/trait-alias-cannot-be-impl-restricted.without_gate.stderr+19-19| ... | ... | @@ -1,77 +1,77 @@ |
| 1 | 1 | error: 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 | |
| 3 | 3 | | |
| 4 | 4 | LL | impl(crate) trait Alias = Copy; |
| 5 | 5 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait aliases cannot be `impl`-restricted |
| 6 | 6 | |
| 7 | 7 | error: 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 | |
| 9 | 9 | | |
| 10 | 10 | LL | auto impl(in crate) trait AutoAlias = Copy; |
| 11 | 11 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait aliases cannot be `auto` |
| 12 | 12 | |
| 13 | 13 | error: 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 | |
| 15 | 15 | | |
| 16 | 16 | LL | auto impl(in crate) trait AutoAlias = Copy; |
| 17 | 17 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait aliases cannot be `impl`-restricted |
| 18 | 18 | |
| 19 | 19 | error: 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 | |
| 21 | 21 | | |
| 22 | 22 | LL | unsafe impl(self) trait UnsafeAlias = Copy; |
| 23 | 23 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait aliases cannot be `unsafe` |
| 24 | 24 | |
| 25 | 25 | error: 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 | |
| 27 | 27 | | |
| 28 | 28 | LL | unsafe impl(self) trait UnsafeAlias = Copy; |
| 29 | 29 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait aliases cannot be `impl`-restricted |
| 30 | 30 | |
| 31 | 31 | error: 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 | |
| 33 | 33 | | |
| 34 | 34 | LL | const impl(in self) trait ConstAlias = Copy; |
| 35 | 35 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait aliases cannot be `impl`-restricted |
| 36 | 36 | |
| 37 | 37 | error: 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 | |
| 39 | 39 | | |
| 40 | 40 | LL | impl(super) trait InnerAlias = Copy; |
| 41 | 41 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait aliases cannot be `impl`-restricted |
| 42 | 42 | |
| 43 | 43 | error: 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 | |
| 45 | 45 | | |
| 46 | 46 | LL | const unsafe impl(in crate::foo) trait InnerConstUnsafeAlias = Copy; |
| 47 | 47 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait aliases cannot be `unsafe` |
| 48 | 48 | |
| 49 | 49 | error: 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 | |
| 51 | 51 | | |
| 52 | 52 | LL | const unsafe impl(in crate::foo) trait InnerConstUnsafeAlias = Copy; |
| 53 | 53 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait aliases cannot be `impl`-restricted |
| 54 | 54 | |
| 55 | 55 | error: 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 | |
| 57 | 57 | | |
| 58 | 58 | LL | unsafe auto impl(in crate::foo) trait InnerUnsafeAutoAlias = Copy; |
| 59 | 59 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait aliases cannot be `auto` |
| 60 | 60 | |
| 61 | 61 | error: 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 | |
| 63 | 63 | | |
| 64 | 64 | LL | unsafe auto impl(in crate::foo) trait InnerUnsafeAutoAlias = Copy; |
| 65 | 65 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait aliases cannot be `unsafe` |
| 66 | 66 | |
| 67 | 67 | error: 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 | |
| 69 | 69 | | |
| 70 | 70 | LL | unsafe auto impl(in crate::foo) trait InnerUnsafeAutoAlias = Copy; |
| 71 | 71 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait aliases cannot be `impl`-restricted |
| 72 | 72 | |
| 73 | 73 | error[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 | |
| 75 | 75 | | |
| 76 | 76 | LL | impl(crate) trait Alias = Copy; |
| 77 | 77 | | ^^^^^^^^^^^ |
| ... | ... | @@ -81,7 +81,7 @@ LL | impl(crate) trait Alias = Copy; |
| 81 | 81 | = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date |
| 82 | 82 | |
| 83 | 83 | error[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 | |
| 85 | 85 | | |
| 86 | 86 | LL | auto impl(in crate) trait AutoAlias = Copy; |
| 87 | 87 | | ^^^^^^^^^^^^^^ |
| ... | ... | @@ -91,7 +91,7 @@ LL | auto impl(in crate) trait AutoAlias = Copy; |
| 91 | 91 | = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date |
| 92 | 92 | |
| 93 | 93 | error[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 | |
| 95 | 95 | | |
| 96 | 96 | LL | unsafe impl(self) trait UnsafeAlias = Copy; |
| 97 | 97 | | ^^^^^^^^^^ |
| ... | ... | @@ -101,7 +101,7 @@ LL | unsafe impl(self) trait UnsafeAlias = Copy; |
| 101 | 101 | = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date |
| 102 | 102 | |
| 103 | 103 | error[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 | |
| 105 | 105 | | |
| 106 | 106 | LL | const impl(in self) trait ConstAlias = Copy; |
| 107 | 107 | | ^^^^^^^^^^^^^ |
| ... | ... | @@ -111,7 +111,7 @@ LL | const impl(in self) trait ConstAlias = Copy; |
| 111 | 111 | = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date |
| 112 | 112 | |
| 113 | 113 | error[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 | |
| 115 | 115 | | |
| 116 | 116 | LL | impl(super) trait InnerAlias = Copy; |
| 117 | 117 | | ^^^^^^^^^^^ |
| ... | ... | @@ -121,7 +121,7 @@ LL | impl(super) trait InnerAlias = Copy; |
| 121 | 121 | = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date |
| 122 | 122 | |
| 123 | 123 | error[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 | |
| 125 | 125 | | |
| 126 | 126 | LL | const unsafe impl(in crate::foo) trait InnerConstUnsafeAlias = Copy; |
| 127 | 127 | | ^^^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -131,7 +131,7 @@ LL | const unsafe impl(in crate::foo) trait InnerConstUnsafeAlias = Copy; |
| 131 | 131 | = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date |
| 132 | 132 | |
| 133 | 133 | error[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 | |
| 135 | 135 | | |
| 136 | 136 | LL | unsafe auto impl(in crate::foo) trait InnerUnsafeAutoAlias = Copy; |
| 137 | 137 | | ^^^^^^^^^^^^^^^^^^^ |
tests/ui/impl-trait/equality-rpass.rs+1-1| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | //@ run-pass |
| 2 | 2 | |
| 3 | #![feature(specialization)] //~ WARN the feature `specialization` is incomplete | |
| 3 | #![feature(specialization)] | |
| 4 | 4 | |
| 5 | 5 | trait Foo: std::fmt::Debug + Eq {} |
| 6 | 6 |
tests/ui/impl-trait/equality-rpass.stderr deleted-12| ... | ... | @@ -1,12 +0,0 @@ |
| 1 | warning: 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 | | | |
| 4 | LL | #![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 | ||
| 11 | warning: 1 warning emitted | |
| 12 |
tests/ui/impl-trait/equality.rs+1-1| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | //@ dont-require-annotations: NOTE |
| 2 | 2 | |
| 3 | #![feature(specialization)] //~ WARN the feature `specialization` is incomplete | |
| 3 | #![feature(specialization)] | |
| 4 | 4 | |
| 5 | 5 | trait Foo: Copy + ToString {} |
| 6 | 6 |
tests/ui/impl-trait/equality.stderr+1-11| ... | ... | @@ -1,13 +1,3 @@ |
| 1 | warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes | |
| 2 | --> $DIR/equality.rs:3:12 | |
| 3 | | | |
| 4 | LL | #![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 | ||
| 11 | 1 | error[E0308]: mismatched types |
| 12 | 2 | --> $DIR/equality.rs:17:5 |
| 13 | 3 | | |
| ... | ... | @@ -48,7 +38,7 @@ help: the following other types implement trait `Add<Rhs>` |
| 48 | 38 | = note: `&u32` implements `Add` |
| 49 | 39 | = note: this error originates in the macro `add_impl` (in Nightly builds, run with -Z macro-backtrace for more info) |
| 50 | 40 | |
| 51 | error: aborting due to 2 previous errors; 1 warning emitted | |
| 41 | error: aborting due to 2 previous errors | |
| 52 | 42 | |
| 53 | 43 | Some errors have detailed explanations: E0277, E0308. |
| 54 | 44 | For more information about an error, try `rustc --explain E0277`. |
tests/ui/impl-trait/equality2.rs+1-1| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | //@ dont-require-annotations: NOTE |
| 2 | 2 | |
| 3 | #![feature(specialization)] //~ WARN the feature `specialization` is incomplete | |
| 3 | #![feature(specialization)] | |
| 4 | 4 | |
| 5 | 5 | trait Foo: Copy + ToString {} |
| 6 | 6 |
tests/ui/impl-trait/equality2.stderr+1-11| ... | ... | @@ -1,13 +1,3 @@ |
| 1 | warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes | |
| 2 | --> $DIR/equality2.rs:3:12 | |
| 3 | | | |
| 4 | LL | #![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 | ||
| 11 | 1 | error[E0308]: mismatched types |
| 12 | 2 | --> $DIR/equality2.rs:27:18 |
| 13 | 3 | | |
| ... | ... | @@ -72,6 +62,6 @@ LL | x.0); |
| 72 | 62 | found opaque type `impl Foo` (`u32`) |
| 73 | 63 | = note: distinct uses of `impl Trait` result in different opaque types |
| 74 | 64 | |
| 75 | error: aborting due to 4 previous errors; 1 warning emitted | |
| 65 | error: aborting due to 4 previous errors | |
| 76 | 66 | |
| 77 | 67 | For 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 @@ |
| 1 | 1 | //@ compile-flags: -Znext-solver |
| 2 | 2 | |
| 3 | 3 | #![feature(lazy_type_alias)] |
| 4 | //~^ WARN the feature `lazy_type_alias` is incomplete | |
| 5 | 4 | |
| 6 | 5 | trait Foo {} |
| 7 | 6 |
tests/ui/impl-trait/in-trait/alias-bounds-when-not-wf.stderr+8-17| ... | ... | @@ -1,53 +1,44 @@ |
| 1 | warning: 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 | | | |
| 4 | LL | #![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 | ||
| 10 | 1 | error[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 | |
| 12 | 3 | | |
| 13 | 4 | LL | fn hello(_: W<A<usize>>) {} |
| 14 | 5 | | ^^^^^^^^ the trait `Foo` is not implemented for `usize` |
| 15 | 6 | | |
| 16 | 7 | help: 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 | |
| 18 | 9 | | |
| 19 | 10 | LL | trait Foo {} |
| 20 | 11 | | ^^^^^^^^^ |
| 21 | 12 | note: 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 | |
| 23 | 14 | | |
| 24 | 15 | LL | type A<T: Foo> = T; |
| 25 | 16 | | ^^^ required by this bound in `A` |
| 26 | 17 | |
| 27 | 18 | error[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 | |
| 29 | 20 | | |
| 30 | 21 | LL | fn hello(_: W<A<usize>>) {} |
| 31 | 22 | | ^ the trait `Foo` is not implemented for `usize` |
| 32 | 23 | | |
| 33 | 24 | help: 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 | |
| 35 | 26 | | |
| 36 | 27 | LL | trait Foo {} |
| 37 | 28 | | ^^^^^^^^^ |
| 38 | 29 | |
| 39 | 30 | error[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 | |
| 41 | 32 | | |
| 42 | 33 | LL | fn hello(_: W<A<usize>>) {} |
| 43 | 34 | | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `usize` |
| 44 | 35 | | |
| 45 | 36 | help: 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 | |
| 47 | 38 | | |
| 48 | 39 | LL | trait Foo {} |
| 49 | 40 | | ^^^^^^^^^ |
| 50 | 41 | |
| 51 | error: aborting due to 3 previous errors; 1 warning emitted | |
| 42 | error: aborting due to 3 previous errors | |
| 52 | 43 | |
| 53 | 44 | For 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 | ||
| 7 | fn 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"] | |
| 10 | pub fn fn1(a: u32, b: u32, c: u32) -> u32 { | |
| 11 | a + b + c | |
| 12 | } | |
| 13 | ||
| 14 | #[linkage = "weak"] | |
| 15 | pub 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 @@ |
| 12 | 12 | //! constant. |
| 13 | 13 | |
| 14 | 14 | #![feature(rustc_attrs)] |
| 15 | #![feature(generic_const_exprs)] //~ WARNING: the feature `generic_const_exprs` is incomplete | |
| 15 | #![feature(generic_const_exprs)] | |
| 16 | 16 | #![feature(trivial_bounds)] |
| 17 | 17 | |
| 18 | 18 | #![crate_type = "lib"] |
tests/ui/layout/gce-rigid-const-in-array-len.stderr+1-10| ... | ... | @@ -1,17 +1,8 @@ |
| 1 | warning: 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 | | | |
| 4 | LL | #![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 | ||
| 10 | 1 | error: the type `[u8; <u8 as A>::B]` has an unknown layout |
| 11 | 2 | --> $DIR/gce-rigid-const-in-array-len.rs:25:1 |
| 12 | 3 | | |
| 13 | 4 | LL | struct S([u8; <u8 as A>::B]) |
| 14 | 5 | | ^^^^^^^^ |
| 15 | 6 | |
| 16 | error: aborting due to 1 previous error; 1 warning emitted | |
| 7 | error: aborting due to 1 previous error | |
| 17 | 8 |
tests/ui/lazy-type-alias/bad-lazy-type-alias.rs-1| ... | ... | @@ -1,7 +1,6 @@ |
| 1 | 1 | // regression test for #127351 |
| 2 | 2 | |
| 3 | 3 | #![feature(lazy_type_alias)] |
| 4 | //~^ WARN the feature `lazy_type_alias` is incomplete | |
| 5 | 4 | |
| 6 | 5 | type ExplicitTypeOutlives<T> = T; |
| 7 | 6 |
tests/ui/lazy-type-alias/bad-lazy-type-alias.stderr+3-12| ... | ... | @@ -1,20 +1,11 @@ |
| 1 | warning: 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 | | | |
| 4 | LL | #![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 | ||
| 10 | 1 | error[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 | |
| 12 | 3 | | |
| 13 | 4 | LL | _significant_drop: ExplicitTypeOutlives, |
| 14 | 5 | | ^^^^^^^^^^^^^^^^^^^^ expected 1 generic argument |
| 15 | 6 | | |
| 16 | 7 | note: 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 | |
| 18 | 9 | | |
| 19 | 10 | LL | type ExplicitTypeOutlives<T> = T; |
| 20 | 11 | | ^^^^^^^^^^^^^^^^^^^^ - |
| ... | ... | @@ -23,6 +14,6 @@ help: add missing generic argument |
| 23 | 14 | LL | _significant_drop: ExplicitTypeOutlives<T>, |
| 24 | 15 | | +++ |
| 25 | 16 | |
| 26 | error: aborting due to 1 previous error; 1 warning emitted | |
| 17 | error: aborting due to 1 previous error | |
| 27 | 18 | |
| 28 | 19 | For 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 @@ |
| 1 | warning: 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 | | | |
| 4 | LL | #![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 | ||
| 10 | warning: 1 warning emitted | |
| 11 |
tests/ui/lazy-type-alias/coerce-behind-lazy.next.stderr deleted-11| ... | ... | @@ -1,11 +0,0 @@ |
| 1 | warning: 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 | | | |
| 4 | LL | #![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 | ||
| 10 | warning: 1 warning emitted | |
| 11 |
tests/ui/lazy-type-alias/coerce-behind-lazy.rs-1| ... | ... | @@ -4,7 +4,6 @@ |
| 4 | 4 | //@[next] compile-flags: -Znext-solver |
| 5 | 5 | |
| 6 | 6 | #![feature(lazy_type_alias)] |
| 7 | //~^ WARN the feature `lazy_type_alias` is incomplete | |
| 8 | 7 | |
| 9 | 8 | use std::any::Any; |
| 10 | 9 |
tests/ui/lazy-type-alias/enum-variant.rs-1| ... | ... | @@ -2,7 +2,6 @@ |
| 2 | 2 | //@ check-pass |
| 3 | 3 | |
| 4 | 4 | #![feature(lazy_type_alias)] |
| 5 | //~^ WARN the feature `lazy_type_alias` is incomplete and may not be safe to use | |
| 6 | 5 | |
| 7 | 6 | enum Enum { |
| 8 | 7 | Unit, |
tests/ui/lazy-type-alias/enum-variant.stderr deleted-11| ... | ... | @@ -1,11 +0,0 @@ |
| 1 | warning: 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 | | | |
| 4 | LL | #![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 | ||
| 10 | warning: 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 | ||
| 8 | fn 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"] | |
| 11 | pub fn fn1(a: u32, b: u32, c: u32) -> u32 { | |
| 12 | a + b + c | |
| 13 | } | |
| 14 | ||
| 15 | #[linkage = "weak"] | |
| 16 | pub 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 @@ |
| 1 | 1 | //@ run-pass |
| 2 | 2 | |
| 3 | 3 | #![feature(marker_trait_attr)] |
| 4 | #![feature(specialization)] //~ WARN the feature `specialization` is incomplete | |
| 4 | #![feature(specialization)] | |
| 5 | 5 | |
| 6 | 6 | #[marker] |
| 7 | 7 | trait MyMarker {} |
tests/ui/marker_trait_attr/overlap-doesnt-conflict-with-specialization.stderr deleted-12| ... | ... | @@ -1,12 +0,0 @@ |
| 1 | warning: 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 | | | |
| 4 | LL | #![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 | ||
| 11 | warning: 1 warning emitted | |
| 12 |
tests/ui/missing/undeclared-generic-parameter.rs created+5| ... | ... | @@ -0,0 +1,5 @@ |
| 1 | struct A; | |
| 2 | impl A<B> {} | |
| 3 | //~^ ERROR cannot find type `B` in this scope | |
| 4 | //~| ERROR struct takes 0 generic arguments but 1 generic argument was supplied | |
| 5 | fn main() {} |
tests/ui/missing/undeclared-generic-parameter.stderr created+36| ... | ... | @@ -0,0 +1,36 @@ |
| 1 | error[E0425]: cannot find type `B` in this scope | |
| 2 | --> $DIR/undeclared-generic-parameter.rs:2:8 | |
| 3 | | | |
| 4 | LL | struct A; | |
| 5 | | --------- similarly named struct `A` defined here | |
| 6 | LL | impl A<B> {} | |
| 7 | | ^ | |
| 8 | | | |
| 9 | help: a struct with a similar name exists | |
| 10 | | | |
| 11 | LL - impl A<B> {} | |
| 12 | LL + impl A<A> {} | |
| 13 | | | |
| 14 | help: you might be missing a type parameter | |
| 15 | | | |
| 16 | LL | impl<B> A<B> {} | |
| 17 | | +++ | |
| 18 | ||
| 19 | error[E0107]: struct takes 0 generic arguments but 1 generic argument was supplied | |
| 20 | --> $DIR/undeclared-generic-parameter.rs:2:6 | |
| 21 | | | |
| 22 | LL | impl A<B> {} | |
| 23 | | ^--- help: remove the unnecessary generics | |
| 24 | | | | |
| 25 | | expected 0 generic arguments | |
| 26 | | | |
| 27 | note: struct defined here, with 0 generic parameters | |
| 28 | --> $DIR/undeclared-generic-parameter.rs:1:8 | |
| 29 | | | |
| 30 | LL | struct A; | |
| 31 | | ^ | |
| 32 | ||
| 33 | error: aborting due to 2 previous errors | |
| 34 | ||
| 35 | Some errors have detailed explanations: E0107, E0425. | |
| 36 | For more information about an error, try `rustc --explain E0107`. |
tests/ui/parser/assoc/assoc-static-semantic-fail.rs-1| ... | ... | @@ -1,7 +1,6 @@ |
| 1 | 1 | // Semantically, we do not allow e.g., `static X: u8 = 0;` as an associated item. |
| 2 | 2 | |
| 3 | 3 | #![feature(specialization)] |
| 4 | //~^ WARN the feature `specialization` is incomplete | |
| 5 | 4 | |
| 6 | 5 | fn main() {} |
| 7 | 6 |
tests/ui/parser/assoc/assoc-static-semantic-fail.stderr+25-35| ... | ... | @@ -1,17 +1,17 @@ |
| 1 | 1 | error: associated `static` items are not allowed |
| 2 | --> $DIR/assoc-static-semantic-fail.rs:10:5 | |
| 2 | --> $DIR/assoc-static-semantic-fail.rs:9:5 | |
| 3 | 3 | | |
| 4 | 4 | LL | static IA: u8 = 0; |
| 5 | 5 | | ^^^^^^^^^^^^^^^^^^ |
| 6 | 6 | |
| 7 | 7 | error: associated `static` items are not allowed |
| 8 | --> $DIR/assoc-static-semantic-fail.rs:12:5 | |
| 8 | --> $DIR/assoc-static-semantic-fail.rs:11:5 | |
| 9 | 9 | | |
| 10 | 10 | LL | static IB: u8; |
| 11 | 11 | | ^^^^^^^^^^^^^^ |
| 12 | 12 | |
| 13 | 13 | error: a static item cannot be `default` |
| 14 | --> $DIR/assoc-static-semantic-fail.rs:15:5 | |
| 14 | --> $DIR/assoc-static-semantic-fail.rs:14:5 | |
| 15 | 15 | | |
| 16 | 16 | LL | default static IC: u8 = 0; |
| 17 | 17 | | ^^^^^^^ `default` because of this |
| ... | ... | @@ -19,13 +19,13 @@ LL | default static IC: u8 = 0; |
| 19 | 19 | = note: only associated `fn`, `const`, and `type` items can be `default` |
| 20 | 20 | |
| 21 | 21 | error: associated `static` items are not allowed |
| 22 | --> $DIR/assoc-static-semantic-fail.rs:15:5 | |
| 22 | --> $DIR/assoc-static-semantic-fail.rs:14:5 | |
| 23 | 23 | | |
| 24 | 24 | LL | default static IC: u8 = 0; |
| 25 | 25 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 26 | 26 | |
| 27 | 27 | error: a static item cannot be `default` |
| 28 | --> $DIR/assoc-static-semantic-fail.rs:18:16 | |
| 28 | --> $DIR/assoc-static-semantic-fail.rs:17:16 | |
| 29 | 29 | | |
| 30 | 30 | LL | pub(crate) default static ID: u8; |
| 31 | 31 | | ^^^^^^^ `default` because of this |
| ... | ... | @@ -33,25 +33,25 @@ LL | pub(crate) default static ID: u8; |
| 33 | 33 | = note: only associated `fn`, `const`, and `type` items can be `default` |
| 34 | 34 | |
| 35 | 35 | error: associated `static` items are not allowed |
| 36 | --> $DIR/assoc-static-semantic-fail.rs:18:5 | |
| 36 | --> $DIR/assoc-static-semantic-fail.rs:17:5 | |
| 37 | 37 | | |
| 38 | 38 | LL | pub(crate) default static ID: u8; |
| 39 | 39 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 40 | 40 | |
| 41 | 41 | error: associated `static` items are not allowed |
| 42 | --> $DIR/assoc-static-semantic-fail.rs:25:5 | |
| 42 | --> $DIR/assoc-static-semantic-fail.rs:24:5 | |
| 43 | 43 | | |
| 44 | 44 | LL | static TA: u8 = 0; |
| 45 | 45 | | ^^^^^^^^^^^^^^^^^^ |
| 46 | 46 | |
| 47 | 47 | error: associated `static` items are not allowed |
| 48 | --> $DIR/assoc-static-semantic-fail.rs:27:5 | |
| 48 | --> $DIR/assoc-static-semantic-fail.rs:26:5 | |
| 49 | 49 | | |
| 50 | 50 | LL | static TB: u8; |
| 51 | 51 | | ^^^^^^^^^^^^^^ |
| 52 | 52 | |
| 53 | 53 | error: a static item cannot be `default` |
| 54 | --> $DIR/assoc-static-semantic-fail.rs:29:5 | |
| 54 | --> $DIR/assoc-static-semantic-fail.rs:28:5 | |
| 55 | 55 | | |
| 56 | 56 | LL | default static TC: u8 = 0; |
| 57 | 57 | | ^^^^^^^ `default` because of this |
| ... | ... | @@ -59,13 +59,13 @@ LL | default static TC: u8 = 0; |
| 59 | 59 | = note: only associated `fn`, `const`, and `type` items can be `default` |
| 60 | 60 | |
| 61 | 61 | error: associated `static` items are not allowed |
| 62 | --> $DIR/assoc-static-semantic-fail.rs:29:5 | |
| 62 | --> $DIR/assoc-static-semantic-fail.rs:28:5 | |
| 63 | 63 | | |
| 64 | 64 | LL | default static TC: u8 = 0; |
| 65 | 65 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 66 | 66 | |
| 67 | 67 | error: a static item cannot be `default` |
| 68 | --> $DIR/assoc-static-semantic-fail.rs:32:16 | |
| 68 | --> $DIR/assoc-static-semantic-fail.rs:31:16 | |
| 69 | 69 | | |
| 70 | 70 | LL | pub(crate) default static TD: u8; |
| 71 | 71 | | ^^^^^^^ `default` because of this |
| ... | ... | @@ -73,25 +73,25 @@ LL | pub(crate) default static TD: u8; |
| 73 | 73 | = note: only associated `fn`, `const`, and `type` items can be `default` |
| 74 | 74 | |
| 75 | 75 | error: associated `static` items are not allowed |
| 76 | --> $DIR/assoc-static-semantic-fail.rs:32:5 | |
| 76 | --> $DIR/assoc-static-semantic-fail.rs:31:5 | |
| 77 | 77 | | |
| 78 | 78 | LL | pub(crate) default static TD: u8; |
| 79 | 79 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 80 | 80 | |
| 81 | 81 | error: associated `static` items are not allowed |
| 82 | --> $DIR/assoc-static-semantic-fail.rs:39:5 | |
| 82 | --> $DIR/assoc-static-semantic-fail.rs:38:5 | |
| 83 | 83 | | |
| 84 | 84 | LL | static TA: u8 = 0; |
| 85 | 85 | | ^^^^^^^^^^^^^^^^^^ |
| 86 | 86 | |
| 87 | 87 | error: associated `static` items are not allowed |
| 88 | --> $DIR/assoc-static-semantic-fail.rs:41:5 | |
| 88 | --> $DIR/assoc-static-semantic-fail.rs:40:5 | |
| 89 | 89 | | |
| 90 | 90 | LL | static TB: u8; |
| 91 | 91 | | ^^^^^^^^^^^^^^ |
| 92 | 92 | |
| 93 | 93 | error: a static item cannot be `default` |
| 94 | --> $DIR/assoc-static-semantic-fail.rs:44:5 | |
| 94 | --> $DIR/assoc-static-semantic-fail.rs:43:5 | |
| 95 | 95 | | |
| 96 | 96 | LL | default static TC: u8 = 0; |
| 97 | 97 | | ^^^^^^^ `default` because of this |
| ... | ... | @@ -99,13 +99,13 @@ LL | default static TC: u8 = 0; |
| 99 | 99 | = note: only associated `fn`, `const`, and `type` items can be `default` |
| 100 | 100 | |
| 101 | 101 | error: associated `static` items are not allowed |
| 102 | --> $DIR/assoc-static-semantic-fail.rs:44:5 | |
| 102 | --> $DIR/assoc-static-semantic-fail.rs:43:5 | |
| 103 | 103 | | |
| 104 | 104 | LL | default static TC: u8 = 0; |
| 105 | 105 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 106 | 106 | |
| 107 | 107 | error: a static item cannot be `default` |
| 108 | --> $DIR/assoc-static-semantic-fail.rs:47:9 | |
| 108 | --> $DIR/assoc-static-semantic-fail.rs:46:9 | |
| 109 | 109 | | |
| 110 | 110 | LL | pub default static TD: u8; |
| 111 | 111 | | ^^^^^^^ `default` because of this |
| ... | ... | @@ -113,13 +113,13 @@ LL | pub default static TD: u8; |
| 113 | 113 | = note: only associated `fn`, `const`, and `type` items can be `default` |
| 114 | 114 | |
| 115 | 115 | error: associated `static` items are not allowed |
| 116 | --> $DIR/assoc-static-semantic-fail.rs:47:5 | |
| 116 | --> $DIR/assoc-static-semantic-fail.rs:46:5 | |
| 117 | 117 | | |
| 118 | 118 | LL | pub default static TD: u8; |
| 119 | 119 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 120 | 120 | |
| 121 | 121 | error: associated constant in `impl` without body |
| 122 | --> $DIR/assoc-static-semantic-fail.rs:12:5 | |
| 122 | --> $DIR/assoc-static-semantic-fail.rs:11:5 | |
| 123 | 123 | | |
| 124 | 124 | LL | static IB: u8; |
| 125 | 125 | | ^^^^^^^^^^^^^- |
| ... | ... | @@ -127,7 +127,7 @@ LL | static IB: u8; |
| 127 | 127 | | help: provide a definition for the constant: `= <expr>;` |
| 128 | 128 | |
| 129 | 129 | error: associated constant in `impl` without body |
| 130 | --> $DIR/assoc-static-semantic-fail.rs:18:5 | |
| 130 | --> $DIR/assoc-static-semantic-fail.rs:17:5 | |
| 131 | 131 | | |
| 132 | 132 | LL | pub(crate) default static ID: u8; |
| 133 | 133 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- |
| ... | ... | @@ -135,7 +135,7 @@ LL | pub(crate) default static ID: u8; |
| 135 | 135 | | help: provide a definition for the constant: `= <expr>;` |
| 136 | 136 | |
| 137 | 137 | error[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 | |
| 139 | 139 | | |
| 140 | 140 | LL | pub(crate) default static TD: u8; |
| 141 | 141 | | ^^^^^^^^^^ help: remove the qualifier |
| ... | ... | @@ -143,7 +143,7 @@ LL | pub(crate) default static TD: u8; |
| 143 | 143 | = note: trait items always share the visibility of their trait |
| 144 | 144 | |
| 145 | 145 | error: associated constant in `impl` without body |
| 146 | --> $DIR/assoc-static-semantic-fail.rs:41:5 | |
| 146 | --> $DIR/assoc-static-semantic-fail.rs:40:5 | |
| 147 | 147 | | |
| 148 | 148 | LL | static TB: u8; |
| 149 | 149 | | ^^^^^^^^^^^^^- |
| ... | ... | @@ -151,7 +151,7 @@ LL | static TB: u8; |
| 151 | 151 | | help: provide a definition for the constant: `= <expr>;` |
| 152 | 152 | |
| 153 | 153 | error: associated constant in `impl` without body |
| 154 | --> $DIR/assoc-static-semantic-fail.rs:47:5 | |
| 154 | --> $DIR/assoc-static-semantic-fail.rs:46:5 | |
| 155 | 155 | | |
| 156 | 156 | LL | pub default static TD: u8; |
| 157 | 157 | | ^^^^^^^^^^^^^^^^^^^^^^^^^- |
| ... | ... | @@ -159,23 +159,13 @@ LL | pub default static TD: u8; |
| 159 | 159 | | help: provide a definition for the constant: `= <expr>;` |
| 160 | 160 | |
| 161 | 161 | error[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 | |
| 163 | 163 | | |
| 164 | 164 | LL | pub default static TD: u8; |
| 165 | 165 | | ^^^ help: remove the qualifier |
| 166 | 166 | | |
| 167 | 167 | = note: trait items always share the visibility of their trait |
| 168 | 168 | |
| 169 | warning: 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 | | | |
| 172 | LL | #![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 | ||
| 179 | error: aborting due to 24 previous errors; 1 warning emitted | |
| 169 | error: aborting due to 24 previous errors | |
| 180 | 170 | |
| 181 | 171 | For more information about this error, try `rustc --explain E0449`. |
tests/ui/parser/default.rs-1| ... | ... | @@ -1,7 +1,6 @@ |
| 1 | 1 | // Test successful and unsuccessful parsing of the `default` contextual keyword |
| 2 | 2 | |
| 3 | 3 | #![feature(specialization)] |
| 4 | //~^ WARN the feature `specialization` is incomplete | |
| 5 | 4 | |
| 6 | 5 | trait Foo { |
| 7 | 6 | fn foo<T: Default>() -> T; |
tests/ui/parser/default.stderr+5-15| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | error: `default` is not followed by an item |
| 2 | --> $DIR/default.rs:23:5 | |
| 2 | --> $DIR/default.rs:22:5 | |
| 3 | 3 | | |
| 4 | 4 | LL | default pub fn foo<T: Default>() -> T { T::default() } |
| 5 | 5 | | ^^^^^^^ the `default` qualifier |
| ... | ... | @@ -7,7 +7,7 @@ LL | default pub fn foo<T: Default>() -> T { T::default() } |
| 7 | 7 | = note: only `fn`, `const`, `type`, or `impl` items may be prefixed by `default` |
| 8 | 8 | |
| 9 | 9 | error: non-item in item list |
| 10 | --> $DIR/default.rs:23:13 | |
| 10 | --> $DIR/default.rs:22:13 | |
| 11 | 11 | | |
| 12 | 12 | LL | impl Foo for u32 { |
| 13 | 13 | | - item list starts here |
| ... | ... | @@ -18,25 +18,15 @@ LL | } |
| 18 | 18 | | - item list ends here |
| 19 | 19 | |
| 20 | 20 | error[E0449]: visibility qualifiers are not permitted here |
| 21 | --> $DIR/default.rs:17:5 | |
| 21 | --> $DIR/default.rs:16:5 | |
| 22 | 22 | | |
| 23 | 23 | LL | pub default fn foo<T: Default>() -> T { |
| 24 | 24 | | ^^^ help: remove the qualifier |
| 25 | 25 | | |
| 26 | 26 | = note: trait items always share the visibility of their trait |
| 27 | 27 | |
| 28 | warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes | |
| 29 | --> $DIR/default.rs:3:12 | |
| 30 | | | |
| 31 | LL | #![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 | ||
| 38 | 28 | error[E0046]: not all trait items implemented, missing: `foo` |
| 39 | --> $DIR/default.rs:22:1 | |
| 29 | --> $DIR/default.rs:21:1 | |
| 40 | 30 | | |
| 41 | 31 | LL | fn foo<T: Default>() -> T; |
| 42 | 32 | | -------------------------- `foo` from trait |
| ... | ... | @@ -44,7 +34,7 @@ LL | fn foo<T: Default>() -> T; |
| 44 | 34 | LL | impl Foo for u32 { |
| 45 | 35 | | ^^^^^^^^^^^^^^^^ missing `foo` in implementation |
| 46 | 36 | |
| 47 | error: aborting due to 4 previous errors; 1 warning emitted | |
| 37 | error: aborting due to 4 previous errors | |
| 48 | 38 | |
| 49 | 39 | Some errors have detailed explanations: E0046, E0449. |
| 50 | 40 | For 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)] | |
| 2 | 2 | |
| 3 | 3 | fn main() {} |
| 4 | 4 |
tests/ui/parser/defaultness-invalid-places-fail-semantic.stderr+1-11| ... | ... | @@ -70,15 +70,5 @@ LL | default fn h() {} |
| 70 | 70 | | | |
| 71 | 71 | | `default` because of this |
| 72 | 72 | |
| 73 | warning: 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 | | | |
| 76 | LL | #![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 | ||
| 83 | error: aborting due to 9 previous errors; 1 warning emitted | |
| 73 | error: aborting due to 9 previous errors | |
| 84 | 74 |
tests/ui/pattern/usefulness/empty-types.exhaustive_patterns.stderr+50-50| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | error: unreachable pattern |
| 2 | --> $DIR/empty-types.rs:48:9 | |
| 2 | --> $DIR/empty-types.rs:47:9 | |
| 3 | 3 | | |
| 4 | 4 | LL | _ => {} |
| 5 | 5 | | ^------ |
| ... | ... | @@ -9,13 +9,13 @@ LL | _ => {} |
| 9 | 9 | | |
| 10 | 10 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 11 | 11 | note: the lint level is defined here |
| 12 | --> $DIR/empty-types.rs:14:9 | |
| 12 | --> $DIR/empty-types.rs:13:9 | |
| 13 | 13 | | |
| 14 | 14 | LL | #![deny(unreachable_patterns)] |
| 15 | 15 | | ^^^^^^^^^^^^^^^^^^^^ |
| 16 | 16 | |
| 17 | 17 | error: unreachable pattern |
| 18 | --> $DIR/empty-types.rs:51:9 | |
| 18 | --> $DIR/empty-types.rs:50:9 | |
| 19 | 19 | | |
| 20 | 20 | LL | _x => {} |
| 21 | 21 | | ^^------ |
| ... | ... | @@ -26,7 +26,7 @@ LL | _x => {} |
| 26 | 26 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 27 | 27 | |
| 28 | 28 | error[E0004]: non-exhaustive patterns: type `&!` is non-empty |
| 29 | --> $DIR/empty-types.rs:55:11 | |
| 29 | --> $DIR/empty-types.rs:54:11 | |
| 30 | 30 | | |
| 31 | 31 | LL | match ref_never {} |
| 32 | 32 | | ^^^^^^^^^ |
| ... | ... | @@ -41,7 +41,7 @@ LL ~ } |
| 41 | 41 | | |
| 42 | 42 | |
| 43 | 43 | error: unreachable pattern |
| 44 | --> $DIR/empty-types.rs:69:9 | |
| 44 | --> $DIR/empty-types.rs:68:9 | |
| 45 | 45 | | |
| 46 | 46 | LL | (_, _) => {} |
| 47 | 47 | | ^^^^^^------ |
| ... | ... | @@ -52,7 +52,7 @@ LL | (_, _) => {} |
| 52 | 52 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 53 | 53 | |
| 54 | 54 | error: unreachable pattern |
| 55 | --> $DIR/empty-types.rs:75:9 | |
| 55 | --> $DIR/empty-types.rs:74:9 | |
| 56 | 56 | | |
| 57 | 57 | LL | _ => {} |
| 58 | 58 | | ^------ |
| ... | ... | @@ -63,7 +63,7 @@ LL | _ => {} |
| 63 | 63 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 64 | 64 | |
| 65 | 65 | error: unreachable pattern |
| 66 | --> $DIR/empty-types.rs:78:9 | |
| 66 | --> $DIR/empty-types.rs:77:9 | |
| 67 | 67 | | |
| 68 | 68 | LL | (_, _) => {} |
| 69 | 69 | | ^^^^^^------ |
| ... | ... | @@ -74,7 +74,7 @@ LL | (_, _) => {} |
| 74 | 74 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 75 | 75 | |
| 76 | 76 | error: unreachable pattern |
| 77 | --> $DIR/empty-types.rs:82:9 | |
| 77 | --> $DIR/empty-types.rs:81:9 | |
| 78 | 78 | | |
| 79 | 79 | LL | _ => {} |
| 80 | 80 | | ^------ |
| ... | ... | @@ -85,7 +85,7 @@ LL | _ => {} |
| 85 | 85 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 86 | 86 | |
| 87 | 87 | error[E0004]: non-exhaustive patterns: `Ok(_)` not covered |
| 88 | --> $DIR/empty-types.rs:86:11 | |
| 88 | --> $DIR/empty-types.rs:85:11 | |
| 89 | 89 | | |
| 90 | 90 | LL | match res_u32_never {} |
| 91 | 91 | | ^^^^^^^^^^^^^ pattern `Ok(_)` not covered |
| ... | ... | @@ -104,7 +104,7 @@ LL ~ } |
| 104 | 104 | | |
| 105 | 105 | |
| 106 | 106 | error: unreachable pattern |
| 107 | --> $DIR/empty-types.rs:93:9 | |
| 107 | --> $DIR/empty-types.rs:92:9 | |
| 108 | 108 | | |
| 109 | 109 | LL | Err(_) => {} |
| 110 | 110 | | ^^^^^^------ |
| ... | ... | @@ -115,7 +115,7 @@ LL | Err(_) => {} |
| 115 | 115 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 116 | 116 | |
| 117 | 117 | error: unreachable pattern |
| 118 | --> $DIR/empty-types.rs:98:9 | |
| 118 | --> $DIR/empty-types.rs:97:9 | |
| 119 | 119 | | |
| 120 | 120 | LL | Err(_) => {} |
| 121 | 121 | | ^^^^^^------ |
| ... | ... | @@ -126,7 +126,7 @@ LL | Err(_) => {} |
| 126 | 126 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 127 | 127 | |
| 128 | 128 | error[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 | |
| 130 | 130 | | |
| 131 | 131 | LL | match res_u32_never { |
| 132 | 132 | | ^^^^^^^^^^^^^ pattern `Ok(1_u32..=u32::MAX)` not covered |
| ... | ... | @@ -144,7 +144,7 @@ LL ~ Ok(1_u32..=u32::MAX) => todo!() |
| 144 | 144 | | |
| 145 | 145 | |
| 146 | 146 | error[E0005]: refutable pattern in local binding |
| 147 | --> $DIR/empty-types.rs:101:9 | |
| 147 | --> $DIR/empty-types.rs:100:9 | |
| 148 | 148 | | |
| 149 | 149 | LL | let Ok(_x) = res_u32_never.as_ref(); |
| 150 | 150 | | ^^^^^^ pattern `Err(_)` not covered |
| ... | ... | @@ -158,7 +158,7 @@ LL | let Ok(_x) = res_u32_never.as_ref() else { todo!() }; |
| 158 | 158 | | ++++++++++++++++ |
| 159 | 159 | |
| 160 | 160 | error: unreachable pattern |
| 161 | --> $DIR/empty-types.rs:111:9 | |
| 161 | --> $DIR/empty-types.rs:110:9 | |
| 162 | 162 | | |
| 163 | 163 | LL | _ => {} |
| 164 | 164 | | ^------ |
| ... | ... | @@ -169,7 +169,7 @@ LL | _ => {} |
| 169 | 169 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 170 | 170 | |
| 171 | 171 | error: unreachable pattern |
| 172 | --> $DIR/empty-types.rs:114:9 | |
| 172 | --> $DIR/empty-types.rs:113:9 | |
| 173 | 173 | | |
| 174 | 174 | LL | Ok(_) => {} |
| 175 | 175 | | ^^^^^------ |
| ... | ... | @@ -180,7 +180,7 @@ LL | Ok(_) => {} |
| 180 | 180 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 181 | 181 | |
| 182 | 182 | error: unreachable pattern |
| 183 | --> $DIR/empty-types.rs:117:9 | |
| 183 | --> $DIR/empty-types.rs:116:9 | |
| 184 | 184 | | |
| 185 | 185 | LL | Ok(_) => {} |
| 186 | 186 | | ^^^^^------ |
| ... | ... | @@ -191,7 +191,7 @@ LL | Ok(_) => {} |
| 191 | 191 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 192 | 192 | |
| 193 | 193 | error: unreachable pattern |
| 194 | --> $DIR/empty-types.rs:118:9 | |
| 194 | --> $DIR/empty-types.rs:117:9 | |
| 195 | 195 | | |
| 196 | 196 | LL | _ => {} |
| 197 | 197 | | ^------ |
| ... | ... | @@ -202,7 +202,7 @@ LL | _ => {} |
| 202 | 202 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 203 | 203 | |
| 204 | 204 | error: unreachable pattern |
| 205 | --> $DIR/empty-types.rs:121:9 | |
| 205 | --> $DIR/empty-types.rs:120:9 | |
| 206 | 206 | | |
| 207 | 207 | LL | Ok(_) => {} |
| 208 | 208 | | ^^^^^------ |
| ... | ... | @@ -213,7 +213,7 @@ LL | Ok(_) => {} |
| 213 | 213 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 214 | 214 | |
| 215 | 215 | error: unreachable pattern |
| 216 | --> $DIR/empty-types.rs:122:9 | |
| 216 | --> $DIR/empty-types.rs:121:9 | |
| 217 | 217 | | |
| 218 | 218 | LL | Err(_) => {} |
| 219 | 219 | | ^^^^^^------ |
| ... | ... | @@ -224,7 +224,7 @@ LL | Err(_) => {} |
| 224 | 224 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 225 | 225 | |
| 226 | 226 | error: unreachable pattern |
| 227 | --> $DIR/empty-types.rs:131:13 | |
| 227 | --> $DIR/empty-types.rs:130:13 | |
| 228 | 228 | | |
| 229 | 229 | LL | _ => {} |
| 230 | 230 | | ^------ |
| ... | ... | @@ -235,7 +235,7 @@ LL | _ => {} |
| 235 | 235 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 236 | 236 | |
| 237 | 237 | error: unreachable pattern |
| 238 | --> $DIR/empty-types.rs:134:13 | |
| 238 | --> $DIR/empty-types.rs:133:13 | |
| 239 | 239 | | |
| 240 | 240 | LL | _ if false => {} |
| 241 | 241 | | ^--------------- |
| ... | ... | @@ -246,7 +246,7 @@ LL | _ if false => {} |
| 246 | 246 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 247 | 247 | |
| 248 | 248 | error: unreachable pattern |
| 249 | --> $DIR/empty-types.rs:142:13 | |
| 249 | --> $DIR/empty-types.rs:141:13 | |
| 250 | 250 | | |
| 251 | 251 | LL | Some(_) => {} |
| 252 | 252 | | ^^^^^^^------ |
| ... | ... | @@ -257,7 +257,7 @@ LL | Some(_) => {} |
| 257 | 257 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 258 | 258 | |
| 259 | 259 | error: unreachable pattern |
| 260 | --> $DIR/empty-types.rs:146:13 | |
| 260 | --> $DIR/empty-types.rs:145:13 | |
| 261 | 261 | | |
| 262 | 262 | LL | None => {} |
| 263 | 263 | | ---- matches all the relevant values |
| ... | ... | @@ -265,7 +265,7 @@ LL | _ => {} |
| 265 | 265 | | ^ no value can reach this |
| 266 | 266 | |
| 267 | 267 | error: unreachable pattern |
| 268 | --> $DIR/empty-types.rs:198:13 | |
| 268 | --> $DIR/empty-types.rs:197:13 | |
| 269 | 269 | | |
| 270 | 270 | LL | _ => {} |
| 271 | 271 | | ^------ |
| ... | ... | @@ -276,7 +276,7 @@ LL | _ => {} |
| 276 | 276 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 277 | 277 | |
| 278 | 278 | error: unreachable pattern |
| 279 | --> $DIR/empty-types.rs:203:13 | |
| 279 | --> $DIR/empty-types.rs:202:13 | |
| 280 | 280 | | |
| 281 | 281 | LL | _ => {} |
| 282 | 282 | | ^------ |
| ... | ... | @@ -287,7 +287,7 @@ LL | _ => {} |
| 287 | 287 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 288 | 288 | |
| 289 | 289 | error: unreachable pattern |
| 290 | --> $DIR/empty-types.rs:208:13 | |
| 290 | --> $DIR/empty-types.rs:207:13 | |
| 291 | 291 | | |
| 292 | 292 | LL | _ => {} |
| 293 | 293 | | ^------ |
| ... | ... | @@ -298,7 +298,7 @@ LL | _ => {} |
| 298 | 298 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 299 | 299 | |
| 300 | 300 | error: unreachable pattern |
| 301 | --> $DIR/empty-types.rs:213:13 | |
| 301 | --> $DIR/empty-types.rs:212:13 | |
| 302 | 302 | | |
| 303 | 303 | LL | _ => {} |
| 304 | 304 | | ^------ |
| ... | ... | @@ -309,7 +309,7 @@ LL | _ => {} |
| 309 | 309 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 310 | 310 | |
| 311 | 311 | error: unreachable pattern |
| 312 | --> $DIR/empty-types.rs:219:13 | |
| 312 | --> $DIR/empty-types.rs:218:13 | |
| 313 | 313 | | |
| 314 | 314 | LL | _ => {} |
| 315 | 315 | | ^------ |
| ... | ... | @@ -320,7 +320,7 @@ LL | _ => {} |
| 320 | 320 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 321 | 321 | |
| 322 | 322 | error: unreachable pattern |
| 323 | --> $DIR/empty-types.rs:280:9 | |
| 323 | --> $DIR/empty-types.rs:279:9 | |
| 324 | 324 | | |
| 325 | 325 | LL | _ => {} |
| 326 | 326 | | ^------ |
| ... | ... | @@ -331,7 +331,7 @@ LL | _ => {} |
| 331 | 331 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 332 | 332 | |
| 333 | 333 | error: unreachable pattern |
| 334 | --> $DIR/empty-types.rs:283:9 | |
| 334 | --> $DIR/empty-types.rs:282:9 | |
| 335 | 335 | | |
| 336 | 336 | LL | (_, _) => {} |
| 337 | 337 | | ^^^^^^------ |
| ... | ... | @@ -342,7 +342,7 @@ LL | (_, _) => {} |
| 342 | 342 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 343 | 343 | |
| 344 | 344 | error: unreachable pattern |
| 345 | --> $DIR/empty-types.rs:286:9 | |
| 345 | --> $DIR/empty-types.rs:285:9 | |
| 346 | 346 | | |
| 347 | 347 | LL | Ok(_) => {} |
| 348 | 348 | | ^^^^^------ |
| ... | ... | @@ -353,7 +353,7 @@ LL | Ok(_) => {} |
| 353 | 353 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 354 | 354 | |
| 355 | 355 | error: unreachable pattern |
| 356 | --> $DIR/empty-types.rs:287:9 | |
| 356 | --> $DIR/empty-types.rs:286:9 | |
| 357 | 357 | | |
| 358 | 358 | LL | Err(_) => {} |
| 359 | 359 | | ^^^^^^------ |
| ... | ... | @@ -364,7 +364,7 @@ LL | Err(_) => {} |
| 364 | 364 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 365 | 365 | |
| 366 | 366 | error[E0004]: non-exhaustive patterns: type `&[!]` is non-empty |
| 367 | --> $DIR/empty-types.rs:326:11 | |
| 367 | --> $DIR/empty-types.rs:325:11 | |
| 368 | 368 | | |
| 369 | 369 | LL | match slice_never {} |
| 370 | 370 | | ^^^^^^^^^^^ |
| ... | ... | @@ -378,7 +378,7 @@ LL ~ } |
| 378 | 378 | | |
| 379 | 379 | |
| 380 | 380 | error[E0004]: non-exhaustive patterns: `&[]` not covered |
| 381 | --> $DIR/empty-types.rs:337:11 | |
| 381 | --> $DIR/empty-types.rs:336:11 | |
| 382 | 382 | | |
| 383 | 383 | LL | match slice_never { |
| 384 | 384 | | ^^^^^^^^^^^ pattern `&[]` not covered |
| ... | ... | @@ -391,7 +391,7 @@ LL + &[] => todo!() |
| 391 | 391 | | |
| 392 | 392 | |
| 393 | 393 | error[E0004]: non-exhaustive patterns: `&[]` not covered |
| 394 | --> $DIR/empty-types.rs:351:11 | |
| 394 | --> $DIR/empty-types.rs:350:11 | |
| 395 | 395 | | |
| 396 | 396 | LL | match slice_never { |
| 397 | 397 | | ^^^^^^^^^^^ pattern `&[]` not covered |
| ... | ... | @@ -405,7 +405,7 @@ LL + &[] => todo!() |
| 405 | 405 | | |
| 406 | 406 | |
| 407 | 407 | error[E0004]: non-exhaustive patterns: type `[!]` is non-empty |
| 408 | --> $DIR/empty-types.rs:358:11 | |
| 408 | --> $DIR/empty-types.rs:357:11 | |
| 409 | 409 | | |
| 410 | 410 | LL | match *slice_never {} |
| 411 | 411 | | ^^^^^^^^^^^^ |
| ... | ... | @@ -419,7 +419,7 @@ LL ~ } |
| 419 | 419 | | |
| 420 | 420 | |
| 421 | 421 | error: unreachable pattern |
| 422 | --> $DIR/empty-types.rs:367:9 | |
| 422 | --> $DIR/empty-types.rs:366:9 | |
| 423 | 423 | | |
| 424 | 424 | LL | _ => {} |
| 425 | 425 | | ^------ |
| ... | ... | @@ -430,7 +430,7 @@ LL | _ => {} |
| 430 | 430 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 431 | 431 | |
| 432 | 432 | error: unreachable pattern |
| 433 | --> $DIR/empty-types.rs:370:9 | |
| 433 | --> $DIR/empty-types.rs:369:9 | |
| 434 | 434 | | |
| 435 | 435 | LL | [_, _, _] => {} |
| 436 | 436 | | ^^^^^^^^^------ |
| ... | ... | @@ -441,7 +441,7 @@ LL | [_, _, _] => {} |
| 441 | 441 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 442 | 442 | |
| 443 | 443 | error: unreachable pattern |
| 444 | --> $DIR/empty-types.rs:373:9 | |
| 444 | --> $DIR/empty-types.rs:372:9 | |
| 445 | 445 | | |
| 446 | 446 | LL | [_, ..] => {} |
| 447 | 447 | | ^^^^^^^------ |
| ... | ... | @@ -452,7 +452,7 @@ LL | [_, ..] => {} |
| 452 | 452 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 453 | 453 | |
| 454 | 454 | error[E0004]: non-exhaustive patterns: type `[!; 0]` is non-empty |
| 455 | --> $DIR/empty-types.rs:387:11 | |
| 455 | --> $DIR/empty-types.rs:386:11 | |
| 456 | 456 | | |
| 457 | 457 | LL | match array_0_never {} |
| 458 | 458 | | ^^^^^^^^^^^^^ |
| ... | ... | @@ -466,7 +466,7 @@ LL ~ } |
| 466 | 466 | | |
| 467 | 467 | |
| 468 | 468 | error: unreachable pattern |
| 469 | --> $DIR/empty-types.rs:394:9 | |
| 469 | --> $DIR/empty-types.rs:393:9 | |
| 470 | 470 | | |
| 471 | 471 | LL | [] => {} |
| 472 | 472 | | -- matches all the relevant values |
| ... | ... | @@ -474,7 +474,7 @@ LL | _ => {} |
| 474 | 474 | | ^ no value can reach this |
| 475 | 475 | |
| 476 | 476 | error[E0004]: non-exhaustive patterns: `[]` not covered |
| 477 | --> $DIR/empty-types.rs:396:11 | |
| 477 | --> $DIR/empty-types.rs:395:11 | |
| 478 | 478 | | |
| 479 | 479 | LL | match array_0_never { |
| 480 | 480 | | ^^^^^^^^^^^^^ pattern `[]` not covered |
| ... | ... | @@ -488,7 +488,7 @@ LL + [] => todo!() |
| 488 | 488 | | |
| 489 | 489 | |
| 490 | 490 | error: unreachable pattern |
| 491 | --> $DIR/empty-types.rs:415:9 | |
| 491 | --> $DIR/empty-types.rs:414:9 | |
| 492 | 492 | | |
| 493 | 493 | LL | Some(_) => {} |
| 494 | 494 | | ^^^^^^^------ |
| ... | ... | @@ -499,7 +499,7 @@ LL | Some(_) => {} |
| 499 | 499 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 500 | 500 | |
| 501 | 501 | error: unreachable pattern |
| 502 | --> $DIR/empty-types.rs:420:9 | |
| 502 | --> $DIR/empty-types.rs:419:9 | |
| 503 | 503 | | |
| 504 | 504 | LL | Some(_a) => {} |
| 505 | 505 | | ^^^^^^^^------ |
| ... | ... | @@ -510,7 +510,7 @@ LL | Some(_a) => {} |
| 510 | 510 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 511 | 511 | |
| 512 | 512 | error: unreachable pattern |
| 513 | --> $DIR/empty-types.rs:425:9 | |
| 513 | --> $DIR/empty-types.rs:424:9 | |
| 514 | 514 | | |
| 515 | 515 | LL | None => {} |
| 516 | 516 | | ---- matches all the relevant values |
| ... | ... | @@ -519,7 +519,7 @@ LL | _ => {} |
| 519 | 519 | | ^ no value can reach this |
| 520 | 520 | |
| 521 | 521 | error: unreachable pattern |
| 522 | --> $DIR/empty-types.rs:430:9 | |
| 522 | --> $DIR/empty-types.rs:429:9 | |
| 523 | 523 | | |
| 524 | 524 | LL | None => {} |
| 525 | 525 | | ---- matches all the relevant values |
| ... | ... | @@ -528,7 +528,7 @@ LL | _a => {} |
| 528 | 528 | | ^^ no value can reach this |
| 529 | 529 | |
| 530 | 530 | error: unreachable pattern |
| 531 | --> $DIR/empty-types.rs:602:9 | |
| 531 | --> $DIR/empty-types.rs:601:9 | |
| 532 | 532 | | |
| 533 | 533 | LL | _ => {} |
| 534 | 534 | | ^------ |
| ... | ... | @@ -539,7 +539,7 @@ LL | _ => {} |
| 539 | 539 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 540 | 540 | |
| 541 | 541 | error: unreachable pattern |
| 542 | --> $DIR/empty-types.rs:605:9 | |
| 542 | --> $DIR/empty-types.rs:604:9 | |
| 543 | 543 | | |
| 544 | 544 | LL | _x => {} |
| 545 | 545 | | ^^------ |
| ... | ... | @@ -550,7 +550,7 @@ LL | _x => {} |
| 550 | 550 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 551 | 551 | |
| 552 | 552 | error: unreachable pattern |
| 553 | --> $DIR/empty-types.rs:608:9 | |
| 553 | --> $DIR/empty-types.rs:607:9 | |
| 554 | 554 | | |
| 555 | 555 | LL | _ if false => {} |
| 556 | 556 | | ^--------------- |
| ... | ... | @@ -561,7 +561,7 @@ LL | _ if false => {} |
| 561 | 561 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 562 | 562 | |
| 563 | 563 | error: unreachable pattern |
| 564 | --> $DIR/empty-types.rs:611:9 | |
| 564 | --> $DIR/empty-types.rs:610:9 | |
| 565 | 565 | | |
| 566 | 566 | LL | _x if false => {} |
| 567 | 567 | | ^^--------------- |
tests/ui/pattern/usefulness/empty-types.never_pats.stderr+44-53| ... | ... | @@ -1,14 +1,5 @@ |
| 1 | warning: 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 | | | |
| 4 | LL | #![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 | ||
| 10 | 1 | error: unreachable pattern |
| 11 | --> $DIR/empty-types.rs:48:9 | |
| 2 | --> $DIR/empty-types.rs:47:9 | |
| 12 | 3 | | |
| 13 | 4 | LL | _ => {} |
| 14 | 5 | | ^------ |
| ... | ... | @@ -18,13 +9,13 @@ LL | _ => {} |
| 18 | 9 | | |
| 19 | 10 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 20 | 11 | note: the lint level is defined here |
| 21 | --> $DIR/empty-types.rs:14:9 | |
| 12 | --> $DIR/empty-types.rs:13:9 | |
| 22 | 13 | | |
| 23 | 14 | LL | #![deny(unreachable_patterns)] |
| 24 | 15 | | ^^^^^^^^^^^^^^^^^^^^ |
| 25 | 16 | |
| 26 | 17 | error: unreachable pattern |
| 27 | --> $DIR/empty-types.rs:51:9 | |
| 18 | --> $DIR/empty-types.rs:50:9 | |
| 28 | 19 | | |
| 29 | 20 | LL | _x => {} |
| 30 | 21 | | ^^------ |
| ... | ... | @@ -35,7 +26,7 @@ LL | _x => {} |
| 35 | 26 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 36 | 27 | |
| 37 | 28 | error[E0004]: non-exhaustive patterns: type `&!` is non-empty |
| 38 | --> $DIR/empty-types.rs:55:11 | |
| 29 | --> $DIR/empty-types.rs:54:11 | |
| 39 | 30 | | |
| 40 | 31 | LL | match ref_never {} |
| 41 | 32 | | ^^^^^^^^^ |
| ... | ... | @@ -50,7 +41,7 @@ LL ~ } |
| 50 | 41 | | |
| 51 | 42 | |
| 52 | 43 | error: unreachable pattern |
| 53 | --> $DIR/empty-types.rs:82:9 | |
| 44 | --> $DIR/empty-types.rs:81:9 | |
| 54 | 45 | | |
| 55 | 46 | LL | _ => {} |
| 56 | 47 | | ^------ |
| ... | ... | @@ -61,7 +52,7 @@ LL | _ => {} |
| 61 | 52 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 62 | 53 | |
| 63 | 54 | error[E0004]: non-exhaustive patterns: `Ok(_)` not covered |
| 64 | --> $DIR/empty-types.rs:86:11 | |
| 55 | --> $DIR/empty-types.rs:85:11 | |
| 65 | 56 | | |
| 66 | 57 | LL | match res_u32_never {} |
| 67 | 58 | | ^^^^^^^^^^^^^ pattern `Ok(_)` not covered |
| ... | ... | @@ -80,7 +71,7 @@ LL ~ } |
| 80 | 71 | | |
| 81 | 72 | |
| 82 | 73 | error[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 | |
| 84 | 75 | | |
| 85 | 76 | LL | match res_u32_never { |
| 86 | 77 | | ^^^^^^^^^^^^^ pattern `Ok(1_u32..=u32::MAX)` not covered |
| ... | ... | @@ -98,7 +89,7 @@ LL ~ Ok(1_u32..=u32::MAX) => todo!() |
| 98 | 89 | | |
| 99 | 90 | |
| 100 | 91 | error[E0005]: refutable pattern in local binding |
| 101 | --> $DIR/empty-types.rs:101:9 | |
| 92 | --> $DIR/empty-types.rs:100:9 | |
| 102 | 93 | | |
| 103 | 94 | LL | let Ok(_x) = res_u32_never.as_ref(); |
| 104 | 95 | | ^^^^^^ pattern `Err(_)` not covered |
| ... | ... | @@ -112,7 +103,7 @@ LL | let Ok(_x) = res_u32_never.as_ref() else { todo!() }; |
| 112 | 103 | | ++++++++++++++++ |
| 113 | 104 | |
| 114 | 105 | error[E0005]: refutable pattern in local binding |
| 115 | --> $DIR/empty-types.rs:105:9 | |
| 106 | --> $DIR/empty-types.rs:104:9 | |
| 116 | 107 | | |
| 117 | 108 | LL | let Ok(_x) = &res_u32_never; |
| 118 | 109 | | ^^^^^^ pattern `&Err(!)` not covered |
| ... | ... | @@ -126,7 +117,7 @@ LL | let Ok(_x) = &res_u32_never else { todo!() }; |
| 126 | 117 | | ++++++++++++++++ |
| 127 | 118 | |
| 128 | 119 | error: unreachable pattern |
| 129 | --> $DIR/empty-types.rs:131:13 | |
| 120 | --> $DIR/empty-types.rs:130:13 | |
| 130 | 121 | | |
| 131 | 122 | LL | _ => {} |
| 132 | 123 | | ^------ |
| ... | ... | @@ -137,7 +128,7 @@ LL | _ => {} |
| 137 | 128 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 138 | 129 | |
| 139 | 130 | error: unreachable pattern |
| 140 | --> $DIR/empty-types.rs:134:13 | |
| 131 | --> $DIR/empty-types.rs:133:13 | |
| 141 | 132 | | |
| 142 | 133 | LL | _ if false => {} |
| 143 | 134 | | ^--------------- |
| ... | ... | @@ -148,7 +139,7 @@ LL | _ if false => {} |
| 148 | 139 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 149 | 140 | |
| 150 | 141 | error[E0004]: non-exhaustive patterns: `Some(!)` not covered |
| 151 | --> $DIR/empty-types.rs:155:15 | |
| 142 | --> $DIR/empty-types.rs:154:15 | |
| 152 | 143 | | |
| 153 | 144 | LL | match *ref_opt_void { |
| 154 | 145 | | ^^^^^^^^^^^^^ pattern `Some(!)` not covered |
| ... | ... | @@ -167,7 +158,7 @@ LL + Some(!) |
| 167 | 158 | | |
| 168 | 159 | |
| 169 | 160 | error: unreachable pattern |
| 170 | --> $DIR/empty-types.rs:198:13 | |
| 161 | --> $DIR/empty-types.rs:197:13 | |
| 171 | 162 | | |
| 172 | 163 | LL | _ => {} |
| 173 | 164 | | ^------ |
| ... | ... | @@ -178,7 +169,7 @@ LL | _ => {} |
| 178 | 169 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 179 | 170 | |
| 180 | 171 | error: unreachable pattern |
| 181 | --> $DIR/empty-types.rs:203:13 | |
| 172 | --> $DIR/empty-types.rs:202:13 | |
| 182 | 173 | | |
| 183 | 174 | LL | _ => {} |
| 184 | 175 | | ^------ |
| ... | ... | @@ -189,7 +180,7 @@ LL | _ => {} |
| 189 | 180 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 190 | 181 | |
| 191 | 182 | error: unreachable pattern |
| 192 | --> $DIR/empty-types.rs:208:13 | |
| 183 | --> $DIR/empty-types.rs:207:13 | |
| 193 | 184 | | |
| 194 | 185 | LL | _ => {} |
| 195 | 186 | | ^------ |
| ... | ... | @@ -200,7 +191,7 @@ LL | _ => {} |
| 200 | 191 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 201 | 192 | |
| 202 | 193 | error: unreachable pattern |
| 203 | --> $DIR/empty-types.rs:213:13 | |
| 194 | --> $DIR/empty-types.rs:212:13 | |
| 204 | 195 | | |
| 205 | 196 | LL | _ => {} |
| 206 | 197 | | ^------ |
| ... | ... | @@ -211,7 +202,7 @@ LL | _ => {} |
| 211 | 202 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 212 | 203 | |
| 213 | 204 | error: unreachable pattern |
| 214 | --> $DIR/empty-types.rs:219:13 | |
| 205 | --> $DIR/empty-types.rs:218:13 | |
| 215 | 206 | | |
| 216 | 207 | LL | _ => {} |
| 217 | 208 | | ^------ |
| ... | ... | @@ -222,7 +213,7 @@ LL | _ => {} |
| 222 | 213 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 223 | 214 | |
| 224 | 215 | error: unreachable pattern |
| 225 | --> $DIR/empty-types.rs:280:9 | |
| 216 | --> $DIR/empty-types.rs:279:9 | |
| 226 | 217 | | |
| 227 | 218 | LL | _ => {} |
| 228 | 219 | | ^------ |
| ... | ... | @@ -233,7 +224,7 @@ LL | _ => {} |
| 233 | 224 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 234 | 225 | |
| 235 | 226 | error[E0005]: refutable pattern in local binding |
| 236 | --> $DIR/empty-types.rs:296:13 | |
| 227 | --> $DIR/empty-types.rs:295:13 | |
| 237 | 228 | | |
| 238 | 229 | LL | let Ok(_) = *ptr_result_never_err; |
| 239 | 230 | | ^^^^^ pattern `Err(!)` not covered |
| ... | ... | @@ -247,7 +238,7 @@ LL | if let Ok(_) = *ptr_result_never_err { todo!() }; |
| 247 | 238 | | ++ +++++++++++ |
| 248 | 239 | |
| 249 | 240 | error[E0004]: non-exhaustive patterns: type `(u32, !)` is non-empty |
| 250 | --> $DIR/empty-types.rs:315:11 | |
| 241 | --> $DIR/empty-types.rs:314:11 | |
| 251 | 242 | | |
| 252 | 243 | LL | match *x {} |
| 253 | 244 | | ^^ |
| ... | ... | @@ -261,7 +252,7 @@ LL ~ } |
| 261 | 252 | | |
| 262 | 253 | |
| 263 | 254 | error[E0004]: non-exhaustive patterns: type `(!, !)` is non-empty |
| 264 | --> $DIR/empty-types.rs:317:11 | |
| 255 | --> $DIR/empty-types.rs:316:11 | |
| 265 | 256 | | |
| 266 | 257 | LL | match *x {} |
| 267 | 258 | | ^^ |
| ... | ... | @@ -275,7 +266,7 @@ LL ~ } |
| 275 | 266 | | |
| 276 | 267 | |
| 277 | 268 | error[E0004]: non-exhaustive patterns: `Ok(!)` and `Err(!)` not covered |
| 278 | --> $DIR/empty-types.rs:319:11 | |
| 269 | --> $DIR/empty-types.rs:318:11 | |
| 279 | 270 | | |
| 280 | 271 | LL | match *x {} |
| 281 | 272 | | ^^ patterns `Ok(!)` and `Err(!)` not covered |
| ... | ... | @@ -297,7 +288,7 @@ LL ~ } |
| 297 | 288 | | |
| 298 | 289 | |
| 299 | 290 | error[E0004]: non-exhaustive patterns: type `[!; 3]` is non-empty |
| 300 | --> $DIR/empty-types.rs:321:11 | |
| 291 | --> $DIR/empty-types.rs:320:11 | |
| 301 | 292 | | |
| 302 | 293 | LL | match *x {} |
| 303 | 294 | | ^^ |
| ... | ... | @@ -311,7 +302,7 @@ LL ~ } |
| 311 | 302 | | |
| 312 | 303 | |
| 313 | 304 | error[E0004]: non-exhaustive patterns: type `&[!]` is non-empty |
| 314 | --> $DIR/empty-types.rs:326:11 | |
| 305 | --> $DIR/empty-types.rs:325:11 | |
| 315 | 306 | | |
| 316 | 307 | LL | match slice_never {} |
| 317 | 308 | | ^^^^^^^^^^^ |
| ... | ... | @@ -325,7 +316,7 @@ LL ~ } |
| 325 | 316 | | |
| 326 | 317 | |
| 327 | 318 | error[E0004]: non-exhaustive patterns: `&[!, ..]` not covered |
| 328 | --> $DIR/empty-types.rs:328:11 | |
| 319 | --> $DIR/empty-types.rs:327:11 | |
| 329 | 320 | | |
| 330 | 321 | LL | match slice_never { |
| 331 | 322 | | ^^^^^^^^^^^ pattern `&[!, ..]` not covered |
| ... | ... | @@ -339,7 +330,7 @@ LL + &[!, ..] |
| 339 | 330 | | |
| 340 | 331 | |
| 341 | 332 | error[E0004]: non-exhaustive patterns: `&[]`, `&[!]` and `&[!, !]` not covered |
| 342 | --> $DIR/empty-types.rs:337:11 | |
| 333 | --> $DIR/empty-types.rs:336:11 | |
| 343 | 334 | | |
| 344 | 335 | LL | match slice_never { |
| 345 | 336 | | ^^^^^^^^^^^ patterns `&[]`, `&[!]` and `&[!, !]` not covered |
| ... | ... | @@ -352,7 +343,7 @@ LL + &[] | &[!] | &[!, !] => todo!() |
| 352 | 343 | | |
| 353 | 344 | |
| 354 | 345 | error[E0004]: non-exhaustive patterns: `&[]` and `&[!, ..]` not covered |
| 355 | --> $DIR/empty-types.rs:351:11 | |
| 346 | --> $DIR/empty-types.rs:350:11 | |
| 356 | 347 | | |
| 357 | 348 | LL | match slice_never { |
| 358 | 349 | | ^^^^^^^^^^^ patterns `&[]` and `&[!, ..]` not covered |
| ... | ... | @@ -366,7 +357,7 @@ LL + &[] | &[!, ..] => todo!() |
| 366 | 357 | | |
| 367 | 358 | |
| 368 | 359 | error[E0004]: non-exhaustive patterns: type `[!]` is non-empty |
| 369 | --> $DIR/empty-types.rs:358:11 | |
| 360 | --> $DIR/empty-types.rs:357:11 | |
| 370 | 361 | | |
| 371 | 362 | LL | match *slice_never {} |
| 372 | 363 | | ^^^^^^^^^^^^ |
| ... | ... | @@ -380,7 +371,7 @@ LL ~ } |
| 380 | 371 | | |
| 381 | 372 | |
| 382 | 373 | error[E0004]: non-exhaustive patterns: type `[!; 0]` is non-empty |
| 383 | --> $DIR/empty-types.rs:387:11 | |
| 374 | --> $DIR/empty-types.rs:386:11 | |
| 384 | 375 | | |
| 385 | 376 | LL | match array_0_never {} |
| 386 | 377 | | ^^^^^^^^^^^^^ |
| ... | ... | @@ -394,7 +385,7 @@ LL ~ } |
| 394 | 385 | | |
| 395 | 386 | |
| 396 | 387 | error: unreachable pattern |
| 397 | --> $DIR/empty-types.rs:394:9 | |
| 388 | --> $DIR/empty-types.rs:393:9 | |
| 398 | 389 | | |
| 399 | 390 | LL | [] => {} |
| 400 | 391 | | -- matches all the relevant values |
| ... | ... | @@ -402,7 +393,7 @@ LL | _ => {} |
| 402 | 393 | | ^ no value can reach this |
| 403 | 394 | |
| 404 | 395 | error[E0004]: non-exhaustive patterns: `[]` not covered |
| 405 | --> $DIR/empty-types.rs:396:11 | |
| 396 | --> $DIR/empty-types.rs:395:11 | |
| 406 | 397 | | |
| 407 | 398 | LL | match array_0_never { |
| 408 | 399 | | ^^^^^^^^^^^^^ pattern `[]` not covered |
| ... | ... | @@ -416,7 +407,7 @@ LL + [] => todo!() |
| 416 | 407 | | |
| 417 | 408 | |
| 418 | 409 | error[E0004]: non-exhaustive patterns: `&Some(!)` not covered |
| 419 | --> $DIR/empty-types.rs:450:11 | |
| 410 | --> $DIR/empty-types.rs:449:11 | |
| 420 | 411 | | |
| 421 | 412 | LL | match ref_opt_never { |
| 422 | 413 | | ^^^^^^^^^^^^^ pattern `&Some(!)` not covered |
| ... | ... | @@ -435,7 +426,7 @@ LL + &Some(!) |
| 435 | 426 | | |
| 436 | 427 | |
| 437 | 428 | error[E0004]: non-exhaustive patterns: `Some(!)` not covered |
| 438 | --> $DIR/empty-types.rs:491:11 | |
| 429 | --> $DIR/empty-types.rs:490:11 | |
| 439 | 430 | | |
| 440 | 431 | LL | match *ref_opt_never { |
| 441 | 432 | | ^^^^^^^^^^^^^^ pattern `Some(!)` not covered |
| ... | ... | @@ -454,7 +445,7 @@ LL + Some(!) |
| 454 | 445 | | |
| 455 | 446 | |
| 456 | 447 | error[E0004]: non-exhaustive patterns: `Err(!)` not covered |
| 457 | --> $DIR/empty-types.rs:539:11 | |
| 448 | --> $DIR/empty-types.rs:538:11 | |
| 458 | 449 | | |
| 459 | 450 | LL | match *ref_res_never { |
| 460 | 451 | | ^^^^^^^^^^^^^^ pattern `Err(!)` not covered |
| ... | ... | @@ -473,7 +464,7 @@ LL + Err(!) |
| 473 | 464 | | |
| 474 | 465 | |
| 475 | 466 | error[E0004]: non-exhaustive patterns: `Err(!)` not covered |
| 476 | --> $DIR/empty-types.rs:550:11 | |
| 467 | --> $DIR/empty-types.rs:549:11 | |
| 477 | 468 | | |
| 478 | 469 | LL | match *ref_res_never { |
| 479 | 470 | | ^^^^^^^^^^^^^^ pattern `Err(!)` not covered |
| ... | ... | @@ -492,7 +483,7 @@ LL + Err(!) |
| 492 | 483 | | |
| 493 | 484 | |
| 494 | 485 | error[E0004]: non-exhaustive patterns: type `(u32, !)` is non-empty |
| 495 | --> $DIR/empty-types.rs:569:11 | |
| 486 | --> $DIR/empty-types.rs:568:11 | |
| 496 | 487 | | |
| 497 | 488 | LL | match *ref_tuple_half_never {} |
| 498 | 489 | | ^^^^^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -506,7 +497,7 @@ LL ~ } |
| 506 | 497 | | |
| 507 | 498 | |
| 508 | 499 | error: unreachable pattern |
| 509 | --> $DIR/empty-types.rs:602:9 | |
| 500 | --> $DIR/empty-types.rs:601:9 | |
| 510 | 501 | | |
| 511 | 502 | LL | _ => {} |
| 512 | 503 | | ^------ |
| ... | ... | @@ -517,7 +508,7 @@ LL | _ => {} |
| 517 | 508 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 518 | 509 | |
| 519 | 510 | error: unreachable pattern |
| 520 | --> $DIR/empty-types.rs:605:9 | |
| 511 | --> $DIR/empty-types.rs:604:9 | |
| 521 | 512 | | |
| 522 | 513 | LL | _x => {} |
| 523 | 514 | | ^^------ |
| ... | ... | @@ -528,7 +519,7 @@ LL | _x => {} |
| 528 | 519 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 529 | 520 | |
| 530 | 521 | error: unreachable pattern |
| 531 | --> $DIR/empty-types.rs:608:9 | |
| 522 | --> $DIR/empty-types.rs:607:9 | |
| 532 | 523 | | |
| 533 | 524 | LL | _ if false => {} |
| 534 | 525 | | ^--------------- |
| ... | ... | @@ -539,7 +530,7 @@ LL | _ if false => {} |
| 539 | 530 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 540 | 531 | |
| 541 | 532 | error: unreachable pattern |
| 542 | --> $DIR/empty-types.rs:611:9 | |
| 533 | --> $DIR/empty-types.rs:610:9 | |
| 543 | 534 | | |
| 544 | 535 | LL | _x if false => {} |
| 545 | 536 | | ^^--------------- |
| ... | ... | @@ -550,7 +541,7 @@ LL | _x if false => {} |
| 550 | 541 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 551 | 542 | |
| 552 | 543 | error[E0004]: non-exhaustive patterns: `&!` not covered |
| 553 | --> $DIR/empty-types.rs:636:11 | |
| 544 | --> $DIR/empty-types.rs:635:11 | |
| 554 | 545 | | |
| 555 | 546 | LL | match ref_never { |
| 556 | 547 | | ^^^^^^^^^ pattern `&!` not covered |
| ... | ... | @@ -566,7 +557,7 @@ LL + &! |
| 566 | 557 | | |
| 567 | 558 | |
| 568 | 559 | error[E0004]: non-exhaustive patterns: `Ok(!)` not covered |
| 569 | --> $DIR/empty-types.rs:652:11 | |
| 560 | --> $DIR/empty-types.rs:651:11 | |
| 570 | 561 | | |
| 571 | 562 | LL | match *ref_result_never { |
| 572 | 563 | | ^^^^^^^^^^^^^^^^^ pattern `Ok(!)` not covered |
| ... | ... | @@ -585,7 +576,7 @@ LL + Ok(!) |
| 585 | 576 | | |
| 586 | 577 | |
| 587 | 578 | error[E0004]: non-exhaustive patterns: `Some(!)` not covered |
| 588 | --> $DIR/empty-types.rs:672:11 | |
| 579 | --> $DIR/empty-types.rs:671:11 | |
| 589 | 580 | | |
| 590 | 581 | LL | match *x { |
| 591 | 582 | | ^^ pattern `Some(!)` not covered |
| ... | ... | @@ -603,7 +594,7 @@ LL ~ None => {}, |
| 603 | 594 | LL + Some(!) |
| 604 | 595 | | |
| 605 | 596 | |
| 606 | error: aborting due to 42 previous errors; 1 warning emitted | |
| 597 | error: aborting due to 42 previous errors | |
| 607 | 598 | |
| 608 | 599 | Some errors have detailed explanations: E0004, E0005. |
| 609 | 600 | For more information about an error, try `rustc --explain E0004`. |
tests/ui/pattern/usefulness/empty-types.normal.stderr+43-43| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | error: unreachable pattern |
| 2 | --> $DIR/empty-types.rs:48:9 | |
| 2 | --> $DIR/empty-types.rs:47:9 | |
| 3 | 3 | | |
| 4 | 4 | LL | _ => {} |
| 5 | 5 | | ^------ |
| ... | ... | @@ -9,13 +9,13 @@ LL | _ => {} |
| 9 | 9 | | |
| 10 | 10 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 11 | 11 | note: the lint level is defined here |
| 12 | --> $DIR/empty-types.rs:14:9 | |
| 12 | --> $DIR/empty-types.rs:13:9 | |
| 13 | 13 | | |
| 14 | 14 | LL | #![deny(unreachable_patterns)] |
| 15 | 15 | | ^^^^^^^^^^^^^^^^^^^^ |
| 16 | 16 | |
| 17 | 17 | error: unreachable pattern |
| 18 | --> $DIR/empty-types.rs:51:9 | |
| 18 | --> $DIR/empty-types.rs:50:9 | |
| 19 | 19 | | |
| 20 | 20 | LL | _x => {} |
| 21 | 21 | | ^^------ |
| ... | ... | @@ -26,7 +26,7 @@ LL | _x => {} |
| 26 | 26 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 27 | 27 | |
| 28 | 28 | error[E0004]: non-exhaustive patterns: type `&!` is non-empty |
| 29 | --> $DIR/empty-types.rs:55:11 | |
| 29 | --> $DIR/empty-types.rs:54:11 | |
| 30 | 30 | | |
| 31 | 31 | LL | match ref_never {} |
| 32 | 32 | | ^^^^^^^^^ |
| ... | ... | @@ -41,7 +41,7 @@ LL ~ } |
| 41 | 41 | | |
| 42 | 42 | |
| 43 | 43 | error: unreachable pattern |
| 44 | --> $DIR/empty-types.rs:82:9 | |
| 44 | --> $DIR/empty-types.rs:81:9 | |
| 45 | 45 | | |
| 46 | 46 | LL | _ => {} |
| 47 | 47 | | ^------ |
| ... | ... | @@ -52,7 +52,7 @@ LL | _ => {} |
| 52 | 52 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 53 | 53 | |
| 54 | 54 | error[E0004]: non-exhaustive patterns: `Ok(_)` not covered |
| 55 | --> $DIR/empty-types.rs:86:11 | |
| 55 | --> $DIR/empty-types.rs:85:11 | |
| 56 | 56 | | |
| 57 | 57 | LL | match res_u32_never {} |
| 58 | 58 | | ^^^^^^^^^^^^^ pattern `Ok(_)` not covered |
| ... | ... | @@ -71,7 +71,7 @@ LL ~ } |
| 71 | 71 | | |
| 72 | 72 | |
| 73 | 73 | error[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 | |
| 75 | 75 | | |
| 76 | 76 | LL | match res_u32_never { |
| 77 | 77 | | ^^^^^^^^^^^^^ pattern `Ok(1_u32..=u32::MAX)` not covered |
| ... | ... | @@ -89,7 +89,7 @@ LL ~ Ok(1_u32..=u32::MAX) => todo!() |
| 89 | 89 | | |
| 90 | 90 | |
| 91 | 91 | error[E0005]: refutable pattern in local binding |
| 92 | --> $DIR/empty-types.rs:101:9 | |
| 92 | --> $DIR/empty-types.rs:100:9 | |
| 93 | 93 | | |
| 94 | 94 | LL | let Ok(_x) = res_u32_never.as_ref(); |
| 95 | 95 | | ^^^^^^ pattern `Err(_)` not covered |
| ... | ... | @@ -103,7 +103,7 @@ LL | let Ok(_x) = res_u32_never.as_ref() else { todo!() }; |
| 103 | 103 | | ++++++++++++++++ |
| 104 | 104 | |
| 105 | 105 | error[E0005]: refutable pattern in local binding |
| 106 | --> $DIR/empty-types.rs:105:9 | |
| 106 | --> $DIR/empty-types.rs:104:9 | |
| 107 | 107 | | |
| 108 | 108 | LL | let Ok(_x) = &res_u32_never; |
| 109 | 109 | | ^^^^^^ pattern `&Err(_)` not covered |
| ... | ... | @@ -117,7 +117,7 @@ LL | let Ok(_x) = &res_u32_never else { todo!() }; |
| 117 | 117 | | ++++++++++++++++ |
| 118 | 118 | |
| 119 | 119 | error: unreachable pattern |
| 120 | --> $DIR/empty-types.rs:131:13 | |
| 120 | --> $DIR/empty-types.rs:130:13 | |
| 121 | 121 | | |
| 122 | 122 | LL | _ => {} |
| 123 | 123 | | ^------ |
| ... | ... | @@ -128,7 +128,7 @@ LL | _ => {} |
| 128 | 128 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 129 | 129 | |
| 130 | 130 | error: unreachable pattern |
| 131 | --> $DIR/empty-types.rs:134:13 | |
| 131 | --> $DIR/empty-types.rs:133:13 | |
| 132 | 132 | | |
| 133 | 133 | LL | _ if false => {} |
| 134 | 134 | | ^--------------- |
| ... | ... | @@ -139,7 +139,7 @@ LL | _ if false => {} |
| 139 | 139 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 140 | 140 | |
| 141 | 141 | error[E0004]: non-exhaustive patterns: `Some(_)` not covered |
| 142 | --> $DIR/empty-types.rs:155:15 | |
| 142 | --> $DIR/empty-types.rs:154:15 | |
| 143 | 143 | | |
| 144 | 144 | LL | match *ref_opt_void { |
| 145 | 145 | | ^^^^^^^^^^^^^ pattern `Some(_)` not covered |
| ... | ... | @@ -158,7 +158,7 @@ LL + Some(_) => todo!() |
| 158 | 158 | | |
| 159 | 159 | |
| 160 | 160 | error: unreachable pattern |
| 161 | --> $DIR/empty-types.rs:198:13 | |
| 161 | --> $DIR/empty-types.rs:197:13 | |
| 162 | 162 | | |
| 163 | 163 | LL | _ => {} |
| 164 | 164 | | ^------ |
| ... | ... | @@ -169,7 +169,7 @@ LL | _ => {} |
| 169 | 169 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 170 | 170 | |
| 171 | 171 | error: unreachable pattern |
| 172 | --> $DIR/empty-types.rs:203:13 | |
| 172 | --> $DIR/empty-types.rs:202:13 | |
| 173 | 173 | | |
| 174 | 174 | LL | _ => {} |
| 175 | 175 | | ^------ |
| ... | ... | @@ -180,7 +180,7 @@ LL | _ => {} |
| 180 | 180 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 181 | 181 | |
| 182 | 182 | error: unreachable pattern |
| 183 | --> $DIR/empty-types.rs:208:13 | |
| 183 | --> $DIR/empty-types.rs:207:13 | |
| 184 | 184 | | |
| 185 | 185 | LL | _ => {} |
| 186 | 186 | | ^------ |
| ... | ... | @@ -191,7 +191,7 @@ LL | _ => {} |
| 191 | 191 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 192 | 192 | |
| 193 | 193 | error: unreachable pattern |
| 194 | --> $DIR/empty-types.rs:213:13 | |
| 194 | --> $DIR/empty-types.rs:212:13 | |
| 195 | 195 | | |
| 196 | 196 | LL | _ => {} |
| 197 | 197 | | ^------ |
| ... | ... | @@ -202,7 +202,7 @@ LL | _ => {} |
| 202 | 202 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 203 | 203 | |
| 204 | 204 | error: unreachable pattern |
| 205 | --> $DIR/empty-types.rs:219:13 | |
| 205 | --> $DIR/empty-types.rs:218:13 | |
| 206 | 206 | | |
| 207 | 207 | LL | _ => {} |
| 208 | 208 | | ^------ |
| ... | ... | @@ -213,7 +213,7 @@ LL | _ => {} |
| 213 | 213 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 214 | 214 | |
| 215 | 215 | error: unreachable pattern |
| 216 | --> $DIR/empty-types.rs:280:9 | |
| 216 | --> $DIR/empty-types.rs:279:9 | |
| 217 | 217 | | |
| 218 | 218 | LL | _ => {} |
| 219 | 219 | | ^------ |
| ... | ... | @@ -224,7 +224,7 @@ LL | _ => {} |
| 224 | 224 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 225 | 225 | |
| 226 | 226 | error[E0005]: refutable pattern in local binding |
| 227 | --> $DIR/empty-types.rs:296:13 | |
| 227 | --> $DIR/empty-types.rs:295:13 | |
| 228 | 228 | | |
| 229 | 229 | LL | let Ok(_) = *ptr_result_never_err; |
| 230 | 230 | | ^^^^^ pattern `Err(_)` not covered |
| ... | ... | @@ -238,7 +238,7 @@ LL | if let Ok(_) = *ptr_result_never_err { todo!() }; |
| 238 | 238 | | ++ +++++++++++ |
| 239 | 239 | |
| 240 | 240 | error[E0004]: non-exhaustive patterns: type `(u32, !)` is non-empty |
| 241 | --> $DIR/empty-types.rs:315:11 | |
| 241 | --> $DIR/empty-types.rs:314:11 | |
| 242 | 242 | | |
| 243 | 243 | LL | match *x {} |
| 244 | 244 | | ^^ |
| ... | ... | @@ -252,7 +252,7 @@ LL ~ } |
| 252 | 252 | | |
| 253 | 253 | |
| 254 | 254 | error[E0004]: non-exhaustive patterns: type `(!, !)` is non-empty |
| 255 | --> $DIR/empty-types.rs:317:11 | |
| 255 | --> $DIR/empty-types.rs:316:11 | |
| 256 | 256 | | |
| 257 | 257 | LL | match *x {} |
| 258 | 258 | | ^^ |
| ... | ... | @@ -266,7 +266,7 @@ LL ~ } |
| 266 | 266 | | |
| 267 | 267 | |
| 268 | 268 | error[E0004]: non-exhaustive patterns: `Ok(_)` and `Err(_)` not covered |
| 269 | --> $DIR/empty-types.rs:319:11 | |
| 269 | --> $DIR/empty-types.rs:318:11 | |
| 270 | 270 | | |
| 271 | 271 | LL | match *x {} |
| 272 | 272 | | ^^ patterns `Ok(_)` and `Err(_)` not covered |
| ... | ... | @@ -288,7 +288,7 @@ LL ~ } |
| 288 | 288 | | |
| 289 | 289 | |
| 290 | 290 | error[E0004]: non-exhaustive patterns: type `[!; 3]` is non-empty |
| 291 | --> $DIR/empty-types.rs:321:11 | |
| 291 | --> $DIR/empty-types.rs:320:11 | |
| 292 | 292 | | |
| 293 | 293 | LL | match *x {} |
| 294 | 294 | | ^^ |
| ... | ... | @@ -302,7 +302,7 @@ LL ~ } |
| 302 | 302 | | |
| 303 | 303 | |
| 304 | 304 | error[E0004]: non-exhaustive patterns: type `&[!]` is non-empty |
| 305 | --> $DIR/empty-types.rs:326:11 | |
| 305 | --> $DIR/empty-types.rs:325:11 | |
| 306 | 306 | | |
| 307 | 307 | LL | match slice_never {} |
| 308 | 308 | | ^^^^^^^^^^^ |
| ... | ... | @@ -316,7 +316,7 @@ LL ~ } |
| 316 | 316 | | |
| 317 | 317 | |
| 318 | 318 | error[E0004]: non-exhaustive patterns: `&[_, ..]` not covered |
| 319 | --> $DIR/empty-types.rs:328:11 | |
| 319 | --> $DIR/empty-types.rs:327:11 | |
| 320 | 320 | | |
| 321 | 321 | LL | match slice_never { |
| 322 | 322 | | ^^^^^^^^^^^ pattern `&[_, ..]` not covered |
| ... | ... | @@ -330,7 +330,7 @@ LL + &[_, ..] => todo!() |
| 330 | 330 | | |
| 331 | 331 | |
| 332 | 332 | error[E0004]: non-exhaustive patterns: `&[]`, `&[_]` and `&[_, _]` not covered |
| 333 | --> $DIR/empty-types.rs:337:11 | |
| 333 | --> $DIR/empty-types.rs:336:11 | |
| 334 | 334 | | |
| 335 | 335 | LL | match slice_never { |
| 336 | 336 | | ^^^^^^^^^^^ patterns `&[]`, `&[_]` and `&[_, _]` not covered |
| ... | ... | @@ -343,7 +343,7 @@ LL + &[] | &[_] | &[_, _] => todo!() |
| 343 | 343 | | |
| 344 | 344 | |
| 345 | 345 | error[E0004]: non-exhaustive patterns: `&[]` and `&[_, ..]` not covered |
| 346 | --> $DIR/empty-types.rs:351:11 | |
| 346 | --> $DIR/empty-types.rs:350:11 | |
| 347 | 347 | | |
| 348 | 348 | LL | match slice_never { |
| 349 | 349 | | ^^^^^^^^^^^ patterns `&[]` and `&[_, ..]` not covered |
| ... | ... | @@ -357,7 +357,7 @@ LL + &[] | &[_, ..] => todo!() |
| 357 | 357 | | |
| 358 | 358 | |
| 359 | 359 | error[E0004]: non-exhaustive patterns: type `[!]` is non-empty |
| 360 | --> $DIR/empty-types.rs:358:11 | |
| 360 | --> $DIR/empty-types.rs:357:11 | |
| 361 | 361 | | |
| 362 | 362 | LL | match *slice_never {} |
| 363 | 363 | | ^^^^^^^^^^^^ |
| ... | ... | @@ -371,7 +371,7 @@ LL ~ } |
| 371 | 371 | | |
| 372 | 372 | |
| 373 | 373 | error[E0004]: non-exhaustive patterns: type `[!; 0]` is non-empty |
| 374 | --> $DIR/empty-types.rs:387:11 | |
| 374 | --> $DIR/empty-types.rs:386:11 | |
| 375 | 375 | | |
| 376 | 376 | LL | match array_0_never {} |
| 377 | 377 | | ^^^^^^^^^^^^^ |
| ... | ... | @@ -385,7 +385,7 @@ LL ~ } |
| 385 | 385 | | |
| 386 | 386 | |
| 387 | 387 | error: unreachable pattern |
| 388 | --> $DIR/empty-types.rs:394:9 | |
| 388 | --> $DIR/empty-types.rs:393:9 | |
| 389 | 389 | | |
| 390 | 390 | LL | [] => {} |
| 391 | 391 | | -- matches all the relevant values |
| ... | ... | @@ -393,7 +393,7 @@ LL | _ => {} |
| 393 | 393 | | ^ no value can reach this |
| 394 | 394 | |
| 395 | 395 | error[E0004]: non-exhaustive patterns: `[]` not covered |
| 396 | --> $DIR/empty-types.rs:396:11 | |
| 396 | --> $DIR/empty-types.rs:395:11 | |
| 397 | 397 | | |
| 398 | 398 | LL | match array_0_never { |
| 399 | 399 | | ^^^^^^^^^^^^^ pattern `[]` not covered |
| ... | ... | @@ -407,7 +407,7 @@ LL + [] => todo!() |
| 407 | 407 | | |
| 408 | 408 | |
| 409 | 409 | error[E0004]: non-exhaustive patterns: `&Some(_)` not covered |
| 410 | --> $DIR/empty-types.rs:450:11 | |
| 410 | --> $DIR/empty-types.rs:449:11 | |
| 411 | 411 | | |
| 412 | 412 | LL | match ref_opt_never { |
| 413 | 413 | | ^^^^^^^^^^^^^ pattern `&Some(_)` not covered |
| ... | ... | @@ -426,7 +426,7 @@ LL + &Some(_) => todo!() |
| 426 | 426 | | |
| 427 | 427 | |
| 428 | 428 | error[E0004]: non-exhaustive patterns: `Some(_)` not covered |
| 429 | --> $DIR/empty-types.rs:491:11 | |
| 429 | --> $DIR/empty-types.rs:490:11 | |
| 430 | 430 | | |
| 431 | 431 | LL | match *ref_opt_never { |
| 432 | 432 | | ^^^^^^^^^^^^^^ pattern `Some(_)` not covered |
| ... | ... | @@ -445,7 +445,7 @@ LL + Some(_) => todo!() |
| 445 | 445 | | |
| 446 | 446 | |
| 447 | 447 | error[E0004]: non-exhaustive patterns: `Err(_)` not covered |
| 448 | --> $DIR/empty-types.rs:539:11 | |
| 448 | --> $DIR/empty-types.rs:538:11 | |
| 449 | 449 | | |
| 450 | 450 | LL | match *ref_res_never { |
| 451 | 451 | | ^^^^^^^^^^^^^^ pattern `Err(_)` not covered |
| ... | ... | @@ -464,7 +464,7 @@ LL + Err(_) => todo!() |
| 464 | 464 | | |
| 465 | 465 | |
| 466 | 466 | error[E0004]: non-exhaustive patterns: `Err(_)` not covered |
| 467 | --> $DIR/empty-types.rs:550:11 | |
| 467 | --> $DIR/empty-types.rs:549:11 | |
| 468 | 468 | | |
| 469 | 469 | LL | match *ref_res_never { |
| 470 | 470 | | ^^^^^^^^^^^^^^ pattern `Err(_)` not covered |
| ... | ... | @@ -483,7 +483,7 @@ LL + Err(_) => todo!() |
| 483 | 483 | | |
| 484 | 484 | |
| 485 | 485 | error[E0004]: non-exhaustive patterns: type `(u32, !)` is non-empty |
| 486 | --> $DIR/empty-types.rs:569:11 | |
| 486 | --> $DIR/empty-types.rs:568:11 | |
| 487 | 487 | | |
| 488 | 488 | LL | match *ref_tuple_half_never {} |
| 489 | 489 | | ^^^^^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -497,7 +497,7 @@ LL ~ } |
| 497 | 497 | | |
| 498 | 498 | |
| 499 | 499 | error: unreachable pattern |
| 500 | --> $DIR/empty-types.rs:602:9 | |
| 500 | --> $DIR/empty-types.rs:601:9 | |
| 501 | 501 | | |
| 502 | 502 | LL | _ => {} |
| 503 | 503 | | ^------ |
| ... | ... | @@ -508,7 +508,7 @@ LL | _ => {} |
| 508 | 508 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 509 | 509 | |
| 510 | 510 | error: unreachable pattern |
| 511 | --> $DIR/empty-types.rs:605:9 | |
| 511 | --> $DIR/empty-types.rs:604:9 | |
| 512 | 512 | | |
| 513 | 513 | LL | _x => {} |
| 514 | 514 | | ^^------ |
| ... | ... | @@ -519,7 +519,7 @@ LL | _x => {} |
| 519 | 519 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 520 | 520 | |
| 521 | 521 | error: unreachable pattern |
| 522 | --> $DIR/empty-types.rs:608:9 | |
| 522 | --> $DIR/empty-types.rs:607:9 | |
| 523 | 523 | | |
| 524 | 524 | LL | _ if false => {} |
| 525 | 525 | | ^--------------- |
| ... | ... | @@ -530,7 +530,7 @@ LL | _ if false => {} |
| 530 | 530 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 531 | 531 | |
| 532 | 532 | error: unreachable pattern |
| 533 | --> $DIR/empty-types.rs:611:9 | |
| 533 | --> $DIR/empty-types.rs:610:9 | |
| 534 | 534 | | |
| 535 | 535 | LL | _x if false => {} |
| 536 | 536 | | ^^--------------- |
| ... | ... | @@ -541,7 +541,7 @@ LL | _x if false => {} |
| 541 | 541 | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types |
| 542 | 542 | |
| 543 | 543 | error[E0004]: non-exhaustive patterns: `&_` not covered |
| 544 | --> $DIR/empty-types.rs:636:11 | |
| 544 | --> $DIR/empty-types.rs:635:11 | |
| 545 | 545 | | |
| 546 | 546 | LL | match ref_never { |
| 547 | 547 | | ^^^^^^^^^ pattern `&_` not covered |
| ... | ... | @@ -557,7 +557,7 @@ LL + &_ => todo!() |
| 557 | 557 | | |
| 558 | 558 | |
| 559 | 559 | error[E0004]: non-exhaustive patterns: `Ok(_)` not covered |
| 560 | --> $DIR/empty-types.rs:652:11 | |
| 560 | --> $DIR/empty-types.rs:651:11 | |
| 561 | 561 | | |
| 562 | 562 | LL | match *ref_result_never { |
| 563 | 563 | | ^^^^^^^^^^^^^^^^^ pattern `Ok(_)` not covered |
| ... | ... | @@ -576,7 +576,7 @@ LL + Ok(_) => todo!() |
| 576 | 576 | | |
| 577 | 577 | |
| 578 | 578 | error[E0004]: non-exhaustive patterns: `Some(_)` not covered |
| 579 | --> $DIR/empty-types.rs:672:11 | |
| 579 | --> $DIR/empty-types.rs:671:11 | |
| 580 | 580 | | |
| 581 | 581 | LL | match *x { |
| 582 | 582 | | ^^ pattern `Some(_)` not covered |
tests/ui/pattern/usefulness/empty-types.rs-1| ... | ... | @@ -9,7 +9,6 @@ |
| 9 | 9 | #![feature(never_type)] |
| 10 | 10 | #![cfg_attr(exhaustive_patterns, feature(exhaustive_patterns))] |
| 11 | 11 | #![cfg_attr(never_pats, feature(never_patterns))] |
| 12 | //[never_pats]~^ WARN the feature `never_patterns` is incomplete | |
| 13 | 12 | #![allow(dead_code, unreachable_code)] |
| 14 | 13 | #![deny(unreachable_patterns)] |
| 15 | 14 |
tests/ui/pin-ergonomics/coerce-non-pointer-pin.rs-1| ... | ... | @@ -1,7 +1,6 @@ |
| 1 | 1 | //@ check-pass |
| 2 | 2 | |
| 3 | 3 | #![feature(pin_ergonomics)] |
| 4 | //~^ WARN the feature `pin_ergonomics` is incomplete | |
| 5 | 4 | |
| 6 | 5 | use std::pin::Pin; |
| 7 | 6 |
tests/ui/pin-ergonomics/coerce-non-pointer-pin.stderr deleted-11| ... | ... | @@ -1,11 +0,0 @@ |
| 1 | warning: 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 | | | |
| 4 | LL | #![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 | ||
| 10 | warning: 1 warning emitted | |
| 11 |
tests/ui/privacy/private-in-public-warn.rs+6-6| ... | ... | @@ -49,10 +49,10 @@ mod traits { |
| 49 | 49 | fn f<T: PrivTr>(arg: T) {} |
| 50 | 50 | //~^ ERROR trait `traits::PrivTr` is more private than the item `traits::Tr3::f` |
| 51 | 51 | 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 | |
| 53 | 53 | //~| ERROR trait `traits::PrivTr` is more private than the item `traits::Tr3::g::{anon_assoc#0}` |
| 54 | 54 | 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 | |
| 56 | 56 | //~| ERROR trait `traits::PrivTr` is more private than the item `traits::Tr3::h::{anon_assoc#0}` |
| 57 | 57 | } |
| 58 | 58 | impl<T: PrivTr> Pub<T> {} //~ ERROR trait `traits::PrivTr` is more private than the item `traits::Pub<T>` |
| ... | ... | @@ -93,13 +93,13 @@ mod generics { |
| 93 | 93 | |
| 94 | 94 | pub trait Tr5 { |
| 95 | 95 | 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 | |
| 98 | 98 | //~| ERROR trait `generics::PrivTr<generics::Priv<()>>` is more private than the item `Tr5::required::{anon_assoc#0}` |
| 99 | 99 | //~| ERROR type `generics::Priv<()>` is more private than the item `Tr5::required::{anon_assoc#0}` |
| 100 | 100 | 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 | |
| 103 | 103 | //~| ERROR trait `generics::PrivTr<generics::Priv<()>>` is more private than the item `Tr5::provided::{anon_assoc#0}` |
| 104 | 104 | //~| ERROR type `generics::Priv<()>` is more private than the item `Tr5::provided::{anon_assoc#0}` |
| 105 | 105 | } |
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)` |
| 194 | 194 | LL | trait PrivTr {} |
| 195 | 195 | | ^^^^^^^^^^^^ |
| 196 | 196 | |
| 197 | error: trait `traits::PrivTr` is more private than the item `traits::Tr3::g::{anon_assoc#0}` | |
| 197 | error[E0446]: private trait `traits::PrivTr` in public interface | |
| 198 | 198 | --> $DIR/private-in-public-warn.rs:51:19 |
| 199 | 199 | | |
| 200 | LL | fn g() -> impl PrivTr; | |
| 201 | | ^^^^^^^^^^^ opaque type `traits::Tr3::g::{anon_assoc#0}` is reachable at visibility `pub(crate)` | |
| 202 | | | |
| 203 | note: but trait `traits::PrivTr` is only usable at visibility `pub(self)` | |
| 204 | --> $DIR/private-in-public-warn.rs:37:5 | |
| 205 | | | |
| 206 | 200 | LL | trait PrivTr {} |
| 207 | | ^^^^^^^^^^^^ | |
| 201 | | ------------ `traits::PrivTr` declared as private | |
| 202 | ... | |
| 203 | LL | fn g() -> impl PrivTr; | |
| 204 | | ^^^^^^^^^^^ can't leak private trait | |
| 208 | 205 | |
| 209 | 206 | error: trait `traits::PrivTr` is more private than the item `traits::Tr3::g::{anon_assoc#0}` |
| 210 | 207 | --> $DIR/private-in-public-warn.rs:51:19 |
| ... | ... | @@ -218,17 +215,14 @@ note: but trait `traits::PrivTr` is only usable at visibility `pub(self)` |
| 218 | 215 | LL | trait PrivTr {} |
| 219 | 216 | | ^^^^^^^^^^^^ |
| 220 | 217 | |
| 221 | error: trait `traits::PrivTr` is more private than the item `traits::Tr3::h::{anon_assoc#0}` | |
| 218 | error[E0446]: private trait `traits::PrivTr` in public interface | |
| 222 | 219 | --> $DIR/private-in-public-warn.rs:54:19 |
| 223 | 220 | | |
| 224 | LL | fn h() -> impl PrivTr {} | |
| 225 | | ^^^^^^^^^^^ opaque type `traits::Tr3::h::{anon_assoc#0}` is reachable at visibility `pub(crate)` | |
| 226 | | | |
| 227 | note: but trait `traits::PrivTr` is only usable at visibility `pub(self)` | |
| 228 | --> $DIR/private-in-public-warn.rs:37:5 | |
| 229 | | | |
| 230 | 221 | LL | trait PrivTr {} |
| 231 | | ^^^^^^^^^^^^ | |
| 222 | | ------------ `traits::PrivTr` declared as private | |
| 223 | ... | |
| 224 | LL | fn h() -> impl PrivTr {} | |
| 225 | | ^^^^^^^^^^^ can't leak private trait | |
| 232 | 226 | |
| 233 | 227 | error: trait `traits::PrivTr` is more private than the item `traits::Tr3::h::{anon_assoc#0}` |
| 234 | 228 | --> $DIR/private-in-public-warn.rs:54:19 |
| ... | ... | @@ -350,29 +344,23 @@ note: but type `generics::Priv` is only usable at visibility `pub(self)` |
| 350 | 344 | LL | struct Priv<T = u8>(T); |
| 351 | 345 | | ^^^^^^^^^^^^^^^^^^^ |
| 352 | 346 | |
| 353 | error: trait `generics::PrivTr<generics::Priv<()>>` is more private than the item `Tr5::required::{anon_assoc#0}` | |
| 347 | error[E0446]: private trait `generics::PrivTr<generics::Priv<()>>` in public interface | |
| 354 | 348 | --> $DIR/private-in-public-warn.rs:95:26 |
| 355 | 349 | | |
| 356 | LL | fn required() -> impl PrivTr<Priv<()>>; | |
| 357 | | ^^^^^^^^^^^^^^^^^^^^^ opaque type `Tr5::required::{anon_assoc#0}` is reachable at visibility `pub(crate)` | |
| 358 | | | |
| 359 | note: but trait `generics::PrivTr<generics::Priv<()>>` is only usable at visibility `pub(self)` | |
| 360 | --> $DIR/private-in-public-warn.rs:84:5 | |
| 361 | | | |
| 362 | 350 | LL | trait PrivTr<T> {} |
| 363 | | ^^^^^^^^^^^^^^^ | |
| 351 | | --------------- `generics::PrivTr<generics::Priv<()>>` declared as private | |
| 352 | ... | |
| 353 | LL | fn required() -> impl PrivTr<Priv<()>>; | |
| 354 | | ^^^^^^^^^^^^^^^^^^^^^ can't leak private trait | |
| 364 | 355 | |
| 365 | error: type `generics::Priv<()>` is more private than the item `Tr5::required::{anon_assoc#0}` | |
| 356 | error[E0446]: private type `generics::Priv<()>` in public interface | |
| 366 | 357 | --> $DIR/private-in-public-warn.rs:95:26 |
| 367 | 358 | | |
| 368 | LL | fn required() -> impl PrivTr<Priv<()>>; | |
| 369 | | ^^^^^^^^^^^^^^^^^^^^^ opaque type `Tr5::required::{anon_assoc#0}` is reachable at visibility `pub(crate)` | |
| 370 | | | |
| 371 | note: but type `generics::Priv<()>` is only usable at visibility `pub(self)` | |
| 372 | --> $DIR/private-in-public-warn.rs:82:5 | |
| 373 | | | |
| 374 | 359 | LL | struct Priv<T = u8>(T); |
| 375 | | ^^^^^^^^^^^^^^^^^^^ | |
| 360 | | ------------------- `generics::Priv<()>` declared as private | |
| 361 | ... | |
| 362 | LL | fn required() -> impl PrivTr<Priv<()>>; | |
| 363 | | ^^^^^^^^^^^^^^^^^^^^^ can't leak private type | |
| 376 | 364 | |
| 377 | 365 | error: trait `generics::PrivTr<generics::Priv<()>>` is more private than the item `Tr5::required::{anon_assoc#0}` |
| 378 | 366 | --> $DIR/private-in-public-warn.rs:95:26 |
| ... | ... | @@ -398,29 +386,23 @@ note: but type `generics::Priv<()>` is only usable at visibility `pub(self)` |
| 398 | 386 | LL | struct Priv<T = u8>(T); |
| 399 | 387 | | ^^^^^^^^^^^^^^^^^^^ |
| 400 | 388 | |
| 401 | error: trait `generics::PrivTr<generics::Priv<()>>` is more private than the item `Tr5::provided::{anon_assoc#0}` | |
| 389 | error[E0446]: private trait `generics::PrivTr<generics::Priv<()>>` in public interface | |
| 402 | 390 | --> $DIR/private-in-public-warn.rs:100:26 |
| 403 | 391 | | |
| 404 | LL | fn provided() -> impl PrivTr<Priv<()>> {} | |
| 405 | | ^^^^^^^^^^^^^^^^^^^^^ opaque type `Tr5::provided::{anon_assoc#0}` is reachable at visibility `pub(crate)` | |
| 406 | | | |
| 407 | note: but trait `generics::PrivTr<generics::Priv<()>>` is only usable at visibility `pub(self)` | |
| 408 | --> $DIR/private-in-public-warn.rs:84:5 | |
| 409 | | | |
| 410 | 392 | LL | trait PrivTr<T> {} |
| 411 | | ^^^^^^^^^^^^^^^ | |
| 393 | | --------------- `generics::PrivTr<generics::Priv<()>>` declared as private | |
| 394 | ... | |
| 395 | LL | fn provided() -> impl PrivTr<Priv<()>> {} | |
| 396 | | ^^^^^^^^^^^^^^^^^^^^^ can't leak private trait | |
| 412 | 397 | |
| 413 | error: type `generics::Priv<()>` is more private than the item `Tr5::provided::{anon_assoc#0}` | |
| 398 | error[E0446]: private type `generics::Priv<()>` in public interface | |
| 414 | 399 | --> $DIR/private-in-public-warn.rs:100:26 |
| 415 | 400 | | |
| 416 | LL | fn provided() -> impl PrivTr<Priv<()>> {} | |
| 417 | | ^^^^^^^^^^^^^^^^^^^^^ opaque type `Tr5::provided::{anon_assoc#0}` is reachable at visibility `pub(crate)` | |
| 418 | | | |
| 419 | note: but type `generics::Priv<()>` is only usable at visibility `pub(self)` | |
| 420 | --> $DIR/private-in-public-warn.rs:82:5 | |
| 421 | | | |
| 422 | 401 | LL | struct Priv<T = u8>(T); |
| 423 | | ^^^^^^^^^^^^^^^^^^^ | |
| 402 | | ------------------- `generics::Priv<()>` declared as private | |
| 403 | ... | |
| 404 | LL | fn provided() -> impl PrivTr<Priv<()>> {} | |
| 405 | | ^^^^^^^^^^^^^^^^^^^^^ can't leak private type | |
| 424 | 406 | |
| 425 | 407 | error: trait `generics::PrivTr<generics::Priv<()>>` is more private than the item `Tr5::provided::{anon_assoc#0}` |
| 426 | 408 | --> $DIR/private-in-public-warn.rs:100:26 |
tests/ui/resolve/auxiliary/open-ns-mod-my_api.rs created+9| ... | ... | @@ -0,0 +1,9 @@ |
| 1 | pub mod utils { | |
| 2 | pub fn root_helper() { | |
| 3 | println!("root_helper"); | |
| 4 | } | |
| 5 | } | |
| 6 | ||
| 7 | pub 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 @@ |
| 1 | pub 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 | ||
| 3 | pub mod util { | |
| 4 | pub fn core_mod_fn() -> String { | |
| 5 | format!("core_fn from my_api::core::util",) | |
| 6 | } | |
| 7 | } | |
| 8 | ||
| 9 | pub fn core_fn() -> String { | |
| 10 | format!("core_fn from my_api::core!",) | |
| 11 | } | |
| 12 | ||
| 13 | pub 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 @@ |
| 1 | pub mod util { | |
| 2 | pub fn util_mod_helper() -> String { | |
| 3 | format!("Helper from my_api::utils::util",) | |
| 4 | } | |
| 5 | } | |
| 6 | ||
| 7 | pub fn utils_helper() -> String { | |
| 8 | format!("Helper from my_api::utils!",) | |
| 9 | } | |
| 10 | ||
| 11 | pub 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 | ||
| 7 | use my_api::root_function; | |
| 8 | use my_api::utils::util; | |
| 9 | //~^ ERROR unresolved import `my_api::utils` | |
| 10 | ||
| 11 | fn 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 @@ |
| 1 | error[E0432]: unresolved import `my_api::utils` | |
| 2 | --> $DIR/open-ns-1.rs:8:13 | |
| 3 | | | |
| 4 | LL | use my_api::utils::util; | |
| 5 | | ^^^^^ could not find `utils` in `my_api` | |
| 6 | ||
| 7 | error[E0433]: cannot find `utils` in `my_api` | |
| 8 | --> $DIR/open-ns-1.rs:14:21 | |
| 9 | | | |
| 10 | LL | let _ = my_api::utils::utils_helper(); | |
| 11 | | ^^^^^ could not find `utils` in `my_api` | |
| 12 | ||
| 13 | error[E0433]: cannot find `core` in `my_api` | |
| 14 | --> $DIR/open-ns-1.rs:17:21 | |
| 15 | | | |
| 16 | LL | let _ = my_api::core::core_fn(); | |
| 17 | | ^^^^ could not find `core` in `my_api` | |
| 18 | ||
| 19 | error: aborting due to 3 previous errors | |
| 20 | ||
| 21 | Some errors have detailed explanations: E0432, E0433. | |
| 22 | For 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 | ||
| 8 | fn main() {} |
tests/ui/resolve/open-ns-10.stderr created+2| ... | ... | @@ -0,0 +1,2 @@ |
| 1 | error: 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 | ||
| 7 | use std::utils::get_u32; | |
| 8 | //~^ ERROR unresolved import `std::utils` | |
| 9 | ||
| 10 | fn main() { | |
| 11 | let _ = get_u32(); | |
| 12 | } |
tests/ui/resolve/open-ns-11.stderr created+9| ... | ... | @@ -0,0 +1,9 @@ |
| 1 | error[E0432]: unresolved import `std::utils` | |
| 2 | --> $DIR/open-ns-11.rs:7:10 | |
| 3 | | | |
| 4 | LL | use std::utils::get_u32; | |
| 5 | | ^^^^^ could not find `utils` in `std` | |
| 6 | ||
| 7 | error: aborting due to 1 previous error | |
| 8 | ||
| 9 | For 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 | ||
| 7 | use my_api::core::{core_fn, core_fn2}; | |
| 8 | //~^ ERROR unresolved import `my_api::core` [E0432] | |
| 9 | use my_api::utils::*; | |
| 10 | //~^ ERROR unresolved import `my_api::utils` [E0432] | |
| 11 | use my_api::*; | |
| 12 | ||
| 13 | fn 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 @@ |
| 1 | error[E0432]: unresolved import `my_api::core` | |
| 2 | --> $DIR/open-ns-2.rs:7:13 | |
| 3 | | | |
| 4 | LL | use my_api::core::{core_fn, core_fn2}; | |
| 5 | | ^^^^ could not find `core` in `my_api` | |
| 6 | ||
| 7 | error[E0432]: unresolved import `my_api::utils` | |
| 8 | --> $DIR/open-ns-2.rs:9:13 | |
| 9 | | | |
| 10 | LL | use my_api::utils::*; | |
| 11 | | ^^^^^ could not find `utils` in `my_api` | |
| 12 | ||
| 13 | error: aborting due to 2 previous errors | |
| 14 | ||
| 15 | For 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 | ||
| 10 | fn 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 @@ |
| 1 | error[E0425]: cannot find function `utils_helper` in module `my_api::utils` | |
| 2 | --> $DIR/open-ns-3.rs:12:28 | |
| 3 | | | |
| 4 | LL | let _ = my_api::utils::utils_helper(); | |
| 5 | | ^^^^^^^^^^^^ not found in `my_api::utils` | |
| 6 | | | |
| 7 | help: consider importing this function | |
| 8 | | | |
| 9 | LL + use my_api::utils::utils_helper; | |
| 10 | | | |
| 11 | help: if you import `utils_helper`, refer to it directly | |
| 12 | | | |
| 13 | LL - let _ = my_api::utils::utils_helper(); | |
| 14 | LL + let _ = utils_helper(); | |
| 15 | | | |
| 16 | ||
| 17 | error: aborting due to 1 previous error | |
| 18 | ||
| 19 | For 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 | ||
| 8 | fn 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 @@ |
| 1 | error[E0433]: cannot find `utils` in `my_api` | |
| 2 | --> $DIR/open-ns-4.rs:10:21 | |
| 3 | | | |
| 4 | LL | let _ = my_api::utils::utils_helper(); | |
| 5 | | ^^^^^ could not find `utils` in `my_api` | |
| 6 | ||
| 7 | error: aborting due to 1 previous error | |
| 8 | ||
| 9 | For 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 | ||
| 8 | macro_rules! import_and_call { | |
| 9 | ($import_path:path, $fn_name:ident) => {{ | |
| 10 | use $import_path; | |
| 11 | $fn_name(); | |
| 12 | }}; | |
| 13 | } | |
| 14 | ||
| 15 | fn 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 | ||
| 8 | use my_api; | |
| 9 | use my_api::utils::utils_helper; | |
| 10 | ||
| 11 | fn 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 | ||
| 8 | use my_api::utils::utils_helper; | |
| 9 | //~^ ERROR unresolved import `my_api::utils` [E0432] | |
| 10 | ||
| 11 | fn 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 @@ |
| 1 | error[E0432]: unresolved import `my_api::utils` | |
| 2 | --> $DIR/open-ns-7.rs:8:13 | |
| 3 | | | |
| 4 | LL | use my_api::utils::utils_helper; | |
| 5 | | ^^^^^ could not find `utils` in `my_api` | |
| 6 | ||
| 7 | error[E0433]: cannot find `utils` in `my_api` | |
| 8 | --> $DIR/open-ns-7.rs:12:21 | |
| 9 | | | |
| 10 | LL | let _ = my_api::utils::utils_helper(); | |
| 11 | | ^^^^^ could not find `utils` in `my_api` | |
| 12 | ||
| 13 | error: aborting due to 2 previous errors | |
| 14 | ||
| 15 | Some errors have detailed explanations: E0432, E0433. | |
| 16 | For 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 | ||
| 7 | macro_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 | ||
| 19 | fn 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 | ||
| 5 | use my_api::utils::get_u32; | |
| 6 | //~^ ERROR `my_api` is ambiguous [E0659] | |
| 7 | ||
| 8 | macro_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 | ||
| 20 | define!(); | |
| 21 | ||
| 22 | fn 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 @@ |
| 1 | error[E0659]: `my_api` is ambiguous | |
| 2 | --> $DIR/open-ns-9.rs:5:5 | |
| 3 | | | |
| 4 | LL | 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` | |
| 9 | note: `my_api` could also refer to the module defined here | |
| 10 | --> $DIR/open-ns-9.rs:10:9 | |
| 11 | | | |
| 12 | LL | / pub mod my_api { | |
| 13 | LL | | pub mod utils { | |
| 14 | LL | | pub fn get_u32() -> u32 { | |
| 15 | LL | | 2 | |
| 16 | ... | | |
| 17 | LL | | } | |
| 18 | | |_________^ | |
| 19 | ... | |
| 20 | LL | 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 | ||
| 25 | error: aborting due to 1 previous error | |
| 26 | ||
| 27 | For 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 @@ |
| 1 | 1 | // Make sure we consider `!` to be a union read. |
| 2 | 2 | |
| 3 | 3 | #![feature(never_type, never_patterns)] |
| 4 | //~^ WARN the feature `never_patterns` is incomplete | |
| 5 | 4 | |
| 6 | 5 | union U { |
| 7 | 6 | a: !, |
tests/ui/rfcs/rfc-0000-never_patterns/never-pattern-is-a-read.stderr+2-11| ... | ... | @@ -1,20 +1,11 @@ |
| 1 | warning: 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 | | | |
| 4 | LL | #![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 | ||
| 10 | 1 | error[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 | |
| 12 | 3 | | |
| 13 | 4 | LL | let U { a: ! } = u; |
| 14 | 5 | | ^ access to union field |
| 15 | 6 | | |
| 16 | 7 | = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior |
| 17 | 8 | |
| 18 | error: aborting due to 1 previous error; 1 warning emitted | |
| 9 | error: aborting due to 1 previous error | |
| 19 | 10 | |
| 20 | 11 | For 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 @@ |
| 1 | 1 | #![feature(transmutability)] |
| 2 | 2 | #![feature(generic_const_exprs)] |
| 3 | //~^ WARN the feature `generic_const_exprs` is incomplete | |
| 4 | 3 | |
| 5 | 4 | use std::mem::{Assume, TransmuteFrom}; |
| 6 | 5 |
tests/ui/transmutability/dont-assume-err-is-yes-issue-126377.stderr+4-13| ... | ... | @@ -1,26 +1,17 @@ |
| 1 | warning: 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 | | | |
| 4 | LL | #![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 | ||
| 10 | 1 | error[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 | |
| 12 | 3 | | |
| 13 | 4 | LL | is_transmutable::<{}>(); |
| 14 | 5 | | ^^ expected `bool`, found `()` |
| 15 | 6 | |
| 16 | 7 | error[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 | |
| 18 | 9 | | |
| 19 | 10 | LL | is_transmutable::<{}>(); |
| 20 | 11 | | ^^ the nightly-only, unstable trait `TransmuteFrom<(), { Assume::SAFETY }>` is not implemented for `()` |
| 21 | 12 | | |
| 22 | 13 | note: 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 | |
| 24 | 15 | | |
| 25 | 16 | LL | pub fn is_transmutable<const ASSUME_ALIGNMENT: bool>() |
| 26 | 17 | | --------------- required by a bound in this function |
| ... | ... | @@ -28,7 +19,7 @@ LL | where |
| 28 | 19 | LL | (): TransmuteFrom<(), { Assume::SAFETY }>, |
| 29 | 20 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` |
| 30 | 21 | |
| 31 | error: aborting due to 2 previous errors; 1 warning emitted | |
| 22 | error: aborting due to 2 previous errors | |
| 32 | 23 | |
| 33 | 24 | Some errors have detailed explanations: E0277, E0308. |
| 34 | 25 | For more information about an error, try `rustc --explain E0277`. |
tests/ui/transmutability/non_scalar_alignment_value.rs-1| ... | ... | @@ -1,5 +1,4 @@ |
| 1 | 1 | #![feature(min_generic_const_args)] |
| 2 | //~^ WARN the feature `min_generic_const_args` is incomplete | |
| 3 | 2 | |
| 4 | 3 | #![feature(transmutability)] |
| 5 | 4 |
tests/ui/transmutability/non_scalar_alignment_value.stderr+5-14| ... | ... | @@ -1,35 +1,26 @@ |
| 1 | warning: 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 | | | |
| 4 | LL | #![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 | ||
| 10 | 1 | error: 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 | |
| 12 | 3 | | |
| 13 | 4 | LL | alignment: Assume {}, |
| 14 | 5 | | ^^^^^^^^^ |
| 15 | 6 | |
| 16 | 7 | error: 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 | |
| 18 | 9 | | |
| 19 | 10 | LL | alignment: Assume {}, |
| 20 | 11 | | ^^^^^^^^^ |
| 21 | 12 | |
| 22 | 13 | error: 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 | |
| 24 | 15 | | |
| 25 | 16 | LL | alignment: Assume {}, |
| 26 | 17 | | ^^^^^^^^^ |
| 27 | 18 | |
| 28 | 19 | error: 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 | |
| 30 | 21 | | |
| 31 | 22 | LL | alignment: Assume {}, |
| 32 | 23 | | ^^^^^^^^^ |
| 33 | 24 | |
| 34 | error: aborting due to 4 previous errors; 1 warning emitted | |
| 25 | error: aborting due to 4 previous errors | |
| 35 | 26 |
tests/ui/unsafe-binders/binder-sized-crit.rs-1| ... | ... | @@ -1,7 +1,6 @@ |
| 1 | 1 | //@ check-pass |
| 2 | 2 | |
| 3 | 3 | #![feature(unsafe_binders)] |
| 4 | //~^ WARN the feature `unsafe_binders` is incomplete | |
| 5 | 4 | |
| 6 | 5 | use std::unsafe_binder::wrap_binder; |
| 7 | 6 |
tests/ui/unsafe-binders/binder-sized-crit.stderr deleted-11| ... | ... | @@ -1,11 +0,0 @@ |
| 1 | warning: 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 | | | |
| 4 | LL | #![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 | ||
| 10 | warning: 1 warning emitted | |
| 11 |
tests/ui/unsafe-binders/expr.rs-1| ... | ... | @@ -1,7 +1,6 @@ |
| 1 | 1 | //@ check-pass |
| 2 | 2 | |
| 3 | 3 | #![feature(unsafe_binders)] |
| 4 | //~^ WARN the feature `unsafe_binders` is incomplete | |
| 5 | 4 | |
| 6 | 5 | use std::unsafe_binder::{wrap_binder, unwrap_binder}; |
| 7 | 6 |
tests/ui/unsafe-binders/expr.stderr deleted-11| ... | ... | @@ -1,11 +0,0 @@ |
| 1 | warning: 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 | | | |
| 4 | LL | #![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 | ||
| 10 | warning: 1 warning emitted | |
| 11 |
tests/ui/unsafe-binders/lifetime-resolution.rs-1| ... | ... | @@ -1,5 +1,4 @@ |
| 1 | 1 | #![feature(unsafe_binders)] |
| 2 | //~^ WARN the feature `unsafe_binders` is incomplete | |
| 3 | 2 | |
| 4 | 3 | fn foo<'a>() { |
| 5 | 4 | let good: unsafe<'b> &'a &'b (); |
tests/ui/unsafe-binders/lifetime-resolution.stderr+3-12| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | error[E0261]: use of undeclared lifetime name `'missing` |
| 2 | --> $DIR/lifetime-resolution.rs:7:28 | |
| 2 | --> $DIR/lifetime-resolution.rs:6:28 | |
| 3 | 3 | | |
| 4 | 4 | LL | let missing: unsafe<> &'missing (); |
| 5 | 5 | | ^^^^^^^^ undeclared lifetime |
| ... | ... | @@ -15,7 +15,7 @@ LL | fn foo<'missing, 'a>() { |
| 15 | 15 | | +++++++++ |
| 16 | 16 | |
| 17 | 17 | error[E0401]: can't use generic parameters from outer item |
| 18 | --> $DIR/lifetime-resolution.rs:11:30 | |
| 18 | --> $DIR/lifetime-resolution.rs:10:30 | |
| 19 | 19 | | |
| 20 | 20 | LL | fn foo<'a>() { |
| 21 | 21 | | -- lifetime parameter from outer item |
| ... | ... | @@ -32,16 +32,7 @@ help: consider introducing lifetime `'a` here |
| 32 | 32 | LL | fn inner<'a, 'b>() { |
| 33 | 33 | | +++ |
| 34 | 34 | |
| 35 | warning: 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 | | | |
| 38 | LL | #![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 | ||
| 44 | error: aborting due to 2 previous errors; 1 warning emitted | |
| 35 | error: aborting due to 2 previous errors | |
| 45 | 36 | |
| 46 | 37 | Some errors have detailed explanations: E0261, E0401. |
| 47 | 38 | For more information about an error, try `rustc --explain E0261`. |
tests/ui/unsafe-binders/mismatch.rs-1| ... | ... | @@ -1,5 +1,4 @@ |
| 1 | 1 | #![feature(unsafe_binders)] |
| 2 | //~^ WARN the feature `unsafe_binders` is incomplete | |
| 3 | 2 | |
| 4 | 3 | use std::unsafe_binder::{wrap_binder, unwrap_binder}; |
| 5 | 4 |
tests/ui/unsafe-binders/mismatch.stderr+6-15| ... | ... | @@ -1,14 +1,5 @@ |
| 1 | warning: 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 | | | |
| 4 | LL | #![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 | ||
| 10 | 1 | error[E0308]: mismatched types |
| 11 | --> $DIR/mismatch.rs:7:46 | |
| 2 | --> $DIR/mismatch.rs:6:46 | |
| 12 | 3 | | |
| 13 | 4 | LL | let _: unsafe<'a> &'a i32 = wrap_binder!(&()); |
| 14 | 5 | | ^^^ expected `&i32`, found `&()` |
| ... | ... | @@ -17,7 +8,7 @@ LL | let _: unsafe<'a> &'a i32 = wrap_binder!(&()); |
| 17 | 8 | found reference `&()` |
| 18 | 9 | |
| 19 | 10 | error: `wrap_binder!()` can only wrap into unsafe binder, not `i32` |
| 20 | --> $DIR/mismatch.rs:12:18 | |
| 11 | --> $DIR/mismatch.rs:11:18 | |
| 21 | 12 | | |
| 22 | 13 | LL | let _: i32 = wrap_binder!(&()); |
| 23 | 14 | | ^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -26,7 +17,7 @@ LL | let _: i32 = wrap_binder!(&()); |
| 26 | 17 | = note: this error originates in the macro `wrap_binder` (in Nightly builds, run with -Z macro-backtrace for more info) |
| 27 | 18 | |
| 28 | 19 | error: expected unsafe binder, found integer as input of `unwrap_binder!()` |
| 29 | --> $DIR/mismatch.rs:18:20 | |
| 20 | --> $DIR/mismatch.rs:17:20 | |
| 30 | 21 | | |
| 31 | 22 | LL | unwrap_binder!(y); |
| 32 | 23 | | ^ |
| ... | ... | @@ -34,7 +25,7 @@ LL | unwrap_binder!(y); |
| 34 | 25 | = note: only an unsafe binder type can be unwrapped |
| 35 | 26 | |
| 36 | 27 | error[E0282]: type annotations needed |
| 37 | --> $DIR/mismatch.rs:23:9 | |
| 28 | --> $DIR/mismatch.rs:22:9 | |
| 38 | 29 | | |
| 39 | 30 | LL | let unknown = Default::default(); |
| 40 | 31 | | ^^^^^^^ |
| ... | ... | @@ -48,12 +39,12 @@ LL | let unknown: /* Type */ = Default::default(); |
| 48 | 39 | | ++++++++++++ |
| 49 | 40 | |
| 50 | 41 | error[E0282]: type annotations needed |
| 51 | --> $DIR/mismatch.rs:29:26 | |
| 42 | --> $DIR/mismatch.rs:28:26 | |
| 52 | 43 | | |
| 53 | 44 | LL | let x = wrap_binder!(&42); |
| 54 | 45 | | ^^^ cannot infer type |
| 55 | 46 | |
| 56 | error: aborting due to 5 previous errors; 1 warning emitted | |
| 47 | error: aborting due to 5 previous errors | |
| 57 | 48 | |
| 58 | 49 | Some errors have detailed explanations: E0282, E0308. |
| 59 | 50 | For more information about an error, try `rustc --explain E0282`. |
tests/ui/unsafe-binders/moves.rs-1| ... | ... | @@ -1,5 +1,4 @@ |
| 1 | 1 | #![feature(unsafe_binders)] |
| 2 | //~^ WARN the feature `unsafe_binders` is incomplete | |
| 3 | 2 | |
| 4 | 3 | use std::mem::{ManuallyDrop, drop}; |
| 5 | 4 | use std::unsafe_binder::{unwrap_binder, wrap_binder}; |
tests/ui/unsafe-binders/moves.stderr+5-14| ... | ... | @@ -1,14 +1,5 @@ |
| 1 | warning: 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 | | | |
| 4 | LL | #![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 | ||
| 10 | 1 | error[E0382]: use of moved value: `base` |
| 11 | --> $DIR/moves.rs:15:14 | |
| 2 | --> $DIR/moves.rs:14:14 | |
| 12 | 3 | | |
| 13 | 4 | LL | let base = NotCopy::default(); |
| 14 | 5 | | ---- move occurs because `base` has type `ManuallyDrop<NotCopyInner>`, which does not implement the `Copy` trait |
| ... | ... | @@ -18,7 +9,7 @@ LL | drop(base); |
| 18 | 9 | | ^^^^ value used here after move |
| 19 | 10 | | |
| 20 | 11 | note: if `NotCopyInner` implemented `Clone`, you could clone the value |
| 21 | --> $DIR/moves.rs:8:1 | |
| 12 | --> $DIR/moves.rs:7:1 | |
| 22 | 13 | | |
| 23 | 14 | LL | struct NotCopyInner; |
| 24 | 15 | | ^^^^^^^^^^^^^^^^^^^ consider implementing `Clone` for this type |
| ... | ... | @@ -27,7 +18,7 @@ LL | let binder: unsafe<> NotCopy = wrap_binder!(base); |
| 27 | 18 | | ---- you could clone this value |
| 28 | 19 | |
| 29 | 20 | error[E0382]: use of moved value: `binder` |
| 30 | --> $DIR/moves.rs:24:14 | |
| 21 | --> $DIR/moves.rs:23:14 | |
| 31 | 22 | | |
| 32 | 23 | LL | drop(unwrap_binder!(binder)); |
| 33 | 24 | | ---------------------- value moved here |
| ... | ... | @@ -38,7 +29,7 @@ LL | drop(unwrap_binder!(binder)); |
| 38 | 29 | = note: this error originates in the macro `unwrap_binder` (in Nightly builds, run with -Z macro-backtrace for more info) |
| 39 | 30 | |
| 40 | 31 | error[E0382]: use of moved value: `binder.0` |
| 41 | --> $DIR/moves.rs:36:14 | |
| 32 | --> $DIR/moves.rs:35:14 | |
| 42 | 33 | | |
| 43 | 34 | LL | drop(unwrap_binder!(binder).0); |
| 44 | 35 | | ------------------------ value moved here |
| ... | ... | @@ -48,6 +39,6 @@ LL | drop(unwrap_binder!(binder).0); |
| 48 | 39 | | |
| 49 | 40 | = note: move occurs because `binder.0` has type `ManuallyDrop<NotCopyInner>`, which does not implement the `Copy` trait |
| 50 | 41 | |
| 51 | error: aborting due to 3 previous errors; 1 warning emitted | |
| 42 | error: aborting due to 3 previous errors | |
| 52 | 43 | |
| 53 | 44 | For more information about this error, try `rustc --explain E0382`. |
tests/ui/unsafe-binders/simple.rs-1| ... | ... | @@ -1,7 +1,6 @@ |
| 1 | 1 | //@ check-pass |
| 2 | 2 | |
| 3 | 3 | #![feature(unsafe_binders)] |
| 4 | //~^ WARN the feature `unsafe_binders` is incomplete | |
| 5 | 4 | |
| 6 | 5 | fn main() { |
| 7 | 6 | let x: unsafe<'a> &'a (); |
tests/ui/unsafe-binders/simple.stderr deleted-11| ... | ... | @@ -1,11 +0,0 @@ |
| 1 | warning: 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 | | | |
| 4 | LL | #![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 | ||
| 10 | warning: 1 warning emitted | |
| 11 |
tests/ui/unsafe-binders/type-mismatch.rs-1| ... | ... | @@ -1,5 +1,4 @@ |
| 1 | 1 | #![feature(unsafe_binders)] |
| 2 | //~^ WARN the feature `unsafe_binders` is incomplete | |
| 3 | 2 | |
| 4 | 3 | fn main() { |
| 5 | 4 | let x: unsafe<> i32 = 0; |
tests/ui/unsafe-binders/type-mismatch.stderr+3-12| ... | ... | @@ -1,14 +1,5 @@ |
| 1 | warning: 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 | | | |
| 4 | LL | #![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 | ||
| 10 | 1 | error[E0308]: mismatched types |
| 11 | --> $DIR/type-mismatch.rs:5:27 | |
| 2 | --> $DIR/type-mismatch.rs:4:27 | |
| 12 | 3 | | |
| 13 | 4 | LL | let x: unsafe<> i32 = 0; |
| 14 | 5 | | ------------ ^ expected `unsafe<> i32`, found integer |
| ... | ... | @@ -19,7 +10,7 @@ LL | let x: unsafe<> i32 = 0; |
| 19 | 10 | found type `{integer}` |
| 20 | 11 | |
| 21 | 12 | error[E0308]: mismatched types |
| 22 | --> $DIR/type-mismatch.rs:7:33 | |
| 13 | --> $DIR/type-mismatch.rs:6:33 | |
| 23 | 14 | | |
| 24 | 15 | LL | let x: unsafe<'a> &'a i32 = &0; |
| 25 | 16 | | ------------------ ^^ expected `unsafe<'a> &i32`, found `&{integer}` |
| ... | ... | @@ -29,6 +20,6 @@ LL | let x: unsafe<'a> &'a i32 = &0; |
| 29 | 20 | = note: expected unsafe binder `unsafe<'a> &'a i32` |
| 30 | 21 | found reference `&{integer}` |
| 31 | 22 | |
| 32 | error: aborting due to 2 previous errors; 1 warning emitted | |
| 23 | error: aborting due to 2 previous errors | |
| 33 | 24 | |
| 34 | 25 | For more information about this error, try `rustc --explain E0308`. |
tests/ui/unsafe-binders/unsafe-binders-debuginfo.rs-1| ... | ... | @@ -3,7 +3,6 @@ |
| 3 | 3 | //@ compile-flags: -Cdebuginfo=2 |
| 4 | 4 | //@ ignore-backends: gcc |
| 5 | 5 | #![feature(unsafe_binders)] |
| 6 | //~^ WARN the feature `unsafe_binders` is incomplete | |
| 7 | 6 | |
| 8 | 7 | use std::unsafe_binder::wrap_binder; |
| 9 | 8 | fn main() { |
tests/ui/unsafe-binders/unsafe-binders-debuginfo.stderr deleted-11| ... | ... | @@ -1,11 +0,0 @@ |
| 1 | warning: 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 | | | |
| 4 | LL | #![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 | ||
| 10 | warning: 1 warning emitted | |
| 11 |
typos.toml+1| ... | ... | @@ -48,6 +48,7 @@ unstalled = "unstalled" # short for un-stalled |
| 48 | 48 | # the non-empty form can be automatically fixed by `--bless`. |
| 49 | 49 | # |
| 50 | 50 | # tidy-alphabetical-start |
| 51 | atomicaly = "atomically" | |
| 51 | 52 | definitinon = "definition" |
| 52 | 53 | dependy = "" |
| 53 | 54 | similarlty = "similarity" |