Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cross will stop working in Rust 2024 Edition #1561

Open
4 of 11 tasks
sylv256 opened this issue Sep 26, 2024 · 4 comments
Open
4 of 11 tasks

Cross will stop working in Rust 2024 Edition #1561

sylv256 opened this issue Sep 26, 2024 · 4 comments

Comments

@sylv256
Copy link

sylv256 commented Sep 26, 2024

Checklist

Describe your issue

Cross will stop working in Rust 2024 because it uses an outdated feature.
Please migrate from mutable statics to support the latest Rust edition.

What target(s) are you cross-compiling for?

x86_64-pc-windows-gnu

Which operating system is the host (e.g computer cross is on) running?

  • macOS
  • Windows
  • Linux / BSD
  • other OS (specify in description)

What architecture is the host?

  • x86_64 / AMD64
  • arm32
  • arm64 (including Mac M1)

What container engine is cross using?

  • docker
  • podman
  • other container engine (specify in description)

cross version

cross 0.2.5 (ac4c11c 2024-09-24)

Example

Warnings like this are repeated multiple times while compiling.

warning: creating a shared reference to mutable static is discouraged
  --> src/temp.rs:91:8
   |
91 |     Ok(DIRS.last().expect("should not be empty").path())
   |        ^^^^^^^^^^^ 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

Additional information / notes

No response

@Emilgardis
Copy link
Member

I dont see how this is an issue, it will not stop working when Rust 2024 is released, we will still be on 2021 edition. When we update to 2024 we will have to move to the alternatives, but right now its fine

@sylv256
Copy link
Author

sylv256 commented Sep 26, 2024

The reason why it's being deprecated is quite important. I'd suggest reading that before deciding it's unnecessary to refactor for now.

@Emilgardis
Copy link
Member

Emilgardis commented Sep 27, 2024

Ok, that reason is more compelling. The current implementation shouldnt trigger immediate UB as we've reasoned about it (we do uphold the conditions), but we should change it to not chance it.

@Sewer56
Copy link

Sewer56 commented Nov 1, 2024

In some CI setups, running cargo install cross --git https://github.com/cross-rs/cross may fail actually.

Users of the very popular actions-rust-lang/setup-rust-toolchain which is often used transitively in CI setups would experience CI errors, because the action sets -D warnings by default.

I figured I'd give a heads up here.

Edit: In case it's not obvious, you can use RUSTFLAGS="" cargo install cross --git https://github.com/cross-rs/cross (bash) or similar as a temporary workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants