Skip to content

format_args! uses the plural incorrectly #15780

Closed
@steveklabnik

Description

@steveklabnik

Sample code:

fn main() {
    // Error: you are missing an argument
    println!("My name is {0}, {1} {0}", "Bond");
}

error message:

me, ~/workspace/rust/byexample.rs » rustc scratchpad.rs 
scratchpad.rs:13:14: 13:39 error: invalid reference to argument `1` (there are 1 arguments)
scratchpad.rs:13     println!("My name is {0}, {1} {0}", "Bond");
                          ^~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to previous error

This should say "there is 1 argument" instead.

originally reported here: http://www.reddit.com/r/rust/comments/2b0mw8/error_message_in_format_args/

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.P-lowLow priority

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions