about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr10
-rw-r--r--src/test/ui/fmt/format-args-capture-issue-93378.rs4
-rw-r--r--src/test/ui/fmt/format-args-capture-issue-93378.stderr17
-rw-r--r--src/test/ui/fmt/ifmt-bad-arg.rs8
-rw-r--r--src/test/ui/fmt/ifmt-bad-arg.stderr98
-rw-r--r--src/test/ui/issues/issue-75307.rs2
-rw-r--r--src/test/ui/issues/issue-75307.stderr8
-rw-r--r--src/test/ui/macros/format-parse-errors.stderr2
-rw-r--r--src/test/ui/macros/issue-99265.stderr278
-rw-r--r--src/test/ui/macros/issue-99907.stderr4
10 files changed, 202 insertions, 229 deletions
diff --git a/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr b/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr
index 68602640a24..21a402c7b9d 100644
--- a/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr
+++ b/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr
@@ -237,21 +237,19 @@ LL |     #[suggestion(typeck::suggestion, code = "{name}")]
    |                                             ^^^^^^^^
 
 error: invalid format string: expected `'}'` but string was terminated
-  --> $DIR/diagnostic-derive.rs:175:16
+  --> $DIR/diagnostic-derive.rs:175:10
    |
 LL | #[derive(Diagnostic)]
-   |           -    ^ expected `'}'` in format string
-   |           |
-   |           because of this opening brace
+   |          ^^^^^^^^^^ expected `'}'` in format string
    |
    = note: if you intended to print `{`, you can escape it using `{{`
    = note: this error originates in the derive macro `Diagnostic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: invalid format string: unmatched `}` found
-  --> $DIR/diagnostic-derive.rs:185:15
+  --> $DIR/diagnostic-derive.rs:185:10
    |
 LL | #[derive(Diagnostic)]
-   |               ^ unmatched `}` in format string
+   |          ^^^^^^^^^^ unmatched `}` in format string
    |
    = note: if you intended to print `}`, you can escape it using `}}`
    = note: this error originates in the derive macro `Diagnostic` (in Nightly builds, run with -Z macro-backtrace for more info)
diff --git a/src/test/ui/fmt/format-args-capture-issue-93378.rs b/src/test/ui/fmt/format-args-capture-issue-93378.rs
index 67444444264..9d722a0287a 100644
--- a/src/test/ui/fmt/format-args-capture-issue-93378.rs
+++ b/src/test/ui/fmt/format-args-capture-issue-93378.rs
@@ -3,9 +3,9 @@ fn main() {
     let b = "b";
 
     println!("{a} {b} {} {} {c} {}", c = "c");
-    //~^ ERROR: invalid reference to positional arguments 1 and 2 (there is 1 argument)
+    //~^ ERROR: 3 positional arguments in format string, but there is 1 argument
 
     let n = 1;
     println!("{a:.n$} {b:.*}");
-    //~^ ERROR: invalid reference to positional argument 0 (no arguments were given)
+    //~^ ERROR: 1 positional argument in format string, but no arguments were given
 }
diff --git a/src/test/ui/fmt/format-args-capture-issue-93378.stderr b/src/test/ui/fmt/format-args-capture-issue-93378.stderr
index b8e2b2afb38..6429b0d46f6 100644
--- a/src/test/ui/fmt/format-args-capture-issue-93378.stderr
+++ b/src/test/ui/fmt/format-args-capture-issue-93378.stderr
@@ -1,19 +1,14 @@
-error: invalid reference to positional arguments 1 and 2 (there is 1 argument)
-  --> $DIR/format-args-capture-issue-93378.rs:5:26
+error: 3 positional arguments in format string, but there is 1 argument
+  --> $DIR/format-args-capture-issue-93378.rs:5:23
    |
 LL |     println!("{a} {b} {} {} {c} {}", c = "c");
-   |                          ^^     ^^
-   |
-   = note: positional arguments are zero-based
+   |                       ^^ ^^     ^^       ---
 
-error: invalid reference to positional argument 0 (no arguments were given)
-  --> $DIR/format-args-capture-issue-93378.rs:9:23
+error: 1 positional argument in format string, but no arguments were given
+  --> $DIR/format-args-capture-issue-93378.rs:9:26
    |
 LL |     println!("{a:.n$} {b:.*}");
-   |                   -   ^^^--^
-   |                   |      |
-   |                   |      this precision flag adds an extra required argument at position 0, which is why there are 3 arguments expected
-   |                   this parameter corresponds to the precision flag
+   |                          ^^ this precision flag adds an extra required argument at position 0, which is why there is 1 argument expected
    |
    = note: positional arguments are zero-based
    = note: for information about formatting flags, visit https://doc.rust-lang.org/std/fmt/index.html
diff --git a/src/test/ui/fmt/ifmt-bad-arg.rs b/src/test/ui/fmt/ifmt-bad-arg.rs
index f00cb05c9eb..68861d7bf3f 100644
--- a/src/test/ui/fmt/ifmt-bad-arg.rs
+++ b/src/test/ui/fmt/ifmt-bad-arg.rs
@@ -20,9 +20,9 @@ fn main() {
     //~^ ERROR: invalid reference to positional argument 2 (there are 2 arguments)
 
     format!("{} {value} {} {}", 1, value=2);
-    //~^ ERROR: invalid reference to positional argument 2 (there are 2 arguments)
+    //~^ ERROR: 3 positional arguments in format string, but there are 2 arguments
     format!("{name} {value} {} {} {} {} {} {}", 0, name=1, value=2);
-    //~^ ERROR: invalid reference to positional arguments 3, 4 and 5 (there are 3 arguments)
+    //~^ ERROR: 6 positional arguments in format string, but there are 3 arguments
 
     format!("{} {foo} {} {bar} {}", 1, 2, 3);
     //~^ ERROR: cannot find value `foo` in this scope
@@ -79,7 +79,7 @@ tenth number: {}",
     //~^ ERROR 4 positional arguments in format string, but there are 3 arguments
     //~| ERROR mismatched types
     println!("{} {:07$.*} {}", 1, 3.2, 4);
-    //~^ ERROR 4 positional arguments in format string, but there are 3 arguments
+    //~^ ERROR invalid reference to positional arguments 3 and 7 (there are 3 arguments)
     //~| ERROR mismatched types
     println!("{} {:07$} {}", 1, 3.2, 4);
     //~^ ERROR invalid reference to positional argument 7 (there are 3 arguments)
@@ -95,5 +95,5 @@ tenth number: {}",
     println!("{:.*}");
     //~^ ERROR 2 positional arguments in format string, but no arguments were given
     println!("{:.0$}");
-    //~^ ERROR 1 positional argument in format string, but no arguments were given
+    //~^ ERROR invalid reference to positional argument 0 (no arguments were given)
 }
diff --git a/src/test/ui/fmt/ifmt-bad-arg.stderr b/src/test/ui/fmt/ifmt-bad-arg.stderr
index dbb4bc6d937..1b595a50e99 100644
--- a/src/test/ui/fmt/ifmt-bad-arg.stderr
+++ b/src/test/ui/fmt/ifmt-bad-arg.stderr
@@ -5,10 +5,10 @@ LL |     format!("{}");
    |              ^^
 
 error: invalid reference to positional argument 1 (there is 1 argument)
-  --> $DIR/ifmt-bad-arg.rs:9:14
+  --> $DIR/ifmt-bad-arg.rs:9:15
    |
 LL |     format!("{1}", 1);
-   |              ^^^
+   |               ^
    |
    = note: positional arguments are zero-based
 
@@ -27,36 +27,32 @@ LL |     format!("{} {}");
    |              ^^ ^^
 
 error: invalid reference to positional argument 1 (there is 1 argument)
-  --> $DIR/ifmt-bad-arg.rs:16:18
+  --> $DIR/ifmt-bad-arg.rs:16:19
    |
 LL |     format!("{0} {1}", 1);
-   |                  ^^^
+   |                   ^
    |
    = note: positional arguments are zero-based
 
 error: invalid reference to positional argument 2 (there are 2 arguments)
-  --> $DIR/ifmt-bad-arg.rs:19:22
+  --> $DIR/ifmt-bad-arg.rs:19:23
    |
 LL |     format!("{0} {1} {2}", 1, 2);
-   |                      ^^^
+   |                       ^
    |
    = note: positional arguments are zero-based
 
-error: invalid reference to positional argument 2 (there are 2 arguments)
-  --> $DIR/ifmt-bad-arg.rs:22:28
+error: 3 positional arguments in format string, but there are 2 arguments
+  --> $DIR/ifmt-bad-arg.rs:22:14
    |
 LL |     format!("{} {value} {} {}", 1, value=2);
-   |                            ^^
-   |
-   = note: positional arguments are zero-based
+   |              ^^         ^^ ^^   -        -
 
-error: invalid reference to positional arguments 3, 4 and 5 (there are 3 arguments)
-  --> $DIR/ifmt-bad-arg.rs:24:38
+error: 6 positional arguments in format string, but there are 3 arguments
+  --> $DIR/ifmt-bad-arg.rs:24:29
    |
 LL |     format!("{name} {value} {} {} {} {} {} {}", 0, name=1, value=2);
-   |                                      ^^ ^^ ^^
-   |
-   = note: positional arguments are zero-based
+   |                             ^^ ^^ ^^ ^^ ^^ ^^   -       -        -
 
 error: multiple unused formatting arguments
   --> $DIR/ifmt-bad-arg.rs:32:17
@@ -117,20 +113,20 @@ LL |     format!("{} {}", 1, 2, foo=1, bar=2);
    |             multiple missing formatting specifiers
 
 error: duplicate argument named `foo`
-  --> $DIR/ifmt-bad-arg.rs:40:33
+  --> $DIR/ifmt-bad-arg.rs:40:29
    |
 LL |     format!("{foo}", foo=1, foo=2);
-   |                          -      ^ duplicate argument
-   |                          |
-   |                          previously here
+   |                      ---    ^^^ duplicate argument
+   |                      |
+   |                      previously here
 
 error: positional arguments cannot follow named arguments
   --> $DIR/ifmt-bad-arg.rs:41:35
    |
 LL |     format!("{foo} {} {}", foo=1, 2);
-   |                                -  ^ positional arguments must be before named arguments
-   |                                |
-   |                                named argument
+   |                            -----  ^ positional arguments must be before named arguments
+   |                            |
+   |                            named argument
 
 error: named argument never used
   --> $DIR/ifmt-bad-arg.rs:45:51
@@ -191,33 +187,26 @@ error: 4 positional arguments in format string, but there are 3 arguments
    |
 LL |     println!("{} {:.*} {}", 1, 3.2, 4);
    |               ^^ ^^--^ ^^   -  ---  -
-   |                    |           |
-   |                    |           this parameter corresponds to the precision flag
+   |                    |
    |                    this precision flag adds an extra required argument at position 1, which is why there are 4 arguments expected
    |
    = note: positional arguments are zero-based
    = note: for information about formatting flags, visit https://doc.rust-lang.org/std/fmt/index.html
 
-error: 4 positional arguments in format string, but there are 3 arguments
-  --> $DIR/ifmt-bad-arg.rs:81:15
+error: invalid reference to positional arguments 3 and 7 (there are 3 arguments)
+  --> $DIR/ifmt-bad-arg.rs:81:21
    |
 LL |     println!("{} {:07$.*} {}", 1, 3.2, 4);
-   |               ^^ ^^^----^ ^^   -  ---  -
-   |                     | |           |
-   |                     | |           this parameter corresponds to the precision flag
-   |                     | this precision flag adds an extra required argument at position 1, which is why there are 4 arguments expected
-   |                     this width flag expects an `usize` argument at position 7, but there are 3 arguments
+   |                     ^^     ^
    |
    = note: positional arguments are zero-based
    = note: for information about formatting flags, visit https://doc.rust-lang.org/std/fmt/index.html
 
 error: invalid reference to positional argument 7 (there are 3 arguments)
-  --> $DIR/ifmt-bad-arg.rs:84:18
+  --> $DIR/ifmt-bad-arg.rs:84:21
    |
 LL |     println!("{} {:07$} {}", 1, 3.2, 4);
-   |                  ^^^--^
-   |                     |
-   |                     this width flag expects an `usize` argument at position 7, but there are 3 arguments
+   |                     ^^
    |
    = note: positional arguments are zero-based
    = note: for information about formatting flags, visit https://doc.rust-lang.org/std/fmt/index.html
@@ -240,24 +229,19 @@ LL |     println!("{:foo}", 1);
            - `X`, which uses the `UpperHex` trait
 
 error: invalid reference to positional arguments 4, 5, 6 and 7 (there is 1 argument)
-  --> $DIR/ifmt-bad-arg.rs:87:15
+  --> $DIR/ifmt-bad-arg.rs:87:16
    |
 LL |     println!("{5} {:4$} {6:7$}", 1);
-   |               ^^^ ^^--^ ^^^--^
-   |                     |      |
-   |                     |      this width flag expects an `usize` argument at position 7, but there is 1 argument
-   |                     this width flag expects an `usize` argument at position 4, but there is 1 argument
+   |                ^    ^^   ^ ^^
    |
    = note: positional arguments are zero-based
    = note: for information about formatting flags, visit https://doc.rust-lang.org/std/fmt/index.html
 
 error: invalid reference to positional argument 0 (no arguments were given)
-  --> $DIR/ifmt-bad-arg.rs:90:15
+  --> $DIR/ifmt-bad-arg.rs:90:20
    |
 LL |     println!("{foo:0$}");
-   |               ^^^^^--^
-   |                    |
-   |                    this width flag expects an `usize` argument at position 0, but no arguments were given
+   |                    ^^
    |
    = note: positional arguments are zero-based
    = note: for information about formatting flags, visit https://doc.rust-lang.org/std/fmt/index.html
@@ -273,13 +257,11 @@ LL |     println!("{:.*}");
    = note: positional arguments are zero-based
    = note: for information about formatting flags, visit https://doc.rust-lang.org/std/fmt/index.html
 
-error: 1 positional argument in format string, but no arguments were given
-  --> $DIR/ifmt-bad-arg.rs:97:15
+error: invalid reference to positional argument 0 (no arguments were given)
+  --> $DIR/ifmt-bad-arg.rs:97:16
    |
 LL |     println!("{:.0$}");
-   |               ^^---^
-   |                 |
-   |                 this precision flag expects an `usize` argument at position 0, but no arguments were given
+   |                ^^^^
    |
    = note: positional arguments are zero-based
    = note: for information about formatting flags, visit https://doc.rust-lang.org/std/fmt/index.html
@@ -318,10 +300,10 @@ error[E0308]: mismatched types
   --> $DIR/ifmt-bad-arg.rs:78:32
    |
 LL |     println!("{} {:.*} {}", 1, 3.2, 4);
-   |     ---------------------------^^^----
-   |     |                          |
-   |     |                          expected `usize`, found floating-point number
-   |     arguments to this function are incorrect
+   |                                ^^^
+   |                                |
+   |                                expected `usize`, found floating-point number
+   |                                arguments to this function are incorrect
    |
    = note: expected reference `&usize`
               found reference `&{float}`
@@ -336,10 +318,10 @@ error[E0308]: mismatched types
   --> $DIR/ifmt-bad-arg.rs:81:35
    |
 LL |     println!("{} {:07$.*} {}", 1, 3.2, 4);
-   |     ------------------------------^^^----
-   |     |                             |
-   |     |                             expected `usize`, found floating-point number
-   |     arguments to this function are incorrect
+   |                                   ^^^
+   |                                   |
+   |                                   expected `usize`, found floating-point number
+   |                                   arguments to this function are incorrect
    |
    = note: expected reference `&usize`
               found reference `&{float}`
diff --git a/src/test/ui/issues/issue-75307.rs b/src/test/ui/issues/issue-75307.rs
index 2fe112a3b95..cffa6bea8ed 100644
--- a/src/test/ui/issues/issue-75307.rs
+++ b/src/test/ui/issues/issue-75307.rs
@@ -1,3 +1,3 @@
 fn main() {
-    format!(r"{}{}{}", named_arg=1); //~ ERROR invalid reference to positional arguments 1 and 2
+    format!(r"{}{}{}", named_arg=1); //~ ERROR 3 positional arguments in format string, but there is 1 argument
 }
diff --git a/src/test/ui/issues/issue-75307.stderr b/src/test/ui/issues/issue-75307.stderr
index 10c952006c2..c5b0b11e7d0 100644
--- a/src/test/ui/issues/issue-75307.stderr
+++ b/src/test/ui/issues/issue-75307.stderr
@@ -1,10 +1,8 @@
-error: invalid reference to positional arguments 1 and 2 (there is 1 argument)
-  --> $DIR/issue-75307.rs:2:17
+error: 3 positional arguments in format string, but there is 1 argument
+  --> $DIR/issue-75307.rs:2:15
    |
 LL |     format!(r"{}{}{}", named_arg=1);
-   |                 ^^^^
-   |
-   = note: positional arguments are zero-based
+   |               ^^^^^^             -
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/macros/format-parse-errors.stderr b/src/test/ui/macros/format-parse-errors.stderr
index 1a7578e6076..f9ea4c63377 100644
--- a/src/test/ui/macros/format-parse-errors.stderr
+++ b/src/test/ui/macros/format-parse-errors.stderr
@@ -22,7 +22,7 @@ error: positional arguments cannot follow named arguments
   --> $DIR/format-parse-errors.rs:10:9
    |
 LL |         foo = foo,
-   |               --- named argument
+   |         --------- named argument
 LL |         bar,
    |         ^^^ positional arguments must be before named arguments
 
diff --git a/src/test/ui/macros/issue-99265.stderr b/src/test/ui/macros/issue-99265.stderr
index 2bfeedd7d07..9185dbff61e 100644
--- a/src/test/ui/macros/issue-99265.stderr
+++ b/src/test/ui/macros/issue-99265.stderr
@@ -77,18 +77,18 @@ help: use the named argument by name to avoid ambiguity
 LL |     println!("Hello {:width$}!", "x", width = 5);
    |                       ~~~~~~
 
-warning: named argument `width` is not used by name
-  --> $DIR/issue-99265.rs:23:46
+warning: named argument `f` is not used by name
+  --> $DIR/issue-99265.rs:23:33
    |
 LL |     println!("Hello {:1$.2$}!", f = 0.02f32, width = 5, precision = 2);
-   |                       --                     ^^^^^ this named argument is referred to by position in formatting string
-   |                       |
-   |                       this formatting argument uses named argument `width` by position
+   |                     --------    ^ this named argument is referred to by position in formatting string
+   |                     |
+   |                     this formatting argument uses named argument `f` by position
    |
 help: use the named argument by name to avoid ambiguity
    |
-LL |     println!("Hello {:width$.2$}!", f = 0.02f32, width = 5, precision = 2);
-   |                       ~~~~~~
+LL |     println!("Hello {f:1$.2$}!", f = 0.02f32, width = 5, precision = 2);
+   |                      +
 
 warning: named argument `precision` is not used by name
   --> $DIR/issue-99265.rs:23:57
@@ -103,31 +103,31 @@ help: use the named argument by name to avoid ambiguity
 LL |     println!("Hello {:1$.precision$}!", f = 0.02f32, width = 5, precision = 2);
    |                          ~~~~~~~~~~
 
-warning: named argument `f` is not used by name
-  --> $DIR/issue-99265.rs:23:33
+warning: named argument `width` is not used by name
+  --> $DIR/issue-99265.rs:23:46
    |
 LL |     println!("Hello {:1$.2$}!", f = 0.02f32, width = 5, precision = 2);
-   |                     --          ^ this named argument is referred to by position in formatting string
-   |                     |
-   |                     this formatting argument uses named argument `f` by position
+   |                       --                     ^^^^^ this named argument is referred to by position in formatting string
+   |                       |
+   |                       this formatting argument uses named argument `width` by position
    |
 help: use the named argument by name to avoid ambiguity
    |
-LL |     println!("Hello {f:1$.2$}!", f = 0.02f32, width = 5, precision = 2);
-   |                      +
+LL |     println!("Hello {:width$.2$}!", f = 0.02f32, width = 5, precision = 2);
+   |                       ~~~~~~
 
-warning: named argument `width` is not used by name
-  --> $DIR/issue-99265.rs:31:47
+warning: named argument `f` is not used by name
+  --> $DIR/issue-99265.rs:31:34
    |
 LL |     println!("Hello {0:1$.2$}!", f = 0.02f32, width = 5, precision = 2);
-   |                        --                     ^^^^^ this named argument is referred to by position in formatting string
-   |                        |
-   |                        this formatting argument uses named argument `width` by position
+   |                     ---------    ^ this named argument is referred to by position in formatting string
+   |                     |
+   |                     this formatting argument uses named argument `f` by position
    |
 help: use the named argument by name to avoid ambiguity
    |
-LL |     println!("Hello {0:width$.2$}!", f = 0.02f32, width = 5, precision = 2);
-   |                        ~~~~~~
+LL |     println!("Hello {f:1$.2$}!", f = 0.02f32, width = 5, precision = 2);
+   |                      ~
 
 warning: named argument `precision` is not used by name
   --> $DIR/issue-99265.rs:31:58
@@ -142,32 +142,32 @@ help: use the named argument by name to avoid ambiguity
 LL |     println!("Hello {0:1$.precision$}!", f = 0.02f32, width = 5, precision = 2);
    |                           ~~~~~~~~~~
 
-warning: named argument `f` is not used by name
-  --> $DIR/issue-99265.rs:31:34
+warning: named argument `width` is not used by name
+  --> $DIR/issue-99265.rs:31:47
    |
 LL |     println!("Hello {0:1$.2$}!", f = 0.02f32, width = 5, precision = 2);
-   |                      -           ^ this named argument is referred to by position in formatting string
-   |                      |
-   |                      this formatting argument uses named argument `f` by position
+   |                        --                     ^^^^^ this named argument is referred to by position in formatting string
+   |                        |
+   |                        this formatting argument uses named argument `width` by position
    |
 help: use the named argument by name to avoid ambiguity
    |
-LL |     println!("Hello {f:1$.2$}!", f = 0.02f32, width = 5, precision = 2);
-   |                      ~
+LL |     println!("Hello {0:width$.2$}!", f = 0.02f32, width = 5, precision = 2);
+   |                        ~~~~~~
 
-warning: named argument `width` is not used by name
-  --> $DIR/issue-99265.rs:52:9
+warning: named argument `f` is not used by name
+  --> $DIR/issue-99265.rs:49:9
    |
 LL |         "{}, Hello {1:2$.3$} {4:5$.6$}! {1}",
-   |                       -- this formatting argument uses named argument `width` by position
+   |                    --------- this formatting argument uses named argument `f` by position
 ...
-LL |         width = 5,
-   |         ^^^^^ this named argument is referred to by position in formatting string
+LL |         f = 0.02f32,
+   |         ^ this named argument is referred to by position in formatting string
    |
 help: use the named argument by name to avoid ambiguity
    |
-LL |         "{}, Hello {1:width$.3$} {4:5$.6$}! {1}",
-   |                       ~~~~~~
+LL |         "{}, Hello {f:2$.3$} {4:5$.6$}! {1}",
+   |                     ~
 
 warning: named argument `precision` is not used by name
   --> $DIR/issue-99265.rs:54:9
@@ -183,33 +183,33 @@ help: use the named argument by name to avoid ambiguity
 LL |         "{}, Hello {1:2$.precision$} {4:5$.6$}! {1}",
    |                          ~~~~~~~~~~
 
-warning: named argument `f` is not used by name
-  --> $DIR/issue-99265.rs:49:9
+warning: named argument `width` is not used by name
+  --> $DIR/issue-99265.rs:52:9
    |
 LL |         "{}, Hello {1:2$.3$} {4:5$.6$}! {1}",
-   |                     - this formatting argument uses named argument `f` by position
+   |                       -- this formatting argument uses named argument `width` by position
 ...
-LL |         f = 0.02f32,
-   |         ^ this named argument is referred to by position in formatting string
+LL |         width = 5,
+   |         ^^^^^ this named argument is referred to by position in formatting string
    |
 help: use the named argument by name to avoid ambiguity
    |
-LL |         "{}, Hello {f:2$.3$} {4:5$.6$}! {1}",
-   |                     ~
+LL |         "{}, Hello {1:width$.3$} {4:5$.6$}! {1}",
+   |                       ~~~~~~
 
-warning: named argument `width2` is not used by name
-  --> $DIR/issue-99265.rs:58:9
+warning: named argument `g` is not used by name
+  --> $DIR/issue-99265.rs:56:9
    |
 LL |         "{}, Hello {1:2$.3$} {4:5$.6$}! {1}",
-   |                                 -- this formatting argument uses named argument `width2` by position
+   |                              --------- this formatting argument uses named argument `g` by position
 ...
-LL |         width2 = 5,
-   |         ^^^^^^ this named argument is referred to by position in formatting string
+LL |         g = 0.02f32,
+   |         ^ this named argument is referred to by position in formatting string
    |
 help: use the named argument by name to avoid ambiguity
    |
-LL |         "{}, Hello {1:2$.3$} {4:width2$.6$}! {1}",
-   |                                 ~~~~~~~
+LL |         "{}, Hello {1:2$.3$} {g:5$.6$}! {1}",
+   |                               ~
 
 warning: named argument `precision2` is not used by name
   --> $DIR/issue-99265.rs:60:9
@@ -225,25 +225,25 @@ help: use the named argument by name to avoid ambiguity
 LL |         "{}, Hello {1:2$.3$} {4:5$.precision2$}! {1}",
    |                                    ~~~~~~~~~~~
 
-warning: named argument `g` is not used by name
-  --> $DIR/issue-99265.rs:56:9
+warning: named argument `width2` is not used by name
+  --> $DIR/issue-99265.rs:58:9
    |
 LL |         "{}, Hello {1:2$.3$} {4:5$.6$}! {1}",
-   |                               - this formatting argument uses named argument `g` by position
+   |                                 -- this formatting argument uses named argument `width2` by position
 ...
-LL |         g = 0.02f32,
-   |         ^ this named argument is referred to by position in formatting string
+LL |         width2 = 5,
+   |         ^^^^^^ this named argument is referred to by position in formatting string
    |
 help: use the named argument by name to avoid ambiguity
    |
-LL |         "{}, Hello {1:2$.3$} {g:5$.6$}! {1}",
-   |                               ~
+LL |         "{}, Hello {1:2$.3$} {4:width2$.6$}! {1}",
+   |                                 ~~~~~~~
 
 warning: named argument `f` is not used by name
   --> $DIR/issue-99265.rs:49:9
    |
 LL |         "{}, Hello {1:2$.3$} {4:5$.6$}! {1}",
-   |                                          - this formatting argument uses named argument `f` by position
+   |                                         --- this formatting argument uses named argument `f` by position
 ...
 LL |         f = 0.02f32,
    |         ^ this named argument is referred to by position in formatting string
@@ -257,7 +257,7 @@ warning: named argument `f` is not used by name
   --> $DIR/issue-99265.rs:64:31
    |
 LL |     println!("Hello {:0.1}!", f = 0.02f32);
-   |                     --        ^ this named argument is referred to by position in formatting string
+   |                     ------    ^ this named argument is referred to by position in formatting string
    |                     |
    |                     this formatting argument uses named argument `f` by position
    |
@@ -270,9 +270,9 @@ warning: named argument `f` is not used by name
   --> $DIR/issue-99265.rs:68:32
    |
 LL |     println!("Hello {0:0.1}!", f = 0.02f32);
-   |                      -         ^ this named argument is referred to by position in formatting string
-   |                      |
-   |                      this formatting argument uses named argument `f` by position
+   |                     -------    ^ this named argument is referred to by position in formatting string
+   |                     |
+   |                     this formatting argument uses named argument `f` by position
    |
 help: use the named argument by name to avoid ambiguity
    |
@@ -283,6 +283,19 @@ warning: named argument `v` is not used by name
   --> $DIR/issue-99265.rs:79:23
    |
 LL |     println!("{:0$}", v = val);
+   |               -----   ^ this named argument is referred to by position in formatting string
+   |               |
+   |               this formatting argument uses named argument `v` by position
+   |
+help: use the named argument by name to avoid ambiguity
+   |
+LL |     println!("{v:0$}", v = val);
+   |                +
+
+warning: named argument `v` is not used by name
+  --> $DIR/issue-99265.rs:79:23
+   |
+LL |     println!("{:0$}", v = val);
    |                 --    ^ this named argument is referred to by position in formatting string
    |                 |
    |                 this formatting argument uses named argument `v` by position
@@ -293,17 +306,17 @@ LL |     println!("{:v$}", v = val);
    |                 ~~
 
 warning: named argument `v` is not used by name
-  --> $DIR/issue-99265.rs:79:23
+  --> $DIR/issue-99265.rs:84:24
    |
-LL |     println!("{:0$}", v = val);
-   |               --      ^ this named argument is referred to by position in formatting string
+LL |     println!("{0:0$}", v = val);
+   |               ------   ^ this named argument is referred to by position in formatting string
    |               |
    |               this formatting argument uses named argument `v` by position
    |
 help: use the named argument by name to avoid ambiguity
    |
 LL |     println!("{v:0$}", v = val);
-   |                +
+   |                ~
 
 warning: named argument `v` is not used by name
   --> $DIR/issue-99265.rs:84:24
@@ -319,30 +332,17 @@ LL |     println!("{0:v$}", v = val);
    |                  ~~
 
 warning: named argument `v` is not used by name
-  --> $DIR/issue-99265.rs:84:24
-   |
-LL |     println!("{0:0$}", v = val);
-   |                -       ^ this named argument is referred to by position in formatting string
-   |                |
-   |                this formatting argument uses named argument `v` by position
-   |
-help: use the named argument by name to avoid ambiguity
-   |
-LL |     println!("{v:0$}", v = val);
-   |                ~
-
-warning: named argument `v` is not used by name
   --> $DIR/issue-99265.rs:89:26
    |
 LL |     println!("{:0$.0$}", v = val);
-   |                 --       ^ this named argument is referred to by position in formatting string
-   |                 |
-   |                 this formatting argument uses named argument `v` by position
+   |               --------   ^ this named argument is referred to by position in formatting string
+   |               |
+   |               this formatting argument uses named argument `v` by position
    |
 help: use the named argument by name to avoid ambiguity
    |
-LL |     println!("{:v$.0$}", v = val);
-   |                 ~~
+LL |     println!("{v:0$.0$}", v = val);
+   |                +
 
 warning: named argument `v` is not used by name
   --> $DIR/issue-99265.rs:89:26
@@ -361,27 +361,27 @@ warning: named argument `v` is not used by name
   --> $DIR/issue-99265.rs:89:26
    |
 LL |     println!("{:0$.0$}", v = val);
-   |               --         ^ this named argument is referred to by position in formatting string
-   |               |
-   |               this formatting argument uses named argument `v` by position
+   |                 --       ^ this named argument is referred to by position in formatting string
+   |                 |
+   |                 this formatting argument uses named argument `v` by position
    |
 help: use the named argument by name to avoid ambiguity
    |
-LL |     println!("{v:0$.0$}", v = val);
-   |                +
+LL |     println!("{:v$.0$}", v = val);
+   |                 ~~
 
 warning: named argument `v` is not used by name
   --> $DIR/issue-99265.rs:96:27
    |
 LL |     println!("{0:0$.0$}", v = val);
-   |                  --       ^ this named argument is referred to by position in formatting string
-   |                  |
-   |                  this formatting argument uses named argument `v` by position
+   |               ---------   ^ this named argument is referred to by position in formatting string
+   |               |
+   |               this formatting argument uses named argument `v` by position
    |
 help: use the named argument by name to avoid ambiguity
    |
-LL |     println!("{0:v$.0$}", v = val);
-   |                  ~~
+LL |     println!("{v:0$.0$}", v = val);
+   |                ~
 
 warning: named argument `v` is not used by name
   --> $DIR/issue-99265.rs:96:27
@@ -400,14 +400,14 @@ warning: named argument `v` is not used by name
   --> $DIR/issue-99265.rs:96:27
    |
 LL |     println!("{0:0$.0$}", v = val);
-   |                -          ^ this named argument is referred to by position in formatting string
-   |                |
-   |                this formatting argument uses named argument `v` by position
+   |                  --       ^ this named argument is referred to by position in formatting string
+   |                  |
+   |                  this formatting argument uses named argument `v` by position
    |
 help: use the named argument by name to avoid ambiguity
    |
-LL |     println!("{v:0$.0$}", v = val);
-   |                ~
+LL |     println!("{0:v$.0$}", v = val);
+   |                  ~~
 
 warning: named argument `a` is not used by name
   --> $DIR/issue-99265.rs:104:28
@@ -426,28 +426,28 @@ warning: named argument `a` is not used by name
   --> $DIR/issue-99265.rs:104:28
    |
 LL |     println!("{} {a} {0}", a = 1);
-   |                       -    ^ this named argument is referred to by position in formatting string
-   |                       |
-   |                       this formatting argument uses named argument `a` by position
+   |                      ---   ^ this named argument is referred to by position in formatting string
+   |                      |
+   |                      this formatting argument uses named argument `a` by position
    |
 help: use the named argument by name to avoid ambiguity
    |
 LL |     println!("{} {a} {a}", a = 1);
    |                       ~
 
-warning: named argument `b` is not used by name
-  --> $DIR/issue-99265.rs:115:23
+warning: named argument `a` is not used by name
+  --> $DIR/issue-99265.rs:115:14
    |
 LL |                 {:1$.2$}",
-   |                   -- this formatting argument uses named argument `b` by position
+   |                 -------- this formatting argument uses named argument `a` by position
 ...
 LL |              a = 1.0, b = 1, c = 2,
-   |                       ^ this named argument is referred to by position in formatting string
+   |              ^ this named argument is referred to by position in formatting string
    |
 help: use the named argument by name to avoid ambiguity
    |
-LL |                 {:b$.2$}",
-   |                   ~~
+LL |                 {a:1$.2$}",
+   |                  +
 
 warning: named argument `c` is not used by name
   --> $DIR/issue-99265.rs:115:30
@@ -463,33 +463,33 @@ help: use the named argument by name to avoid ambiguity
 LL |                 {:1$.c$}",
    |                      ~~
 
-warning: named argument `a` is not used by name
-  --> $DIR/issue-99265.rs:115:14
+warning: named argument `b` is not used by name
+  --> $DIR/issue-99265.rs:115:23
    |
 LL |                 {:1$.2$}",
-   |                 -- this formatting argument uses named argument `a` by position
+   |                   -- this formatting argument uses named argument `b` by position
 ...
 LL |              a = 1.0, b = 1, c = 2,
-   |              ^ this named argument is referred to by position in formatting string
+   |                       ^ this named argument is referred to by position in formatting string
    |
 help: use the named argument by name to avoid ambiguity
    |
-LL |                 {a:1$.2$}",
-   |                  +
+LL |                 {:b$.2$}",
+   |                   ~~
 
-warning: named argument `b` is not used by name
-  --> $DIR/issue-99265.rs:126:23
+warning: named argument `a` is not used by name
+  --> $DIR/issue-99265.rs:126:14
    |
 LL |                 {0:1$.2$}",
-   |                    -- this formatting argument uses named argument `b` by position
+   |                 --------- this formatting argument uses named argument `a` by position
 ...
 LL |              a = 1.0, b = 1, c = 2,
-   |                       ^ this named argument is referred to by position in formatting string
+   |              ^ this named argument is referred to by position in formatting string
    |
 help: use the named argument by name to avoid ambiguity
    |
-LL |                 {0:b$.2$}",
-   |                    ~~
+LL |                 {a:1$.2$}",
+   |                  ~
 
 warning: named argument `c` is not used by name
   --> $DIR/issue-99265.rs:126:30
@@ -505,32 +505,32 @@ help: use the named argument by name to avoid ambiguity
 LL |                 {0:1$.c$}",
    |                       ~~
 
-warning: named argument `a` is not used by name
-  --> $DIR/issue-99265.rs:126:14
+warning: named argument `b` is not used by name
+  --> $DIR/issue-99265.rs:126:23
    |
 LL |                 {0:1$.2$}",
-   |                  - this formatting argument uses named argument `a` by position
+   |                    -- this formatting argument uses named argument `b` by position
 ...
 LL |              a = 1.0, b = 1, c = 2,
-   |              ^ this named argument is referred to by position in formatting string
+   |                       ^ this named argument is referred to by position in formatting string
    |
 help: use the named argument by name to avoid ambiguity
    |
-LL |                 {a:1$.2$}",
-   |                  ~
+LL |                 {0:b$.2$}",
+   |                    ~~
 
-warning: named argument `width` is not used by name
-  --> $DIR/issue-99265.rs:132:39
+warning: named argument `x` is not used by name
+  --> $DIR/issue-99265.rs:132:30
    |
 LL |     println!("{{{:1$.2$}}}", x = 1.0, width = 3, precision = 2);
-   |                   --                  ^^^^^ this named argument is referred to by position in formatting string
-   |                   |
-   |                   this formatting argument uses named argument `width` by position
+   |                 --------     ^ this named argument is referred to by position in formatting string
+   |                 |
+   |                 this formatting argument uses named argument `x` by position
    |
 help: use the named argument by name to avoid ambiguity
    |
-LL |     println!("{{{:width$.2$}}}", x = 1.0, width = 3, precision = 2);
-   |                   ~~~~~~
+LL |     println!("{{{x:1$.2$}}}", x = 1.0, width = 3, precision = 2);
+   |                  +
 
 warning: named argument `precision` is not used by name
   --> $DIR/issue-99265.rs:132:50
@@ -545,18 +545,18 @@ help: use the named argument by name to avoid ambiguity
 LL |     println!("{{{:1$.precision$}}}", x = 1.0, width = 3, precision = 2);
    |                      ~~~~~~~~~~
 
-warning: named argument `x` is not used by name
-  --> $DIR/issue-99265.rs:132:30
+warning: named argument `width` is not used by name
+  --> $DIR/issue-99265.rs:132:39
    |
 LL |     println!("{{{:1$.2$}}}", x = 1.0, width = 3, precision = 2);
-   |                 --           ^ this named argument is referred to by position in formatting string
-   |                 |
-   |                 this formatting argument uses named argument `x` by position
+   |                   --                  ^^^^^ this named argument is referred to by position in formatting string
+   |                   |
+   |                   this formatting argument uses named argument `width` by position
    |
 help: use the named argument by name to avoid ambiguity
    |
-LL |     println!("{{{x:1$.2$}}}", x = 1.0, width = 3, precision = 2);
-   |                  +
+LL |     println!("{{{:width$.2$}}}", x = 1.0, width = 3, precision = 2);
+   |                   ~~~~~~
 
 warning: 42 warnings emitted
 
diff --git a/src/test/ui/macros/issue-99907.stderr b/src/test/ui/macros/issue-99907.stderr
index 4786ce003b4..eefb28dee35 100644
--- a/src/test/ui/macros/issue-99907.stderr
+++ b/src/test/ui/macros/issue-99907.stderr
@@ -2,7 +2,7 @@ warning: named argument `f` is not used by name
   --> $DIR/issue-99907.rs:5:30
    |
 LL |     println!("Hello {:.1}!", f = 0.02f32);
-   |                     --       ^ this named argument is referred to by position in formatting string
+   |                     -----    ^ this named argument is referred to by position in formatting string
    |                     |
    |                     this formatting argument uses named argument `f` by position
    |
@@ -16,7 +16,7 @@ warning: named argument `f` is not used by name
   --> $DIR/issue-99907.rs:9:31
    |
 LL |     println!("Hello {:1.1}!", f = 0.02f32);
-   |                     --        ^ this named argument is referred to by position in formatting string
+   |                     ------    ^ this named argument is referred to by position in formatting string
    |                     |
    |                     this formatting argument uses named argument `f` by position
    |