diff options
| author | bors <bors@rust-lang.org> | 2019-04-21 07:20:14 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-04-21 07:20:14 +0000 |
| commit | 4d9c6cd7226e1839a195f1b6e7d40a3ccf9bb062 (patch) | |
| tree | 57987160b517735c1654f387d18b1c24b35a4788 /src/test | |
| parent | 9224be5fa39f6170f6e046342976efee5453a1ff (diff) | |
| parent | 60c6ed9664e8d6fa30388290d5fe86eb80bc6fc7 (diff) | |
| download | rust-4d9c6cd7226e1839a195f1b6e7d40a3ccf9bb062.tar.gz rust-4d9c6cd7226e1839a195f1b6e7d40a3ccf9bb062.zip | |
Auto merge of #60132 - davidtwco:issue-60075, r=estebank
Fix fn front matter parsing ICE from invalid code. Fixes #60075. This PR fixes an "unreachable code" ICE that results from parsing invalid code where the compiler is expecting the next trait item declaration in the middle of the previous trait item due to extra closing braces. r? @estebank (thanks for the minimized test case)
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/issue-60075.rs | 12 | ||||
| -rw-r--r-- | src/test/ui/issue-60075.stderr | 37 |
2 files changed, 49 insertions, 0 deletions
diff --git a/src/test/ui/issue-60075.rs b/src/test/ui/issue-60075.rs new file mode 100644 index 00000000000..5788716a526 --- /dev/null +++ b/src/test/ui/issue-60075.rs @@ -0,0 +1,12 @@ +fn main() {} + +trait T { + fn qux() -> Option<usize> { + let _ = if true { + }); +//~^ ERROR expected one of `async`, `const`, `extern`, `fn`, `type`, `unsafe`, or `}`, found `;` +//~^^ ERROR expected one of `.`, `;`, `?`, `else`, or an operator, found `}` +//~^^^ ERROR 6:11: 6:12: expected identifier, found `;` +//~^^^^ ERROR missing `fn`, `type`, or `const` for trait-item declaration + Some(4) + } diff --git a/src/test/ui/issue-60075.stderr b/src/test/ui/issue-60075.stderr new file mode 100644 index 00000000000..244aef2d1f0 --- /dev/null +++ b/src/test/ui/issue-60075.stderr @@ -0,0 +1,37 @@ +error: expected one of `.`, `;`, `?`, `else`, or an operator, found `}` + --> $DIR/issue-60075.rs:6:10 + | +LL | }); + | ^ expected one of `.`, `;`, `?`, `else`, or an operator here + +error: expected one of `async`, `const`, `extern`, `fn`, `type`, `unsafe`, or `}`, found `;` + --> $DIR/issue-60075.rs:6:11 + | +LL | fn qux() -> Option<usize> { + | - unclosed delimiter +LL | let _ = if true { +LL | }); + | ^ + | | + | help: `}` may belong here + +error: expected identifier, found `;` + --> $DIR/issue-60075.rs:6:11 + | +LL | }); + | ^ expected identifier + +error: missing `fn`, `type`, or `const` for trait-item declaration + --> $DIR/issue-60075.rs:6:12 + | +LL | }); + | ____________^ +LL | | +LL | | +LL | | +LL | | +LL | | Some(4) + | |________^ missing `fn`, `type`, or `const` + +error: aborting due to 4 previous errors + |
