diff options
| author | Paolo Bonzini <pbonzini@redhat.com> | 2025-09-08 12:49:36 +0200 |
|---|---|---|
| committer | Paolo Bonzini <pbonzini@redhat.com> | 2025-09-17 19:00:56 +0200 |
| commit | 71e84e5ae87b8e6adce3af7dd2a490c7b2f39772 (patch) | |
| tree | 73b6ec6ec3cd777704a96c34ab19885bfd91da6a /rust/qemu-api/src/uninit.rs | |
| parent | e1c689c2189087bcab258f0a99019bb900986af7 (diff) | |
| download | focaccia-qemu-71e84e5ae87b8e6adce3af7dd2a490c7b2f39772.tar.gz focaccia-qemu-71e84e5ae87b8e6adce3af7dd2a490c7b2f39772.zip | |
rust: add missing const markers for MSRV==1.83.0
Rust 1.83 allows more functions to be marked const. Fix clippy with bumped minimum supported Rust version. Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Link: https://lore.kernel.org/r/20250908105005.2119297-5-pbonzini@redhat.com Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'rust/qemu-api/src/uninit.rs')
| -rw-r--r-- | rust/qemu-api/src/uninit.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/rust/qemu-api/src/uninit.rs b/rust/qemu-api/src/uninit.rs index 04123b4ae9..b0a829729d 100644 --- a/rust/qemu-api/src/uninit.rs +++ b/rust/qemu-api/src/uninit.rs @@ -12,7 +12,7 @@ pub struct MaybeUninitField<'a, T, U> { impl<'a, T, U> MaybeUninitField<'a, T, U> { #[doc(hidden)] - pub fn new(parent: &'a mut MaybeUninit<T>, child: *mut U) -> Self { + pub const fn new(parent: &'a mut MaybeUninit<T>, child: *mut U) -> Self { MaybeUninitField { parent, child } } @@ -21,7 +21,7 @@ impl<'a, T, U> MaybeUninitField<'a, T, U> { /// Because the `MaybeUninitField` remembers the containing object, /// it is possible to use it in foreign APIs that initialize the /// child. - pub fn parent(f: &Self) -> *const T { + pub const fn parent(f: &Self) -> *const T { f.parent.as_ptr() } @@ -30,7 +30,7 @@ impl<'a, T, U> MaybeUninitField<'a, T, U> { /// Because the `MaybeUninitField` remembers the containing object, /// it is possible to use it in foreign APIs that initialize the /// child. - pub fn parent_mut(f: &mut Self) -> *mut T { + pub const fn parent_mut(f: &mut Self) -> *mut T { f.parent.as_mut_ptr() } } |