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.
Do not emit type errors after parse error in last statement of block
When recovering from a parse error inside a block, do not emit type errors generating on that block's recovered return expression. Fix rust-lang#57383.
- Loading branch information
Showing
9 changed files
with
42 additions
and
61 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
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,5 +1,10 @@ | ||
fn main() { | ||
fn main() { // we don't complain about the return type being `{integer}` | ||
let t = (42, 42); | ||
t.0::<isize>; //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `::` | ||
//~| ERROR mismatched types | ||
} | ||
|
||
fn foo() -> usize { // we don't complain about the return type being unit | ||
let t = (42, 42); | ||
t.0::<isize>; //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `::` | ||
42; | ||
} |
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,16 +1,25 @@ | ||
fn test_if() { | ||
r#if true { } //~ ERROR found `true` | ||
//~| ERROR cannot find value `if` in this scope | ||
} | ||
|
||
fn test_struct() { | ||
r#struct Test; //~ ERROR found `Test` | ||
//~| ERROR cannot find value `struct` in this scope | ||
} | ||
|
||
fn test_union() { | ||
r#union Test; //~ ERROR found `Test` | ||
//~| ERROR cannot find value `union` in this scope | ||
} | ||
|
||
fn test_if_2() { | ||
let _ = r#if; //~ ERROR cannot find value `if` in this scope | ||
} | ||
|
||
fn test_struct_2() { | ||
let _ = r#struct; //~ ERROR cannot find value `struct` in this scope | ||
} | ||
|
||
fn test_union_2() { | ||
let _ = r#union; //~ ERROR cannot find value `union` in this scope | ||
} | ||
|
||
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
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