What's a motivation for E401 for inner functions?


#1

I want to write the RFC that allows inner functions to use type parameters that declared in outer functions. But I think that there was some motivation why this is disallowed. I have some thoughts about it: Probably it is made to ease handling of inner functions in cases like:

fn foo<T>() {
  fn inner_foo() {
  }
}

If type parameters are allowed in inner_foo, then it is required to create function for each T. I don’t know how hard it is to check whether T is used in inner_foo. If not then the compiler could create single inner_foo. I am waiting for a motivation from rustc team because they probably know reasons.