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

Rust 1.70.0 #1017

Merged
merged 4 commits into from
Jun 21, 2023
Merged

Rust 1.70.0 #1017

merged 4 commits into from
Jun 21, 2023

Conversation

ojeda
Copy link
Member

@ojeda ojeda commented Jun 21, 2023

rust-next is getting Rust 1.70.0 soon, thus upgrade it here too (with the extra alloc bits, as usual).

This also aligns all branches to a single Rust version (for e.g. KernelCI/0-Day purposes).

`rust-next` is getting Rust 1.70.0 soon, thus upgrade it here too
(with the extra `alloc` bits, as usual).

This also aligns all branches to a single Rust version.

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Introduced in Rust 1.69.0 [1], this lint prevents forgetting to set
the C ABI when using `#[no_mangle]` (or thinking it is implied).

For instance, it would have prevented the issue [2] fixed by commit
c682e4c ("rust: kernel: Mark rust_fmt_argument as extern "C"").

    error: `#[no_mangle]` set on a function with the default (`Rust`) ABI
      --> rust/kernel/print.rs:21:1
       |
    21 | / unsafe fn rust_fmt_argument(
    22 | |     buf: *mut c_char,
    23 | |     end: *mut c_char,
    24 | |     ptr: *const c_void,
    25 | | ) -> *mut c_char {
       | |________________^
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#no_mangle_with_rust_abi
       = note: requested on the command line with `-D clippy::no-mangle-with-rust-abi`
    help: set an ABI
       |
    21 | unsafe extern "C" fn rust_fmt_argument(
       |        ++++++++++
    help: or explicitly set the default
       |
    21 | unsafe extern "Rust" fn rust_fmt_argument(
       |        +++++++++++++

Thus enable it.

In some cases, we need to use the Rust ABI even with `#[no_mangle]`,
and for that, one may use `extern "Rust"` explicitly, but `rustfmt`
overwrites it (and there does not seem to be an option to prevent
that: `force_explicit_abi` does not allow to control that part,
and even if it did, or if there was another option, we may not use
it, since so far we have been using the defaults). Therefore, use
`allow`s instead for the few cases we had.

Link: rust-lang/rust-clippy#10347 [1]
Link: Rust-for-Linux#967 [2]
Link: https://rust-lang.github.io/rustfmt/?version=v1.5.2&search=force_explicit_abi#force_explicit_abi [3]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Due to the `eh_frame` issue [1]. They may be re-enabled in
Rust 1.72.0.

Link: Rust-for-Linux#1012 [1]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
@ojeda ojeda merged commit c8d1ae2 into Rust-for-Linux:rust Jun 21, 2023
@ojeda ojeda deleted the rust-rust-1.70 branch June 21, 2023 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant