Skip to content

Commit c481679

Browse files
committed
Auto merge of #103069 - matthiaskrgr:rollup-xxsx6sk, r=matthiaskrgr
Rollup of 9 pull requests Successful merges: - #102092 (refactor: use grep -E/-F instead of fgrep/egrep) - #102781 (Improved documentation for `std::io::Error`) - #103017 (Avoid dropping TLS Key on sgx) - #103039 (checktools: fix comments) - #103045 (Remove leading newlines from integer primitive doc examples) - #103047 (Update browser-ui-test version to fix some flaky tests) - #103054 (Clean up rust-logo rustdoc GUI test) - #103059 (Fix `Duration::{try_,}from_secs_f{32,64}(-0.0)`) - #103067 (More alphabetical sorting) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents c556cf0 + 1571111 commit c481679

File tree

8 files changed

+63
-52
lines changed

8 files changed

+63
-52
lines changed

core/src/num/int_macros.rs

-9
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,6 @@ macro_rules! int_impl {
652652
/// Basic usage:
653653
///
654654
/// ```
655-
///
656655
#[doc = concat!("assert_eq!(5", stringify!($SelfT), ".checked_rem(2), Some(1));")]
657656
#[doc = concat!("assert_eq!(5", stringify!($SelfT), ".checked_rem(0), None);")]
658657
#[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN.checked_rem(-1), None);")]
@@ -704,7 +703,6 @@ macro_rules! int_impl {
704703
/// Basic usage:
705704
///
706705
/// ```
707-
///
708706
#[doc = concat!("assert_eq!(5", stringify!($SelfT), ".checked_neg(), Some(-5));")]
709707
#[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN.checked_neg(), None);")]
710708
/// ```
@@ -820,7 +818,6 @@ macro_rules! int_impl {
820818
/// Basic usage:
821819
///
822820
/// ```
823-
///
824821
#[doc = concat!("assert_eq!((-5", stringify!($SelfT), ").checked_abs(), Some(5));")]
825822
#[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN.checked_abs(), None);")]
826823
/// ```
@@ -1026,7 +1023,6 @@ macro_rules! int_impl {
10261023
/// Basic usage:
10271024
///
10281025
/// ```
1029-
///
10301026
#[doc = concat!("assert_eq!(10", stringify!($SelfT), ".saturating_mul(12), 120);")]
10311027
#[doc = concat!("assert_eq!(", stringify!($SelfT), "::MAX.saturating_mul(10), ", stringify!($SelfT), "::MAX);")]
10321028
#[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN.saturating_mul(10), ", stringify!($SelfT), "::MIN);")]
@@ -1085,7 +1081,6 @@ macro_rules! int_impl {
10851081
/// Basic usage:
10861082
///
10871083
/// ```
1088-
///
10891084
#[doc = concat!("assert_eq!((-4", stringify!($SelfT), ").saturating_pow(3), -64);")]
10901085
#[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN.saturating_pow(2), ", stringify!($SelfT), "::MAX);")]
10911086
#[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN.saturating_pow(3), ", stringify!($SelfT), "::MIN);")]
@@ -1498,7 +1493,6 @@ macro_rules! int_impl {
14981493
/// Basic usage:
14991494
///
15001495
/// ```
1501-
///
15021496
#[doc = concat!("assert_eq!(5", stringify!($SelfT), ".overflowing_add(2), (7, false));")]
15031497
#[doc = concat!("assert_eq!(", stringify!($SelfT), "::MAX.overflowing_add(1), (", stringify!($SelfT), "::MIN, true));")]
15041498
/// ```
@@ -1593,7 +1587,6 @@ macro_rules! int_impl {
15931587
/// Basic usage:
15941588
///
15951589
/// ```
1596-
///
15971590
#[doc = concat!("assert_eq!(5", stringify!($SelfT), ".overflowing_sub(2), (3, false));")]
15981591
#[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN.overflowing_sub(1), (", stringify!($SelfT), "::MAX, true));")]
15991592
/// ```
@@ -1703,7 +1696,6 @@ macro_rules! int_impl {
17031696
/// Basic usage:
17041697
///
17051698
/// ```
1706-
///
17071699
#[doc = concat!("assert_eq!(5", stringify!($SelfT), ".overflowing_div(2), (2, false));")]
17081700
#[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN.overflowing_div(-1), (", stringify!($SelfT), "::MIN, true));")]
17091701
/// ```
@@ -1766,7 +1758,6 @@ macro_rules! int_impl {
17661758
/// Basic usage:
17671759
///
17681760
/// ```
1769-
///
17701761
#[doc = concat!("assert_eq!(5", stringify!($SelfT), ".overflowing_rem(2), (1, false));")]
17711762
#[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN.overflowing_rem(-1), (0, true));")]
17721763
/// ```

core/src/num/uint_macros.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1456,7 +1456,6 @@ macro_rules! uint_impl {
14561456
/// Basic usage
14571457
///
14581458
/// ```
1459-
///
14601459
#[doc = concat!("assert_eq!(5", stringify!($SelfT), ".overflowing_add(2), (7, false));")]
14611460
#[doc = concat!("assert_eq!(", stringify!($SelfT), "::MAX.overflowing_add(1), (0, true));")]
14621461
/// ```
@@ -1551,7 +1550,6 @@ macro_rules! uint_impl {
15511550
/// Basic usage
15521551
///
15531552
/// ```
1554-
///
15551553
#[doc = concat!("assert_eq!(5", stringify!($SelfT), ".overflowing_sub(2), (3, false));")]
15561554
#[doc = concat!("assert_eq!(0", stringify!($SelfT), ".overflowing_sub(1), (", stringify!($SelfT), "::MAX, true));")]
15571555
/// ```

core/src/time.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1279,7 +1279,7 @@ macro_rules! try_from_secs {
12791279
const MANT_MASK: $bits_ty = (1 << $mant_bits) - 1;
12801280
const EXP_MASK: $bits_ty = (1 << $exp_bits) - 1;
12811281

1282-
if $secs.is_sign_negative() {
1282+
if $secs < 0.0 {
12831283
return Err(FromFloatSecsError { kind: FromFloatSecsErrorKind::Negative });
12841284
}
12851285

core/tests/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@
103103
#![feature(provide_any)]
104104
#![feature(utf8_chunks)]
105105
#![feature(is_ascii_octdigit)]
106+
#![feature(duration_checked_float)]
106107
#![deny(unsafe_op_in_unsafe_fn)]
107108

108109
extern crate test;

core/tests/time.rs

+8
Original file line numberDiff line numberDiff line change
@@ -467,3 +467,11 @@ fn duration_const() {
467467
const SATURATING_MUL: Duration = MAX.saturating_mul(2);
468468
assert_eq!(SATURATING_MUL, MAX);
469469
}
470+
471+
#[test]
472+
fn from_neg_zero() {
473+
assert_eq!(Duration::try_from_secs_f32(-0.0), Ok(Duration::ZERO));
474+
assert_eq!(Duration::try_from_secs_f64(-0.0), Ok(Duration::ZERO));
475+
assert_eq!(Duration::from_secs_f32(-0.0), Duration::ZERO);
476+
assert_eq!(Duration::from_secs_f64(-0.0), Duration::ZERO);
477+
}

std/src/io/error.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ pub enum ErrorKind {
387387
impl ErrorKind {
388388
pub(crate) fn as_str(&self) -> &'static str {
389389
use ErrorKind::*;
390-
// Strictly alphabetical, please. (Sadly rustfmt cannot do this yet.)
390+
// tidy-alphabetical-start
391391
match *self {
392392
AddrInUse => "address in use",
393393
AddrNotAvailable => "address not available",
@@ -431,6 +431,7 @@ impl ErrorKind {
431431
WouldBlock => "operation would block",
432432
WriteZero => "write zero",
433433
}
434+
// tidy-alphabetical-end
434435
}
435436
}
436437

@@ -481,6 +482,7 @@ impl Error {
481482
/// originate from the OS itself. The `error` argument is an arbitrary
482483
/// payload which will be contained in this [`Error`].
483484
///
485+
/// Note that this function allocates memory on the heap.
484486
/// If no extra payload is required, use the `From` conversion from
485487
/// `ErrorKind`.
486488
///
@@ -495,7 +497,7 @@ impl Error {
495497
/// // errors can also be created from other errors
496498
/// let custom_error2 = Error::new(ErrorKind::Interrupted, custom_error);
497499
///
498-
/// // creating an error without payload
500+
/// // creating an error without payload (and without memory allocation)
499501
/// let eof_error = Error::from(ErrorKind::UnexpectedEof);
500502
/// ```
501503
#[stable(feature = "rust1", since = "1.0.0")]

std/src/sys/sgx/abi/tls/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ impl Tls {
111111
rtabort!("TLS limit exceeded")
112112
};
113113
TLS_DESTRUCTOR[index].store(dtor.map_or(0, |f| f as usize), Ordering::Relaxed);
114+
unsafe { Self::current() }.data[index].set(ptr::null_mut());
114115
Key::from_index(index)
115116
}
116117

std/tests/run-time-detect.rs

+48-38
Original file line numberDiff line numberDiff line change
@@ -14,77 +14,85 @@
1414
#[cfg(all(target_arch = "arm", any(target_os = "linux", target_os = "android")))]
1515
fn arm_linux() {
1616
use std::arch::is_arm_feature_detected;
17+
// tidy-alphabetical-start
18+
println!("aes: {}", is_arm_feature_detected!("aes"));
19+
println!("crc: {}", is_arm_feature_detected!("crc"));
20+
println!("crypto: {}", is_arm_feature_detected!("crypto"));
1721
println!("neon: {}", is_arm_feature_detected!("neon"));
1822
println!("pmull: {}", is_arm_feature_detected!("pmull"));
19-
println!("crypto: {}", is_arm_feature_detected!("crypto"));
20-
println!("crc: {}", is_arm_feature_detected!("crc"));
21-
println!("aes: {}", is_arm_feature_detected!("aes"));
2223
println!("sha2: {}", is_arm_feature_detected!("sha2"));
24+
// tidy-alphabetical-end
2325
}
2426

2527
#[test]
2628
#[cfg(all(target_arch = "aarch64", any(target_os = "linux", target_os = "android")))]
2729
fn aarch64_linux() {
2830
use std::arch::is_aarch64_feature_detected;
29-
println!("neon: {}", is_aarch64_feature_detected!("neon"));
31+
// tidy-alphabetical-start
32+
println!("aes: {}", is_aarch64_feature_detected!("aes"));
3033
println!("asimd: {}", is_aarch64_feature_detected!("asimd"));
31-
println!("pmull: {}", is_aarch64_feature_detected!("pmull"));
32-
println!("fp16: {}", is_aarch64_feature_detected!("fp16"));
33-
println!("sve: {}", is_aarch64_feature_detected!("sve"));
34+
println!("bf16: {}", is_aarch64_feature_detected!("bf16"));
35+
println!("bti: {}", is_aarch64_feature_detected!("bti"));
3436
println!("crc: {}", is_aarch64_feature_detected!("crc"));
35-
println!("lse: {}", is_aarch64_feature_detected!("lse"));
36-
println!("lse2: {}", is_aarch64_feature_detected!("lse2"));
37-
println!("rdm: {}", is_aarch64_feature_detected!("rdm"));
38-
println!("rcpc: {}", is_aarch64_feature_detected!("rcpc"));
39-
println!("rcpc2: {}", is_aarch64_feature_detected!("rcpc2"));
37+
println!("dit: {}", is_aarch64_feature_detected!("dit"));
4038
println!("dotprod: {}", is_aarch64_feature_detected!("dotprod"));
41-
println!("tme: {}", is_aarch64_feature_detected!("tme"));
39+
println!("dpb2: {}", is_aarch64_feature_detected!("dpb2"));
40+
println!("dpb: {}", is_aarch64_feature_detected!("dpb"));
41+
println!("f32mm: {}", is_aarch64_feature_detected!("f32mm"));
42+
println!("f64mm: {}", is_aarch64_feature_detected!("f64mm"));
43+
println!("fcma: {}", is_aarch64_feature_detected!("fcma"));
4244
println!("fhm: {}", is_aarch64_feature_detected!("fhm"));
43-
println!("dit: {}", is_aarch64_feature_detected!("dit"));
4445
println!("flagm: {}", is_aarch64_feature_detected!("flagm"));
45-
println!("ssbs: {}", is_aarch64_feature_detected!("ssbs"));
46-
println!("sb: {}", is_aarch64_feature_detected!("sb"));
47-
println!("paca: {}", is_aarch64_feature_detected!("paca"));
48-
println!("pacg: {}", is_aarch64_feature_detected!("pacg"));
49-
println!("dpb: {}", is_aarch64_feature_detected!("dpb"));
50-
println!("dpb2: {}", is_aarch64_feature_detected!("dpb2"));
51-
println!("sve2: {}", is_aarch64_feature_detected!("sve2"));
52-
println!("sve2-aes: {}", is_aarch64_feature_detected!("sve2-aes"));
53-
println!("sve2-sm4: {}", is_aarch64_feature_detected!("sve2-sm4"));
54-
println!("sve2-sha3: {}", is_aarch64_feature_detected!("sve2-sha3"));
55-
println!("sve2-bitperm: {}", is_aarch64_feature_detected!("sve2-bitperm"));
46+
println!("fp16: {}", is_aarch64_feature_detected!("fp16"));
5647
println!("frintts: {}", is_aarch64_feature_detected!("frintts"));
5748
println!("i8mm: {}", is_aarch64_feature_detected!("i8mm"));
58-
println!("f32mm: {}", is_aarch64_feature_detected!("f32mm"));
59-
println!("f64mm: {}", is_aarch64_feature_detected!("f64mm"));
60-
println!("bf16: {}", is_aarch64_feature_detected!("bf16"));
61-
println!("rand: {}", is_aarch64_feature_detected!("rand"));
62-
println!("bti: {}", is_aarch64_feature_detected!("bti"));
63-
println!("mte: {}", is_aarch64_feature_detected!("mte"));
6449
println!("jsconv: {}", is_aarch64_feature_detected!("jsconv"));
65-
println!("fcma: {}", is_aarch64_feature_detected!("fcma"));
66-
println!("aes: {}", is_aarch64_feature_detected!("aes"));
50+
println!("lse2: {}", is_aarch64_feature_detected!("lse2"));
51+
println!("lse: {}", is_aarch64_feature_detected!("lse"));
52+
println!("mte: {}", is_aarch64_feature_detected!("mte"));
53+
println!("neon: {}", is_aarch64_feature_detected!("neon"));
54+
println!("paca: {}", is_aarch64_feature_detected!("paca"));
55+
println!("pacg: {}", is_aarch64_feature_detected!("pacg"));
56+
println!("pmull: {}", is_aarch64_feature_detected!("pmull"));
57+
println!("rand: {}", is_aarch64_feature_detected!("rand"));
58+
println!("rcpc2: {}", is_aarch64_feature_detected!("rcpc2"));
59+
println!("rcpc: {}", is_aarch64_feature_detected!("rcpc"));
60+
println!("rdm: {}", is_aarch64_feature_detected!("rdm"));
61+
println!("sb: {}", is_aarch64_feature_detected!("sb"));
6762
println!("sha2: {}", is_aarch64_feature_detected!("sha2"));
6863
println!("sha3: {}", is_aarch64_feature_detected!("sha3"));
6964
println!("sm4: {}", is_aarch64_feature_detected!("sm4"));
65+
println!("ssbs: {}", is_aarch64_feature_detected!("ssbs"));
66+
println!("sve2-aes: {}", is_aarch64_feature_detected!("sve2-aes"));
67+
println!("sve2-bitperm: {}", is_aarch64_feature_detected!("sve2-bitperm"));
68+
println!("sve2-sha3: {}", is_aarch64_feature_detected!("sve2-sha3"));
69+
println!("sve2-sm4: {}", is_aarch64_feature_detected!("sve2-sm4"));
70+
println!("sve2: {}", is_aarch64_feature_detected!("sve2"));
71+
println!("sve: {}", is_aarch64_feature_detected!("sve"));
72+
println!("tme: {}", is_aarch64_feature_detected!("tme"));
73+
// tidy-alphabetical-end
7074
}
7175

7276
#[test]
7377
#[cfg(all(target_arch = "powerpc", target_os = "linux"))]
7478
fn powerpc_linux() {
7579
use std::arch::is_powerpc_feature_detected;
80+
// tidy-alphabetical-start
7681
println!("altivec: {}", is_powerpc_feature_detected!("altivec"));
77-
println!("vsx: {}", is_powerpc_feature_detected!("vsx"));
7882
println!("power8: {}", is_powerpc_feature_detected!("power8"));
83+
println!("vsx: {}", is_powerpc_feature_detected!("vsx"));
84+
// tidy-alphabetical-end
7985
}
8086

8187
#[test]
8288
#[cfg(all(target_arch = "powerpc64", target_os = "linux"))]
8389
fn powerpc64_linux() {
8490
use std::arch::is_powerpc64_feature_detected;
91+
// tidy-alphabetical-start
8592
println!("altivec: {}", is_powerpc64_feature_detected!("altivec"));
86-
println!("vsx: {}", is_powerpc64_feature_detected!("vsx"));
8793
println!("power8: {}", is_powerpc64_feature_detected!("power8"));
94+
println!("vsx: {}", is_powerpc64_feature_detected!("vsx"));
95+
// tidy-alphabetical-end
8896
}
8997

9098
#[test]
@@ -102,9 +110,9 @@ fn x86_all() {
102110
// the below is in alphabetical order and matches
103111
// the order of X86_ALLOWED_FEATURES in rustc_codegen_ssa's target_features.rs
104112

113+
// tidy-alphabetical-start
105114
println!("adx: {:?}", is_x86_feature_detected!("adx"));
106115
println!("aes: {:?}", is_x86_feature_detected!("aes"));
107-
println!("avx: {:?}", is_x86_feature_detected!("avx"));
108116
println!("avx2: {:?}", is_x86_feature_detected!("avx2"));
109117
println!("avx512bf16: {:?}", is_x86_feature_detected!("avx512bf16"));
110118
println!("avx512bitalg: {:?}", is_x86_feature_detected!("avx512bitalg"));
@@ -117,13 +125,14 @@ fn x86_all() {
117125
println!("avx512ifma: {:?}", is_x86_feature_detected!("avx512ifma"));
118126
println!("avx512pf: {:?}", is_x86_feature_detected!("avx512pf"));
119127
println!("avx512vaes: {:?}", is_x86_feature_detected!("avx512vaes"));
120-
println!("avx512vbmi: {:?}", is_x86_feature_detected!("avx512vbmi"));
121128
println!("avx512vbmi2: {:?}", is_x86_feature_detected!("avx512vbmi2"));
129+
println!("avx512vbmi: {:?}", is_x86_feature_detected!("avx512vbmi"));
122130
println!("avx512vl: {:?}", is_x86_feature_detected!("avx512vl"));
123131
println!("avx512vnni: {:?}", is_x86_feature_detected!("avx512vnni"));
124132
println!("avx512vp2intersect: {:?}", is_x86_feature_detected!("avx512vp2intersect"));
125133
println!("avx512vpclmulqdq: {:?}", is_x86_feature_detected!("avx512vpclmulqdq"));
126134
println!("avx512vpopcntdq: {:?}", is_x86_feature_detected!("avx512vpopcntdq"));
135+
println!("avx: {:?}", is_x86_feature_detected!("avx"));
127136
println!("bmi1: {:?}", is_x86_feature_detected!("bmi1"));
128137
println!("bmi2: {:?}", is_x86_feature_detected!("bmi2"));
129138
println!("cmpxchg16b: {:?}", is_x86_feature_detected!("cmpxchg16b"));
@@ -138,16 +147,17 @@ fn x86_all() {
138147
println!("rdseed: {:?}", is_x86_feature_detected!("rdseed"));
139148
println!("rtm: {:?}", is_x86_feature_detected!("rtm"));
140149
println!("sha: {:?}", is_x86_feature_detected!("sha"));
141-
println!("sse: {:?}", is_x86_feature_detected!("sse"));
142150
println!("sse2: {:?}", is_x86_feature_detected!("sse2"));
143151
println!("sse3: {:?}", is_x86_feature_detected!("sse3"));
144152
println!("sse4.1: {:?}", is_x86_feature_detected!("sse4.1"));
145153
println!("sse4.2: {:?}", is_x86_feature_detected!("sse4.2"));
146154
println!("sse4a: {:?}", is_x86_feature_detected!("sse4a"));
155+
println!("sse: {:?}", is_x86_feature_detected!("sse"));
147156
println!("ssse3: {:?}", is_x86_feature_detected!("ssse3"));
148157
println!("tbm: {:?}", is_x86_feature_detected!("tbm"));
149158
println!("xsave: {:?}", is_x86_feature_detected!("xsave"));
150159
println!("xsavec: {:?}", is_x86_feature_detected!("xsavec"));
151160
println!("xsaveopt: {:?}", is_x86_feature_detected!("xsaveopt"));
152161
println!("xsaves: {:?}", is_x86_feature_detected!("xsaves"));
162+
// tidy-alphabetical-end
153163
}

0 commit comments

Comments
 (0)