diff options
author | Ingo Molnar <mingo@kernel.org> | 2024-05-02 13:12:31 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2024-05-02 13:12:31 +0200 |
commit | ad112b3a759cefc245695f7e612f17e6f38d2cc1 (patch) | |
tree | d5fa837d0f996dbf15e4fd89a7f89b9b660f5796 /rust/kernel/init.rs | |
parent | 854dd99b5ddc9d90e31e5f112462a5994dd31810 (diff) | |
parent | e67572cd2204894179d89bd7b984072f19313b03 (diff) |
Merge tag 'v6.9-rc6' into perf/core, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'rust/kernel/init.rs')
-rw-r--r-- | rust/kernel/init.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/rust/kernel/init.rs b/rust/kernel/init.rs index 424257284d16..09004b56fb65 100644 --- a/rust/kernel/init.rs +++ b/rust/kernel/init.rs @@ -1292,8 +1292,15 @@ impl_zeroable! { i8, i16, i32, i64, i128, isize, f32, f64, - // SAFETY: These are ZSTs, there is nothing to zero. - {<T: ?Sized>} PhantomData<T>, core::marker::PhantomPinned, Infallible, (), + // Note: do not add uninhabited types (such as `!` or `core::convert::Infallible`) to this list; + // creating an instance of an uninhabited type is immediate undefined behavior. For more on + // uninhabited/empty types, consult The Rustonomicon: + // <https://doc.rust-lang.org/stable/nomicon/exotic-sizes.html#empty-types>. The Rust Reference + // also has information on undefined behavior: + // <https://doc.rust-lang.org/stable/reference/behavior-considered-undefined.html>. + // + // SAFETY: These are inhabited ZSTs; there is nothing to zero and a valid value exists. + {<T: ?Sized>} PhantomData<T>, core::marker::PhantomPinned, (), // SAFETY: Type is allowed to take any value, including all zeros. {<T>} MaybeUninit<T>, |