Rollup merge of #80923 - LingMan:exits, r=varkor
Merge different function exits `@rustbot` modify labels +C-cleanup +T-compiler
This commit is contained in:
commit
4e69c5d0fa
@ -710,15 +710,10 @@ pub fn get_defining_scope(&self, id: HirId) -> HirId {
|
|||||||
let mut scope = id;
|
let mut scope = id;
|
||||||
loop {
|
loop {
|
||||||
scope = self.get_enclosing_scope(scope).unwrap_or(CRATE_HIR_ID);
|
scope = self.get_enclosing_scope(scope).unwrap_or(CRATE_HIR_ID);
|
||||||
if scope == CRATE_HIR_ID {
|
if scope == CRATE_HIR_ID || !matches!(self.get(scope), Node::Block(_)) {
|
||||||
return CRATE_HIR_ID;
|
return scope;
|
||||||
}
|
|
||||||
match self.get(scope) {
|
|
||||||
Node::Block(_) => {}
|
|
||||||
_ => break,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
scope
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_parent_did(&self, id: HirId) -> LocalDefId {
|
pub fn get_parent_did(&self, id: HirId) -> LocalDefId {
|
||||||
|
Loading…
Reference in New Issue
Block a user