forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#96355 - estebank:issue-95030, r=compiler-er…
…rors Better handle too many `#` recovery in raw str Point at all the unnecessary trailing `#`. Better handle interaction with outer attributes when `;` is missing. Fix rust-lang#95030.
- Loading branch information
Showing
3 changed files
with
84 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,22 @@ | ||
static s: &'static str = | ||
r#""## //~ ERROR too many `#` when terminating raw string | ||
; | ||
|
||
static s2: &'static str = | ||
r#" | ||
"## //~ too many `#` when terminating raw string | ||
"#### //~ ERROR too many `#` when terminating raw string | ||
; | ||
|
||
const A: &'static str = r"" //~ ERROR expected `;`, found `#` | ||
|
||
// Test | ||
#[test] | ||
fn test() {} | ||
|
||
const B: &'static str = r""## //~ ERROR too many `#` when terminating raw string | ||
|
||
// Test | ||
#[test] | ||
fn test2() {} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,36 @@ | ||
error: too many `#` when terminating raw string | ||
--> $DIR/raw-str-unbalanced.rs:3:9 | ||
--> $DIR/raw-str-unbalanced.rs:2:10 | ||
| | ||
LL | "## | ||
| ^ help: remove the extra `#` | ||
LL | r#""## | ||
| -----^ help: remove the extra `#` | ||
| | | ||
| this raw string started with 1 `#` | ||
|
||
error: too many `#` when terminating raw string | ||
--> $DIR/raw-str-unbalanced.rs:7:9 | ||
| | ||
LL | / r#" | ||
LL | | "#### | ||
| | -^^^ help: remove the extra `#`s | ||
| |________| | ||
| this raw string started with 1 `#` | ||
|
||
error: expected `;`, found `#` | ||
--> $DIR/raw-str-unbalanced.rs:10:28 | ||
| | ||
LL | const A: &'static str = r"" | ||
| ^ help: add `;` here | ||
... | ||
LL | #[test] | ||
| - unexpected token | ||
|
||
error: too many `#` when terminating raw string | ||
--> $DIR/raw-str-unbalanced.rs:16:28 | ||
| | ||
= note: the raw string started with 1 `#`s | ||
LL | const B: &'static str = r""## | ||
| ---^^ help: remove the extra `#`s | ||
| | | ||
| this raw string started with 0 `#`s | ||
|
||
error: aborting due to previous error | ||
error: aborting due to 4 previous errors | ||
|