File tree 2 files changed +3
-1
lines changed
2 files changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -134,7 +134,7 @@ impl<'a> CfgFolder for StripUnconfigured<'a> {
134
134
}
135
135
136
136
fn visit_unremovable_expr ( & mut self , expr : & ast:: Expr ) {
137
- if let Some ( attr) = expr. attrs ( ) . iter ( ) . find ( |a| is_cfg ( a) ) {
137
+ if let Some ( attr) = expr. attrs ( ) . iter ( ) . find ( |a| is_cfg ( a) || is_test_or_bench ( a ) ) {
138
138
let msg = "removing an expression is not supported in this position" ;
139
139
self . diag . diag . span_err ( attr. span , msg) ;
140
140
}
Original file line number Diff line number Diff line change @@ -17,4 +17,6 @@ fn main() {
17
17
//~^ ERROR removing an expression is not supported in this position
18
18
let _ = [ 1 , 2 , 3 ] [ #[ cfg ( unset) ] 1 ] ;
19
19
//~^ ERROR removing an expression is not supported in this position
20
+ let _ = #[ test] ( ) ;
21
+ //~^ ERROR removing an expression is not supported in this position
20
22
}
You can’t perform that action at this time.
0 commit comments