修复20-11的mimr代码检查反馈。

原数据可能是未安装nightly 版本的 Rust 和 Miri的结果,英文原版网页运行也是这个反馈。
pull/872/head
须语 6 days ago
parent 3e0187c0ce
commit 42f99efa0b

@ -1,5 +1,16 @@
$ cargo +nightly miri run $ cargo +nightly miri run
Compiling unsafe-example v0.1.0 (file:///projects/unsafe-example) Compiling unsafe-example v0.1.0 (file:///projects/unsafe-example)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.01s 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 COUNTER: 3

Loading…
Cancel
Save