mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Opt-in rather than opt-out to unsafe blocks in layout.
This commit is contained in:
parent
a819b0b1b6
commit
7c6b03abfe
12 changed files with 22 additions and 0 deletions
|
@ -294,6 +294,7 @@ pub trait Flow: fmt::Show + Sync {
|
|||
}
|
||||
|
||||
/// Returns a layer ID for the given fragment.
|
||||
#[allow(unsafe_blocks)]
|
||||
fn layer_id(&self, fragment_id: uint) -> LayerId {
|
||||
unsafe {
|
||||
let obj = mem::transmute::<&&Self, &raw::TraitObject>(&self);
|
||||
|
@ -310,6 +311,7 @@ pub trait Flow: fmt::Show + Sync {
|
|||
// Base access
|
||||
|
||||
#[inline(always)]
|
||||
#[allow(unsafe_blocks)]
|
||||
pub fn base<'a, T: ?Sized + Flow>(this: &'a T) -> &'a BaseFlow {
|
||||
unsafe {
|
||||
let obj = mem::transmute::<&&'a T, &'a raw::TraitObject>(&this);
|
||||
|
@ -323,6 +325,7 @@ pub fn imm_child_iter<'a>(flow: &'a Flow) -> FlowListIterator<'a> {
|
|||
}
|
||||
|
||||
#[inline(always)]
|
||||
#[allow(unsafe_blocks)]
|
||||
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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue