blob: 442203addb787241788f92c9ee179506ae498367 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
// run-rustfix
struct A;
struct B;
impl From<A> for B {
fn from(_: A) -> Self { B }
}
fn foo1(x: Result<(), A>) -> Result<(), B> {
x //~ ERROR mismatched types
}
fn foo2(x: Result<(), A>) -> Result<(), B> {
return x; //~ ERROR mismatched types
}
fn foo3(x: Result<(), A>) -> Result<(), B> {
if true {
x //~ ERROR mismatched types
} else {
x //~ ERROR mismatched types
}
}
fn main() {
let _ = foo1(Ok(()));
let _ = foo2(Ok(()));
let _ = foo3(Ok(()));
}
|