Skip to content

Carriage return doesn't end // comments #7946

@sp3d

Description

@sp3d

The manual and compiler agree that \n (newline) is the only character which can end // comments. However, a large amount of software such as editors and document viewers consider any of "\r", "\r", and "\r\n" to introduce the start of a new line. In a file that has a \r without a following \n, users can easily be tricked into thinking a line is not commented out when it actually is.

For example, the rust program "//\rfn main() {}" is missing a main function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-grammarArea: The grammar of Rust

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions