diff options
author | Manish Goregaokar <manishsmail@gmail.com> | 2015-03-19 07:40:22 +0530 |
---|---|---|
committer | Ms2ger <ms2ger@gmail.com> | 2015-03-21 10:27:32 +0100 |
commit | 3479d3fa7fbbfbcdbc92a93896b4a347338fe103 (patch) | |
tree | d05bd5d1964dfad791132d2384950cc681597f6e /components/layout | |
parent | 4eb26065acdc37d275e658d8581282cb39b90686 (diff) | |
download | servo-3479d3fa7fbbfbcdbc92a93896b4a347338fe103.tar.gz servo-3479d3fa7fbbfbcdbc92a93896b4a347338fe103.zip |
Replace unsafe_blocks by unsafe_code.
Diffstat (limited to 'components/layout')
29 files changed, 39 insertions, 30 deletions
diff --git a/components/layout/block.rs b/components/layout/block.rs index 1f6b64a97d2..231f406d25a 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -25,7 +25,7 @@ //! //! http://dev.w3.org/csswg/css-sizing/ -#![deny(unsafe_blocks)] +#![deny(unsafe_code)] use context::LayoutContext; use css::node_style::StyledNode; diff --git a/components/layout/construct.rs b/components/layout/construct.rs index a30f3aee701..675f49a2be8 100644 --- a/components/layout/construct.rs +++ b/components/layout/construct.rs @@ -11,7 +11,7 @@ //! maybe it's an absolute or fixed position thing that hasn't found its containing block yet. //! Construction items bubble up the tree from children to parents until they find their homes. -#![deny(unsafe_blocks)] +#![deny(unsafe_code)] use block::BlockFlow; use context::LayoutContext; diff --git a/components/layout/context.rs b/components/layout/context.rs index 7420a29fa9c..6c87ef63742 100644 --- a/components/layout/context.rs +++ b/components/layout/context.rs @@ -4,7 +4,7 @@ //! Data needed by the layout task. -#![allow(unsafe_blocks)] +#![allow(unsafe_code)] use css::matching::{ApplicableDeclarationsCache, StyleSharingCandidateCache}; diff --git a/components/layout/css/matching.rs b/components/layout/css/matching.rs index 59e9a75b8d9..8d25f7007f5 100644 --- a/components/layout/css/matching.rs +++ b/components/layout/css/matching.rs @@ -4,7 +4,7 @@ //! High-level interface to CSS selector matching. -#![allow(unsafe_blocks)] +#![allow(unsafe_code)] use context::SharedLayoutContext; use css::node_style::StyledNode; diff --git a/components/layout/css/node_style.rs b/components/layout/css/node_style.rs index 946ac11a5e7..5b33d8d4c2d 100644 --- a/components/layout/css/node_style.rs +++ b/components/layout/css/node_style.rs @@ -23,7 +23,7 @@ pub trait StyledNode { impl<'ln> StyledNode for ThreadSafeLayoutNode<'ln> { #[inline] - #[allow(unsafe_blocks)] + #[allow(unsafe_code)] fn style<'a>(&'a self) -> &'a Arc<ComputedValues> { unsafe { let layout_data_ref = self.borrow_layout_data(); diff --git a/components/layout/data.rs b/components/layout/data.rs index da24d662485..70ee8eb2c2e 100644 --- a/components/layout/data.rs +++ b/components/layout/data.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#![allow(unsafe_blocks)] +#![allow(unsafe_code)] use construct::{ConstructionItem, ConstructionResult}; use incremental::RestyleDamage; diff --git a/components/layout/display_list_builder.rs b/components/layout/display_list_builder.rs index 30483b64f65..d4a2e7c7e38 100644 --- a/components/layout/display_list_builder.rs +++ b/components/layout/display_list_builder.rs @@ -8,7 +8,7 @@ //! list building, as the actual painting does not happen here—only deciding *what* we're going to //! paint. -#![deny(unsafe_blocks)] +#![deny(unsafe_code)] use azure::azure_hl::Color; use block::BlockFlow; diff --git a/components/layout/flow.rs b/components/layout/flow.rs index 17ee14f7e00..46b69e2deaa 100644 --- a/components/layout/flow.rs +++ b/components/layout/flow.rs @@ -310,7 +310,7 @@ pub trait Flow: fmt::Debug + Sync { } /// Returns a layer ID for the given fragment. - #[allow(unsafe_blocks)] + #[allow(unsafe_code)] fn layer_id(&self, fragment_id: uint) -> LayerId { unsafe { let obj = mem::transmute::<&&Self, &raw::TraitObject>(&self); @@ -330,7 +330,7 @@ pub trait Flow: fmt::Debug + Sync { // Base access #[inline(always)] -#[allow(unsafe_blocks)] +#[allow(unsafe_code)] pub fn base<'a, T: ?Sized + Flow>(this: &'a T) -> &'a BaseFlow { unsafe { let obj = mem::transmute::<&&'a T, &'a raw::TraitObject>(&this); @@ -344,7 +344,7 @@ pub fn imm_child_iter<'a>(flow: &'a Flow) -> FlowListIterator<'a> { } #[inline(always)] -#[allow(unsafe_blocks)] +#[allow(unsafe_code)] pub fn mut_base<'a, T: ?Sized + Flow>(this: &'a mut T) -> &'a mut BaseFlow { unsafe { let obj = mem::transmute::<&&'a mut T, &'a raw::TraitObject>(&this); @@ -832,7 +832,9 @@ pub struct BaseFlow { pub flags: FlowFlags, } +#[allow(unsafe_code)] unsafe impl Send for BaseFlow {} +#[allow(unsafe_code)] unsafe impl Sync for BaseFlow {} impl fmt::Debug for BaseFlow { @@ -982,10 +984,12 @@ impl BaseFlow { self.children.iter_mut() } + #[allow(unsafe_code)] pub unsafe fn strong_ref_count<'a>(&'a self) -> &'a AtomicUsize { &self.strong_ref_count } + #[allow(unsafe_code)] pub unsafe fn weak_ref_count<'a>(&'a self) -> &'a AtomicUsize { &self.weak_ref_count } @@ -1355,6 +1359,7 @@ impl ContainingBlockLink { self.link = Some(link.downgrade()) } + #[allow(unsafe_code)] pub unsafe fn get<'a>(&'a mut self) -> &'a mut Option<WeakFlowRef> { &mut self.link } diff --git a/components/layout/flow_list.rs b/components/layout/flow_list.rs index bd72d7a62ae..20c69b6081c 100644 --- a/components/layout/flow_list.rs +++ b/components/layout/flow_list.rs @@ -31,6 +31,7 @@ impl FlowList { /// Provide a mutable reference to the front element, or None if the list is empty #[inline] + #[allow(unsafe_code)] pub unsafe fn front_mut<'a>(&'a mut self) -> Option<&'a mut Flow> { self.flows.front_mut().map(|head| &mut **head) } @@ -43,6 +44,7 @@ impl FlowList { /// Provide a mutable reference to the back element, or None if the list is empty #[inline] + #[allow(unsafe_code)] pub unsafe fn back_mut<'a>(&'a mut self) -> Option<&'a mut Flow> { self.flows.back_mut().map(|tail| &mut **tail) } diff --git a/components/layout/flow_ref.rs b/components/layout/flow_ref.rs index 19bce56e391..9a8e2bb580e 100644 --- a/components/layout/flow_ref.rs +++ b/components/layout/flow_ref.rs @@ -8,7 +8,7 @@ //! be superfluous. This design is largely duplicating logic of Arc<T> and //! Weak<T>; please see comments there for details. -#![allow(unsafe_blocks)] +#![allow(unsafe_code)] use flow::Flow; use flow; diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs index d39d0c4f74d..5b2c3d83a62 100644 --- a/components/layout/fragment.rs +++ b/components/layout/fragment.rs @@ -4,7 +4,7 @@ //! The `Fragment` type, which represents the leaves of the layout tree. -#![deny(unsafe_blocks)] +#![deny(unsafe_code)] use canvas::canvas_paint_task::CanvasMsg; use css::node_style::StyledNode; @@ -118,7 +118,9 @@ pub struct Fragment { pub debug_id: u16, } +#[allow(unsafe_code)] unsafe impl Send for Fragment {} +#[allow(unsafe_code)] unsafe impl Sync for Fragment {} impl Encodable for Fragment { diff --git a/components/layout/inline.rs b/components/layout/inline.rs index 3c0c0ccd0fe..0b645aa0971 100644 --- a/components/layout/inline.rs +++ b/components/layout/inline.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#![deny(unsafe_blocks)] +#![deny(unsafe_code)] use css::node_style::StyledNode; use context::LayoutContext; diff --git a/components/layout/layout_debug.rs b/components/layout/layout_debug.rs index ed73a1c693e..4066d07546d 100644 --- a/components/layout/layout_debug.rs +++ b/components/layout/layout_debug.rs @@ -6,6 +6,7 @@ //! that can be viewed by an external tool to make layout debugging easier. #![macro_use] +#![allow(unsafe_code)] // thread_local!() defines an unsafe function on Android use flow_ref::FlowRef; use flow; @@ -95,7 +96,6 @@ impl Drop for Scope { /// Generate a unique ID. This is used for items such as Fragment /// which are often reallocated but represent essentially the /// same data. -#[allow(unsafe_blocks)] pub fn generate_unique_debug_id() -> u16 { unsafe { DEBUG_ID_COUNTER.fetch_add(1, Ordering::SeqCst) as u16 } } diff --git a/components/layout/layout_task.rs b/components/layout/layout_task.rs index fa670ca1191..4df269e725a 100644 --- a/components/layout/layout_task.rs +++ b/components/layout/layout_task.rs @@ -5,7 +5,7 @@ //! The layout task. Performs layout on the DOM, builds display lists and sends them to be //! painted. -#![allow(unsafe_blocks)] +#![allow(unsafe_code)] use construct::ConstructionResult; use context::{SharedLayoutContext, SharedLayoutContextWrapper}; diff --git a/components/layout/lib.rs b/components/layout/lib.rs index 0beebba4c51..dafd3764688 100644 --- a/components/layout/lib.rs +++ b/components/layout/lib.rs @@ -17,7 +17,7 @@ #![feature(unsafe_destructor)] #![feature(unsafe_no_drop_flag)] -#![deny(unsafe_blocks)] +#![deny(unsafe_code)] #![allow(unrooted_must_root)] #![plugin(string_cache_plugin)] diff --git a/components/layout/list_item.rs b/components/layout/list_item.rs index e7c90257ccd..cb78f44399e 100644 --- a/components/layout/list_item.rs +++ b/components/layout/list_item.rs @@ -5,7 +5,7 @@ //! Layout for elements with a CSS `display` property of `list-item`. These elements consist of a //! block and an extra inline fragment for the marker. -#![deny(unsafe_blocks)] +#![deny(unsafe_code)] use block::BlockFlow; use context::LayoutContext; diff --git a/components/layout/model.rs b/components/layout/model.rs index 571a45a199e..64ba9a001d8 100644 --- a/components/layout/model.rs +++ b/components/layout/model.rs @@ -4,7 +4,7 @@ //! Borders, padding, and margins. -#![deny(unsafe_blocks)] +#![deny(unsafe_code)] use fragment::Fragment; diff --git a/components/layout/opaque_node.rs b/components/layout/opaque_node.rs index e40538251de..666d3a9eb11 100644 --- a/components/layout/opaque_node.rs +++ b/components/layout/opaque_node.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#![allow(unsafe_blocks)] +#![allow(unsafe_code)] use gfx::display_list::OpaqueNode; use libc::{c_void, uintptr_t}; diff --git a/components/layout/parallel.rs b/components/layout/parallel.rs index d65a14dadbd..5562db5e10d 100644 --- a/components/layout/parallel.rs +++ b/components/layout/parallel.rs @@ -6,7 +6,7 @@ //! //! This code is highly unsafe. Keep this file small and easy to audit. -#![allow(unsafe_blocks)] +#![allow(unsafe_code)] use context::{LayoutContext, SharedLayoutContextWrapper, SharedLayoutContext}; use flow::{Flow, MutableFlowUtils, PreorderFlowTraversal, PostorderFlowTraversal}; diff --git a/components/layout/table.rs b/components/layout/table.rs index 0c1e0c259ef..85bab65e036 100644 --- a/components/layout/table.rs +++ b/components/layout/table.rs @@ -4,7 +4,7 @@ //! CSS table formatting contexts. -#![deny(unsafe_blocks)] +#![deny(unsafe_code)] use block::{self, BlockFlow, CandidateBSizeIterator, ISizeAndMarginsComputer}; use block::{ISizeConstraintInput, ISizeConstraintSolution}; diff --git a/components/layout/table_caption.rs b/components/layout/table_caption.rs index b0b08e7cdec..06617e8c198 100644 --- a/components/layout/table_caption.rs +++ b/components/layout/table_caption.rs @@ -4,7 +4,7 @@ //! CSS table formatting contexts. -#![deny(unsafe_blocks)] +#![deny(unsafe_code)] use block::BlockFlow; use context::LayoutContext; diff --git a/components/layout/table_cell.rs b/components/layout/table_cell.rs index 5ab285aa00e..1de720b2516 100644 --- a/components/layout/table_cell.rs +++ b/components/layout/table_cell.rs @@ -4,7 +4,7 @@ //! CSS table formatting contexts. -#![deny(unsafe_blocks)] +#![deny(unsafe_code)] use block::{BlockFlow, ISizeAndMarginsComputer, MarginsMayCollapseFlag}; use context::LayoutContext; diff --git a/components/layout/table_colgroup.rs b/components/layout/table_colgroup.rs index 61008cd2506..edb6d64bd0f 100644 --- a/components/layout/table_colgroup.rs +++ b/components/layout/table_colgroup.rs @@ -4,7 +4,7 @@ //! CSS table formatting contexts. -#![deny(unsafe_blocks)] +#![deny(unsafe_code)] use context::LayoutContext; use css::node_style::StyledNode; diff --git a/components/layout/table_row.rs b/components/layout/table_row.rs index 44ac99420dc..5d05a5fd5b5 100644 --- a/components/layout/table_row.rs +++ b/components/layout/table_row.rs @@ -4,7 +4,7 @@ //! CSS table formatting contexts. -#![deny(unsafe_blocks)] +#![deny(unsafe_code)] use block::BlockFlow; use block::ISizeAndMarginsComputer; diff --git a/components/layout/table_rowgroup.rs b/components/layout/table_rowgroup.rs index 173310de6e2..64f39412a33 100644 --- a/components/layout/table_rowgroup.rs +++ b/components/layout/table_rowgroup.rs @@ -4,7 +4,7 @@ //! CSS table formatting contexts. -#![deny(unsafe_blocks)] +#![deny(unsafe_code)] use block::{BlockFlow, ISizeAndMarginsComputer}; use context::LayoutContext; diff --git a/components/layout/table_wrapper.rs b/components/layout/table_wrapper.rs index 84524285d2b..a291224944e 100644 --- a/components/layout/table_wrapper.rs +++ b/components/layout/table_wrapper.rs @@ -11,7 +11,7 @@ //! //! Hereafter this document is referred to as INTRINSIC. -#![deny(unsafe_blocks)] +#![deny(unsafe_code)] use block::{BlockFlow, BlockNonReplaced, FloatNonReplaced, ISizeAndMarginsComputer}; use block::{MarginsMayCollapseFlag}; diff --git a/components/layout/text.rs b/components/layout/text.rs index 9ac4d9b1174..66a7597c891 100644 --- a/components/layout/text.rs +++ b/components/layout/text.rs @@ -4,7 +4,7 @@ //! Text layout. -#![deny(unsafe_blocks)] +#![deny(unsafe_code)] use fragment::{Fragment, SpecificFragmentInfo, ScannedTextFragmentInfo}; use inline::InlineFragments; diff --git a/components/layout/traversal.rs b/components/layout/traversal.rs index 228fdd6e7f0..a206bf75b4a 100644 --- a/components/layout/traversal.rs +++ b/components/layout/traversal.rs @@ -4,7 +4,7 @@ //! Traversals over the DOM and flow trees, running the layout computations. -#![allow(unsafe_blocks)] +#![allow(unsafe_code)] use css::node_style::StyledNode; use css::matching::{ApplicableDeclarations, MatchMethods, StyleSharingResult}; diff --git a/components/layout/wrapper.rs b/components/layout/wrapper.rs index ce42907f119..101249b4747 100644 --- a/components/layout/wrapper.rs +++ b/components/layout/wrapper.rs @@ -30,7 +30,7 @@ //! o Instead of `html_element_in_html_document()`, use //! `html_element_in_html_document_for_layout()`. -#![allow(unsafe_blocks)] +#![allow(unsafe_code)] use canvas::canvas_paint_task::CanvasMsg; use context::SharedLayoutContext; |