Skip to content

Commit b86a1d1

Browse files
committed
replace this.clone() with this.create_snapshot_for_diagnostic()
1 parent 3ea4493 commit b86a1d1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

compiler/rustc_parse/src/parser/generics.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ impl<'a> Parser<'a> {
118118
Some(this.parse_ty_param(attrs)?)
119119
} else if this.token.can_begin_type() {
120120
// Trying to write an associated type bound? (#26271)
121-
let snapshot = this.clone();
121+
let snapshot = this.create_snapshot_for_diagnostic();
122122
match this.parse_ty_where_predicate() {
123123
Ok(where_predicate) => {
124124
this.struct_span_err(
@@ -133,7 +133,7 @@ impl<'a> Parser<'a> {
133133
Err(err) => {
134134
err.cancel();
135135
// FIXME - maybe we should overwrite 'self' outside of `collect_tokens`?
136-
*this = snapshot;
136+
this.restore_snapshot(snapshot);
137137
return Ok((None, TrailingToken::None));
138138
}
139139
}

0 commit comments

Comments
 (0)