Rollup merge of #80923 - LingMan:exits, r=varkor

Merge different function exits

`@rustbot` modify labels +C-cleanup +T-compiler
This commit is contained in:
Yuki Okushi 2021-01-12 07:59:18 +09:00 committed by GitHub
commit 4e69c5d0fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 {