diff options
| author | Yuki Okushi <huyuumi.dev@gmail.com> | 2021-01-12 07:59:18 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-12 07:59:18 +0900 |
| commit | 4e69c5d0fad5877e3db28a94fbf6185f1f536cb6 (patch) | |
| tree | 6ad933096da9044b38741696e96f494997a62fa8 | |
| parent | f553a0fe59bb64c436197f4a80837c68d5bec475 (diff) | |
| parent | 578da998afd116be69fe4e518a6279dcb18321d7 (diff) | |
| download | rust-4e69c5d0fad5877e3db28a94fbf6185f1f536cb6.tar.gz rust-4e69c5d0fad5877e3db28a94fbf6185f1f536cb6.zip | |
Rollup merge of #80923 - LingMan:exits, r=varkor
Merge different function exits `@rustbot` modify labels +C-cleanup +T-compiler
| -rw-r--r-- | compiler/rustc_middle/src/hir/map/mod.rs | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/compiler/rustc_middle/src/hir/map/mod.rs b/compiler/rustc_middle/src/hir/map/mod.rs index c2e99224d8b..eb6aded9cb3 100644 --- a/compiler/rustc_middle/src/hir/map/mod.rs +++ b/compiler/rustc_middle/src/hir/map/mod.rs @@ -710,15 +710,10 @@ impl<'hir> Map<'hir> { let mut scope = id; loop { scope = self.get_enclosing_scope(scope).unwrap_or(CRATE_HIR_ID); - if scope == CRATE_HIR_ID { - return CRATE_HIR_ID; - } - match self.get(scope) { - Node::Block(_) => {} - _ => break, + if scope == CRATE_HIR_ID || !matches!(self.get(scope), Node::Block(_)) { + return scope; } } - scope } pub fn get_parent_did(&self, id: HirId) -> LocalDefId { |
