@@ -950,7 +950,7 @@ impl<T> ManuallyDrop<T> {
950
950
/// ManuallyDrop::new(Box::new(()));
951
951
/// ```
952
952
#[ stable( feature = "manually_drop" , since = "1.20.0" ) ]
953
- #[ inline]
953
+ #[ inline( always ) ]
954
954
pub const fn new ( value : T ) -> ManuallyDrop < T > {
955
955
ManuallyDrop { value }
956
956
}
@@ -967,7 +967,7 @@ impl<T> ManuallyDrop<T> {
967
967
/// let _: Box<()> = ManuallyDrop::into_inner(x); // This drops the `Box`.
968
968
/// ```
969
969
#[ stable( feature = "manually_drop" , since = "1.20.0" ) ]
970
- #[ inline]
970
+ #[ inline( always ) ]
971
971
pub const fn into_inner ( slot : ManuallyDrop < T > ) -> T {
972
972
slot. value
973
973
}
@@ -1015,15 +1015,15 @@ impl<T: ?Sized> ManuallyDrop<T> {
1015
1015
#[ stable( feature = "manually_drop" , since = "1.20.0" ) ]
1016
1016
impl < T : ?Sized > Deref for ManuallyDrop < T > {
1017
1017
type Target = T ;
1018
- #[ inline]
1018
+ #[ inline( always ) ]
1019
1019
fn deref ( & self ) -> & T {
1020
1020
& self . value
1021
1021
}
1022
1022
}
1023
1023
1024
1024
#[ stable( feature = "manually_drop" , since = "1.20.0" ) ]
1025
1025
impl < T : ?Sized > DerefMut for ManuallyDrop < T > {
1026
- #[ inline]
1026
+ #[ inline( always ) ]
1027
1027
fn deref_mut ( & mut self ) -> & mut T {
1028
1028
& mut self . value
1029
1029
}
@@ -1044,6 +1044,7 @@ impl<T> MaybeUninit<T> {
1044
1044
/// Note that dropping a `MaybeUninit` will never call `T`'s drop code.
1045
1045
/// It is your responsibility to make sure `T` gets dropped if it got initialized.
1046
1046
#[ unstable( feature = "maybe_uninit" , issue = "53491" ) ]
1047
+ #[ inline( always) ]
1047
1048
pub const fn new ( val : T ) -> MaybeUninit < T > {
1048
1049
MaybeUninit { value : ManuallyDrop :: new ( val) }
1049
1050
}
@@ -1053,6 +1054,7 @@ impl<T> MaybeUninit<T> {
1053
1054
/// Note that dropping a `MaybeUninit` will never call `T`'s drop code.
1054
1055
/// It is your responsibility to make sure `T` gets dropped if it got initialized.
1055
1056
#[ unstable( feature = "maybe_uninit" , issue = "53491" ) ]
1057
+ #[ inline( always) ]
1056
1058
pub const fn uninitialized ( ) -> MaybeUninit < T > {
1057
1059
MaybeUninit { uninit : ( ) }
1058
1060
}
@@ -1066,6 +1068,7 @@ impl<T> MaybeUninit<T> {
1066
1068
/// Note that dropping a `MaybeUninit` will never call `T`'s drop code.
1067
1069
/// It is your responsibility to make sure `T` gets dropped if it got initialized.
1068
1070
#[ unstable( feature = "maybe_uninit" , issue = "53491" ) ]
1071
+ #[ inline]
1069
1072
pub fn zeroed ( ) -> MaybeUninit < T > {
1070
1073
let mut u = MaybeUninit :: < T > :: uninitialized ( ) ;
1071
1074
unsafe {
@@ -1076,6 +1079,7 @@ impl<T> MaybeUninit<T> {
1076
1079
1077
1080
/// Set the value of the `MaybeUninit`. This overwrites any previous value without dropping it.
1078
1081
#[ unstable( feature = "maybe_uninit" , issue = "53491" ) ]
1082
+ #[ inline( always) ]
1079
1083
pub fn set ( & mut self , val : T ) {
1080
1084
unsafe {
1081
1085
self . value = ManuallyDrop :: new ( val) ;
@@ -1091,6 +1095,7 @@ impl<T> MaybeUninit<T> {
1091
1095
/// It is up to the caller to guarantee that the `MaybeUninit` really is in an initialized
1092
1096
/// state, otherwise this will immediately cause undefined behavior.
1093
1097
#[ unstable( feature = "maybe_uninit" , issue = "53491" ) ]
1098
+ #[ inline( always) ]
1094
1099
pub unsafe fn into_inner ( self ) -> T {
1095
1100
ManuallyDrop :: into_inner ( self . value )
1096
1101
}
@@ -1102,6 +1107,7 @@ impl<T> MaybeUninit<T> {
1102
1107
/// It is up to the caller to guarantee that the `MaybeUninit` really is in an initialized
1103
1108
/// state, otherwise this will immediately cause undefined behavior.
1104
1109
#[ unstable( feature = "maybe_uninit" , issue = "53491" ) ]
1110
+ #[ inline( always) ]
1105
1111
pub unsafe fn get_ref ( & self ) -> & T {
1106
1112
& * self . value
1107
1113
}
@@ -1113,20 +1119,23 @@ impl<T> MaybeUninit<T> {
1113
1119
/// It is up to the caller to guarantee that the `MaybeUninit` really is in an initialized
1114
1120
/// state, otherwise this will immediately cause undefined behavior.
1115
1121
#[ unstable( feature = "maybe_uninit" , issue = "53491" ) ]
1122
+ #[ inline( always) ]
1116
1123
pub unsafe fn get_mut ( & mut self ) -> & mut T {
1117
1124
& mut * self . value
1118
1125
}
1119
1126
1120
1127
/// Get a pointer to the contained value. Reading from this pointer will be undefined
1121
1128
/// behavior unless the `MaybeUninit` is initialized.
1122
1129
#[ unstable( feature = "maybe_uninit" , issue = "53491" ) ]
1130
+ #[ inline( always) ]
1123
1131
pub fn as_ptr ( & self ) -> * const T {
1124
1132
unsafe { & * self . value as * const T }
1125
1133
}
1126
1134
1127
1135
/// Get a mutable pointer to the contained value. Reading from this pointer will be undefined
1128
1136
/// behavior unless the `MaybeUninit` is initialized.
1129
1137
#[ unstable( feature = "maybe_uninit" , issue = "53491" ) ]
1138
+ #[ inline( always) ]
1130
1139
pub fn as_mut_ptr ( & mut self ) -> * mut T {
1131
1140
unsafe { & mut * self . value as * mut T }
1132
1141
}
0 commit comments