diff --git a/src/libsyntax/error_codes.rs b/src/libsyntax/error_codes.rs index 941df5ea57087..7cf722299ad96 100644 --- a/src/libsyntax/error_codes.rs +++ b/src/libsyntax/error_codes.rs @@ -518,6 +518,24 @@ undefined number of parameters to a given function (like `printf` in C). The equivalent in Rust would be to use macros directly. "##, +E0744: r##" +A raw string isn't terminated. + +Erroneous code example: + +```compile_fail,E0744 +let dolphins = r##"Dolphins!"#; // error! +``` + +To terminate a raw string, you have to have the same number of `#` at the end +than at the beginning. Example: + +``` +let dolphins = r#"Dolphins!"#; // one `#` at the beginning, one at the end so + // all good! +``` +"##, + ; E0539, // incorrect meta item diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs index e2a7ea28b9b59..4bf39d59e5907 100644 --- a/src/libsyntax/parse/lexer/mod.rs +++ b/src/libsyntax/parse/lexer/mod.rs @@ -501,8 +501,10 @@ impl<'a> StringReader<'a> { } fn report_unterminated_raw_string(&self, start: BytePos, n_hashes: usize) -> ! { - let mut err = self.struct_span_fatal( - start, start, + let mut err = struct_span_fatal!( + self.sess.span_diagnostic, + self.mk_sp(start, start), + E0744, "unterminated raw string", ); err.span_label(