Rust for Linux List
 help / color / mirror / Atom feed
From: Andreas Hindborg <a.hindborg@kernel.org>
To: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>,
	Alice Ryhl <aliceryhl@google.com>
Cc: FUJITA Tomonori <tomo@flapping.org>,
	gary@garyguo.net, ojeda@kernel.org, acourbot@nvidia.com,
	anna-maria@linutronix.de, bjorn3_gh@protonmail.com,
	boqun@kernel.org, dakr@kernel.org, daniel.almeida@collabora.com,
	frederic@kernel.org, jstultz@google.com, lossin@kernel.org,
	lyude@redhat.com, sboyd@kernel.org, tamird@kernel.org,
	tglx@kernel.org, tmgross@umich.edu, work@onurozkan.dev,
	rust-for-linux@vger.kernel.org, fujita.tomonori@gmail.com
Subject: Re: [PATCH v1] rust: time: fix as_micros_ceil() to round correctly for negative Delta
Date: Fri, 17 Jul 2026 22:31:35 +0200	[thread overview]
Message-ID: <874ihxgxy0.fsf@kernel.org> (raw)
In-Reply-To: <CANiq72n-MUqf2MBrUTqOD4jbDTZ26kYULzX6YbQLawJ+201jQA@mail.gmail.com>

"Miguel Ojeda" <miguel.ojeda.sandonis@gmail.com> writes:

> On Tue, Jul 14, 2026 at 2:57 PM Alice Ryhl <aliceryhl@google.com> wrote:
>>
>> I mean if the goal is just to explain that values that are too large
>> saturate, then the example could look like this?
>
> Yeah, that is what I meant by the 2) group, i.e. I think saturation
> should be shown one way or another.
>
> But the boundary case in particular is separate, and a previous patch
> showcased the actual boundary (i.e. both N and N + 1). If the docs
> mention it (as they do now), then I am OK with the boundary case being
> in the example too, even if we may not have a `pub const`, or in
> `#[test]`.
>
> Either way, what I really want is to have the basic examples landed
> and the fix... we can discuss the boundary (docs, examples, `#[test]`s
> and `pub const`s) separately. :)
>

We can land the fix first and the examples and tests later.

I agree with the suggestions made in this thread about examples and
cases. Let's have the example like Alice suggest and then test boundary
inputs in `#[test]` kunit tests. Define the magic numbers as named
constants local to the test scope, not as part of the exported API.

Best regards,
Andreas Hindborg



  reply	other threads:[~2026-07-17 20:31 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <N3Mcf328j6hi7HCJTp14HUC6-cxRUNgQLjvAdkFhIuZM-yYM91SYBYsW7kEVHRkqTzm1B3zgl5Bat4dpSIfXtA==@protonmail.internalid>
2026-07-13 22:52 ` [PATCH v1] rust: time: fix as_micros_ceil() to round correctly for negative Delta FUJITA Tomonori
2026-07-14  9:09   ` Miguel Ojeda
2026-07-14 10:16     ` FUJITA Tomonori
2026-07-14 10:38       ` Miguel Ojeda
2026-07-14 10:49         ` FUJITA Tomonori
2026-07-14 10:56           ` Gary Guo
2026-07-14 12:17             ` FUJITA Tomonori
2026-07-14 12:31               ` Miguel Ojeda
2026-07-14 12:57                 ` Alice Ryhl
2026-07-14 14:21                   ` Miguel Ojeda
2026-07-17 20:31                     ` Andreas Hindborg [this message]
2026-07-14 12:18           ` Miguel Ojeda
2026-07-17 20:26   ` Andreas Hindborg

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=874ihxgxy0.fsf@kernel.org \
    --to=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=aliceryhl@google.com \
    --cc=anna-maria@linutronix.de \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=frederic@kernel.org \
    --cc=fujita.tomonori@gmail.com \
    --cc=gary@garyguo.net \
    --cc=jstultz@google.com \
    --cc=lossin@kernel.org \
    --cc=lyude@redhat.com \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=sboyd@kernel.org \
    --cc=tamird@kernel.org \
    --cc=tglx@kernel.org \
    --cc=tmgross@umich.edu \
    --cc=tomo@flapping.org \
    --cc=work@onurozkan.dev \
    /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