Rust miscompiles Servo after upgrading to new revision of Rust #16366
Closed
Description
In the current Servo Rust upgrade branch (rustup-20140804-debug-segfault 4f40685a), Servo currently dies with a double borrow error loading essentially any page:
$ ./servo http://www.google.com
task 'LayoutWorker' failed at 'RefCell<T> already borrowed', /Users/jack/src/rust/src/libcore/cell.rs:306
Moving a single line of code out of an unsafe
block makes this problem go away, which points to a miscompilation in at least one version of this code:
diff --git a/src/components/layout/layout_task.rs b/src/components/layout/layout_task.rs
index 632e3af..dd1bb09 100644
--- a/src/components/layout/layout_task.rs
+++ b/src/components/layout/layout_task.rs
@@ -573,9 +573,9 @@ impl LayoutTask {
/// The high-level routine that performs layout tasks.
fn handle_reflow(&mut self, data: &Reflow) {
+ let mut node: JS<Node> = unsafe { JS::from_trusted_node_address(data.document_root) };
// FIXME: Isolate this transmutation into a "bridge" module.
let node: &mut LayoutNode = unsafe {
- let mut node: JS<Node> = JS::from_trusted_node_address(data.document_root);
mem::transmute(&mut node)
};