From 080ee041e4372a4dec0848e8838bfd2ab019a629 Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Mon, 3 Oct 2016 09:49:17 -0700 Subject: [PATCH] Revise long diagnostic --- src/librustc/diagnostics.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/librustc/diagnostics.rs b/src/librustc/diagnostics.rs index f43cbb2696df..142f8f5c719c 100644 --- a/src/librustc/diagnostics.rs +++ b/src/librustc/diagnostics.rs @@ -1432,8 +1432,9 @@ fn make_child<'elve>(x: &mut &'elve isize, y: &mut &'elve isize) { "##, E0317: r##" -An `if` expression without an `else` block is required to have the type `()`. -This error occurs when the `if` block has a type other than `()`. For example: +This error occurs when an `if` expression without an `else` block is used in a +context where a type other than `()` is expected, for example a `let` +expression: ```compile_fail,E0317 fn main() { @@ -1442,8 +1443,9 @@ fn main() { } ``` -To resolve this error, either add an `else` block having the same type as the -`if` block, or adjust the `if` block so that it has the type `()`. +An `if` expression without an `else` block has the type `()`, so this is a type +error. To resolve it, add an `else` block having the same type as the `if` +block. "##, E0398: r##"