Skip to content

Commit

Permalink
Rollup merge of rust-lang#48682 - spastorino:make_causal_lazy, r=niko…
Browse files Browse the repository at this point in the history
…matsakis

[NLL] Make causal tracking lazy

Close rust-lang#46590

cc @nikomatsakis
  • Loading branch information
Manishearth authored Mar 8, 2018
2 parents f12d5aa + 52a47d4 commit d7f44ac
Show file tree
Hide file tree
Showing 33 changed files with 1,255 additions and 860 deletions.
19 changes: 16 additions & 3 deletions src/librustc/infer/error_reporting/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
self.explain_span(scope_decorated_tag, span)
}

ty::ReEarlyBound(_) | ty::ReFree(_) => self.msg_span_from_free_region(region),

ty::ReStatic => ("the static lifetime".to_owned(), None),
ty::ReEarlyBound(_) | ty::ReFree(_) | ty::ReStatic => {
self.msg_span_from_free_region(region)
}

ty::ReEmpty => ("the empty lifetime".to_owned(), None),

Expand Down Expand Up @@ -175,6 +175,19 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
}

fn msg_span_from_free_region(self, region: ty::Region<'tcx>) -> (String, Option<Span>) {
match *region {
ty::ReEarlyBound(_) | ty::ReFree(_) => {
self.msg_span_from_early_bound_and_free_regions(region)
},
ty::ReStatic => ("the static lifetime".to_owned(), None),
_ => bug!(),
}
}

fn msg_span_from_early_bound_and_free_regions(
self,
region: ty::Region<'tcx>,
) -> (String, Option<Span>) {
let scope = region.free_region_binding_scope(self);
let node = self.hir.as_local_node_id(scope).unwrap_or(DUMMY_NODE_ID);
let unknown;
Expand Down
Loading

0 comments on commit d7f44ac

Please sign in to comment.