mirror of https://github.com/KaiserY/trpl-zh-cn
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
928 B
17 lines
928 B
$ cargo +nightly miri run
|
|
Compiling unsafe-example v0.1.0 (file:///projects/unsafe-example)
|
|
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
|
|
|