@@ -2099,7 +2099,7 @@ impl Ty {
2099
2099
2100
2100
#[ derive( Clone , Encodable , Decodable , Debug ) ]
2101
2101
pub struct BareFnTy {
2102
- pub unsafety : Unsafe ,
2102
+ pub safety : Safety ,
2103
2103
pub ext : Extern ,
2104
2104
pub generic_params : ThinVec < GenericParam > ,
2105
2105
pub decl : P < FnDecl > ,
@@ -2485,6 +2485,13 @@ pub enum Unsafe {
2485
2485
No ,
2486
2486
}
2487
2487
2488
+ #[ derive( Copy , Clone , PartialEq , Eq , Hash , Encodable , Decodable , Debug ) ]
2489
+ #[ derive( HashStable_Generic ) ]
2490
+ pub enum Safety {
2491
+ Unsafe ( Span ) ,
2492
+ Default ,
2493
+ }
2494
+
2488
2495
/// Describes what kind of coroutine markers, if any, a function has.
2489
2496
///
2490
2497
/// Coroutine markers are things that cause the function to generate a coroutine, such as `async`,
@@ -3001,8 +3008,8 @@ impl Extern {
3001
3008
/// included in this struct (e.g., `async unsafe fn` or `const extern "C" fn`).
3002
3009
#[ derive( Clone , Copy , Encodable , Decodable , Debug ) ]
3003
3010
pub struct FnHeader {
3004
- /// The `unsafe` keyword, if any
3005
- pub unsafety : Unsafe ,
3011
+ /// The safety keyword, if any
3012
+ pub safety : Safety ,
3006
3013
/// Whether this is `async`, `gen`, or nothing.
3007
3014
pub coroutine_kind : Option < CoroutineKind > ,
3008
3015
/// The `const` keyword, if any
@@ -3014,8 +3021,8 @@ pub struct FnHeader {
3014
3021
impl FnHeader {
3015
3022
/// Does this function header have any qualifiers or is it empty?
3016
3023
pub fn has_qualifiers ( & self ) -> bool {
3017
- let Self { unsafety , coroutine_kind, constness, ext } = self ;
3018
- matches ! ( unsafety , Unsafe :: Yes ( _) )
3024
+ let Self { safety , coroutine_kind, constness, ext } = self ;
3025
+ matches ! ( safety , Safety :: Unsafe ( _) )
3019
3026
|| coroutine_kind. is_some ( )
3020
3027
|| matches ! ( constness, Const :: Yes ( _) )
3021
3028
|| !matches ! ( ext, Extern :: None )
@@ -3025,7 +3032,7 @@ impl FnHeader {
3025
3032
impl Default for FnHeader {
3026
3033
fn default ( ) -> FnHeader {
3027
3034
FnHeader {
3028
- unsafety : Unsafe :: No ,
3035
+ safety : Safety :: Default ,
3029
3036
coroutine_kind : None ,
3030
3037
constness : Const :: No ,
3031
3038
ext : Extern :: None ,
0 commit comments