diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-05-20 23:03:08 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-05-20 23:03:08 +0200 |
| commit | 44b5d4deb66a9cac04076ec0dabd46a0275a9bbf (patch) | |
| tree | 7e47cbea5353ad040cf62dd28832040502c9216a | |
| parent | 581cf70367d89af738a4f6be5eda8b7f157de25e (diff) | |
| parent | b9be68ce2ed75a3801075f66f50200e329211400 (diff) | |
| download | rust-44b5d4deb66a9cac04076ec0dabd46a0275a9bbf.tar.gz rust-44b5d4deb66a9cac04076ec0dabd46a0275a9bbf.zip | |
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 https://github.com/rust-lang/rust/commit/911d35f0bfd207112806eaec2763201dad06d1c7 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](https://github.com/rust-lang/rust/issues/58599#issuecomment-493791130), which -- to my knowledge -- they are not. So better remove this. Cc @rkruppe @rust-lang/wg-unsafe-code-guidelines
| -rw-r--r-- | src/libcore/ptr.rs | 6 |
1 files changed, 0 insertions, 6 deletions
diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index dd321dcdfae..006b1e143ee 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -810,9 +810,6 @@ pub unsafe fn write_unaligned<T>(dst: *mut T, src: T) { /// to not be elided or reordered by the compiler across other volatile /// operations. /// -/// Memory accessed with `read_volatile` or [`write_volatile`] should not be -/// accessed with non-volatile operations. -/// /// [`write_volatile`]: ./fn.write_volatile.html /// /// # Notes @@ -881,9 +878,6 @@ pub unsafe fn read_volatile<T>(src: *const T) -> T { /// to not be elided or reordered by the compiler across other volatile /// operations. /// -/// Memory accessed with [`read_volatile`] or `write_volatile` should not be -/// accessed with non-volatile operations. -/// /// `write_volatile` does not drop the contents of `dst`. This is safe, but it /// could leak allocations or resources, so care should be taken not to overwrite /// an object that should be dropped. |
