Open Bug 1563623 Opened 4 months ago Updated 7 days ago

use MaybeUninit instead of mem::uninitialized

Categories

(Core :: CSS Parsing and Computation, defect, P3)

defect

Tracking

()

People

(Reporter: heycam, Unassigned)

References

(Depends on 2 open bugs, Blocks 1 open bug)

Details

Rust 1.36 has been released, and we should migrate from mem::uninitialized to MaybeUninit. mem::uninitialized will be deprecated in Rust 1.38.

https://gankro.github.io/blah/initialize-me-maybe/

Blocks: 1563876
Depends on: 1563378

FWIW, Servo is planning to do this so we'll get most of this when they get to it. I plan to do a sync tomorrow to allow this not to get too messy.

I had just started on doing this, but noticed that the current offset_of macro used in servo_arc relies on UB, and would continue to do so when converted to MaybeUninit. I have a patch to compute the offset differently which I'll upload to a separate bug.

Depends on: 1563988

Servo PR doing this in Stylo: https://github.com/servo/servo/pull/23726

m-c has a few other uses of mem::uninitialized in WebRender and Cubeb.

Depends on: 1564873
Depends on: 1565193
You need to log in before you can comment on or make changes to this bug.