Skip to content

Commit 3323691

Browse files
committed
Auto merge of #75747 - cuviper:rollup-icke90l, r=cuviper
Rollup of 8 pull requests Successful merges: - #75672 (Move to intra-doc links for task.rs and vec.rs) - #75702 (Clean up E0759 explanation) - #75703 (Enable stack-overflow detection on musl for non-main threads) - #75710 (Fix bad printing of const-eval queries) - #75716 (Upgrade Emscripten on CI to 1.39.20 ) - #75731 (Suppress ty::Float in MIR comments of ty::Const) - #75733 (Remove duplicated alloc vec bench push_all_move) - #75743 (Rename rustc_lexer::TokenKind::Not to Bang) Failed merges: r? @ghost
2 parents 814d252 + 2a3f43d commit 3323691

File tree

17 files changed

+131
-144
lines changed

17 files changed

+131
-144
lines changed

library/alloc/benches/vec.rs

+15-64
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ fn bench_extend_1000_1000(b: &mut Bencher) {
213213
do_bench_extend(b, 1000, 1000)
214214
}
215215

216-
fn do_bench_push_all(b: &mut Bencher, dst_len: usize, src_len: usize) {
216+
fn do_bench_extend_from_slice(b: &mut Bencher, dst_len: usize, src_len: usize) {
217217
let dst: Vec<_> = FromIterator::from_iter(0..dst_len);
218218
let src: Vec<_> = FromIterator::from_iter(dst_len..dst_len + src_len);
219219

@@ -228,87 +228,38 @@ fn do_bench_push_all(b: &mut Bencher, dst_len: usize, src_len: usize) {
228228
}
229229

230230
#[bench]
231-
fn bench_push_all_0000_0000(b: &mut Bencher) {
232-
do_bench_push_all(b, 0, 0)
231+
fn bench_extend_from_slice_0000_0000(b: &mut Bencher) {
232+
do_bench_extend_from_slice(b, 0, 0)
233233
}
234234

235235
#[bench]
236-
fn bench_push_all_0000_0010(b: &mut Bencher) {
237-
do_bench_push_all(b, 0, 10)
236+
fn bench_extend_from_slice_0000_0010(b: &mut Bencher) {
237+
do_bench_extend_from_slice(b, 0, 10)
238238
}
239239

240240
#[bench]
241-
fn bench_push_all_0000_0100(b: &mut Bencher) {
242-
do_bench_push_all(b, 0, 100)
241+
fn bench_extend_from_slice_0000_0100(b: &mut Bencher) {
242+
do_bench_extend_from_slice(b, 0, 100)
243243
}
244244

245245
#[bench]
246-
fn bench_push_all_0000_1000(b: &mut Bencher) {
247-
do_bench_push_all(b, 0, 1000)
246+
fn bench_extend_from_slice_0000_1000(b: &mut Bencher) {
247+
do_bench_extend_from_slice(b, 0, 1000)
248248
}
249249

250250
#[bench]
251-
fn bench_push_all_0010_0010(b: &mut Bencher) {
252-
do_bench_push_all(b, 10, 10)
251+
fn bench_extend_from_slice_0010_0010(b: &mut Bencher) {
252+
do_bench_extend_from_slice(b, 10, 10)
253253
}
254254

255255
#[bench]
256-
fn bench_push_all_0100_0100(b: &mut Bencher) {
257-
do_bench_push_all(b, 100, 100)
256+
fn bench_extend_from_slice_0100_0100(b: &mut Bencher) {
257+
do_bench_extend_from_slice(b, 100, 100)
258258
}
259259

260260
#[bench]
261-
fn bench_push_all_1000_1000(b: &mut Bencher) {
262-
do_bench_push_all(b, 1000, 1000)
263-
}
264-
265-
fn do_bench_push_all_move(b: &mut Bencher, dst_len: usize, src_len: usize) {
266-
let dst: Vec<_> = FromIterator::from_iter(0..dst_len);
267-
let src: Vec<_> = FromIterator::from_iter(dst_len..dst_len + src_len);
268-
269-
b.bytes = src_len as u64;
270-
271-
b.iter(|| {
272-
let mut dst = dst.clone();
273-
dst.extend(src.clone());
274-
assert_eq!(dst.len(), dst_len + src_len);
275-
assert!(dst.iter().enumerate().all(|(i, x)| i == *x));
276-
});
277-
}
278-
279-
#[bench]
280-
fn bench_push_all_move_0000_0000(b: &mut Bencher) {
281-
do_bench_push_all_move(b, 0, 0)
282-
}
283-
284-
#[bench]
285-
fn bench_push_all_move_0000_0010(b: &mut Bencher) {
286-
do_bench_push_all_move(b, 0, 10)
287-
}
288-
289-
#[bench]
290-
fn bench_push_all_move_0000_0100(b: &mut Bencher) {
291-
do_bench_push_all_move(b, 0, 100)
292-
}
293-
294-
#[bench]
295-
fn bench_push_all_move_0000_1000(b: &mut Bencher) {
296-
do_bench_push_all_move(b, 0, 1000)
297-
}
298-
299-
#[bench]
300-
fn bench_push_all_move_0010_0010(b: &mut Bencher) {
301-
do_bench_push_all_move(b, 10, 10)
302-
}
303-
304-
#[bench]
305-
fn bench_push_all_move_0100_0100(b: &mut Bencher) {
306-
do_bench_push_all_move(b, 100, 100)
307-
}
308-
309-
#[bench]
310-
fn bench_push_all_move_1000_1000(b: &mut Bencher) {
311-
do_bench_push_all_move(b, 1000, 1000)
261+
fn bench_extend_from_slice_1000_1000(b: &mut Bencher) {
262+
do_bench_extend_from_slice(b, 1000, 1000)
312263
}
313264

314265
fn do_bench_clone(b: &mut Bencher, src_len: usize) {

library/alloc/src/task.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,9 @@ use crate::sync::Arc;
1313
///
1414
/// This trait is a memory-safe and ergonomic alternative to constructing a
1515
/// [`RawWaker`]. It supports the common executor design in which the data used
16-
/// to wake up a task is stored in an [`Arc`][arc]. Some executors (especially
16+
/// to wake up a task is stored in an [`Arc`]. Some executors (especially
1717
/// those for embedded systems) cannot use this API, which is why [`RawWaker`]
1818
/// exists as an alternative for those systems.
19-
///
20-
/// [arc]: ../../std/sync/struct.Arc.html
2119
#[unstable(feature = "wake_trait", issue = "69912")]
2220
pub trait Wake {
2321
/// Wake this task.

library/alloc/src/vec.rs

+29-45
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,9 @@
5050
//! v[1] = v[1] + 5;
5151
//! ```
5252
//!
53-
//! [`Vec<T>`]: ../../std/vec/struct.Vec.html
54-
//! [`new`]: ../../std/vec/struct.Vec.html#method.new
55-
//! [`push`]: ../../std/vec/struct.Vec.html#method.push
56-
//! [`Index`]: ../../std/ops/trait.Index.html
57-
//! [`IndexMut`]: ../../std/ops/trait.IndexMut.html
58-
//! [`vec!`]: ../../std/macro.vec.html
53+
//! [`Vec<T>`]: Vec
54+
//! [`new`]: Vec::new
55+
//! [`push`]: Vec::push
5956
6057
#![stable(feature = "rust1", since = "1.0.0")]
6158

@@ -278,22 +275,18 @@ use crate::raw_vec::RawVec;
278275
/// `Vec` does not currently guarantee the order in which elements are dropped.
279276
/// The order has changed in the past and may change again.
280277
///
281-
/// [`vec!`]: ../../std/macro.vec.html
282278
/// [`get`]: ../../std/vec/struct.Vec.html#method.get
283279
/// [`get_mut`]: ../../std/vec/struct.Vec.html#method.get_mut
284-
/// [`Index`]: ../../std/ops/trait.Index.html
285-
/// [`String`]: ../../std/string/struct.String.html
286-
/// [`&str`]: ../../std/primitive.str.html
287-
/// [`Vec::with_capacity`]: ../../std/vec/struct.Vec.html#method.with_capacity
288-
/// [`Vec::new`]: ../../std/vec/struct.Vec.html#method.new
289-
/// [`shrink_to_fit`]: ../../std/vec/struct.Vec.html#method.shrink_to_fit
290-
/// [`capacity`]: ../../std/vec/struct.Vec.html#method.capacity
291-
/// [`mem::size_of::<T>`]: ../../std/mem/fn.size_of.html
292-
/// [`len`]: ../../std/vec/struct.Vec.html#method.len
293-
/// [`push`]: ../../std/vec/struct.Vec.html#method.push
294-
/// [`insert`]: ../../std/vec/struct.Vec.html#method.insert
295-
/// [`reserve`]: ../../std/vec/struct.Vec.html#method.reserve
296-
/// [owned slice]: ../../std/boxed/struct.Box.html
280+
/// [`String`]: crate::string::String
281+
/// [`&str`]: type@str
282+
/// [`shrink_to_fit`]: Vec::shrink_to_fit
283+
/// [`capacity`]: Vec::capacity
284+
/// [`mem::size_of::<T>`]: core::mem::size_of
285+
/// [`len`]: Vec::len
286+
/// [`push`]: Vec::push
287+
/// [`insert`]: Vec::insert
288+
/// [`reserve`]: Vec::reserve
289+
/// [owned slice]: Box
297290
#[stable(feature = "rust1", since = "1.0.0")]
298291
#[cfg_attr(not(test), rustc_diagnostic_item = "vec_type")]
299292
pub struct Vec<T> {
@@ -375,7 +368,7 @@ impl<T> Vec<T> {
375368
/// into a `Vec` with the [`from_raw_parts`] function, allowing
376369
/// the destructor to perform the cleanup.
377370
///
378-
/// [`from_raw_parts`]: #method.from_raw_parts
371+
/// [`from_raw_parts`]: Vec::from_raw_parts
379372
///
380373
/// # Examples
381374
///
@@ -430,8 +423,8 @@ impl<T> Vec<T> {
430423
/// that nothing else uses the pointer after calling this
431424
/// function.
432425
///
433-
/// [`String`]: ../../std/string/struct.String.html
434-
/// [`dealloc`]: ../../alloc/alloc/trait.GlobalAlloc.html#tymethod.dealloc
426+
/// [`String`]: crate::string::String
427+
/// [`dealloc`]: crate::alloc::GlobalAlloc::dealloc
435428
///
436429
/// # Examples
437430
///
@@ -661,7 +654,7 @@ impl<T> Vec<T> {
661654
///
662655
/// Note that this will drop any excess capacity.
663656
///
664-
/// [owned slice]: ../../std/boxed/struct.Box.html
657+
/// [owned slice]: Box
665658
///
666659
/// # Examples
667660
///
@@ -732,8 +725,8 @@ impl<T> Vec<T> {
732725
/// assert_eq!(vec, []);
733726
/// ```
734727
///
735-
/// [`clear`]: #method.clear
736-
/// [`drain`]: #method.drain
728+
/// [`clear`]: Vec::clear
729+
/// [`drain`]: Vec::drain
737730
#[stable(feature = "rust1", since = "1.0.0")]
738731
pub fn truncate(&mut self, len: usize) {
739732
// This is safe because:
@@ -812,7 +805,7 @@ impl<T> Vec<T> {
812805
/// }
813806
/// ```
814807
///
815-
/// [`as_mut_ptr`]: #method.as_mut_ptr
808+
/// [`as_mut_ptr`]: Vec::as_mut_ptr
816809
#[stable(feature = "vec_as_ptr", since = "1.37.0")]
817810
#[inline]
818811
pub fn as_ptr(&self) -> *const T {
@@ -868,17 +861,17 @@ impl<T> Vec<T> {
868861
/// is done using one of the safe operations instead, such as
869862
/// [`truncate`], [`resize`], [`extend`], or [`clear`].
870863
///
871-
/// [`truncate`]: #method.truncate
872-
/// [`resize`]: #method.resize
873-
/// [`extend`]: ../../std/iter/trait.Extend.html#tymethod.extend
874-
/// [`clear`]: #method.clear
864+
/// [`truncate`]: Vec::truncate
865+
/// [`resize`]: Vec::resize
866+
/// [`extend`]: Extend::extend
867+
/// [`clear`]: Vec::clear
875868
///
876869
/// # Safety
877870
///
878871
/// - `new_len` must be less than or equal to [`capacity()`].
879872
/// - The elements at `old_len..new_len` must be initialized.
880873
///
881-
/// [`capacity()`]: #method.capacity
874+
/// [`capacity()`]: Vec::capacity
882875
///
883876
/// # Examples
884877
///
@@ -1217,8 +1210,6 @@ impl<T> Vec<T> {
12171210
/// Removes the last element from a vector and returns it, or [`None`] if it
12181211
/// is empty.
12191212
///
1220-
/// [`None`]: ../../std/option/enum.Option.html#variant.None
1221-
///
12221213
/// # Examples
12231214
///
12241215
/// ```
@@ -1482,8 +1473,7 @@ impl<T> Vec<T> {
14821473
/// assert_eq!(vec, [2, 4, 8, 16]);
14831474
/// ```
14841475
///
1485-
/// [`resize`]: #method.resize
1486-
/// [`Clone`]: ../../std/clone/trait.Clone.html
1476+
/// [`resize`]: Vec::resize
14871477
#[stable(feature = "vec_resize_with", since = "1.33.0")]
14881478
pub fn resize_with<F>(&mut self, new_len: usize, f: F)
14891479
where
@@ -1534,7 +1524,7 @@ impl<T> Vec<T> {
15341524
/// reading from a file) before marking the data as initialized using the
15351525
/// [`set_len`] method.
15361526
///
1537-
/// [`set_len`]: #method.set_len
1527+
/// [`set_len`]: Vec::set_len
15381528
///
15391529
/// # Examples
15401530
///
@@ -1593,9 +1583,7 @@ impl<T: Clone> Vec<T> {
15931583
/// assert_eq!(vec, [1, 2]);
15941584
/// ```
15951585
///
1596-
/// [`Clone`]: ../../std/clone/trait.Clone.html
1597-
/// [`Default`]: ../../std/default/trait.Default.html
1598-
/// [`resize_with`]: #method.resize_with
1586+
/// [`resize_with`]: Vec::resize_with
15991587
#[stable(feature = "vec_resize", since = "1.5.0")]
16001588
pub fn resize(&mut self, new_len: usize, value: T) {
16011589
let len = self.len();
@@ -1657,10 +1645,7 @@ impl<T: Default> Vec<T> {
16571645
/// assert_eq!(vec, [1, 2]);
16581646
/// ```
16591647
///
1660-
/// [`resize`]: #method.resize
1661-
/// [`Default::default()`]: ../../std/default/trait.Default.html#tymethod.default
1662-
/// [`Default`]: ../../std/default/trait.Default.html
1663-
/// [`Clone`]: ../../std/clone/trait.Clone.html
1648+
/// [`resize`]: Vec::resize
16641649
#[unstable(feature = "vec_resize_default", issue = "41758")]
16651650
#[rustc_deprecated(
16661651
reason = "This is moving towards being removed in favor \
@@ -2341,7 +2326,6 @@ impl<T> Vec<T> {
23412326
/// Note that `drain_filter` also lets you mutate every element in the filter closure,
23422327
/// regardless of whether you choose to keep or remove it.
23432328
///
2344-
///
23452329
/// # Examples
23462330
///
23472331
/// Splitting an array into evens and odds, reusing the original allocation:

library/std/src/sys/unix/thread.rs

+21-6
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ impl Drop for Thread {
213213
}
214214

215215
#[cfg(all(
216-
not(all(target_os = "linux", not(target_env = "musl"))),
216+
not(target_os = "linux"),
217217
not(target_os = "freebsd"),
218218
not(target_os = "macos"),
219219
not(all(target_os = "netbsd", not(target_vendor = "rumprun"))),
@@ -233,7 +233,7 @@ pub mod guard {
233233
}
234234

235235
#[cfg(any(
236-
all(target_os = "linux", not(target_env = "musl")),
236+
target_os = "linux",
237237
target_os = "freebsd",
238238
target_os = "macos",
239239
all(target_os = "netbsd", not(target_vendor = "rumprun")),
@@ -333,9 +333,7 @@ pub mod guard {
333333
let page_size = os::page_size();
334334
PAGE_SIZE.store(page_size, Ordering::Relaxed);
335335

336-
let stackaddr = get_stack_start_aligned()?;
337-
338-
if cfg!(target_os = "linux") {
336+
if cfg!(all(target_os = "linux", not(target_env = "musl"))) {
339337
// Linux doesn't allocate the whole stack right away, and
340338
// the kernel has its own stack-guard mechanism to fault
341339
// when growing too close to an existing mapping. If we map
@@ -346,8 +344,15 @@ pub mod guard {
346344
// Instead, we'll just note where we expect rlimit to start
347345
// faulting, so our handler can report "stack overflow", and
348346
// trust that the kernel's own stack guard will work.
347+
let stackaddr = get_stack_start_aligned()?;
349348
let stackaddr = stackaddr as usize;
350349
Some(stackaddr - page_size..stackaddr)
350+
} else if cfg!(all(target_os = "linux", target_env = "musl")) {
351+
// For the main thread, the musl's pthread_attr_getstack
352+
// returns the current stack size, rather than maximum size
353+
// it can eventually grow to. It cannot be used to determine
354+
// the position of kernel's stack guard.
355+
None
351356
} else {
352357
// Reallocate the last page of the stack.
353358
// This ensures SIGBUS will be raised on
@@ -357,6 +362,7 @@ pub mod guard {
357362
// than the initial mmap() used, so we mmap() here with
358363
// read/write permissions and only then mprotect() it to
359364
// no permissions at all. See issue #50313.
365+
let stackaddr = get_stack_start_aligned()?;
360366
let result = mmap(
361367
stackaddr,
362368
page_size,
@@ -406,7 +412,14 @@ pub mod guard {
406412
let mut guardsize = 0;
407413
assert_eq!(libc::pthread_attr_getguardsize(&attr, &mut guardsize), 0);
408414
if guardsize == 0 {
409-
panic!("there is no guard page");
415+
if cfg!(all(target_os = "linux", target_env = "musl")) {
416+
// musl versions before 1.1.19 always reported guard
417+
// size obtained from pthread_attr_get_np as zero.
418+
// Use page size as a fallback.
419+
guardsize = PAGE_SIZE.load(Ordering::Relaxed);
420+
} else {
421+
panic!("there is no guard page");
422+
}
410423
}
411424
let mut stackaddr = crate::ptr::null_mut();
412425
let mut size = 0;
@@ -419,6 +432,8 @@ pub mod guard {
419432
Some(guardaddr - PAGE_SIZE.load(Ordering::Relaxed)..guardaddr)
420433
} else if cfg!(target_os = "netbsd") {
421434
Some(stackaddr - guardsize..stackaddr)
435+
} else if cfg!(all(target_os = "linux", target_env = "musl")) {
436+
Some(stackaddr - guardsize..stackaddr)
422437
} else if cfg!(all(target_os = "linux", target_env = "gnu")) {
423438
// glibc used to include the guard area within the stack, as noted in the BUGS
424439
// section of `man pthread_attr_getguardsize`. This has been corrected starting

src/ci/docker/scripts/emscripten.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ exit 1
1919

2020
git clone https://github.com/emscripten-core/emsdk.git /emsdk-portable
2121
cd /emsdk-portable
22-
hide_output ./emsdk install 1.38.47-upstream
23-
./emsdk activate 1.38.47-upstream
22+
hide_output ./emsdk install 1.39.20
23+
./emsdk activate 1.39.20

0 commit comments

Comments
 (0)