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 authored and pietroalbini committed Dec 4, 2018
1 parent 6b4e297 commit f41b48a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/librustc_typeck/check/wfcheck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,8 @@ fn check_item_fn<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item: &hir::Item) {
fn check_item_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item_id: ast::NodeId, ty_span: Span) {
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);

fcx.register_wf_obligation(item_ty, ty_span, ObligationCauseCode::MiscObligation);
Expand Down

0 comments on commit f41b48a

Please sign in to comment.