]> git.ipfire.org Git - thirdparty/linux.git/commit
rust: macros: convert `#[kunit_tests]` macro to use `syn`
authorGary Guo <gary@garyguo.net>
Mon, 12 Jan 2026 17:07:19 +0000 (17:07 +0000)
committerMiguel Ojeda <ojeda@kernel.org>
Wed, 28 Jan 2026 12:43:36 +0000 (13:43 +0100)
commitc3b416e19eb38a6b8d9a30bc7df1361ac3244464
tree32ef033c8913504c74fb3c7dce5a55e2161a79dc
parenta863b21b1e665d8fed0022c0175ffbdc5d94c06c
rust: macros: convert `#[kunit_tests]` macro to use `syn`

Make use of `syn` to parse the module structurally and thus improve the
robustness of parsing.

String interpolation is avoided by generating tokens directly using
`quote!`.

Reviewed-by: Tamir Duberstein <tamird@gmail.com>
Signed-off-by: Gary Guo <gary@garyguo.net>
Reviewed-by: Benno Lossin <lossin@kernel.org>
Reviewed-by: David Gow <davidgow@google.com>
Link: https://patch.msgid.link/20260112170919.1888584-9-gary@kernel.org
[ Pass C string to match commit 6c37b6841a92 ("rust: kunit: replace
  `kernel::c_str!` with C-Strings"). - Miguel ]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
rust/macros/kunit.rs
rust/macros/lib.rs