Skip to content

Commit

Permalink
Add comment pointing to test
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewhickman committed Sep 11, 2021
1 parent d6ce326 commit 43b79d8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions compiler/rustc_typeck/src/check/op.rs
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
if let Some(sp) =
self.tcx.sess.parse_sess.ambiguous_block_expr_parse.borrow().get(&sp)
{
// If the previous expression was a block expression, suggest parentheses
// (turning this into a binary subtraction operation instead.)
// for example, `{2} - 2` -> `({2}) - 2` (see src\test\ui\parser\expr-as-stmt.rs)
self.tcx.sess.parse_sess.expr_parentheses_needed(&mut err, *sp);
} else {
match actual.kind() {
Expand Down

0 comments on commit 43b79d8

Please sign in to comment.