2021-11-04 11:57:40 -05:00
|
|
|
enum Hey<A, B> {
|
|
|
|
A(A),
|
|
|
|
B(B),
|
|
|
|
}
|
|
|
|
|
2022-01-11 22:22:00 -06:00
|
|
|
struct Foo {
|
|
|
|
bar: Option<i32>,
|
|
|
|
}
|
|
|
|
|
2021-11-04 11:57:40 -05:00
|
|
|
fn f() {}
|
|
|
|
|
|
|
|
fn a() -> Option<()> {
|
|
|
|
while false {
|
|
|
|
//~^ ERROR mismatched types
|
|
|
|
f();
|
|
|
|
}
|
|
|
|
//~^ HELP try adding an expression
|
|
|
|
}
|
|
|
|
|
|
|
|
fn b() -> Result<(), ()> {
|
|
|
|
f()
|
|
|
|
//~^ ERROR mismatched types
|
|
|
|
//~| HELP try adding an expression
|
|
|
|
}
|
|
|
|
|
2022-01-19 06:11:48 -06:00
|
|
|
fn c() -> Option<()> {
|
|
|
|
for _ in [1, 2] {
|
|
|
|
//~^ ERROR mismatched types
|
|
|
|
f();
|
|
|
|
}
|
|
|
|
//~^ HELP try adding an expression
|
|
|
|
}
|
|
|
|
|
|
|
|
fn d() -> Option<()> {
|
|
|
|
c()?
|
|
|
|
//~^ ERROR incompatible types
|
|
|
|
//~| HELP try removing this `?`
|
|
|
|
//~| HELP try adding an expression
|
|
|
|
}
|
|
|
|
|
2021-11-04 11:57:40 -05:00
|
|
|
fn main() {
|
|
|
|
let _: Option<()> = while false {};
|
|
|
|
//~^ ERROR mismatched types
|
|
|
|
//~| HELP try wrapping
|
|
|
|
let _: Option<()> = {
|
|
|
|
while false {}
|
|
|
|
//~^ ERROR mismatched types
|
|
|
|
//~| HELP try adding an expression
|
|
|
|
};
|
|
|
|
let _: Result<i32, i32> = 1;
|
|
|
|
//~^ ERROR mismatched types
|
|
|
|
//~| HELP try wrapping
|
|
|
|
let _: Option<i32> = 1;
|
|
|
|
//~^ ERROR mismatched types
|
|
|
|
//~| HELP try wrapping
|
|
|
|
let _: Hey<i32, i32> = 1;
|
|
|
|
//~^ ERROR mismatched types
|
|
|
|
//~| HELP try wrapping
|
|
|
|
let _: Hey<i32, bool> = false;
|
|
|
|
//~^ ERROR mismatched types
|
|
|
|
//~| HELP try wrapping
|
2022-01-11 22:22:00 -06:00
|
|
|
let bar = 1i32;
|
|
|
|
let _ = Foo { bar };
|
|
|
|
//~^ ERROR mismatched types
|
|
|
|
//~| HELP try wrapping
|
2021-11-04 11:57:40 -05:00
|
|
|
}
|
2022-03-27 18:05:14 -05:00
|
|
|
|
|
|
|
enum A {
|
2022-07-31 09:09:39 -05:00
|
|
|
B { b: B },
|
2022-03-27 18:05:14 -05:00
|
|
|
}
|
|
|
|
|
2022-03-27 18:15:26 -05:00
|
|
|
struct A2(B);
|
|
|
|
|
2022-03-27 18:05:14 -05:00
|
|
|
enum B {
|
|
|
|
Fst,
|
|
|
|
Snd,
|
|
|
|
}
|
|
|
|
|
|
|
|
fn foo() {
|
|
|
|
let a: A = B::Fst;
|
|
|
|
//~^ ERROR mismatched types
|
2022-07-31 09:09:39 -05:00
|
|
|
//~| HELP try wrapping
|
2022-03-27 18:15:26 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn bar() {
|
|
|
|
let a: A2 = B::Fst;
|
|
|
|
//~^ ERROR mismatched types
|
|
|
|
//~| HELP try wrapping
|
|
|
|
}
|