Skip to content

Incorrect Compiler Error #15362

Closed
Closed
@Kleptine

Description

@Kleptine

When running the following (clearly broken) program, the compiler spits out a completely incorrect error message:

fn main() { 
    println!(format!("foo"))
}

Results:

<anon>:2:14: 2:20 error: macro undefined: 'format'
<anon>:2     println!(format!("foo"))
                      ^~~~~~
<anon>:2:14: 2:28 error: format argument must be a string literal.
<anon>:2     println!(format!("foo"))
                      ^~~~~~~~~~~~~~
error: aborting due to 2 previous errors
playpen: application terminated with error code 101

http://is.gd/XYH1f2

While the second is correct, the first is wrong, confusing and suggests that format! needs to be imported somehow.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions