Skip to content

Multiline strings with carriage return - unknown string escape #11669

Closed
@adam-frisby

Description

@adam-frisby

Using Windows style (or Mac OS 9) style line endings results in "unknown string escape: \r" when attempting to use a multiline string literal.

test.rs:2:26: 2:27 error: unknown string escape: \r
test.rs:2   let string = ~"This is \
                                    ^
fn main() {
    let string = "This is \
                  a test";
}

When cloning a rust library, git automatically converted the Linux style line endings to Windows which caused compilation to fail.

Activity

SiegeLord

SiegeLord commented on Jan 20, 2014

@SiegeLord
Contributor

Discussion in #7946 seems relevant, although it only directly relates to CR-only line endings. The Rust repository specifically disables that feature of git via .gitattributes (see #9214) which is something one could do in the meantime/if this issue is determined to be a non-issue.

huonw

huonw commented on Feb 17, 2014

@huonw
Member

It would be good to at least special case this to emit a more useful error message, even if it's not legal.

added a commit that references this issue on Nov 2, 2023

Auto merge of rust-lang#11669 - y21:issue11577, r=Jarcho

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    O-windowsOperating system: Windows

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @SiegeLord@huonw@adam-frisby

        Issue actions

          Multiline strings with carriage return - unknown string escape · Issue #11669 · rust-lang/rust