rust/tests/ui/did_you_mean/issue-42764.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

31 lines
685 B
Rust
Raw Normal View History

enum DoubleOption<T> {
FirstSome(T),
AlternativeSome(T),
Nothing,
}
fn this_function_expects_a_double_option<T>(d: DoubleOption<T>) {}
fn main() {
let n: usize = 42;
this_function_expects_a_double_option(n);
2017-11-20 06:13:27 -06:00
//~^ ERROR mismatched types
2021-11-04 11:57:30 -05:00
//~| HELP try wrapping the expression in a variant of `DoubleOption`
}
// But don't issue the "try using a variant" help if the one-"variant" ADT is
// actually a one-field struct.
struct Payload;
struct Wrapper { payload: Payload }
struct Context { wrapper: Wrapper }
fn overton() {
let _c = Context { wrapper: Payload{} };
//~^ ERROR mismatched types
2022-07-31 09:09:39 -05:00
//~| try wrapping the expression in `Wrapper`
}