Description
openedon Mar 25, 2014
Spawned off of issue #5121.
The concrete problem that we are encountering is that the type fn_tpt.ty
extracted by check_item
still has formal generic parameters in it (e.g. so-called EarlyBound lifetimes) that should have been replaced with concrete types (such as unification variables, so-called Free lifetimes).
The solution in several of these instances is that typeck::check::check_item
handling of ItemFn
should subst more, in the same manner as done in check_method_body
.
That, or the substitution should be moved into the common control paths that are shared between check_item
and check_method_body
, e.g. check_bare_fn
or perhaps check_fn
.
(See also #13139 for the bug to try to safe-guard against future occurrences of this bug.)
Aside: Normally I would have just repurposed #5121 for this task, but local experimentation has shown that fixing this problem will not solve all of the ICE's nor all of the instances of unsoundness that are linked on #5121. So I am trying to track which issues are resolved and which remain unresolved by filing a separate issue and then checking off checkboxes accordingly.