Skip to content

Commit 0460841

Browse files
committed
Properly visit nested functions and closures in check_rvalues
This correctly catches moves of unsized values in nested functions and closures. Closes issue #17651
1 parent 86509d8 commit 0460841

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/librustc/middle/check_rvalues.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,16 @@ struct RvalueContext<'a, 'tcx: 'a> {
3232

3333
impl<'a, 'tcx, 'v> visit::Visitor<'v> for RvalueContext<'a, 'tcx> {
3434
fn visit_fn(&mut self,
35-
_: visit::FnKind<'v>,
35+
fk: visit::FnKind<'v>,
3636
fd: &'v ast::FnDecl,
3737
b: &'v ast::Block,
38-
_: Span,
38+
s: Span,
3939
_: ast::NodeId) {
40-
let mut euv = euv::ExprUseVisitor::new(self, self.tcx);
41-
euv.walk_fn(fd, b);
40+
{
41+
let mut euv = euv::ExprUseVisitor::new(self, self.tcx);
42+
euv.walk_fn(fd, b);
43+
}
44+
visit::walk_fn(self, fk, fd, b, s)
4245
}
4346
}
4447

0 commit comments

Comments
 (0)