about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthew Jasper <mjjasper1@gmail.com>2018-12-04 19:14:13 +0000
committerMatthew Jasper <mjjasper1@gmail.com>2018-12-04 19:52:47 +0000
commitb2e6da7a7f8e3a82a48b0e3d6cb7912d2e31e758 (patch)
tree905c06c69191bf183510287d0fcea1db199882ad
parentd7487125211dbc63557d9288d07b45535a4709a7 (diff)
downloadrust-b2e6da7a7f8e3a82a48b0e3d6cb7912d2e31e758.tar.gz
rust-b2e6da7a7f8e3a82a48b0e3d6cb7912d2e31e758.zip
Call methods on the right tcx
There are two `TyCtxt`s, one global, one local. Methods must be called
on the right one, as they differ by invariant lifetimes.
-rw-r--r--src/librustc_typeck/check/wfcheck.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs
index b5addbd18d2..e5fe74f2305 100644
--- a/src/librustc_typeck/check/wfcheck.rs
+++ b/src/librustc_typeck/check/wfcheck.rs
@@ -355,13 +355,13 @@ fn check_item_type<'a, 'tcx>(
 ) {
     debug!("check_item_type: {:?}", item_id);
 
-    for_id(tcx, item_id, ty_span).with_fcx(|fcx, _this| {
-        let ty = fcx.tcx.type_of(fcx.tcx.hir.local_def_id(item_id));
+    for_id(tcx, item_id, ty_span).with_fcx(|fcx, gcx| {
+        let ty = gcx.type_of(gcx.hir.local_def_id(item_id));
         let item_ty = fcx.normalize_associated_types_in(ty_span, &ty);
 
         let mut forbid_unsized = true;
         if allow_foreign_ty {
-            if let TyKind::Foreign(_) = tcx.struct_tail(item_ty).sty {
+            if let TyKind::Foreign(_) = fcx.tcx.struct_tail(item_ty).sty {
                 forbid_unsized = false;
             }
         }