1
Fork 0

Rollup merge of #73502 - GuillaumeGomez:add-e0764, r=estebank

Add E0765
This commit is contained in:
Dylan DPC 2020-06-22 14:53:50 +02:00 committed by GitHub
commit d22b80dc0c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 33 additions and 7 deletions

View file

@ -445,6 +445,7 @@ E0761: include_str!("./error_codes/E0761.md"),
E0762: include_str!("./error_codes/E0762.md"),
E0763: include_str!("./error_codes/E0763.md"),
E0764: include_str!("./error_codes/E0764.md"),
E0765: include_str!("./error_codes/E0765.md"),
;
// E0006, // merged with E0005
// E0008, // cannot bind by-move into a pattern guard

View file

@ -0,0 +1,13 @@
A double quote string (`"`) was not terminated.
Erroneous code example:
```compile_fail,E0765
let s = "; // error!
```
To fix this error, add the missing double quote at the end of the string:
```
let s = ""; // ok!
```

View file

@ -353,8 +353,15 @@ impl<'a> StringReader<'a> {
}
rustc_lexer::LiteralKind::Str { terminated } => {
if !terminated {
self.fatal_span_(start, suffix_start, "unterminated double quote string")
.raise()
self.sess
.span_diagnostic
.struct_span_fatal_with_code(
self.mk_sp(start, suffix_start),
"unterminated double quote string",
error_code!(E0765),
)
.emit();
FatalError.raise();
}
(token::Str, Mode::Str, 1, 1) // " "
}

View file

@ -1,4 +1,4 @@
error: unterminated double quote string
error[E0765]: unterminated double quote string
--> $DIR/test-compile-fail3.rs:3:1
|
3 | "fail
@ -6,3 +6,4 @@ error: unterminated double quote string
error: aborting due to previous error
For more information about this error, try `rustc --explain E0765`.

View file

@ -5,7 +5,7 @@ test $DIR/unparseable-doc-test.rs - foo (line 6) ... FAILED
failures:
---- $DIR/unparseable-doc-test.rs - foo (line 6) stdout ----
error: unterminated double quote string
error[E0765]: unterminated double quote string
--> $DIR/unparseable-doc-test.rs:8:1
|
LL | "unterminated
@ -13,6 +13,7 @@ LL | "unterminated
error: aborting due to previous error
For more information about this error, try `rustc --explain E0765`.
Couldn't compile the test.
failures:

View file

@ -1,4 +1,4 @@
error: unterminated double quote string
error[E0765]: unterminated double quote string
--> $DIR/tab_2.rs:4:7
|
LL | """;
@ -8,3 +8,4 @@ LL | | }
error: aborting due to previous error
For more information about this error, try `rustc --explain E0765`.

View file

@ -1,4 +1,4 @@
error: unterminated double quote string
error[E0765]: unterminated double quote string
--> $DIR/issue-44078.rs:2:8
|
LL | "😊"";
@ -8,3 +8,4 @@ LL | | }
error: aborting due to previous error
For more information about this error, try `rustc --explain E0765`.

View file

@ -1,4 +1,4 @@
error: unterminated double quote string
error[E0765]: unterminated double quote string
--> $DIR/unbalanced-doublequote.rs:5:5
|
LL | / "
@ -7,3 +7,4 @@ LL | | }
error: aborting due to previous error
For more information about this error, try `rustc --explain E0765`.