You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rust 2024 doesn't allow references to static mut variables. Some tests fail:
********************
FAIL: cpp2rust :: unit/bool_condition_logical.cpp/unsafe (24 of 634)
******************** TEST 'cpp2rust :: unit/bool_condition_logical.cpp/unsafe' FAILED ********************
rustc failed
error: creating a mutable reference to mutable static
--> main.rs:28:5
|
28 | side_effect.prefix_inc();
| ^^^^^^^^^^^^^^^^^^^^^^^^ mutable reference to mutable static
|
= note: mutable references to mutable statics are dangerous; it's undefined behavior if any other pointer to the static is used or if any other reference is created for the static while the mutable reference lives
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/static-mut-references.html>
= note: `#[deny(static_mut_refs)]` (part of `#[deny(rust_2024_compatibility)]`) on by default
error: aborting due to 1 previous error
After fixing this, remove -W static_mut_refs from the Cpp2RustTest.py test driver.
Compiling woff2_unsafe v0.1.0 (/home/nuno.lopes/testsuite/woff2/out/unsafe)
error: creating a shared reference to mutable static
--> src/bin/woff2_info.rs:1433:9
|
1433 | &woff2_kDsigTableTag,
| ^^^^^^^^^^^^^^^^^^^^ shared reference to mutable static
|
= 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: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/static-mut-references.html>
= note: `#[deny(static_mut_refs)]` (part of `#[deny(rust_2024_compatibility)]`) on by default
help: use `&raw const` instead to create a raw pointer
|
1433 | &raw const woff2_kDsigTableTag,
| +++++++++
error: could not compile `woff2_unsafe` (bin "woff2_info") due to 1 previous error
warning: build failed, waiting for other jobs to finish...
error: creating a shared reference to mutable static
--> src/bin/woff2_decompress.rs:3250:36
|
3250 | (*if *&mut __tmp_0 <= *&woff2_kDefaultMaxSize {
| ^^^^^^^^^^^^^^^^^^^^^^ shared reference to mutable static
|
= 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: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/static-mut-references.html>
= note: `#[deny(static_mut_refs)]` (part of `#[deny(rust_2024_compatibility)]`) on by default
help: use `&raw const` instead to create a raw pointer
|
3250 | (*if *&mut __tmp_0 <= *&raw const woff2_kDefaultMaxSize {
| +++++++++
error: creating a shared reference to mutable static
--> src/bin/woff2_decompress.rs:3253:17
|
3253 | (&woff2_kDefaultMaxSize) as *const _
| ^^^^^^^^^^^^^^^^^^^^^^^^ shared reference to mutable static
|
= 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: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/static-mut-references.html>
help: use `&raw const` instead to create a raw pointer
|
3253 | (&raw const woff2_kDefaultMaxSize) as *const _
| +++++++++
error: could not compile `woff2_unsafe` (bin "woff2_decompress") due to 2 previous errors
error: creating a shared reference to mutable static
--> src/bin/woff2_compress.rs:1433:9
|
1433 | &woff2_kDsigTableTag,
| ^^^^^^^^^^^^^^^^^^^^ shared reference to mutable static
|
= 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: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/static-mut-references.html>
= note: `#[deny(static_mut_refs)]` (part of `#[deny(rust_2024_compatibility)]`) on by default
help: use `&raw const` instead to create a raw pointer
|
1433 | &raw const woff2_kDsigTableTag,
| +++++++++
error: could not compile `woff2_unsafe` (bin "woff2_compress") due to 1 previous error
Activity
nunoplopes commentedon May 17, 2026
Woff2 also fails:
Fix Cpp2Rust#114: Rust 2024 compatibility