]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc/middle/traits/select.rs
rollup merge of #21353: sanxiyn/upvar
[rust.git] / src / librustc / middle / traits / select.rs
index 1c341df85cb9840e6f84c37d09c736b32457c015..5323a32243642cf7c5a6fe434763d9fc680253d4 100644 (file)
@@ -1549,6 +1549,14 @@ fn builtin_bound(&mut self,
                     return Ok(ParameterBuiltin);
                 }
 
+                // Upvars are always local variables or references to
+                // local variables, and local variables cannot be
+                // unsized, so the closure struct as a whole must be
+                // Sized.
+                if bound == ty::BoundSized {
+                    return Ok(If(Vec::new()));
+                }
+
                 match self.closure_typer.closure_upvars(def_id, substs) {
                     Some(upvars) => {
                         Ok(If(upvars.iter().map(|c| c.ty).collect()))