From b2e6da7a7f8e3a82a48b0e3d6cb7912d2e31e758 Mon Sep 17 00:00:00 2001 From: Matthew Jasper Date: Tue, 4 Dec 2018 19:14:13 +0000 Subject: [PATCH] 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. --- src/librustc_typeck/check/wfcheck.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs index b5addbd18d2a4..e5fe74f23056f 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; } }