Skip to content

Commit fece511

Browse files
authored
Rollup merge of rust-lang#100566 - TaKO8Ki:use-create-snapshot-for-diagnostic, r=cjgillot
Use `create_snapshot_for_diagnostic` instead of `clone` for `Parser` follow-up to rust-lang#98020
2 parents 748925b + 84f0d5e commit fece511

File tree

1 file changed

+2
-2
lines changed
  • compiler/rustc_parse/src/parser

1 file changed

+2
-2
lines changed

compiler/rustc_parse/src/parser/item.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2309,7 +2309,7 @@ impl<'a> Parser<'a> {
23092309
(pat, this.parse_ty_for_param()?)
23102310
} else {
23112311
debug!("parse_param_general ident_to_pat");
2312-
let parser_snapshot_before_ty = this.clone();
2312+
let parser_snapshot_before_ty = this.create_snapshot_for_diagnostic();
23132313
this.eat_incorrect_doc_comment_for_param_type();
23142314
let mut ty = this.parse_ty_for_param();
23152315
if ty.is_ok()
@@ -2332,7 +2332,7 @@ impl<'a> Parser<'a> {
23322332
// Recover from attempting to parse the argument as a type without pattern.
23332333
Err(err) => {
23342334
err.cancel();
2335-
*this = parser_snapshot_before_ty;
2335+
this.restore_snapshot(parser_snapshot_before_ty);
23362336
this.recover_arg_parse()?
23372337
}
23382338
}

0 commit comments

Comments
 (0)