@@ -44,8 +44,7 @@ pub trait AllocMut: AllocError {
4444 ///
4545 /// [last_os_error]: ::std::io::Error::last_os_error
4646 /// [raw_os_error]: ::std::io::Error::raw_os_error
47- fn alloc_mut ( & mut self , layout : Layout )
48- -> Result < NonNull < u8 > , <Self as AllocError >:: Error > ;
47+ fn alloc_mut ( & mut self , layout : Layout ) -> Result < NonNull < u8 > , <Self as AllocError >:: Error > ;
4948
5049 /// Attempts to allocate a zeroed block of memory fitting the given [`Layout`].
5150 ///
@@ -66,10 +65,7 @@ pub trait AllocMut: AllocError {
6665 /// [raw_os_error]: ::std::io::Error::raw_os_error
6766 #[ cfg_attr( miri, track_caller) ]
6867 #[ inline]
69- fn zalloc_mut (
70- & mut self ,
71- layout : Layout
72- ) -> Result < NonNull < u8 > , <Self as AllocError >:: Error > {
68+ fn zalloc_mut ( & mut self , layout : Layout ) -> Result < NonNull < u8 > , <Self as AllocError >:: Error > {
7369 zalloc ! ( self , alloc_mut, layout)
7470 }
7571}
@@ -125,6 +121,8 @@ pub trait DeallocMut: AllocMut {
125121 /// 0</code>.
126122 /// - <code>Err([Error::DanglingDeallocation])</code> if <code>ptr ==
127123 /// [layout.dangling](Layout::dangling)</code>.
124+ /// - <code>Err([Error::Unsupported]))</code> if deallocation is unsupported. In this case,
125+ /// reallocation via [`Grow`], [`Shrink`], and [`Realloc`] may still be supported.
128126 ///
129127 /// However, if using this method through a synchronization primitive wrapping a type which
130128 /// implements [`DeallocMut`], an [`Error::Other`] wrapping a generic error message will be
@@ -392,19 +390,13 @@ impl<A: ReallocMut + GrowMut + ShrinkMut + AllocMut + DeallocMut> FullAllocMut f
392390impl < A : Alloc + ?Sized > AllocMut for A {
393391 #[ cfg_attr( miri, track_caller) ]
394392 #[ inline( always) ]
395- fn alloc_mut (
396- & mut self ,
397- layout : Layout
398- ) -> Result < NonNull < u8 > , <Self as AllocError >:: Error > {
393+ fn alloc_mut ( & mut self , layout : Layout ) -> Result < NonNull < u8 > , <A as AllocError >:: Error > {
399394 ( * self ) . alloc ( layout)
400395 }
401396
402397 #[ cfg_attr( miri, track_caller) ]
403398 #[ inline( always) ]
404- fn zalloc_mut (
405- & mut self ,
406- layout : Layout
407- ) -> Result < NonNull < u8 > , <Self as AllocError >:: Error > {
399+ fn zalloc_mut ( & mut self , layout : Layout ) -> Result < NonNull < u8 > , <A as AllocError >:: Error > {
408400 ( * self ) . zalloc ( layout)
409401 }
410402}
@@ -422,7 +414,7 @@ impl<A: Dealloc + ?Sized> DeallocMut for A {
422414 & mut self ,
423415 ptr : NonNull < u8 > ,
424416 layout : Layout
425- ) -> Result < ( ) , <Self as AllocError >:: Error > {
417+ ) -> Result < ( ) , <A as AllocError >:: Error > {
426418 ( * self ) . try_dealloc ( ptr, layout)
427419 }
428420}
@@ -435,7 +427,7 @@ impl<A: Grow + ?Sized> GrowMut for A {
435427 ptr : NonNull < u8 > ,
436428 old_layout : Layout ,
437429 new_layout : Layout
438- ) -> Result < NonNull < u8 > , <Self as AllocError >:: Error > {
430+ ) -> Result < NonNull < u8 > , <A as AllocError >:: Error > {
439431 ( * self ) . grow ( ptr, old_layout, new_layout)
440432 }
441433
@@ -446,7 +438,7 @@ impl<A: Grow + ?Sized> GrowMut for A {
446438 ptr : NonNull < u8 > ,
447439 old_layout : Layout ,
448440 new_layout : Layout
449- ) -> Result < NonNull < u8 > , <Self as AllocError >:: Error > {
441+ ) -> Result < NonNull < u8 > , <A as AllocError >:: Error > {
450442 ( * self ) . zgrow ( ptr, old_layout, new_layout)
451443 }
452444}
@@ -459,7 +451,7 @@ impl<A: Shrink + ?Sized> ShrinkMut for A {
459451 ptr : NonNull < u8 > ,
460452 old_layout : Layout ,
461453 new_layout : Layout
462- ) -> Result < NonNull < u8 > , <Self as AllocError >:: Error > {
454+ ) -> Result < NonNull < u8 > , <A as AllocError >:: Error > {
463455 ( * self ) . shrink ( ptr, old_layout, new_layout)
464456 }
465457}
@@ -472,7 +464,7 @@ impl<A: Realloc + ?Sized> ReallocMut for A {
472464 ptr : NonNull < u8 > ,
473465 old_layout : Layout ,
474466 new_layout : Layout
475- ) -> Result < NonNull < u8 > , <Self as AllocError >:: Error > {
467+ ) -> Result < NonNull < u8 > , <A as AllocError >:: Error > {
476468 ( * self ) . realloc ( ptr, old_layout, new_layout)
477469 }
478470
@@ -483,7 +475,7 @@ impl<A: Realloc + ?Sized> ReallocMut for A {
483475 ptr : NonNull < u8 > ,
484476 old_layout : Layout ,
485477 new_layout : Layout
486- ) -> Result < NonNull < u8 > , <Self as AllocError >:: Error > {
478+ ) -> Result < NonNull < u8 > , <A as AllocError >:: Error > {
487479 ( * self ) . rezalloc ( ptr, old_layout, new_layout)
488480 }
489481}
@@ -503,7 +495,7 @@ macro_rules! impl_alloc_for_sync_mutalloc {
503495 fn alloc(
504496 & self ,
505497 layout: Layout
506- ) -> Result <NonNull <u8 >, <Self as AllocError >:: Error > {
498+ ) -> Result <NonNull <u8 >, <$t as AllocError >:: Error > {
507499 tri!(
508500 cmap(
509501 Error :: Other ( concat!(
@@ -522,7 +514,7 @@ macro_rules! impl_alloc_for_sync_mutalloc {
522514 fn zalloc(
523515 & self ,
524516 layout: Layout
525- ) -> Result <NonNull <u8 >, <Self as AllocError >:: Error > {
517+ ) -> Result <NonNull <u8 >, <$t as AllocError >:: Error > {
526518 tri!(
527519 cmap(
528520 Error :: Other ( concat!(
@@ -561,7 +553,7 @@ macro_rules! impl_alloc_for_sync_mutalloc {
561553 & self ,
562554 ptr: NonNull <u8 >,
563555 layout: Layout
564- ) -> Result <( ) , <Self as AllocError >:: Error > {
556+ ) -> Result <( ) , <$t as AllocError >:: Error > {
565557 tri!(
566558 cmap(
567559 Error :: Other ( concat!(
@@ -585,7 +577,7 @@ macro_rules! impl_alloc_for_sync_mutalloc {
585577 ptr: NonNull <u8 >,
586578 old_layout: Layout ,
587579 new_layout: Layout ,
588- ) -> Result <NonNull <u8 >, <Self as AllocError >:: Error > {
580+ ) -> Result <NonNull <u8 >, <$t as AllocError >:: Error > {
589581 tri!(
590582 cmap(
591583 Error :: Other ( concat!(
@@ -607,7 +599,7 @@ macro_rules! impl_alloc_for_sync_mutalloc {
607599 ptr: NonNull <u8 >,
608600 old_layout: Layout ,
609601 new_layout: Layout ,
610- ) -> Result <NonNull <u8 >, <Self as AllocError >:: Error > {
602+ ) -> Result <NonNull <u8 >, <$t as AllocError >:: Error > {
611603 tri!(
612604 cmap(
613605 Error :: Other ( concat!(
@@ -631,7 +623,7 @@ macro_rules! impl_alloc_for_sync_mutalloc {
631623 ptr: NonNull <u8 >,
632624 old_layout: Layout ,
633625 new_layout: Layout ,
634- ) -> Result <NonNull <u8 >, <Self as AllocError >:: Error > {
626+ ) -> Result <NonNull <u8 >, <$t as AllocError >:: Error > {
635627 tri!(
636628 cmap(
637629 Error :: Other ( concat!(
@@ -655,7 +647,7 @@ macro_rules! impl_alloc_for_sync_mutalloc {
655647 ptr: NonNull <u8 >,
656648 old_layout: Layout ,
657649 new_layout: Layout ,
658- ) -> Result <NonNull <u8 >, <Self as AllocError >:: Error > {
650+ ) -> Result <NonNull <u8 >, <$t as AllocError >:: Error > {
659651 tri!(
660652 cmap(
661653 Error :: Other ( concat!(
@@ -677,7 +669,7 @@ macro_rules! impl_alloc_for_sync_mutalloc {
677669 ptr: NonNull <u8 >,
678670 old_layout: Layout ,
679671 new_layout: Layout ,
680- ) -> Result <NonNull <u8 >, <Self as AllocError >:: Error > {
672+ ) -> Result <NonNull <u8 >, <$t as AllocError >:: Error > {
681673 tri!(
682674 cmap(
683675 Error :: Other ( concat!(
0 commit comments