You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
error[E0282]: type annotations needed for `Option<T>`
--> sandbox\src\main.rs:5:5
|
5 | foo: Option<T>,
| ^^^
|
help: consider giving `foo` an explicit type, where the type for type parameter `T` is specified
|
5 | foo: Option<T>: Option<T>,
| +++++++++++
The text was updated successfully, but these errors were encountered:
error: unexpected end of input, expected an expression
|
2 | #[builder(build_method(into=Bar<T>))]
|
In my current use case, Bar is not generic so a fix to the first problem would be already very helpful. However, if conversion to generic types could be supported that might be useful as well.
Without the conversion, Foo { foo } would have gotten the type of the concrete Foo (because that would have been the return value of the function, and there would have been no .into(). But with the conversion the compiler has no way to know the value of the Foo { foo } - which also means it has no way to know the value of the foo.
into=Bar))]
As for the second issue - I'm afraid you are going to have to use the turbofish:
Thank you for a very quick fix! And how silly of me not to try the turbofish, thanks for pointing this out as well. (The error message wasn't exactly helpful here, but I guess that's what we get with macros.)
This code:
yields this error:
The text was updated successfully, but these errors were encountered: