* Re: [PATCH v2] rust: kunit: fix warning when !CONFIG_PRINTK
2026-02-24 10:37 ` [PATCH v2] rust: kunit: fix warning when !CONFIG_PRINTK Alexandre Courbot
@ 2026-02-24 11:44 ` Alice Ryhl
2026-02-24 11:51 ` Andreas Hindborg
` (2 subsequent siblings)
3 siblings, 0 replies; 12+ messages in thread
From: Alice Ryhl @ 2026-02-24 11:44 UTC (permalink / raw)
To: Alexandre Courbot
Cc: Brendan Higgins, David Gow, Rae Moar, Miguel Ojeda, Boqun Feng,
Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg,
Trevor Gross, Danilo Krummrich, Shuah Khan, linux-kselftest,
kunit-dev, rust-for-linux, linux-kernel
On Tue, Feb 24, 2026 at 07:37:56PM +0900, Alexandre Courbot wrote:
> If `CONFIG_PRINTK` is not set, then the following warnings are issued
> during build:
>
> warning: unused variable: `args`
> --> ../rust/kernel/kunit.rs:16:12
> |
> 16 | pub fn err(args: fmt::Arguments<'_>) {
> | ^^^^ help: if this is intentional, prefix it with an underscore: `_args`
> |
> = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default
>
> warning: unused variable: `args`
> --> ../rust/kernel/kunit.rs:32:13
> |
> 32 | pub fn info(args: fmt::Arguments<'_>) {
> | ^^^^ help: if this is intentional, prefix it with an underscore: `_args`
>
> Fix this by adding a no-op assignment using `args` when `CONFIG_PRINTK`
> is not set.
>
> Fixes: a66d733da801 ("rust: support running Rust documentation tests as KUnit ones")
> Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH v2] rust: kunit: fix warning when !CONFIG_PRINTK
2026-02-24 10:37 ` [PATCH v2] rust: kunit: fix warning when !CONFIG_PRINTK Alexandre Courbot
2026-02-24 11:44 ` Alice Ryhl
@ 2026-02-24 11:51 ` Andreas Hindborg
2026-02-24 13:07 ` Alexandre Courbot
2026-02-24 13:56 ` David Gow
2026-03-04 2:34 ` Miguel Ojeda
3 siblings, 1 reply; 12+ messages in thread
From: Andreas Hindborg @ 2026-02-24 11:51 UTC (permalink / raw)
To: Alexandre Courbot, Brendan Higgins, David Gow, Rae Moar,
Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Alice Ryhl, Trevor Gross, Danilo Krummrich,
Shuah Khan
Cc: linux-kselftest, kunit-dev, rust-for-linux, linux-kernel,
Alexandre Courbot
"Alexandre Courbot" <acourbot@nvidia.com> writes:
> If `CONFIG_PRINTK` is not set, then the following warnings are issued
> during build:
>
> warning: unused variable: `args`
> --> ../rust/kernel/kunit.rs:16:12
> |
> 16 | pub fn err(args: fmt::Arguments<'_>) {
> | ^^^^ help: if this is intentional, prefix it with an underscore: `_args`
> |
> = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default
>
> warning: unused variable: `args`
> --> ../rust/kernel/kunit.rs:32:13
> |
> 32 | pub fn info(args: fmt::Arguments<'_>) {
> | ^^^^ help: if this is intentional, prefix it with an underscore: `_args`
>
> Fix this by adding a no-op assignment using `args` when `CONFIG_PRINTK`
> is not set.
>
> Fixes: a66d733da801 ("rust: support running Rust documentation tests as KUnit ones")
> Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
> ---
> Changes in v2:
> - Use a no-op assignment instead of the wider `#[allow(unused_variables)]`.
> - Link to v1: https://patch.msgid.link/20260224-unused_var_err-v1-1-c51d805eceb5@nvidia.com
> ---
> rust/kernel/kunit.rs | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/rust/kernel/kunit.rs b/rust/kernel/kunit.rs
> index f93f24a60bdd..a1edf7491579 100644
> --- a/rust/kernel/kunit.rs
> +++ b/rust/kernel/kunit.rs
> @@ -14,6 +14,10 @@
> /// Public but hidden since it should only be used from KUnit generated code.
> #[doc(hidden)]
> pub fn err(args: fmt::Arguments<'_>) {
> + // `args` is unused if `CONFIG_PRINTK` is not set - this avoids a build-time warning.
> + #[cfg(not(CONFIG_PRINTK))]
> + let _ = args;
I think (didn't test) that you can use a conditional attribute [1] instead:
pub fn err(
#[cfg_attr(not(CONFIG_PRINTK), expect(unused))]
args: fmt::Arguments<'_>
) {
Best regards,
Andreas Hindborg
[1] https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH v2] rust: kunit: fix warning when !CONFIG_PRINTK
2026-02-24 11:51 ` Andreas Hindborg
@ 2026-02-24 13:07 ` Alexandre Courbot
2026-02-24 13:15 ` Alice Ryhl
2026-02-24 13:56 ` David Gow
0 siblings, 2 replies; 12+ messages in thread
From: Alexandre Courbot @ 2026-02-24 13:07 UTC (permalink / raw)
To: Andreas Hindborg, Alice Ryhl
Cc: Brendan Higgins, David Gow, Rae Moar, Miguel Ojeda, Boqun Feng,
Gary Guo, Björn Roy Baron, Benno Lossin, Trevor Gross,
Danilo Krummrich, Shuah Khan, linux-kselftest, kunit-dev,
rust-for-linux, linux-kernel
On Tue Feb 24, 2026 at 8:51 PM JST, Andreas Hindborg wrote:
> "Alexandre Courbot" <acourbot@nvidia.com> writes:
>
>> If `CONFIG_PRINTK` is not set, then the following warnings are issued
>> during build:
>>
>> warning: unused variable: `args`
>> --> ../rust/kernel/kunit.rs:16:12
>> |
>> 16 | pub fn err(args: fmt::Arguments<'_>) {
>> | ^^^^ help: if this is intentional, prefix it with an underscore: `_args`
>> |
>> = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default
>>
>> warning: unused variable: `args`
>> --> ../rust/kernel/kunit.rs:32:13
>> |
>> 32 | pub fn info(args: fmt::Arguments<'_>) {
>> | ^^^^ help: if this is intentional, prefix it with an underscore: `_args`
>>
>> Fix this by adding a no-op assignment using `args` when `CONFIG_PRINTK`
>> is not set.
>>
>> Fixes: a66d733da801 ("rust: support running Rust documentation tests as KUnit ones")
>> Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
>> ---
>> Changes in v2:
>> - Use a no-op assignment instead of the wider `#[allow(unused_variables)]`.
>> - Link to v1: https://patch.msgid.link/20260224-unused_var_err-v1-1-c51d805eceb5@nvidia.com
>> ---
>> rust/kernel/kunit.rs | 8 ++++++++
>> 1 file changed, 8 insertions(+)
>>
>> diff --git a/rust/kernel/kunit.rs b/rust/kernel/kunit.rs
>> index f93f24a60bdd..a1edf7491579 100644
>> --- a/rust/kernel/kunit.rs
>> +++ b/rust/kernel/kunit.rs
>> @@ -14,6 +14,10 @@
>> /// Public but hidden since it should only be used from KUnit generated code.
>> #[doc(hidden)]
>> pub fn err(args: fmt::Arguments<'_>) {
>> + // `args` is unused if `CONFIG_PRINTK` is not set - this avoids a build-time warning.
>> + #[cfg(not(CONFIG_PRINTK))]
>> + let _ = args;
>
> I think (didn't test) that you can use a conditional attribute [1] instead:
>
> pub fn err(
> #[cfg_attr(not(CONFIG_PRINTK), expect(unused))]
> args: fmt::Arguments<'_>
> ) {
Yup, that works as well, and I think I like it better as it is more
localized. Alice, WDYT?
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH v2] rust: kunit: fix warning when !CONFIG_PRINTK
2026-02-24 13:07 ` Alexandre Courbot
@ 2026-02-24 13:15 ` Alice Ryhl
2026-02-24 13:56 ` David Gow
1 sibling, 0 replies; 12+ messages in thread
From: Alice Ryhl @ 2026-02-24 13:15 UTC (permalink / raw)
To: Alexandre Courbot
Cc: Andreas Hindborg, Brendan Higgins, David Gow, Rae Moar,
Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Trevor Gross, Danilo Krummrich, Shuah Khan,
linux-kselftest, kunit-dev, rust-for-linux, linux-kernel
On Tue, Feb 24, 2026 at 2:07 PM Alexandre Courbot <acourbot@nvidia.com> wrote:
>
> On Tue Feb 24, 2026 at 8:51 PM JST, Andreas Hindborg wrote:
> > "Alexandre Courbot" <acourbot@nvidia.com> writes:
> >
> >> If `CONFIG_PRINTK` is not set, then the following warnings are issued
> >> during build:
> >>
> >> warning: unused variable: `args`
> >> --> ../rust/kernel/kunit.rs:16:12
> >> |
> >> 16 | pub fn err(args: fmt::Arguments<'_>) {
> >> | ^^^^ help: if this is intentional, prefix it with an underscore: `_args`
> >> |
> >> = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default
> >>
> >> warning: unused variable: `args`
> >> --> ../rust/kernel/kunit.rs:32:13
> >> |
> >> 32 | pub fn info(args: fmt::Arguments<'_>) {
> >> | ^^^^ help: if this is intentional, prefix it with an underscore: `_args`
> >>
> >> Fix this by adding a no-op assignment using `args` when `CONFIG_PRINTK`
> >> is not set.
> >>
> >> Fixes: a66d733da801 ("rust: support running Rust documentation tests as KUnit ones")
> >> Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
> >> ---
> >> Changes in v2:
> >> - Use a no-op assignment instead of the wider `#[allow(unused_variables)]`.
> >> - Link to v1: https://patch.msgid.link/20260224-unused_var_err-v1-1-c51d805eceb5@nvidia.com
> >> ---
> >> rust/kernel/kunit.rs | 8 ++++++++
> >> 1 file changed, 8 insertions(+)
> >>
> >> diff --git a/rust/kernel/kunit.rs b/rust/kernel/kunit.rs
> >> index f93f24a60bdd..a1edf7491579 100644
> >> --- a/rust/kernel/kunit.rs
> >> +++ b/rust/kernel/kunit.rs
> >> @@ -14,6 +14,10 @@
> >> /// Public but hidden since it should only be used from KUnit generated code.
> >> #[doc(hidden)]
> >> pub fn err(args: fmt::Arguments<'_>) {
> >> + // `args` is unused if `CONFIG_PRINTK` is not set - this avoids a build-time warning.
> >> + #[cfg(not(CONFIG_PRINTK))]
> >> + let _ = args;
> >
> > I think (didn't test) that you can use a conditional attribute [1] instead:
> >
> > pub fn err(
> > #[cfg_attr(not(CONFIG_PRINTK), expect(unused))]
> > args: fmt::Arguments<'_>
> > ) {
>
> Yup, that works as well, and I think I like it better as it is more
> localized. Alice, WDYT?
I think the other options is also quite localised. It's per function
argument too. shrug
Alice
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH v2] rust: kunit: fix warning when !CONFIG_PRINTK
2026-02-24 13:07 ` Alexandre Courbot
2026-02-24 13:15 ` Alice Ryhl
@ 2026-02-24 13:56 ` David Gow
2026-02-24 14:23 ` Alexandre Courbot
1 sibling, 1 reply; 12+ messages in thread
From: David Gow @ 2026-02-24 13:56 UTC (permalink / raw)
To: Alexandre Courbot, Andreas Hindborg, Alice Ryhl
Cc: Brendan Higgins, David Gow, Rae Moar, Miguel Ojeda, Boqun Feng,
Gary Guo, Björn Roy Baron, Benno Lossin, Trevor Gross,
Danilo Krummrich, Shuah Khan, linux-kselftest, kunit-dev,
rust-for-linux, linux-kernel
Le 24/02/2026 à 9:07 PM, 'Alexandre Courbot' via KUnit Development a écrit :
> On Tue Feb 24, 2026 at 8:51 PM JST, Andreas Hindborg wrote:
>> "Alexandre Courbot" <acourbot@nvidia.com> writes:
>>
>>> If `CONFIG_PRINTK` is not set, then the following warnings are issued
>>> during build:
>>>
>>> warning: unused variable: `args`
>>> --> ../rust/kernel/kunit.rs:16:12
>>> |
>>> 16 | pub fn err(args: fmt::Arguments<'_>) {
>>> | ^^^^ help: if this is intentional, prefix it with an underscore: `_args`
>>> |
>>> = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default
>>>
>>> warning: unused variable: `args`
>>> --> ../rust/kernel/kunit.rs:32:13
>>> |
>>> 32 | pub fn info(args: fmt::Arguments<'_>) {
>>> | ^^^^ help: if this is intentional, prefix it with an underscore: `_args`
>>>
>>> Fix this by adding a no-op assignment using `args` when `CONFIG_PRINTK`
>>> is not set.
>>>
>>> Fixes: a66d733da801 ("rust: support running Rust documentation tests as KUnit ones")
>>> Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
>>> ---
>>> Changes in v2:
>>> - Use a no-op assignment instead of the wider `#[allow(unused_variables)]`.
>>> - Link to v1: https://patch.msgid.link/20260224-unused_var_err-v1-1-c51d805eceb5@nvidia.com
>>> ---
>>> rust/kernel/kunit.rs | 8 ++++++++
>>> 1 file changed, 8 insertions(+)
>>>
>>> diff --git a/rust/kernel/kunit.rs b/rust/kernel/kunit.rs
>>> index f93f24a60bdd..a1edf7491579 100644
>>> --- a/rust/kernel/kunit.rs
>>> +++ b/rust/kernel/kunit.rs
>>> @@ -14,6 +14,10 @@
>>> /// Public but hidden since it should only be used from KUnit generated code.
>>> #[doc(hidden)]
>>> pub fn err(args: fmt::Arguments<'_>) {
>>> + // `args` is unused if `CONFIG_PRINTK` is not set - this avoids a build-time warning.
>>> + #[cfg(not(CONFIG_PRINTK))]
>>> + let _ = args;
>>
>> I think (didn't test) that you can use a conditional attribute [1] instead:
>>
>> pub fn err(
>> #[cfg_attr(not(CONFIG_PRINTK), expect(unused))]
>> args: fmt::Arguments<'_>
>> ) {
>
> Yup, that works as well, and I think I like it better as it is more
> localized. Alice, WDYT?
>
Personally, I have a slight preference for the current `let _ = args`
option -- we'll still want to be able to format (at least some of) these
messages to the KUnit test log, even if printk is disabled. So in the
interest of avoiding churn in the function prototype, this version seems
more future-proof.
But I'm not enormously worried either way.
Cheers,
-- David
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH v2] rust: kunit: fix warning when !CONFIG_PRINTK
2026-02-24 13:56 ` David Gow
@ 2026-02-24 14:23 ` Alexandre Courbot
0 siblings, 0 replies; 12+ messages in thread
From: Alexandre Courbot @ 2026-02-24 14:23 UTC (permalink / raw)
To: David Gow
Cc: Andreas Hindborg, Alice Ryhl, Brendan Higgins, David Gow,
Rae Moar, Miguel Ojeda, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Trevor Gross,
Danilo Krummrich, Shuah Khan, linux-kselftest, kunit-dev,
rust-for-linux, linux-kernel
On Tue Feb 24, 2026 at 10:56 PM JST, David Gow wrote:
> Le 24/02/2026 à 9:07 PM, 'Alexandre Courbot' via KUnit Development a écrit :
>> On Tue Feb 24, 2026 at 8:51 PM JST, Andreas Hindborg wrote:
>>> "Alexandre Courbot" <acourbot@nvidia.com> writes:
>>>
>>>> If `CONFIG_PRINTK` is not set, then the following warnings are issued
>>>> during build:
>>>>
>>>> warning: unused variable: `args`
>>>> --> ../rust/kernel/kunit.rs:16:12
>>>> |
>>>> 16 | pub fn err(args: fmt::Arguments<'_>) {
>>>> | ^^^^ help: if this is intentional, prefix it with an underscore: `_args`
>>>> |
>>>> = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default
>>>>
>>>> warning: unused variable: `args`
>>>> --> ../rust/kernel/kunit.rs:32:13
>>>> |
>>>> 32 | pub fn info(args: fmt::Arguments<'_>) {
>>>> | ^^^^ help: if this is intentional, prefix it with an underscore: `_args`
>>>>
>>>> Fix this by adding a no-op assignment using `args` when `CONFIG_PRINTK`
>>>> is not set.
>>>>
>>>> Fixes: a66d733da801 ("rust: support running Rust documentation tests as KUnit ones")
>>>> Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
>>>> ---
>>>> Changes in v2:
>>>> - Use a no-op assignment instead of the wider `#[allow(unused_variables)]`.
>>>> - Link to v1: https://patch.msgid.link/20260224-unused_var_err-v1-1-c51d805eceb5@nvidia.com
>>>> ---
>>>> rust/kernel/kunit.rs | 8 ++++++++
>>>> 1 file changed, 8 insertions(+)
>>>>
>>>> diff --git a/rust/kernel/kunit.rs b/rust/kernel/kunit.rs
>>>> index f93f24a60bdd..a1edf7491579 100644
>>>> --- a/rust/kernel/kunit.rs
>>>> +++ b/rust/kernel/kunit.rs
>>>> @@ -14,6 +14,10 @@
>>>> /// Public but hidden since it should only be used from KUnit generated code.
>>>> #[doc(hidden)]
>>>> pub fn err(args: fmt::Arguments<'_>) {
>>>> + // `args` is unused if `CONFIG_PRINTK` is not set - this avoids a build-time warning.
>>>> + #[cfg(not(CONFIG_PRINTK))]
>>>> + let _ = args;
>>>
>>> I think (didn't test) that you can use a conditional attribute [1] instead:
>>>
>>> pub fn err(
>>> #[cfg_attr(not(CONFIG_PRINTK), expect(unused))]
>>> args: fmt::Arguments<'_>
>>> ) {
>>
>> Yup, that works as well, and I think I like it better as it is more
>> localized. Alice, WDYT?
>>
>
> Personally, I have a slight preference for the current `let _ = args`
> option -- we'll still want to be able to format (at least some of) these
> messages to the KUnit test log, even if printk is disabled. So in the
> interest of avoiding churn in the function prototype, this version seems
> more future-proof.
Sounds good - let's keep the current version then.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2] rust: kunit: fix warning when !CONFIG_PRINTK
2026-02-24 10:37 ` [PATCH v2] rust: kunit: fix warning when !CONFIG_PRINTK Alexandre Courbot
2026-02-24 11:44 ` Alice Ryhl
2026-02-24 11:51 ` Andreas Hindborg
@ 2026-02-24 13:56 ` David Gow
2026-03-04 2:34 ` Miguel Ojeda
3 siblings, 0 replies; 12+ messages in thread
From: David Gow @ 2026-02-24 13:56 UTC (permalink / raw)
To: Alexandre Courbot, Brendan Higgins, David Gow, Rae Moar,
Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Danilo Krummrich, Shuah Khan
Cc: linux-kselftest, kunit-dev, rust-for-linux, linux-kernel
Le 24/02/2026 à 6:37 PM, 'Alexandre Courbot' via KUnit Development a écrit :
> If `CONFIG_PRINTK` is not set, then the following warnings are issued
> during build:
>
> warning: unused variable: `args`
> --> ../rust/kernel/kunit.rs:16:12
> |
> 16 | pub fn err(args: fmt::Arguments<'_>) {
> | ^^^^ help: if this is intentional, prefix it with an underscore: `_args`
> |
> = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default
>
> warning: unused variable: `args`
> --> ../rust/kernel/kunit.rs:32:13
> |
> 32 | pub fn info(args: fmt::Arguments<'_>) {
> | ^^^^ help: if this is intentional, prefix it with an underscore: `_args`
>
> Fix this by adding a no-op assignment using `args` when `CONFIG_PRINTK`
> is not set.
>
> Fixes: a66d733da801 ("rust: support running Rust documentation tests as KUnit ones")
> Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
> ---
> Changes in v2:
> - Use a no-op assignment instead of the wider `#[allow(unused_variables)]`.
> - Link to v1: https://patch.msgid.link/20260224-unused_var_err-v1-1-c51d805eceb5@nvidia.com
> ---
Reviewed-by: David Gow <david@davidgow.net>
Cheers,
-- David
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH v2] rust: kunit: fix warning when !CONFIG_PRINTK
2026-02-24 10:37 ` [PATCH v2] rust: kunit: fix warning when !CONFIG_PRINTK Alexandre Courbot
` (2 preceding siblings ...)
2026-02-24 13:56 ` David Gow
@ 2026-03-04 2:34 ` Miguel Ojeda
2026-03-04 9:16 ` David Gow
3 siblings, 1 reply; 12+ messages in thread
From: Miguel Ojeda @ 2026-03-04 2:34 UTC (permalink / raw)
To: Alexandre Courbot
Cc: Brendan Higgins, David Gow, Rae Moar, Miguel Ojeda, Boqun Feng,
Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg,
Alice Ryhl, Trevor Gross, Danilo Krummrich, Shuah Khan,
linux-kselftest, kunit-dev, rust-for-linux, linux-kernel
On Tue, Feb 24, 2026 at 11:38 AM Alexandre Courbot <acourbot@nvidia.com> wrote:
>
> If `CONFIG_PRINTK` is not set, then the following warnings are issued
> during build:
>
> warning: unused variable: `args`
> --> ../rust/kernel/kunit.rs:16:12
> |
> 16 | pub fn err(args: fmt::Arguments<'_>) {
> | ^^^^ help: if this is intentional, prefix it with an underscore: `_args`
> |
> = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default
>
> warning: unused variable: `args`
> --> ../rust/kernel/kunit.rs:32:13
> |
> 32 | pub fn info(args: fmt::Arguments<'_>) {
> | ^^^^ help: if this is intentional, prefix it with an underscore: `_args`
>
> Fix this by adding a no-op assignment using `args` when `CONFIG_PRINTK`
> is not set.
>
> Fixes: a66d733da801 ("rust: support running Rust documentation tests as KUnit ones")
> Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Applied to `rust-fixes` -- thanks everyone!
Also Cc: stable@vger.kernel.org
Cheers,
Miguel
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH v2] rust: kunit: fix warning when !CONFIG_PRINTK
2026-03-04 2:34 ` Miguel Ojeda
@ 2026-03-04 9:16 ` David Gow
2026-03-04 12:07 ` Miguel Ojeda
0 siblings, 1 reply; 12+ messages in thread
From: David Gow @ 2026-03-04 9:16 UTC (permalink / raw)
To: Miguel Ojeda, Alexandre Courbot
Cc: Brendan Higgins, David Gow, Rae Moar, Miguel Ojeda, Boqun Feng,
Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg,
Alice Ryhl, Trevor Gross, Danilo Krummrich, Shuah Khan,
linux-kselftest, kunit-dev, rust-for-linux, linux-kernel
Le 04/03/2026 à 10:34 AM, Miguel Ojeda a écrit :
> On Tue, Feb 24, 2026 at 11:38 AM Alexandre Courbot <acourbot@nvidia.com> wrote:
>>
>> If `CONFIG_PRINTK` is not set, then the following warnings are issued
>> during build:
>>
>> warning: unused variable: `args`
>> --> ../rust/kernel/kunit.rs:16:12
>> |
>> 16 | pub fn err(args: fmt::Arguments<'_>) {
>> | ^^^^ help: if this is intentional, prefix it with an underscore: `_args`
>> |
>> = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default
>>
>> warning: unused variable: `args`
>> --> ../rust/kernel/kunit.rs:32:13
>> |
>> 32 | pub fn info(args: fmt::Arguments<'_>) {
>> | ^^^^ help: if this is intentional, prefix it with an underscore: `_args`
>>
>> Fix this by adding a no-op assignment using `args` when `CONFIG_PRINTK`
>> is not set.
>>
>> Fixes: a66d733da801 ("rust: support running Rust documentation tests as KUnit ones")
>> Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
>
> Applied to `rust-fixes` -- thanks everyone!
>
> Also Cc: stable@vger.kernel.org
This is also sitting in kselftest/kunit-fixes:
https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git/commit/?h=kunit-fixes&id=7dd34dfc8dfa92a7244242098110388367996ac3
I don't particularly mind if you'd rather it go through the Rust tree,
though. Let me know if you want this removed.
Cheers,
-- David
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH v2] rust: kunit: fix warning when !CONFIG_PRINTK
2026-03-04 9:16 ` David Gow
@ 2026-03-04 12:07 ` Miguel Ojeda
2026-03-05 23:55 ` Miguel Ojeda
0 siblings, 1 reply; 12+ messages in thread
From: Miguel Ojeda @ 2026-03-04 12:07 UTC (permalink / raw)
To: David Gow
Cc: Alexandre Courbot, Brendan Higgins, David Gow, Rae Moar,
Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Danilo Krummrich, Shuah Khan, linux-kselftest, kunit-dev,
rust-for-linux, linux-kernel
On Wed, Mar 4, 2026 at 10:16 AM David Gow <david@davidgow.net> wrote:
>
> This is also sitting in kselftest/kunit-fixes:
> https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git/commit/?h=kunit-fixes&id=7dd34dfc8dfa92a7244242098110388367996ac3
>
> I don't particularly mind if you'd rather it go through the Rust tree,
> though. Let me know if you want this removed.
Ah, good, thanks!
I saw your Reviewed-by and no notification of being queued so I
thought you expected me to pick it up.
Happy to remove it, but it would be nice to get the Cc: stable@ there
to avoid having to send it later.
Cheers,
Miguel
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2] rust: kunit: fix warning when !CONFIG_PRINTK
2026-03-04 12:07 ` Miguel Ojeda
@ 2026-03-05 23:55 ` Miguel Ojeda
0 siblings, 0 replies; 12+ messages in thread
From: Miguel Ojeda @ 2026-03-05 23:55 UTC (permalink / raw)
To: David Gow, Shuah Khan, Shuah Khan
Cc: Alexandre Courbot, Brendan Higgins, David Gow, Rae Moar,
Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Danilo Krummrich, linux-kselftest, kunit-dev, rust-for-linux,
linux-kernel
On Wed, Mar 4, 2026 at 1:07 PM Miguel Ojeda
<miguel.ojeda.sandonis@gmail.com> wrote:
>
> Ah, good, thanks!
>
> I saw your Reviewed-by and no notification of being queued so I
> thought you expected me to pick it up.
>
> Happy to remove it, but it would be nice to get the Cc: stable@ there
> to avoid having to send it later.
Ok, I will remove it since I am not hearing anything, but I will send
a message to stable now to avoid forgetting about it later.
Cc'ing Shuah, by the way.
Thanks!
Cheers,
Miguel
^ permalink raw reply [flat|nested] 12+ messages in thread