You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bind higher-ranked lifetimes of fn-pointer contract-target types #4933
A proof_for_contract target whose fn-pointer argument is higher-ranked (fn(&u8) -> u8 is for<'a> fn(&'a u8) -> u8) should stay distinct from the same target spelled with 'static (fn(&'static u8) -> u8). The BareFn arm added in #4916 erases the fn pointer's regions (Binder::dummy), so the two collapse to one type and a higher-ranked target resolves to a coexisting 'static impl instead of its own. The fix is to bind the higher-ranked lifetimes as late-bound regions, and it has to be syntax-driven, since erasing is correct when the 'static lifetime is written explicitly.
Use case:
proof_for_contract on a target whose fn-pointer argument is higher-ranked, when a fn(&'static u8) -> u8 sibling impl also exists (the two coexist, with coherence_leak_check only warning). Without the binding, the higher-ranked target resolves to the 'static impl and its harness reports the target as not reachable. tautschnig identified this in the review of #4916 (#4916 (comment)) and sketches the fix there. Follow-up to #4916 and #4909.
Test case:
Save as hr.rs (self-contained, no standard library):
On the BareFn arm (#4916), h_static verifies but h_hr fails: its target resolves to the 'static impl, so kani reports it as not reachable from the h_hr harness. With the binding, both should verify.
Activity
Disclose higher-ranked fn-pointer limitation; add fixme test
Resolve fn-pointer type arguments in contract target paths (model-che…