Set 'static lifetime for local variables of diverging functions?

Side question ā€“ is there a reason you chose Fn instead of FnOnce?

1 Like

My overlooking that point :sweat_smile::laughing::laughing:

=> s/Fn/FnOnce/g

1 Like

I agree, this should be sound. However, building a model that can actually verify these patterns is something we are currently looking into; once we have a model that is able to do so we'll check your approach and some less careful ones to see how much we can make work.

We currently think that your most conservative version should be no issue to prove correct.

That is the less cautious version indeed. It still seems sound but it is much more challenging, from what we can see so far in our attempts to build models for this -- some of our preliminary models likely can not prove correctness of this.

And then there is a version (that we cannot write in current Rust) that is definitely incompatible with generative lifetimes:

    fn with_diverging <T: lft -> type>(
        x: T<'_>,
        f: impl FnOnce(T<'a>) -> Diverging,
    ) -> ! // this function **never** returns (AbortOnDrop guard)

where T is a type constructor; this basically allows replacing a lifetime appearing anywhere in a type by 'static.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.