aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Brubeck <mbrubeck@limpet.net>2017-09-20 13:26:40 -0700
committerMatt Brubeck <mbrubeck@limpet.net>2017-09-20 13:26:40 -0700
commit2795e5fa9c30a5d40efb90a9064bbce9fcc9302e (patch)
tree6baf871f1a028a4423338a5aa3e1c7bae5802ce0
parentf31c8e6673b1ef82b96dd29c342681ccfdf5af28 (diff)
downloadservo-2795e5fa9c30a5d40efb90a9064bbce9fcc9302e.tar.gz
servo-2795e5fa9c30a5d40efb90a9064bbce9fcc9302e.zip
Stop using unstable 'unique' feature
The `Unique` wrapper was only needed to provide the `Sync` trait.
-rw-r--r--components/gfx/lib.rs1
-rw-r--r--components/gfx/text/shaping/harfbuzz.rs12
2 files changed, 8 insertions, 5 deletions
diff --git a/components/gfx/lib.rs b/components/gfx/lib.rs
index ce24b697444..97bda55b563 100644
--- a/components/gfx/lib.rs
+++ b/components/gfx/lib.rs
@@ -7,7 +7,6 @@
#![feature(box_syntax)]
#![feature(cfg_target_feature)]
#![feature(range_contains)]
-#![feature(unique)]
#![deny(unsafe_code)]
diff --git a/components/gfx/text/shaping/harfbuzz.rs b/components/gfx/text/shaping/harfbuzz.rs
index ce61dd30c0e..1069e3460ba 100644
--- a/components/gfx/text/shaping/harfbuzz.rs
+++ b/components/gfx/text/shaping/harfbuzz.rs
@@ -164,7 +164,7 @@ impl Shaper {
Shaper::float_to_fixed(pt_size) as c_int);
// configure static function callbacks.
- hb_font_set_funcs(hb_font, HB_FONT_FUNCS.as_ptr(), font as *mut Font as *mut c_void, None);
+ hb_font_set_funcs(hb_font, HB_FONT_FUNCS.0, font as *mut Font as *mut c_void, None);
Shaper {
hb_face: hb_face,
@@ -411,9 +411,13 @@ impl Shaper {
}
}
-// Callbacks from Harfbuzz when font map and glyph advance lookup needed.
+/// Callbacks from Harfbuzz when font map and glyph advance lookup needed.
+struct FontFuncs(*mut hb_font_funcs_t);
+
+unsafe impl Sync for FontFuncs {}
+
lazy_static! {
- static ref HB_FONT_FUNCS: ptr::Unique<hb_font_funcs_t> = unsafe {
+ static ref HB_FONT_FUNCS: FontFuncs = unsafe {
let hb_funcs = hb_font_funcs_create();
hb_font_funcs_set_glyph_func(hb_funcs, Some(glyph_func), ptr::null_mut(), None);
hb_font_funcs_set_glyph_h_advance_func(
@@ -421,7 +425,7 @@ lazy_static! {
hb_font_funcs_set_glyph_h_kerning_func(
hb_funcs, Some(glyph_h_kerning_func), ptr::null_mut(), None);
- ptr::Unique::new_unchecked(hb_funcs)
+ FontFuncs(hb_funcs)
};
}