We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
this.clone()
this.create_snapshot_for_diagnostic()
1 parent 3ea4493 commit b86a1d1Copy full SHA for b86a1d1
compiler/rustc_parse/src/parser/generics.rs
@@ -118,7 +118,7 @@ impl<'a> Parser<'a> {
118
Some(this.parse_ty_param(attrs)?)
119
} else if this.token.can_begin_type() {
120
// Trying to write an associated type bound? (#26271)
121
- let snapshot = this.clone();
+ let snapshot = this.create_snapshot_for_diagnostic();
122
match this.parse_ty_where_predicate() {
123
Ok(where_predicate) => {
124
this.struct_span_err(
@@ -133,7 +133,7 @@ impl<'a> Parser<'a> {
133
Err(err) => {
134
err.cancel();
135
// FIXME - maybe we should overwrite 'self' outside of `collect_tokens`?
136
- *this = snapshot;
+ this.restore_snapshot(snapshot);
137
return Ok((None, TrailingToken::None));
138
}
139
0 commit comments