Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
363addc
Gate repr(Rust) correctly on non-ADT items
compiler-errors Aug 22, 2024
6b0fc97
Win: Open dir for sync access in remove_dir_all
ChrisDenton Sep 3, 2024
d0a2ca4
Implement ACP 429: add `Lazy{Cell,Lock}::get[_mut]` and `force_mut`
ChayimFriedman2 Aug 20, 2024
0fa92b4
add `Thread::{into_raw, from_raw}`
ibraheemdev Jul 12, 2022
3ecf8e9
Update the minimum external LLVM to 18
cuviper Sep 17, 2024
96a3b48
Clarify docs for std::fs::File::write
shekhirin Sep 18, 2024
69350a4
Revert "Add a hack to prevent proc_macro misopt in CI"
cuviper Sep 18, 2024
a18564c
[Clippy] Swap `manual_retain` to use diagnostic items instead of paths
GnomedDev Sep 18, 2024
bd8e88f
Do not ICE with incorrect empty suggestion
estebank Jul 19, 2024
682c5f4
Explicitly mark a hack as a HACK and elaborate its comment
fmease Sep 18, 2024
d9cdb71
library: Destabilize Lazy{Cell,Lock}::{force,deref}_mut
workingjubilee Sep 17, 2024
f22797d
library: Call it really_init_mut to avoid name collisions
workingjubilee Sep 18, 2024
0cf89b5
compiler: Use make_indirect for the wasm ABI
workingjubilee Sep 16, 2024
a800d1c
compiler: s/make_indirect_byval/pass_by_stack_offset/
workingjubilee Sep 16, 2024
b75711d
tests: Remove test for wrong wasm codegen
workingjubilee Sep 16, 2024
51718e8
tests: Move wasm32 to transparent-opaque-ptr.rs test
workingjubilee Sep 17, 2024
8d52ab1
Rollup merge of #97524 - ibraheemdev:thread-raw, r=ibraheemdev
workingjubilee Sep 18, 2024
1fa684f
Rollup merge of #127988 - estebank:dupe-derive-params, r=fmease
workingjubilee Sep 18, 2024
31e64b3
Rollup merge of #129422 - compiler-errors:repr-rust, r=fmease
workingjubilee Sep 18, 2024
c83e1f6
Rollup merge of #129934 - ChrisDenton:remove-dir-all3, r=Amanieu
workingjubilee Sep 18, 2024
3edd952
Rollup merge of #130450 - workingjubilee:these-names-are-indirect, r=…
workingjubilee Sep 18, 2024
89610c0
Rollup merge of #130476 - workingjubilee:more-lazy-methods-take-2, r=…
workingjubilee Sep 18, 2024
66df252
Rollup merge of #130487 - cuviper:min-llvm-18, r=nikic
workingjubilee Sep 18, 2024
f0dc481
Rollup merge of #130513 - shekhirin:fs-write-doc-comment, r=cuviper
workingjubilee Sep 18, 2024
457c91c
Rollup merge of #130522 - GnomedDev:clippy-manual-retain-paths, r=com…
workingjubilee Sep 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
library: Destabilize Lazy{Cell,Lock}::{force,deref}_mut
  • Loading branch information
workingjubilee committed Sep 18, 2024
commit d9cdb71497fbfcf36f6debd3fcf559c0fe3cf9ec
17 changes: 3 additions & 14 deletions library/core/src/cell/lazy.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use super::UnsafeCell;
use crate::hint::unreachable_unchecked;
use crate::ops::{Deref, DerefMut};
use crate::ops::Deref;
use crate::{fmt, mem};

enum State<T, F> {
Expand Down Expand Up @@ -122,11 +122,10 @@ impl<T, F: FnOnce() -> T> LazyCell<T, F> {
/// Forces the evaluation of this lazy value and returns a mutable reference to
/// the result.
///
/// This is equivalent to the `DerefMut` impl, but is explicit.
///
/// # Examples
///
/// ```
/// #![feature(lazy_get)]
/// use std::cell::LazyCell;
///
/// let mut lazy = LazyCell::new(|| 92);
Expand All @@ -135,11 +134,9 @@ impl<T, F: FnOnce() -> T> LazyCell<T, F> {
/// assert_eq!(*p, 92);
/// *p = 44;
/// assert_eq!(*lazy, 44);
/// *lazy = 55; // Using `DerefMut`
/// assert_eq!(*lazy, 55);
/// ```
#[inline]
#[stable(feature = "lazy_deref_mut", since = "CURRENT_RUSTC_VERSION")]
#[unstable(feature = "lazy_get", issue = "129333")]
pub fn force_mut(this: &mut LazyCell<T, F>) -> &mut T {
#[cold]
/// # Safety
Expand Down Expand Up @@ -286,14 +283,6 @@ impl<T, F: FnOnce() -> T> Deref for LazyCell<T, F> {
}
}

#[stable(feature = "lazy_deref_mut", since = "CURRENT_RUSTC_VERSION")]
impl<T, F: FnOnce() -> T> DerefMut for LazyCell<T, F> {
#[inline]
fn deref_mut(&mut self) -> &mut T {
LazyCell::force_mut(self)
}
}

#[stable(feature = "lazy_cell", since = "1.80.0")]
impl<T: Default> Default for LazyCell<T> {
/// Creates a new lazy value using `Default` as the initializing function.
Expand Down
1 change: 1 addition & 0 deletions library/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@
#![feature(is_ascii_octdigit)]
#![feature(is_val_statically_known)]
#![feature(isqrt)]
#![feature(lazy_get)]
#![feature(link_cfg)]
#![feature(offset_of_enum)]
#![feature(panic_internals)]
Expand Down
1 change: 1 addition & 0 deletions library/core/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
#![feature(iterator_try_collect)]
#![feature(iterator_try_reduce)]
#![feature(layout_for_ptr)]
#![feature(lazy_get)]
#![feature(maybe_uninit_fill)]
#![feature(maybe_uninit_uninit_array_transpose)]
#![feature(maybe_uninit_write_slice)]
Expand Down
1 change: 1 addition & 0 deletions library/std/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@
#![feature(hasher_prefixfree_extras)]
#![feature(hashmap_internals)]
#![feature(ip)]
#![feature(lazy_get)]
#![feature(maybe_uninit_slice)]
#![feature(maybe_uninit_write_slice)]
#![feature(panic_can_unwind)]
Expand Down
17 changes: 3 additions & 14 deletions library/std/src/sync/lazy_lock.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use super::once::ExclusiveState;
use crate::cell::UnsafeCell;
use crate::mem::ManuallyDrop;
use crate::ops::{Deref, DerefMut};
use crate::ops::Deref;
use crate::panic::{RefUnwindSafe, UnwindSafe};
use crate::sync::Once;
use crate::{fmt, ptr};
Expand Down Expand Up @@ -137,11 +137,10 @@ impl<T, F: FnOnce() -> T> LazyLock<T, F> {
/// Forces the evaluation of this lazy value and returns a mutable reference to
/// the result.
///
/// This is equivalent to the `DerefMut` impl, but is explicit.
///
/// # Examples
///
/// ```
/// #![feature(lazy_get)]
/// use std::sync::LazyLock;
///
/// let mut lazy = LazyLock::new(|| 92);
Expand All @@ -150,11 +149,9 @@ impl<T, F: FnOnce() -> T> LazyLock<T, F> {
/// assert_eq!(*p, 92);
/// *p = 44;
/// assert_eq!(*lazy, 44);
/// *lazy = 55; // Using `DerefMut`
/// assert_eq!(*lazy, 55);
/// ```
#[inline]
#[stable(feature = "lazy_deref_mut", since = "CURRENT_RUSTC_VERSION")]
#[unstable(feature = "lazy_get", issue = "129333")]
pub fn force_mut(this: &mut LazyLock<T, F>) -> &mut T {
#[cold]
/// # Safety
Expand Down Expand Up @@ -317,14 +314,6 @@ impl<T, F: FnOnce() -> T> Deref for LazyLock<T, F> {
}
}

#[stable(feature = "lazy_deref_mut", since = "CURRENT_RUSTC_VERSION")]
impl<T, F: FnOnce() -> T> DerefMut for LazyLock<T, F> {
#[inline]
fn deref_mut(&mut self) -> &mut T {
LazyLock::force_mut(self)
}
}

#[stable(feature = "lazy_cell", since = "1.80.0")]
impl<T: Default> Default for LazyLock<T> {
/// Creates a new lazy value using `Default` as the initializing function.
Expand Down