]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_typeck/check/closure.rs
rustc_typeck: do not leak late-bound lifetimes from bounds to closures.
[rust.git] / src / librustc_typeck / check / closure.rs
index 9eca2b96d62ab1dc124f4a63ee995f8ce544dc67..9e4a7ed1ddc68193e64e3a75086632f430cbef36 100644 (file)
@@ -60,6 +60,9 @@ fn check_closure(&self,
                                          decl,
                                          Abi::RustCall,
                                          expected_sig);
+        // `deduce_expectations_from_expected_type` introduces late-bound
+        // lifetimes defined elsewhere, which we need to anonymize away.
+        let sig = self.tcx.anonymize_late_bound_regions(&sig);
 
         // Create type variables (for now) to represent the transformed
         // types of upvars. These will be unified during the upvar