servo: Merge #6139 - Rustup fixes (from michaelwu:rustup-fixes); r=SimonSapin

Mutable transmutes and wrong transmutes fixed.

Source-Repo: https://github.com/servo/servo
Source-Revision: 64810583093dadfacbda942562853af1ae82e34e
This commit is contained in:
Michael Wu 2015-05-20 01:55:43 -05:00
parent 8af3f9a70e
commit d49fb75099
2 changed files with 7 additions and 7 deletions

View File

@ -169,7 +169,7 @@ trait ParallelPostorderDomTraversal : PostorderDomTraversal {
unsafe_node = layout_node_to_unsafe_layout_node(&parent);
let parent_layout_data: &mut LayoutDataWrapper = mem::transmute(parent_layout_data);
let parent_layout_data: &LayoutDataWrapper = mem::transmute(parent_layout_data);
if parent_layout_data
.data
.parallel
@ -221,7 +221,7 @@ trait ParallelPostorderFlowTraversal : PostorderFlowTraversal {
loop {
unsafe {
// Get a real flow.
let flow: &mut FlowRef = mem::transmute(&unsafe_flow);
let flow: &mut FlowRef = mem::transmute(&mut unsafe_flow);
// Perform the appropriate traversal.
if self.should_process(&mut **flow) {
@ -236,7 +236,7 @@ trait ParallelPostorderFlowTraversal : PostorderFlowTraversal {
Ordering::Relaxed);
// Possibly enqueue the parent.
let unsafe_parent = base.parallel.parent;
let mut unsafe_parent = base.parallel.parent;
if unsafe_parent == null_unsafe_flow() {
// We're done!
break
@ -245,7 +245,7 @@ trait ParallelPostorderFlowTraversal : PostorderFlowTraversal {
// No, we're not at the root yet. Then are we the last child
// of our parent to finish processing? If so, we can continue
// on with our parent; otherwise, we've gotta wait.
let parent: &mut FlowRef = mem::transmute(&unsafe_parent);
let parent: &mut FlowRef = mem::transmute(&mut unsafe_parent);
let parent_base = flow::mut_base(&mut **parent);
if parent_base.parallel.children_count.fetch_sub(1, Ordering::SeqCst) == 1 {
// We were the last child of our parent. Reflow our parent.
@ -269,14 +269,14 @@ trait ParallelPreorderFlowTraversal : PreorderFlowTraversal {
#[inline(always)]
fn run_parallel_helper(&self,
unsafe_flow: UnsafeFlow,
mut unsafe_flow: UnsafeFlow,
proxy: &mut WorkerProxy<SharedLayoutContextWrapper,UnsafeFlow>,
top_down_func: FlowTraversalFunction,
bottom_up_func: FlowTraversalFunction) {
let mut had_children = false;
unsafe {
// Get a real flow.
let flow: &mut FlowRef = mem::transmute(&unsafe_flow);
let flow: &mut FlowRef = mem::transmute(&mut unsafe_flow);
if self.should_record_thread_ids() {
flow::mut_base(&mut **flow).thread_id = proxy.worker_index();

View File

@ -245,7 +245,7 @@ impl LayoutDataRef {
#[inline]
#[allow(unsafe_code)]
pub unsafe fn borrow_unchecked(&self) -> *const Option<LayoutData> {
mem::transmute(&self.data_cell)
self.data_cell.as_unsafe_cell().get() as *const _
}
/// Borrows the layout data immutably. This function is *not* thread-safe.