Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 8305398

Browse files
committed
Auto merge of rust-lang#96178 - Dylan-DPC:rollup-6z8pcob, r=Dylan-DPC
Rollup of 5 pull requests Successful merges: - rust-lang#96032 (Update books) - rust-lang#96136 (Reword clarification on lifetime for ptr->ref safety docs) - rust-lang#96143 (Fix snapshot --bless not working anymore in htmldocck) - rust-lang#96148 (Use revisions instead of nll compare mode for `/self/` ui tests) - rust-lang#96156 (Replace u8to64_le macro with u64::from_le_bytes) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 0516711 + 55e3997 commit 8305398

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+387
-237
lines changed

library/core/src/ptr/const_ptr.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ impl<T: ?Sized> *const T {
295295
///
296296
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
297297
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
298-
/// In particular, for the duration of this lifetime, the memory the pointer points to must
298+
/// In particular, while this reference exists, the memory the pointer points to must
299299
/// not get mutated (except inside `UnsafeCell`).
300300
///
301301
/// This applies even if the result of this method is unused!
@@ -358,7 +358,7 @@ impl<T: ?Sized> *const T {
358358
///
359359
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
360360
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
361-
/// In particular, for the duration of this lifetime, the memory the pointer points to must
361+
/// In particular, while this reference exists, the memory the pointer points to must
362362
/// not get mutated (except inside `UnsafeCell`).
363363
///
364364
/// This applies even if the result of this method is unused!
@@ -1188,7 +1188,7 @@ impl<T> *const [T] {
11881188
///
11891189
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
11901190
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
1191-
/// In particular, for the duration of this lifetime, the memory the pointer points to must
1191+
/// In particular, while this reference exists, the memory the pointer points to must
11921192
/// not get mutated (except inside `UnsafeCell`).
11931193
///
11941194
/// This applies even if the result of this method is unused!

library/core/src/ptr/mut_ptr.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ impl<T: ?Sized> *mut T {
302302
///
303303
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
304304
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
305-
/// In particular, for the duration of this lifetime, the memory the pointer points to must
305+
/// In particular, while this reference exists, the memory the pointer points to must
306306
/// not get mutated (except inside `UnsafeCell`).
307307
///
308308
/// This applies even if the result of this method is unused!
@@ -368,7 +368,7 @@ impl<T: ?Sized> *mut T {
368368
///
369369
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
370370
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
371-
/// In particular, for the duration of this lifetime, the memory the pointer points to must
371+
/// In particular, while this reference exists, the memory the pointer points to must
372372
/// not get mutated (except inside `UnsafeCell`).
373373
///
374374
/// This applies even if the result of this method is unused!
@@ -550,7 +550,7 @@ impl<T: ?Sized> *mut T {
550550
///
551551
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
552552
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
553-
/// In particular, for the duration of this lifetime, the memory the pointer points to must
553+
/// In particular, while this reference exists, the memory the pointer points to must
554554
/// not get accessed (read or written) through any other pointer.
555555
///
556556
/// This applies even if the result of this method is unused!
@@ -615,7 +615,7 @@ impl<T: ?Sized> *mut T {
615615
///
616616
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
617617
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
618-
/// In particular, for the duration of this lifetime, the memory the pointer points to must
618+
/// In particular, while this reference exists, the memory the pointer points to must
619619
/// not get accessed (read or written) through any other pointer.
620620
///
621621
/// This applies even if the result of this method is unused!
@@ -1461,7 +1461,7 @@ impl<T> *mut [T] {
14611461
///
14621462
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
14631463
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
1464-
/// In particular, for the duration of this lifetime, the memory the pointer points to must
1464+
/// In particular, while this reference exists, the memory the pointer points to must
14651465
/// not get mutated (except inside `UnsafeCell`).
14661466
///
14671467
/// This applies even if the result of this method is unused!
@@ -1513,7 +1513,7 @@ impl<T> *mut [T] {
15131513
///
15141514
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
15151515
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
1516-
/// In particular, for the duration of this lifetime, the memory the pointer points to must
1516+
/// In particular, while this reference exists, the memory the pointer points to must
15171517
/// not get accessed (read or written) through any other pointer.
15181518
///
15191519
/// This applies even if the result of this method is unused!

library/core/src/ptr/non_null.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ impl<T: Sized> NonNull<T> {
114114
///
115115
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
116116
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
117-
/// In particular, for the duration of this lifetime, the memory the pointer points to must
117+
/// In particular, while this reference exists, the memory the pointer points to must
118118
/// not get mutated (except inside `UnsafeCell`).
119119
///
120120
/// This applies even if the result of this method is unused!
@@ -148,7 +148,7 @@ impl<T: Sized> NonNull<T> {
148148
///
149149
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
150150
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
151-
/// In particular, for the duration of this lifetime, the memory the pointer points to must
151+
/// In particular, while this reference exists, the memory the pointer points to must
152152
/// not get accessed (read or written) through any other pointer.
153153
///
154154
/// This applies even if the result of this method is unused!
@@ -350,7 +350,7 @@ impl<T: ?Sized> NonNull<T> {
350350
///
351351
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
352352
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
353-
/// In particular, for the duration of this lifetime, the memory the pointer points to must
353+
/// In particular, while this reference exists, the memory the pointer points to must
354354
/// not get mutated (except inside `UnsafeCell`).
355355
///
356356
/// This applies even if the result of this method is unused!
@@ -400,7 +400,7 @@ impl<T: ?Sized> NonNull<T> {
400400
///
401401
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
402402
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
403-
/// In particular, for the duration of this lifetime, the memory the pointer points to must
403+
/// In particular, while this reference exists, the memory the pointer points to must
404404
/// not get accessed (read or written) through any other pointer.
405405
///
406406
/// This applies even if the result of this method is unused!
@@ -580,7 +580,7 @@ impl<T> NonNull<[T]> {
580580
///
581581
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
582582
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
583-
/// In particular, for the duration of this lifetime, the memory the pointer points to must
583+
/// In particular, while this reference exists, the memory the pointer points to must
584584
/// not get mutated (except inside `UnsafeCell`).
585585
///
586586
/// This applies even if the result of this method is unused!
@@ -626,7 +626,7 @@ impl<T> NonNull<[T]> {
626626
///
627627
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
628628
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
629-
/// In particular, for the duration of this lifetime, the memory the pointer points to must
629+
/// In particular, while this reference exists, the memory the pointer points to must
630630
/// not get accessed (read or written) through any other pointer.
631631
///
632632
/// This applies even if the result of this method is unused!

library/core/tests/hash/sip.rs

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,6 @@ impl<'a> Hash for Bytes<'a> {
1515
}
1616
}
1717

18-
macro_rules! u8to64_le {
19-
($buf:expr, $i:expr) => {
20-
$buf[0 + $i] as u64
21-
| ($buf[1 + $i] as u64) << 8
22-
| ($buf[2 + $i] as u64) << 16
23-
| ($buf[3 + $i] as u64) << 24
24-
| ($buf[4 + $i] as u64) << 32
25-
| ($buf[5 + $i] as u64) << 40
26-
| ($buf[6 + $i] as u64) << 48
27-
| ($buf[7 + $i] as u64) << 56
28-
};
29-
($buf:expr, $i:expr, $len:expr) => {{
30-
let mut t = 0;
31-
let mut out = 0;
32-
while t < $len {
33-
out |= ($buf[t + $i] as u64) << t * 8;
34-
t += 1;
35-
}
36-
out
37-
}};
38-
}
39-
4018
fn hash_with<H: Hasher, T: Hash>(mut st: H, x: &T) -> u64 {
4119
x.hash(&mut st);
4220
st.finish()
@@ -123,7 +101,7 @@ fn test_siphash_1_3() {
123101
let mut state_inc = SipHasher13::new_with_keys(k0, k1);
124102

125103
while t < 64 {
126-
let vec = u8to64_le!(vecs[t], 0);
104+
let vec = u64::from_le_bytes(vecs[t]);
127105
let out = hash_with(SipHasher13::new_with_keys(k0, k1), &Bytes(&buf));
128106
assert_eq!(vec, out);
129107

@@ -217,7 +195,7 @@ fn test_siphash_2_4() {
217195
let mut state_inc = SipHasher::new_with_keys(k0, k1);
218196

219197
while t < 64 {
220-
let vec = u8to64_le!(vecs[t], 0);
198+
let vec = u64::from_le_bytes(vecs[t]);
221199
let out = hash_with(SipHasher::new_with_keys(k0, k1), &Bytes(&buf));
222200
assert_eq!(vec, out);
223201

src/doc/book

Submodule book updated 37 files

src/doc/nomicon

src/etc/htmldocck.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,8 +423,12 @@ def check_snapshot(snapshot_name, actual_tree, normalize_to_text):
423423
else:
424424
actual_str = flatten(actual_tree)
425425

426+
# Conditions:
427+
# 1. Is --bless
428+
# 2. Are actual and expected tree different
429+
# 3. Are actual and expected text different
426430
if not expected_str \
427-
or (not normalize_to_text and
431+
or (not normalize_to_text and \
428432
not compare_tree(make_xml(actual_str), make_xml(expected_str), stderr)) \
429433
or (normalize_to_text and actual_str != expected_str):
430434

0 commit comments

Comments
 (0)