|
Revision tags: v6.15, v6.15-rc7, v6.15-rc6, v6.15-rc5, v6.15-rc4, v6.15-rc3, v6.15-rc2, v6.15-rc1, v6.14, v6.14-rc7, v6.14-rc6 |
|
| #
c0010452 |
| 07-Mar-2025 |
José Expósito <[email protected]> |
rust: macros: add macro to easily run KUnit tests
Add a new procedural macro (`#[kunit_tests(kunit_test_suit_name)]`) to run KUnit tests using a user-space like syntax.
The macro, that should be us
rust: macros: add macro to easily run KUnit tests
Add a new procedural macro (`#[kunit_tests(kunit_test_suit_name)]`) to run KUnit tests using a user-space like syntax.
The macro, that should be used on modules, transforms every `#[test]` in a `kunit_case!` and adds a `kunit_unsafe_test_suite!` registering all of them.
The only difference with user-space tests is that instead of using `#[cfg(test)]`, `#[kunit_tests(kunit_test_suit_name)]` is used.
Note that `#[cfg(CONFIG_KUNIT)]` is added so the test module is not compiled when `CONFIG_KUNIT` is set to `n`.
Reviewed-by: David Gow <[email protected]> Signed-off-by: José Expósito <[email protected]> Co-developed-by: Boqun Feng <[email protected]> Signed-off-by: Boqun Feng <[email protected]> Co-developed-by: Miguel Ojeda <[email protected]> Signed-off-by: Miguel Ojeda <[email protected]> Reviewed-by: Tamir Duberstein <[email protected]> Signed-off-by: David Gow <[email protected]> Link: https://lore.kernel.org/r/[email protected] [ Removed spurious (in rendered form) newline in docs. - Miguel ] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|
| #
dbd5058b |
| 08-Mar-2025 |
Benno Lossin <[email protected]> |
rust: make pin-init its own crate
Rename relative paths inside of the crate to still refer to the same items, also rename paths inside of the kernel crate and adjust the build system to build the cr
rust: make pin-init its own crate
Rename relative paths inside of the crate to still refer to the same items, also rename paths inside of the kernel crate and adjust the build system to build the crate.
[ Remove the `expect` (and thus the `lint_reasons` feature) since the tree now uses `quote!` from `rust/macros/export.rs`. Remove the `TokenStream` import removal, since it is now used as well.
In addition, temporarily (i.e. just for this commit) use an `--extern force:alloc` to prevent an unknown `new_uninit` error in the `rustdoc` target. For context, please see a similar case in:
https://lore.kernel.org/lkml/[email protected]/
And adjusted the message above. - Miguel ]
Signed-off-by: Benno Lossin <[email protected]> Reviewed-by: Fiona Behrens <[email protected]> Tested-by: Andreas Hindborg <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|
| #
fbf8fb32 |
| 08-Mar-2025 |
Benno Lossin <[email protected]> |
rust: move pin-init API into its own directory
In preparation of splitting off the pin-init crate from the kernel crate, move all pin-init API code (including proc-macros) into `rust/pin-init`.
Mov
rust: move pin-init API into its own directory
In preparation of splitting off the pin-init crate from the kernel crate, move all pin-init API code (including proc-macros) into `rust/pin-init`.
Moved modules have their import path adjusted via the `#[path = "..."]` attribute. This allows the files to still be imported in the kernel crate even though the files are in different directories.
Code that is moved out of files (but the file itself stays where it is) is imported via the `include!` macro. This also allows the code to be moved while still being part of the kernel crate.
Note that this commit moves the generics parsing code out of the GPL-2.0 file `rust/macros/helpers.rs` into the Apache-2.0 OR MIT file `rust/pin_init/internal/src/helpers.rs`. I am the sole author of that code and it already is available with that license at [1]. The same is true for the entry-points of the proc-macros `pin_data`, `pinned_drop` and `derive_zeroable` in `rust/macros/lib.rs` that are moved to `rust/pin_data/internal/src/lib.rs`. Although there are some smaller patches that fix the doctests.
Link: https://github.com/Rust-for-Linux/pinned-init [1] Signed-off-by: Benno Lossin <[email protected]> Reviewed-by: Andreas Hindborg <[email protected]> Reviewed-by: Fiona Behrens <[email protected]> Tested-by: Andreas Hindborg <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|
| #
206dea39 |
| 08-Mar-2025 |
Benno Lossin <[email protected]> |
rust: init: disable doctests
The build system cannot handle doctests in the kernel crate in files outside of `rust/kernel/`. Subsequent commits will move files out of that directory, but will still
rust: init: disable doctests
The build system cannot handle doctests in the kernel crate in files outside of `rust/kernel/`. Subsequent commits will move files out of that directory, but will still compile them as part of the kernel crate. Thus ignore all doctests in the to-be-moved files.
Leave tests disabled until they are separated into their own crate and they stop causing breakage.
Signed-off-by: Benno Lossin <[email protected]> Reviewed-by: Fiona Behrens <[email protected]> Reviewed-by: Andreas Hindborg <[email protected]> Tested-by: Andreas Hindborg <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|
| #
38559da6 |
| 09-Mar-2025 |
Guilherme Giacomo Simoes <[email protected]> |
rust: module: introduce `authors` key
In the `module!` macro, the `author` field is currently of type `String`.
Since modules can have multiple authors, this limitation prevents specifying more tha
rust: module: introduce `authors` key
In the `module!` macro, the `author` field is currently of type `String`.
Since modules can have multiple authors, this limitation prevents specifying more than one.
Add an `authors` field as `Option<Vec<String>>` to allow creating modules with multiple authors, and change the documentation and all current users to use it. Eventually, the single `author` field may be removed.
[ The `modinfo` key needs to still be `author`; otherwise, tooling may not work properly, e.g.:
$ modinfo --author samples/rust/rust_print.ko Rust for Linux Contributors
I have also kept the original `author` field (undocumented), so that we can drop it more easily in a kernel cycle or two.
- Miguel ]
Suggested-by: Miguel Ojeda <[email protected]> Link: https://github.com/Rust-for-Linux/linux/issues/244 Reviewed-by: Charalampos Mitrodimas <[email protected]> Reviewed-by: Alice Ryhl <[email protected]> Reviewed-by: Andreas Hindborg <[email protected]> Signed-off-by: Guilherme Giacomo Simoes <[email protected]> Link: https://lore.kernel.org/r/[email protected] [ Fixed `modinfo` key. Kept `author` field. Reworded message accordingly. Updated my email. - Miguel ] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|
| #
44e333fe |
| 03-Mar-2025 |
Alice Ryhl <[email protected]> |
rust: add #[export] macro
Rust has two different tools for generating function declarations to call across the FFI boundary:
* bindgen. Generates Rust declarations from a C header. * cbindgen. Gene
rust: add #[export] macro
Rust has two different tools for generating function declarations to call across the FFI boundary:
* bindgen. Generates Rust declarations from a C header. * cbindgen. Generates C headers from Rust declarations.
However, we only use bindgen in the kernel. This means that when C code calls a Rust function by name, its signature must be duplicated in both Rust code and a C header, and the signature needs to be kept in sync manually.
Introducing cbindgen as a mandatory dependency to build the kernel would be a rather complex and large change, so we do not consider that at this time. Instead, to eliminate this manual checking, introduce a new macro that verifies at compile time that the two function declarations use the same signature. The idea is to run the C declaration through bindgen, and then have rustc verify that the function pointers have the same type.
The signature must still be written twice, but at least you can no longer get it wrong. If the signatures don't match, you will get errors that look like this:
error[E0308]: `if` and `else` have incompatible types --> <linux>/rust/kernel/print.rs:22:22 | 21 | #[export] | --------- expected because of this 22 | unsafe extern "C" fn rust_fmt_argument( | ^^^^^^^^^^^^^^^^^ expected `u8`, found `i8` | = note: expected fn item `unsafe extern "C" fn(*mut u8, *mut u8, *mut c_void) -> *mut u8 {bindings::rust_fmt_argument}` found fn item `unsafe extern "C" fn(*mut i8, *mut i8, *const c_void) -> *mut i8 {print::rust_fmt_argument}`
It is unfortunate that the error message starts out by saying "`if` and `else` have incompatible types", but I believe the rest of the error message is reasonably clear and not too confusing.
Reviewed-by: Tamir Duberstein <[email protected]> Reviewed-by: Andreas Hindborg <[email protected]> Acked-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Alice Ryhl <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|
|
Revision tags: v6.14-rc5, v6.14-rc4, v6.14-rc3, v6.14-rc2, v6.14-rc1, v6.13, v6.13-rc7, v6.13-rc6, v6.13-rc5, v6.13-rc4, v6.13-rc3, v6.13-rc2, v6.13-rc1 |
|
| #
4401565f |
| 23-Nov-2024 |
Miguel Ojeda <[email protected]> |
rust: add `build_error!` to the prelude
The sibling `build_assert!` is already in the prelude, it makes sense that a "core"/"language" facility like this is part of the prelude and users should not
rust: add `build_error!` to the prelude
The sibling `build_assert!` is already in the prelude, it makes sense that a "core"/"language" facility like this is part of the prelude and users should not be defining their own one (thus there should be no risk of future name collisions and we would want to be aware of them anyway).
Thus add `build_error!` into the prelude.
Reviewed-by: Alice Ryhl <[email protected]> Link: https://lore.kernel.org/r/[email protected] [ Applied the change to the new miscdevice cases. - Miguel ] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|
| #
15f2f931 |
| 23-Nov-2024 |
Miguel Ojeda <[email protected]> |
rust: use the `build_error!` macro, not the hidden function
Code and some examples were using the function, rather than the macro. The macro is what is documented.
Thus move users to the macro.
Re
rust: use the `build_error!` macro, not the hidden function
Code and some examples were using the function, rather than the macro. The macro is what is documented.
Thus move users to the macro.
Reviewed-by: Alice Ryhl <[email protected]> Link: https://lore.kernel.org/r/[email protected] [ Applied the change to the new miscdevice cases. - Miguel ] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|
|
Revision tags: v6.12, v6.12-rc7, v6.12-rc6, v6.12-rc5, v6.12-rc4, v6.12-rc3, v6.12-rc2, v6.12-rc1, v6.11, v6.11-rc7, v6.11-rc6, v6.11-rc5, v6.11-rc4, v6.11-rc3, v6.11-rc2, v6.11-rc1, v6.10, v6.10-rc7 |
|
| #
ae7851c2 |
| 04-Jul-2024 |
Ethan D. Twardy <[email protected]> |
rust: macros: enable the rest of the tests
Now that the rusttest target for the macros crate is compiled with the kernel crate as a dependency, the rest of the rustdoc tests can be enabled.
Signed-
rust: macros: enable the rest of the tests
Now that the rusttest target for the macros crate is compiled with the kernel crate as a dependency, the rest of the rustdoc tests can be enabled.
Signed-off-by: Ethan D. Twardy <[email protected]> Reviewed-by: Alice Ryhl <[email protected]> Link: https://github.com/Rust-for-Linux/linux/issues/1076 Link: https://lore.kernel.org/r/[email protected] [ Rebased (use `K{Box,Vec}` instead, enable `lint_reasons` feature). Remove unneeded `rust` as language in examples, as well as `#[macro_use]` `extern`s. - Miguel ] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|
| #
7e06561f |
| 04-Jul-2024 |
Ethan D. Twardy <[email protected]> |
rust: macros: enable paste! use from macro_rules!
According to the rustdoc for the proc_macro crate[1], tokens captured from a "macro variable" (e.g. from within macro_rules!) may be delimited by in
rust: macros: enable paste! use from macro_rules!
According to the rustdoc for the proc_macro crate[1], tokens captured from a "macro variable" (e.g. from within macro_rules!) may be delimited by invisible tokens and be contained within a proc_macro::Group.
Previously, this scenario was not handled by macros::paste, which caused a proc-macro panic when the corresponding tests are enabled. Enable the tests, and handle this case by making macros::paste::concat recursive.
Link: https://doc.rust-lang.org/stable/proc_macro/enum.Delimiter.html [1] Signed-off-by: Ethan D. Twardy <[email protected]> Reviewed-by: Alice Ryhl <[email protected]> Link: https://github.com/Rust-for-Linux/linux/issues/1076 Link: https://lore.kernel.org/r/[email protected] [ Rebased (one fix was already applied) and reworded. Remove unneeded `rust` as language in examples. - Miguel ] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|
| #
8d3f5079 |
| 04-Jul-2024 |
Ethan D. Twardy <[email protected]> |
rust: enable macros::module! tests
Previously, these tests were ignored due to a missing necessary dependency on the `kernel` crate. Enable the tests, and update them: for both, add the parameter to
rust: enable macros::module! tests
Previously, these tests were ignored due to a missing necessary dependency on the `kernel` crate. Enable the tests, and update them: for both, add the parameter to `init()`; for the first one, remove the use of a kernel parameter mechanism that was never merged.
Signed-off-by: Ethan D. Twardy <[email protected]> Reviewed-by: Alice Ryhl <[email protected]> Link: https://github.com/Rust-for-Linux/linux/issues/1076 Link: https://lore.kernel.org/r/[email protected] [ Rebased (moved the `export` to the `rustdoc_test` rule, enable the firmware example too). Removed `export` for `RUST_MODFILE`. Removed unneeded `rust` language in examples, as well as `#[macro_use]` `extern`s. Reworded accordingly. - Miguel ] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|
| #
b2c261fa |
| 04-Jul-2024 |
Ethan D. Twardy <[email protected]> |
rust: kbuild: expand rusttest target for macros
Previously, the rusttest target for the macros crate did not specify the dependencies necessary to run the rustdoc tests. These tests rely on the kern
rust: kbuild: expand rusttest target for macros
Previously, the rusttest target for the macros crate did not specify the dependencies necessary to run the rustdoc tests. These tests rely on the kernel crate, so add the dependencies.
Signed-off-by: Ethan D. Twardy <[email protected]> Link: https://github.com/Rust-for-Linux/linux/issues/1076 Link: https://lore.kernel.org/r/[email protected] [ Rebased (`alloc` is gone nowadays, sysroot handling is simpler) and simplified (reused `rustdoc_test` rule instead of adding a new one, no need for `rustdoc-compiler_builtins`, removed unneeded `macros` explicit path). Made `vtable` example fail (avoiding to increase the complexity in the `rusttest` target). Removed unstable `-Zproc-macro-backtrace` option. Reworded accordingly. - Miguel ] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|
| #
15541c92 |
| 19-Oct-2024 |
Paolo Bonzini <[email protected]> |
rust: macros: fix documentation of the paste! macro
One of the example in this section uses a curious mix of the constant and function declaration syntaxes; fix it.
Signed-off-by: Paolo Bonzini <pb
rust: macros: fix documentation of the paste! macro
One of the example in this section uses a curious mix of the constant and function declaration syntaxes; fix it.
Signed-off-by: Paolo Bonzini <[email protected]> Reviewed-by: Alice Ryhl <[email protected]> Fixes: 823d4737d4c2 ("rust: macros: add `paste!` proc macro") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|
| #
58eff8e8 |
| 04-Oct-2024 |
Danilo Krummrich <[email protected]> |
rust: treewide: switch to the kernel `Vec` type
Now that we got the kernel `Vec` in place, convert all existing `Vec` users to make use of it.
Reviewed-by: Alice Ryhl <[email protected]> Reviewe
rust: treewide: switch to the kernel `Vec` type
Now that we got the kernel `Vec` in place, convert all existing `Vec` users to make use of it.
Reviewed-by: Alice Ryhl <[email protected]> Reviewed-by: Benno Lossin <[email protected]> Reviewed-by: Gary Guo <[email protected]> Signed-off-by: Danilo Krummrich <[email protected]> Link: https://lore.kernel.org/r/[email protected] [ Converted `kasan_test_rust.rs` too, as discussed. - Miguel ] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|
| #
8373147c |
| 04-Oct-2024 |
Danilo Krummrich <[email protected]> |
rust: treewide: switch to our kernel `Box` type
Now that we got the kernel `Box` type in place, convert all existing `Box` users to make use of it.
Reviewed-by: Alice Ryhl <[email protected]> Re
rust: treewide: switch to our kernel `Box` type
Now that we got the kernel `Box` type in place, convert all existing `Box` users to make use of it.
Reviewed-by: Alice Ryhl <[email protected]> Reviewed-by: Benno Lossin <[email protected]> Reviewed-by: Gary Guo <[email protected]> Signed-off-by: Danilo Krummrich <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|
| #
aeb0e24a |
| 02-Sep-2024 |
Miguel Ojeda <[email protected]> |
kbuild: rust: replace proc macros dependency on `core.o` with the version text
With the `RUSTC_VERSION_TEXT` rebuild support in place, now proc macros can depend on that instead of `core.o`.
This m
kbuild: rust: replace proc macros dependency on `core.o` with the version text
With the `RUSTC_VERSION_TEXT` rebuild support in place, now proc macros can depend on that instead of `core.o`.
This means that both the `core` and `macros` crates can be built in parallel, and that touching `core.o` does not trigger a rebuild of the proc macros.
This could be accomplished using the same approach as for `core` (i.e. depending directly on `include/config/RUSTC_VERSION_TEXT`). However, that is considered an implementation detail [1], and thus it is best to avoid it. Instead, let fixdep find a string that we explicitly write down in the source code for this purpose (like it is done for `include/linux/compiler-version.h`), which we can easily do (unlike for `core`) since this is our own source code.
Suggested-by: Masahiro Yamada <[email protected]> Link: https://lore.kernel.org/rust-for-linux/CAK7LNAQBG0nDupXSgAAk-6nOqeqGVkr3H1RjYaqRJ1OxmLm6xA@mail.gmail.com/ [1] Reviewed-by: Nicolas Schier <[email protected]> Tested-by: Alice Ryhl <[email protected]> Acked-by: Masahiro Yamada <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|
| #
0ba521d6 |
| 25-Jul-2024 |
Miguel Ojeda <[email protected]> |
rust: macros: indent list item in `module!`'s docs
Like commit e516211f615f ("rust: macros: indent list item in `paste!`'s docs"), but for `module!`.
Reviewed-by: Trevor Gross <[email protected]> L
rust: macros: indent list item in `module!`'s docs
Like commit e516211f615f ("rust: macros: indent list item in `paste!`'s docs"), but for `module!`.
Reviewed-by: Trevor Gross <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|
| #
e516211f |
| 09-Jul-2024 |
Miguel Ojeda <[email protected]> |
rust: macros: indent list item in `paste!`'s docs
A new style lint, `doc_lazy_continuation` [1], has been introduced in the upcoming Rust 1.80 (currently in beta), which detects missing indentation
rust: macros: indent list item in `paste!`'s docs
A new style lint, `doc_lazy_continuation` [1], has been introduced in the upcoming Rust 1.80 (currently in beta), which detects missing indentation in code documentation.
We have one such case:
error: doc list item missing indentation --> rust/macros/lib.rs:315:5 | 315 | /// default the span of the `[< >]` group is used. | ^ | = help: if this is supposed to be its own paragraph, add a blank line = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation = note: `-D clippy::doc-lazy-continuation` implied by `-D clippy::style` = help: to override `-D clippy::style` add `#[allow(clippy::doc_lazy_continuation)]` help: indent this line | 315 | /// default the span of the `[< >]` group is used. | ++
While the rendering of the docs by `rustdoc` is not affected, we apply this kind of indentation elsewhere since it looks better.
Thus clean it up.
Link: https://rust-lang.github.io/rust-clippy/master/index.html#/doc_lazy_continuation [1] Reviewed-by: Björn Roy Baron <[email protected]> Reviewed-by: Finn Behrens <[email protected]> Tested-by: Benno Lossin <[email protected]> Tested-by: Andreas Hindborg <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|
|
Revision tags: v6.10-rc6, v6.10-rc5, v6.10-rc4, v6.10-rc3, v6.10-rc2, v6.10-rc1, v6.9, v6.9-rc7 |
|
| #
549d3c2f |
| 01-May-2024 |
FUJITA Tomonori <[email protected]> |
rust: add 'firmware' field support to module! macro
This adds 'firmware' field support to module! macro, corresponds to MODULE_FIRMWARE macro. You can specify the file names of binary firmware that
rust: add 'firmware' field support to module! macro
This adds 'firmware' field support to module! macro, corresponds to MODULE_FIRMWARE macro. You can specify the file names of binary firmware that the kernel module requires. The information is embedded in the modinfo section of the kernel module. For example, a tool to build an initramfs uses this information to put the firmware files into the initramfs image.
Signed-off-by: FUJITA Tomonori <[email protected]> Reviewed-by: Benno Lossin <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|
| #
63249a07 |
| 12-May-2024 |
Aswin Unnikrishnan <[email protected]> |
rust: fix datatype in docs for `module` macro arguments
Remove the mention of byte array as datatype for `module` macro arguments since the arguments are defined as string, and `alias` is a string a
rust: fix datatype in docs for `module` macro arguments
Remove the mention of byte array as datatype for `module` macro arguments since the arguments are defined as string, and `alias` is a string array.
Signed-off-by: Aswin Unnikrishnan <[email protected]> Reviewed-by: Vincenzo Palazzo <[email protected]> Reviewed-by: Benno Lossin <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|
| #
67f9c312 |
| 12-May-2024 |
Aswin Unnikrishnan <[email protected]> |
rust: add example for `alias` argument in `module` macro documentation
Add example for `alias` argument supported by `module` macro. `alias` accepts an array of alternate names for the module as str
rust: add example for `alias` argument in `module` macro documentation
Add example for `alias` argument supported by `module` macro. `alias` accepts an array of alternate names for the module as string.
Reviewed-by: Alice Ryhl <[email protected]> Signed-off-by: Aswin Unnikrishnan <[email protected]> Reviewed-by: Benno Lossin <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|
|
Revision tags: v6.9-rc6, v6.9-rc5 |
|
| #
19843452 |
| 19-Apr-2024 |
Aswin Unnikrishnan <[email protected]> |
rust: remove `params` from `module` macro example
Remove argument `params` from the `module` macro example, because the macro does not currently support module parameters since it was not sent with
rust: remove `params` from `module` macro example
Remove argument `params` from the `module` macro example, because the macro does not currently support module parameters since it was not sent with the initial merge.
Signed-off-by: Aswin Unnikrishnan <[email protected]> Reviewed-by: Alice Ryhl <[email protected]> Cc: [email protected] Fixes: 1fbde52bde73 ("rust: add `macros` crate") Link: https://lore.kernel.org/r/[email protected] [ Reworded slightly. ] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|
|
Revision tags: v6.9-rc4, v6.9-rc3, v6.9-rc2, v6.9-rc1, v6.8, v6.8-rc7, v6.8-rc6, v6.8-rc5, v6.8-rc4, v6.8-rc3, v6.8-rc2, v6.8-rc1, v6.7, v6.7-rc8, v6.7-rc7, v6.7-rc6 |
|
| #
bc2e7d5c |
| 15-Dec-2023 |
Miguel Ojeda <[email protected]> |
rust: support `srctree`-relative links
Some of our links use relative paths in order to point to files in the source tree, e.g.:
//! C header: [`include/linux/printk.h`](../../../../include/lin
rust: support `srctree`-relative links
Some of our links use relative paths in order to point to files in the source tree, e.g.:
//! C header: [`include/linux/printk.h`](../../../../include/linux/printk.h) /// [`struct mutex`]: ../../../../include/linux/mutex.h
These are problematic because they are hard to maintain and do not support `O=` builds.
Instead, provide support for `srctree`-relative links, e.g.:
//! C header: [`include/linux/printk.h`](srctree/include/linux/printk.h) /// [`struct mutex`]: srctree/include/linux/mutex.h
The links are fixed after `rustdoc` generation to be based on the absolute path to the source tree.
Essentially, this is the automatic version of Tomonori's fix [1], suggested by Gary [2].
Suggested-by: Gary Guo <[email protected]> Reported-by: FUJITA Tomonori <[email protected]> Closes: https://lore.kernel.org/r/[email protected] [1] Fixes: 48fadf440075 ("docs: Move rustdoc output, cross-reference it") Link: https://lore.kernel.org/rust-for-linux/20231026154525.6d14b495@eugeo/ [2] Reviewed-by: Martin Rodriguez Reboredo <[email protected]> Reviewed-by: Benno Lossin <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|
|
Revision tags: v6.7-rc5, v6.7-rc4, v6.7-rc3, v6.7-rc2, v6.7-rc1, v6.6 |
|
| #
88c2e116 |
| 26-Oct-2023 |
Benno Lossin <[email protected]> |
rust: macros: improve `#[vtable]` documentation
Traits marked with `#[vtable]` need to provide default implementations for optional functions. The C side represents these with `NULL` in the vtable,
rust: macros: improve `#[vtable]` documentation
Traits marked with `#[vtable]` need to provide default implementations for optional functions. The C side represents these with `NULL` in the vtable, so the default functions are never actually called. We do not want to replicate the default behavior from C in Rust, because that is not maintainable. Therefore we should use `build_error` in those default implementations. The error message for that is provided at `kernel::error::VTABLE_DEFAULT_ERROR`.
Signed-off-by: Benno Lossin <[email protected]> Reviewed-by: Martin Rodriguez Reboredo <[email protected]> Reviewed-by: Andreas Hindborg <[email protected]> Reviewed-by: Alice Ryhl <[email protected]> Reviewed-by: Finn Behrens <[email protected]> Link: https://lore.kernel.org/r/[email protected] [ Wrapped paragraph to 80 as requested and capitalized sentence. ] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|
| #
2dc318ea |
| 18-Nov-2023 |
Trevor Gross <[email protected]> |
rust: macros: update 'paste!' macro to accept string literals
Enable combining identifiers with literals in the 'paste!' macro. This allows combining user-specified strings with affixes to create na
rust: macros: update 'paste!' macro to accept string literals
Enable combining identifiers with literals in the 'paste!' macro. This allows combining user-specified strings with affixes to create namespaced identifiers.
This sample code:
macro_rules! m { ($name:lit) => { paste!(struct [<_some_ $name _struct_>] {}) } }
m!("foo_bar");
Would previously cause a compilation error. It will now generate:
struct _some_foo_bar_struct_ {}
Signed-off-by: Trevor Gross <[email protected]> Reviewed-by: Martin Rodriguez Reboredo <[email protected]> Reviewed-by: Vincenzo Palazzo <[email protected]> Reviewed-by: Alice Ryhl <[email protected]> Reviewed-by: Benno Lossin <[email protected]> Reviewed-by: Gary Guo <[email protected]> Link: https://lore.kernel.org/r/[email protected] [ Added `:` before example block. ] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|