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[E0401]: can't use generic parameters from outer function
--> src/lib.rs:15:24
|
13 | impl<T: X> Z for B<T> {
| - type parameter from outer function
14 | fn a() -> i32 {
| - try adding a local generic parameter in this method instead
15 | const C: i32 = T::Y;
| ^^^^ use of generic parameter from outer function
This is limiting because if you're implementing a trait like X over an external type like Vec there's no way to declare a const that depends on the impl generic type. You can't make the const in the function scope, you can't make it in the impl scope, and you can't make it outside of the impl block since it relies on the generic parameter.
The text was updated successfully, but these errors were encountered:
The compiler misreports the following as error 401, saying you can't use generic parameters from an outer function.
This is limiting because if you're implementing a trait like
X
over an external type likeVec
there's no way to declare aconst
that depends on theimpl
generic type. You can't make theconst
in the function scope, you can't make it in theimpl
scope, and you can't make it outside of theimpl
block since it relies on the generic parameter.The text was updated successfully, but these errors were encountered: