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
$ cargo build Compiling contract v0.1.0 (/path/to/contract)error[E0401]: can't use generic parameters from outer function --> src/lib.rs:10:28 |10 | pub fn method<T>(data: T) -> T { | --------- ^ use of generic parameter from outer function | | | | | type parameter from outer function | help: try using a local generic parameter instead: `method<T, T>`For more information about this error, try `rustc --explain E0401`.error: could not compile `contract` due to previous error
But technically, it's clear what the hurdle will be here. It's understandably tricky disambiguating between generic identifiers and explicitly typed ones. Would be interesting to investigate.
The text was updated successfully, but these errors were encountered:
One option is to just disable the declaration of generics in public functions altogether. Unsure if there's a use-case for them anyway. I can't personally think of any patterns that require them.
We should consider returning a neater error message stating that generics aren't supported, instead of the confusing error it currently returns.
Especially since, it's perfectly valid code without the
#[near_bindgen]
attr.But technically, it's clear what the hurdle will be here. It's understandably tricky disambiguating between generic identifiers and explicitly typed ones. Would be interesting to investigate.
The text was updated successfully, but these errors were encountered: