Bug 1449159 - Move the allow(improper_ctypes) attribute to be more scoped. r?jrmuizel draft
authorKartikaya Gupta <kgupta@mozilla.com>
Tue, 27 Mar 2018 08:37:07 -0400
changeset 773145 7c1045f5c5d23e4a7b02d661182390d475a03790
parent 773144 b906009d875d1f5d29b0d1252cdb43a9b1a5889c
push id104138
push userkgupta@mozilla.com
push dateTue, 27 Mar 2018 12:37:35 +0000
reviewersjrmuizel
bugs1449159
milestone61.0a1
Bug 1449159 - Move the allow(improper_ctypes) attribute to be more scoped. r?jrmuizel Apparently applying it on an individual function inside the extern "C" block doesn't work so we have to apply it to the whole block. But that's better than applying it to the whole crate. MozReview-Commit-ID: GUMliaZragl
gfx/webrender_bindings/src/moz2d_renderer.rs
--- a/gfx/webrender_bindings/src/moz2d_renderer.rs
+++ b/gfx/webrender_bindings/src/moz2d_renderer.rs
@@ -1,9 +1,8 @@
-#![allow(improper_ctypes)] // this is needed so that rustc doesn't complain about passing the &Arc<Vec> to an extern function
 use webrender::api::*;
 use bindings::{ByteSlice, MutByteSlice, wr_moz2d_render_cb, ArcVecU8};
 use rayon::ThreadPool;
 
 use std::collections::hash_map::{HashMap, Entry};
 use std::mem;
 use std::os::raw::c_void;
 use std::ptr;
@@ -443,18 +442,19 @@ impl BlobImageRenderer for Moz2dImageRen
         unsafe { DeleteFontData(font); }
     }
 
     fn delete_font_instance(&mut self, _key: FontInstanceKey) {
     }
 }
 
 use bindings::WrFontKey;
+
+#[allow(improper_ctypes)] // this is needed so that rustc doesn't complain about passing the &Arc<Vec> to an extern function
 extern "C" {
-    #[allow(improper_ctypes)]
     fn AddFontData(key: WrFontKey, data: *const u8, size: usize, index: u32, vec: &ArcVecU8);
     fn AddNativeFontHandle(key: WrFontKey, handle: *mut c_void, index: u32);
     fn DeleteFontData(key: WrFontKey);
 }
 
 impl Moz2dImageRenderer {
     pub fn new(workers: Arc<ThreadPool>) -> Self {
         let (tx, rx) = channel();