Rollup merge of #100566 - TaKO8Ki:use-create-snapshot-for-diagnostic, r=cjgillot
Use `create_snapshot_for_diagnostic` instead of `clone` for `Parser` follow-up to #98020
This commit is contained in:
commit
fece51174b
1 changed files with 2 additions and 2 deletions
|
@ -2309,7 +2309,7 @@ impl<'a> Parser<'a> {
|
||||||
(pat, this.parse_ty_for_param()?)
|
(pat, this.parse_ty_for_param()?)
|
||||||
} else {
|
} else {
|
||||||
debug!("parse_param_general ident_to_pat");
|
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();
|
this.eat_incorrect_doc_comment_for_param_type();
|
||||||
let mut ty = this.parse_ty_for_param();
|
let mut ty = this.parse_ty_for_param();
|
||||||
if ty.is_ok()
|
if ty.is_ok()
|
||||||
|
@ -2332,7 +2332,7 @@ impl<'a> Parser<'a> {
|
||||||
// Recover from attempting to parse the argument as a type without pattern.
|
// Recover from attempting to parse the argument as a type without pattern.
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
err.cancel();
|
err.cancel();
|
||||||
*this = parser_snapshot_before_ty;
|
this.restore_snapshot(parser_snapshot_before_ty);
|
||||||
this.recover_arg_parse()?
|
this.recover_arg_parse()?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue