Update tests.

This commit is contained in:
Mara Bos 2022-08-26 18:52:08 +02:00
parent 9bec0de397
commit 3ffcb65518
9 changed files with 210 additions and 235 deletions

View File

@ -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)

View File

@ -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
}

View File

@ -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

View File

@ -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)

View File

@ -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
@ -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
@ -318,10 +302,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 +320,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}`

View File

@ -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
}

View File

@ -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

View File

@ -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 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 {:width$.2$}!", f = 0.02f32, width = 5, precision = 2);
| ~~~~~~
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 `f` 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);
| +
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 `width` 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);
| ~~~~~~
| ~
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,
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 {1:width$.3$} {4:5$.6$}! {1}",
| ~~~~~~
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 `g` by position
...
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 {f:2$.3$} {4:5$.6$}! {1}",
| ~
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 `width2` by position
...
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$} {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,15 +270,28 @@ 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
|
LL | println!("Hello {f:0.1}!", f = 0.02f32);
| ~
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
|
@ -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
@ -318,31 +331,18 @@ help: use the named argument by name to avoid ambiguity
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 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: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
|
help: use the named argument by name to avoid ambiguity
|
LL | println!("{v:0$.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
|
help: use the named argument by name to avoid ambiguity
|
LL | println!("{0:v$.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,11 +463,25 @@ 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
|
help: use the named argument by name to avoid ambiguity
|
LL | {:b$.2$}",
| ~~
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 `a` by position
...
LL | a = 1.0, b = 1, c = 2,
| ^ this named argument is referred to by position in formatting string
@ -475,21 +489,7 @@ LL | a = 1.0, b = 1, c = 2,
help: use the named argument by name to avoid ambiguity
|
LL | {a:1$.2$}",
| +
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 `b` by position
...
LL | a = 1.0, b = 1, c = 2,
| ^ 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$}",
| ~~
| ~
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

View File

@ -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
|