@@ -150,6 +150,7 @@ ast_struct! {
150
150
#[ cfg_attr( doc_cfg, doc( cfg( feature = "full" ) ) ) ]
151
151
pub struct ItemForeignMod {
152
152
pub attrs: Vec <Attribute >,
153
+ pub unsafety: Option <Token ![ unsafe ] >,
153
154
pub abi: Abi ,
154
155
pub brace_token: token:: Brace ,
155
156
pub items: Vec <ForeignItem >,
@@ -1620,6 +1621,7 @@ pub mod parsing {
1620
1621
impl Parse for ItemForeignMod {
1621
1622
fn parse ( input : ParseStream ) -> Result < Self > {
1622
1623
let outer_attrs = input. call ( Attribute :: parse_outer) ?;
1624
+ let unsafety = input. parse ( ) ?;
1623
1625
let abi: Abi = input. parse ( ) ?;
1624
1626
1625
1627
let content;
@@ -1632,6 +1634,7 @@ pub mod parsing {
1632
1634
1633
1635
Ok ( ItemForeignMod {
1634
1636
attrs : private:: attrs ( outer_attrs, inner_attrs) ,
1637
+ unsafety,
1635
1638
abi,
1636
1639
brace_token,
1637
1640
items,
@@ -2775,6 +2778,7 @@ mod printing {
2775
2778
impl ToTokens for ItemForeignMod {
2776
2779
fn to_tokens ( & self , tokens : & mut TokenStream ) {
2777
2780
tokens. append_all ( self . attrs . outer ( ) ) ;
2781
+ self . unsafety . to_tokens ( tokens) ;
2778
2782
self . abi . to_tokens ( tokens) ;
2779
2783
self . brace_token . surround ( tokens, |tokens| {
2780
2784
tokens. append_all ( self . attrs . inner ( ) ) ;
0 commit comments