From db171649d3e2298859740d164f92e99c8bd3cf4b Mon Sep 17 00:00:00 2001 From: ljedrz Date: Tue, 2 Oct 2018 11:00:11 +0200 Subject: [PATCH] rustc/ty: calculate span after a possible early continue --- src/librustc/ty/util.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustc/ty/util.rs b/src/librustc/ty/util.rs index 4e2c9cceab63..e4141211a4fe 100644 --- a/src/librustc/ty/util.rs +++ b/src/librustc/ty/util.rs @@ -205,11 +205,11 @@ impl<'tcx> ty::ParamEnv<'tcx> { let mut infringing = Vec::new(); for variant in &adt.variants { for field in &variant.fields { - let span = tcx.def_span(field.did); let ty = field.ty(tcx, substs); if ty.references_error() { continue; } + let span = tcx.def_span(field.did); let cause = ObligationCause { span, ..ObligationCause::dummy() }; let ctx = traits::FulfillmentContext::new(); match traits::fully_normalize(&infcx, ctx, cause, self, &ty) {