Skip to content

Commit 34ca1df

Browse files
committed
Auto merge of #164199 - JonathanBrouwer:rollup-eJso6IU, r=JonathanBrouwer
Rollup of 6 pull requests Successful merges: - #163824 (aarch64: Use neon registers for ABI on targets that require `neon") - #162257 (Revise the VEXos synchronization model) - #163832 (reject non-async coroutine closures as async callables) - #163990 (`AliasConstKind`: add intra-doc links to `AliasTyKind`) - #164031 (Adding File Lock Support for Haiku) - #164151 (std: add doctest to parent_id)
2 parents fb5f32b + 56f02d1 commit 34ca1df

29 files changed

Lines changed: 296 additions & 89 deletions

‎compiler/rustc_interface/src/util.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ pub(crate) fn check_abi_required_features(sess: &Session) {
110110
// emit a (less friendly) hard error.
111111
// Also make it a hard error on x86, where we use SSE registers for the "Rust" ABI. The
112112
// post-mono ABI check only systematically checks "C" calls, so we better reject this here.
113-
let hard_error = matches!(sess.target.arch, Arch::Arm | Arch::X86);
113+
let hard_error = matches!(sess.target.arch, Arch::AArch64 | Arch::Arm | Arch::X86);
114114

115115
for feature in abi_feature_constraints.required {
116116
if !sess.internal_target_features.contains(&Symbol::intern(feature)) {

‎compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,10 @@ pub(in crate::solve) fn extract_tupled_inputs_and_output_from_async_callable<I:
440440
) -> Result<(ty::Binder<I, AsyncCallableRelevantTypes<I>>, Vec<I::Predicate>), NoSolution> {
441441
match self_ty.kind() {
442442
ty::CoroutineClosure(def_id, args) => {
443+
if !cx.coroutine_is_async(cx.coroutine_for_closure(def_id)) {
444+
return Err(NoSolution);
445+
}
446+
443447
let args = args.as_coroutine_closure();
444448
let kind_ty = args.kind_ty();
445449
let sig = args.coroutine_closure_sig().skip_binder();

‎compiler/rustc_target/src/callconv/mod.rs‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,10 @@ impl<'a, Ty> FnAbi<'a, Ty> {
809809
// x86-64 non-softfloat targets all require SSE2 so we can use SSE registers.
810810
arg.layout.size.bits() <= 128
811811
}
812-
// So far, we haven't implemented this logic for any other target.
812+
Arch::AArch64 if spec.rustc_abi != Some(RustcAbi::Softfloat) => {
813+
// aarch64 non-softfloat targets all require Neon
814+
arg.layout.size.bits() <= 128
815+
}
813816
_ => false,
814817
};
815818

‎compiler/rustc_type_ir/src/const_kind.rs‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,11 @@ impl<I: Interner> AliasConst<I> {
9494
}
9595
}
9696

97-
/// AliasConstKind is extremely similar to AliasTyKind, and likely should be reasoned about
98-
/// and handled in very similar ways. The documentation for AliasTyKind/etc. may be helpful when
99-
/// learning about AliasConstKind.
97+
/// `AliasConstKind` is extremely similar to [`AliasTyKind`], and likely should be reasoned about
98+
/// and handled in very similar ways. The documentation for [`AliasTyKind`]/etc. may be helpful when
99+
/// learning about `AliasConstKind`.
100+
///
101+
/// [`AliasTyKind`]: crate::AliasTyKind
100102
#[derive_where(Clone, Copy, Hash, PartialEq, Debug; I: Interner)]
101103
#[derive(TypeVisitable_Generic, GenericTypeVisitable, TypeFoldable_Generic, Lift_Generic)]
102104
#[cfg_attr(

‎library/std/src/fs/tests.rs‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ fn file_test_io_seek_and_write() {
183183
target_os = "freebsd",
184184
target_os = "fuchsia",
185185
target_os = "hurd",
186+
target_os = "haiku",
186187
target_os = "illumos",
187188
target_os = "linux",
188189
target_os = "netbsd",
@@ -217,6 +218,7 @@ fn file_lock_multiple_shared() {
217218
target_os = "freebsd",
218219
target_os = "fuchsia",
219220
target_os = "hurd",
221+
target_os = "haiku",
220222
target_os = "illumos",
221223
target_os = "linux",
222224
target_os = "netbsd",
@@ -252,6 +254,7 @@ fn file_lock_blocking() {
252254
target_os = "freebsd",
253255
target_os = "fuchsia",
254256
target_os = "hurd",
257+
target_os = "haiku",
255258
target_os = "illumos",
256259
target_os = "linux",
257260
target_os = "netbsd",
@@ -284,6 +287,7 @@ fn file_lock_drop() {
284287
target_os = "freebsd",
285288
target_os = "fuchsia",
286289
target_os = "hurd",
290+
target_os = "haiku",
287291
target_os = "illumos",
288292
target_os = "linux",
289293
target_os = "netbsd",
@@ -318,6 +322,7 @@ fn file_lock_dup() {
318322
target_os = "freebsd",
319323
target_os = "fuchsia",
320324
target_os = "hurd",
325+
target_os = "haiku",
321326
target_os = "illumos",
322327
target_os = "linux",
323328
target_os = "netbsd",
@@ -340,7 +345,7 @@ fn file_lock_double() {
340345
// The behavior here differs between Windows and Unix: on Windows, f1 holds both locks;
341346
// on Unix, the lock got downgraded so f1 only holds the shared lock.
342347
assert_matches!(f2.try_lock(), Err(TryLockError::WouldBlock));
343-
if cfg!(windows) {
348+
if cfg!(any(windows, target_os = "haiku")) {
344349
assert_matches!(f2.try_lock_shared(), Err(TryLockError::WouldBlock));
345350
} else {
346351
check!(f2.try_lock_shared());

‎library/std/src/os/unix/process.rs‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,15 @@ impl From<OwnedFd> for process::ChildStderr {
747747
}
748748

749749
/// Returns the OS-assigned process identifier associated with this process's parent.
750+
///
751+
/// # Example
752+
///
753+
#[cfg_attr(target_family = "unix", doc = "```")]
754+
#[cfg_attr(not(target_family = "unix"), doc = "```ignore (needs unix)")]
755+
/// use std::os::unix::process;
756+
/// let parent = process::parent_id();
757+
/// println!("The parent process has ID {}", parent);
758+
/// ```
750759
#[must_use]
751760
#[stable(feature = "unix_ppid", since = "1.27.0")]
752761
pub fn parent_id() -> u32 {

‎library/std/src/sys/fs/unix.rs‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1309,6 +1309,7 @@ impl File {
13091309
target_os = "cygwin",
13101310
target_os = "illumos",
13111311
target_os = "aix",
1312+
target_os = "haiku",
13121313
target_os = "android",
13131314
target_os = "redox",
13141315
target_vendor = "apple",
@@ -1332,6 +1333,7 @@ impl File {
13321333
target_os = "cygwin",
13331334
target_os = "illumos",
13341335
target_os = "aix",
1336+
target_os = "haiku",
13351337
target_os = "android",
13361338
target_os = "redox",
13371339
target_vendor = "apple",
@@ -1355,6 +1357,7 @@ impl File {
13551357
target_os = "cygwin",
13561358
target_os = "illumos",
13571359
target_os = "aix",
1360+
target_os = "haiku",
13581361
target_os = "android",
13591362
target_os = "redox",
13601363
target_vendor = "apple",
@@ -1390,6 +1393,7 @@ impl File {
13901393
target_os = "cygwin",
13911394
target_os = "illumos",
13921395
target_os = "aix",
1396+
target_os = "haiku",
13931397
target_os = "android",
13941398
target_os = "redox",
13951399
target_vendor = "apple",
@@ -1425,6 +1429,7 @@ impl File {
14251429
target_os = "cygwin",
14261430
target_os = "illumos",
14271431
target_os = "aix",
1432+
target_os = "haiku",
14281433
target_os = "android",
14291434
target_os = "redox",
14301435
target_vendor = "apple",

‎library/std/src/sys/sync/condvar/no_threads.rs‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@ use crate::sys::sync::Mutex;
22
use crate::thread::sleep;
33
use crate::time::Duration;
44

5-
#[cfg(target_has_threads)]
5+
#[cfg(all(
6+
target_has_threads,
7+
// VEXos is only "target_has_threads" because it allows user interrupt handlers which preempt
8+
// the main thread, but they are forbidden from accessing sync primitives (the same as UNIX
9+
// signal handlers).
10+
not(target_os = "vexos"),
11+
))]
612
compile_error!("Using no_threads implementation on a target with threads");
713

814
pub struct Condvar {}

‎library/std/src/sys/sync/mutex/no_threads.rs‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
use crate::cell::Cell;
22

3-
#[cfg(target_has_threads)]
3+
#[cfg(all(
4+
target_has_threads,
5+
// VEXos is only "target_has_threads" because it allows user interrupt handlers which preempt
6+
// the main thread, but they are forbidden from accessing sync primitives (the same as UNIX
7+
// signal handlers).
8+
not(target_os = "vexos"),
9+
))]
410
compile_error!("Using no_threads implementation on a target with threads");
511

612
pub struct Mutex {

‎library/std/src/sys/sync/once/no_threads.rs‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@ use crate::cell::Cell;
22
use crate::sync as public;
33
use crate::sync::once::OnceExclusiveState;
44

5-
#[cfg(target_has_threads)]
5+
#[cfg(all(
6+
target_has_threads,
7+
// VEXos is only "target_has_threads" because it allows user interrupt handlers which preempt
8+
// the main thread, but they are forbidden from accessing sync primitives (the same as UNIX
9+
// signal handlers).
10+
not(target_os = "vexos"),
11+
))]
612
compile_error!("Using no_threads implementation on a target with threads");
713

814
pub struct Once {

0 commit comments

Comments
 (0)