diff options
| author | bors <bors@rust-lang.org> | 2022-12-06 12:29:38 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-12-06 12:29:38 +0000 |
| commit | b6852428a8ea9728369b64b9964cad8e258403d3 (patch) | |
| tree | 07c892e607e39ad00b0420417dc7ec109c2e12ee /compiler/rustc_parse/src | |
| parent | 9db224fc908059986c179fc6ec433944e9cfce50 (diff) | |
| parent | a9ffe7c738e4e9a9367726b591f3145c784391ed (diff) | |
| download | rust-b6852428a8ea9728369b64b9964cad8e258403d3.tar.gz rust-b6852428a8ea9728369b64b9964cad8e258403d3.zip | |
Auto merge of #105365 - matthiaskrgr:rollup-g0mrrt7, r=matthiaskrgr
Rollup of 11 pull requests Successful merges: - #104439 (Add prototype to generate `COPYRIGHT` from REUSE metadata) - #105005 (On E0195 point at where clause lifetime bounds) - #105098 (propagate the error from parsing enum variant to the parser and emit out) - #105243 (remove no-op 'let _ = ') - #105254 (Recurse into nested impl-trait when computing variance.) - #105287 (Synthesize substitutions for bad auto traits in dyn types) - #105310 (Be more careful about unresolved exprs in suggestion) - #105318 (Make `get_impl_future_output_ty` work with AFIT) - #105339 (support `ConstKind::Expr` in `is_const_evaluatable` and `WfPredicates::compute`) - #105340 (Avoid ICE by accounting for missing type) - #105342 (Make `note_obligation_cause_code` take a `impl ToPredicate` for predicate) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_parse/src')
| -rw-r--r-- | compiler/rustc_parse/src/parser/item.rs | 5 | ||||
| -rw-r--r-- | compiler/rustc_parse/src/parser/mod.rs | 4 |
2 files changed, 8 insertions, 1 deletions
diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs index 84c63219920..03f25392a7c 100644 --- a/compiler/rustc_parse/src/parser/item.rs +++ b/compiler/rustc_parse/src/parser/item.rs @@ -1414,7 +1414,10 @@ impl<'a> Parser<'a> { Ok((Some(vr), TrailingToken::MaybeComma)) }, - ) + ).map_err(|mut err|{ + err.help("enum variants can be `Variant`, `Variant = <integer>`, `Variant(Type, ..., TypeN)` or `Variant { fields: Types }`"); + err + }) } /// Parses `struct Foo { ... }`. diff --git a/compiler/rustc_parse/src/parser/mod.rs b/compiler/rustc_parse/src/parser/mod.rs index 4d8bff28b05..bebb012660a 100644 --- a/compiler/rustc_parse/src/parser/mod.rs +++ b/compiler/rustc_parse/src/parser/mod.rs @@ -943,6 +943,10 @@ impl<'a> Parser<'a> { Err(e) => { // Parsing failed, therefore it must be something more serious // than just a missing separator. + for xx in &e.children { + // propagate the help message from sub error 'e' to main error 'expect_err; + expect_err.children.push(xx.clone()); + } expect_err.emit(); e.cancel(); |
