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
Const contexts that are used as parts of types (array type and repeat length expressions as well as const generic arguments) can only make restricted use of surrounding generic type and lifetime parameters.
We should document what these restrictions are precisely.
Here's an example of what doesn't work:
fnfoo<constC:usize>(){let _ = [();const{C + 1}];//~^ ERROR generic parameters may not be used in const operations}
Similarly:
traitTr{constC:usize;}implTrfor(){constC:usize = 0;}fnfoo<T:Tr>(){let _ = [();const{T::C}];//~^ ERROR constant expression depends on a generic parameter}