Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
cfd52bb
rustc: Stop passing `--allow-undefined` on wasm targets
alexcrichton Dec 10, 2025
08abc44
Add test for SGX delayed host lookup via ToSocketAddr
Feb 19, 2026
e2b3087
Fix SGX delayed host lookup via ToSocketAddr
Feb 24, 2026
fadd60b
Move default implementation of lookup_host_string to sys/net/connection.
sardok Mar 13, 2026
83a7a4a
Clarified docs in std::sync::RwLock and added a test that checks if w…
asder8215 Mar 8, 2026
4b0caec
Panic/return false on overflow in no_threads read/try_read impl
asder8215 Mar 28, 2026
1d7d435
Panic on unlocking a non-read locked RwLock + provided better error msgs
asder8215 Mar 30, 2026
a374727
resolve: issue 154452 solve
lms0806 Mar 27, 2026
6c46776
Debug for vec::ExtractIf
GrigorenkoPV Mar 29, 2026
f1d240c
rustdoc-search: match path components on words
notriddle Apr 4, 2026
a1feab1
use libm for acosh and asinh
malezjaa Mar 18, 2026
bbe1afa
Rollup merge of #149868 - alexcrichton:wasm-no-allow-undefined, r=Mar…
JonathanBrouwer Apr 4, 2026
08343b5
Rollup merge of #153555 - asder8215:rwlock_docs, r=Mark-Simulacrum
JonathanBrouwer Apr 4, 2026
a5d2326
Rollup merge of #152851 - fortanix:jb/fix-sgx-non-ip-addr, r=Mark-Sim…
JonathanBrouwer Apr 4, 2026
69751ec
Rollup merge of #154051 - malezjaa:approximations-acosh-and-asinh, r=…
JonathanBrouwer Apr 4, 2026
ab3532f
Rollup merge of #154581 - GrigorenkoPV:extract-if-debug, r=Mark-Simul…
JonathanBrouwer Apr 4, 2026
a660f77
Rollup merge of #154461 - lms0806:issue_154452, r=Mark-Simulacrum
JonathanBrouwer Apr 4, 2026
67898f8
Rollup merge of #154526 - asder8215:no_threads_read_overflow, r=Mark-…
JonathanBrouwer Apr 4, 2026
4210825
Rollup merge of #154798 - notriddle:sub-word-path-match, r=GuillaumeG…
JonathanBrouwer Apr 4, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions compiler/rustc_target/src/spec/base/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,6 @@ pub(crate) fn options() -> TargetOptions {
// stack overflow will be guaranteed to trap as it underflows instead of
// corrupting static data.
concat!($prefix, "--stack-first"),
// FIXME we probably shouldn't pass this but instead pass an explicit list
// of symbols we'll allow to be undefined. We don't currently have a
// mechanism of knowing, however, which symbols are intended to be imported
// from the environment and which are intended to be imported from other
// objects linked elsewhere. This is a coarse approximation but is sure to
// hide some bugs and frustrate someone at some point, so we should ideally
// work towards a world where we can explicitly list symbols that are
// supposed to be imported and have all other symbols generate errors if
// they remain undefined.
concat!($prefix, "--allow-undefined"),
// LLD only implements C++-like demangling, which doesn't match our own
// mangling scheme. Tell LLD to not demangle anything and leave it up to
// us to demangle these symbols later. Currently rustc does not perform
Expand Down
9 changes: 9 additions & 0 deletions library/alloc/src/boxed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,15 @@ impl<T, A: Allocator> Box<T, A> {
/// does the same as <code>[Box::into_pin]\([Box::new_in]\(x, alloc))</code>. Consider using
/// [`into_pin`](Box::into_pin) if you already have a `Box<T, A>`, or if you want to
/// construct a (pinned) `Box` in a different way than with [`Box::new_in`].
///
/// # Examples
///
/// ```
/// #![feature(allocator_api)]
/// use std::alloc::System;
///
/// let x = Box::pin_in(1, System);
/// ```
#[cfg(not(no_global_oom_handling))]
#[unstable(feature = "allocator_api", issue = "32838")]
#[must_use]
Expand Down
8 changes: 4 additions & 4 deletions library/alloc/src/collections/binary_heap/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -549,8 +549,8 @@ impl<T, A: Allocator> BinaryHeap<T, A> {
///
/// use std::alloc::System;
/// use std::collections::BinaryHeap;
/// let mut heap = BinaryHeap::new_in(System);
/// heap.push(4);
///
/// let heap : BinaryHeap<i32, System> = BinaryHeap::new_in(System);
/// ```
#[unstable(feature = "allocator_api", issue = "32838")]
#[must_use]
Expand All @@ -573,8 +573,8 @@ impl<T, A: Allocator> BinaryHeap<T, A> {
///
/// use std::alloc::System;
/// use std::collections::BinaryHeap;
/// let mut heap = BinaryHeap::with_capacity_in(10, System);
/// heap.push(4);
///
/// let heap: BinaryHeap<i32, System> = BinaryHeap::with_capacity_in(10, System);
/// ```
#[unstable(feature = "allocator_api", issue = "32838")]
#[must_use]
Expand Down
6 changes: 2 additions & 4 deletions library/alloc/src/collections/btree/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -684,13 +684,11 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
/// ```
/// # #![feature(allocator_api)]
/// # #![feature(btreemap_alloc)]
///
/// use std::collections::BTreeMap;
/// use std::alloc::Global;
///
/// let mut map = BTreeMap::new_in(Global);
///
/// // entries can now be inserted into the empty map
/// map.insert(1, "a");
/// let map: BTreeMap<i32, i32> = BTreeMap::new_in(Global);
/// ```
#[unstable(feature = "btreemap_alloc", issue = "32838")]
#[must_use]
Expand Down
3 changes: 2 additions & 1 deletion library/alloc/src/collections/btree/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,10 +355,11 @@ impl<T, A: Allocator + Clone> BTreeSet<T, A> {
/// # #![allow(unused_mut)]
/// # #![feature(allocator_api)]
/// # #![feature(btreemap_alloc)]
///
/// use std::collections::BTreeSet;
/// use std::alloc::Global;
///
/// let mut set: BTreeSet<i32> = BTreeSet::new_in(Global);
/// let set: BTreeSet<i32> = BTreeSet::new_in(Global);
/// ```
#[unstable(feature = "btreemap_alloc", issue = "32838")]
#[must_use]
Expand Down
2 changes: 1 addition & 1 deletion library/alloc/src/collections/linked_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ impl<T, A: Allocator> LinkedList<T, A> {
/// use std::alloc::System;
/// use std::collections::LinkedList;
///
/// let list: LinkedList<u32, _> = LinkedList::new_in(System);
/// let list: LinkedList<i32, System> = LinkedList::new_in(System);
/// ```
#[inline]
#[unstable(feature = "allocator_api", issue = "32838")]
Expand Down
12 changes: 9 additions & 3 deletions library/alloc/src/collections/vec_deque/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ impl<T> VecDeque<T> {
/// ```
/// use std::collections::VecDeque;
///
/// let deque: VecDeque<u32> = VecDeque::with_capacity(10);
/// let deque: VecDeque<i32> = VecDeque::with_capacity(10);
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
Expand Down Expand Up @@ -830,9 +830,12 @@ impl<T, A: Allocator> VecDeque<T, A> {
/// # Examples
///
/// ```
/// # #![feature(allocator_api)]
///
/// use std::collections::VecDeque;
/// use std::alloc::Global;
///
/// let deque: VecDeque<u32> = VecDeque::new();
/// let deque: VecDeque<i32> = VecDeque::new_in(Global);
/// ```
#[inline]
#[unstable(feature = "allocator_api", issue = "32838")]
Expand All @@ -845,9 +848,12 @@ impl<T, A: Allocator> VecDeque<T, A> {
/// # Examples
///
/// ```
/// # #![feature(allocator_api)]
///
/// use std::collections::VecDeque;
/// use std::alloc::Global;
///
/// let deque: VecDeque<u32> = VecDeque::with_capacity(10);
/// let deque: VecDeque<i32> = VecDeque::with_capacity_in(10, Global);
/// ```
#[unstable(feature = "allocator_api", issue = "32838")]
pub fn with_capacity_in(capacity: usize, alloc: A) -> VecDeque<T, A> {
Expand Down
1 change: 1 addition & 0 deletions library/alloc/src/rc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,7 @@ impl<T, A: Allocator> Rc<T, A> {
///
/// ```
/// #![feature(allocator_api)]
///
/// use std::rc::Rc;
/// use std::alloc::System;
///
Expand Down
35 changes: 20 additions & 15 deletions library/alloc/src/vec/extract_if.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,20 +130,25 @@ where
A: Allocator,
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let peek = if self.idx < self.end {
// This has to use pointer arithmetic as `self.vec[self.idx]` or
// `self.vec.get_unchecked(self.idx)` wouldn't work since we
// temporarily set the length of `self.vec` to zero.
//
// SAFETY:
// Since `self.idx` is smaller than `self.end` and `self.end` is
// smaller than `self.old_len`, `idx` is valid for indexing the
// buffer. Also, per the invariant of `self.idx`, this element
// has not been inspected/moved out yet.
Some(unsafe { &*self.vec.as_ptr().add(self.idx) })
} else {
None
};
f.debug_struct("ExtractIf").field("peek", &peek).finish_non_exhaustive()
// We have to use pointer arithmetics here,
// because the length of `self.vec` is temporarily set to 0.
let start = self.vec.as_ptr();

// SAFETY: we always keep first `self.idx - self.del` elements valid.
let retained = unsafe { slice::from_raw_parts(start, self.idx - self.del) };

// SAFETY: we have not yet touched elements starting at `self.idx`.
let valid_tail =
unsafe { slice::from_raw_parts(start.add(self.idx), self.old_len - self.idx) };

// SAFETY: `end - idx <= old_len - idx`, because `end <= old_len`. Also `idx <= end` by invariant.
let (remainder, skipped_tail) =
unsafe { valid_tail.split_at_unchecked(self.end - self.idx) };

f.debug_struct("ExtractIf")
.field("retained", &retained)
.field("remainder", &remainder)
.field("skipped_tail", &skipped_tail)
.finish_non_exhaustive()
}
}
3 changes: 1 addition & 2 deletions library/alloc/src/vec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1062,8 +1062,7 @@ impl<T, A: Allocator> Vec<T, A> {
///
/// use std::alloc::System;
///
/// # #[allow(unused_mut)]
/// let mut vec: Vec<i32, _> = Vec::new_in(System);
/// let vec: Vec<i32, System> = Vec::new_in(System);
/// ```
#[inline]
#[unstable(feature = "allocator_api", issue = "32838")]
Expand Down
18 changes: 11 additions & 7 deletions library/alloctests/tests/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1651,13 +1651,17 @@ fn extract_if_unconsumed() {

#[test]
fn extract_if_debug() {
let mut vec = vec![1, 2];
let mut drain = vec.extract_if(.., |&mut x| x % 2 != 0);
assert!(format!("{drain:?}").contains("Some(1)"));
drain.next();
assert!(format!("{drain:?}").contains("Some(2)"));
drain.next();
assert!(format!("{drain:?}").contains("None"));
let mut vec = vec![1, 2, 3, 4, 5, 6, 7, 8];
let mut drain = vec.extract_if(1..5, |&mut x| x % 2 != 0);
assert_eq!(
format!("{drain:?}"),
"ExtractIf { retained: [1], remainder: [2, 3, 4, 5], skipped_tail: [6, 7, 8], .. }"
);
drain.next().unwrap();
assert_eq!(
format!("{drain:?}"),
"ExtractIf { retained: [1, 2], remainder: [4, 5], skipped_tail: [6, 7, 8], .. }"
);
}

#[test]
Expand Down
30 changes: 28 additions & 2 deletions library/coretests/tests/num/floats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ use std::hint::black_box;
use std::num::FpCategory as Fp;
use std::ops::{Add, Div, Mul, Rem, Sub};

/// i586 has issues with floating point precision.
const I586: bool = cfg!(target_arch = "x86") && cfg!(not(target_feature = "sse2"));

pub(crate) trait TestableFloat: Sized {
const BITS: u32;
/// Unsigned int with the same size, for converting to/from bits.
Expand Down Expand Up @@ -59,6 +62,7 @@ pub(crate) trait TestableFloat: Sized {
const NEG_MUL_ADD_RESULT: Self;
/// Reciprocal of the maximum val
const MAX_RECIP: Self;
const ASINH_ACOSH_MAX: Self;
}

impl TestableFloat for f16 {
Expand Down Expand Up @@ -103,6 +107,7 @@ impl TestableFloat for f16 {
const MUL_ADD_RESULT: Self = 62.031;
const NEG_MUL_ADD_RESULT: Self = 48.625;
const MAX_RECIP: Self = 1.526624e-5;
const ASINH_ACOSH_MAX: Self = 11.781;
}

impl TestableFloat for f32 {
Expand All @@ -120,8 +125,20 @@ impl TestableFloat for f32 {
const LOG_APPROX: Self = if cfg!(miri) { 1e-3 } else { Self::APPROX };
const LOG2_APPROX: Self = if cfg!(miri) { 1e-3 } else { Self::APPROX };
const LOG10_APPROX: Self = if cfg!(miri) { 1e-3 } else { Self::APPROX };
const ASINH_APPROX: Self = if cfg!(miri) { 1e-3 } else { Self::APPROX };
const ACOSH_APPROX: Self = if cfg!(miri) { 1e-3 } else { Self::APPROX };
const ASINH_APPROX: Self = if cfg!(miri) {
1e-3
} else if I586 {
1e-5
} else {
Self::APPROX
};
const ACOSH_APPROX: Self = if cfg!(miri) {
1e-3
} else if I586 {
1e-5
} else {
Self::APPROX
};
const ATANH_APPROX: Self = if cfg!(miri) { 1e-3 } else { Self::APPROX };
const GAMMA_APPROX: Self = if cfg!(miri) { 1e-3 } else { Self::APPROX };
const GAMMA_APPROX_LOOSE: Self = if cfg!(miri) { 1e-2 } else { 1e-4 };
Expand Down Expand Up @@ -149,6 +166,7 @@ impl TestableFloat for f32 {
const MUL_ADD_RESULT: Self = 62.05;
const NEG_MUL_ADD_RESULT: Self = 48.65;
const MAX_RECIP: Self = 2.938736e-39;
const ASINH_ACOSH_MAX: Self = 89.4159851;
}

impl TestableFloat for f64 {
Expand Down Expand Up @@ -180,6 +198,7 @@ impl TestableFloat for f64 {
const MUL_ADD_RESULT: Self = 62.050000000000004;
const NEG_MUL_ADD_RESULT: Self = 48.650000000000006;
const MAX_RECIP: Self = 5.562684646268003e-309;
const ASINH_ACOSH_MAX: Self = 710.47586007394398;
}

impl TestableFloat for f128 {
Expand Down Expand Up @@ -221,6 +240,7 @@ impl TestableFloat for f128 {
const MUL_ADD_RESULT: Self = 62.0500000000000000000000000000000037;
const NEG_MUL_ADD_RESULT: Self = 48.6500000000000000000000000000000049;
const MAX_RECIP: Self = 8.40525785778023376565669454330438228902076605e-4933;
const ASINH_ACOSH_MAX: Self = 11357.216553474703894801348310092223;
}

/// Determine the tolerance for values of the argument type.
Expand Down Expand Up @@ -1705,6 +1725,9 @@ float_test! {

assert_approx_eq!(flt(-200.0).asinh(), -5.991470797049389, Float::ASINH_APPROX);

// issue 153878: large values were rounding to infinity
assert_approx_eq!(Float::MAX.asinh(), Float::ASINH_ACOSH_MAX, Float::ASINH_APPROX);

#[allow(overflowing_literals)]
if Float::MAX > flt(66000.0) {
// regression test for the catastrophic cancellation fixed in 72486
Expand Down Expand Up @@ -1733,6 +1756,9 @@ float_test! {
assert_approx_eq!(flt(2.0).acosh(), 1.31695789692481670862504634730796844, Float::ACOSH_APPROX);
assert_approx_eq!(flt(3.0).acosh(), 1.76274717403908605046521864995958461, Float::ACOSH_APPROX);

// issue 153878: large values were rounding to infinity
assert_approx_eq!(Float::MAX.acosh(), Float::ASINH_ACOSH_MAX, Float::ACOSH_APPROX);

#[allow(overflowing_literals)]
if Float::MAX > flt(66000.0) {
// test for low accuracy from issue 104548
Expand Down
33 changes: 31 additions & 2 deletions library/std/src/collections/hash/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,11 @@ impl<K, V, A: Allocator> HashMap<K, V, RandomState, A> {
/// # Examples
///
/// ```
/// # #![feature(allocator_api)]
/// use std::collections::HashMap;
/// let mut map: HashMap<&str, i32> = HashMap::new();
/// use std::alloc::Global;
///
/// let map: HashMap<i32, i32> = HashMap::new_in(Global);
/// ```
#[inline]
#[must_use]
Expand All @@ -321,8 +324,11 @@ impl<K, V, A: Allocator> HashMap<K, V, RandomState, A> {
/// # Examples
///
/// ```
/// # #![feature(allocator_api)]
/// use std::collections::HashMap;
/// let mut map: HashMap<&str, i32> = HashMap::with_capacity(10);
/// use std::alloc::Global;
///
/// let map: HashMap<i32, i32> = HashMap::with_capacity_in(10, Global);
/// ```
#[inline]
#[must_use]
Expand Down Expand Up @@ -410,6 +416,18 @@ impl<K, V, S, A: Allocator> HashMap<K, V, S, A> {
///
/// The `hash_builder` passed should implement the [`BuildHasher`] trait for
/// the `HashMap` to be useful, see its documentation for details.
///
/// # Examples
///
/// ```
/// #![feature(allocator_api)]
/// use std::alloc::Global;
/// use std::collections::HashMap;
/// use std::hash::RandomState;
///
/// let s = RandomState::new();
/// let map: HashMap<i32, i32> = HashMap::with_hasher_in(s, Global);
/// ```
#[inline]
#[must_use]
#[unstable(feature = "allocator_api", issue = "32838")]
Expand All @@ -432,6 +450,17 @@ impl<K, V, S, A: Allocator> HashMap<K, V, S, A> {
/// The `hasher` passed should implement the [`BuildHasher`] trait for
/// the `HashMap` to be useful, see its documentation for details.
///
/// # Examples
///
/// ```
/// #![feature(allocator_api)]
/// use std::alloc::Global;
/// use std::collections::HashMap;
/// use std::hash::RandomState;
///
/// let s = RandomState::new();
/// let map: HashMap<i32, i32> = HashMap::with_capacity_and_hasher_in(10, s, Global);
/// ```
#[inline]
#[must_use]
#[unstable(feature = "allocator_api", issue = "32838")]
Expand Down
Loading
Loading