We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
create_snapshot_for_diagnostic
clone
Parser
1 parent 0068b8b commit 84f0d5eCopy full SHA for 84f0d5e
compiler/rustc_parse/src/parser/item.rs
@@ -2260,7 +2260,7 @@ impl<'a> Parser<'a> {
2260
(pat, this.parse_ty_for_param()?)
2261
} else {
2262
debug!("parse_param_general ident_to_pat");
2263
- let parser_snapshot_before_ty = this.clone();
+ let parser_snapshot_before_ty = this.create_snapshot_for_diagnostic();
2264
this.eat_incorrect_doc_comment_for_param_type();
2265
let mut ty = this.parse_ty_for_param();
2266
if ty.is_ok()
@@ -2283,7 +2283,7 @@ impl<'a> Parser<'a> {
2283
// Recover from attempting to parse the argument as a type without pattern.
2284
Err(err) => {
2285
err.cancel();
2286
- *this = parser_snapshot_before_ty;
+ this.restore_snapshot(parser_snapshot_before_ty);
2287
this.recover_arg_parse()?
2288
}
2289
0 commit comments