diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2019-04-22 19:37:23 -0700 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2019-04-29 14:07:02 -0700 |
| commit | f007e6f442adafae3e5f2f7f635dc12463bbe0bb (patch) | |
| tree | 7b48de502fcceeefbb8b6767455aa1d7248e4c3e /src/libsyntax/parse/lexer/mod.rs | |
| parent | a55c2eb325029960991508e64650a139b040d24f (diff) | |
| download | rust-f007e6f442adafae3e5f2f7f635dc12463bbe0bb.tar.gz rust-f007e6f442adafae3e5f2f7f635dc12463bbe0bb.zip | |
Identify when a stmt could have been parsed as an expr
There are some expressions that can be parsed as a statement without a trailing semicolon depending on the context, which can lead to confusing errors due to the same looking code being accepted in some places and not others. Identify these cases and suggest enclosing in parenthesis making the parse non-ambiguous without changing the accepted grammar.
Diffstat (limited to 'src/libsyntax/parse/lexer/mod.rs')
| -rw-r--r-- | src/libsyntax/parse/lexer/mod.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs index cf8f8abe2ab..e7d79a647d3 100644 --- a/src/libsyntax/parse/lexer/mod.rs +++ b/src/libsyntax/parse/lexer/mod.rs @@ -1899,7 +1899,7 @@ mod tests { use std::io; use std::path::PathBuf; use syntax_pos::{BytePos, Span, NO_EXPANSION}; - use rustc_data_structures::fx::FxHashSet; + use rustc_data_structures::fx::{FxHashSet, FxHashMap}; use rustc_data_structures::sync::Lock; fn mk_sess(sm: Lrc<SourceMap>) -> ParseSess { @@ -1918,6 +1918,7 @@ mod tests { raw_identifier_spans: Lock::new(Vec::new()), registered_diagnostics: Lock::new(ErrorMap::new()), buffered_lints: Lock::new(vec![]), + abiguous_block_expr_parse: Lock::new(FxHashMap::default()), } } |
