<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="/source/rss.xsl.xml"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
    <title>Changes in kunit.rs</title>
    <description></description>
    <language>en</language>
    <copyright>Copyright 2015</copyright>
    <generator>Java</generator><item>
        <title>42ec980024f03bad6fd97d65c22f6cf32fb08c58 - rust: macros: simplify code using `feature(extract_if)`</title>
        <link>http://kernelsources.org:8080/source/history/linux/rust/macros/kunit.rs#42ec980024f03bad6fd97d65c22f6cf32fb08c58</link>
        <description>rust: macros: simplify code using `feature(extract_if)``feature(extract_if)` [1] was stabilized in Rust 1.87.0 [2], and the lastsignificant change happened in Rust 1.85.0 [3] when the range parameterwas added.That is, with our new minimum version, we can start using the feature.Thus simplify the code using the feature and remove the TODO comment.Suggested-by: Gary Guo &lt;gary@garyguo.net&gt;Link: https://lore.kernel.org/rust-for-linux/DHHVSX66206Y.3E7I9QUNTCJ8I@garyguo.net/Link: https://github.com/rust-lang/rust/issues/43244 [1]Link: https://github.com/rust-lang/rust/pull/137109 [2]Link: https://github.com/rust-lang/rust/pull/133265 [3]Link: https://patch.msgid.link/20260405235309.418950-16-ojeda@kernel.orgReviewed-by: Tamir Duberstein &lt;tamird@kernel.org&gt;Signed-off-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;

            List of files:
            /linux/rust/macros/kunit.rs</description>
        <pubDate>Mon, 06 Apr 2026 01:52:51 +0200</pubDate>
        <dc:creator>Miguel Ojeda &lt;ojeda@kernel.org&gt;</dc:creator>
    </item>
<item>
        <title>be97f3c82021239476ce32cddde32948c597753e - rust: kunit: use `pin_init::zeroed` instead of custom null value</title>
        <link>http://kernelsources.org:8080/source/history/linux/rust/macros/kunit.rs#be97f3c82021239476ce32cddde32948c597753e</link>
        <description>rust: kunit: use `pin_init::zeroed` instead of custom null valueThe last null element can be created (constly) using `pin_init::zeroed`,so prefer to use it instead of adding a custom way of building it.Reviewed-by: Tamir Duberstein &lt;tamird@gmail.com&gt;Reviewed-by: Benno Lossin &lt;lossin@kernel.org&gt;Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;Reviewed-by: David Gow &lt;davidgow@google.com&gt;Link: https://patch.msgid.link/20260112170919.1888584-12-gary@kernel.orgSigned-off-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;

            List of files:
            /linux/rust/macros/kunit.rs</description>
        <pubDate>Mon, 12 Jan 2026 18:07:22 +0100</pubDate>
        <dc:creator>Gary Guo &lt;gary@garyguo.net&gt;</dc:creator>
    </item>
<item>
        <title>c3b416e19eb38a6b8d9a30bc7df1361ac3244464 - rust: macros: convert `#[kunit_tests]` macro to use `syn`</title>
        <link>http://kernelsources.org:8080/source/history/linux/rust/macros/kunit.rs#c3b416e19eb38a6b8d9a30bc7df1361ac3244464</link>
        <description>rust: macros: convert `#[kunit_tests]` macro to use `syn`Make use of `syn` to parse the module structurally and thus improve therobustness of parsing.String interpolation is avoided by generating tokens directly using`quote!`.Reviewed-by: Tamir Duberstein &lt;tamird@gmail.com&gt;Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;Reviewed-by: Benno Lossin &lt;lossin@kernel.org&gt;Reviewed-by: David Gow &lt;davidgow@google.com&gt;Link: https://patch.msgid.link/20260112170919.1888584-9-gary@kernel.org[ Pass C string to match commit 6c37b6841a92 (&quot;rust: kunit: replace  `kernel::c_str!` with C-Strings&quot;). - Miguel ]Signed-off-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;

            List of files:
            /linux/rust/macros/kunit.rs</description>
        <pubDate>Mon, 12 Jan 2026 18:07:19 +0100</pubDate>
        <dc:creator>Gary Guo &lt;gary@garyguo.net&gt;</dc:creator>
    </item>
<item>
        <title>f637bafe1ff15fa356c1e0576c32f077b9e6e46a - rust: macros: use `quote!` from vendored crate</title>
        <link>http://kernelsources.org:8080/source/history/linux/rust/macros/kunit.rs#f637bafe1ff15fa356c1e0576c32f077b9e6e46a</link>
        <description>rust: macros: use `quote!` from vendored crateWith `quote` crate now vendored in the kernel, we can remove our custom`quote!` macro implementation and just rely on that crate instead.The `quote` crate uses types from the `proc-macro2` library so we alsoupdate to use that, and perform conversion in the top-level lib.rs.Clippy complains about unnecessary `.to_string()` as `proc-macro2`provides additional `PartialEq` impl, so they are removed.Reviewed-by: Tamir Duberstein &lt;tamird@gmail.com&gt;Reviewed-by: Benno Lossin &lt;lossin@kernel.org&gt;Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;Acked-by: David Gow &lt;davidgow@google.com&gt; # for kunitLink: https://patch.msgid.link/20260112170919.1888584-3-gary@kernel.orgSigned-off-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;

            List of files:
            /linux/rust/macros/kunit.rs</description>
        <pubDate>Mon, 12 Jan 2026 18:07:13 +0100</pubDate>
        <dc:creator>Gary Guo &lt;gary@garyguo.net&gt;</dc:creator>
    </item>
<item>
        <title>6c37b6841a92714eba4a7b7f823aea801da4e09f - rust: kunit: replace `kernel::c_str!` with C-Strings</title>
        <link>http://kernelsources.org:8080/source/history/linux/rust/macros/kunit.rs#6c37b6841a92714eba4a7b7f823aea801da4e09f</link>
        <description>rust: kunit: replace `kernel::c_str!` with C-StringsC-String literals were added in Rust 1.77. Replace instances of`kernel::c_str!` with C-String literals where possible.Acked-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;Reviewed-by: Alice Ryhl &lt;aliceryhl@google.com&gt;Reviewed-by: Benno Lossin &lt;lossin@kernel.org&gt;Signed-off-by: Tamir Duberstein &lt;tamird@gmail.com&gt;Reviewed-by: David Gow &lt;davidgow@google.com&gt;Link: https://patch.msgid.link/20251222-cstr-kunit-v1-1-39d999672f35@gmail.comSigned-off-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;

            List of files:
            /linux/rust/macros/kunit.rs</description>
        <pubDate>Mon, 22 Dec 2025 13:28:27 +0100</pubDate>
        <dc:creator>Tamir Duberstein &lt;tamird@gmail.com&gt;</dc:creator>
    </item>
<item>
        <title>c652dc44192d96820d73a7ecd89d275ca7e4355d - rust: kunit: allow `cfg` on `test`s</title>
        <link>http://kernelsources.org:8080/source/history/linux/rust/macros/kunit.rs#c652dc44192d96820d73a7ecd89d275ca7e4355d</link>
        <description>rust: kunit: allow `cfg` on `test`sThe `kunit_test` proc macro only checks for the `test` attributeimmediately preceding a `fn`. If the function is disabled via a `cfg`,the generated code would result in a compile error referencing anon-existent function [1].This collects attributes and specifically cherry-picks `cfg` attributesto be duplicated inside KUnit wrapper functions such that a test functiondisabled via `cfg` compiles and is marked as skipped in KUnit correctly.Link: https://lore.kernel.org/r/20250916021259.115578-1-ent3rm4n@gmail.comLink: https://lore.kernel.org/rust-for-linux/CANiq72==48=69hYiDo1321pCzgn_n1_jg=ez5UYXX91c+g5JVQ@mail.gmail.com/ [1]Closes: https://github.com/Rust-for-Linux/linux/issues/1185Suggested-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;Suggested-by: David Gow &lt;davidgow@google.com&gt;Signed-off-by: Kaibo Ma &lt;ent3rm4n@gmail.com&gt;Reviewed-by: David Gow &lt;davidgow@google.com&gt;Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;

            List of files:
            /linux/rust/macros/kunit.rs</description>
        <pubDate>Tue, 16 Sep 2025 04:12:56 +0200</pubDate>
        <dc:creator>Kaibo Ma &lt;ent3rm4n@gmail.com&gt;</dc:creator>
    </item>
<item>
        <title>950b306c296ec1e90d2d76f1974d2de2375a3d82 - rust: kunit: support checked `-&gt; Result`s in KUnit `#[test]`s</title>
        <link>http://kernelsources.org:8080/source/history/linux/rust/macros/kunit.rs#950b306c296ec1e90d2d76f1974d2de2375a3d82</link>
        <description>rust: kunit: support checked `-&gt; Result`s in KUnit `#[test]`sCurrently, return values of KUnit `#[test]` functions are ignored.Thus introduce support for `-&gt; Result` functions by checking theirreturned values.At the same time, require that test functions return `()` or `Result&lt;T,E&gt;`, which should avoid mistakes, especially with non-`#[must_use]`types. Other types can be supported in the future if needed.With this, a failing test like:    #[test]    fn my_test() -&gt; Result {        f()?;        Ok(())    }will output:    [    3.744214]     KTAP version 1    [    3.744287]     # Subtest: my_test_suite    [    3.744378]     # speed: normal    [    3.744399]     1..1    [    3.745817]     # my_test: ASSERTION FAILED at rust/kernel/lib.rs:321    [    3.745817]     Expected is_test_result_ok(my_test()) to be true, but is false    [    3.747152]     # my_test.speed: normal    [    3.747199]     not ok 1 my_test    [    3.747345] not ok 4 my_test_suiteReviewed-by: David Gow &lt;davidgow@google.com&gt;Acked-by: Danilo Krummrich &lt;dakr@kernel.org&gt;Link: https://lore.kernel.org/r/20250502215133.1923676-3-ojeda@kernel.org[ Used `::kernel` for paths. - Miguel ]Signed-off-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;

            List of files:
            /linux/rust/macros/kunit.rs</description>
        <pubDate>Fri, 02 May 2025 23:51:27 +0200</pubDate>
        <dc:creator>Miguel Ojeda &lt;ojeda@kernel.org&gt;</dc:creator>
    </item>
<item>
        <title>36174d16f3ec072f9e07b6c6d59ba91b2d52f9e2 - rust: kunit: support KUnit-mapped `assert!` macros in `#[test]`s</title>
        <link>http://kernelsources.org:8080/source/history/linux/rust/macros/kunit.rs#36174d16f3ec072f9e07b6c6d59ba91b2d52f9e2</link>
        <description>rust: kunit: support KUnit-mapped `assert!` macros in `#[test]`sThe KUnit `#[test]` support that landed recently is very basic and doesnot map the `assert*!` macros into KUnit like the doctests do, so theypanic at the moment.Thus implement the custom mapping in a similar way to doctests, reusingthe infrastructure there.In Rust 1.88.0, the `file()` method in `Span` may be stable [1]. However,it was changed recently (from `SourceFile`), so we need to do somethingdifferent in previous versions. Thus create a helper for it and use itto get the path.With this, a failing test suite like:    #[kunit_tests(my_test_suite)]    mod tests {        use super::*;        #[test]        fn my_first_test() {            assert_eq!(42, 43);        }        #[test]        fn my_second_test() {            assert!(42 &gt;= 43);        }    }will properly map back to KUnit, printing something like:    [    1.924325]     KTAP version 1    [    1.924421]     # Subtest: my_test_suite    [    1.924506]     # speed: normal    [    1.924525]     1..2    [    1.926385]     # my_first_test: ASSERTION FAILED at rust/kernel/lib.rs:251    [    1.926385]     Expected 42 == 43 to be true, but is false    [    1.928026]     # my_first_test.speed: normal    [    1.928075]     not ok 1 my_first_test    [    1.928723]     # my_second_test: ASSERTION FAILED at rust/kernel/lib.rs:256    [    1.928723]     Expected 42 &gt;= 43 to be true, but is false    [    1.929834]     # my_second_test.speed: normal    [    1.929868]     not ok 2 my_second_test    [    1.930032] # my_test_suite: pass:0 fail:2 skip:0 total:2    [    1.930153] # Totals: pass:0 fail:2 skip:0 totalLink: https://github.com/rust-lang/rust/pull/140514 [1]Reviewed-by: David Gow &lt;davidgow@google.com&gt;Acked-by: Danilo Krummrich &lt;dakr@kernel.org&gt;Link: https://lore.kernel.org/r/20250502215133.1923676-2-ojeda@kernel.org[ Required `KUNIT=y` like for doctests. Used the `cfg_attr` from the  TODO comment and clarified its comment now that the stabilization is  in beta and thus quite likely stable in Rust 1.88.0. Simplified the  `new_body` code by introducing a new variable. Added  `#[allow(clippy::incompatible_msrv)]`. - Miguel ]Signed-off-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;

            List of files:
            /linux/rust/macros/kunit.rs</description>
        <pubDate>Fri, 02 May 2025 23:51:26 +0200</pubDate>
        <dc:creator>Miguel Ojeda &lt;ojeda@kernel.org&gt;</dc:creator>
    </item>
<item>
        <title>de7cd3e4d6387df6a5ae8c4c32ff0479ebe0efb5 - rust: use absolute paths in macros referencing core and kernel</title>
        <link>http://kernelsources.org:8080/source/history/linux/rust/macros/kunit.rs#de7cd3e4d6387df6a5ae8c4c32ff0479ebe0efb5</link>
        <description>rust: use absolute paths in macros referencing core and kernelMacros and auto-generated code should use absolute paths, `::core::...`and `::kernel::...`, for core and kernel references.This prevents issues where user-defined modules named `core` or `kernel`could be picked up instead of the `core` or `kernel` crates.Thus clean some references up.Suggested-by: Benno Lossin &lt;benno.lossin@proton.me&gt;Closes: https://github.com/Rust-for-Linux/linux/issues/1150Signed-off-by: Igor Korotin &lt;igor.korotin.linux@gmail.com&gt;Reviewed-by: Benno Lossin &lt;lossin@kernel.org&gt;Acked-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;Link: https://lore.kernel.org/r/20250519164615.3310844-1-igor.korotin.linux@gmail.com[ Applied `rustfmt`. Reworded slightly. - Miguel ]Signed-off-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;

            List of files:
            /linux/rust/macros/kunit.rs</description>
        <pubDate>Mon, 19 May 2025 18:45:53 +0200</pubDate>
        <dc:creator>Igor Korotin &lt;igor.korotin.linux@gmail.com&gt;</dc:creator>
    </item>
<item>
        <title>211dcf77856db64c73e0c3b9ce0c624ec855daca - rust: clean Rust 1.88.0&apos;s `clippy::uninlined_format_args` lint</title>
        <link>http://kernelsources.org:8080/source/history/linux/rust/macros/kunit.rs#211dcf77856db64c73e0c3b9ce0c624ec855daca</link>
        <description>rust: clean Rust 1.88.0&apos;s `clippy::uninlined_format_args` lintStarting with Rust 1.88.0 (expected 2025-06-26) [1], `rustc` may moveback the `uninlined_format_args` to `style` from `pedantic` (it wasthere waiting for rust-analyzer suppotr), and thus we will start to seelints like:    warning: variables can be used directly in the `format!` string       --&gt; rust/macros/kunit.rs:105:37        |    105 |         let kunit_wrapper_fn_name = format!(&quot;kunit_rust_wrapper_{}&quot;, test);        |                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^        |        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args    help: change this to        |    105 -         let kunit_wrapper_fn_name = format!(&quot;kunit_rust_wrapper_{}&quot;, test);    105 +         let kunit_wrapper_fn_name = format!(&quot;kunit_rust_wrapper_{test}&quot;);There is even a case that is a pure removal:    warning: variables can be used directly in the `format!` string      --&gt; rust/macros/module.rs:51:13       |    51 |             format!(&quot;{field}={content}\0&quot;, field = field, content = content)       |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^       |       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args    help: change this to       |    51 -             format!(&quot;{field}={content}\0&quot;, field = field, content = content)    51 +             format!(&quot;{field}={content}\0&quot;)The lints all seem like nice cleanups, thus just apply them.We may want to disable `allow-mixed-uninlined-format-args` in the future.Cc: stable@vger.kernel.org # Needed in 6.12.y and later (Rust is pinned in older LTSs).Link: https://github.com/rust-lang/rust-clippy/pull/14160 [1]Acked-by: Benno Lossin &lt;lossin@kernel.org&gt;Reviewed-by: Tamir Duberstein &lt;tamird@gmail.com&gt;Reviewed-by: Alice Ryhl &lt;aliceryhl@google.com&gt;Link: https://lore.kernel.org/r/20250502140237.1659624-6-ojeda@kernel.orgSigned-off-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;

            List of files:
            /linux/rust/macros/kunit.rs</description>
        <pubDate>Fri, 02 May 2025 16:02:37 +0200</pubDate>
        <dc:creator>Miguel Ojeda &lt;ojeda@kernel.org&gt;</dc:creator>
    </item>
<item>
        <title>c0010452893e07e032427e88f6b7b4bf7ac42e95 - rust: macros: add macro to easily run KUnit tests</title>
        <link>http://kernelsources.org:8080/source/history/linux/rust/macros/kunit.rs#c0010452893e07e032427e88f6b7b4bf7ac42e95</link>
        <description>rust: macros: add macro to easily run KUnit testsAdd a new procedural macro (`#[kunit_tests(kunit_test_suit_name)]`) torun 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!` registeringall 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 notcompiled when `CONFIG_KUNIT` is set to `n`.Reviewed-by: David Gow &lt;davidgow@google.com&gt;Signed-off-by: Jos&#233; Exp&#243;sito &lt;jose.exposito89@gmail.com&gt;Co-developed-by: Boqun Feng &lt;boqun.feng@gmail.com&gt;Signed-off-by: Boqun Feng &lt;boqun.feng@gmail.com&gt;Co-developed-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;Signed-off-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;Reviewed-by: Tamir Duberstein &lt;tamird@gmail.com&gt;Signed-off-by: David Gow &lt;davidgow@google.com&gt;Link: https://lore.kernel.org/r/20250307090103.918788-3-davidgow@google.com[ Removed spurious (in rendered form) newline in docs. - Miguel ]Signed-off-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;

            List of files:
            /linux/rust/macros/kunit.rs</description>
        <pubDate>Fri, 07 Mar 2025 10:00:57 +0100</pubDate>
        <dc:creator>Jos&#233; Exp&#243;sito &lt;jose.exposito89@gmail.com&gt;</dc:creator>
    </item>
</channel>
</rss>
