Add more test cases to tests/ui/issues/issue-92741.rs

This commit is contained in:
CastilloDel 2023-02-06 15:30:29 +01:00
parent 9cdc07538d
commit 039f70e926
2 changed files with 41 additions and 1 deletions

View File

@ -4,3 +4,13 @@ fn foo() -> bool {
mut
if true { true } else { false }
}
fn bar() -> bool {
& //~ ERROR 9:5: 10:40: mismatched types [E0308]
mut if true { true } else { false }
}
fn baz() -> bool {
& mut //~ ERROR 14:5: 15:36: mismatched types [E0308]
if true { true } else { false }
}

View File

@ -14,6 +14,36 @@ LL - &
LL - mut
|
error: aborting due to previous error
error[E0308]: mismatched types
--> $DIR/issue-92741.rs:9:5
|
LL | fn bar() -> bool {
| ---- expected `bool` because of return type
LL | / &
LL | | mut if true { true } else { false }
| |_______________________________________^ expected `bool`, found `&mut bool`
|
help: consider removing the borrow
|
LL - &
LL - mut if true { true } else { false }
LL + if true { true } else { false }
|
error[E0308]: mismatched types
--> $DIR/issue-92741.rs:14:5
|
LL | fn baz() -> bool {
| ---- expected `bool` because of return type
LL | / & mut
LL | | if true { true } else { false }
| |___________________________________^ expected `bool`, found `&mut bool`
|
help: consider removing the borrow
|
LL - & mut
|
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0308`.