about summary refs log tree commit diff
path: root/compiler/rustc_ast/src/ast.rs
diff options
context:
space:
mode:
authorEsteban Kuber <esteban@kuber.com.ar>2021-09-02 18:34:03 +0000
committerEsteban Kuber <esteban@kuber.com.ar>2021-09-03 14:43:04 +0000
commit12ce6e9c60c662dc7181b70021145f191c0f9f3e (patch)
tree2d25c254eeec0782df8dced3f020e4cff9ef6785 /compiler/rustc_ast/src/ast.rs
parentfcce644119cf4e8e36001368e514bb5ed67cb855 (diff)
downloadrust-12ce6e9c60c662dc7181b70021145f191c0f9f3e.tar.gz
rust-12ce6e9c60c662dc7181b70021145f191c0f9f3e.zip
Detect bare blocks with type ascription that were meant to be a `struct` literal
Address part of #34255.

Potential improvement: silence the other knock down errors in
`issue-34255-1.rs`.
Diffstat (limited to 'compiler/rustc_ast/src/ast.rs')
-rw-r--r--compiler/rustc_ast/src/ast.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/rustc_ast/src/ast.rs b/compiler/rustc_ast/src/ast.rs
index 0632d937c4c..5e154805644 100644
--- a/compiler/rustc_ast/src/ast.rs
+++ b/compiler/rustc_ast/src/ast.rs
@@ -565,6 +565,14 @@ pub struct Block {
     pub rules: BlockCheckMode,
     pub span: Span,
     pub tokens: Option<LazyTokenStream>,
+    /// The following *isn't* a parse error, but will cause multiple errors in following stages.
+    /// ```
+    /// let x = {
+    ///     foo: var
+    /// };
+    /// ```
+    /// #34255
+    pub could_be_bare_literal: bool,
 }
 
 /// A match pattern.