Skip to contentSkip to conversation

Rust for 6.5

GIT PULL Merged Miguel Ojeda 2 participants 2 messages Jun 18, 2023 – Jun 26, 2023 Rust

lore
Share & tools
lore

Miguel Ojeda

author maintainer
#0 lore raw

Hi Linus,

This is the next round of the Rust support.

All commits have been in linux-next for more than 2 weeks, except the last which has been there for 4 days.

No conflicts expected. No changes to the C side.

Please pull for v6.5 -- thanks!

Cheers,
Miguel

The following changes since commit 7877cb91f1081754a1487c144d85dc0d2e2e7fc4:

Linux 6.4-rc4 (2023-05-28 07:49:00 -0400)

are available in the Git repository at:

https://github.com/Rust-for-Linux/linux.git tags/rust-6.5

for you to fetch changes up to d2e3115d717197cb2bc020dd1f06b06538474ac3:

rust: error: impl Debug for Error with errname() integration (2023-06-13 01:24:42 +0200)

----------------------------------------------------------------
Rust changes for v6.5

A fairly small one in terms of feature additions. Most of the changes in terms of lines come from the upgrade to the new version of the toolchain (which in turn is big due to the vendored 'alloc' crate).

- Upgrade to Rust 1.68.2:

This is the first such upgrade, and we will try to update it often from now on, in order to remain close to the latest release, until a minimum version (which is "in the future") can be established.

The upgrade brings the stabilization of 4 features we used (and 2 more that we used in our old 'rust' branch).

Commit 3ed03f4da06e ("rust: upgrade to Rust 1.68.2") contains the details and rationale.

- pin-init API:

Several internal improvements and fixes to the pin-init API, e.g. allowing to use 'Self' in a struct definition with '#[pin_data]'.

- 'error' module:

New 'name()' method for the 'Error' type (with 'errname()' integration), used to implement the 'Debug' trait for 'Error'.

Add error codes from 'include/linux/errno.h' to the list of Rust 'Error' constants.

Allow specifying error type on the 'Result' type (with the default still being our usual 'Error' type).

- 'str' module:

'TryFrom' implementation for 'CStr', and new 'to_cstring()' method based on it.

- 'sync' module:

Implement 'AsRef' trait for 'Arc', allowing to use 'Arc' in code that is generic over smart pointer types.

Add 'ptr_eq' method to 'Arc' for easier, less error prone comparison between two 'Arc' pointers.

Reword the 'Send' safety comment for 'Arc', and avoid referencing it from the 'Sync' one.

- 'task' module:

Implement 'Send' marker for 'Task'.

- 'types' module:

Implement 'Send' and 'Sync' markers for 'ARef<T>' when 'T' is 'AlwaysRefCounted', 'Send' and 'Sync'.

- Other changes:

Documentation improvements and '.gitattributes' change to start using the Rust diff driver.

----------------------------------------------------------------
Alice Ryhl (9):
rust: error: allow specifying error type on Result
rust: str: add conversion from CStr to CString
rust: error: add missing error codes
rust: sync: add Arc::ptr_eq
rust: sync: implement AsRef<T> for Arc<T>
rust: sync: reword the Arc safety comment for Send
rust: sync: reword the Arc safety comment for Sync
rust: specify when ARef is thread safe
rust: task: add Send marker to Task

Benno Lossin (4):
rust: macros: fix usage of #[allow] in quote!
rust: macros: refactor generics parsing of #[pin_data] into its own function
rust: macros: replace Self with the concrete type in #[pin_data]
rust: init: update macro expansion example in docs

Gary Guo (1):
rust: error: impl Debug for Error with errname() integration

Miguel Ojeda (5):
rust: alloc: clarify what is the upstream version
rust: arc: fix intra-doc link in Arc<T>::init
rust: upgrade to Rust 1.68.2
.gitattributes: set diff driver for Rust source code files
docs: rust: point directly to the standalone installers

 .gitattributes                     |   1 +
 Documentation/process/changes.rst  |   2 +-
 Documentation/rust/quick-start.rst |   4 +-
 rust/alloc/README.md               |   3 +
 rust/alloc/alloc.rs                |  55 +++--
 rust/alloc/boxed.rs                | 446 +++++++++++++++++++++++++++++++++--
 rust/alloc/collections/mod.rs      |   5 +-
 rust/alloc/lib.rs                  |  71 ++++--
 rust/alloc/raw_vec.rs              |  16 +-
 rust/alloc/slice.rs                | 447 +++++------------------------------
 rust/alloc/vec/drain.rs            |  81 ++++++-
 rust/alloc/vec/drain_filter.rs     |  60 ++++-
 rust/alloc/vec/into_iter.rs        | 125 +++++++---
 rust/alloc/vec/is_zero.rs          |  96 +++++++-
 rust/alloc/vec/mod.rs              | 464 ++++++++++++++++++++++++++++---------
 rust/alloc/vec/set_len_on_drop.rs  |   5 +
 rust/alloc/vec/spec_extend.rs      |  63 +----
 rust/bindings/bindings_helper.h    |   1 +
 rust/bindings/lib.rs               |   1 -
 rust/helpers.c                     |   7 +
 rust/kernel/build_assert.rs        |   2 +
 rust/kernel/error.rs               |  61 ++++-
 rust/kernel/init.rs                |   5 +
 rust/kernel/init/macros.rs         |  85 ++++---
 rust/kernel/lib.rs                 |   4 -
 rust/kernel/std_vendor.rs          |   2 +
 rust/kernel/str.rs                 |  22 ++
 rust/kernel/sync/arc.rs            |  25 +-
 rust/kernel/task.rs                |  10 +-
 rust/kernel/types.rs               |  13 ++
 rust/macros/helpers.rs             |  86 ++++++-
 rust/macros/pin_data.rs            | 168 +++++++++-----
 rust/macros/quote.rs               |  14 +-
 rust/uapi/lib.rs                   |   1 -
 scripts/Makefile.build             |   2 +-
 scripts/min-tool-version.sh        |   2 +-
 36 files changed, 1659 insertions(+), 796 deletions(-)