charon icon indicating copy to clipboard operation
charon copied to clipboard

Bug: Regions not properly tracked

Open ssyram opened this issue 4 months ago • 5 comments

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

ssyram avatar Sep 04 '25 07:09 ssyram

You're right, but this is quite difficult to fix in general. Is this something you need or just something you noticed?

Nadrieril avatar Sep 08 '25 15:09 Nadrieril

I just noticed this. This is totally fine for Eurydice so I don't mind it anyway...

ssyram avatar Sep 09 '25 02:09 ssyram

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.

Nadrieril avatar Sep 09 '25 09:09 Nadrieril

Where does the problem come from? I thought you had done a lot of work to properly track regions that are bound locally.

sonmarcho avatar Sep 16 '25 10:09 sonmarcho

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.

Nadrieril avatar Sep 16 '25 12:09 Nadrieril