File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -31,14 +31,14 @@ alloc = []
31
31
# This is disabled by default and requires recent nightly compiler.
32
32
# Note that this is outside of the normal semver guarantees and minor versions
33
33
# of crossbeam may make breaking changes to them at any time.
34
- nightly = [" crossbeam-utils/nightly" ]
34
+ nightly = [" crossbeam-utils/nightly" , " const_fn " ]
35
35
36
36
# TODO: docs
37
37
sanitize = [] # Makes it more likely to trigger any potential data races.
38
38
39
39
[dependencies ]
40
40
cfg-if = " 1"
41
- const_fn = " 0.4"
41
+ const_fn = { version = " 0.4.4 " , optional = true }
42
42
memoffset = " 0.6"
43
43
44
44
[dependencies .crossbeam-utils ]
Original file line number Diff line number Diff line change @@ -10,7 +10,6 @@ use core::sync::atomic::{AtomicUsize, Ordering};
10
10
use crate :: alloc:: alloc;
11
11
use crate :: alloc:: boxed:: Box ;
12
12
use crate :: guard:: Guard ;
13
- use const_fn:: const_fn;
14
13
use crossbeam_utils:: atomic:: AtomicConsume ;
15
14
16
15
/// Given ordering for the success case in a compare-exchange operation, returns the strongest
@@ -327,8 +326,8 @@ impl<T: ?Sized + Pointable> Atomic<T> {
327
326
/// let a = Atomic::<i32>::null();
328
327
/// ```
329
328
///
330
- #[ const_fn ( feature = "nightly" ) ]
331
- pub const fn null ( ) -> Atomic < T > {
329
+ #[ cfg_attr ( feature = "nightly" , const_fn :: const_fn ) ]
330
+ pub fn null ( ) -> Atomic < T > {
332
331
Self {
333
332
data : AtomicUsize :: new ( 0 ) ,
334
333
_marker : PhantomData ,
@@ -1371,4 +1370,11 @@ mod tests {
1371
1370
fn valid_tag_i64 ( ) {
1372
1371
Shared :: < i64 > :: null ( ) . with_tag ( 7 ) ;
1373
1372
}
1373
+
1374
+ #[ cfg( feature = "nightly" ) ]
1375
+ #[ test]
1376
+ fn const_atomic_null ( ) {
1377
+ use super :: Atomic ;
1378
+ const _: Atomic < u8 > = Atomic :: < u8 > :: null ( ) ;
1379
+ }
1374
1380
}
You can’t perform that action at this time.
0 commit comments