Skip to content

Commit c3c7223

Browse files
committed
Remove incorrect assert in trans
As an optimization, once unboxed closures receive their environment by value if it fits within the size of an `int`. An assert in this code path assumed that this would only occur if the environment had no more than a single free variable in it, but multiple smaller free variables can easily be packed into the space of an `int`, particularly if any of them are 0-sized. The assert can simply be removed. Closes #18652
1 parent b03a275 commit c3c7223

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

src/librustc/middle/trans/closure.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,6 @@ fn load_unboxed_closure_environment<'blk, 'tcx>(
322322
self_type,
323323
"unboxed_closure_env");
324324
store_ty(bcx, bcx.fcx.llenv.unwrap(), datum.val, self_type);
325-
assert!(freevars.len() <= 1);
326325
datum.val
327326
} else {
328327
bcx.fcx.llenv.unwrap()

0 commit comments

Comments
 (0)