diff --git a/compiler/rustc_parse/src/parser/mod.rs b/compiler/rustc_parse/src/parser/mod.rs index 57778d67098..b452eb6a401 100644 --- a/compiler/rustc_parse/src/parser/mod.rs +++ b/compiler/rustc_parse/src/parser/mod.rs @@ -1288,12 +1288,12 @@ pub(crate) fn parse_token_tree(&mut self) -> TokenTree { } /// Parses a stream of tokens into a list of `TokenTree`s, up to EOF. - pub fn parse_all_token_trees(&mut self) -> PResult<'a, Vec> { + pub fn parse_all_token_trees(&mut self) -> Vec { let mut tts = Vec::new(); while self.token != token::Eof { tts.push(self.parse_token_tree()); } - Ok(tts) + tts } pub fn parse_tokens(&mut self) -> TokenStream { diff --git a/src/librustdoc/clean/render_macro_matchers.rs b/src/librustdoc/clean/render_macro_matchers.rs index ef38ca3c16c..b6120e814df 100644 --- a/src/librustdoc/clean/render_macro_matchers.rs +++ b/src/librustdoc/clean/render_macro_matchers.rs @@ -76,13 +76,7 @@ fn snippet_equal_to_token(tcx: TyCtxt<'_>, matcher: &TokenTree) -> Option reparsed_trees, - Err(diagnostic) => { - diagnostic.cancel(); - return None; - } - }; + let mut reparsed_trees = parser.parse_all_token_trees(); if reparsed_trees.len() != 1 { return None; }