From 65b0655230085d7f6400e0d0c21292053e41adc1 Mon Sep 17 00:00:00 2001 From: Alexander Bliskovsky Date: Tue, 24 Feb 2015 00:13:04 -0500 Subject: [PATCH 1/2] Added documentation of backslash ending string literals. Closes #22698 --- src/doc/reference.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/doc/reference.md b/src/doc/reference.md index 781b40be768..81e7076edbc 100644 --- a/src/doc/reference.md +++ b/src/doc/reference.md @@ -302,7 +302,7 @@ nonzero_dec: '1' | '2' | '3' | '4' A _character literal_ is a single Unicode character enclosed within two `U+0027` (single-quote) characters, with the exception of `U+0027` itself, -which must be _escaped_ by a preceding U+005C character (`\`). +which must be _escaped_ by a preceding `U+005C` character (`\`). ##### String literals @@ -311,6 +311,19 @@ A _string literal_ is a sequence of any Unicode characters enclosed within two which must be _escaped_ by a preceding `U+005C` character (`\`), or a _raw string literal_. +A multi-line string literal may be defined by terminating each line with a +`U+005C` character (`\`) immediately before the newline. This causes the +`U+005C` character, the newline, and all whitespace at the beginning of the +next line to be ignored. + +```rust +let a = "foobar"; +let b = "foo\ + bar"; +``` + +`a` is equivalent to `b`. + ##### Character escapes Some additional _escapes_ are available in either character or non-raw string From f618e2e1ec1d6b9f0b5c110f0dbfa385f3b583d3 Mon Sep 17 00:00:00 2001 From: Alexander Bliskovsky Date: Wed, 25 Feb 2015 20:29:13 -0500 Subject: [PATCH 2/2] Changed prose to assert_eq! macro. --- src/doc/reference.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/doc/reference.md b/src/doc/reference.md index 81e7076edbc..87130c08991 100644 --- a/src/doc/reference.md +++ b/src/doc/reference.md @@ -320,9 +320,9 @@ next line to be ignored. let a = "foobar"; let b = "foo\ bar"; -``` -`a` is equivalent to `b`. +assert_eq!(a,b); +``` ##### Character escapes