Skip to content

Commit dbab4e1

Browse files
committed
Auto merge of #140895 - matthiaskrgr:rollup-rfvqv4t, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #129334 (Implement (part of) ACP 429: add `DerefMut` to `Lazy[Cell/Lock]`) - #139562 (rustdoc: add a handle that makes sidebar resizing more obvious) - #140151 (remove intrinsics::drop_in_place) - #140660 (remove 'unordered' atomic intrinsics) - #140783 (Update documentation of OnceLock::get_or_init.) - #140789 (Update hermit-abi to 0.5.1) - #140879 (1.87.0 release notes: remove nonsensical `~` operator) r? `@ghost` `@rustbot` modify labels: rollup
2 parents b105556 + 3ca41e2 commit dbab4e1

30 files changed

+110
-93
lines changed

RELEASES.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Version 1.87.0 (2025-05-15)
66
Language
77
--------
88
- [Stabilize `asm_goto` feature](https://github.com/rust-lang/rust/pull/133870)
9-
- [Allow parsing open beginning ranges (`..EXPR`) after unary operators `!`, `~`, `-`, and `*`}](https://github.com/rust-lang/rust/pull/134900).
9+
- [Allow parsing open beginning ranges (`..EXPR`) after unary operators `!`, `-`, and `*`](https://github.com/rust-lang/rust/pull/134900).
1010
- [Don't require method impls for methods with `Self: Sized` bounds in `impl`s for unsized types](https://github.com/rust-lang/rust/pull/135480)
1111
- [Stabilize `feature(precise_capturing_in_traits)` allowing `use<...>` bounds on return position `impl Trait` in `trait`s](https://github.com/rust-lang/rust/pull/138128)
1212

compiler/rustc_codegen_gcc/src/builder.rs

-1
Original file line numberDiff line numberDiff line change
@@ -2454,7 +2454,6 @@ impl ToGccOrdering for AtomicOrdering {
24542454
use MemOrdering::*;
24552455

24562456
let ordering = match self {
2457-
AtomicOrdering::Unordered => __ATOMIC_RELAXED,
24582457
AtomicOrdering::Relaxed => __ATOMIC_RELAXED, // TODO(antoyo): check if that's the same.
24592458
AtomicOrdering::Acquire => __ATOMIC_ACQUIRE,
24602459
AtomicOrdering::Release => __ATOMIC_RELEASE,

compiler/rustc_codegen_llvm/src/llvm/ffi.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,7 @@ impl AtomicRmwBinOp {
415415
pub(crate) enum AtomicOrdering {
416416
#[allow(dead_code)]
417417
NotAtomic = 0,
418+
#[allow(dead_code)]
418419
Unordered = 1,
419420
Monotonic = 2,
420421
// Consume = 3, // Not specified yet.
@@ -428,7 +429,6 @@ impl AtomicOrdering {
428429
pub(crate) fn from_generic(ao: rustc_codegen_ssa::common::AtomicOrdering) -> Self {
429430
use rustc_codegen_ssa::common::AtomicOrdering as Common;
430431
match ao {
431-
Common::Unordered => Self::Unordered,
432432
Common::Relaxed => Self::Monotonic,
433433
Common::Acquire => Self::Acquire,
434434
Common::Release => Self::Release,

compiler/rustc_codegen_ssa/src/common.rs

-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ pub enum AtomicRmwBinOp {
6161

6262
#[derive(Copy, Clone, Debug)]
6363
pub enum AtomicOrdering {
64-
Unordered,
6564
Relaxed,
6665
Acquire,
6766
Release,

compiler/rustc_codegen_ssa/src/mir/intrinsic.rs

-1
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
336336
};
337337

338338
let parse_ordering = |bx: &Bx, s| match s {
339-
"unordered" => Unordered,
340339
"relaxed" => Relaxed,
341340
"acquire" => Acquire,
342341
"release" => Release,

library/Cargo.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,9 @@ dependencies = [
139139

140140
[[package]]
141141
name = "hermit-abi"
142-
version = "0.5.0"
142+
version = "0.5.1"
143143
source = "registry+https://github.com/rust-lang/crates.io-index"
144-
checksum = "fbd780fe5cc30f81464441920d82ac8740e2e46b29a6fad543ddd075229ce37e"
144+
checksum = "f154ce46856750ed433c8649605bf7ed2de3bc35fd9d2a9f30cddd873c80cb08"
145145
dependencies = [
146146
"compiler_builtins",
147147
"rustc-std-workspace-alloc",

library/core/src/cell/lazy.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use super::UnsafeCell;
22
use crate::hint::unreachable_unchecked;
3-
use crate::ops::Deref;
3+
use crate::ops::{Deref, DerefMut};
44
use crate::{fmt, mem};
55

66
enum State<T, F> {
@@ -284,6 +284,14 @@ impl<T, F: FnOnce() -> T> Deref for LazyCell<T, F> {
284284
}
285285
}
286286

287+
#[stable(feature = "lazy_deref_mut", since = "CURRENT_RUSTC_VERSION")]
288+
impl<T, F: FnOnce() -> T> DerefMut for LazyCell<T, F> {
289+
#[inline]
290+
fn deref_mut(&mut self) -> &mut T {
291+
LazyCell::force_mut(self)
292+
}
293+
}
294+
287295
#[stable(feature = "lazy_cell", since = "1.80.0")]
288296
impl<T: Default> Default for LazyCell<T> {
289297
/// Creates a new lazy value using `Default` as the initializing function.

library/core/src/intrinsics/mod.rs

-21
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,6 @@ pub mod simd;
7474
#[cfg(all(target_has_atomic = "8", target_has_atomic = "32", target_has_atomic = "ptr"))]
7575
use crate::sync::atomic::{self, AtomicBool, AtomicI32, AtomicIsize, AtomicU32, Ordering};
7676

77-
#[stable(feature = "drop_in_place", since = "1.8.0")]
78-
#[rustc_allowed_through_unstable_modules = "import this function via `std::ptr` instead"]
79-
#[deprecated(note = "no longer an intrinsic - use `ptr::drop_in_place` directly", since = "1.52.0")]
80-
#[inline]
81-
pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
82-
// SAFETY: see `ptr::drop_in_place`
83-
unsafe { crate::ptr::drop_in_place(to_drop) }
84-
}
85-
8677
// N.B., these intrinsics take raw pointers because they mutate aliased
8778
// memory, which is not valid for either `&` or `&mut`.
8879

@@ -439,12 +430,6 @@ pub unsafe fn atomic_load_acquire<T: Copy>(src: *const T) -> T;
439430
#[rustc_intrinsic]
440431
#[rustc_nounwind]
441432
pub unsafe fn atomic_load_relaxed<T: Copy>(src: *const T) -> T;
442-
/// Do NOT use this intrinsic; "unordered" operations do not exist in our memory model!
443-
/// In terms of the Rust Abstract Machine, this operation is equivalent to `src.read()`,
444-
/// i.e., it performs a non-atomic read.
445-
#[rustc_intrinsic]
446-
#[rustc_nounwind]
447-
pub unsafe fn atomic_load_unordered<T: Copy>(src: *const T) -> T;
448433

449434
/// Stores the value at the specified memory location.
450435
/// `T` must be an integer or pointer type.
@@ -473,12 +458,6 @@ pub unsafe fn atomic_store_release<T: Copy>(dst: *mut T, val: T);
473458
#[rustc_intrinsic]
474459
#[rustc_nounwind]
475460
pub unsafe fn atomic_store_relaxed<T: Copy>(dst: *mut T, val: T);
476-
/// Do NOT use this intrinsic; "unordered" operations do not exist in our memory model!
477-
/// In terms of the Rust Abstract Machine, this operation is equivalent to `dst.write(val)`,
478-
/// i.e., it performs a non-atomic write.
479-
#[rustc_intrinsic]
480-
#[rustc_nounwind]
481-
pub unsafe fn atomic_store_unordered<T: Copy>(dst: *mut T, val: T);
482461

483462
/// Stores the value at the specified memory location, returning the old value.
484463
/// `T` must be an integer or pointer type.

library/std/src/sync/lazy_lock.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use super::poison::once::ExclusiveState;
22
use crate::cell::UnsafeCell;
33
use crate::mem::ManuallyDrop;
4-
use crate::ops::Deref;
4+
use crate::ops::{Deref, DerefMut};
55
use crate::panic::{RefUnwindSafe, UnwindSafe};
66
use crate::sync::Once;
77
use crate::{fmt, ptr};
@@ -313,6 +313,14 @@ impl<T, F: FnOnce() -> T> Deref for LazyLock<T, F> {
313313
}
314314
}
315315

316+
#[stable(feature = "lazy_deref_mut", since = "CURRENT_RUSTC_VERSION")]
317+
impl<T, F: FnOnce() -> T> DerefMut for LazyLock<T, F> {
318+
#[inline]
319+
fn deref_mut(&mut self) -> &mut T {
320+
LazyLock::force_mut(self)
321+
}
322+
}
323+
316324
#[stable(feature = "lazy_cell", since = "1.80.0")]
317325
impl<T: Default> Default for LazyLock<T> {
318326
/// Creates a new lazy value using `Default` as the initializing function.

library/std/src/sync/once_lock.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ impl<T> OnceLock<T> {
279279
///
280280
/// Many threads may call `get_or_init` concurrently with different
281281
/// initializing functions, but it is guaranteed that only one function
282-
/// will be executed.
282+
/// will be executed if the function doesn't panic.
283283
///
284284
/// # Panics
285285
///

src/librustdoc/html/static/css/noscript.css

+2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ nav.sub {
4343
--settings-button-border-focus: #717171;
4444
--sidebar-background-color: #f5f5f5;
4545
--sidebar-background-color-hover: #e0e0e0;
46+
--sidebar-border-color: #ddd;
4647
--code-block-background-color: #f5f5f5;
4748
--scrollbar-track-background-color: #dcdcdc;
4849
--scrollbar-thumb-background-color: rgba(36, 37, 39, 0.6);
@@ -149,6 +150,7 @@ nav.sub {
149150
--settings-button-border-focus: #ffb900;
150151
--sidebar-background-color: #505050;
151152
--sidebar-background-color-hover: #676767;
153+
--sidebar-border-color: #2A2A2A;
152154
--code-block-background-color: #2A2A2A;
153155
--scrollbar-track-background-color: #717171;
154156
--scrollbar-thumb-background-color: rgba(32, 34, 37, .6);

src/librustdoc/html/static/css/rustdoc.css

+38-14
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
/* When static files are updated, their suffixes need to be updated.
1+
/* ignore-tidy-filelength */
2+
/*
3+
When static files are updated, their suffixes need to be updated.
24
1. In the top directory run:
35
./x.py doc --stage 1 library/core
46
2. Find the directory containing files named with updated suffixes:
@@ -496,12 +498,13 @@ img {
496498
top: 0;
497499
left: 0;
498500
z-index: var(--desktop-sidebar-z-index);
501+
/* resize indicator: hide this when on touch or mobile */
502+
border-right: solid 1px var(--sidebar-border-color);
499503
}
500504

501505
.rustdoc.src .sidebar {
502506
flex-basis: 50px;
503507
width: 50px;
504-
border-right: 1px solid;
505508
overflow-x: hidden;
506509
/* The sidebar is by default hidden */
507510
overflow-y: hidden;
@@ -515,12 +518,27 @@ img {
515518
.sidebar-resizer {
516519
touch-action: none;
517520
width: 9px;
518-
cursor: col-resize;
521+
cursor: ew-resize;
519522
z-index: calc(var(--desktop-sidebar-z-index) + 1);
520523
position: fixed;
521524
height: 100%;
522-
/* make sure there's a 1px gap between the scrollbar and resize handle */
523-
left: calc(var(--desktop-sidebar-width) + 1px);
525+
left: var(--desktop-sidebar-width);
526+
display: flex;
527+
align-items: center;
528+
justify-content: flex-start;
529+
color: var(--right-side-color);
530+
}
531+
.sidebar-resizer::before {
532+
content: "";
533+
border-right: dotted 2px currentColor;
534+
width: 2px;
535+
height: 12px;
536+
}
537+
.sidebar-resizer::after {
538+
content: "";
539+
border-right: dotted 2px currentColor;
540+
width: 2px;
541+
height: 16px;
524542
}
525543

526544
.rustdoc.src .sidebar-resizer {
@@ -543,11 +561,12 @@ img {
543561
}
544562

545563
.sidebar-resizing * {
546-
cursor: col-resize !important;
564+
cursor: ew-resize !important;
547565
}
548566

549567
.sidebar-resizing .sidebar {
550568
position: fixed;
569+
border-right: solid 2px var(--sidebar-resizer-active);
551570
}
552571
.sidebar-resizing > body {
553572
padding-left: var(--resizing-sidebar-width);
@@ -561,8 +580,9 @@ img {
561580
margin: 0;
562581
/* when active or hovered, place resizer glow on top of the sidebar (right next to, or even
563582
on top of, the scrollbar) */
564-
left: var(--desktop-sidebar-width);
583+
left: calc(var(--desktop-sidebar-width) - 1px);
565584
border-left: solid 1px var(--sidebar-resizer-hover);
585+
color: var(--sidebar-resizer-hover);
566586
}
567587

568588
.src-sidebar-expanded .rustdoc.src .sidebar-resizer:hover,
@@ -578,21 +598,20 @@ img {
578598
/* too easy to hit the resizer while trying to hit the [-] toggle */
579599
display: none !important;
580600
}
601+
.sidebar {
602+
/* resize indicator: hide this when on touch or mobile */
603+
border-right: none;
604+
}
581605
}
582606

583607
.sidebar-resizer.active {
584608
/* make the resize tool bigger when actually resizing, to avoid :hover styles on other stuff
585609
while resizing */
586610
padding: 0 140px;
587-
width: 2px;
611+
width: calc(140px + 140px + 9px + 2px);
588612
margin-left: -140px;
589613
border-left: none;
590-
}
591-
.sidebar-resizer.active::before {
592-
border-left: solid 2px var(--sidebar-resizer-active);
593-
display: block;
594-
height: 100%;
595-
content: "";
614+
color: var(--sidebar-resizer-active);
596615
}
597616

598617
.sidebar, .mobile-topbar, .sidebar-menu-toggle,
@@ -2509,6 +2528,8 @@ in src-script.js and main.js
25092528
/* Reduce height slightly to account for mobile topbar. */
25102529
height: calc(100vh - 45px);
25112530
width: 200px;
2531+
/* resize indicator: hide this when on touch or mobile */
2532+
border-right: none;
25122533
}
25132534

25142535
/* The source view uses a different design for the sidebar toggle, and doesn't have a topbar,
@@ -2897,6 +2918,7 @@ by default.
28972918
--settings-button-border-focus: #717171;
28982919
--sidebar-background-color: #f5f5f5;
28992920
--sidebar-background-color-hover: #e0e0e0;
2921+
--sidebar-border-color: #ddd;
29002922
--code-block-background-color: #f5f5f5;
29012923
--scrollbar-track-background-color: #dcdcdc;
29022924
--scrollbar-thumb-background-color: rgba(36, 37, 39, 0.6);
@@ -3002,6 +3024,7 @@ by default.
30023024
--settings-button-border-focus: #ffb900;
30033025
--sidebar-background-color: #505050;
30043026
--sidebar-background-color-hover: #676767;
3027+
--sidebar-border-color: #999;
30053028
--code-block-background-color: #2A2A2A;
30063029
--scrollbar-track-background-color: #717171;
30073030
--scrollbar-thumb-background-color: rgba(32, 34, 37, .6);
@@ -3114,6 +3137,7 @@ Original by Dempfi (https://github.com/dempfi/ayu)
31143137
--settings-button-border-focus: #e0e0e0;
31153138
--sidebar-background-color: #14191f;
31163139
--sidebar-background-color-hover: rgba(70, 70, 70, 0.33);
3140+
--sidebar-border-color: #5c6773;
31173141
--code-block-background-color: #191f26;
31183142
--scrollbar-track-background-color: transparent;
31193143
--scrollbar-thumb-background-color: #5c6773;

src/librustdoc/html/templates/page.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ <h2>Files</h2> {# #}
114114
{% endif %}
115115
{{ sidebar|safe }}
116116
</nav> {# #}
117-
<div class="sidebar-resizer"></div> {# #}
117+
<div class="sidebar-resizer" title="Drag to resize sidebar"></div> {# #}
118118
<main>
119119
{% if page.css_class != "src" %}<div class="width-limiter">{% endif %}
120120
{# defined in storage.js to avoid duplicating complex UI across every page #}

tests/mir-opt/inline/inline_shims.drop.Inline.panic-abort.diff

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
let _3: ();
99
let mut _4: *mut std::vec::Vec<A>;
1010
let mut _5: *mut std::option::Option<B>;
11-
+ scope 1 (inlined std::ptr::drop_in_place::<Vec<A>> - shim(Some(Vec<A>))) {
11+
+ scope 1 (inlined drop_in_place::<Vec<A>> - shim(Some(Vec<A>))) {
1212
+ let mut _6: &mut std::vec::Vec<A>;
1313
+ let mut _7: ();
1414
+ scope 2 (inlined <Vec<A> as Drop>::drop) {
@@ -38,14 +38,14 @@
3838
+ scope 13 (inlined std::ptr::from_raw_parts_mut::<[A], A>) {
3939
+ }
4040
+ }
41-
+ scope 14 (inlined std::ptr::drop_in_place::<[A]> - shim(Some([A]))) {
41+
+ scope 14 (inlined drop_in_place::<[A]> - shim(Some([A]))) {
4242
+ let mut _12: usize;
4343
+ let mut _13: *mut A;
4444
+ let mut _14: bool;
4545
+ }
4646
+ }
4747
+ }
48-
+ scope 15 (inlined std::ptr::drop_in_place::<Option<B>> - shim(Some(Option<B>))) {
48+
+ scope 15 (inlined drop_in_place::<Option<B>> - shim(Some(Option<B>))) {
4949
+ let mut _15: isize;
5050
+ let mut _16: isize;
5151
+ }
@@ -54,7 +54,7 @@
5454
StorageLive(_3);
5555
StorageLive(_4);
5656
_4 = copy _1;
57-
- _3 = std::ptr::drop_in_place::<Vec<A>>(move _4) -> [return: bb1, unwind unreachable];
57+
- _3 = drop_in_place::<Vec<A>>(move _4) -> [return: bb1, unwind unreachable];
5858
+ StorageLive(_6);
5959
+ StorageLive(_7);
6060
+ _6 = &mut (*_4);
@@ -82,7 +82,7 @@
8282
StorageDead(_3);
8383
StorageLive(_5);
8484
_5 = copy _2;
85-
- _0 = std::ptr::drop_in_place::<Option<B>>(move _5) -> [return: bb2, unwind unreachable];
85+
- _0 = drop_in_place::<Option<B>>(move _5) -> [return: bb2, unwind unreachable];
8686
+ StorageLive(_15);
8787
+ StorageLive(_16);
8888
+ _15 = discriminant((*_5));

tests/mir-opt/inline/inline_shims.drop.Inline.panic-unwind.diff

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
let _3: ();
99
let mut _4: *mut std::vec::Vec<A>;
1010
let mut _5: *mut std::option::Option<B>;
11-
+ scope 1 (inlined std::ptr::drop_in_place::<Option<B>> - shim(Some(Option<B>))) {
11+
+ scope 1 (inlined drop_in_place::<Option<B>> - shim(Some(Option<B>))) {
1212
+ let mut _6: isize;
1313
+ let mut _7: isize;
1414
+ }
@@ -17,15 +17,15 @@
1717
StorageLive(_3);
1818
StorageLive(_4);
1919
_4 = copy _1;
20-
_3 = std::ptr::drop_in_place::<Vec<A>>(move _4) -> [return: bb1, unwind continue];
20+
_3 = drop_in_place::<Vec<A>>(move _4) -> [return: bb1, unwind continue];
2121
}
2222

2323
bb1: {
2424
StorageDead(_4);
2525
StorageDead(_3);
2626
StorageLive(_5);
2727
_5 = copy _2;
28-
- _0 = std::ptr::drop_in_place::<Option<B>>(move _5) -> [return: bb2, unwind continue];
28+
- _0 = drop_in_place::<Option<B>>(move _5) -> [return: bb2, unwind continue];
2929
+ StorageLive(_6);
3030
+ StorageLive(_7);
3131
+ _6 = discriminant((*_5));

0 commit comments

Comments
 (0)