Skip to content

Commit 080ee04

Browse files
committed
Revise long diagnostic
1 parent 71f9e2e commit 080ee04

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/librustc/diagnostics.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -1432,8 +1432,9 @@ fn make_child<'elve>(x: &mut &'elve isize, y: &mut &'elve isize) {
14321432
"##,
14331433

14341434
E0317: r##"
1435-
An `if` expression without an `else` block is required to have the type `()`.
1436-
This error occurs when the `if` block has a type other than `()`. For example:
1435+
This error occurs when an `if` expression without an `else` block is used in a
1436+
context where a type other than `()` is expected, for example a `let`
1437+
expression:
14371438
14381439
```compile_fail,E0317
14391440
fn main() {
@@ -1442,8 +1443,9 @@ fn main() {
14421443
}
14431444
```
14441445
1445-
To resolve this error, either add an `else` block having the same type as the
1446-
`if` block, or adjust the `if` block so that it has the type `()`.
1446+
An `if` expression without an `else` block has the type `()`, so this is a type
1447+
error. To resolve it, add an `else` block having the same type as the `if`
1448+
block.
14471449
"##,
14481450

14491451
E0398: r##"

0 commit comments

Comments
 (0)