File tree Expand file tree Collapse file tree 2 files changed +3
-1
lines changed Expand file tree Collapse file tree 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> {
134134 }
135135
136136 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 ) ) {
138138 let msg = "removing an expression is not supported in this position" ;
139139 self . diag . diag . span_err ( attr. span , msg) ;
140140 }
Original file line number Diff line number Diff line change @@ -17,4 +17,6 @@ fn main() {
1717 //~^ ERROR removing an expression is not supported in this position
1818 let _ = [ 1 , 2 , 3 ] [ #[ cfg ( unset) ] 1 ] ;
1919 //~^ ERROR removing an expression is not supported in this position
20+ let _ = #[ test] ( ) ;
21+ //~^ ERROR removing an expression is not supported in this position
2022}
You can’t perform that action at this time.
0 commit comments