Re: [PATCH] rust: doctest: fix line numbers after crate-level attributes

From: Miguel Ojeda

Date: Wed Oct 28 2026 - 03:34:36 EST


On Tue, Oct 27, 2026 at 7:32 AM Younes Akhouayri via B4 Relay
<devnull+git.younes.io@xxxxxxxxxx> wrote:
>
> Twelve in-tree doctests start like this, e.g. in `bits.rs`, `devres.rs`,
> `init.rs` and `std_vendor.rs`.

This looks OK, and I think it fixes all the cases we have currently,
but it doesn't cover every case one may write (like a multi-line
attribute), i.e. I was wondering whether the complexity of this is
worth it or not (especially if later on we try to support every case).
But it may be that never happens, or happens way less often than even
this case that we may not even care.

By the way, why `saturating_sub` in particular? I guess because of
underflow, but can that happen? And if it can (perhaps in a future
compiler version), wouldn't we want to notice?

Thanks!

Cheers,
Miguel