aboutsummaryrefslogtreecommitdiffstats
path: root/components/script_layout_interface/lib.rs
diff options
context:
space:
mode:
authorImanol Fernandez <mortimergoro@gmail.com>2017-05-12 12:17:58 +0200
committerImanol Fernandez <mortimergoro@gmail.com>2017-05-12 12:48:13 +0200
commit593e89086fd1bd7a1cb9c496ad5837a3c7ba594e (patch)
tree0b11e4dc542751a897297c1e3dfa28067c4a622d /components/script_layout_interface/lib.rs
parent48fdda3f075572897e9f0d846dcf1897eae5b230 (diff)
downloadservo-593e89086fd1bd7a1cb9c496ad5837a3c7ba594e.tar.gz
servo-593e89086fd1bd7a1cb9c496ad5837a3c7ba594e.zip
Fix unsafe AtomicRefCell<PersistentLayoutData> transmute due to memory alignment differences
Diffstat (limited to 'components/script_layout_interface/lib.rs')
-rw-r--r--components/script_layout_interface/lib.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/components/script_layout_interface/lib.rs b/components/script_layout_interface/lib.rs
index 46d9bf2aadc..ddeed0d6366 100644
--- a/components/script_layout_interface/lib.rs
+++ b/components/script_layout_interface/lib.rs
@@ -50,6 +50,7 @@ use servo_url::ServoUrl;
use std::sync::atomic::AtomicIsize;
use style::data::ElementData;
+#[repr(C)]
pub struct PartialPersistentLayoutData {
/// Data that the style system associates with a node. When the
/// style system is being used standalone, this is all that hangs
@@ -59,6 +60,9 @@ pub struct PartialPersistentLayoutData {
/// Information needed during parallel traversals.
pub parallel: DomParallelInfo,
+
+ // Required alignment for safe transmutes between PersistentLayoutData and PartialPersistentLayoutData.
+ _align: [u64; 0]
}
impl PartialPersistentLayoutData {
@@ -66,6 +70,7 @@ impl PartialPersistentLayoutData {
PartialPersistentLayoutData {
style_data: ElementData::new(None),
parallel: DomParallelInfo::new(),
+ _align: [],
}
}
}