Skip to content

@bors-servo bors-servo tagged this Nov 12, 2019 · 88 commits to master since this tag

Fix CFRunLoop types to avoid UB

A number of callback functions associated with the CFRunLoop types are
allowed to be NULL to evoke default behavior.

Prior to this commit the definition of those structs prevented passing
in null which meant resorting to transmute or other tricks to
effectively set null, but with recent compiler versions the compiler
emits `ud2` instructions and triggers a fault at runtime.

The correct resolution for this is to define these fields as `Option`al
callbacks and that is what this commit does.

I've used this approach successfully here in another project:
Refs: https://github.com/wez/wezterm/commit/398f333c32fb1ff4ccd9cc001a66ae22522eb60c

I've bumped up the version for the crate as part of this commit
because it effectively changes the API around these structs.
Assets 2
You can’t perform that action at this time.