struct Foo<T>;
fn test<T>() {
type F = Foo<T>; // type alias for brevity
}
produces: “error: can’t use type parameters from outer function; try using a local type parameter instead [E0401]”.
The --explain output does a good enough job stating the rule: “Items inside functions are basically just like top-level items, except that they can only be used from the function they are in.” But it doesn’t state any reason why this should be the case, and I can’t think of any other than implementation limitations: the semantics of allowing such references would be straightforward. While nested fns can be replaced with closures, that doesn’t work for type aliases and structs, leaving a choice between repeating type parameters (potentially a lot of them) everywhere the type is used, or creating a verbose boilerplate helper function or struct.
Worth creating a RFC over?