-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce basic usage of Miri in the unsafe chapter
- Loading branch information
1 parent
9f44ec7
commit 20f0c94
Showing
2 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
$ cargo +nightly miri run | ||
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.01s | ||
Running `/Users/chris/.rustup/toolchains/nightly-aarch64-apple-darwin/bin/cargo-miri runner target/miri/aarch64-apple-darwin/debug/unsafe-example` | ||
warning: creating a shared reference to mutable static is discouraged | ||
--> src/main.rs:14:33 | ||
| | ||
14 | println!("COUNTER: {}", COUNTER); | ||
| ^^^^^^^ shared reference to mutable static | ||
| | ||
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/static-mut-references.html> | ||
= note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives | ||
= note: `#[warn(static_mut_refs)]` on by default | ||
|
||
COUNTER: 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters