rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] rust: time: Fix compile error in impl_has_hr_timer macro
@ 2025-06-06  2:05 FUJITA Tomonori
  2025-06-06 15:34 ` Miguel Ojeda
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: FUJITA Tomonori @ 2025-06-06  2:05 UTC (permalink / raw)
  To: a.hindborg, alex.gaynor, ojeda
  Cc: aliceryhl, bjorn3_gh, boqun.feng, dakr, gary, lossin,
	rust-for-linux, tmgross, tamird

Fix a compile error in the `impl_has_hr_timer!` macro as follows:

error[E0599]: no method named cast_mut found for raw pointer *mut Foo in the current scope

The `container_of!` macro already returns a mutable pointer when used
in a `*mut T` context so the `.cast_mut()` method is not available.

Fixes: 74d6a606c2b3 ("rust: retain pointer mut-ness in `container_of!`")
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
---
 rust/kernel/time/hrtimer.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rust/kernel/time/hrtimer.rs b/rust/kernel/time/hrtimer.rs
index 9df3dcd2fa39..36e1290cd079 100644
--- a/rust/kernel/time/hrtimer.rs
+++ b/rust/kernel/time/hrtimer.rs
@@ -517,7 +517,7 @@ unsafe fn timer_container_of(
             ) -> *mut Self {
                 // SAFETY: As per the safety requirement of this function, `ptr`
                 // is pointing inside a `$timer_type`.
-                unsafe { ::kernel::container_of!(ptr, $timer_type, $field).cast_mut() }
+                unsafe { ::kernel::container_of!(ptr, $timer_type, $field) }
             }
         }
     }

base-commit: e271ed52b344ac02d4581286961d0c40acc54c03
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2025-06-10 19:30 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-06  2:05 [PATCH v1] rust: time: Fix compile error in impl_has_hr_timer macro FUJITA Tomonori
2025-06-06 15:34 ` Miguel Ojeda
2025-06-06 21:36   ` FUJITA Tomonori
2025-06-07 10:19     ` Miguel Ojeda
2025-06-08 21:26   ` Miguel Ojeda
2025-06-10  7:36     ` Andreas Hindborg
2025-06-10  9:49       ` Miguel Ojeda
2025-06-10 10:43         ` Andreas Hindborg
2025-06-06 19:34 ` Benno Lossin
2025-06-10 19:30 ` Miguel Ojeda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).