Auto merge of #11641 - Ms2ger:flow-deref-mut-lifetime, r=nox

Correct the signature of flow_ref::deref_mut.

This also fixes Undefined Behavior in build_display_list_for_subtree.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11641)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-06-06 08:18:05 -05:00
commit a316fb73e5
2 changed files with 2 additions and 2 deletions

View file

@ -20,7 +20,7 @@ pub type WeakFlowRef = Weak<Flow>;
/// See https://github.com/servo/servo/issues/6503 /// See https://github.com/servo/servo/issues/6503
/// Use Arc::get_mut instead when possible (e.g. on an Arc that was just created). /// Use Arc::get_mut instead when possible (e.g. on an Arc that was just created).
#[allow(unsafe_code)] #[allow(unsafe_code)]
pub fn deref_mut<'a>(r: &mut FlowRef) -> &'a mut Flow { pub fn deref_mut<'a>(r: &'a mut FlowRef) -> &'a mut Flow {
let ptr: *const Flow = &**r; let ptr: *const Flow = &**r;
unsafe { unsafe {
&mut *(ptr as *mut Flow) &mut *(ptr as *mut Flow)

View file

@ -87,7 +87,7 @@ pub fn build_display_list_for_subtree(root: &mut FlowRef,
&mut root_stacking_context.children); &mut root_stacking_context.children);
let mut build_display_list = BuildDisplayList { let mut build_display_list = BuildDisplayList {
state: DisplayListBuildState::new(&layout_context, state: DisplayListBuildState::new(&layout_context,
flow::base(&**root).stacking_context_id), flow::base(&*flow_root).stacking_context_id),
}; };
build_display_list.traverse(&mut *flow_root); build_display_list.traverse(&mut *flow_root);
build_display_list.state.items build_display_list.state.items