about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-08-15 15:25:31 +0000
committerbors <bors@rust-lang.org>2022-08-15 15:25:31 +0000
commit9b4ea391a132ec5f5de40079597ab7ff2fd691ad (patch)
tree8a46c02d7aa2be231291370f5a1b8ec96316ebad /compiler/rustc_parse/src/parser
parent4916e2b9e6ef8cee6f9c6abb75bd01ba9dc07e5c (diff)
parentfece51174be4fbd89a08cdbcad4533b856795cae (diff)
downloadrust-9b4ea391a132ec5f5de40079597ab7ff2fd691ad.tar.gz
rust-9b4ea391a132ec5f5de40079597ab7ff2fd691ad.zip
Auto merge of #100569 - matthiaskrgr:rollup-9450lzs, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #100211 (Refuse to codegen an upstream static.)
 - #100277 (Simplify format_args builtin macro implementation.)
 - #100483 (Point to generic or arg if it's the self type of unsatisfied projection predicate)
 - #100506 (change `InlineAsmCtxt` to not talk about `FnCtxt`)
 - #100534 (Make code slightly more uniform)
 - #100566 (Use `create_snapshot_for_diagnostic` instead of `clone` for `Parser`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_parse/src/parser')
-rw-r--r--compiler/rustc_parse/src/parser/diagnostics.rs4
-rw-r--r--compiler/rustc_parse/src/parser/item.rs4
2 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs
index f4c6b33a529..018f0ad71ef 100644
--- a/compiler/rustc_parse/src/parser/diagnostics.rs
+++ b/compiler/rustc_parse/src/parser/diagnostics.rs
@@ -590,7 +590,7 @@ impl<'a> Parser<'a> {
             )
         } else if expected.is_empty() {
             (
-                format!("unexpected token: {}", actual),
+                format!("unexpected token: {actual}"),
                 (self.prev_token.span, "unexpected token after this".to_string()),
             )
         } else {
@@ -1497,7 +1497,7 @@ impl<'a> Parser<'a> {
         MultiSugg {
             msg: format!("use `{}= 1` instead", kind.op.chr()),
             patches: vec![
-                (pre_span, format!("{{ let {} = ", tmp_var)),
+                (pre_span, format!("{{ let {tmp_var} = ")),
                 (post_span, format!("; {} {}= 1; {} }}", base_src, kind.op.chr(), tmp_var)),
             ],
             applicability: Applicability::HasPlaceholders,
diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs
index 83fab0829a1..81d0e4733d0 100644
--- a/compiler/rustc_parse/src/parser/item.rs
+++ b/compiler/rustc_parse/src/parser/item.rs
@@ -2309,7 +2309,7 @@ impl<'a> Parser<'a> {
                 (pat, this.parse_ty_for_param()?)
             } else {
                 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();
                 let mut ty = this.parse_ty_for_param();
                 if ty.is_ok()
@@ -2332,7 +2332,7 @@ impl<'a> Parser<'a> {
                     // Recover from attempting to parse the argument as a type without pattern.
                     Err(err) => {
                         err.cancel();
-                        *this = parser_snapshot_before_ty;
+                        this.restore_snapshot(parser_snapshot_before_ty);
                         this.recover_arg_parse()?
                     }
                 }