-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #100826 - vincenzopalazzo:macros/wrong_sugg_with_posi…
…tional_arg, r=TaKO8Ki sugg: take into count the debug formatting Closes #100648 This PR will fix a suggestion error by taking into consideration also the `:?` symbol and act in a different way ``@rustbot`` r? ``@compiler-errors`` N.B: I did not find a full way to test the change, any idea?
- Loading branch information
Showing
3 changed files
with
38 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/test/ui/suggestions/sugg_with_positional_args_and_debug_fmt.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// When build the suggesttion take in consideration the `:?` | ||
// https://github.com/rust-lang/rust/issues/100648 | ||
#![deny(warnings)] | ||
|
||
fn main () { | ||
println!("hello {:?}", world = "world"); | ||
//~^ ERROR named argument `world` is not used by name | ||
//~| HELP use the named argument by name to avoid ambiguity | ||
//~| SUGGESTION world | ||
} |
21 changes: 21 additions & 0 deletions
21
src/test/ui/suggestions/sugg_with_positional_args_and_debug_fmt.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
error: named argument `world` is not used by name | ||
--> $DIR/sugg_with_positional_args_and_debug_fmt.rs:6:28 | ||
| | ||
LL | println!("hello {:?}", world = "world"); | ||
| ---- ^^^^^ this named argument is referred to by position in formatting string | ||
| | | ||
| this formatting argument uses named argument `world` by position | ||
| | ||
note: the lint level is defined here | ||
--> $DIR/sugg_with_positional_args_and_debug_fmt.rs:3:9 | ||
| | ||
LL | #![deny(warnings)] | ||
| ^^^^^^^^ | ||
= note: `#[deny(named_arguments_used_positionally)]` implied by `#[deny(warnings)]` | ||
help: use the named argument by name to avoid ambiguity | ||
| | ||
LL | println!("hello {world:?}", world = "world"); | ||
| +++++ | ||
|
||
error: aborting due to previous error | ||
|