rustc: combine partial_def_map and last_private_map into def_map.

This commit is contained in:
Eduard Burtescu 2015-02-17 06:44:23 +02:00
parent 06f362aeb3
commit 5a6a9ed792
38 changed files with 442 additions and 447 deletions

View file

@ -610,32 +610,24 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
fn find_scope(&self,
expr: &ast::Expr,
label: Option<ast::Ident>) -> LoopScope {
match label {
None => {
return *self.loop_scopes.last().unwrap();
}
if label.is_none() {
return *self.loop_scopes.last().unwrap();
}
Some(_) => {
match self.tcx.def_map.borrow().get(&expr.id) {
Some(&def::DefLabel(loop_id)) => {
for l in &self.loop_scopes {
if l.loop_id == loop_id {
return *l;
}
}
self.tcx.sess.span_bug(
expr.span,
&format!("no loop scope for id {}",
loop_id));
}
r => {
self.tcx.sess.span_bug(
expr.span,
&format!("bad entry `{:?}` in def_map for label",
r));
match self.tcx.def_map.borrow().get(&expr.id).map(|d| d.full_def()) {
Some(def::DefLabel(loop_id)) => {
for l in &self.loop_scopes {
if l.loop_id == loop_id {
return *l;
}
}
self.tcx.sess.span_bug(expr.span,
&format!("no loop scope for id {}", loop_id));
}
r => {
self.tcx.sess.span_bug(expr.span,
&format!("bad entry `{:?}` in def_map for label", r));
}
}
}