diff options
| author | bors <bors@rust-lang.org> | 2018-09-01 11:26:24 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-09-01 11:26:24 +0000 |
| commit | fea32f1b775b3f37fc4abfa6391c1bebe48af9d1 (patch) | |
| tree | ab51afef12f740e9b7e2ffd7595ce0869c7e45a1 /src/libstd/sys | |
| parent | e6381a7f37402dd5f346256b3773ae2e72853fc3 (diff) | |
| parent | 2839f4f0e8d58c295e146999961b78e2cc47354f (diff) | |
| download | rust-fea32f1b775b3f37fc4abfa6391c1bebe48af9d1.tar.gz rust-fea32f1b775b3f37fc4abfa6391c1bebe48af9d1.zip | |
Auto merge of #53604 - oli-obk:min_const_fn, r=Centril,varkor
Implement the `min_const_fn` feature gate cc @RalfJung @eddyb r? @Centril implements the feature gate for #53555 I added a hack so the `const_fn` feature gate also enables the `min_const_fn` feature gate. This ensures that nightly users of `const_fn` don't have to touch their code at all. The `min_const_fn` checks are run first, and if they succeeded, the `const_fn` checks are run additionally to ensure we didn't miss anything.
Diffstat (limited to 'src/libstd/sys')
| -rw-r--r-- | src/libstd/sys/cloudabi/condvar.rs | 8 | ||||
| -rw-r--r-- | src/libstd/sys/cloudabi/rwlock.rs | 8 |
2 files changed, 10 insertions, 6 deletions
diff --git a/src/libstd/sys/cloudabi/condvar.rs b/src/libstd/sys/cloudabi/condvar.rs index c05c837ade2..ccf848a9be4 100644 --- a/src/libstd/sys/cloudabi/condvar.rs +++ b/src/libstd/sys/cloudabi/condvar.rs @@ -28,11 +28,13 @@ pub struct Condvar { unsafe impl Send for Condvar {} unsafe impl Sync for Condvar {} +const NEW: Condvar = Condvar { + condvar: UnsafeCell::new(AtomicU32::new(abi::CONDVAR_HAS_NO_WAITERS.0)), +}; + impl Condvar { pub const fn new() -> Condvar { - Condvar { - condvar: UnsafeCell::new(AtomicU32::new(abi::CONDVAR_HAS_NO_WAITERS.0)), - } + NEW } pub unsafe fn init(&mut self) {} diff --git a/src/libstd/sys/cloudabi/rwlock.rs b/src/libstd/sys/cloudabi/rwlock.rs index 8539aec5e2c..dc8624ec8a1 100644 --- a/src/libstd/sys/cloudabi/rwlock.rs +++ b/src/libstd/sys/cloudabi/rwlock.rs @@ -32,11 +32,13 @@ pub unsafe fn raw(r: &RWLock) -> *mut AtomicU32 { unsafe impl Send for RWLock {} unsafe impl Sync for RWLock {} +const NEW: RWLock = RWLock { + lock: UnsafeCell::new(AtomicU32::new(abi::LOCK_UNLOCKED.0)), +}; + impl RWLock { pub const fn new() -> RWLock { - RWLock { - lock: UnsafeCell::new(AtomicU32::new(abi::LOCK_UNLOCKED.0)), - } + NEW } pub unsafe fn try_read(&self) -> bool { |
