diff options
| author | bors <bors@rust-lang.org> | 2019-07-06 06:15:44 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-07-06 06:15:44 +0000 |
| commit | 254f2014954bd66da206232490824975c0c662f1 (patch) | |
| tree | 0692cdd08d580f827d1ee5b7837cf2a2f3c4ce52 /src/libsyntax_pos | |
| parent | b820c761744db080ff7a4ba3ac88d259065cb836 (diff) | |
| parent | 9b1d513e47b22180f5b73f64bb97ef7390efe7a0 (diff) | |
| download | rust-254f2014954bd66da206232490824975c0c662f1.tar.gz rust-254f2014954bd66da206232490824975c0c662f1.zip | |
Auto merge of #61988 - Centril:there-is-only-loop, r=matthewjasper
[let_chains, 3/6] And then there was only Loop
Here we remove `hir::ExprKind::While`.
Instead, we desugar: `'label: while $cond $body` into:
```rust
'label: loop {
match DropTemps($cond) {
true => $body,
_ => break,
}
}
```
Per https://github.com/rust-lang/rust/issues/53667#issuecomment-471583239.
This is a follow up to https://github.com/rust-lang/rust/pull/59288 which did the same for `if` expressions.
r? @matthewjasper
Diffstat (limited to 'src/libsyntax_pos')
| -rw-r--r-- | src/libsyntax_pos/hygiene.rs | 5 |
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 => "?", |
