about summary refs log tree commit diff
path: root/src/librustc_borrowck
diff options
context:
space:
mode:
authorEduard-Mihai Burtescu <edy.burt@gmail.com>2017-08-30 02:39:06 +0300
committerEduard-Mihai Burtescu <edy.burt@gmail.com>2017-09-01 11:17:03 +0300
commitea6aca7726bd035ae79fc4643f863178c8f26e90 (patch)
tree009389c2e2d9347c66b28c13016bbed40122d923 /src/librustc_borrowck
parent28ddd7a4ef30a89091dbf48cae18f571326510fb (diff)
downloadrust-ea6aca7726bd035ae79fc4643f863178c8f26e90.tar.gz
rust-ea6aca7726bd035ae79fc4643f863178c8f26e90.zip
rustc: take TyCtxt and RegionMaps in CodeMap::span.
Diffstat (limited to 'src/librustc_borrowck')
-rw-r--r--src/librustc_borrowck/borrowck/mod.rs13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/librustc_borrowck/borrowck/mod.rs b/src/librustc_borrowck/borrowck/mod.rs
index 0b62da306db..e4384935e37 100644
--- a/src/librustc_borrowck/borrowck/mod.rs
+++ b/src/librustc_borrowck/borrowck/mod.rs
@@ -943,6 +943,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
                             }
                             None => {
                                 self.tcx.note_and_explain_region(
+                                    &self.region_maps,
                                     &mut db,
                                     "borrowed value must be valid for ",
                                     sub_scope,
@@ -955,6 +956,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
                             }
                             None => {
                                 self.tcx.note_and_explain_region(
+                                    &self.region_maps,
                                     &mut db,
                                     "...but borrowed value is only valid for ",
                                     super_scope,
@@ -984,12 +986,14 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
                     None => self.cmt_to_string(&err.cmt),
                 };
                 self.tcx.note_and_explain_region(
+                    &self.region_maps,
                     &mut db,
                     &format!("{} would have to be valid for ",
                             descr),
                     loan_scope,
                     "...");
                 self.tcx.note_and_explain_region(
+                    &self.region_maps,
                     &mut db,
                     &format!("...but {} is only valid for ", descr),
                     ptr_scope,
@@ -1245,14 +1249,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
     fn region_end_span(&self, region: ty::Region<'tcx>) -> Option<Span> {
         match *region {
             ty::ReScope(scope) => {
-                match scope.span(&self.tcx.hir) {
-                    Some(s) => {
-                        Some(s.end_point())
-                    }
-                    None => {
-                        None
-                    }
-                }
+                Some(scope.span(self.tcx, &self.region_maps).end_point())
             }
             _ => None
         }