]> git.lizzy.rs Git - rust.git/commitdiff
rustc/ty: calculate span after a possible early continue
authorljedrz <ljedrz@gmail.com>
Tue, 2 Oct 2018 09:00:11 +0000 (11:00 +0200)
committerljedrz <ljedrz@gmail.com>
Wed, 3 Oct 2018 07:04:02 +0000 (09:04 +0200)
src/librustc/ty/util.rs

index 4e2c9cceab6344e8f89231c319e75a381315d426..e4141211a4fe521bde857592de08ca0d80d327ef 100644 (file)
@@ -205,11 +205,11 @@ pub fn can_type_implement_copy<'a>(self,
             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) {