Skip to content

Commit f41b48a

Browse files
matthewjasperpietroalbini
authored andcommitted
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.
1 parent 6b4e297 commit f41b48a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/librustc_typeck/check/wfcheck.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -343,8 +343,8 @@ fn check_item_fn<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item: &hir::Item) {
343343
fn check_item_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item_id: ast::NodeId, ty_span: Span) {
344344
debug!("check_item_type: {:?}", item_id);
345345

346-
for_id(tcx, item_id, ty_span).with_fcx(|fcx, _this| {
347-
let ty = fcx.tcx.type_of(fcx.tcx.hir.local_def_id(item_id));
346+
for_id(tcx, item_id, ty_span).with_fcx(|fcx, gcx| {
347+
let ty = gcx.type_of(gcx.hir.local_def_id(item_id));
348348
let item_ty = fcx.normalize_associated_types_in(ty_span, &ty);
349349

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

0 commit comments

Comments
 (0)