[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <871pr82pk8.fsf@kernel.org>
Date: Wed, 25 Jun 2025 10:28:07 +0200
From: Andreas Hindborg <a.hindborg@...nel.org>
To: "Miguel Ojeda" <miguel.ojeda.sandonis@...il.com>
Cc: <alex.gaynor@...il.com>, <ojeda@...nel.org>, "FUJITA Tomonori"
<fujita.tomonori@...il.com>, <aliceryhl@...gle.com>,
<anna-maria@...utronix.de>, <bjorn3_gh@...tonmail.com>,
<boqun.feng@...il.com>, <dakr@...nel.org>, <frederic@...nel.org>,
<gary@...yguo.net>, <jstultz@...gle.com>,
<linux-kernel@...r.kernel.org>, <lossin@...nel.org>,
<lyude@...hat.com>, <rust-for-linux@...r.kernel.org>,
<sboyd@...nel.org>, <tglx@...utronix.de>, <tmgross@...ch.edu>
Subject: Re: [PATCH v3 0/5] rust: time: Convert hrtimer to use Instant and
Delta
"Miguel Ojeda" <miguel.ojeda.sandonis@...il.com> writes:
> On Tue, 24 Jun 2025 at 15:11, Andreas Hindborg <a.hindborg@...nel.org> wrote:
>>
>> None of the options are the right choice.
>
> That is fine (it is also what I have been arguing in the other thread
> and in previous times), but that does not imply `into_*` is not a bad
> choice if we really want to follow upstream.
>
>> Cost and ownership _do_ line
>> up for `into_*` in this case.
>
> No, ownership definitely doesn't line up: `Delta` is not `Copy` and
> there is no conceptual ownership transfer. While it says "owned ->
> owned", not being `Copy` is quite important here: the guidelines
> clarify in an example for a `Copy` type that if the input is not
> consumed then it should not be `into_*`.
OK, that makes sense. And you are right, `T: Copy` does not line up, I
must have read too fast.
>
> Sure, "Variable" cost means anything could go there, but that doesn't
> tell us much, i.e. if it was completely free, we could just as well
> pick `as_`, which would actually provide some information since you
> know it needs to be cheap.
>
> So the whole argument for `into_*` is... "it says 'Variable' cost so
> it lines up"?
You are right, there is no argument outside of "variable cost", thanks
for clarifying.
> Now, what I argued is that we may just as well define our own rules,
> since that table is confusing and doesn't cover all cases. If we do
> that, then you could propose things like "all owned->owned methods are
> `into_*`", which I think is what you are essentially implying here.
I would actually prefer that the rust-lang guidelines were clarified so
that we could just defer to those.
>
>> I do not think that is settled.
>
> If you think so, then the patch shouldn't be applied.
I understand.
Best regards,
Andreas Hindborg
Powered by blists - more mailing lists