Skip to content

Commit 5caebb2

Browse files
author
Jorge Aparicio
committed
Tell regionck that user unops are by value
1 parent b98c3bd commit 5caebb2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/librustc_typeck/check/regionck.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -682,10 +682,12 @@ fn visit_expr(rcx: &mut Rcx, expr: &ast::Expr) {
682682
visit::walk_expr(rcx, expr);
683683
}
684684

685-
ast::ExprUnary(_, ref lhs) if has_method_map => {
685+
ast::ExprUnary(op, ref lhs) if has_method_map => {
686+
let implicitly_ref_args = !ast_util::is_by_value_unop(op);
687+
686688
// As above.
687689
constrain_call(rcx, expr, Some(&**lhs),
688-
None::<ast::Expr>.iter(), true);
690+
None::<ast::Expr>.iter(), implicitly_ref_args);
689691

690692
visit::walk_expr(rcx, expr);
691693
}

0 commit comments

Comments
 (0)