mirror of https://github.com/rust-lang/rust
24 lines
339 B
Rust
24 lines
339 B
Rust
struct S;
|
|
struct Y;
|
|
|
|
trait Trait {}
|
|
|
|
impl Trait for Y {}
|
|
|
|
fn foo() -> impl Trait {
|
|
if true {
|
|
S
|
|
} else {
|
|
Y //~ ERROR `if` and `else` have incompatible types
|
|
}
|
|
}
|
|
|
|
fn bar() -> impl Trait {
|
|
match true {
|
|
true => S,
|
|
false => Y, //~ ERROR `match` arms have incompatible types
|
|
}
|
|
}
|
|
|
|
fn main() {}
|