Skip to content

Commit

Permalink
Rollup merge of rust-lang#127599 - tgross35:lazy_cell_consume-rename,…
Browse files Browse the repository at this point in the history
… r=workingjubilee

Rename `lazy_cell_consume` to `lazy_cell_into_inner`

Name this something that is less confusable with an atomic consume API for `{Lazy,Once}Lock`.
  • Loading branch information
matthiaskrgr authored Jul 11, 2024
2 parents fde7fd2 + b71b538 commit f937ef1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions core/src/cell/lazy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ impl<T, F: FnOnce() -> T> LazyCell<T, F> {
/// # Examples
///
/// ```
/// #![feature(lazy_cell_consume)]
/// #![feature(lazy_cell_into_inner)]
///
/// use std::cell::LazyCell;
///
Expand All @@ -78,7 +78,7 @@ impl<T, F: FnOnce() -> T> LazyCell<T, F> {
/// assert_eq!(&*lazy, "HELLO, WORLD!");
/// assert_eq!(LazyCell::into_inner(lazy).ok(), Some("HELLO, WORLD!".to_string()));
/// ```
#[unstable(feature = "lazy_cell_consume", issue = "125623")]
#[unstable(feature = "lazy_cell_into_inner", issue = "125623")]
pub fn into_inner(this: Self) -> Result<T, F> {
match this.state.into_inner() {
State::Init(data) => Ok(data),
Expand Down
4 changes: 2 additions & 2 deletions std/src/sync/lazy_lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ impl<T, F: FnOnce() -> T> LazyLock<T, F> {
/// # Examples
///
/// ```
/// #![feature(lazy_cell_consume)]
/// #![feature(lazy_cell_into_inner)]
///
/// use std::sync::LazyLock;
///
Expand All @@ -118,7 +118,7 @@ impl<T, F: FnOnce() -> T> LazyLock<T, F> {
/// assert_eq!(&*lazy, "HELLO, WORLD!");
/// assert_eq!(LazyLock::into_inner(lazy).ok(), Some("HELLO, WORLD!".to_string()));
/// ```
#[unstable(feature = "lazy_cell_consume", issue = "125623")]
#[unstable(feature = "lazy_cell_into_inner", issue = "125623")]
pub fn into_inner(mut this: Self) -> Result<T, F> {
let state = this.once.state();
match state {
Expand Down

0 comments on commit f937ef1

Please sign in to comment.