Skip to content

Commit 44b5d4d

Browse files
authored
Rollup merge of #60972 - RalfJung:volatile, r=alexcrichton
remove confusing remarks about mixed volatile and non-volatile accesses These comments were originally added by @ecstatic-morse in 911d35f and then later edited by me. The intention, I think, was to make sure people do both their reads and writes with these methods if the affected memory really is used for communication with external devices. However, [people read this as saying that mixed volatile/non-volatile accesses are UB](#58599 (comment)), which -- to my knowledge -- they are not. So better remove this. Cc @rkruppe @rust-lang/wg-unsafe-code-guidelines
2 parents 581cf70 + b9be68c commit 44b5d4d

File tree

1 file changed

+0
-6
lines changed

1 file changed

+0
-6
lines changed

Diff for: src/libcore/ptr.rs

-6
Original file line numberDiff line numberDiff line change
@@ -810,9 +810,6 @@ pub unsafe fn write_unaligned<T>(dst: *mut T, src: T) {
810810
/// to not be elided or reordered by the compiler across other volatile
811811
/// operations.
812812
///
813-
/// Memory accessed with `read_volatile` or [`write_volatile`] should not be
814-
/// accessed with non-volatile operations.
815-
///
816813
/// [`write_volatile`]: ./fn.write_volatile.html
817814
///
818815
/// # Notes
@@ -881,9 +878,6 @@ pub unsafe fn read_volatile<T>(src: *const T) -> T {
881878
/// to not be elided or reordered by the compiler across other volatile
882879
/// operations.
883880
///
884-
/// Memory accessed with [`read_volatile`] or `write_volatile` should not be
885-
/// accessed with non-volatile operations.
886-
///
887881
/// `write_volatile` does not drop the contents of `dst`. This is safe, but it
888882
/// could leak allocations or resources, so care should be taken not to overwrite
889883
/// an object that should be dropped.

0 commit comments

Comments
 (0)