about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-06-27 17:48:45 +0200
committerGitHub <noreply@github.com>2023-06-27 17:48:45 +0200
commite992895c1d1d401406590fbe01122569b9cc1b42 (patch)
treeb60f03586e8b5b40f61b9f3360885149f84e9d80 /compiler/rustc_parse/src/parser
parent9f2c21c11f0cf8762b66675024c9d1041dbcc219 (diff)
parent2cc7782cfd85a2c4dc2fa566fae4d4e356976471 (diff)
downloadrust-e992895c1d1d401406590fbe01122569b9cc1b42.tar.gz
rust-e992895c1d1d401406590fbe01122569b9cc1b42.zip
Rollup merge of #112978 - compiler-errors:bad-block-sugg, r=davidtwco
Add suggestion for bad block fragment error

Makes it a bit clearer how to fix this parser restriction
Diffstat (limited to 'compiler/rustc_parse/src/parser')
-rw-r--r--compiler/rustc_parse/src/parser/expr.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs
index 5f2f86e8113..7ede4fbc3d9 100644
--- a/compiler/rustc_parse/src/parser/expr.rs
+++ b/compiler/rustc_parse/src/parser/expr.rs
@@ -2192,6 +2192,10 @@ impl<'a> Parser<'a> {
             self.sess.emit_err(errors::InvalidBlockMacroSegment {
                 span: self.token.span,
                 context: lo.to(self.token.span),
+                wrap: errors::WrapInExplicitBlock {
+                    lo: self.token.span.shrink_to_lo(),
+                    hi: self.token.span.shrink_to_hi(),
+                },
             });
         }