Skip to content

examples: mark as #[inline] all From::from()s for Error#126

Merged
nbdd0121 merged 1 commit intoRust-for-Linux:mainfrom
alistair23:alistair/inline
Apr 16, 2026
Merged

examples: mark as #[inline] all From::from()s for Error#126
nbdd0121 merged 1 commit intoRust-for-Linux:mainfrom
alistair23:alistair/inline

Conversation

@alistair23
Copy link
Copy Markdown
Contributor

@alistair23 alistair23 commented Mar 25, 2026

There was a recent request [1] to mark as #[inline] the simple
From::from() functions implemented for Error.

Thus mark all of the existing

    impl From<...> for Error {
        fn from(err: ...) -> Self {
            ...
        }
    }

functions in the kernel crate as #[inline].

Suggested-by: Gary Guo gary@garyguo.net
Link: https://lore.kernel.org/all/8403c8b7a832b5274743816eb77abfa4@garyguo.net/ [1]

Copy link
Copy Markdown
Member

@nbdd0121 nbdd0121 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think these #[inline]s are useful given it's only in examples, but I don't think these'll hurt either.

Anyhow, please adjust your commit summary and message to quote code blocks properly and to use lore link. You can see the commit message that Miguel fixed up for you: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4f13c93497e366cd8e41561a8e30ad4da887cb82

@alistair23 alistair23 changed the title rust: Mark all from() for Error functions inline rust: kernel: mark as #[inline] all From::from()s for Error Apr 16, 2026
@alistair23
Copy link
Copy Markdown
Contributor Author

Commit is updated

There was a recent request in kernel [1] to mark as `#[inline]` the
simple `From::from()` functions implemented for `Error`.

Thus mark all of the existing

    impl From<...> for Error {
        fn from(err: ...) -> Self {
            ...
        }
    }

functions as `#[inline]`.

While in pin-init crate the relevant code is just examples, it
nevertheless does not hurt to use good practice for them.

Suggested-by: Gary Guo <gary@garyguo.net>
Link: https://lore.kernel.org/all/8403c8b7a832b5274743816eb77abfa4@garyguo.net/ [1]
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
[ Reworded commit message - Gary ]
Signed-off-by: Gary Guo <gary@garyguo.net>
@nbdd0121 nbdd0121 changed the title rust: kernel: mark as #[inline] all From::from()s for Error examples: mark as #[inline] all From::from()s for Error Apr 16, 2026
@nbdd0121 nbdd0121 merged commit f2f676b into Rust-for-Linux:main Apr 16, 2026
26 checks passed
@nbdd0121
Copy link
Copy Markdown
Member

Thanks

@alistair23 alistair23 deleted the alistair/inline branch April 16, 2026 05:11
nbdd0121 added a commit to nbdd0121/linux that referenced this pull request Apr 27, 2026
This series collects all upstream developments of pin-init to date and
synchronize them to the kernel tree.

A major change in this cycle is the bump of MSRV to 1.82 to get rid of
unstable features, following the kernel version bump in 7.1. The MSRV is
bumped straight to 1.85 as pin-init can also be used outside kernel, so we
avoid bumping unless there is a need for new version.

Here are the list of merged changes included in the series:

- examples: mark as `#[inline]` all `From::from()`s for `Error`
  Rust-for-Linux/pin-init#126
- bump minimum Rust version to 1.82
  Rust-for-Linux/pin-init#129
- cleanup `Zeroable` and `ZeroableOptions`
  Rust-for-Linux/pin-init#118
- internal: add missing where clause to projection types
  Rust-for-Linux/pin-init#121
- internal: internal: remove redundant `#[pin]` filtering
  Rust-for-Linux/pin-init#131

For information, here are the list of upstream-only changes, which are
related to Cargo or tests/CI changes only.

- build.rs: use `option_env!` to register env variable dependency
  Rust-for-Linux/pin-init#128
- clean up dependencies
  Rust-for-Linux/pin-init#130
- tests: add test for check correct macro hygiene 
  Rust-for-Linux/pin-init#133
- ci: use tagged release of actions
  Rust-for-Linux/pin-init#134
- ci: have a single job to gate all required jobs
  Rust-for-Linux/pin-init#138

Best,
Gary

--- b4-submit-tracking ---
# This section is used internally by b4 prep for tracking purposes.
{
  "series": {
    "revision": 1,
    "change-id": "20260414-pin-init-sync-ae407945a726",
    "prefixes": [],
    "presubject": ""
  }
}
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.

2 participants