-
Notifications
You must be signed in to change notification settings - Fork 76
Upgrade to compatibility with rust edition 2024 #200
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
base: main
Are you sure you want to change the base?
Conversation
3052f83
to
e482ef9
Compare
Does that effectively bump |
e482ef9
to
633f51a
Compare
Yes, it would. Is that a problem? We don't have to land this now - it could wait, or we could make a separate CI build that modifies it to 2024 and then runs checks while actually keeping it at 2021 - but remembering there are different edition rules across related projects is a mental overhead I'm trying to resolve. |
633f51a
to
88ffcab
Compare
We want to support Rust toolchains avaliable in RHEL, Alpine and Ubuntu LTS, to allow building distribution packages of ngx-rust based modules. Currently, that limits us to 1.82.0. |
OK: I will remove the upgrade of edition and msrv, I will switch this to lint that the libraries are compatible with the 2024 edition, which keeps the upgrade delta pretty small. |
20b75fc
to
3896684
Compare
1688760
to
737e368
Compare
737e368
to
77216ba
Compare
254a706
to
cd1940f
Compare
enforced by workspace level lints, now specified in each Cargo.toml, except nginx-sys, because bindgen can't be set to Edition2024 until MSRV hits 1.85 this change set is created automatically by `cargo fix --edition --all`, then with manual fixes afterwards: * Back out any use of unsafe(no_mangle) for plain no_mangle, since 1.81 wont accept it * remove uses of expr_2021 in macros, which is not available in the MSRV. * Manual fix to ngx_container_of! macro for safety rules in 2024, these weren't migrated automatically by `cargo fix` * Manual fixes to several other macros that created an &mut Request in an expression, Rust 2024 is stricter about taking &mut of temporaries, so instead the request is let-bound first.
cd1940f
to
dadcb3e
Compare
Proposed changes
We can't actually upgrade to edition 2024, because the MSRV is currently stuck on 1.81 for LTS linux packaging, and 2024 shipped in 1.85. But, in order to have a consistent set of rules (especially around
unsafe
) to follow across Rust projects with a newer MSRV, make this source tree forwards-compatible to 2024.Automatically make changes to source of all crates using
cargo fix --edition --all
, then all of the manual fixes required after that.Add workspace level lints for
rust-2024-compatibility
, allowing the expr fragment specifier case which I don't expect to matter and is unstable when building with 1.81Checklist
Before creating a PR, run through this checklist and mark each as complete.