]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc/ty/mod.rs
rustc_typeck: do not leak late-bound lifetimes from bounds to closures.
[rust.git] / src / librustc / ty / mod.rs
index 99ee4e41d1de384a5f6cc7ddc0c9128dd6128ff9..8ccaf0622d7a109adc7747c30012f86074e21c22 100644 (file)
@@ -2386,11 +2386,11 @@ pub fn empty_parameter_environment(self) -> ParameterEnvironment<'tcx> {
     /// free parameters. Since we currently represent bound/free type
     /// parameters in the same way, this only has an effect on regions.
     pub fn construct_free_substs(self, def_id: DefId) -> &'gcx Substs<'gcx> {
-
+        let scope = self.closure_base_def_id(def_id);
         let substs = Substs::for_item(self.global_tcx(), def_id, |def, _| {
             // map bound 'a => free 'a
             self.global_tcx().mk_region(ReFree(FreeRegion {
-                scope: def_id,
+                scope,
                 bound_region: def.to_bound_region()
             }))
         }, |def, _| {