* Re: [PATCH 6.12.y] rust: block: `allow(deprecated)` for `fetch_update` for Rust >= 1.99.0
[not found] <20260718182323.107565-1-ojeda@kernel.org>
@ 2026-07-18 18:27 ` Miguel Ojeda
2026-07-21 0:56 ` Sasha Levin
0 siblings, 1 reply; 2+ messages in thread
From: Miguel Ojeda @ 2026-07-18 18:27 UTC (permalink / raw)
To: Miguel Ojeda
Cc: Andreas Hindborg, Jens Axboe, Boqun Feng, linux-block,
rust-for-linux, Gary Guo, Björn Roy Baron, Benno Lossin,
Alice Ryhl, Trevor Gross, Danilo Krummrich, Daniel Almeida,
Tamir Duberstein, Alexandre Courbot, Onur Özkan,
Greg Kroah-Hartman, Sasha Levin, stable
On Sat, Jul 18, 2026 at 8:23 PM Miguel Ojeda <ojeda@kernel.org> wrote:
>
> Starting with Rust 1.99.0 (expected 2026-10-01), the
> `Atomic*::fetch_update` method is deprecated, with the compiler suggesting
> the `try_update` alias instead:
>
> error: use of deprecated method `core::sync::atomic::Atomic::<u64>::fetch_update`: renamed to `try_update` for consistency
> --> rust/kernel/block/mq/request.rs:206:22
> |
> 206 | let old = target.fetch_update(Ordering::Relaxed, Ordering::Relaxed, |x| Some(op(x)));
> | ^^^^^^^^^^^^
> |
> = note: `-D deprecated` implied by `-D warnings`
> = help: to override `-D warnings` add `#[allow(deprecated)]`
> help: replace the use of the deprecated method
> |
> 206 - let old = target.fetch_update(Ordering::Relaxed, Ordering::Relaxed, |x| Some(op(x)));
> 206 + let old = target.try_update(Ordering::Relaxed, Ordering::Relaxed, |x| Some(op(x)));
> |
>
> The deprecation was added in Rust 1.95.0 [1], but only triggers starting
> with Rust 1.99.0.
>
> However, we cannot use the alias since our minimum in 6.12.y is Rust
> 1.78.0 -- `try_update` was added in Rust 1.86.0 [2].
>
> Thus just allow the lint.
>
> Cc: Andreas Hindborg <a.hindborg@kernel.org>
> Cc: Boqun Feng <boqun@kernel.org>
> Cc: Jens Axboe <axboe@kernel.dk>
> Link: https://github.com/rust-lang/rust/pull/148590 [1]
> Link: https://github.com/rust-lang/rust/pull/133829 [2]
> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
> ---
> Warning: this is a 6.12.y-only patch -- I assume you prefer something
> local like this instead of backporting the commit that made this go away
> later with the move to `Refcount`.
Cc'ing stable here in the reply.
Cheers,
Miguel
^ permalink raw reply [flat|nested] 2+ messages in thread