[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CANiq72nd6m3eOxF+6kscXuVu7uLim4KgpONupgTsMcAF9TNhYQ@mail.gmail.com>
Date: Thu, 19 Jun 2025 21:03:05 +0200
From: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
To: Andreas Hindborg <a.hindborg@...nel.org>
Cc: FUJITA Tomonori <fujita.tomonori@...il.com>, aliceryhl@...gle.com, alex.gaynor@...il.com,
ojeda@...nel.org, 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 v1 1/2] rust: time: Rename Delta's methods as_micros_ceil
and as_millis
On Thu, Jun 19, 2025 at 2:51 PM Andreas Hindborg <a.hindborg@...nel.org> wrote:
>
> Yes, I would prefer taking by value. I think Alice mentioned earlier in
> this thread that the compiler will be smart about this and just pass the
> value. But it still feels wrong to me.
If inlined/private, yes; but not always.
So for small ("free") functions like this, it should generally not
matter, since they should be inlined whether by manual marking or by
the compiler.
But, in general, it is not the same, and you can see cases where the
compiler will still pass a pointer, and thus dereferences and writes
to memory to take an address to pass it.
Which means that, outside small things like `as_*`, one should still
probably take by value. Which creates an inconsistency.
Cheers,
Miguel
Powered by blists - more mailing lists