@@ -1193,7 +1193,7 @@ impl<'tcx> Ty<'tcx> {
1193
1193
1194
1194
/// Fast path helper for testing if a type is `Freeze`.
1195
1195
///
1196
- /// Returning true means the type is known to be `Freeze`. Returning
1196
+ /// Returning ` true` means the type is known to be `Freeze`. Returning
1197
1197
/// `false` means nothing -- could be `Freeze`, might not be.
1198
1198
pub fn is_trivially_freeze ( self ) -> bool {
1199
1199
match self . kind ( ) {
@@ -1227,16 +1227,18 @@ impl<'tcx> Ty<'tcx> {
1227
1227
}
1228
1228
}
1229
1229
1230
- /// Checks whether values of this type `T` implement the `Unpin` trait.
1231
- pub fn is_unpin ( self , tcx : TyCtxt < ' tcx > , typing_env : ty:: TypingEnv < ' tcx > ) -> bool {
1232
- self . is_trivially_unpin ( ) || tcx. is_unpin_raw ( typing_env. as_query_input ( self ) )
1230
+ /// Checks whether values of this type `T` implement the `UnsafeUnpin` trait.
1231
+ ///
1232
+ /// For more information, see [RFC 3467](https://rust-lang.github.io/rfcs/3467-unsafe-pinned.html).
1233
+ pub fn is_unsafe_unpin ( self , tcx : TyCtxt < ' tcx > , typing_env : ty:: TypingEnv < ' tcx > ) -> bool {
1234
+ self . is_trivially_unsafe_unpin ( ) || tcx. is_unsafe_unpin_raw ( typing_env. as_query_input ( self ) )
1233
1235
}
1234
1236
1235
- /// Fast path helper for testing if a type is `Unpin `.
1237
+ /// Fast path helper for testing if a type is `UnsafeUnpin `.
1236
1238
///
1237
- /// Returning true means the type is known to be `Unpin `. Returning
1238
- /// `false` means nothing -- could be `Unpin `, might not be.
1239
- fn is_trivially_unpin ( self ) -> bool {
1239
+ /// Returning ` true` means the type is known to be `UnsafeUnpin `. Returning
1240
+ /// `false` means nothing -- could be `UnsafeUnpin `, might not be.
1241
+ fn is_trivially_unsafe_unpin ( self ) -> bool {
1240
1242
match self . kind ( ) {
1241
1243
ty:: Int ( _)
1242
1244
| ty:: Uint ( _)
@@ -1250,8 +1252,8 @@ impl<'tcx> Ty<'tcx> {
1250
1252
| ty:: FnDef ( ..)
1251
1253
| ty:: Error ( _)
1252
1254
| ty:: FnPtr ( ..) => true ,
1253
- ty:: Tuple ( fields) => fields. iter ( ) . all ( Self :: is_trivially_unpin ) ,
1254
- ty:: Pat ( ty, _) | ty:: Slice ( ty) | ty:: Array ( ty, _) => ty. is_trivially_unpin ( ) ,
1255
+ ty:: Tuple ( fields) => fields. iter ( ) . all ( Self :: is_trivially_unsafe_unpin ) ,
1256
+ ty:: Pat ( ty, _) | ty:: Slice ( ty) | ty:: Array ( ty, _) => ty. is_trivially_unsafe_unpin ( ) ,
1255
1257
ty:: Adt ( ..)
1256
1258
| ty:: Bound ( ..)
1257
1259
| ty:: Closure ( ..)
0 commit comments