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
This commit is contained in:
commit
9ffe52e05b
@ -189,7 +189,7 @@
|
||||
/// ```
|
||||
///
|
||||
/// This example is quite unlike anything that would be used in the real world: it is redundant
|
||||
/// to put an an assertion right next to code that checks the same thing, and dereferencing a
|
||||
/// to put an assertion right next to code that checks the same thing, and dereferencing a
|
||||
/// pointer already has the builtin assumption that it is nonnull. However, it illustrates the
|
||||
/// kind of changes the optimizer can make even when the behavior is less obviously related.
|
||||
#[track_caller]
|
||||
|
@ -200,7 +200,7 @@ fn logical_merge<T, F: FnMut(&T, &T) -> bool>(
|
||||
// If one or both of the runs are sorted do a physical merge, using
|
||||
// quicksort to sort the unsorted run if present. We also *need* to
|
||||
// physically merge if the combined runs would not fit in the scratch space
|
||||
// anymore (as this would mean we are no longer able to to quicksort them).
|
||||
// anymore (as this would mean we are no longer able to quicksort them).
|
||||
let len = v.len();
|
||||
let can_fit_in_scratch = len <= scratch.len();
|
||||
if !can_fit_in_scratch || left.sorted() || right.sorted() {
|
||||
|
@ -30,6 +30,8 @@ pub fn swizzle_dyn(self, idxs: Simd<u8, N>) -> Self {
|
||||
use core::arch::arm::{uint8x8_t, vtbl1_u8};
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
use core::arch::wasm32 as wasm;
|
||||
#[cfg(target_arch = "wasm64")]
|
||||
use core::arch::wasm64 as wasm;
|
||||
#[cfg(target_arch = "x86")]
|
||||
use core::arch::x86;
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
|
@ -266,6 +266,7 @@
|
||||
)]
|
||||
#![cfg_attr(any(windows, target_os = "uefi"), feature(round_char_boundary))]
|
||||
#![cfg_attr(target_family = "wasm", feature(stdarch_wasm_atomic_wait))]
|
||||
#![cfg_attr(target_arch = "wasm64", feature(simd_wasm64))]
|
||||
#![cfg_attr(
|
||||
all(any(target_arch = "x86_64", target_arch = "x86"), target_os = "uefi"),
|
||||
feature(stdarch_x86_has_cpuid)
|
||||
|
@ -1976,13 +1976,14 @@ pub fn chroot(dir: &Path) -> io::Result<()> {
|
||||
|
||||
pub use remove_dir_impl::remove_dir_all;
|
||||
|
||||
// Fallback for REDOX, ESP-ID, Horizon, Vita and Miri
|
||||
// Fallback for REDOX, ESP-ID, Horizon, Vita, Vxworks and Miri
|
||||
#[cfg(any(
|
||||
target_os = "redox",
|
||||
target_os = "espidf",
|
||||
target_os = "horizon",
|
||||
target_os = "vita",
|
||||
target_os = "nto",
|
||||
target_os = "vxworks",
|
||||
miri
|
||||
))]
|
||||
mod remove_dir_impl {
|
||||
@ -1996,6 +1997,7 @@ mod remove_dir_impl {
|
||||
target_os = "horizon",
|
||||
target_os = "vita",
|
||||
target_os = "nto",
|
||||
target_os = "vxworks",
|
||||
miri
|
||||
)))]
|
||||
mod remove_dir_impl {
|
||||
|
@ -1,5 +1,5 @@
|
||||
use crate::fmt;
|
||||
use crate::io::{self, Error, ErrorKind};
|
||||
use crate::io::{self, ErrorKind};
|
||||
use crate::num::NonZero;
|
||||
use crate::sys;
|
||||
use crate::sys::cvt;
|
||||
|
@ -1,4 +1,8 @@
|
||||
use crate::arch::wasm32;
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
use core::arch::wasm32 as wasm;
|
||||
#[cfg(target_arch = "wasm64")]
|
||||
use core::arch::wasm64 as wasm;
|
||||
|
||||
use crate::sync::atomic::AtomicU32;
|
||||
use crate::time::Duration;
|
||||
|
||||
@ -10,11 +14,8 @@
|
||||
pub fn futex_wait(futex: &AtomicU32, expected: u32, timeout: Option<Duration>) -> bool {
|
||||
let timeout = timeout.and_then(|t| t.as_nanos().try_into().ok()).unwrap_or(-1);
|
||||
unsafe {
|
||||
wasm32::memory_atomic_wait32(
|
||||
futex as *const AtomicU32 as *mut i32,
|
||||
expected as i32,
|
||||
timeout,
|
||||
) < 2
|
||||
wasm::memory_atomic_wait32(futex as *const AtomicU32 as *mut i32, expected as i32, timeout)
|
||||
< 2
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,12 +24,12 @@ pub fn futex_wait(futex: &AtomicU32, expected: u32, timeout: Option<Duration>) -
|
||||
/// Returns true if this actually woke up such a thread,
|
||||
/// or false if no thread was waiting on this futex.
|
||||
pub fn futex_wake(futex: &AtomicU32) -> bool {
|
||||
unsafe { wasm32::memory_atomic_notify(futex as *const AtomicU32 as *mut i32, 1) > 0 }
|
||||
unsafe { wasm::memory_atomic_notify(futex as *const AtomicU32 as *mut i32, 1) > 0 }
|
||||
}
|
||||
|
||||
/// Wake up all threads that are waiting on futex_wait on this futex.
|
||||
pub fn futex_wake_all(futex: &AtomicU32) {
|
||||
unsafe {
|
||||
wasm32::memory_atomic_notify(futex as *const AtomicU32 as *mut i32, i32::MAX as u32);
|
||||
wasm::memory_atomic_notify(futex as *const AtomicU32 as *mut i32, i32::MAX as u32);
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,11 @@ pub fn yield_now() {}
|
||||
pub fn set_name(_name: &CStr) {}
|
||||
|
||||
pub fn sleep(dur: Duration) {
|
||||
use crate::arch::wasm32;
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
use core::arch::wasm32 as wasm;
|
||||
#[cfg(target_arch = "wasm64")]
|
||||
use core::arch::wasm64 as wasm;
|
||||
|
||||
use crate::cmp;
|
||||
|
||||
// Use an atomic wait to block the current thread artificially with a
|
||||
@ -31,7 +35,7 @@ pub fn sleep(dur: Duration) {
|
||||
while nanos > 0 {
|
||||
let amt = cmp::min(i64::MAX as u128, nanos);
|
||||
let mut x = 0;
|
||||
let val = unsafe { wasm32::memory_atomic_wait32(&mut x, 0, amt as i64) };
|
||||
let val = unsafe { wasm::memory_atomic_wait32(&mut x, 0, amt as i64) };
|
||||
debug_assert_eq!(val, 2);
|
||||
nanos -= amt;
|
||||
}
|
||||
|
@ -1286,7 +1286,7 @@ pub(crate) fn get_trait_path(&self) -> Option<Path> {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug, Hash)]
|
||||
pub(crate) struct Lifetime(pub Symbol);
|
||||
|
||||
impl Lifetime {
|
||||
|
@ -10,6 +10,7 @@
|
||||
use rustc_attr::DeprecatedSince;
|
||||
use rustc_hir::{def::CtorKind, def::DefKind, def_id::DefId};
|
||||
use rustc_metadata::rendered_const;
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::ty::{self, TyCtxt};
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_span::{Pos, Symbol};
|
||||
@ -512,9 +513,15 @@ fn from_tcx(predicate: clean::WherePredicate, tcx: TyCtxt<'_>) -> Self {
|
||||
})
|
||||
.collect(),
|
||||
},
|
||||
RegionPredicate { lifetime, bounds } => WherePredicate::RegionPredicate {
|
||||
RegionPredicate { lifetime, bounds } => WherePredicate::LifetimePredicate {
|
||||
lifetime: convert_lifetime(lifetime),
|
||||
bounds: bounds.into_tcx(tcx),
|
||||
outlives: bounds
|
||||
.iter()
|
||||
.map(|bound| match bound {
|
||||
clean::GenericBound::Outlives(lt) => convert_lifetime(*lt),
|
||||
_ => bug!("found non-outlives-bound on lifetime predicate"),
|
||||
})
|
||||
.collect(),
|
||||
},
|
||||
EqPredicate { lhs, rhs } => {
|
||||
WherePredicate::EqPredicate { lhs: lhs.into_tcx(tcx), rhs: rhs.into_tcx(tcx) }
|
||||
|
@ -8,7 +8,7 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
/// rustdoc format-version.
|
||||
pub const FORMAT_VERSION: u32 = 30;
|
||||
pub const FORMAT_VERSION: u32 = 31;
|
||||
|
||||
/// A `Crate` is the root of the emitted JSON blob. It contains all type/documentation information
|
||||
/// about the language items in the local crate, as well as info about external items to allow
|
||||
@ -511,9 +511,9 @@ pub enum WherePredicate {
|
||||
/// ```
|
||||
generic_params: Vec<GenericParamDef>,
|
||||
},
|
||||
RegionPredicate {
|
||||
LifetimePredicate {
|
||||
lifetime: String,
|
||||
bounds: Vec<GenericBound>,
|
||||
outlives: Vec<String>,
|
||||
},
|
||||
EqPredicate {
|
||||
lhs: Type,
|
||||
|
@ -56,6 +56,8 @@ pub enum CommandKind {
|
||||
|
||||
impl CommandKind {
|
||||
fn validate(&self, args: &[String], lineno: usize) -> bool {
|
||||
// FIXME(adotinthevoid): We should "parse, don't validate" here, so we avoid ad-hoc
|
||||
// indexing in check_command.
|
||||
let count = match self {
|
||||
CommandKind::Has => (1..=2).contains(&args.len()),
|
||||
CommandKind::IsMany => args.len() >= 2,
|
||||
@ -71,7 +73,7 @@ fn validate(&self, args: &[String], lineno: usize) -> bool {
|
||||
if let CommandKind::Count = self {
|
||||
if args[1].parse::<usize>().is_err() {
|
||||
print_err(
|
||||
&format!("Second argument to @count must be a valid usize (got `{}`)", args[2]),
|
||||
&format!("Second argument to @count must be a valid usize (got `{}`)", args[1]),
|
||||
lineno,
|
||||
);
|
||||
return false;
|
||||
|
@ -374,8 +374,8 @@ fn check_where_predicate(&mut self, w: &'a WherePredicate) {
|
||||
bounds.iter().for_each(|b| self.check_generic_bound(b));
|
||||
generic_params.iter().for_each(|gpd| self.check_generic_param_def(gpd));
|
||||
}
|
||||
WherePredicate::RegionPredicate { lifetime: _, bounds } => {
|
||||
bounds.iter().for_each(|b| self.check_generic_bound(b));
|
||||
WherePredicate::LifetimePredicate { lifetime: _, outlives: _ } => {
|
||||
// nop, all strings.
|
||||
}
|
||||
WherePredicate::EqPredicate { lhs, rhs } => {
|
||||
self.check_type(lhs);
|
||||
|
8
tests/rustdoc-json/lifetime/outlives_in_param.rs
Normal file
8
tests/rustdoc-json/lifetime/outlives_in_param.rs
Normal file
@ -0,0 +1,8 @@
|
||||
// ignore-tidy-linelength
|
||||
|
||||
// @count '$.index[*][?(@.name=="outlives")].inner.function.generics.params[*]' 2
|
||||
// @is '$.index[*][?(@.name=="outlives")].inner.function.generics.params[0].name' \"\'a\"
|
||||
// @is '$.index[*][?(@.name=="outlives")].inner.function.generics.params[0].kind.lifetime.outlives' []
|
||||
// @is '$.index[*][?(@.name=="outlives")].inner.function.generics.params[1].name' '"T"'
|
||||
// @is '$.index[*][?(@.name=="outlives")].inner.function.generics.params[1].kind.type.bounds' '[{"outlives": "'\''a"}]'
|
||||
pub fn outlives<'a, T: 'a>() {}
|
24
tests/rustdoc-json/lifetime/outlives_in_where.rs
Normal file
24
tests/rustdoc-json/lifetime/outlives_in_where.rs
Normal file
@ -0,0 +1,24 @@
|
||||
// ignore-tidy-linelength
|
||||
|
||||
// @is '$.index[*][?(@.name=="on_lifetimes")].inner.function.generics.where_predicates' '[{"lifetime_predicate": {"lifetime": "'\''all", "outlives": ["'\''a", "'\''b", "'\''c"]}}]'
|
||||
pub fn on_lifetimes<'a, 'b, 'c, 'all>()
|
||||
where
|
||||
'all: 'a + 'b + 'c,
|
||||
{
|
||||
}
|
||||
|
||||
// @count '$.index[*][?(@.name=="on_trait")].inner.function.generics.params[*]' 2
|
||||
// @is '$.index[*][?(@.name=="on_trait")].inner.function.generics.params[0].name' \"\'a\"
|
||||
// @is '$.index[*][?(@.name=="on_trait")].inner.function.generics.params[0].kind.lifetime.outlives' []
|
||||
// @is '$.index[*][?(@.name=="on_trait")].inner.function.generics.params[1].name' '"T"'
|
||||
// @is '$.index[*][?(@.name=="on_trait")].inner.function.generics.params[1].kind.type.bounds' []
|
||||
// @is '$.index[*][?(@.name=="on_trait")].inner.function.generics.params[1].kind.type.bounds' []
|
||||
// @count '$.index[*][?(@.name=="on_trait")].inner.function.generics.where_predicates[*]' 1
|
||||
// @is '$.index[*][?(@.name=="on_trait")].inner.function.generics.where_predicates[0].bound_predicate.type.generic' '"T"'
|
||||
// @count '$.index[*][?(@.name=="on_trait")].inner.function.generics.where_predicates[0].bound_predicate.bounds[*]' 1
|
||||
// @is '$.index[*][?(@.name=="on_trait")].inner.function.generics.where_predicates[0].bound_predicate.bounds[0].outlives' \"\'a\"
|
||||
pub fn on_trait<'a, T>()
|
||||
where
|
||||
T: 'a,
|
||||
{
|
||||
}
|
Loading…
Reference in New Issue
Block a user