diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-01-14 20:31:55 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-01-14 20:31:55 +0100 |
| commit | 2f7a226c4dfd8fe71a7451063b6724166b705cf2 (patch) | |
| tree | 379e29c97d1847840c5b054f516d3ea71e85a8da /src/libsyntax/parse/mod.rs | |
| parent | 816e31b1c608626f1a67387676f85544f3da843d (diff) | |
| parent | 28ea03e11477032a29b30284487d6d73e181ecaf (diff) | |
| download | rust-2f7a226c4dfd8fe71a7451063b6724166b705cf2.tar.gz rust-2f7a226c4dfd8fe71a7451063b6724166b705cf2.zip | |
Rollup merge of #57540 - estebank:eval-more, r=petrochenkov
Modify some parser diagnostics to continue evaluating beyond the parser Continue evaluating further errors after parser errors on: - trailing type argument attribute - lifetime in incorrect location - incorrect binary literal - missing `for` in `impl Trait for Foo` - type argument in `where` clause - incorrect float literal - incorrect `..` in pattern - associated types - incorrect discriminator value variant error and others. All of these were found by making `continue-parse-after-error` `true` by default to identify errors that would need few changes. There are now only a handful of errors that have any change with `continue-parse-after-error` enabled. These changes make it so `rust` _won't_ stop evaluation after finishing parsing, enabling type checking errors to be displayed on the existing code without having to fix the parse errors. Each commit has an individual diagnostic change with their corresponding tests. CC #48724.
Diffstat (limited to 'src/libsyntax/parse/mod.rs')
| -rw-r--r-- | src/libsyntax/parse/mod.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index ba5676a65d7..ea205530ca5 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -520,6 +520,7 @@ fn filtered_float_lit(data: Symbol, suffix: Option<Symbol>, diag: Option<(Span, } else { let msg = format!("invalid suffix `{}` for float literal", suf); diag.struct_span_err(span, &msg) + .span_label(span, format!("invalid suffix `{}`", suf)) .help("valid suffixes are `f32` and `f64`") .emit(); } @@ -673,7 +674,11 @@ fn integer_lit(s: &str, suffix: Option<Symbol>, diag: Option<(Span, &Handler)>) _ => None, }; if let Some(err) = err { - err!(diag, |span, diag| diag.span_err(span, err)); + err!(diag, |span, diag| { + diag.struct_span_err(span, err) + .span_label(span, "not supported") + .emit(); + }); } return filtered_float_lit(Symbol::intern(s), Some(suf), diag) } @@ -712,6 +717,7 @@ fn integer_lit(s: &str, suffix: Option<Symbol>, diag: Option<(Span, &Handler)>) } else { let msg = format!("invalid suffix `{}` for numeric literal", suf); diag.struct_span_err(span, &msg) + .span_label(span, format!("invalid suffix `{}`", suf)) .help("the suffix must be one of the integral types \ (`u32`, `isize`, etc)") .emit(); |
