Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
3f679fe
Fix rustc sysroot in systems using CAS
rcvalle Nov 21, 2020
a2f5c72
Fix has_body for trait methods
CraftSpider Jan 24, 2021
1c60d27
Remove leading newline
CraftSpider Jan 24, 2021
c34faad
rustdoc: Move `display_fn` struct inside `display_fn`
camelid Jan 29, 2021
b6b897b
introduce future-compatibility warning for forbidden lint groups
nikomatsakis Jan 30, 2021
6e6608d
Add additional benchmarks to bit_set
JulianKnodt Feb 2, 2021
4d1efb7
OsStr eq_ignore_ascii_case takes arg by value
TyPR124 Feb 3, 2021
d3d0fb7
add #[inline] to all the public IpAddr functions
saethlin Feb 3, 2021
2c8bf1d
Stabilize the Wake trait
yoshuawuyts Jan 22, 2021
82914a5
Add more information to the error code for 'crate not found'
jyn514 Feb 2, 2021
3719247
move test to be with the others
mark-i-m Feb 3, 2021
8988238
Revert stabilizing integer::BITS.
m-ou-se Feb 3, 2021
a616f82
Add lint for `panic!(123)` which is not accepted in Rust 2021.
m-ou-se Feb 1, 2021
34d5ac2
Make panic/assert calls in rustc compatible with Rust 2021.
m-ou-se Feb 1, 2021
e9ad5be
Allow/fix non_fmt_panic in tests.
m-ou-se Feb 1, 2021
753b0b0
Update panic!() documentation about non-string panics.
m-ou-se Feb 2, 2021
3f3eb89
Fix/allow non_fmt_panic in clippy tests.
m-ou-se Feb 2, 2021
0870c15
Suggest panic!("{}", ..) instead of panic!(..) clippy::expect_fun_call.
m-ou-se Feb 3, 2021
5c056ed
Rename Iterator::fold_first to reduce.
m-ou-se Dec 7, 2020
26af55f
Improve documentation of Iterator::{fold, reduce}.
m-ou-se Dec 7, 2020
24e0940
Stabilize feature(iterator_fold_self): Iterator::reduce
m-ou-se Dec 7, 2020
f42e961
Stabilize poison API of Once, rename poisoned()
Kixunil Feb 4, 2021
64c5354
Rollup merge of #74304 - yoshuawuyts:stabilize-wake, r=KodrAus
m-ou-se Feb 4, 2021
2153f5d
Rollup merge of #79253 - rcvalle:fix-rustc-sysroot-cas, r=nagisa
m-ou-se Feb 4, 2021
a5c1085
Rollup merge of #79805 - m-ou-se:iterator-reduce, r=KodrAus
m-ou-se Feb 4, 2021
a94528d
Rollup merge of #81318 - CraftSpider:json-trait-fix, r=jyn514
m-ou-se Feb 4, 2021
7485c17
Rollup merge of #81497 - camelid:rustdoc-display_fn-remove-cell, r=jy…
m-ou-se Feb 4, 2021
5ba06ab
Rollup merge of #81556 - nikomatsakis:forbidden-lint-groups-lint, r=p…
m-ou-se Feb 4, 2021
f17cd6c
Rollup merge of #81645 - m-ou-se:panic-lint, r=estebank,flip1995
m-ou-se Feb 4, 2021
0fd6d64
Rollup merge of #81676 - jyn514:crate-not-found, r=oli-obk
m-ou-se Feb 4, 2021
c071859
Rollup merge of #81682 - JulianKnodt:bit_set_iter_benchmarks, r=oli-obk
m-ou-se Feb 4, 2021
c434994
Rollup merge of #81710 - TyPR124:patch-2, r=m-ou-se
m-ou-se Feb 4, 2021
9f7f396
Rollup merge of #81711 - saethlin:ipaddr-inline, r=m-ou-se
m-ou-se Feb 4, 2021
df6eed5
Rollup merge of #81725 - mark-i-m:mv-test, r=Mark-Simulacrum
m-ou-se Feb 4, 2021
5e4a424
Rollup merge of #81727 - m-ou-se:unstabilize-bits, r=Mark-Simulacrum
m-ou-se Feb 4, 2021
7066afb
Rollup merge of #81745 - Kixunil:stabilize_once_poison, r=m-ou-se
m-ou-se Feb 4, 2021
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
20 changes: 7 additions & 13 deletions library/std/src/sync/once.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ unsafe impl Send for Once {}

/// State yielded to [`Once::call_once_force()`]’s closure parameter. The state
/// can be used to query the poison status of the [`Once`].
#[unstable(feature = "once_poison", issue = "33577")]
#[stable(feature = "once_poison", since = "1.51.0")]
#[derive(Debug)]
pub struct OnceState {
poisoned: bool,
Expand Down Expand Up @@ -280,8 +280,6 @@ impl Once {
/// # Examples
///
/// ```
/// #![feature(once_poison)]
///
/// use std::sync::Once;
/// use std::thread;
///
Expand All @@ -301,13 +299,13 @@ impl Once {
///
/// // call_once_force will still run and reset the poisoned state
/// INIT.call_once_force(|state| {
/// assert!(state.poisoned());
/// assert!(state.is_poisoned());
/// });
///
/// // once any success happens, we stop propagating the poison
/// INIT.call_once(|| {});
/// ```
#[unstable(feature = "once_poison", issue = "33577")]
#[stable(feature = "once_poison", since = "1.51.0")]
pub fn call_once_force<F>(&self, f: F)
where
F: FnOnce(&OnceState),
Expand Down Expand Up @@ -526,8 +524,6 @@ impl OnceState {
/// A poisoned [`Once`]:
///
/// ```
/// #![feature(once_poison)]
///
/// use std::sync::Once;
/// use std::thread;
///
Expand All @@ -540,24 +536,22 @@ impl OnceState {
/// assert!(handle.join().is_err());
///
/// INIT.call_once_force(|state| {
/// assert!(state.poisoned());
/// assert!(state.is_poisoned());
/// });
/// ```
///
/// An unpoisoned [`Once`]:
///
/// ```
/// #![feature(once_poison)]
///
/// use std::sync::Once;
///
/// static INIT: Once = Once::new();
///
/// INIT.call_once_force(|state| {
/// assert!(!state.poisoned());
/// assert!(!state.is_poisoned());
/// });
#[unstable(feature = "once_poison", issue = "33577")]
pub fn poisoned(&self) -> bool {
#[stable(feature = "once_poison", since = "1.51.0")]
pub fn is_poisoned(&self) -> bool {
self.poisoned
}

Expand Down
4 changes: 2 additions & 2 deletions library/std/src/sync/once/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ fn poison_bad() {
let mut called = false;
O.call_once_force(|p| {
called = true;
assert!(p.poisoned())
assert!(p.is_poisoned())
});
assert!(called);

Expand All @@ -92,7 +92,7 @@ fn wait_for_force_to_finish() {
let (tx2, rx2) = channel();
let t1 = thread::spawn(move || {
O.call_once_force(|p| {
assert!(p.poisoned());
assert!(p.is_poisoned());
tx1.send(()).unwrap();
rx2.recv().unwrap();
});
Expand Down