Skip to content

Commit eaab582

Browse files
committed
Revert "Part 3: Add safety contracts to all atomic intrinsic declarations"
This reverts commit f598ca7.
1 parent f598ca7 commit eaab582

1 file changed

Lines changed: 0 additions & 15 deletions

File tree

  • library/core/src/intrinsics

library/core/src/intrinsics/mod.rs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ pub enum AtomicOrdering {
9999
/// For example, [`AtomicBool::compare_exchange`].
100100
#[rustc_intrinsic]
101101
#[rustc_nounwind]
102-
#[requires(ub_checks::can_write(dst) && ub_checks::can_dereference(dst as *const T))]
103102
pub unsafe fn atomic_cxchg<
104103
T: Copy,
105104
const ORD_SUCC: AtomicOrdering,
@@ -118,7 +117,6 @@ pub unsafe fn atomic_cxchg<
118117
/// For example, [`AtomicBool::compare_exchange_weak`].
119118
#[rustc_intrinsic]
120119
#[rustc_nounwind]
121-
#[requires(ub_checks::can_write(_dst) && ub_checks::can_dereference(_dst as *const T))]
122120
pub unsafe fn atomic_cxchgweak<
123121
T: Copy,
124122
const ORD_SUCC: AtomicOrdering,
@@ -136,7 +134,6 @@ pub unsafe fn atomic_cxchgweak<
136134
/// [`atomic`] types via the `load` method. For example, [`AtomicBool::load`].
137135
#[rustc_intrinsic]
138136
#[rustc_nounwind]
139-
#[requires(ub_checks::can_dereference(src))]
140137
pub unsafe fn atomic_load<T: Copy, const ORD: AtomicOrdering>(src: *const T) -> T;
141138

142139
/// Stores the value at the specified memory location.
@@ -146,7 +143,6 @@ pub unsafe fn atomic_load<T: Copy, const ORD: AtomicOrdering>(src: *const T) ->
146143
/// [`atomic`] types via the `store` method. For example, [`AtomicBool::store`].
147144
#[rustc_intrinsic]
148145
#[rustc_nounwind]
149-
#[requires(ub_checks::can_write(dst))]
150146
pub unsafe fn atomic_store<T: Copy, const ORD: AtomicOrdering>(dst: *mut T, val: T);
151147

152148
/// Stores the value at the specified memory location, returning the old value.
@@ -156,7 +152,6 @@ pub unsafe fn atomic_store<T: Copy, const ORD: AtomicOrdering>(dst: *mut T, val:
156152
/// [`atomic`] types via the `swap` method. For example, [`AtomicBool::swap`].
157153
#[rustc_intrinsic]
158154
#[rustc_nounwind]
159-
#[requires(ub_checks::can_write(dst) && ub_checks::can_dereference(dst as *const T))]
160155
pub unsafe fn atomic_xchg<T: Copy, const ORD: AtomicOrdering>(dst: *mut T, src: T) -> T;
161156

162157
/// Adds to the current value, returning the previous value.
@@ -167,7 +162,6 @@ pub unsafe fn atomic_xchg<T: Copy, const ORD: AtomicOrdering>(dst: *mut T, src:
167162
/// [`atomic`] types via the `fetch_add` method. For example, [`AtomicIsize::fetch_add`].
168163
#[rustc_intrinsic]
169164
#[rustc_nounwind]
170-
#[requires(ub_checks::can_write(dst) && ub_checks::can_dereference(dst as *const T))]
171165
pub unsafe fn atomic_xadd<T: Copy, U: Copy, const ORD: AtomicOrdering>(dst: *mut T, src: U) -> T;
172166

173167
/// Subtract from the current value, returning the previous value.
@@ -178,7 +172,6 @@ pub unsafe fn atomic_xadd<T: Copy, U: Copy, const ORD: AtomicOrdering>(dst: *mut
178172
/// [`atomic`] types via the `fetch_sub` method. For example, [`AtomicIsize::fetch_sub`].
179173
#[rustc_intrinsic]
180174
#[rustc_nounwind]
181-
#[requires(ub_checks::can_write(dst) && ub_checks::can_dereference(dst as *const T))]
182175
pub unsafe fn atomic_xsub<T: Copy, U: Copy, const ORD: AtomicOrdering>(dst: *mut T, src: U) -> T;
183176

184177
/// Bitwise and with the current value, returning the previous value.
@@ -189,7 +182,6 @@ pub unsafe fn atomic_xsub<T: Copy, U: Copy, const ORD: AtomicOrdering>(dst: *mut
189182
/// [`atomic`] types via the `fetch_and` method. For example, [`AtomicBool::fetch_and`].
190183
#[rustc_intrinsic]
191184
#[rustc_nounwind]
192-
#[requires(ub_checks::can_write(dst) && ub_checks::can_dereference(dst as *const T))]
193185
pub unsafe fn atomic_and<T: Copy, U: Copy, const ORD: AtomicOrdering>(dst: *mut T, src: U) -> T;
194186

195187
/// Bitwise nand with the current value, returning the previous value.
@@ -200,7 +192,6 @@ pub unsafe fn atomic_and<T: Copy, U: Copy, const ORD: AtomicOrdering>(dst: *mut
200192
/// [`AtomicBool`] type via the `fetch_nand` method. For example, [`AtomicBool::fetch_nand`].
201193
#[rustc_intrinsic]
202194
#[rustc_nounwind]
203-
#[requires(ub_checks::can_write(dst) && ub_checks::can_dereference(dst as *const T))]
204195
pub unsafe fn atomic_nand<T: Copy, U: Copy, const ORD: AtomicOrdering>(dst: *mut T, src: U) -> T;
205196

206197
/// Bitwise or with the current value, returning the previous value.
@@ -211,7 +202,6 @@ pub unsafe fn atomic_nand<T: Copy, U: Copy, const ORD: AtomicOrdering>(dst: *mut
211202
/// [`atomic`] types via the `fetch_or` method. For example, [`AtomicBool::fetch_or`].
212203
#[rustc_intrinsic]
213204
#[rustc_nounwind]
214-
#[requires(ub_checks::can_write(dst) && ub_checks::can_dereference(dst as *const T))]
215205
pub unsafe fn atomic_or<T: Copy, U: Copy, const ORD: AtomicOrdering>(dst: *mut T, src: U) -> T;
216206

217207
/// Bitwise xor with the current value, returning the previous value.
@@ -222,7 +212,6 @@ pub unsafe fn atomic_or<T: Copy, U: Copy, const ORD: AtomicOrdering>(dst: *mut T
222212
/// [`atomic`] types via the `fetch_xor` method. For example, [`AtomicBool::fetch_xor`].
223213
#[rustc_intrinsic]
224214
#[rustc_nounwind]
225-
#[requires(ub_checks::can_write(dst) && ub_checks::can_dereference(dst as *const T))]
226215
pub unsafe fn atomic_xor<T: Copy, U: Copy, const ORD: AtomicOrdering>(dst: *mut T, src: U) -> T;
227216

228217
/// Maximum with the current value using a signed comparison.
@@ -232,7 +221,6 @@ pub unsafe fn atomic_xor<T: Copy, U: Copy, const ORD: AtomicOrdering>(dst: *mut
232221
/// [`atomic`] signed integer types via the `fetch_max` method. For example, [`AtomicI32::fetch_max`].
233222
#[rustc_intrinsic]
234223
#[rustc_nounwind]
235-
#[requires(ub_checks::can_write(dst) && ub_checks::can_dereference(dst as *const T))]
236224
pub unsafe fn atomic_max<T: Copy, const ORD: AtomicOrdering>(dst: *mut T, src: T) -> T;
237225

238226
/// Minimum with the current value using a signed comparison.
@@ -242,7 +230,6 @@ pub unsafe fn atomic_max<T: Copy, const ORD: AtomicOrdering>(dst: *mut T, src: T
242230
/// [`atomic`] signed integer types via the `fetch_min` method. For example, [`AtomicI32::fetch_min`].
243231
#[rustc_intrinsic]
244232
#[rustc_nounwind]
245-
#[requires(ub_checks::can_write(dst) && ub_checks::can_dereference(dst as *const T))]
246233
pub unsafe fn atomic_min<T: Copy, const ORD: AtomicOrdering>(dst: *mut T, src: T) -> T;
247234

248235
/// Minimum with the current value using an unsigned comparison.
@@ -252,7 +239,6 @@ pub unsafe fn atomic_min<T: Copy, const ORD: AtomicOrdering>(dst: *mut T, src: T
252239
/// [`atomic`] unsigned integer types via the `fetch_min` method. For example, [`AtomicU32::fetch_min`].
253240
#[rustc_intrinsic]
254241
#[rustc_nounwind]
255-
#[requires(ub_checks::can_write(dst) && ub_checks::can_dereference(dst as *const T))]
256242
pub unsafe fn atomic_umin<T: Copy, const ORD: AtomicOrdering>(dst: *mut T, src: T) -> T;
257243

258244
/// Maximum with the current value using an unsigned comparison.
@@ -262,7 +248,6 @@ pub unsafe fn atomic_umin<T: Copy, const ORD: AtomicOrdering>(dst: *mut T, src:
262248
/// [`atomic`] unsigned integer types via the `fetch_max` method. For example, [`AtomicU32::fetch_max`].
263249
#[rustc_intrinsic]
264250
#[rustc_nounwind]
265-
#[requires(ub_checks::can_write(dst) && ub_checks::can_dereference(dst as *const T))]
266251
pub unsafe fn atomic_umax<T: Copy, const ORD: AtomicOrdering>(dst: *mut T, src: T) -> T;
267252

268253
/// An atomic fence.

0 commit comments

Comments
 (0)