Skip to content

Commit 43b79d8

Browse files
committed
Add comment pointing to test
1 parent d6ce326 commit 43b79d8

File tree

1 file changed

+3
-0
lines changed
  • compiler/rustc_typeck/src/check

1 file changed

+3
-0
lines changed

compiler/rustc_typeck/src/check/op.rs

+3
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
685685
if let Some(sp) =
686686
self.tcx.sess.parse_sess.ambiguous_block_expr_parse.borrow().get(&sp)
687687
{
688+
// If the previous expression was a block expression, suggest parentheses
689+
// (turning this into a binary subtraction operation instead.)
690+
// for example, `{2} - 2` -> `({2}) - 2` (see src\test\ui\parser\expr-as-stmt.rs)
688691
self.tcx.sess.parse_sess.expr_parentheses_needed(&mut err, *sp);
689692
} else {
690693
match actual.kind() {

0 commit comments

Comments
 (0)