diff options
| author | LeSeulArtichaut <leseulartichaut@gmail.com> | 2021-05-30 00:07:34 +0200 |
|---|---|---|
| committer | LeSeulArtichaut <leseulartichaut@gmail.com> | 2021-05-30 00:08:42 +0200 |
| commit | b237f90ab9a83ffe3a56338b89dfa1d21f5a2560 (patch) | |
| tree | 7d8ea8c6cc360113cbafbf5887e3a3c999a578d1 /compiler/rustc_parse/src/parser | |
| parent | 8d1e3d3b74fa80ce14af6ec143f061897684582b (diff) | |
| download | rust-b237f90ab9a83ffe3a56338b89dfa1d21f5a2560.tar.gz rust-b237f90ab9a83ffe3a56338b89dfa1d21f5a2560.zip | |
Don't drop `PResult` without handling the error
Diffstat (limited to 'compiler/rustc_parse/src/parser')
| -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), |
