Skip to content

Commit 4e69c5d

Browse files
authored
Rollup merge of #80923 - LingMan:exits, r=varkor
Merge different function exits `@rustbot` modify labels +C-cleanup +T-compiler
2 parents f553a0f + 578da99 commit 4e69c5d

File tree

1 file changed

+2
-7
lines changed
  • compiler/rustc_middle/src/hir/map

1 file changed

+2
-7
lines changed

compiler/rustc_middle/src/hir/map/mod.rs

+2-7
Original file line numberDiff line numberDiff line change
@@ -710,15 +710,10 @@ impl<'hir> Map<'hir> {
710710
let mut scope = id;
711711
loop {
712712
scope = self.get_enclosing_scope(scope).unwrap_or(CRATE_HIR_ID);
713-
if scope == CRATE_HIR_ID {
714-
return CRATE_HIR_ID;
715-
}
716-
match self.get(scope) {
717-
Node::Block(_) => {}
718-
_ => break,
713+
if scope == CRATE_HIR_ID || !matches!(self.get(scope), Node::Block(_)) {
714+
return scope;
719715
}
720716
}
721-
scope
722717
}
723718

724719
pub fn get_parent_did(&self, id: HirId) -> LocalDefId {

0 commit comments

Comments
 (0)