about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-05-30 20:20:44 +0000
committerbors <bors@rust-lang.org>2021-05-30 20:20:44 +0000
commitc1e8f3a5857c3c8d095fd212acc6ed442f4cc58b (patch)
tree017a5aec220066f1e9cbd5fb109f1c154705e4af /compiler/rustc_parse/src/parser
parent758c00ea4088e1ca2714890f00c791c24f001536 (diff)
parent71a7f8f1884b2c83eeb4a545eef16df1f2ea6476 (diff)
downloadrust-c1e8f3a5857c3c8d095fd212acc6ed442f4cc58b.tar.gz
rust-c1e8f3a5857c3c8d095fd212acc6ed442f4cc58b.zip
Auto merge of #85838 - GuillaumeGomez:rollup-rk2rh7m, r=GuillaumeGomez
Rollup of 8 pull requests

Successful merges:

 - #85285 (Add eslint checks to CI)
 - #85709 (Use correct edition when parsing `:pat` matchers)
 - #85762 (Do not try to build LLVM with Zlib on Windows)
 - #85770 (Remove `--print unversioned-files` from rustdoc )
 - #85781 (Add documentation for aarch64-apple-ios-sim target)
 - #85801 (Add `String::extend_from_within`)
 - #85817 (Fix a typo)
 - #85818 (Don't drop `PResult` without handling the error)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_parse/src/parser')
-rw-r--r--compiler/rustc_parse/src/parser/item.rs5
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),