diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2021-05-30 21:06:53 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-30 21:06:53 +0200 |
| commit | 71a7f8f1884b2c83eeb4a545eef16df1f2ea6476 (patch) | |
| tree | 38dd223f8a9b32effd0cdcb5b9c8d7c6e0123235 /compiler/rustc_parse/src | |
| parent | 980a4a725ee4e4935e65e311dfe801a7fabaabd6 (diff) | |
| parent | b237f90ab9a83ffe3a56338b89dfa1d21f5a2560 (diff) | |
| download | rust-71a7f8f1884b2c83eeb4a545eef16df1f2ea6476.tar.gz rust-71a7f8f1884b2c83eeb4a545eef16df1f2ea6476.zip | |
Rollup merge of #85818 - LeSeulArtichaut:85794-diag-drop-ice, r=petrochenkov
Don't drop `PResult` without handling the error Fixes #85794.
Diffstat (limited to 'compiler/rustc_parse/src')
| -rw-r--r-- | compiler/rustc_parse/src/parser/item.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs index c64fab0507c..54e6ff6272c 100644 --- a/compiler/rustc_parse/src/parser/item.rs +++ b/compiler/rustc_parse/src/parser/item.rs @@ -1474,7 +1474,10 @@ impl<'a> Parser<'a> { self.sess.gated_spans.gate(sym::unnamed_fields, lo); } else { let err = if self.check_fn_front_matter(false) { - let _ = self.parse_fn(&mut Vec::new(), |_| true, lo); + // We use `parse_fn` to get a span for the function + if let Err(mut db) = self.parse_fn(&mut Vec::new(), |_| true, lo) { + db.delay_as_bug(); + } let mut err = self.struct_span_err( lo.to(self.prev_token.span), &format!("functions are not allowed in {} definitions", adt_ty), |
