Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweak format string error to point at arguments always #65746

Merged
merged 1 commit into from
Oct 25, 2019

Commits on Oct 24, 2019

  1. Tweak format string error to point at arguments always

    Add secondary span labels with no text to make it clear when there's a
    mismatch bewteen the positional arguments in a format string and the
    arguments to the macro. This shouldn't affect experienced users, but it
    should make it easier for newcomers to more clearly understand how
    `format!()` and `println!()` are supposed to be used.
    
    ```
    error: 2 positional arguments in format string, but there is 1 argument
     --> file8.rs:2:14
      |
    2 |     format!("{} {}", 1);
      |              ^^ ^^   -
    ```
    
    instead of
    
    ```
    error: 2 positional arguments in format string, but there is 1 argument
     --> file8.rs:2:14
      |
    2 |     format!("{} {}", 1);
      |              ^^ ^^
    ```
    estebank committed Oct 24, 2019
    Configuration menu
    Copy the full SHA
    8467cef View commit details
    Browse the repository at this point in the history