@@ -155,6 +155,7 @@ impl<'a> Parser<'a> {
155
155
if self . token . is_range_separator ( ) {
156
156
return self . parse_expr_prefix_range ( attrs) ;
157
157
} else {
158
+ let attrs = self . parse_or_use_outer_attributes ( attrs) ?;
158
159
self . parse_expr_prefix ( attrs) ?
159
160
}
160
161
}
@@ -541,8 +542,7 @@ impl<'a> Parser<'a> {
541
542
}
542
543
543
544
/// Parses a prefix-unary-operator expr.
544
- fn parse_expr_prefix ( & mut self , attrs : Option < AttrWrapper > ) -> PResult < ' a , P < Expr > > {
545
- let attrs = self . parse_or_use_outer_attributes ( attrs) ?;
545
+ fn parse_expr_prefix ( & mut self , attrs : AttrWrapper ) -> PResult < ' a , P < Expr > > {
546
546
let lo = self . token . span ;
547
547
548
548
macro_rules! make_it {
@@ -591,7 +591,8 @@ impl<'a> Parser<'a> {
591
591
this. dcx ( ) . emit_err ( err) ;
592
592
593
593
this. bump ( ) ;
594
- this. parse_expr_prefix ( None )
594
+ let attrs = this. parse_outer_attributes ( ) ?;
595
+ this. parse_expr_prefix ( attrs)
595
596
}
596
597
// Recover from `++x`:
597
598
token:: BinOp ( token:: Plus )
@@ -619,7 +620,8 @@ impl<'a> Parser<'a> {
619
620
620
621
fn parse_expr_prefix_common ( & mut self , lo : Span ) -> PResult < ' a , ( Span , P < Expr > ) > {
621
622
self . bump ( ) ;
622
- let expr = self . parse_expr_prefix ( None ) ?;
623
+ let attrs = self . parse_outer_attributes ( ) ?;
624
+ let expr = self . parse_expr_prefix ( attrs) ?;
623
625
let span = self . interpolated_or_expr_span ( & expr) ;
624
626
Ok ( ( lo. to ( span) , expr) )
625
627
}
@@ -872,7 +874,8 @@ impl<'a> Parser<'a> {
872
874
let expr = if self . token . is_range_separator ( ) {
873
875
self . parse_expr_prefix_range ( None )
874
876
} else {
875
- self . parse_expr_prefix ( None )
877
+ let attrs = self . parse_outer_attributes ( ) ?;
878
+ self . parse_expr_prefix ( attrs)
876
879
} ?;
877
880
let hi = self . interpolated_or_expr_span ( & expr) ;
878
881
let span = lo. to ( hi) ;
0 commit comments