@@ -3208,13 +3208,15 @@ impl fmt::Display for Unsafety {
3208
3208
#[ derive( Encodable , Decodable , HashStable_Generic ) ]
3209
3209
pub enum Safety {
3210
3210
Unsafe ,
3211
+ Safe ,
3211
3212
Default ,
3212
3213
}
3213
3214
3214
3215
impl Safety {
3215
3216
pub fn prefix_str ( & self ) -> & ' static str {
3216
3217
match self {
3217
3218
Self :: Unsafe => "unsafe " ,
3219
+ Self :: Safe => "safe " ,
3218
3220
Self :: Default => "" ,
3219
3221
}
3220
3222
}
@@ -3224,6 +3226,7 @@ impl fmt::Display for Safety {
3224
3226
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
3225
3227
f. write_str ( match * self {
3226
3228
Self :: Unsafe => "unsafe" ,
3229
+ Self :: Safe => "safe" ,
3227
3230
Self :: Default => "normal" ,
3228
3231
} )
3229
3232
}
@@ -3461,9 +3464,9 @@ impl ForeignItem<'_> {
3461
3464
#[ derive( Debug , Clone , Copy , HashStable_Generic ) ]
3462
3465
pub enum ForeignItemKind < ' hir > {
3463
3466
/// A foreign function.
3464
- Fn ( & ' hir FnDecl < ' hir > , & ' hir [ Ident ] , & ' hir Generics < ' hir > ) ,
3467
+ Fn ( & ' hir FnDecl < ' hir > , & ' hir [ Ident ] , & ' hir Generics < ' hir > , Safety ) ,
3465
3468
/// A foreign static item (`static ext: u8`).
3466
- Static ( & ' hir Ty < ' hir > , Mutability ) ,
3469
+ Static ( & ' hir Ty < ' hir > , Mutability , Safety ) ,
3467
3470
/// A foreign type.
3468
3471
Type ,
3469
3472
}
@@ -3533,7 +3536,7 @@ impl<'hir> OwnerNode<'hir> {
3533
3536
| OwnerNode :: ImplItem ( ImplItem { kind : ImplItemKind :: Fn ( fn_sig, _) , .. } )
3534
3537
| OwnerNode :: Item ( Item { kind : ItemKind :: Fn ( fn_sig, _, _) , .. } ) => Some ( fn_sig. decl ) ,
3535
3538
OwnerNode :: ForeignItem ( ForeignItem {
3536
- kind : ForeignItemKind :: Fn ( fn_decl, _, _) ,
3539
+ kind : ForeignItemKind :: Fn ( fn_decl, _, _, _ ) ,
3537
3540
..
3538
3541
} ) => Some ( fn_decl) ,
3539
3542
_ => None ,
@@ -3720,9 +3723,9 @@ impl<'hir> Node<'hir> {
3720
3723
| Node :: ImplItem ( ImplItem { kind : ImplItemKind :: Fn ( fn_sig, _) , .. } )
3721
3724
| Node :: Item ( Item { kind : ItemKind :: Fn ( fn_sig, _, _) , .. } ) => Some ( fn_sig. decl ) ,
3722
3725
Node :: Expr ( Expr { kind : ExprKind :: Closure ( Closure { fn_decl, .. } ) , .. } )
3723
- | Node :: ForeignItem ( ForeignItem { kind : ForeignItemKind :: Fn ( fn_decl , _ , _ ) , .. } ) => {
3724
- Some ( fn_decl)
3725
- }
3726
+ | Node :: ForeignItem ( ForeignItem {
3727
+ kind : ForeignItemKind :: Fn ( fn_decl, _ , _ , _ ) , ..
3728
+ } ) => Some ( fn_decl ) ,
3726
3729
_ => None ,
3727
3730
}
3728
3731
}
@@ -3806,7 +3809,7 @@ impl<'hir> Node<'hir> {
3806
3809
pub fn generics ( self ) -> Option < & ' hir Generics < ' hir > > {
3807
3810
match self {
3808
3811
Node :: ForeignItem ( ForeignItem {
3809
- kind : ForeignItemKind :: Fn ( _, _, generics) , ..
3812
+ kind : ForeignItemKind :: Fn ( _, _, generics, _ ) , ..
3810
3813
} )
3811
3814
| Node :: TraitItem ( TraitItem { generics, .. } )
3812
3815
| Node :: ImplItem ( ImplItem { generics, .. } ) => Some ( generics) ,
0 commit comments