@@ -2099,7 +2099,7 @@ impl Ty {
20992099
21002100#[ derive( Clone , Encodable , Decodable , Debug ) ]
21012101pub struct BareFnTy {
2102- pub unsafety : Unsafe ,
2102+ pub safety : Safety ,
21032103 pub ext : Extern ,
21042104 pub generic_params : ThinVec < GenericParam > ,
21052105 pub decl : P < FnDecl > ,
@@ -2485,6 +2485,13 @@ pub enum Unsafe {
24852485 No ,
24862486}
24872487
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+
24882495/// Describes what kind of coroutine markers, if any, a function has.
24892496///
24902497/// Coroutine markers are things that cause the function to generate a coroutine, such as `async`,
@@ -3001,8 +3008,8 @@ impl Extern {
30013008/// included in this struct (e.g., `async unsafe fn` or `const extern "C" fn`).
30023009#[ derive( Clone , Copy , Encodable , Decodable , Debug ) ]
30033010pub struct FnHeader {
3004- /// The `unsafe` keyword, if any
3005- pub unsafety : Unsafe ,
3011+ /// The safety keyword, if any
3012+ pub safety : Safety ,
30063013 /// Whether this is `async`, `gen`, or nothing.
30073014 pub coroutine_kind : Option < CoroutineKind > ,
30083015 /// The `const` keyword, if any
@@ -3014,8 +3021,8 @@ pub struct FnHeader {
30143021impl FnHeader {
30153022 /// Does this function header have any qualifiers or is it empty?
30163023 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 ( _) )
30193026 || coroutine_kind. is_some ( )
30203027 || matches ! ( constness, Const :: Yes ( _) )
30213028 || !matches ! ( ext, Extern :: None )
@@ -3025,7 +3032,7 @@ impl FnHeader {
30253032impl Default for FnHeader {
30263033 fn default ( ) -> FnHeader {
30273034 FnHeader {
3028- unsafety : Unsafe :: No ,
3035+ safety : Safety :: Default ,
30293036 coroutine_kind : None ,
30303037 constness : Const :: No ,
30313038 ext : Extern :: None ,
0 commit comments