about summary refs log tree commit diff
path: root/src/libsyntax_pos
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-06-20 10:29:42 +0200
committerMazdak Farrokhzad <twingoow@gmail.com>2019-07-06 06:43:58 +0200
commit4edfa6d4c90550d20c66fbb79223939e114edf73 (patch)
tree84e1583c647ee86e01ce231d1e8f7bde492bbf0e /src/libsyntax_pos
parente7b544ee836831b1b469f62816ab965b2790351c (diff)
downloadrust-4edfa6d4c90550d20c66fbb79223939e114edf73.tar.gz
rust-4edfa6d4c90550d20c66fbb79223939e114edf73.zip
Enforce 'cond: bool' in while-expr + improve reachability diags.
Diffstat (limited to 'src/libsyntax_pos')
-rw-r--r--src/libsyntax_pos/hygiene.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libsyntax_pos/hygiene.rs b/src/libsyntax_pos/hygiene.rs
index 4dbd4ccda91..a6c8c76cf23 100644
--- a/src/libsyntax_pos/hygiene.rs
+++ b/src/libsyntax_pos/hygiene.rs
@@ -723,7 +723,8 @@ pub enum CompilerDesugaringKind {
     /// We desugar `if c { i } else { e }` to `match $ExprKind::Use(c) { true => i, _ => e }`.
     /// However, we do not want to blame `c` for unreachability but rather say that `i`
     /// is unreachable. This desugaring kind allows us to avoid blaming `c`.
-    IfTemporary,
+    /// This also applies to `while` loops.
+    CondTemporary,
     QuestionMark,
     TryBlock,
     /// Desugaring of an `impl Trait` in return type position
@@ -738,7 +739,7 @@ pub enum CompilerDesugaringKind {
 impl CompilerDesugaringKind {
     pub fn name(self) -> Symbol {
         Symbol::intern(match self {
-            CompilerDesugaringKind::IfTemporary => "if",
+            CompilerDesugaringKind::CondTemporary => "if and while condition",
             CompilerDesugaringKind::Async => "async",
             CompilerDesugaringKind::Await => "await",
             CompilerDesugaringKind::QuestionMark => "?",