Add a test for #26577
This commit is contained in:
parent
5917d9fc62
commit
b4b8a6e0bb
2 changed files with 27 additions and 0 deletions
10
src/test/ui/block-expression-remove-semicolon.rs
Normal file
10
src/test/ui/block-expression-remove-semicolon.rs
Normal file
|
@ -0,0 +1,10 @@
|
|||
fn foo() -> i32 {
|
||||
0
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let x: i32 = {
|
||||
//~^ ERROR mismatched types
|
||||
foo(); //~ HELP consider removing this semicolon
|
||||
};
|
||||
}
|
17
src/test/ui/block-expression-remove-semicolon.stderr
Normal file
17
src/test/ui/block-expression-remove-semicolon.stderr
Normal file
|
@ -0,0 +1,17 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/block-expression-remove-semicolon.rs:6:18
|
||||
|
|
||||
LL | let x: i32 = {
|
||||
| __________________^
|
||||
LL | | //~^ ERROR mismatched types
|
||||
LL | | foo(); //~ HELP consider removing this semicolon
|
||||
| | - help: consider removing this semicolon
|
||||
LL | | };
|
||||
| |_____^ expected i32, found ()
|
||||
|
|
||||
= note: expected type `i32`
|
||||
found type `()`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
Loading…
Add table
Reference in a new issue