diff options
| author | Takayuki Maeda <takoyaki0316@gmail.com> | 2022-08-15 16:42:58 +0900 |
|---|---|---|
| committer | Takayuki Maeda <takoyaki0316@gmail.com> | 2022-08-15 16:42:58 +0900 |
| commit | 84f0d5e460786d071ff3598637c24137ef866509 (patch) | |
| tree | 7f40f77f0596a7375ff4861d988f343e7fc3c85b /compiler/rustc_parse/src/parser | |
| parent | 0068b8bf4b150b506ef0871be4e8652fd4308f84 (diff) | |
| download | rust-84f0d5e460786d071ff3598637c24137ef866509.tar.gz rust-84f0d5e460786d071ff3598637c24137ef866509.zip | |
use `create_snapshot_for_diagnostic` instead of `clone` for `Parser`
Diffstat (limited to 'compiler/rustc_parse/src/parser')
| -rw-r--r-- | compiler/rustc_parse/src/parser/item.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs index 72c23776d33..65ebaf1539f 100644 --- a/compiler/rustc_parse/src/parser/item.rs +++ b/compiler/rustc_parse/src/parser/item.rs @@ -2260,7 +2260,7 @@ impl<'a> Parser<'a> { (pat, this.parse_ty_for_param()?) } else { debug!("parse_param_general ident_to_pat"); - let parser_snapshot_before_ty = this.clone(); + let parser_snapshot_before_ty = this.create_snapshot_for_diagnostic(); this.eat_incorrect_doc_comment_for_param_type(); let mut ty = this.parse_ty_for_param(); if ty.is_ok() @@ -2283,7 +2283,7 @@ impl<'a> Parser<'a> { // Recover from attempting to parse the argument as a type without pattern. Err(err) => { err.cancel(); - *this = parser_snapshot_before_ty; + this.restore_snapshot(parser_snapshot_before_ty); this.recover_arg_parse()? } } |
