File tree Expand file tree Collapse file tree 2 files changed +3
-18
lines changed
compiler/rustc_parse/src/parser Expand file tree Collapse file tree 2 files changed +3
-18
lines changed Original file line number Diff line number Diff line change @@ -2291,16 +2291,9 @@ impl<'a> Parser<'a> {
22912291 . span_label ( else_span, "expected an `if` or a block after this `else`" )
22922292 . span_suggestion (
22932293 cond. span . shrink_to_lo ( ) ,
2294- "add an `if` if this is the condition to an chained `if` statement after the `else` " ,
2294+ "add an `if` if this is the condition of a chained `else if` statement" ,
22952295 "if " . to_string ( ) ,
22962296 Applicability :: MaybeIncorrect ,
2297- ) . multipart_suggestion (
2298- "... otherwise, place this expression inside of a block if it is not an `if` condition" ,
2299- vec ! [
2300- ( cond. span. shrink_to_lo( ) , "{ " . to_string( ) ) ,
2301- ( cond. span. shrink_to_hi( ) , " }" . to_string( ) ) ,
2302- ] ,
2303- Applicability :: MaybeIncorrect ,
23042297 )
23052298 . emit ( ) ;
23062299 self . parse_if_after_cond ( AttrVec :: new ( ) , cond. span . shrink_to_lo ( ) , cond) ?
Original file line number Diff line number Diff line change @@ -6,14 +6,10 @@ LL | } else false {
66 | |
77 | expected an `if` or a block after this `else`
88 |
9- help: add an `if` if this is the condition to an chained `if` statement after the `else`
9+ help: add an `if` if this is the condition of a chained `else if` statement
1010 |
1111LL | } else if false {
1212 | ++
13- help: ... otherwise, place this expression inside of a block if it is not an `if` condition
14- |
15- LL | } else { false } {
16- | + +
1713
1814error: expected `{`, found `falsy`
1915 --> $DIR/else-no-if.rs:10:12
@@ -23,14 +19,10 @@ LL | } else falsy() {
2319 | |
2420 | expected an `if` or a block after this `else`
2521 |
26- help: add an `if` if this is the condition to an chained `if` statement after the `else`
22+ help: add an `if` if this is the condition of a chained `else if` statement
2723 |
2824LL | } else if falsy() {
2925 | ++
30- help: ... otherwise, place this expression inside of a block if it is not an `if` condition
31- |
32- LL | } else { falsy() } {
33- | + +
3426
3527error: expected `{`, found `falsy`
3628 --> $DIR/else-no-if.rs:17:12
You can’t perform that action at this time.
0 commit comments