@@ -715,6 +715,7 @@ impl<'a, T: ?Sized> Pin<&'a T> {
715
715
impl < ' a , T : ?Sized > Pin < & ' a mut T > {
716
716
/// Converts this `Pin<&mut T>` into a `Pin<&T>` with the same lifetime.
717
717
#[ inline( always) ]
718
+ #[ must_use = "`self` will be dropped if the result is not used" ]
718
719
#[ rustc_const_unstable( feature = "const_pin" , issue = "76654" ) ]
719
720
#[ stable( feature = "pin" , since = "1.33.0" ) ]
720
721
pub const fn into_ref ( self ) -> Pin < & ' a T > {
@@ -731,6 +732,7 @@ impl<'a, T: ?Sized> Pin<&'a mut T> {
731
732
/// the `Pin` itself. This method allows turning the `Pin` into a reference
732
733
/// with the same lifetime as the original `Pin`.
733
734
#[ inline( always) ]
735
+ #[ must_use = "`self` will be dropped if the result is not used" ]
734
736
#[ stable( feature = "pin" , since = "1.33.0" ) ]
735
737
#[ rustc_const_unstable( feature = "const_pin" , issue = "76654" ) ]
736
738
pub const fn get_mut ( self ) -> & ' a mut T
@@ -751,6 +753,7 @@ impl<'a, T: ?Sized> Pin<&'a mut T> {
751
753
/// If the underlying data is `Unpin`, `Pin::get_mut` should be used
752
754
/// instead.
753
755
#[ inline( always) ]
756
+ #[ must_use = "`self` will be dropped if the result is not used" ]
754
757
#[ stable( feature = "pin" , since = "1.33.0" ) ]
755
758
#[ rustc_const_unstable( feature = "const_pin" , issue = "76654" ) ]
756
759
pub const unsafe fn get_unchecked_mut ( self ) -> & ' a mut T {
@@ -772,6 +775,7 @@ impl<'a, T: ?Sized> Pin<&'a mut T> {
772
775
/// not move out of the argument you receive to the interior function.
773
776
///
774
777
/// [`pin` module]: self#projections-and-structural-pinning
778
+ #[ must_use = "`self` will be dropped if the result is not used" ]
775
779
#[ stable( feature = "pin" , since = "1.33.0" ) ]
776
780
pub unsafe fn map_unchecked_mut < U , F > ( self , func : F ) -> Pin < & ' a mut U >
777
781
where
@@ -811,6 +815,7 @@ impl<'a, P: DerefMut> Pin<&'a mut Pin<P>> {
811
815
/// implementations of `P::DerefMut` are likewise ruled out by the contract of
812
816
/// `Pin::new_unchecked`.
813
817
#[ unstable( feature = "pin_deref_mut" , issue = "86918" ) ]
818
+ #[ must_use = "`self` will be dropped if the result is not used" ]
814
819
#[ inline( always) ]
815
820
pub fn as_deref_mut ( self ) -> Pin < & ' a mut P :: Target > {
816
821
// SAFETY: What we're asserting here is that going from
0 commit comments