mirror of https://github.com/KaiserY/trpl-zh-cn
parent
3e0187c0ce
commit
42f99efa0b
@ -1,5 +1,16 @@
|
||||
$ 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 `file:///home/.rustup/toolchains/nightly/bin/cargo-miri runner target/miri/debug/unsafe-example`
|
||||
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
|
||||
|
||||
|
Loading…
Reference in new issue