We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 748925b + 84f0d5e commit fece511Copy full SHA for fece511
compiler/rustc_parse/src/parser/item.rs
@@ -2309,7 +2309,7 @@ impl<'a> Parser<'a> {
2309
(pat, this.parse_ty_for_param()?)
2310
} else {
2311
debug!("parse_param_general ident_to_pat");
2312
- let parser_snapshot_before_ty = this.clone();
+ let parser_snapshot_before_ty = this.create_snapshot_for_diagnostic();
2313
this.eat_incorrect_doc_comment_for_param_type();
2314
let mut ty = this.parse_ty_for_param();
2315
if ty.is_ok()
@@ -2332,7 +2332,7 @@ impl<'a> Parser<'a> {
2332
// Recover from attempting to parse the argument as a type without pattern.
2333
Err(err) => {
2334
err.cancel();
2335
- *this = parser_snapshot_before_ty;
+ this.restore_snapshot(parser_snapshot_before_ty);
2336
this.recover_arg_parse()?
2337
}
2338
0 commit comments