linux-next: manual merge of the rust tree with the vfs-brauner tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

Today's linux-next merge of the rust tree got a conflict in:

  rust/kernel/types.rs

between commit:

  e7572e5deaf3 ("rust: types: add `NotThreadSafe`")

from the vfs-brauner tree and commits:

  c4277ae2a630 ("rust: types: avoid repetition in `{As,From}Bytes` impls")
  432526d4ff32 ("rust: enable `clippy::undocumented_unsafe_blocks` lint")

from the rust tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc rust/kernel/types.rs
index 3238ffaab031,28d9e5ea3df4..000000000000
--- a/rust/kernel/types.rs
+++ b/rust/kernel/types.rs
@@@ -514,42 -527,23 +527,44 @@@ impl_frombytes! 
  /// mutability.
  pub unsafe trait AsBytes {}
  
- // SAFETY: Instances of the following types have no uninitialized portions.
- unsafe impl AsBytes for u8 {}
- unsafe impl AsBytes for u16 {}
- unsafe impl AsBytes for u32 {}
- unsafe impl AsBytes for u64 {}
- unsafe impl AsBytes for usize {}
- unsafe impl AsBytes for i8 {}
- unsafe impl AsBytes for i16 {}
- unsafe impl AsBytes for i32 {}
- unsafe impl AsBytes for i64 {}
- unsafe impl AsBytes for isize {}
- unsafe impl AsBytes for bool {}
- unsafe impl AsBytes for char {}
- unsafe impl AsBytes for str {}
- // SAFETY: If individual values in an array have no uninitialized portions, then the array itself
- // does not have any uninitialized portions either.
- unsafe impl<T: AsBytes> AsBytes for [T] {}
- unsafe impl<T: AsBytes, const N: usize> AsBytes for [T; N] {}
+ macro_rules! impl_asbytes {
+     ($($({$($generics:tt)*})? $t:ty, )*) => {
+         // SAFETY: Safety comments written in the macro invocation.
+         $(unsafe impl$($($generics)*)? AsBytes for $t {})*
+     };
+ }
+ 
+ impl_asbytes! {
+     // SAFETY: Instances of the following types have no uninitialized portions.
+     u8, u16, u32, u64, usize,
+     i8, i16, i32, i64, isize,
+     bool,
+     char,
+     str,
+ 
+     // SAFETY: If individual values in an array have no uninitialized portions, then the array
+     // itself does not have any uninitialized portions either.
+     {<T: AsBytes>} [T],
+     {<T: AsBytes, const N: usize>} [T; N],
+ }
 +
 +/// Zero-sized type to mark types not [`Send`].
 +///
 +/// Add this type as a field to your struct if your type should not be sent to a different task.
 +/// Since [`Send`] is an auto trait, adding a single field that is `!Send` will ensure that the
 +/// whole type is `!Send`.
 +///
 +/// If a type is `!Send` it is impossible to give control over an instance of the type to another
 +/// task. This is useful to include in types that store or reference task-local information. A file
 +/// descriptor is an example of such task-local information.
 +///
 +/// This type also makes the type `!Sync`, which prevents immutable access to the value from
 +/// several threads in parallel.
 +pub type NotThreadSafe = PhantomData<*mut ()>;
 +
 +/// Used to construct instances of type [`NotThreadSafe`] similar to how `PhantomData` is
 +/// constructed.
 +///
 +/// [`NotThreadSafe`]: type@NotThreadSafe
 +#[allow(non_upper_case_globals)]
 +pub const NotThreadSafe: NotThreadSafe = PhantomData;

Attachment: pgpursCT2Ox_c.pgp
Description: OpenPGP digital signature


[Index of Archives]     [Linux Kernel]     [Linux USB Development]     [Yosemite News]     [Linux SCSI]

  Powered by Linux