diff options
| author | Andrew Hickman <andrew.hickman1@sky.com> | 2021-09-11 10:08:11 +0100 |
|---|---|---|
| committer | Andrew Hickman <andrew.hickman1@sky.com> | 2021-09-11 10:17:06 +0100 |
| commit | 43b79d8ef5e1967a7ea476b757256d62fdbb3ebf (patch) | |
| tree | da6f1201a8983b43f5be10f0bb2743c5f765b937 | |
| parent | d6ce3269b4031a8c8fb0fab7710bad7165642fcf (diff) | |
| download | rust-43b79d8ef5e1967a7ea476b757256d62fdbb3ebf.tar.gz rust-43b79d8ef5e1967a7ea476b757256d62fdbb3ebf.zip | |
Add comment pointing to test
| -rw-r--r-- | compiler/rustc_typeck/src/check/op.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/rustc_typeck/src/check/op.rs b/compiler/rustc_typeck/src/check/op.rs index bc5587af3ef..a574a63d63b 100644 --- a/compiler/rustc_typeck/src/check/op.rs +++ b/compiler/rustc_typeck/src/check/op.rs @@ -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() { |
