feat: add unit test
This commit is contained in:
parent
62318b38ef
commit
c811acb1f3
2 changed files with 17 additions and 0 deletions
5
tests/ui/return/tail-expr-if-as-return.rs
Normal file
5
tests/ui/return/tail-expr-if-as-return.rs
Normal file
|
@ -0,0 +1,5 @@
|
|||
fn main() {
|
||||
if true {
|
||||
"" //~ ERROR mismatched types [E0308]
|
||||
}
|
||||
}
|
12
tests/ui/return/tail-expr-if-as-return.stderr
Normal file
12
tests/ui/return/tail-expr-if-as-return.stderr
Normal file
|
@ -0,0 +1,12 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/tail-expr-if-as-return.rs:3:9
|
||||
|
|
||||
LL | / if true {
|
||||
LL | | ""
|
||||
| | ^^ expected `()`, found `&str`
|
||||
LL | | }
|
||||
| |_____- expected this to be `()`
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
Loading…
Add table
Add a link
Reference in a new issue