diff options
| author | Ding Xiang Fei <dingxiangfei2009@protonmail.ch> | 2022-09-12 22:50:52 +0800 |
|---|---|---|
| committer | Ding Xiang Fei <dingxiangfei2009@protonmail.ch> | 2022-09-15 10:08:12 +0800 |
| commit | 635b57c2ede8eb311b418104f027ad4fae1ee548 (patch) | |
| tree | 4e62ea43491081d6bdb11bf9583bd065eceb4cd3 | |
| parent | 34f0c4502f6d64724478a5bf73c9ec616c3bde23 (diff) | |
| download | rust-635b57c2ede8eb311b418104f027ad4fae1ee548.tar.gz rust-635b57c2ede8eb311b418104f027ad4fae1ee548.zip | |
enclose else block in terminating scope
| -rw-r--r-- | compiler/rustc_typeck/src/check/region.rs | 1 | ||||
| -rw-r--r-- | src/test/ui/async-await/async-await-let-else.no-drop-tracking.stderr | 3 |
2 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_typeck/src/check/region.rs b/compiler/rustc_typeck/src/check/region.rs index 46ffafc5a61..b89db79bef8 100644 --- a/compiler/rustc_typeck/src/check/region.rs +++ b/compiler/rustc_typeck/src/check/region.rs @@ -144,6 +144,7 @@ fn resolve_block<'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, blk: &'tcx h // the sequence of visits agree with the order in the default // `hir::intravisit` visitor. mem::swap(&mut prev_cx, &mut visitor.cx); + visitor.terminating_scopes.insert(els.hir_id.local_id); visitor.visit_block(els); // From now on, we continue normally. visitor.cx = prev_cx; diff --git a/src/test/ui/async-await/async-await-let-else.no-drop-tracking.stderr b/src/test/ui/async-await/async-await-let-else.no-drop-tracking.stderr index 0058f7016dc..7f93563e288 100644 --- a/src/test/ui/async-await/async-await-let-else.no-drop-tracking.stderr +++ b/src/test/ui/async-await/async-await-let-else.no-drop-tracking.stderr @@ -35,8 +35,7 @@ LL | bar2(Rc::new(())).await | | | has type `Rc<()>` which is not `Send` LL | }; -LL | } - | - `Rc::new(())` is later dropped here + | - `Rc::new(())` is later dropped here note: required by a bound in `is_send` --> $DIR/async-await-let-else.rs:19:15 | |
