Skip to content
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

Add E0765 #73502

Merged
merged 2 commits into from
Jun 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/librustc_error_codes/error_codes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions src/librustc_error_codes/error_codes/E0765.md
Original file line number Diff line number Diff line change
@@ -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!
```
11 changes: 9 additions & 2 deletions src/librustc_parse/lexer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) // " "
}
Expand Down
3 changes: 2 additions & 1 deletion src/test/rustdoc-ui/test-compile-fail3.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
error: unterminated double quote string
error[E0765]: unterminated double quote string
--> $DIR/test-compile-fail3.rs:3:1
|
3 | "fail
| ^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0765`.
3 changes: 2 additions & 1 deletion src/test/rustdoc-ui/unparseable-doc-test.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ 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
| ^^^^^^^^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0765`.
Couldn't compile the test.

failures:
Expand Down
3 changes: 2 additions & 1 deletion src/test/ui/codemap_tests/tab_2.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error: unterminated double quote string
error[E0765]: unterminated double quote string
--> $DIR/tab_2.rs:4:7
|
LL | """;
Expand All @@ -8,3 +8,4 @@ LL | | }

error: aborting due to previous error

For more information about this error, try `rustc --explain E0765`.
3 changes: 2 additions & 1 deletion src/test/ui/issues/issue-44078.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error: unterminated double quote string
error[E0765]: unterminated double quote string
--> $DIR/issue-44078.rs:2:8
|
LL | "😊"";
Expand All @@ -8,3 +8,4 @@ LL | | }

error: aborting due to previous error

For more information about this error, try `rustc --explain E0765`.
3 changes: 2 additions & 1 deletion src/test/ui/parser/unbalanced-doublequote.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error: unterminated double quote string
error[E0765]: unterminated double quote string
--> $DIR/unbalanced-doublequote.rs:5:5
|
LL | / "
Expand All @@ -7,3 +7,4 @@ LL | | }

error: aborting due to previous error

For more information about this error, try `rustc --explain E0765`.