mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-15 05:26:47 +00:00
Add more test cases to tests/ui/issues/issue-92741.rs
This commit is contained in:
parent
9cdc07538d
commit
039f70e926
@ -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 }
|
||||
}
|
||||
|
@ -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`.
|
||||
|
Loading…
Reference in New Issue
Block a user