@@ -51,7 +51,7 @@ pub trait Handle: Sized {
5151
5252/// Iterates through the pointer chain. Includes the item that is passed into the function. Stops at
5353/// the last [`BaseOutStructure`] that has a null [`BaseOutStructure::p_next`] field.
54- pub ( crate ) unsafe fn ptr_chain_iter < ' a , T : TaggedStructure < ' a > + ? Sized > (
54+ pub ( crate ) unsafe fn ptr_chain_iter < ' a , T : TaggedStructure < ' a > > (
5555 ptr : & mut T ,
5656) -> impl Iterator < Item = * mut BaseOutStructure < ' _ > > {
5757 let ptr = <* mut T >:: cast :: < BaseOutStructure < ' _ > > ( ptr) ;
@@ -69,7 +69,7 @@ pub(crate) unsafe fn ptr_chain_iter<'a, T: TaggedStructure<'a> + ?Sized>(
6969/// Structures implementing this trait are layout-compatible with [`BaseInStructure`] and
7070/// [`BaseOutStructure`]. Such structures have an `s_type` field indicating its type, which must
7171/// always match the value of [`TaggedStructure::STRUCTURE_TYPE`].
72- pub unsafe trait TaggedStructure < ' a > {
72+ pub unsafe trait TaggedStructure < ' a > : Sized {
7373 const STRUCTURE_TYPE : StructureType ;
7474
7575 /// Prepends the given extension struct between the root and the first pointer. This method is
@@ -81,13 +81,10 @@ pub unsafe trait TaggedStructure<'a> {
8181 /// # Panics
8282 /// If `next` contains a pointer chain of its own, this function will panic. Call `unsafe`
8383 /// [`Self::extend()`] to insert this chain instead.
84- fn push < T : Extends < Self > + TaggedStructure < ' a > + ?Sized > ( mut self , next : & ' a mut T ) -> Self
85- where
86- Self : Sized ,
87- {
88- // SAFETY: All implementors of `TaggedStructure` are required to have the `BaseOutStructure` layout
84+ fn push < T : Extends < Self > + TaggedStructure < ' a > > ( mut self , next : & ' a mut T ) -> Self {
85+ // SAFETY: All implementers of `TaggedStructure` are required to have the `BaseOutStructure` layout
8986 let slf_base = unsafe { & mut * <* mut _ >:: cast :: < BaseOutStructure < ' _ > > ( & mut self ) } ;
90- // SAFETY: All implementors of `TaggedStructure` are required to have the `BaseOutStructure` layout
87+ // SAFETY: All implementers of `T: TaggedStructure` are required to have the `BaseOutStructure` layout
9188 let next_base = unsafe { & mut * <* mut T >:: cast :: < BaseOutStructure < ' _ > > ( next) } ;
9289 // `next` here can contain a pointer chain. This function refuses to insert the struct,
9390 // in favour of calling unsafe extend().
@@ -113,13 +110,7 @@ pub unsafe trait TaggedStructure<'a> {
113110 ///
114111 /// The last struct in this chain (i.e. the one where `p_next` is `NULL`) must be writable
115112 /// memory, as its `p_next` field will be updated with the value of `self.p_next`.
116- unsafe fn extend < T : Extends < Self > + TaggedStructure < ' a > + ?Sized > (
117- mut self ,
118- next : & ' a mut T ,
119- ) -> Self
120- where
121- Self : Sized ,
122- {
113+ unsafe fn extend < T : Extends < Self > + TaggedStructure < ' a > > ( mut self , next : & ' a mut T ) -> Self {
123114 // `next` here can contain a pointer chain. This means that we must correctly attach he head
124115 // to the root and the tail to the rest of the chain For example:
125116 //
0 commit comments