about summary refs log tree commit diff
path: root/src/libstd/sync
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstd/sync')
-rw-r--r--src/libstd/sync/mod.rs27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/libstd/sync/mod.rs b/src/libstd/sync/mod.rs
index e06e2994069..df153561b4b 100644
--- a/src/libstd/sync/mod.rs
+++ b/src/libstd/sync/mod.rs
@@ -18,17 +18,20 @@
 //! Considering the following code, operating on some global static variables:
 //!
 //! ```rust
-//! # static mut A: u32 = 0;
-//! # static mut B: u32 = 0;
-//! # static mut C: u32 = 0;
-//! # unsafe {
-//! A = 3;
-//! B = 4;
-//! A = A + B;
-//! C = B;
-//! println!("{} {} {}", A, B, C);
-//! C = A;
-//! # }
+//! static mut A: u32 = 0;
+//! static mut B: u32 = 0;
+//! static mut C: u32 = 0;
+//!
+//! fn main() {
+//!     unsafe {
+//!         A = 3;
+//!         B = 4;
+//!         A = A + B;
+//!         C = B;
+//!         println!("{} {} {}", A, B, C);
+//!         C = A;
+//!     }
+//! }
 //! ```
 //!
 //! It appears _as if_ some variables stored in memory are changed, an addition
@@ -42,8 +45,6 @@
 //! - first store to `C` might be moved before the store to `A` or `B`,
 //!   _as if_ we had written `C = 4; A = 3; B = 4;`
 //!
-//! - last store to `C` might be removed, since we never read from it again.
-//!
 //! - assignment of `A + B` to `A` might be removed, the sum can be stored in a
 //!   in a register until it gets printed, and the global variable never gets
 //!   updated.