Bug: Regions not properly tracked
For codes in the test case charon/tests/ui/dyn-fn.rs, originally, the source code is:
&dyn for<'a> Fn(&'a mut u32) -> bool
But the generated TraitImpl for the Fn is then:
impl<'_0> Fn(&'_ mut (u32))> for closure
I think the erased region should be '_0 to match the source code case? @N1ark
You're right, but this is quite difficult to fix in general. Is this something you need or just something you noticed?
I just noticed this. This is totally fine for Eurydice so I don't mind it anyway...
Ok than it's a known imperfection of Charon that I hope we can fix eventually, but not a priority. Leaving the issue open for anyone else who notices this.
Where does the problem come from? I thought you had done a lot of work to properly track regions that are bound locally.
In this case it's related to closures, which are things that only exist inside a MIR body and as such tend to have erased lifetimes even in their definition. Another place where we lack lifetimes in in the trait reference resolution algorithm.