about summary refs log tree commit diff
path: root/compiler/rustc_parse/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-03-22 19:06:04 +0000
committerbors <bors@rust-lang.org>2022-03-22 19:06:04 +0000
commit5f37001055c29982f4c27ee9edd90449c8e07774 (patch)
treed8897f02157dc621ff21fa007dbd082e6aed28f0 /compiler/rustc_parse/src
parent64137f0b15b752d0c734661dc713bcd140858320 (diff)
parent2aca599325021f352f9bff06fa42daeb3c4bd4f8 (diff)
downloadrust-5f37001055c29982f4c27ee9edd90449c8e07774.tar.gz
rust-5f37001055c29982f4c27ee9edd90449c8e07774.zip
Auto merge of #95215 - Dylan-DPC:rollup-l9f9t7l, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #95188 ([`macro-metavar-expr`] Fix generated tokens hygiene)
 - #95196 (rename LocalState::Uninitialized to Unallocated)
 - #95197 (Suggest constraining param for unary ops when missing trait impl)
 - #95200 (Cancel a not emitted error after parsing const generic args)
 - #95207 (update Termination trait docs)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_parse/src')
-rw-r--r--compiler/rustc_parse/src/parser/path.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/compiler/rustc_parse/src/parser/path.rs b/compiler/rustc_parse/src/parser/path.rs
index 17c57867cf9..07ce879de8f 100644
--- a/compiler/rustc_parse/src/parser/path.rs
+++ b/compiler/rustc_parse/src/parser/path.rs
@@ -630,10 +630,14 @@ impl<'a> Parser<'a> {
                 Ok(ty) => GenericArg::Type(ty),
                 Err(err) => {
                     if is_const_fn {
-                        if let Ok(expr) = (*snapshot).parse_expr_res(Restrictions::CONST_EXPR, None)
-                        {
-                            self.restore_snapshot(snapshot);
-                            return Ok(Some(self.dummy_const_arg_needs_braces(err, expr.span)));
+                        match (*snapshot).parse_expr_res(Restrictions::CONST_EXPR, None) {
+                            Ok(expr) => {
+                                self.restore_snapshot(snapshot);
+                                return Ok(Some(self.dummy_const_arg_needs_braces(err, expr.span)));
+                            }
+                            Err(err) => {
+                                err.cancel();
+                            }
                         }
                     }
                     // Try to recover from possible `const` arg without braces.