2017-07-11 22:03:58 -05:00
|
|
|
error[E0308]: mismatched types
|
|
|
|
--> $DIR/issue-42764.rs:21:43
|
|
|
|
|
|
2018-02-22 18:42:32 -06:00
|
|
|
LL | this_function_expects_a_double_option(n);
|
2017-07-11 22:03:58 -05:00
|
|
|
| ^ expected enum `DoubleOption`, found usize
|
|
|
|
|
|
|
|
|
= note: expected type `DoubleOption<_>`
|
|
|
|
found type `usize`
|
2017-07-21 06:59:17 -05:00
|
|
|
help: try using a variant of the expected type
|
2017-07-11 22:03:58 -05:00
|
|
|
|
|
2018-02-24 17:01:39 -06:00
|
|
|
LL | this_function_expects_a_double_option(DoubleOption::FirstSome(n));
|
path, not name, in sole-argument variant type mismatch suggestion
We want the suggested replacement (which IDE tooling and such might offer to
automatically swap in) to, like, actually be correct: suggesting `MyVariant(x)`
when the actual fix is `MyEnum::MyVariant(x)` might be better than nothing, but
Rust is supposed to be the future of computing: we're better than better than
nothing.
As an exceptional case, we excise the prelude path, preferring to suggest
`Some` or `Ok` rather than `std::prelude::v1::Some` and
`std::prelude::v2::Ok`. (It's not worth the effort to future-proof against
hypothetical preludes v2, v3, &c.: we trust our successors to grep—excuse me,
ripgrep—for that.)
Also, don't make this preëmpt the existing probe-for-return-type suggestions,
despite their being looked unfavorably upon, at least in this situation
(https://github.com/rust-lang/rust/issues/42764#issuecomment-311388958): Cody
Schafer pointed out that that's a separate issue
(https://github.com/rust-lang/rust/pull/43178#issuecomment-314953229).
This is in the matter of #42764.
2017-07-15 12:26:11 -05:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2018-02-24 17:01:39 -06:00
|
|
|
LL | this_function_expects_a_double_option(DoubleOption::AlternativeSome(n));
|
path, not name, in sole-argument variant type mismatch suggestion
We want the suggested replacement (which IDE tooling and such might offer to
automatically swap in) to, like, actually be correct: suggesting `MyVariant(x)`
when the actual fix is `MyEnum::MyVariant(x)` might be better than nothing, but
Rust is supposed to be the future of computing: we're better than better than
nothing.
As an exceptional case, we excise the prelude path, preferring to suggest
`Some` or `Ok` rather than `std::prelude::v1::Some` and
`std::prelude::v2::Ok`. (It's not worth the effort to future-proof against
hypothetical preludes v2, v3, &c.: we trust our successors to grep—excuse me,
ripgrep—for that.)
Also, don't make this preëmpt the existing probe-for-return-type suggestions,
despite their being looked unfavorably upon, at least in this situation
(https://github.com/rust-lang/rust/issues/42764#issuecomment-311388958): Cody
Schafer pointed out that that's a separate issue
(https://github.com/rust-lang/rust/pull/43178#issuecomment-314953229).
This is in the matter of #42764.
2017-07-15 12:26:11 -05:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2017-07-11 22:03:58 -05:00
|
|
|
|
|
|
|
error: aborting due to previous error
|
|
|
|
|
2018-02-19 14:40:25 -06:00
|
|
|
If you want more information on this error, try using "rustc --explain E0308"
|