@@ -68,34 +68,37 @@ extern crate portable_atomic;
68
68
69
69
#[ cfg( not( feature = "portable_atomic" ) ) ]
70
70
use core:: sync:: atomic;
71
- #[ cfg( feature = "portable_atomic" ) ]
71
+ #[ cfg( all ( feature = "portable_atomic" , portable_atomic_unsafe_assume_single_core ) ) ]
72
72
use portable_atomic as atomic;
73
73
74
- #[ cfg( feature = "barrier" ) ]
74
+ #[ cfg( all( feature = "portable_atomic" , not( portable_atomic_unsafe_assume_single_core) ) ) ]
75
+ core:: compile_error!( "The feature \" portable_atomic\" requires the \" portable_atomic_unsafe_assume_single_core\" cfg flag to be enabled. See https://docs.rs/portable-atomic/latest/portable_atomic/#optional-cfg." ) ;
76
+
77
+ #[ cfg( all( feature = "barrier" , any( not( feature = "portable_atomic" ) , all( feature = "portable_atomic" , portable_atomic_unsafe_assume_single_core) ) ) ) ]
75
78
#[ cfg_attr( docsrs, doc( cfg( feature = "barrier" ) ) ) ]
76
79
pub mod barrier;
77
- #[ cfg( feature = "lazy" ) ]
80
+ #[ cfg( all ( feature = "lazy" , any ( not ( feature = "portable_atomic" ) , all ( feature = "portable_atomic" , portable_atomic_unsafe_assume_single_core ) ) ) ) ]
78
81
#[ cfg_attr( docsrs, doc( cfg( feature = "lazy" ) ) ) ]
79
82
pub mod lazy;
80
- #[ cfg( feature = "mutex" ) ]
83
+ #[ cfg( all ( feature = "mutex" , any ( not ( feature = "portable_atomic" ) , all ( feature = "portable_atomic" , portable_atomic_unsafe_assume_single_core ) ) ) ) ]
81
84
#[ cfg_attr( docsrs, doc( cfg( feature = "mutex" ) ) ) ]
82
85
pub mod mutex;
83
- #[ cfg( feature = "once" ) ]
86
+ #[ cfg( all ( feature = "once" , any ( not ( feature = "portable_atomic" ) , all ( feature = "portable_atomic" , portable_atomic_unsafe_assume_single_core ) ) ) ) ]
84
87
#[ cfg_attr( docsrs, doc( cfg( feature = "once" ) ) ) ]
85
88
pub mod once;
86
89
pub mod relax;
87
- #[ cfg( feature = "rwlock" ) ]
90
+ #[ cfg( all ( feature = "rwlock" , any ( not ( feature = "portable_atomic" ) , all ( feature = "portable_atomic" , portable_atomic_unsafe_assume_single_core ) ) ) ) ]
88
91
#[ cfg_attr( docsrs, doc( cfg( feature = "rwlock" ) ) ) ]
89
92
pub mod rwlock;
90
93
91
- #[ cfg( feature = "mutex" ) ]
94
+ #[ cfg( all ( feature = "mutex" , any ( not ( feature = "portable_atomic" ) , all ( feature = "portable_atomic" , portable_atomic_unsafe_assume_single_core ) ) ) ) ]
92
95
#[ cfg_attr( docsrs, doc( cfg( feature = "mutex" ) ) ) ]
93
96
pub use mutex:: MutexGuard ;
94
97
#[ cfg( feature = "std" ) ]
95
98
#[ cfg_attr( docsrs, doc( cfg( feature = "std" ) ) ) ]
96
99
pub use relax:: Yield ;
97
100
pub use relax:: { RelaxStrategy , Spin } ;
98
- #[ cfg( feature = "rwlock" ) ]
101
+ #[ cfg( all ( feature = "rwlock" , any ( not ( feature = "portable_atomic" ) , all ( feature = "portable_atomic" , portable_atomic_unsafe_assume_single_core ) ) ) ) ]
99
102
#[ cfg_attr( docsrs, doc( cfg( feature = "rwlock" ) ) ) ]
100
103
pub use rwlock:: RwLockReadGuard ;
101
104
@@ -107,39 +110,39 @@ pub use rwlock::RwLockReadGuard;
107
110
///
108
111
/// A note for advanced users: this alias exists to avoid subtle type inference errors due to the default relax
109
112
/// strategy type parameter. If you need a non-default relax strategy, use the fully-qualified path.
110
- #[ cfg( feature = "barrier" ) ]
113
+ #[ cfg( all ( feature = "barrier" , any ( not ( feature = "portable_atomic" ) , all ( feature = "portable_atomic" , portable_atomic_unsafe_assume_single_core ) ) ) ) ]
111
114
#[ cfg_attr( docsrs, doc( cfg( feature = "barrier" ) ) ) ]
112
115
pub type Barrier = crate :: barrier:: Barrier ;
113
116
114
117
/// A value which is initialized on the first access. See [`lazy::Lazy`] for documentation.
115
118
///
116
119
/// A note for advanced users: this alias exists to avoid subtle type inference errors due to the default relax
117
120
/// strategy type parameter. If you need a non-default relax strategy, use the fully-qualified path.
118
- #[ cfg( feature = "lazy" ) ]
121
+ #[ cfg( all ( feature = "lazy" , any ( not ( feature = "portable_atomic" ) , all ( feature = "portable_atomic" , portable_atomic_unsafe_assume_single_core ) ) ) ) ]
119
122
#[ cfg_attr( docsrs, doc( cfg( feature = "lazy" ) ) ) ]
120
123
pub type Lazy < T , F = fn ( ) -> T > = crate :: lazy:: Lazy < T , F > ;
121
124
122
125
/// A primitive that synchronizes the execution of multiple threads. See [`mutex::Mutex`] for documentation.
123
126
///
124
127
/// A note for advanced users: this alias exists to avoid subtle type inference errors due to the default relax
125
128
/// strategy type parameter. If you need a non-default relax strategy, use the fully-qualified path.
126
- #[ cfg( feature = "mutex" ) ]
129
+ #[ cfg( all ( feature = "mutex" , any ( not ( feature = "portable_atomic" ) , all ( feature = "portable_atomic" , portable_atomic_unsafe_assume_single_core ) ) ) ) ]
127
130
#[ cfg_attr( docsrs, doc( cfg( feature = "mutex" ) ) ) ]
128
131
pub type Mutex < T > = crate :: mutex:: Mutex < T > ;
129
132
130
133
/// A primitive that provides lazy one-time initialization. See [`once::Once`] for documentation.
131
134
///
132
135
/// A note for advanced users: this alias exists to avoid subtle type inference errors due to the default relax
133
136
/// strategy type parameter. If you need a non-default relax strategy, use the fully-qualified path.
134
- #[ cfg( feature = "once" ) ]
137
+ #[ cfg( all ( feature = "once" , any ( not ( feature = "portable_atomic" ) , all ( feature = "portable_atomic" , portable_atomic_unsafe_assume_single_core ) ) ) ) ]
135
138
#[ cfg_attr( docsrs, doc( cfg( feature = "once" ) ) ) ]
136
139
pub type Once < T = ( ) > = crate :: once:: Once < T > ;
137
140
138
141
/// A lock that provides data access to either one writer or many readers. See [`rwlock::RwLock`] for documentation.
139
142
///
140
143
/// A note for advanced users: this alias exists to avoid subtle type inference errors due to the default relax
141
144
/// strategy type parameter. If you need a non-default relax strategy, use the fully-qualified path.
142
- #[ cfg( feature = "rwlock" ) ]
145
+ #[ cfg( all ( feature = "rwlock" , any ( not ( feature = "portable_atomic" ) , all ( feature = "portable_atomic" , portable_atomic_unsafe_assume_single_core ) ) ) ) ]
143
146
#[ cfg_attr( docsrs, doc( cfg( feature = "rwlock" ) ) ) ]
144
147
pub type RwLock < T > = crate :: rwlock:: RwLock < T > ;
145
148
@@ -148,15 +151,15 @@ pub type RwLock<T> = crate::rwlock::RwLock<T>;
148
151
///
149
152
/// A note for advanced users: this alias exists to avoid subtle type inference errors due to the default relax
150
153
/// strategy type parameter. If you need a non-default relax strategy, use the fully-qualified path.
151
- #[ cfg( feature = "rwlock" ) ]
154
+ #[ cfg( all ( feature = "rwlock" , any ( not ( feature = "portable_atomic" ) , all ( feature = "portable_atomic" , portable_atomic_unsafe_assume_single_core ) ) ) ) ]
152
155
#[ cfg_attr( docsrs, doc( cfg( feature = "rwlock" ) ) ) ]
153
156
pub type RwLockUpgradableGuard < ' a , T > = crate :: rwlock:: RwLockUpgradableGuard < ' a , T > ;
154
157
155
158
/// A guard that provides mutable data access. See [`rwlock::RwLockWriteGuard`] for documentation.
156
159
///
157
160
/// A note for advanced users: this alias exists to avoid subtle type inference errors due to the default relax
158
161
/// strategy type parameter. If you need a non-default relax strategy, use the fully-qualified path.
159
- #[ cfg( feature = "rwlock" ) ]
162
+ #[ cfg( all ( feature = "rwlock" , any ( not ( feature = "portable_atomic" ) , all ( feature = "portable_atomic" , portable_atomic_unsafe_assume_single_core ) ) ) ) ]
160
163
#[ cfg_attr( docsrs, doc( cfg( feature = "rwlock" ) ) ) ]
161
164
pub type RwLockWriteGuard < ' a , T > = crate :: rwlock:: RwLockWriteGuard < ' a , T > ;
162
165
0 commit comments