public inbox for linux-next@vger.kernel.org
 help / color / mirror / Atom feed
From: "Alexandre Courbot" <acourbot@nvidia.com>
To: "Tamir Duberstein" <tamird@gmail.com>
Cc: "Danilo Krummrich" <dakr@kernel.org>,
	"Miguel Ojeda" <miguel.ojeda.sandonis@gmail.com>,
	"Stephen Rothwell" <sfr@canb.auug.org.au>,
	"Lyude Paul" <lyude@redhat.com>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"FUJITA Tomonori" <fujita.tomonori@gmail.com>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	"Linux Next Mailing List" <linux-next@vger.kernel.org>
Subject: Re: linux-next: build failure after merge of the rust tree
Date: Tue, 24 Jun 2025 21:24:07 +0900	[thread overview]
Message-ID: <DAURELPD1M69.1WQM3ZJI33MFZ@nvidia.com> (raw)
In-Reply-To: <CAJ-ks9m-pas1nYSr7GKvREsOKdGOoyW2ru3OKnnjerv9hsWdGw@mail.gmail.com>

On Tue Jun 24, 2025 at 9:16 PM JST, Tamir Duberstein wrote:
> On Tue, Jun 24, 2025 at 5:14 AM Alexandre Courbot <acourbot@nvidia.com> wrote:
>>
>> On Tue Jun 24, 2025 at 9:00 PM JST, Danilo Krummrich wrote:
>> > On Tue, Jun 24, 2025 at 12:31:52PM +0200, Miguel Ojeda wrote:
>> >> On Tue, Jun 24, 2025 at 9:31 AM Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>> >> >
>> >> > error[E0277]: the trait bound `u32: From<DmaTrfCmdSize>` is not satisfied
>> >>
>> >> > error[E0599]: no method named `as_nanos` found for struct `Delta` in the current scope
>> >>
>> >> > Presumably caused by commit
>> >> >
>> >> >   b7c8d7a8d251 ("rust: enable `clippy::cast_lossless` lint")
>> >>
>> >> The first error, yes -- the `register!` macro was changed to use
>> >> `u32::from()` to avoid an `as` cast in that commit, and while the cast
>> >> is OK converting the new `enum`s like `FalconCoreRev`, `from()`
>> >> isn't`, so we would need to implement `From` explicitly -- Cc'ing
>> >> Danilo, Alexandre, Lyude.
>> >
>> > It's a bit annoying to implement From explicitly for all of them, but it seems
>> > to be the correct thing to do.
>>
>> This might be something `FromPrimitive` will help with eventually, but
>> in the meantime I agree having explicit implementations is a bit
>> cumbersome.
>>
>> What I don't understand is why these `as` are problematic - a type like
>> `FalconCoreRev` is `repr(u8)`, so the cast cannot be lossy. I think this
>> is the case for all such instances using the register!() macro.
>
> The use of `as` is problematic because it disempowers the compiler
> from checking that the cast is not lossy. In other words, it is of
> course fine in the case of a `repr(u8)` enum, but if the type changes
> in a way that causes a lossy conversion, the compiler will not warn
> you.

I understand and agree with this, but why doesn't the linter limit
itself to such lossy cases (e.g. `u64 as u32`) and let the harmless ones
be?

  reply	other threads:[~2025-06-24 12:24 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-24  7:31 linux-next: build failure after merge of the rust tree Stephen Rothwell
2025-06-24 10:31 ` Miguel Ojeda
2025-06-24 11:12   ` Danilo Krummrich
2025-06-24 12:29     ` Miguel Ojeda
2025-06-24 12:00   ` Danilo Krummrich
2025-06-24 12:14     ` Alexandre Courbot
2025-06-24 12:16       ` Tamir Duberstein
2025-06-24 12:24         ` Alexandre Courbot [this message]
2025-06-24 12:29           ` Tamir Duberstein
2025-06-24 12:25     ` Miguel Ojeda
  -- strict thread matches above, loose matches on Subject: below --
2025-11-17  8:04 Stephen Rothwell
2025-11-17 11:19 ` Alexandre Courbot
2025-11-17 14:51 ` Alice Ryhl
2025-11-17 15:37   ` Tamir Duberstein
2025-11-17 16:11     ` Alice Ryhl
2025-05-27  9:42 Stephen Rothwell
2025-05-27 10:03 ` Miguel Ojeda
2025-05-12  9:40 Stephen Rothwell
2025-05-12 11:52 ` Miguel Ojeda
2025-03-24 10:57 Stephen Rothwell
2025-03-24 11:06 ` Stephen Rothwell
2025-03-24 11:59   ` Danilo Krummrich
2025-03-24 13:29     ` Greg KH
2025-03-24 13:43       ` Danilo Krummrich
2025-03-24 13:52         ` Greg KH
2025-03-24 15:18         ` Miguel Ojeda
2025-03-24 15:27           ` Danilo Krummrich
2025-03-24 15:40             ` Miguel Ojeda
2025-03-17 10:57 Stephen Rothwell
2025-03-17 22:35 ` Miguel Ojeda
2025-03-17 23:35   ` Stephen Rothwell
2025-03-18 11:37     ` Stephen Rothwell
2025-03-18 23:47       ` Miguel Ojeda
2025-03-19  9:06         ` Stephen Rothwell
2025-03-19  9:18           ` Miguel Ojeda
2025-01-10  5:28 Stephen Rothwell
2025-01-10  9:28 ` Alice Ryhl
2025-01-10  9:34   ` Greg Kroah-Hartman
2025-01-10  9:41     ` Alice Ryhl
2025-01-10 10:07       ` Alice Ryhl
2025-01-10 10:08       ` Miguel Ojeda
2025-01-10 10:16     ` Miguel Ojeda
2025-01-10 10:38       ` Miguel Ojeda
2024-12-16  5:25 Stephen Rothwell
2024-12-16 10:31 ` Miguel Ojeda
2024-12-16 10:59   ` Jocelyn Falempe
2024-12-16 16:24     ` Miguel Ojeda
2024-12-16 19:46       ` Jocelyn Falempe
2024-11-11  6:58 Stephen Rothwell
2024-11-11  8:16 ` Miguel Ojeda
2024-11-11  8:28   ` Miguel Ojeda
2024-11-11 14:15     ` Gary Guo
2024-11-11 23:08       ` Miguel Ojeda
2024-11-11 23:58     ` Miguel Ojeda
2024-11-12  1:29       ` Stephen Rothwell
2024-11-12  6:30       ` Stephen Rothwell
2024-11-12  8:50         ` Miguel Ojeda
2021-09-28  4:09 Stephen Rothwell
2021-09-28  4:18 ` Gary Guo
2021-09-28  5:52   ` Stephen Rothwell
2021-09-28 23:37     ` Stephen Rothwell
2021-09-29 17:13       ` Masahiro Yamada
2021-09-29 17:25         ` Miguel Ojeda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DAURELPD1M69.1WQM3ZJI33MFZ@nvidia.com \
    --to=acourbot@nvidia.com \
    --cc=a.hindborg@kernel.org \
    --cc=dakr@kernel.org \
    --cc=fujita.tomonori@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=lyude@redhat.com \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=ojeda@kernel.org \
    --cc=sfr@canb.auug.org.au \
    --cc=tamird@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox