Using `Context` to report cancel safety

Often futures aren't cancel safe only for a brief periods of time - in some small subset of states. It would be great if those sub-futures can notify the executor (or context in between the future and the executor) that you better keep polling me or I will bug / panic / UB (would be good to have UB as an option too).

What are your thoughts about it?

This would require poll to be an unsafe function, which is a breaking change.

Context may have a capability and setting "I am capable of driving UB protected futures" would be unsafe.

This should be left to async Drop.

Without a language/type system guarantee this can't be used for actually-unsafe things in safe APIs.

This does not work because a poll implementation could forward the same Context to a different future's poll without upholding the capabilities it declares to that other future.

In other words the executor capabilities can only apply to the outmost Future, and it should be impossible to propagate them to nested Futures without unsafe. Context allows doing this without unsafe so it cannot be used for it.

Yeah, that's exactly what I had in mind and what is the purpose of this thread. To collect ideas and brainstorm options