mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
style: Fix servo build, and appease tidy / fmt.
This commit is contained in:
parent
8c004c0858
commit
49842f5031
23 changed files with 165 additions and 53 deletions
|
@ -16,6 +16,8 @@ extern crate cssparser;
|
|||
extern crate servo_arc;
|
||||
extern crate smallbitvec;
|
||||
extern crate smallvec;
|
||||
#[cfg(feature = "string_cache")]
|
||||
extern crate string_cache;
|
||||
extern crate thin_slice;
|
||||
|
||||
use servo_arc::{Arc, ThinArc};
|
||||
|
@ -193,16 +195,18 @@ pub trait ToShmem: Sized {
|
|||
|
||||
#[macro_export]
|
||||
macro_rules! impl_trivial_to_shmem {
|
||||
($($ty:ty),*) => {$(
|
||||
impl $crate::ToShmem for $ty {
|
||||
fn to_shmem(
|
||||
&self,
|
||||
_builder: &mut $crate::SharedMemoryBuilder,
|
||||
) -> ::std::mem::ManuallyDrop<Self> {
|
||||
::std::mem::ManuallyDrop::new(*self)
|
||||
($($ty:ty),*) => {
|
||||
$(
|
||||
impl $crate::ToShmem for $ty {
|
||||
fn to_shmem(
|
||||
&self,
|
||||
_builder: &mut $crate::SharedMemoryBuilder,
|
||||
) -> ::std::mem::ManuallyDrop<Self> {
|
||||
::std::mem::ManuallyDrop::new(*self)
|
||||
}
|
||||
}
|
||||
}
|
||||
)*};
|
||||
)*
|
||||
};
|
||||
}
|
||||
|
||||
impl_trivial_to_shmem!(
|
||||
|
@ -522,3 +526,17 @@ impl ToShmem for SmallBitVec {
|
|||
ManuallyDrop::new(unsafe { SmallBitVec::from_storage(storage) })
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "string_cache")]
|
||||
impl<Static: string_cache::StaticAtomSet> ToShmem for string_cache::Atom<Static> {
|
||||
fn to_shmem(&self, _: &mut SharedMemoryBuilder) -> ManuallyDrop<Self> {
|
||||
// NOTE(emilio): In practice, this can be implemented trivially if
|
||||
// string_cache could expose the implementation detail of static atoms
|
||||
// being an index into the static table (and panicking in the
|
||||
// non-static, non-inline cases).
|
||||
unimplemented!(
|
||||
"If servo wants to share stylesheets across processes, \
|
||||
then ToShmem for Atom needs to be implemented"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue