Skip to content

Commit 3aea48a

Browse files
committed
Auto merge of #104481 - matthiaskrgr:rollup-hf8rev0, r=matthiaskrgr
Rollup of 10 pull requests Successful merges: - #103484 (Add `rust` to `let_underscore_lock` example) - #103489 (Make `pointer::byte_offset_from` more generic) - #104193 (Shift no characters when using raw string literals) - #104348 (Respect visibility & stability of inherent associated types) - #104401 (avoid memory leak in mpsc test) - #104419 (Fix test/ui/issues/issue-30490.rs) - #104424 (rustdoc: remove no-op CSS `.popover { font-size: 1rem }`) - #104425 (rustdoc: remove no-op CSS `.main-header { justify-content }`) - #104450 (Fuchsia test suite script fix) - #104471 (Update PROBLEMATIC_CONSTS in style.rs) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents b2ab7b7 + b346b80 commit 3aea48a

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

core/src/ptr/const_ptr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ impl<T: ?Sized> *const T {
709709
#[unstable(feature = "pointer_byte_offsets", issue = "96283")]
710710
#[rustc_const_unstable(feature = "const_pointer_byte_offsets", issue = "96283")]
711711
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
712-
pub const unsafe fn byte_offset_from(self, origin: *const T) -> isize {
712+
pub const unsafe fn byte_offset_from<U: ?Sized>(self, origin: *const U) -> isize {
713713
// SAFETY: the caller must uphold the safety contract for `offset_from`.
714714
unsafe { self.cast::<u8>().offset_from(origin.cast::<u8>()) }
715715
}

core/src/ptr/mut_ptr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,7 @@ impl<T: ?Sized> *mut T {
889889
#[unstable(feature = "pointer_byte_offsets", issue = "96283")]
890890
#[rustc_const_unstable(feature = "const_pointer_byte_offsets", issue = "96283")]
891891
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
892-
pub const unsafe fn byte_offset_from(self, origin: *const T) -> isize {
892+
pub const unsafe fn byte_offset_from<U: ?Sized>(self, origin: *const U) -> isize {
893893
// SAFETY: the caller must uphold the safety contract for `offset_from`.
894894
unsafe { self.cast::<u8>().offset_from(origin.cast::<u8>()) }
895895
}

std/src/sync/mpsc/tests.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -713,10 +713,11 @@ fn issue_39364() {
713713
let t = thread::spawn(move || {
714714
thread::sleep(Duration::from_millis(300));
715715
let _ = tx.clone();
716-
crate::mem::forget(tx);
716+
// Don't drop; hand back to caller.
717+
tx
717718
});
718719

719720
let _ = rx.recv_timeout(Duration::from_millis(500));
720-
t.join().unwrap();
721+
let _tx = t.join().unwrap(); // delay dropping until end of test
721722
let _ = rx.recv_timeout(Duration::from_millis(500));
722723
}

0 commit comments

Comments
 (0)