Skip to content

Poor error when using single quotes with println! #26101

Closed
@steveklabnik

Description

@steveklabnik
fn main() {
    println!('{}', 5);
}

This error leaves much to be desired:

hello.rs:2:14: 2:16 error: unterminated character constant: '{
hello.rs:2     println!('{}', 5);
                        ^~

The issue is that you need double quotes.

originally found in http://joelmccracken.github.io/entries/a-simple-web-app-in-rust-pt-2b/ /cc @joelmccracken

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.WG-diagnosticsWorking group: Diagnostics

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions