Skip to content

End-of-line backslash in string literal should be documented #22698

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
MicahChalmer opened this issue Feb 23, 2015 · 1 comment · Fixed by #22748
Closed

End-of-line backslash in string literal should be documented #22698

MicahChalmer opened this issue Feb 23, 2015 · 1 comment · Fixed by #22748

Comments

@MicahChalmer
Copy link
Contributor

Rust has a feature in non-raw string literals where a backslash right before a newline causes that newline, plus all whitespace at the beginning of the next line, to be ignored. That makes it so that you can indent the insides of string literals without the indentation being part of the program. For instance:

fn main() {
    println!("foo\
              bar");
}

prints foobar.

That's is a nice feature, but it appears nowhere (at least nowhere obvious that I can find from a brief search) in either in the book or the reference.

@munds
Copy link
Contributor

munds commented Feb 24, 2015

I also added this to the Hello World Tutorial, was that a bad thing?

jxcl added a commit to jxcl/rust that referenced this issue Feb 26, 2015
steveklabnik added a commit to steveklabnik/rust that referenced this issue Feb 26, 2015
r? @steveklabnik 

Closes rust-lang#22698

I wasn't sure that this was appropriate for the book, but I've added this to the reference. I also noticed that one of the U+ symbols in the character literals section was missing the graves.
Manishearth added a commit to Manishearth/rust that referenced this issue Feb 27, 2015
 r? @steveklabnik

Closes rust-lang#22698

I wasn't sure that this was appropriate for the book, but I've added this to the reference. I also noticed that one of the U+ symbols in the character literals section was missing the graves.
dlrobertson pushed a commit to dlrobertson/rust that referenced this issue Nov 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants