File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,14 @@ pub enum Item {
1818impl Parse for Item {
1919 fn parse ( input : ParseStream ) -> Result < Self > {
2020 let attrs = input. call ( Attribute :: parse_outer) ?;
21- let lookahead = input. lookahead1 ( ) ;
21+ let first_lookahead = input. lookahead1 ( ) ;
22+ let lookahead = if first_lookahead. peek ( Token ! [ unsafe ] ) {
23+ let ahead = input. fork ( ) ;
24+ ahead. parse :: < Token ! [ unsafe ] > ( ) ?;
25+ ahead. lookahead1 ( )
26+ } else {
27+ first_lookahead
28+ } ;
2229 if lookahead. peek ( Token ! [ pub ] ) || lookahead. peek ( Token ! [ trait ] ) {
2330 let mut item: ItemTrait = input. parse ( ) ?;
2431 item. attrs = attrs;
Original file line number Diff line number Diff line change @@ -360,3 +360,16 @@ pub mod issue31 {
360360 }
361361 }
362362}
363+
364+
365+ #[ async_trait]
366+ pub unsafe trait UnsafeTrait { }
367+
368+ #[ async_trait]
369+ unsafe impl UnsafeTrait for ( ) { }
370+
371+ #[ async_trait]
372+ pub ( crate ) unsafe trait UnsafeTraitPubCrate { }
373+
374+ #[ async_trait]
375+ unsafe trait UnsafeTraitPrivate { }
You can’t perform that action at this time.
0 commit comments