Skip to content

"Use double quotes" suggestion turns overlong char literal into unterminated string literal #103323

Closed
@jruderman

Description

@jruderman

Given the following code (playground):

fn main() {
    let _s = '"""';
}

The current output is:

error: character literal may only contain one codepoint
 --> src/main.rs:2:14
  |
2 |     let _s = '"""';
  |              ^^^^^
  |
help: if you meant to write a `str` literal, use double quotes
  |
2 |     let _s = """"";
  |              ~~~~~

Ideally the suggestion should look like:

help: if you meant to write a `str` literal, use double quotes
  |
2 |     let _s = "\"\"\"";
  |              ~~~~~~~~

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions