Skip to content

Commit

Permalink
Call methods on the right tcx
Browse files Browse the repository at this point in the history
There are two `TyCtxt`s, one global, one local. Methods must be called
on the right one, as they differ by invariant lifetimes.
  • Loading branch information
matthewjasper committed Dec 4, 2018
1 parent d748712 commit b2e6da7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/librustc_typeck/check/wfcheck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit b2e6da7

Please sign in to comment.