Skip to content

fix(fiber): fiber functions are now 'static

Alexey Protsenko requested to merge fiber-functions-must-be-static into master

Previously fiber functions were allowed to capture any local values by reference which was unsafe. It would allow for a situation where the fiber outlives the captured data and the compiler wouldn't say anything. Making fiber functions required to be 'static helps us avoid such dangerous situations with a drawback of having to use Rc and Cell/RefCell for capturing data, which is a small price to pay for complete safety from dangling references.

Edited by Alexey Protsenko

Merge request reports