Skip to content

Commit ebd279e

Browse files
authored
Rollup merge of rust-lang#73502 - GuillaumeGomez:add-e0764, r=estebank
Add E0765
2 parents c9b7199 + c14d85f commit ebd279e

File tree

8 files changed

+33
-7
lines changed

8 files changed

+33
-7
lines changed

src/librustc_error_codes/error_codes.rs

+1
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,7 @@ E0761: include_str!("./error_codes/E0761.md"),
445445
E0762: include_str!("./error_codes/E0762.md"),
446446
E0763: include_str!("./error_codes/E0763.md"),
447447
E0764: include_str!("./error_codes/E0764.md"),
448+
E0765: include_str!("./error_codes/E0765.md"),
448449
;
449450
// E0006, // merged with E0005
450451
// E0008, // cannot bind by-move into a pattern guard
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
A double quote string (`"`) was not terminated.
2+
3+
Erroneous code example:
4+
5+
```compile_fail,E0765
6+
let s = "; // error!
7+
```
8+
9+
To fix this error, add the missing double quote at the end of the string:
10+
11+
```
12+
let s = ""; // ok!
13+
```

src/librustc_parse/lexer/mod.rs

+9-2
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,15 @@ impl<'a> StringReader<'a> {
353353
}
354354
rustc_lexer::LiteralKind::Str { terminated } => {
355355
if !terminated {
356-
self.fatal_span_(start, suffix_start, "unterminated double quote string")
357-
.raise()
356+
self.sess
357+
.span_diagnostic
358+
.struct_span_fatal_with_code(
359+
self.mk_sp(start, suffix_start),
360+
"unterminated double quote string",
361+
error_code!(E0765),
362+
)
363+
.emit();
364+
FatalError.raise();
358365
}
359366
(token::Str, Mode::Str, 1, 1) // " "
360367
}
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
error: unterminated double quote string
1+
error[E0765]: unterminated double quote string
22
--> $DIR/test-compile-fail3.rs:3:1
33
|
44
3 | "fail
55
| ^^^^^^
66

77
error: aborting due to previous error
88

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

src/test/rustdoc-ui/unparseable-doc-test.stdout

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@ test $DIR/unparseable-doc-test.rs - foo (line 6) ... FAILED
55
failures:
66

77
---- $DIR/unparseable-doc-test.rs - foo (line 6) stdout ----
8-
error: unterminated double quote string
8+
error[E0765]: unterminated double quote string
99
--> $DIR/unparseable-doc-test.rs:8:1
1010
|
1111
LL | "unterminated
1212
| ^^^^^^^^^^^^^
1313

1414
error: aborting due to previous error
1515

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

1819
failures:

src/test/ui/codemap_tests/tab_2.stderr

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: unterminated double quote string
1+
error[E0765]: unterminated double quote string
22
--> $DIR/tab_2.rs:4:7
33
|
44
LL | """;
@@ -8,3 +8,4 @@ LL | | }
88

99
error: aborting due to previous error
1010

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

src/test/ui/issues/issue-44078.stderr

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: unterminated double quote string
1+
error[E0765]: unterminated double quote string
22
--> $DIR/issue-44078.rs:2:8
33
|
44
LL | "😊"";
@@ -8,3 +8,4 @@ LL | | }
88

99
error: aborting due to previous error
1010

11+
For more information about this error, try `rustc --explain E0765`.
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: unterminated double quote string
1+
error[E0765]: unterminated double quote string
22
--> $DIR/unbalanced-doublequote.rs:5:5
33
|
44
LL | / "
@@ -7,3 +7,4 @@ LL | | }
77

88
error: aborting due to previous error
99

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

0 commit comments

Comments
 (0)