Skip to content

Rust 2024 compatibility #114

@nunoplopes

Description

@nunoplopes

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions