Skip to content

Commit ce04288

Browse files
committed
Auto merge of #111346 - JohnTitor:rollup-6g5cg9z, r=JohnTitor
Rollup of 7 pull requests Successful merges: - #105354 (Add deployment-target --print flag for Apple targets) - #110377 (Update max_atomic_width of armv7r and armv7_sony_vita targets to 64.) - #110638 (STD support for PSVita) - #111211 (Don't compute trait super bounds unless they're positive) - #111315 (Remove `identity_future` from stdlib) - #111331 (Mark s390x condition code register as clobbered in inline assembly) - #111332 (Improve inline asm for LoongArch) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents c86e7fb + 2a8adcc commit ce04288

File tree

43 files changed

+455
-82
lines changed

Some content is hidden

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

43 files changed

+455
-82
lines changed

Cargo.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -1938,9 +1938,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
19381938

19391939
[[package]]
19401940
name = "libc"
1941-
version = "0.2.142"
1941+
version = "0.2.143"
19421942
source = "registry+https://github.com/rust-lang/crates.io-index"
1943-
checksum = "6a987beff54b60ffa6d51982e1aa1146bc42f19bd26be28b0586f252fccf5317"
1943+
checksum = "edc207893e85c5d6be840e969b496b53d94cec8be2d501b214f50daa97fa8024"
19441944
dependencies = [
19451945
"rustc-std-workspace-core",
19461946
]

compiler/rustc_codegen_llvm/src/asm.rs

+15-2
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,22 @@ impl<'ll, 'tcx> AsmBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
236236
InlineAsmArch::Nvptx64 => {}
237237
InlineAsmArch::PowerPC | InlineAsmArch::PowerPC64 => {}
238238
InlineAsmArch::Hexagon => {}
239-
InlineAsmArch::LoongArch64 => {}
239+
InlineAsmArch::LoongArch64 => {
240+
constraints.extend_from_slice(&[
241+
"~{$fcc0}".to_string(),
242+
"~{$fcc1}".to_string(),
243+
"~{$fcc2}".to_string(),
244+
"~{$fcc3}".to_string(),
245+
"~{$fcc4}".to_string(),
246+
"~{$fcc5}".to_string(),
247+
"~{$fcc6}".to_string(),
248+
"~{$fcc7}".to_string(),
249+
]);
250+
}
240251
InlineAsmArch::Mips | InlineAsmArch::Mips64 => {}
241-
InlineAsmArch::S390x => {}
252+
InlineAsmArch::S390x => {
253+
constraints.push("~{cc}".to_string());
254+
}
242255
InlineAsmArch::SpirV => {}
243256
InlineAsmArch::Wasm32 | InlineAsmArch::Wasm64 => {}
244257
InlineAsmArch::Bpf => {}

compiler/rustc_driver_impl/src/lib.rs

+16
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,22 @@ fn print_crate_info(
745745
}
746746
}
747747
}
748+
DeploymentTarget => {
749+
use rustc_target::spec::current_apple_deployment_target;
750+
751+
if sess.target.is_like_osx {
752+
safe_println!(
753+
"deployment_target={}",
754+
current_apple_deployment_target(&sess.target)
755+
.expect("unknown Apple target OS")
756+
)
757+
} else {
758+
early_error(
759+
ErrorOutputType::default(),
760+
"only Apple targets currently support deployment version info",
761+
)
762+
}
763+
}
748764
}
749765
}
750766
Compilation::Stop

compiler/rustc_hir_analysis/src/collect/predicates_of.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -657,14 +657,15 @@ pub(super) fn implied_predicates_with_filter(
657657
&*tcx.arena.alloc_from_iter(superbounds.predicates().chain(where_bounds_that_match));
658658
debug!(?implied_bounds);
659659

660-
// Now require that immediate supertraits are converted,
661-
// which will, in turn, reach indirect supertraits.
660+
// Now require that immediate supertraits are converted, which will, in
661+
// turn, reach indirect supertraits, so we detect cycles now instead of
662+
// overflowing during elaboration.
662663
if matches!(filter, PredicateFilter::SelfOnly) {
663-
// Now require that immediate supertraits are converted,
664-
// which will, in turn, reach indirect supertraits.
665664
for &(pred, span) in implied_bounds {
666665
debug!("superbound: {:?}", pred);
667-
if let ty::PredicateKind::Clause(ty::Clause::Trait(bound)) = pred.kind().skip_binder() {
666+
if let ty::PredicateKind::Clause(ty::Clause::Trait(bound)) = pred.kind().skip_binder()
667+
&& bound.polarity == ty::ImplPolarity::Positive
668+
{
668669
tcx.at(span).super_predicates_of(bound.def_id());
669670
}
670671
}

compiler/rustc_session/src/config.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,7 @@ pub enum PrintRequest {
599599
StackProtectorStrategies,
600600
LinkArgs,
601601
SplitDebuginfo,
602+
DeploymentTarget,
602603
}
603604

604605
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
@@ -1481,7 +1482,7 @@ pub fn rustc_short_optgroups() -> Vec<RustcOptGroup> {
14811482
"[crate-name|file-names|sysroot|target-libdir|cfg|calling-conventions|\
14821483
target-list|target-cpus|target-features|relocation-models|code-models|\
14831484
tls-models|target-spec-json|all-target-specs-json|native-static-libs|\
1484-
stack-protector-strategies|link-args]",
1485+
stack-protector-strategies|link-args|deployment-target]",
14851486
),
14861487
opt::flagmulti_s("g", "", "Equivalent to -C debuginfo=2"),
14871488
opt::flagmulti_s("O", "", "Equivalent to -C opt-level=2"),
@@ -1931,6 +1932,7 @@ fn collect_print_requests(
19311932
("all-target-specs-json", PrintRequest::AllTargetSpecs),
19321933
("link-args", PrintRequest::LinkArgs),
19331934
("split-debuginfo", PrintRequest::SplitDebuginfo),
1935+
("deployment-target", PrintRequest::DeploymentTarget),
19341936
];
19351937

19361938
prints.extend(matches.opt_strs("print").into_iter().map(|req| {

compiler/rustc_target/src/asm/loongarch.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,11 @@ impl LoongArchInlineAsmRegClass {
3333

3434
pub fn supported_types(
3535
self,
36-
arch: InlineAsmArch,
36+
_arch: InlineAsmArch,
3737
) -> &'static [(InlineAsmType, Option<Symbol>)] {
38-
match (self, arch) {
39-
(Self::reg, InlineAsmArch::LoongArch64) => types! { _: I8, I16, I32, I64, F32, F64; },
40-
(Self::reg, _) => types! { _: I8, I16, I32, F32; },
41-
(Self::freg, _) => types! { _: F32, F64; },
38+
match self {
39+
Self::reg => types! { _: I8, I16, I32, I64, F32, F64; },
40+
Self::freg => types! { _: F32, F64; },
4241
}
4342
}
4443
}

compiler/rustc_target/src/spec/apple_base.rs

+31-11
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::{borrow::Cow, env};
22

33
use crate::spec::{cvs, Cc, DebuginfoKind, FramePointer, LinkArgs};
4-
use crate::spec::{LinkerFlavor, Lld, SplitDebuginfo, StaticCow, TargetOptions};
4+
use crate::spec::{LinkerFlavor, Lld, SplitDebuginfo, StaticCow, Target, TargetOptions};
55

66
#[cfg(test)]
77
#[path = "apple/tests.rs"]
@@ -179,12 +179,28 @@ pub fn opts(os: &'static str, arch: Arch) -> TargetOptions {
179179
}
180180
}
181181

182-
fn deployment_target(var_name: &str) -> Option<(u32, u32)> {
183-
let deployment_target = env::var(var_name).ok();
184-
deployment_target
185-
.as_ref()
186-
.and_then(|s| s.split_once('.'))
187-
.and_then(|(a, b)| a.parse::<u32>().and_then(|a| b.parse::<u32>().map(|b| (a, b))).ok())
182+
pub fn deployment_target(target: &Target) -> Option<String> {
183+
let (major, minor) = match &*target.os {
184+
"macos" => {
185+
// This does not need to be specific. It just needs to handle x86 vs M1.
186+
let arch = if target.arch == "x86" || target.arch == "x86_64" { X86_64 } else { Arm64 };
187+
macos_deployment_target(arch)
188+
}
189+
"ios" => ios_deployment_target(),
190+
"watchos" => watchos_deployment_target(),
191+
"tvos" => tvos_deployment_target(),
192+
_ => return None,
193+
};
194+
195+
Some(format!("{major}.{minor}"))
196+
}
197+
198+
fn from_set_deployment_target(var_name: &str) -> Option<(u32, u32)> {
199+
let deployment_target = env::var(var_name).ok()?;
200+
let (unparsed_major, unparsed_minor) = deployment_target.split_once('.')?;
201+
let (major, minor) = (unparsed_major.parse().ok()?, unparsed_minor.parse().ok()?);
202+
203+
Some((major, minor))
188204
}
189205

190206
fn macos_default_deployment_target(arch: Arch) -> (u32, u32) {
@@ -198,7 +214,8 @@ fn macos_default_deployment_target(arch: Arch) -> (u32, u32) {
198214
}
199215

200216
fn macos_deployment_target(arch: Arch) -> (u32, u32) {
201-
deployment_target("MACOSX_DEPLOYMENT_TARGET")
217+
// If you are looking for the default deployment target, prefer `rustc --print deployment-target`.
218+
from_set_deployment_target("MACOSX_DEPLOYMENT_TARGET")
202219
.unwrap_or_else(|| macos_default_deployment_target(arch))
203220
}
204221

@@ -247,7 +264,8 @@ fn link_env_remove(arch: Arch, os: &'static str) -> StaticCow<[StaticCow<str>]>
247264
}
248265

249266
fn ios_deployment_target() -> (u32, u32) {
250-
deployment_target("IPHONEOS_DEPLOYMENT_TARGET").unwrap_or((7, 0))
267+
// If you are looking for the default deployment target, prefer `rustc --print deployment-target`.
268+
from_set_deployment_target("IPHONEOS_DEPLOYMENT_TARGET").unwrap_or((7, 0))
251269
}
252270

253271
pub fn ios_llvm_target(arch: Arch) -> String {
@@ -272,7 +290,8 @@ pub fn ios_sim_llvm_target(arch: Arch) -> String {
272290
}
273291

274292
fn tvos_deployment_target() -> (u32, u32) {
275-
deployment_target("TVOS_DEPLOYMENT_TARGET").unwrap_or((7, 0))
293+
// If you are looking for the default deployment target, prefer `rustc --print deployment-target`.
294+
from_set_deployment_target("TVOS_DEPLOYMENT_TARGET").unwrap_or((7, 0))
276295
}
277296

278297
fn tvos_lld_platform_version() -> String {
@@ -281,7 +300,8 @@ fn tvos_lld_platform_version() -> String {
281300
}
282301

283302
fn watchos_deployment_target() -> (u32, u32) {
284-
deployment_target("WATCHOS_DEPLOYMENT_TARGET").unwrap_or((5, 0))
303+
// If you are looking for the default deployment target, prefer `rustc --print deployment-target`.
304+
from_set_deployment_target("WATCHOS_DEPLOYMENT_TARGET").unwrap_or((5, 0))
285305
}
286306

287307
fn watchos_lld_platform_version() -> String {

compiler/rustc_target/src/spec/armebv7r_none_eabi.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub fn target() -> Target {
1616
linker: Some("rust-lld".into()),
1717
relocation_model: RelocModel::Static,
1818
panic_strategy: PanicStrategy::Abort,
19-
max_atomic_width: Some(32),
19+
max_atomic_width: Some(64),
2020
emit_debug_gdb_scripts: false,
2121
// GCC and Clang default to 8 for arm-none here
2222
c_enum_min_bits: Some(8),

compiler/rustc_target/src/spec/armebv7r_none_eabihf.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub fn target() -> Target {
1717
relocation_model: RelocModel::Static,
1818
panic_strategy: PanicStrategy::Abort,
1919
features: "+vfp3,-d32,-fp16".into(),
20-
max_atomic_width: Some(32),
20+
max_atomic_width: Some(64),
2121
emit_debug_gdb_scripts: false,
2222
// GCC and Clang default to 8 for arm-none here
2323
c_enum_min_bits: Some(8),

compiler/rustc_target/src/spec/armv7_sony_vita_newlibeabihf.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pub fn target() -> Target {
99
let pre_link_args = TargetOptions::link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-Wl,-q"]);
1010

1111
Target {
12-
llvm_target: "armv7a-vita-newlibeabihf".into(),
12+
llvm_target: "armv7a-vita-eabihf".into(),
1313
pointer_width: 32,
1414
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
1515
arch: "arm".into(),
@@ -33,7 +33,7 @@ pub fn target() -> Target {
3333
pre_link_args,
3434
exe_suffix: ".elf".into(),
3535
panic_strategy: PanicStrategy::Abort,
36-
max_atomic_width: Some(32),
36+
max_atomic_width: Some(64),
3737
..Default::default()
3838
},
3939
}

compiler/rustc_target/src/spec/armv7r_none_eabi.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub fn target() -> Target {
1515
linker: Some("rust-lld".into()),
1616
relocation_model: RelocModel::Static,
1717
panic_strategy: PanicStrategy::Abort,
18-
max_atomic_width: Some(32),
18+
max_atomic_width: Some(64),
1919
emit_debug_gdb_scripts: false,
2020
// GCC and Clang default to 8 for arm-none here
2121
c_enum_min_bits: Some(8),

compiler/rustc_target/src/spec/armv7r_none_eabihf.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub fn target() -> Target {
1616
relocation_model: RelocModel::Static,
1717
panic_strategy: PanicStrategy::Abort,
1818
features: "+vfp3,-d32,-fp16".into(),
19-
max_atomic_width: Some(32),
19+
max_atomic_width: Some(64),
2020
emit_debug_gdb_scripts: false,
2121
// GCC and Clang default to 8 for arm-none here
2222
c_enum_min_bits: Some(8),

compiler/rustc_target/src/spec/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ pub mod crt_objects;
6060
mod aix_base;
6161
mod android_base;
6262
mod apple_base;
63+
pub use apple_base::deployment_target as current_apple_deployment_target;
6364
mod avr_gnu_base;
6465
mod bpf_base;
6566
mod dragonfly_base;

library/core/src/future/mod.rs

-7
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,3 @@ pub unsafe fn get_context<'a, 'b>(cx: ResumeTy) -> &'a mut Context<'b> {
6666
// that fulfills all the requirements for a mutable reference.
6767
unsafe { &mut *cx.0.as_ptr().cast() }
6868
}
69-
70-
#[doc(hidden)]
71-
#[unstable(feature = "gen_future", issue = "50547")]
72-
#[inline]
73-
pub const fn identity_future<O, Fut: Future<Output = O>>(f: Fut) -> Fut {
74-
f
75-
}

library/std/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ cfg-if = { version = "1.0", features = ['rustc-dep-of-std'] }
1515
panic_unwind = { path = "../panic_unwind", optional = true }
1616
panic_abort = { path = "../panic_abort" }
1717
core = { path = "../core" }
18-
libc = { version = "0.2.142", default-features = false, features = ['rustc-dep-of-std'] }
18+
libc = { version = "0.2.143", default-features = false, features = ['rustc-dep-of-std'] }
1919
compiler_builtins = { version = "0.1.91" }
2020
profiler_builtins = { path = "../profiler_builtins", optional = true }
2121
unwind = { path = "../unwind" }

library/std/build.rs

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ fn main() {
3434
|| target.contains("espidf")
3535
|| target.contains("solid")
3636
|| target.contains("nintendo-3ds")
37+
|| target.contains("vita")
3738
|| target.contains("nto")
3839
{
3940
// These platforms don't have any special requirements.

library/std/src/os/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ pub mod redox;
137137
pub mod solaris;
138138
#[cfg(target_os = "solid_asp3")]
139139
pub mod solid;
140+
#[cfg(target_os = "vita")]
141+
pub mod vita;
140142
#[cfg(target_os = "vxworks")]
141143
pub mod vxworks;
142144
#[cfg(target_os = "watchos")]

library/std/src/os/unix/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ mod platform {
7373
pub use crate::os::redox::*;
7474
#[cfg(target_os = "solaris")]
7575
pub use crate::os::solaris::*;
76+
#[cfg(target_os = "vita")]
77+
pub use crate::os::vita::*;
7678
#[cfg(target_os = "vxworks")]
7779
pub use crate::os::vxworks::*;
7880
#[cfg(target_os = "watchos")]

0 commit comments

Comments
 (0)