hir: Cx<'a, 'tcx>,
cfg: CFG<'tcx>,
+ fn_span: Span,
+
// the current set of scopes, updated as we traverse;
// see the `scope` module for more details
scopes: Vec<scope::Scope<'tcx>>,
let mut builder = Builder {
hir: hir,
cfg: cfg,
+ fn_span: span,
scopes: vec![],
scope_data_vec: ScopeDataVec::new(),
scope_auxiliary: vec![],
// generate B0 <- B1 <- B2 in left-to-right order. Control flow of the generated blocks
// always ends up at a block with the Resume terminator.
if scopes.iter().any(|scope| !scope.drops.is_empty() || scope.free.is_some()) {
- Some(build_diverge_scope(hir.tcx(), cfg, &unit_temp, scopes))
+ Some(build_diverge_scope(hir.tcx(), self.fn_span, cfg, &unit_temp, scopes))
} else {
None
}
}
fn build_diverge_scope<'tcx>(tcx: &TyCtxt<'tcx>,
+ fn_span: Span,
cfg: &mut CFG<'tcx>,
unit_temp: &Lvalue<'tcx>,
scopes: &mut [Scope<'tcx>])
// Diverging from the root scope creates a RESUME terminator.
// FIXME what span to use here?
let resumeblk = cfg.start_new_cleanup_block();
- cfg.terminate(resumeblk, scope.id, DUMMY_SP, TerminatorKind::Resume);
+ cfg.terminate(resumeblk, scope.id, fn_span, TerminatorKind::Resume);
resumeblk
} else {
// Diverging from any other scope chains up to the previous scope.
- build_diverge_scope(tcx, cfg, unit_temp, earlier_scopes)
+ build_diverge_scope(tcx, fn_span, cfg, unit_temp, earlier_scopes)
};
scope.cached_block = Some(target);