diff options
43 files changed, 454 insertions, 81 deletions
diff --git a/Cargo.lock b/Cargo.lock index bab73ff6770..6d77c2b0b88 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1938,9 +1938,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.142" +version = "0.2.143" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a987beff54b60ffa6d51982e1aa1146bc42f19bd26be28b0586f252fccf5317" +checksum = "edc207893e85c5d6be840e969b496b53d94cec8be2d501b214f50daa97fa8024" dependencies = [ "rustc-std-workspace-core", ] diff --git a/compiler/rustc_codegen_llvm/src/asm.rs b/compiler/rustc_codegen_llvm/src/asm.rs index f9af103c9ad..2a6ad1be763 100644 --- a/compiler/rustc_codegen_llvm/src/asm.rs +++ b/compiler/rustc_codegen_llvm/src/asm.rs @@ -236,9 +236,22 @@ impl<'ll, 'tcx> AsmBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> { InlineAsmArch::Nvptx64 => {} InlineAsmArch::PowerPC | InlineAsmArch::PowerPC64 => {} InlineAsmArch::Hexagon => {} - InlineAsmArch::LoongArch64 => {} + InlineAsmArch::LoongArch64 => { + constraints.extend_from_slice(&[ + "~{$fcc0}".to_string(), + "~{$fcc1}".to_string(), + "~{$fcc2}".to_string(), + "~{$fcc3}".to_string(), + "~{$fcc4}".to_string(), + "~{$fcc5}".to_string(), + "~{$fcc6}".to_string(), + "~{$fcc7}".to_string(), + ]); + } InlineAsmArch::Mips | InlineAsmArch::Mips64 => {} - InlineAsmArch::S390x => {} + InlineAsmArch::S390x => { + constraints.push("~{cc}".to_string()); + } InlineAsmArch::SpirV => {} InlineAsmArch::Wasm32 | InlineAsmArch::Wasm64 => {} InlineAsmArch::Bpf => {} diff --git a/compiler/rustc_driver_impl/src/lib.rs b/compiler/rustc_driver_impl/src/lib.rs index 405f3d5b66d..446e29199c6 100644 --- a/compiler/rustc_driver_impl/src/lib.rs +++ b/compiler/rustc_driver_impl/src/lib.rs @@ -745,6 +745,22 @@ fn print_crate_info( } } } + DeploymentTarget => { + use rustc_target::spec::current_apple_deployment_target; + + if sess.target.is_like_osx { + safe_println!( + "deployment_target={}", + current_apple_deployment_target(&sess.target) + .expect("unknown Apple target OS") + ) + } else { + early_error( + ErrorOutputType::default(), + "only Apple targets currently support deployment version info", + ) + } + } } } Compilation::Stop diff --git a/compiler/rustc_hir_analysis/src/collect/predicates_of.rs b/compiler/rustc_hir_analysis/src/collect/predicates_of.rs index 6c06957d1ee..e04658c8e77 100644 --- a/compiler/rustc_hir_analysis/src/collect/predicates_of.rs +++ b/compiler/rustc_hir_analysis/src/collect/predicates_of.rs @@ -657,14 +657,15 @@ pub(super) fn implied_predicates_with_filter( &*tcx.arena.alloc_from_iter(superbounds.predicates().chain(where_bounds_that_match)); debug!(?implied_bounds); - // Now require that immediate supertraits are converted, - // which will, in turn, reach indirect supertraits. + // Now require that immediate supertraits are converted, which will, in + // turn, reach indirect supertraits, so we detect cycles now instead of + // overflowing during elaboration. if matches!(filter, PredicateFilter::SelfOnly) { - // Now require that immediate supertraits are converted, - // which will, in turn, reach indirect supertraits. for &(pred, span) in implied_bounds { debug!("superbound: {:?}", pred); - if let ty::PredicateKind::Clause(ty::Clause::Trait(bound)) = pred.kind().skip_binder() { + if let ty::PredicateKind::Clause(ty::Clause::Trait(bound)) = pred.kind().skip_binder() + && bound.polarity == ty::ImplPolarity::Positive + { tcx.at(span).super_predicates_of(bound.def_id()); } } diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index d80cc0aa043..aa3cb03bad8 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -599,6 +599,7 @@ pub enum PrintRequest { StackProtectorStrategies, LinkArgs, SplitDebuginfo, + DeploymentTarget, } #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] @@ -1481,7 +1482,7 @@ pub fn rustc_short_optgroups() -> Vec<RustcOptGroup> { "[crate-name|file-names|sysroot|target-libdir|cfg|calling-conventions|\ target-list|target-cpus|target-features|relocation-models|code-models|\ tls-models|target-spec-json|all-target-specs-json|native-static-libs|\ - stack-protector-strategies|link-args]", + stack-protector-strategies|link-args|deployment-target]", ), opt::flagmulti_s("g", "", "Equivalent to -C debuginfo=2"), opt::flagmulti_s("O", "", "Equivalent to -C opt-level=2"), @@ -1931,6 +1932,7 @@ fn collect_print_requests( ("all-target-specs-json", PrintRequest::AllTargetSpecs), ("link-args", PrintRequest::LinkArgs), ("split-debuginfo", PrintRequest::SplitDebuginfo), + ("deployment-target", PrintRequest::DeploymentTarget), ]; prints.extend(matches.opt_strs("print").into_iter().map(|req| { diff --git a/compiler/rustc_target/src/asm/loongarch.rs b/compiler/rustc_target/src/asm/loongarch.rs index 7ace1647ded..9d1a4f3eeea 100644 --- a/compiler/rustc_target/src/asm/loongarch.rs +++ b/compiler/rustc_target/src/asm/loongarch.rs @@ -33,12 +33,11 @@ impl LoongArchInlineAsmRegClass { pub fn supported_types( self, - arch: InlineAsmArch, + _arch: InlineAsmArch, ) -> &'static [(InlineAsmType, Option<Symbol>)] { - match (self, arch) { - (Self::reg, InlineAsmArch::LoongArch64) => types! { _: I8, I16, I32, I64, F32, F64; }, - (Self::reg, _) => types! { _: I8, I16, I32, F32; }, - (Self::freg, _) => types! { _: F32, F64; }, + match self { + Self::reg => types! { _: I8, I16, I32, I64, F32, F64; }, + Self::freg => types! { _: F32, F64; }, } } } diff --git a/compiler/rustc_target/src/spec/apple_base.rs b/compiler/rustc_target/src/spec/apple_base.rs index 4c7f64b2078..ff224631828 100644 --- a/compiler/rustc_target/src/spec/apple_base.rs +++ b/compiler/rustc_target/src/spec/apple_base.rs @@ -1,7 +1,7 @@ use std::{borrow::Cow, env}; use crate::spec::{cvs, Cc, DebuginfoKind, FramePointer, LinkArgs}; -use crate::spec::{LinkerFlavor, Lld, SplitDebuginfo, StaticCow, TargetOptions}; +use crate::spec::{LinkerFlavor, Lld, SplitDebuginfo, StaticCow, Target, TargetOptions}; #[cfg(test)] #[path = "apple/tests.rs"] @@ -179,12 +179,28 @@ pub fn opts(os: &'static str, arch: Arch) -> TargetOptions { } } -fn deployment_target(var_name: &str) -> Option<(u32, u32)> { - let deployment_target = env::var(var_name).ok(); - deployment_target - .as_ref() - .and_then(|s| s.split_once('.')) - .and_then(|(a, b)| a.parse::<u32>().and_then(|a| b.parse::<u32>().map(|b| (a, b))).ok()) +pub fn deployment_target(target: &Target) -> Option<String> { + let (major, minor) = match &*target.os { + "macos" => { + // This does not need to be specific. It just needs to handle x86 vs M1. + let arch = if target.arch == "x86" || target.arch == "x86_64" { X86_64 } else { Arm64 }; + macos_deployment_target(arch) + } + "ios" => ios_deployment_target(), + "watchos" => watchos_deployment_target(), + "tvos" => tvos_deployment_target(), + _ => return None, + }; + + Some(format!("{major}.{minor}")) +} + +fn from_set_deployment_target(var_name: &str) -> Option<(u32, u32)> { + let deployment_target = env::var(var_name).ok()?; + let (unparsed_major, unparsed_minor) = deployment_target.split_once('.')?; + let (major, minor) = (unparsed_major.parse().ok()?, unparsed_minor.parse().ok()?); + + Some((major, minor)) } fn macos_default_deployment_target(arch: Arch) -> (u32, u32) { @@ -198,7 +214,8 @@ fn macos_default_deployment_target(arch: Arch) -> (u32, u32) { } fn macos_deployment_target(arch: Arch) -> (u32, u32) { - deployment_target("MACOSX_DEPLOYMENT_TARGET") + // If you are looking for the default deployment target, prefer `rustc --print deployment-target`. + from_set_deployment_target("MACOSX_DEPLOYMENT_TARGET") .unwrap_or_else(|| macos_default_deployment_target(arch)) } @@ -247,7 +264,8 @@ fn link_env_remove(arch: Arch, os: &'static str) -> StaticCow<[StaticCow<str>]> } fn ios_deployment_target() -> (u32, u32) { - deployment_target("IPHONEOS_DEPLOYMENT_TARGET").unwrap_or((7, 0)) + // If you are looking for the default deployment target, prefer `rustc --print deployment-target`. + from_set_deployment_target("IPHONEOS_DEPLOYMENT_TARGET").unwrap_or((7, 0)) } pub fn ios_llvm_target(arch: Arch) -> String { @@ -272,7 +290,8 @@ pub fn ios_sim_llvm_target(arch: Arch) -> String { } fn tvos_deployment_target() -> (u32, u32) { - deployment_target("TVOS_DEPLOYMENT_TARGET").unwrap_or((7, 0)) + // If you are looking for the default deployment target, prefer `rustc --print deployment-target`. + from_set_deployment_target("TVOS_DEPLOYMENT_TARGET").unwrap_or((7, 0)) } fn tvos_lld_platform_version() -> String { @@ -281,7 +300,8 @@ fn tvos_lld_platform_version() -> String { } fn watchos_deployment_target() -> (u32, u32) { - deployment_target("WATCHOS_DEPLOYMENT_TARGET").unwrap_or((5, 0)) + // If you are looking for the default deployment target, prefer `rustc --print deployment-target`. + from_set_deployment_target("WATCHOS_DEPLOYMENT_TARGET").unwrap_or((5, 0)) } fn watchos_lld_platform_version() -> String { diff --git a/compiler/rustc_target/src/spec/armebv7r_none_eabi.rs b/compiler/rustc_target/src/spec/armebv7r_none_eabi.rs index f6f46aac4c3..5632bcfcefe 100644 --- a/compiler/rustc_target/src/spec/armebv7r_none_eabi.rs +++ b/compiler/rustc_target/src/spec/armebv7r_none_eabi.rs @@ -16,7 +16,7 @@ pub fn target() -> Target { linker: Some("rust-lld".into()), relocation_model: RelocModel::Static, panic_strategy: PanicStrategy::Abort, - max_atomic_width: Some(32), + max_atomic_width: Some(64), emit_debug_gdb_scripts: false, // GCC and Clang default to 8 for arm-none here c_enum_min_bits: Some(8), diff --git a/compiler/rustc_target/src/spec/armebv7r_none_eabihf.rs b/compiler/rustc_target/src/spec/armebv7r_none_eabihf.rs index 9608efe8bcf..2815de3589d 100644 --- a/compiler/rustc_target/src/spec/armebv7r_none_eabihf.rs +++ b/compiler/rustc_target/src/spec/armebv7r_none_eabihf.rs @@ -17,7 +17,7 @@ pub fn target() -> Target { relocation_model: RelocModel::Static, panic_strategy: PanicStrategy::Abort, features: "+vfp3,-d32,-fp16".into(), - max_atomic_width: Some(32), + max_atomic_width: Some(64), emit_debug_gdb_scripts: false, // GCC and Clang default to 8 for arm-none here c_enum_min_bits: Some(8), diff --git a/compiler/rustc_target/src/spec/armv7_sony_vita_newlibeabihf.rs b/compiler/rustc_target/src/spec/armv7_sony_vita_newlibeabihf.rs index ebd2cca25ea..e2c0808f1fd 100644 --- a/compiler/rustc_target/src/spec/armv7_sony_vita_newlibeabihf.rs +++ b/compiler/rustc_target/src/spec/armv7_sony_vita_newlibeabihf.rs @@ -9,7 +9,7 @@ pub fn target() -> Target { let pre_link_args = TargetOptions::link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-Wl,-q"]); Target { - llvm_target: "armv7a-vita-newlibeabihf".into(), + llvm_target: "armv7a-vita-eabihf".into(), pointer_width: 32, data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(), arch: "arm".into(), @@ -33,7 +33,7 @@ pub fn target() -> Target { pre_link_args, exe_suffix: ".elf".into(), panic_strategy: PanicStrategy::Abort, - max_atomic_width: Some(32), + max_atomic_width: Some(64), ..Default::default() }, } diff --git a/compiler/rustc_target/src/spec/armv7r_none_eabi.rs b/compiler/rustc_target/src/spec/armv7r_none_eabi.rs index 5225abf44fc..74905ed5a4e 100644 --- a/compiler/rustc_target/src/spec/armv7r_none_eabi.rs +++ b/compiler/rustc_target/src/spec/armv7r_none_eabi.rs @@ -15,7 +15,7 @@ pub fn target() -> Target { linker: Some("rust-lld".into()), relocation_model: RelocModel::Static, panic_strategy: PanicStrategy::Abort, - max_atomic_width: Some(32), + max_atomic_width: Some(64), emit_debug_gdb_scripts: false, // GCC and Clang default to 8 for arm-none here c_enum_min_bits: Some(8), diff --git a/compiler/rustc_target/src/spec/armv7r_none_eabihf.rs b/compiler/rustc_target/src/spec/armv7r_none_eabihf.rs index 9a35e04617f..516b3f5c17e 100644 --- a/compiler/rustc_target/src/spec/armv7r_none_eabihf.rs +++ b/compiler/rustc_target/src/spec/armv7r_none_eabihf.rs @@ -16,7 +16,7 @@ pub fn target() -> Target { relocation_model: RelocModel::Static, panic_strategy: PanicStrategy::Abort, features: "+vfp3,-d32,-fp16".into(), - max_atomic_width: Some(32), + max_atomic_width: Some(64), emit_debug_gdb_scripts: false, // GCC and Clang default to 8 for arm-none here c_enum_min_bits: Some(8), diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs index 10d38c34919..ba4b89c9ea1 100644 --- a/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs @@ -60,6 +60,7 @@ pub mod crt_objects; mod aix_base; mod android_base; mod apple_base; +pub use apple_base::deployment_target as current_apple_deployment_target; mod avr_gnu_base; mod bpf_base; mod dragonfly_base; diff --git a/library/backtrace b/library/backtrace -Subproject 8ad84ca5ad88ade697637387e7cb4d7c3cf4bde +Subproject 4245978ca8169c40c088ff733825e4527f7b914 diff --git a/library/core/src/future/mod.rs b/library/core/src/future/mod.rs index 7a8d0cacdec..089493d3766 100644 --- a/library/core/src/future/mod.rs +++ b/library/core/src/future/mod.rs @@ -66,10 +66,3 @@ pub unsafe fn get_context<'a, 'b>(cx: ResumeTy) -> &'a mut Context<'b> { // that fulfills all the requirements for a mutable reference. unsafe { &mut *cx.0.as_ptr().cast() } } - -#[doc(hidden)] -#[unstable(feature = "gen_future", issue = "50547")] -#[inline] -pub const fn identity_future<O, Fut: Future<Output = O>>(f: Fut) -> Fut { - f -} diff --git a/library/std/Cargo.toml b/library/std/Cargo.toml index 0441f7e6c86..1454b002556 100644 --- a/library/std/Cargo.toml +++ b/library/std/Cargo.toml @@ -15,7 +15,7 @@ cfg-if = { version = "1.0", features = ['rustc-dep-of-std'] } panic_unwind = { path = "../panic_unwind", optional = true } panic_abort = { path = "../panic_abort" } core = { path = "../core" } -libc = { version = "0.2.142", default-features = false, features = ['rustc-dep-of-std'] } +libc = { version = "0.2.143", default-features = false, features = ['rustc-dep-of-std'] } compiler_builtins = { version = "0.1.91" } profiler_builtins = { path = "../profiler_builtins", optional = true } unwind = { path = "../unwind" } diff --git a/library/std/build.rs b/library/std/build.rs index cf708db6f27..0fb03c8e88a 100644 --- a/library/std/build.rs +++ b/library/std/build.rs @@ -34,6 +34,7 @@ fn main() { || target.contains("espidf") || target.contains("solid") || target.contains("nintendo-3ds") + || target.contains("vita") || target.contains("nto") { // These platforms don't have any special requirements. diff --git a/library/std/src/os/mod.rs b/library/std/src/os/mod.rs index b148d8a0091..5b54cc5f2e4 100644 --- a/library/std/src/os/mod.rs +++ b/library/std/src/os/mod.rs @@ -137,6 +137,8 @@ pub mod redox; pub mod solaris; #[cfg(target_os = "solid_asp3")] pub mod solid; +#[cfg(target_os = "vita")] +pub mod vita; #[cfg(target_os = "vxworks")] pub mod vxworks; #[cfg(target_os = "watchos")] diff --git a/library/std/src/os/unix/mod.rs b/library/std/src/os/unix/mod.rs index eb2d7ce1174..6fe1111188a 100644 --- a/library/std/src/os/unix/mod.rs +++ b/library/std/src/os/unix/mod.rs @@ -73,6 +73,8 @@ mod platform { pub use crate::os::redox::*; #[cfg(target_os = "solaris")] pub use crate::os::solaris::*; + #[cfg(target_os = "vita")] + pub use crate::os::vita::*; #[cfg(target_os = "vxworks")] pub use crate::os::vxworks::*; #[cfg(target_os = "watchos")] diff --git a/library/std/src/os/vita/fs.rs b/library/std/src/os/vita/fs.rs new file mode 100644 index 00000000000..a5a06764a4d --- /dev/null +++ b/library/std/src/os/vita/fs.rs @@ -0,0 +1,95 @@ +#![stable(feature = "metadata_ext", since = "1.1.0")] + +use crate::fs::Metadata; +use crate::sys_common::AsInner; + +/// OS-specific extensions to [`fs::Metadata`]. +/// +/// [`fs::Metadata`]: crate::fs::Metadata +#[stable(feature = "metadata_ext", since = "1.1.0")] +pub trait MetadataExt { + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_dev(&self) -> u64; + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_ino(&self) -> u64; + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_mode(&self) -> u32; + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_nlink(&self) -> u64; + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_uid(&self) -> u32; + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_gid(&self) -> u32; + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_rdev(&self) -> u64; + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_size(&self) -> u64; + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_atime(&self) -> i64; + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_atime_nsec(&self) -> i64; + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_mtime(&self) -> i64; + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_mtime_nsec(&self) -> i64; + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_ctime(&self) -> i64; + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_ctime_nsec(&self) -> i64; + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_blksize(&self) -> u64; + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_blocks(&self) -> u64; +} + +#[stable(feature = "metadata_ext", since = "1.1.0")] +impl MetadataExt for Metadata { + fn st_dev(&self) -> u64 { + self.as_inner().as_inner().st_dev as u64 + } + fn st_ino(&self) -> u64 { + self.as_inner().as_inner().st_ino as u64 + } + fn st_mode(&self) -> u32 { + self.as_inner().as_inner().st_mode as u32 + } + fn st_nlink(&self) -> u64 { + self.as_inner().as_inner().st_nlink as u64 + } + fn st_uid(&self) -> u32 { + self.as_inner().as_inner().st_uid as u32 + } + fn st_gid(&self) -> u32 { + self.as_inner().as_inner().st_gid as u32 + } + fn st_rdev(&self) -> u64 { + self.as_inner().as_inner().st_rdev as u64 + } + fn st_size(&self) -> u64 { + self.as_inner().as_inner().st_size as u64 + } + fn st_atime(&self) -> i64 { + self.as_inner().as_inner().st_atime as i64 + } + fn st_atime_nsec(&self) -> i64 { + 0 + } + fn st_mtime(&self) -> i64 { + self.as_inner().as_inner().st_mtime as i64 + } + fn st_mtime_nsec(&self) -> i64 { + 0 + } + fn st_ctime(&self) -> i64 { + self.as_inner().as_inner().st_ctime as i64 + } + fn st_ctime_nsec(&self) -> i64 { + 0 + } + fn st_blksize(&self) -> u64 { + self.as_inner().as_inner().st_blksize as u64 + } + fn st_blocks(&self) -> u64 { + self.as_inner().as_inner().st_blocks as u64 + } +} diff --git a/library/std/src/os/vita/mod.rs b/library/std/src/os/vita/mod.rs new file mode 100644 index 00000000000..da9edd12f7b --- /dev/null +++ b/library/std/src/os/vita/mod.rs @@ -0,0 +1,6 @@ +//! Definitions for vita + +#![stable(feature = "raw_ext", since = "1.1.0")] + +pub mod fs; +pub(crate) mod raw; diff --git a/library/std/src/os/vita/raw.rs b/library/std/src/os/vita/raw.rs new file mode 100644 index 00000000000..74cae4d4135 --- /dev/null +++ b/library/std/src/os/vita/raw.rs @@ -0,0 +1,70 @@ +//! vita raw type definitions + +#![stable(feature = "raw_ext", since = "1.1.0")] +#![deprecated( + since = "1.8.0", + note = "these type aliases are no longer supported by \ + the standard library, the `libc` crate on \ + crates.io should be used instead for the correct \ + definitions" +)] +#![allow(deprecated)] + +use crate::os::raw::c_long; +use crate::os::unix::raw::{gid_t, uid_t}; + +#[stable(feature = "pthread_t", since = "1.8.0")] +pub type pthread_t = libc::pthread_t; + +#[stable(feature = "raw_ext", since = "1.1.0")] +pub type blkcnt_t = libc::blkcnt_t; + +#[stable(feature = "raw_ext", since = "1.1.0")] +pub type blksize_t = libc::blksize_t; +#[stable(feature = "raw_ext", since = "1.1.0")] +pub type dev_t = libc::dev_t; +#[stable(feature = "raw_ext", since = "1.1.0")] +pub type ino_t = libc::ino_t; +#[stable(feature = "raw_ext", since = "1.1.0")] +pub type mode_t = libc::mode_t; +#[stable(feature = "raw_ext", since = "1.1.0")] +pub type nlink_t = libc::nlink_t; +#[stable(feature = "raw_ext", since = "1.1.0")] +pub type off_t = libc::off_t; + +#[stable(feature = "raw_ext", since = "1.1.0")] +pub type time_t = libc::time_t; + +#[repr(C)] +#[derive(Clone)] +#[stable(feature = "raw_ext", since = "1.1.0")] +pub struct stat { + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_dev: dev_t, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_ino: ino_t, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_mode: mode_t, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_nlink: nlink_t, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_uid: uid_t, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_gid: gid_t, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_rdev: dev_t, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_size: off_t, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_atime: time_t, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_mtime: time_t, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_ctime: time_t, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_blksize: blksize_t, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_blocks: blkcnt_t, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_spare4: [c_long; 2usize], +} diff --git a/library/std/src/sys/unix/alloc.rs b/library/std/src/sys/unix/alloc.rs index 9d6567c9fb4..8604b53983d 100644 --- a/library/std/src/sys/unix/alloc.rs +++ b/library/std/src/sys/unix/alloc.rs @@ -59,7 +59,8 @@ cfg_if::cfg_if! { target_os = "redox", target_os = "solaris", target_os = "espidf", - target_os = "horizon" + target_os = "horizon", + target_os = "vita", ))] { #[inline] unsafe fn aligned_malloc(layout: &Layout) -> *mut u8 { diff --git a/library/std/src/sys/unix/args.rs b/library/std/src/sys/unix/args.rs index 3d79058b320..9ed4d9c1e0d 100644 --- a/library/std/src/sys/unix/args.rs +++ b/library/std/src/sys/unix/args.rs @@ -265,7 +265,7 @@ mod imp { } } -#[cfg(target_os = "espidf")] +#[cfg(any(target_os = "espidf", target_os = "vita"))] mod imp { use super::Args; diff --git a/library/std/src/sys/unix/env.rs b/library/std/src/sys/unix/env.rs index 1a9276f1110..8c3ef88d8f8 100644 --- a/library/std/src/sys/unix/env.rs +++ b/library/std/src/sys/unix/env.rs @@ -141,6 +141,17 @@ pub mod os { pub const EXE_EXTENSION: &str = "elf"; } +#[cfg(target_os = "vita")] +pub mod os { + pub const FAMILY: &str = "unix"; + pub const OS: &str = "vita"; + pub const DLL_PREFIX: &str = "lib"; + pub const DLL_SUFFIX: &str = ".so"; + pub const DLL_EXTENSION: &str = "so"; + pub const EXE_SUFFIX: &str = ".elf"; + pub const EXE_EXTENSION: &str = "elf"; +} + #[cfg(all(target_os = "emscripten", target_arch = "asmjs"))] pub mod os { pub const FAMILY: &str = "unix"; diff --git a/library/std/src/sys/unix/fd.rs b/library/std/src/sys/unix/fd.rs index 45f96478fc3..cb630eede6d 100644 --- a/library/std/src/sys/unix/fd.rs +++ b/library/std/src/sys/unix/fd.rs @@ -75,6 +75,7 @@ const fn max_iov() -> usize { target_os = "nto", target_os = "openbsd", target_os = "horizon", + target_os = "vita", target_os = "watchos", )))] const fn max_iov() -> usize { @@ -93,7 +94,7 @@ impl FileDesc { Ok(ret as usize) } - #[cfg(not(any(target_os = "espidf", target_os = "horizon")))] + #[cfg(not(any(target_os = "espidf", target_os = "horizon", target_os = "vita")))] pub fn read_vectored(&self, bufs: &mut [IoSliceMut<'_>]) -> io::Result<usize> { let ret = cvt(unsafe { libc::readv( @@ -105,14 +106,14 @@ impl FileDesc { Ok(ret as usize) } - #[cfg(any(target_os = "espidf", target_os = "horizon"))] + #[cfg(any(target_os = "espidf", target_os = "horizon", target_os = "vita"))] pub fn read_vectored(&self, bufs: &mut [IoSliceMut<'_>]) -> io::Result<usize> { io::default_read_vectored(|b| self.read(b), bufs) } #[inline] pub fn is_read_vectored(&self) -> bool { - cfg!(not(any(target_os = "espidf", target_os = "horizon"))) + cfg!(not(any(target_os = "espidf", target_os = "horizon", target_os = "vita"))) } pub fn read_to_end(&self, buf: &mut Vec<u8>) -> io::Result<usize> { @@ -253,7 +254,7 @@ impl FileDesc { Ok(ret as usize) } - #[cfg(not(any(target_os = "espidf", target_os = "horizon")))] + #[cfg(not(any(target_os = "espidf", target_os = "horizon", target_os = "vita")))] pub fn write_vectored(&self, bufs: &[IoSlice<'_>]) -> io::Result<usize> { let ret = cvt(unsafe { libc::writev( @@ -265,14 +266,14 @@ impl FileDesc { Ok(ret as usize) } - #[cfg(any(target_os = "espidf", target_os = "horizon"))] + #[cfg(any(target_os = "espidf", target_os = "horizon", target_os = "vita"))] pub fn write_vectored(&self, bufs: &[IoSlice<'_>]) -> io::Result<usize> { io::default_write_vectored(|b| self.write(b), bufs) } #[inline] pub fn is_write_vectored(&self) -> bool { - cfg!(not(any(target_os = "espidf", target_os = "horizon"))) + cfg!(not(any(target_os = "espidf", target_os = "horizon", target_os = "vita"))) } pub fn write_at(&self, buf: &[u8], offset: u64) -> io::Result<usize> { diff --git a/library/std/src/sys/unix/fs.rs b/library/std/src/sys/unix/fs.rs index b398fd5eb24..22d2ae39713 100644 --- a/library/std/src/sys/unix/fs.rs +++ b/library/std/src/sys/unix/fs.rs @@ -447,7 +447,12 @@ impl FileAttr { #[cfg(not(any(target_os = "netbsd", target_os = "nto")))] impl FileAttr { - #[cfg(not(any(target_os = "vxworks", target_os = "espidf", target_os = "horizon")))] + #[cfg(not(any( + target_os = "vxworks", + target_os = "espidf", + target_os = "horizon", + target_os = "vita" + )))] pub fn modified(&self) -> io::Result<SystemTime> { #[cfg(target_pointer_width = "32")] cfg_has_statx! { @@ -459,7 +464,7 @@ impl FileAttr { Ok(SystemTime::new(self.stat.st_mtime as i64, self.stat.st_mtime_nsec as i64)) } - #[cfg(any(target_os = "vxworks", target_os = "espidf"))] + #[cfg(any(target_os = "vxworks", target_os = "espidf", target_os = "vita"))] pub fn modified(&self) -> io::Result<SystemTime> { Ok(SystemTime::new(self.stat.st_mtime as i64, 0)) } @@ -469,7 +474,12 @@ impl FileAttr { Ok(SystemTime::from(self.stat.st_mtim)) } - #[cfg(not(any(target_os = "vxworks", target_os = "espidf", target_os = "horizon")))] + #[cfg(not(any( + target_os = "vxworks", + target_os = "espidf", + target_os = "horizon", + target_os = "vita" + )))] pub fn accessed(&self) -> io::Result<SystemTime> { #[cfg(target_pointer_width = "32")] cfg_has_statx! { @@ -481,7 +491,7 @@ impl FileAttr { Ok(SystemTime::new(self.stat.st_atime as i64, self.stat.st_atime_nsec as i64)) } - #[cfg(any(target_os = "vxworks", target_os = "espidf"))] + #[cfg(any(target_os = "vxworks", target_os = "espidf", target_os = "vita"))] pub fn accessed(&self) -> io::Result<SystemTime> { Ok(SystemTime::new(self.stat.st_atime as i64, 0)) } @@ -866,6 +876,7 @@ impl DirEntry { target_os = "vxworks", target_os = "espidf", target_os = "horizon", + target_os = "vita", target_os = "nto", ))] pub fn ino(&self) -> u64 { diff --git a/library/std/src/sys/unix/mod.rs b/library/std/src/sys/unix/mod.rs index 68c9520cc9e..bb9e65e68e5 100644 --- a/library/std/src/sys/unix/mod.rs +++ b/library/std/src/sys/unix/mod.rs @@ -92,6 +92,7 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) { target_os = "redox", target_os = "l4re", target_os = "horizon", + target_os = "vita", )))] 'poll: { use crate::sys::os::errno; @@ -140,6 +141,7 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) { target_os = "vxworks", target_os = "l4re", target_os = "horizon", + target_os = "vita", )))] { use crate::sys::os::errno; @@ -162,7 +164,12 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) { } unsafe fn reset_sigpipe(#[allow(unused_variables)] sigpipe: u8) { - #[cfg(not(any(target_os = "emscripten", target_os = "fuchsia", target_os = "horizon")))] + #[cfg(not(any( + target_os = "emscripten", + target_os = "fuchsia", + target_os = "horizon", + target_os = "vita" + )))] { // We don't want to add this as a public type to std, nor do we // want to `include!` a file from the compiler (which would break @@ -199,7 +206,8 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) { target_os = "espidf", target_os = "emscripten", target_os = "fuchsia", - target_os = "horizon" + target_os = "horizon", + target_os = "vita" )))] static UNIX_SIGPIPE_ATTR_SPECIFIED: crate::sync::atomic::AtomicBool = crate::sync::atomic::AtomicBool::new(false); @@ -208,7 +216,8 @@ static UNIX_SIGPIPE_ATTR_SPECIFIED: crate::sync::atomic::AtomicBool = target_os = "espidf", target_os = "emscripten", target_os = "fuchsia", - target_os = "horizon" + target_os = "horizon", + target_os = "vita", )))] pub(crate) fn unix_sigpipe_attr_specified() -> bool { UNIX_SIGPIPE_ATTR_SPECIFIED.load(crate::sync::atomic::Ordering::Relaxed) @@ -402,7 +411,7 @@ cfg_if::cfg_if! { } } -#[cfg(any(target_os = "espidf", target_os = "horizon"))] +#[cfg(any(target_os = "espidf", target_os = "horizon", target_os = "vita"))] mod unsupported { use crate::io; diff --git a/library/std/src/sys/unix/os.rs b/library/std/src/sys/unix/os.rs index a345af76fa2..8edfd331304 100644 --- a/library/std/src/sys/unix/os.rs +++ b/library/std/src/sys/unix/os.rs @@ -460,7 +460,7 @@ pub fn current_exe() -> io::Result<PathBuf> { path.canonicalize() } -#[cfg(any(target_os = "espidf", target_os = "horizon"))] +#[cfg(any(target_os = "espidf", target_os = "horizon", target_os = "vita"))] pub fn current_exe() -> io::Result<PathBuf> { super::unsupported::unsupported() } @@ -614,7 +614,8 @@ pub fn home_dir() -> Option<PathBuf> { target_os = "redox", target_os = "vxworks", target_os = "espidf", - target_os = "horizon" + target_os = "horizon", + target_os = "vita", ))] unsafe fn fallback() -> Option<OsString> { None @@ -627,7 +628,8 @@ pub fn home_dir() -> Option<PathBuf> { target_os = "redox", target_os = "vxworks", target_os = "espidf", - target_os = "horizon" + target_os = "horizon", + target_os = "vita", )))] unsafe fn fallback() -> Option<OsString> { let amt = match libc::sysconf(libc::_SC_GETPW_R_SIZE_MAX) { diff --git a/library/std/src/sys/unix/process/mod.rs b/library/std/src/sys/unix/process/mod.rs index 3701510f3a4..0cf163d9fb8 100644 --- a/library/std/src/sys/unix/process/mod.rs +++ b/library/std/src/sys/unix/process/mod.rs @@ -14,7 +14,7 @@ cfg_if::cfg_if! { } else if #[cfg(target_os = "vxworks")] { #[path = "process_vxworks.rs"] mod process_inner; - } else if #[cfg(any(target_os = "espidf", target_os = "horizon"))] { + } else if #[cfg(any(target_os = "espidf", target_os = "horizon", target_os = "vita"))] { #[path = "process_unsupported.rs"] mod process_inner; } else { diff --git a/library/std/src/sys/unix/rand.rs b/library/std/src/sys/unix/rand.rs index 0f347ffab42..d8b63546b9e 100644 --- a/library/std/src/sys/unix/rand.rs +++ b/library/std/src/sys/unix/rand.rs @@ -21,7 +21,8 @@ pub fn hashmap_random_keys() -> (u64, u64) { not(target_os = "fuchsia"), not(target_os = "redox"), not(target_os = "vxworks"), - not(target_os = "emscripten") + not(target_os = "emscripten"), + not(target_os = "vita"), ))] mod imp { use crate::fs::File; @@ -175,7 +176,7 @@ mod imp { } } -#[cfg(any(target_os = "openbsd", target_os = "emscripten"))] +#[cfg(any(target_os = "openbsd", target_os = "emscripten", target_os = "vita"))] mod imp { use crate::sys::os::errno; diff --git a/src/doc/rustc/src/command-line-arguments.md b/src/doc/rustc/src/command-line-arguments.md index d4d26654ed1..3be4382b0a3 100644 --- a/src/doc/rustc/src/command-line-arguments.md +++ b/src/doc/rustc/src/command-line-arguments.md @@ -248,8 +248,14 @@ The valid types of print values are: exact format of this debugging output is not a stable guarantee, other than that it will include the linker executable and the text of each command-line argument passed to the linker. +- `deployment-target` - The currently selected [deployment target] (or minimum OS version) + for the selected Apple platform target. This value can be used or passed along to other + components alongside a Rust build that need this information, such as C compilers. + This returns rustc's minimum supported deployment target if no `*_DEPLOYMENT_TARGET` variable + is present in the environment, or otherwise returns the variable's parsed value. [conditional compilation]: ../reference/conditional-compilation.html +[deployment target]: https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/cross_development/Configuring/configuring.html <a id="option-g-debug"></a> ## `-g`: include debug information diff --git a/src/doc/rustc/src/platform-support/armv7-sony-vita-eabihf.md b/src/doc/rustc/src/platform-support/armv7-sony-vita-newlibeabihf.md index 6619c90b849..d75bd92beda 100644 --- a/src/doc/rustc/src/platform-support/armv7-sony-vita-eabihf.md +++ b/src/doc/rustc/src/platform-support/armv7-sony-vita-newlibeabihf.md @@ -1,26 +1,40 @@ -# armv7-sony-vita-eabihf +# armv7-sony-vita-newlibeabihf **Tier: 3** This tier supports the ARM Cortex A9 processor running on a PlayStation Vita console. `armv7-vita-newlibeabihf` aims to have support for `std` crate using `newlib` as a bridge. +Rust support for this target is not affiliated with Sony, and is not derived +from nor used with any official Sony SDK. + ## Designated Developers * [@amg98](https://github.com/amg98) +* [@nikarh](https://github.com/nikarh) ## Requirements -This target is cross compiled, and requires installing [VITASDK](https://vitasdk.org/) toolchain on your system. +This target is cross-compiled, and requires installing [VITASDK](https://vitasdk.org/) toolchain on your system. Dynamic linking is not supported. + +`#![no_std]` crates can be built using `build-std` to build `core`, and optionally +`alloc`, and `panic_abort`. + +`std` is partially supported, but mostly works. Some APIs are unimplemented +and will simply return an error, such as `std::process`. An allocator is provided +by default. + +In order to support some APIs, binaries must be linked against `libc` written +for the target, using a linker for the target. These are provided by the +VITASDK toolchain. + +This target generates binaries in the ELF format. ## Building -You can build Rust with support for the target by adding it to the `target` -list in `config.toml`: +Rust does not ship pre-compiled artifacts for this target. You can use `build-std` flag to build binaries with `std`: -```toml -[build] -build-stage = 1 -target = ["armv7-sony-vita-newlibeabihf"] +```sh +cargo build -Z build-std=std,panic_abort --target=armv7-sony-vita-newlibeabihf --release ``` ## Cross-compilation @@ -33,26 +47,81 @@ Currently there is no support to run the rustc test suite for this target. ## Building and Running Rust Programs -To test your developed rust programs for PlayStation Vita, first you have to prepare a proper executable for the device using the resulting ELF file you get from compilation step. The needed steps can be automated using tools like `cargo-make`. Use the example below as a template for your project: +`std` support for this target relies on newlib. In order to work, newlib must be initialized correctly. The easiest way to achieve this with VITASDK newlib implementation is by compiling your program as a staticlib with and exposing your main function from rust to `_init` function in `crt0`. + +Add this to your `Cargo.toml`: + +```toml +[lib] +crate-type = ["staticlib"] + +[profile.release] +panic = 'abort' +lto = true +opt-level = 3 +``` + +Your entrypoint should look roughly like this, `src/lib.rs`: +```rust,ignore,no_run +#[used] +#[export_name = "_newlib_heap_size_user"] +pub static _NEWLIB_HEAP_SIZE_USER: u32 = 100 * 1024 * 1024; // Default heap size is only 32mb, increase it to something suitable for your application + +#[no_mangle] +pub extern "C" fn main() { + println!("Hello, world!"); +} +``` + +To test your developed rust programs on PlayStation Vita, first you must correctly link and package your rust staticlib. These steps can be preformed using tools available in VITASDK, and can be automated using tools like `cargo-make`. + +First, set up environment variables for `VITASDK`, and it's binaries: + +```sh +export VITASDK=/opt/vitasdk +export PATH=$PATH:$VITASDK/bin +``` + +Use the example below as a template for your project: ```toml [env] TITLE = "Rust Hello World" TITLEID = "RUST00001" +# Add other libs required by your project here +LINKER_LIBS = "-lpthread -lm -lmathneon" + # At least a "sce_sys" folder should be place there for app metadata (title, icons, description...) # You can find sample assets for that on $VITASDK/share/gcc-arm-vita-eabi/samples/hello_world/sce_sys/ STATIC_DIR = "static" # Folder where static assets should be placed (sce_sys folder is at $STATIC_DIR/sce_sys) CARGO_TARGET_DIR = { script = ["echo ${CARGO_TARGET_DIR:=target}"] } -RUST_TARGET_PATH = { script = ["echo $(pwd)"]} RUST_TARGET = "armv7-sony-vita-newlibeabihf" CARGO_OUT_DIR = "${CARGO_TARGET_DIR}/${RUST_TARGET}/release" -[tasks.xbuild] -# This is the command where you get the ELF executable file (e.g. call to cargo build) +TARGET_LINKER = "arm-vita-eabi-gcc" +TARGET_LINKER_FLAGS = "-Wl,-q" + +[tasks.build] +description = "Build the project using `cargo` as a static lib." +command = "cargo" +args = ["build", "-Z", "build-std=std,panic_abort", "--target=armv7-sony-vita-newlibeabihf", "--release"] + +[tasks.link] +description = "Build an ELF executable using the `vitasdk` linker." +dependencies = ["build"] +script = [ + """ + ${TARGET_LINKER} ${TARGET_LINKER_FLAGS} \ + -L"${CARGO_OUT_DIR}" \ + -l"${CARGO_MAKE_CRATE_FS_NAME}" \ + ${LINKER_LIBS} \ + -o"${CARGO_OUT_DIR}/${CARGO_MAKE_CRATE_NAME}.elf" + """ +] [tasks.strip] description = "Strip the produced ELF executable." -dependencies = ["xbuild"] +dependencies = ["link"] command = "arm-vita-eabi-strip" args = ["-g", '${CARGO_OUT_DIR}/${CARGO_MAKE_CRATE_FS_NAME}.elf'] @@ -124,4 +193,4 @@ script = [ ] ``` -After running the above script, you should be able to get a *.vpk file in the same folder your *.elf executable resides. Now you can pick it and install it on your own PlayStation Vita using, for example, [VitaShell](https://github.com/TheOfficialFloW/VitaShell/releases) or you can use an emulator. For the time being, the most mature emulator for PlayStation Vita is [Vita3K](https://vita3k.org/), although I personally recommend testing your programs in real hardware, as the emulator is quite experimental. +After running the above script, you should be able to get a *.vpk file in the same folder your *.elf executable resides. Now you can pick it and install it on your own PlayStation Vita using, or you can use an [Vita3K](https://vita3k.org/) emulator. diff --git a/src/doc/unstable-book/src/language-features/asm-experimental-arch.md b/src/doc/unstable-book/src/language-features/asm-experimental-arch.md index 1874baa0c38..532cb9eea11 100644 --- a/src/doc/unstable-book/src/language-features/asm-experimental-arch.md +++ b/src/doc/unstable-book/src/language-features/asm-experimental-arch.md @@ -18,6 +18,7 @@ This feature tracks `asm!` and `global_asm!` support for the following architect - MSP430 - M68k - LoongArch +- s390x ## Register classes @@ -48,6 +49,8 @@ This feature tracks `asm!` and `global_asm!` support for the following architect | M68k | `reg_addr` | `a[0-3]` | `a` | | LoongArch | `reg` | `$r1`, `$r[4-20]`, `$r[23,30]` | `r` | | LoongArch | `freg` | `$f[0-31]` | `f` | +| s390x | `reg` | `r[0-10]`, `r[12-14]` | `r` | +| s390x | `freg` | `f[0-15]` | `f` | > **Notes**: > - NVPTX doesn't have a fixed register set, so named registers are not supported. @@ -81,6 +84,8 @@ This feature tracks `asm!` and `global_asm!` support for the following architect | M68k | `reg_data` | None | `i8`, `i16`, `i32` | | LoongArch64 | `reg` | None | `i8`, `i16`, `i32`, `i64`, `f32`, `f64` | | LoongArch64 | `freg` | None | `f32`, `f64` | +| s390x | `reg` | None | `i8`, `i16`, `i32`, `i64` | +| s390x | `freg` | None | `f32`, `f64` | ## Register aliases @@ -115,8 +120,8 @@ This feature tracks `asm!` and `global_asm!` support for the following architect | Architecture | Unsupported register | Reason | | ------------ | --------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| All | `sp` | The stack pointer must be restored to its original value at the end of an asm code block. | -| All | `fr` (Hexagon), `$fp` (MIPS), `Y` (AVR), `r4` (MSP430), `a6` (M68k), `$fp` (LoongArch) | The frame pointer cannot be used as an input or output. | +| All | `sp`, `r15` (s390x) | The stack pointer must be restored to its original value at the end of an asm code block. | +| All | `fr` (Hexagon), `$fp` (MIPS), `Y` (AVR), `r4` (MSP430), `a6` (M68k), `$fp` (LoongArch), `r11` (s390x) | The frame pointer cannot be used as an input or output. | | All | `r19` (Hexagon) | This is used internally by LLVM as a "base pointer" for functions with complex stack frames. | | MIPS | `$0` or `$zero` | This is a constant zero register which can't be modified. | | MIPS | `$1` or `$at` | Reserved for assembler. | @@ -147,6 +152,8 @@ This feature tracks `asm!` and `global_asm!` support for the following architect | PowerPC | `freg` | None | `0` | None | | LoongArch | `reg` | None | `$r2` | None | | LoongArch | `freg` | None | `$f0` | None | +| s390x | `reg` | None | `%r0` | None | +| s390x | `freg` | None | `%f0` | None | # Flags covered by `preserves_flags` @@ -157,3 +164,5 @@ These flags registers must be restored upon exiting the asm block if the `preser - The status register `r2`. - M68k - The condition code register `ccr`. +- s390x + - The condition code register `cc`. diff --git a/src/tools/rust-analyzer/crates/hir-def/src/lang_item.rs b/src/tools/rust-analyzer/crates/hir-def/src/lang_item.rs index 4096e0a3826..d338bb41205 100644 --- a/src/tools/rust-analyzer/crates/hir-def/src/lang_item.rs +++ b/src/tools/rust-analyzer/crates/hir-def/src/lang_item.rs @@ -379,7 +379,6 @@ language_item_table! { // FIXME(swatinem): the following lang items are used for async lowering and // should become obsolete eventually. ResumeTy, ResumeTy, resume_ty, Target::Struct, GenericRequirement::None; - IdentityFuture, identity_future, identity_future_fn, Target::Fn, GenericRequirement::None; GetContext, get_context, get_context_fn, Target::Fn, GenericRequirement::None; Context, Context, context, Target::Struct, GenericRequirement::None; diff --git a/src/tools/tidy/src/ui_tests.rs b/src/tools/tidy/src/ui_tests.rs index a2f7b8ba7be..e4f328ec0dd 100644 --- a/src/tools/tidy/src/ui_tests.rs +++ b/src/tools/tidy/src/ui_tests.rs @@ -10,7 +10,7 @@ use std::path::{Path, PathBuf}; const ENTRY_LIMIT: usize = 900; // FIXME: The following limits should be reduced eventually. const ISSUES_ENTRY_LIMIT: usize = 1953; -const ROOT_ENTRY_LIMIT: usize = 894; +const ROOT_ENTRY_LIMIT: usize = 895; fn check_entries(tests_path: &Path, bad: &mut bool) { let mut directories: HashMap<PathBuf, usize> = HashMap::new(); diff --git a/tests/run-make/valid-print-requests/valid-print-requests.stderr b/tests/run-make/valid-print-requests/valid-print-requests.stderr index bea6ce067f6..4f57550c29a 100644 --- a/tests/run-make/valid-print-requests/valid-print-requests.stderr +++ b/tests/run-make/valid-print-requests/valid-print-requests.stderr @@ -1,2 +1,2 @@ -error: unknown print request `uwu`. Valid print requests are: `crate-name`, `file-names`, `sysroot`, `target-libdir`, `cfg`, `calling-conventions`, `target-list`, `target-cpus`, `target-features`, `relocation-models`, `code-models`, `tls-models`, `native-static-libs`, `stack-protector-strategies`, `target-spec-json`, `all-target-specs-json`, `link-args`, `split-debuginfo` +error: unknown print request `uwu`. Valid print requests are: `crate-name`, `file-names`, `sysroot`, `target-libdir`, `cfg`, `calling-conventions`, `target-list`, `target-cpus`, `target-features`, `relocation-models`, `code-models`, `tls-models`, `native-static-libs`, `stack-protector-strategies`, `target-spec-json`, `all-target-specs-json`, `link-args`, `split-debuginfo`, `deployment-target` diff --git a/tests/ui/deployment-target/invalid-target.rs b/tests/ui/deployment-target/invalid-target.rs new file mode 100644 index 00000000000..336624320a3 --- /dev/null +++ b/tests/ui/deployment-target/invalid-target.rs @@ -0,0 +1,4 @@ +// compile-flags: --target x86_64-unknown-linux-gnu --print deployment-target +// needs-llvm-components: x86 + +fn main() {} diff --git a/tests/ui/deployment-target/invalid-target.stderr b/tests/ui/deployment-target/invalid-target.stderr new file mode 100644 index 00000000000..eb4ac131c40 --- /dev/null +++ b/tests/ui/deployment-target/invalid-target.stderr @@ -0,0 +1,2 @@ +error: only Apple targets currently support deployment version info + diff --git a/tests/ui/deployment-target/macos-target.rs b/tests/ui/deployment-target/macos-target.rs new file mode 100644 index 00000000000..701ccf4799a --- /dev/null +++ b/tests/ui/deployment-target/macos-target.rs @@ -0,0 +1,7 @@ +// only-macos +// compile-flags: --print deployment-target +// normalize-stdout-test: "\d+\." -> "$$CURRENT_MAJOR_VERSION." +// normalize-stdout-test: "\d+" -> "$$CURRENT_MINOR_VERSION" +// check-pass + +fn main() {} diff --git a/tests/ui/deployment-target/macos-target.stdout b/tests/ui/deployment-target/macos-target.stdout new file mode 100644 index 00000000000..f55ef568ed6 --- /dev/null +++ b/tests/ui/deployment-target/macos-target.stdout @@ -0,0 +1 @@ +deployment_target=$CURRENT_MAJOR_VERSION.$CURRENT_MINOR_VERSION diff --git a/tests/ui/traits/negative-bounds/supertrait.rs b/tests/ui/traits/negative-bounds/supertrait.rs new file mode 100644 index 00000000000..df0884b8b9f --- /dev/null +++ b/tests/ui/traits/negative-bounds/supertrait.rs @@ -0,0 +1,9 @@ +// check-pass + +#![feature(negative_bounds)] +//~^ WARN the feature `negative_bounds` is incomplete + +trait A: !B {} +trait B: !A {} + +fn main() {} diff --git a/tests/ui/traits/negative-bounds/supertrait.stderr b/tests/ui/traits/negative-bounds/supertrait.stderr new file mode 100644 index 00000000000..f44753b624e --- /dev/null +++ b/tests/ui/traits/negative-bounds/supertrait.stderr @@ -0,0 +1,10 @@ +warning: the feature `negative_bounds` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/supertrait.rs:3:12 + | +LL | #![feature(negative_bounds)] + | ^^^^^^^^^^^^^^^ + | + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + |
