Skip to content

Commit 9ffe52e

Browse files
committed
Auto merge of #127305 - jhpratt:rollup-3p5wf3h, r=jhpratt
Rollup of 5 pull requests Successful merges: - #126792 (wasm64 build with target-feature=+simd128,+atomics) - #127195 (Remove unqualified form import of io::Error in process_vxworks.rs and fallback on remove_dir_impl for vxworks) - #127287 (jsondocck: Use correct index for error message.) - #127289 (rustdoc-json: Better representation of lifetime bounds in where clauses.) - #127303 (chore: remove repeat words) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 486bc27 + 71ea0b9 commit 9ffe52e

File tree

15 files changed

+74
-23
lines changed

15 files changed

+74
-23
lines changed

library/core/src/hint.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ pub const unsafe fn unreachable_unchecked() -> ! {
189189
/// ```
190190
///
191191
/// This example is quite unlike anything that would be used in the real world: it is redundant
192-
/// to put an an assertion right next to code that checks the same thing, and dereferencing a
192+
/// to put an assertion right next to code that checks the same thing, and dereferencing a
193193
/// pointer already has the builtin assumption that it is nonnull. However, it illustrates the
194194
/// kind of changes the optimizer can make even when the behavior is less obviously related.
195195
#[track_caller]

library/core/src/slice/sort/stable/drift.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ fn logical_merge<T, F: FnMut(&T, &T) -> bool>(
200200
// If one or both of the runs are sorted do a physical merge, using
201201
// quicksort to sort the unsorted run if present. We also *need* to
202202
// physically merge if the combined runs would not fit in the scratch space
203-
// anymore (as this would mean we are no longer able to to quicksort them).
203+
// anymore (as this would mean we are no longer able to quicksort them).
204204
let len = v.len();
205205
let can_fit_in_scratch = len <= scratch.len();
206206
if !can_fit_in_scratch || left.sorted() || right.sorted() {

library/portable-simd/crates/core_simd/src/swizzle_dyn.rs

+2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ where
3030
use core::arch::arm::{uint8x8_t, vtbl1_u8};
3131
#[cfg(target_arch = "wasm32")]
3232
use core::arch::wasm32 as wasm;
33+
#[cfg(target_arch = "wasm64")]
34+
use core::arch::wasm64 as wasm;
3335
#[cfg(target_arch = "x86")]
3436
use core::arch::x86;
3537
#[cfg(target_arch = "x86_64")]

library/std/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@
266266
)]
267267
#![cfg_attr(any(windows, target_os = "uefi"), feature(round_char_boundary))]
268268
#![cfg_attr(target_family = "wasm", feature(stdarch_wasm_atomic_wait))]
269+
#![cfg_attr(target_arch = "wasm64", feature(simd_wasm64))]
269270
#![cfg_attr(
270271
all(any(target_arch = "x86_64", target_arch = "x86"), target_os = "uefi"),
271272
feature(stdarch_x86_has_cpuid)

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

+3-1
Original file line numberDiff line numberDiff line change
@@ -1976,13 +1976,14 @@ pub fn chroot(dir: &Path) -> io::Result<()> {
19761976

19771977
pub use remove_dir_impl::remove_dir_all;
19781978

1979-
// Fallback for REDOX, ESP-ID, Horizon, Vita and Miri
1979+
// Fallback for REDOX, ESP-ID, Horizon, Vita, Vxworks and Miri
19801980
#[cfg(any(
19811981
target_os = "redox",
19821982
target_os = "espidf",
19831983
target_os = "horizon",
19841984
target_os = "vita",
19851985
target_os = "nto",
1986+
target_os = "vxworks",
19861987
miri
19871988
))]
19881989
mod remove_dir_impl {
@@ -1996,6 +1997,7 @@ mod remove_dir_impl {
19961997
target_os = "horizon",
19971998
target_os = "vita",
19981999
target_os = "nto",
2000+
target_os = "vxworks",
19992001
miri
20002002
)))]
20012003
mod remove_dir_impl {

library/std/src/sys/pal/unix/process/process_vxworks.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::fmt;
2-
use crate::io::{self, Error, ErrorKind};
2+
use crate::io::{self, ErrorKind};
33
use crate::num::NonZero;
44
use crate::sys;
55
use crate::sys::cvt;
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
use crate::arch::wasm32;
1+
#[cfg(target_arch = "wasm32")]
2+
use core::arch::wasm32 as wasm;
3+
#[cfg(target_arch = "wasm64")]
4+
use core::arch::wasm64 as wasm;
5+
26
use crate::sync::atomic::AtomicU32;
37
use crate::time::Duration;
48

@@ -10,11 +14,8 @@ use crate::time::Duration;
1014
pub fn futex_wait(futex: &AtomicU32, expected: u32, timeout: Option<Duration>) -> bool {
1115
let timeout = timeout.and_then(|t| t.as_nanos().try_into().ok()).unwrap_or(-1);
1216
unsafe {
13-
wasm32::memory_atomic_wait32(
14-
futex as *const AtomicU32 as *mut i32,
15-
expected as i32,
16-
timeout,
17-
) < 2
17+
wasm::memory_atomic_wait32(futex as *const AtomicU32 as *mut i32, expected as i32, timeout)
18+
< 2
1819
}
1920
}
2021

@@ -23,12 +24,12 @@ pub fn futex_wait(futex: &AtomicU32, expected: u32, timeout: Option<Duration>) -
2324
/// Returns true if this actually woke up such a thread,
2425
/// or false if no thread was waiting on this futex.
2526
pub fn futex_wake(futex: &AtomicU32) -> bool {
26-
unsafe { wasm32::memory_atomic_notify(futex as *const AtomicU32 as *mut i32, 1) > 0 }
27+
unsafe { wasm::memory_atomic_notify(futex as *const AtomicU32 as *mut i32, 1) > 0 }
2728
}
2829

2930
/// Wake up all threads that are waiting on futex_wait on this futex.
3031
pub fn futex_wake_all(futex: &AtomicU32) {
3132
unsafe {
32-
wasm32::memory_atomic_notify(futex as *const AtomicU32 as *mut i32, i32::MAX as u32);
33+
wasm::memory_atomic_notify(futex as *const AtomicU32 as *mut i32, i32::MAX as u32);
3334
}
3435
}

library/std/src/sys/pal/wasm/atomics/thread.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ impl Thread {
1919
pub fn set_name(_name: &CStr) {}
2020

2121
pub fn sleep(dur: Duration) {
22-
use crate::arch::wasm32;
22+
#[cfg(target_arch = "wasm32")]
23+
use core::arch::wasm32 as wasm;
24+
#[cfg(target_arch = "wasm64")]
25+
use core::arch::wasm64 as wasm;
26+
2327
use crate::cmp;
2428

2529
// Use an atomic wait to block the current thread artificially with a
@@ -31,7 +35,7 @@ impl Thread {
3135
while nanos > 0 {
3236
let amt = cmp::min(i64::MAX as u128, nanos);
3337
let mut x = 0;
34-
let val = unsafe { wasm32::memory_atomic_wait32(&mut x, 0, amt as i64) };
38+
let val = unsafe { wasm::memory_atomic_wait32(&mut x, 0, amt as i64) };
3539
debug_assert_eq!(val, 2);
3640
nanos -= amt;
3741
}

src/librustdoc/clean/types.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1286,7 +1286,7 @@ impl GenericBound {
12861286
}
12871287
}
12881288

1289-
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
1289+
#[derive(Clone, Copy, PartialEq, Eq, Debug, Hash)]
12901290
pub(crate) struct Lifetime(pub Symbol);
12911291

12921292
impl Lifetime {

src/librustdoc/json/conversions.rs

+9-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use rustc_ast::ast;
1010
use rustc_attr::DeprecatedSince;
1111
use rustc_hir::{def::CtorKind, def::DefKind, def_id::DefId};
1212
use rustc_metadata::rendered_const;
13+
use rustc_middle::bug;
1314
use rustc_middle::ty::{self, TyCtxt};
1415
use rustc_span::symbol::sym;
1516
use rustc_span::{Pos, Symbol};
@@ -512,9 +513,15 @@ impl FromWithTcx<clean::WherePredicate> for WherePredicate {
512513
})
513514
.collect(),
514515
},
515-
RegionPredicate { lifetime, bounds } => WherePredicate::RegionPredicate {
516+
RegionPredicate { lifetime, bounds } => WherePredicate::LifetimePredicate {
516517
lifetime: convert_lifetime(lifetime),
517-
bounds: bounds.into_tcx(tcx),
518+
outlives: bounds
519+
.iter()
520+
.map(|bound| match bound {
521+
clean::GenericBound::Outlives(lt) => convert_lifetime(*lt),
522+
_ => bug!("found non-outlives-bound on lifetime predicate"),
523+
})
524+
.collect(),
518525
},
519526
EqPredicate { lhs, rhs } => {
520527
WherePredicate::EqPredicate { lhs: lhs.into_tcx(tcx), rhs: rhs.into_tcx(tcx) }

src/rustdoc-json-types/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use serde::{Deserialize, Serialize};
88
use std::path::PathBuf;
99

1010
/// rustdoc format-version.
11-
pub const FORMAT_VERSION: u32 = 30;
11+
pub const FORMAT_VERSION: u32 = 31;
1212

1313
/// A `Crate` is the root of the emitted JSON blob. It contains all type/documentation information
1414
/// about the language items in the local crate, as well as info about external items to allow
@@ -511,9 +511,9 @@ pub enum WherePredicate {
511511
/// ```
512512
generic_params: Vec<GenericParamDef>,
513513
},
514-
RegionPredicate {
514+
LifetimePredicate {
515515
lifetime: String,
516-
bounds: Vec<GenericBound>,
516+
outlives: Vec<String>,
517517
},
518518
EqPredicate {
519519
lhs: Type,

src/tools/jsondocck/src/main.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ pub enum CommandKind {
5656

5757
impl CommandKind {
5858
fn validate(&self, args: &[String], lineno: usize) -> bool {
59+
// FIXME(adotinthevoid): We should "parse, don't validate" here, so we avoid ad-hoc
60+
// indexing in check_command.
5961
let count = match self {
6062
CommandKind::Has => (1..=2).contains(&args.len()),
6163
CommandKind::IsMany => args.len() >= 2,
@@ -71,7 +73,7 @@ impl CommandKind {
7173
if let CommandKind::Count = self {
7274
if args[1].parse::<usize>().is_err() {
7375
print_err(
74-
&format!("Second argument to @count must be a valid usize (got `{}`)", args[2]),
76+
&format!("Second argument to @count must be a valid usize (got `{}`)", args[1]),
7577
lineno,
7678
);
7779
return false;

src/tools/jsondoclint/src/validator.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -374,8 +374,8 @@ impl<'a> Validator<'a> {
374374
bounds.iter().for_each(|b| self.check_generic_bound(b));
375375
generic_params.iter().for_each(|gpd| self.check_generic_param_def(gpd));
376376
}
377-
WherePredicate::RegionPredicate { lifetime: _, bounds } => {
378-
bounds.iter().for_each(|b| self.check_generic_bound(b));
377+
WherePredicate::LifetimePredicate { lifetime: _, outlives: _ } => {
378+
// nop, all strings.
379379
}
380380
WherePredicate::EqPredicate { lhs, rhs } => {
381381
self.check_type(lhs);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// ignore-tidy-linelength
2+
3+
// @count '$.index[*][?(@.name=="outlives")].inner.function.generics.params[*]' 2
4+
// @is '$.index[*][?(@.name=="outlives")].inner.function.generics.params[0].name' \"\'a\"
5+
// @is '$.index[*][?(@.name=="outlives")].inner.function.generics.params[0].kind.lifetime.outlives' []
6+
// @is '$.index[*][?(@.name=="outlives")].inner.function.generics.params[1].name' '"T"'
7+
// @is '$.index[*][?(@.name=="outlives")].inner.function.generics.params[1].kind.type.bounds' '[{"outlives": "'\''a"}]'
8+
pub fn outlives<'a, T: 'a>() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// ignore-tidy-linelength
2+
3+
// @is '$.index[*][?(@.name=="on_lifetimes")].inner.function.generics.where_predicates' '[{"lifetime_predicate": {"lifetime": "'\''all", "outlives": ["'\''a", "'\''b", "'\''c"]}}]'
4+
pub fn on_lifetimes<'a, 'b, 'c, 'all>()
5+
where
6+
'all: 'a + 'b + 'c,
7+
{
8+
}
9+
10+
// @count '$.index[*][?(@.name=="on_trait")].inner.function.generics.params[*]' 2
11+
// @is '$.index[*][?(@.name=="on_trait")].inner.function.generics.params[0].name' \"\'a\"
12+
// @is '$.index[*][?(@.name=="on_trait")].inner.function.generics.params[0].kind.lifetime.outlives' []
13+
// @is '$.index[*][?(@.name=="on_trait")].inner.function.generics.params[1].name' '"T"'
14+
// @is '$.index[*][?(@.name=="on_trait")].inner.function.generics.params[1].kind.type.bounds' []
15+
// @is '$.index[*][?(@.name=="on_trait")].inner.function.generics.params[1].kind.type.bounds' []
16+
// @count '$.index[*][?(@.name=="on_trait")].inner.function.generics.where_predicates[*]' 1
17+
// @is '$.index[*][?(@.name=="on_trait")].inner.function.generics.where_predicates[0].bound_predicate.type.generic' '"T"'
18+
// @count '$.index[*][?(@.name=="on_trait")].inner.function.generics.where_predicates[0].bound_predicate.bounds[*]' 1
19+
// @is '$.index[*][?(@.name=="on_trait")].inner.function.generics.where_predicates[0].bound_predicate.bounds[0].outlives' \"\'a\"
20+
pub fn on_trait<'a, T>()
21+
where
22+
T: 'a,
23+
{
24+
}

0 commit comments

Comments
 (0)