diff options
author | bors-servo <servo-ops@mozilla.com> | 2020-05-26 07:09:59 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-26 07:09:59 -0400 |
commit | 844dd859b34be2ea30c48f1875acfc3ce58640ca (patch) | |
tree | 610e78841e16dfc71e11cf954feeb39b353ab3d4 /components/script/canvas_state.rs | |
parent | 57846678c285670d7d1f0b13be258f79c15010de (diff) | |
parent | 3160e62b8ad8a6ab29289151b58d91d31326e578 (diff) | |
download | servo-844dd859b34be2ea30c48f1875acfc3ce58640ca.tar.gz servo-844dd859b34be2ea30c48f1875acfc3ce58640ca.zip |
Auto merge of #26641 - dylni:fix-undefined-behavior, r=SimonSapin
Fix undefined behavior in `energymon::init`
<!-- Please describe your changes on the following line: -->
The layout of [`Box`](https://doc.rust-lang.org/std/boxed/struct.Box.html) is implicitly [`#[repr(Rust)]`](https://doc.rust-lang.org/nomicon/repr-rust.html), so it is undefined behavior to transmute it to another type. [`Box::into_raw`](https://doc.rust-lang.org/std/boxed/struct.Box.html#method.into_raw) can safely convert it to a pointer.
I did not run the test suite locally. I thought it would be better to let CI run than to set up the development environment for such a simple change. I did test that the file works individually with this change.
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [ ] `./mach build -d` does not report any errors
- [ ] `./mach test-tidy` does not report any errors
<!-- Either: -->
- [X] These changes do not require tests because the undefined behavior is not visible
<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Diffstat (limited to 'components/script/canvas_state.rs')
0 files changed, 0 insertions, 0 deletions