mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Remove no_move annotation now that gecko style structs are movable.
This commit is contained in:
parent
4c5f1a375e
commit
e6fe4791f3
1 changed files with 0 additions and 12 deletions
|
@ -103,7 +103,6 @@ impl ComputedValues for GeckoComputedValues {
|
|||
|
||||
<%def name="declare_style_struct(style_struct)">
|
||||
#[derive(Clone, HeapSizeOf, Debug)]
|
||||
#[no_move]
|
||||
% if style_struct.gecko_ffi_name:
|
||||
pub struct ${style_struct.gecko_struct_name} {
|
||||
gecko: ${style_struct.gecko_ffi_name},
|
||||
|
@ -189,17 +188,6 @@ def set_gecko_property(ffi_name, expr):
|
|||
impl ${style_struct.gecko_struct_name} {
|
||||
#[allow(dead_code, unused_variables)]
|
||||
fn initial() -> Arc<Self> {
|
||||
// Some Gecko style structs have AutoTArray members, which have internal pointers and are
|
||||
// thus MOZ_NON_MEMMOVABLE. Since Rust is generally a very move-happy language, we need to
|
||||
// be very careful that nsStyle* structs are never moved after they are constructed.
|
||||
//
|
||||
// By annotating the structs [no_move], we can get the |rust-tenacious| linter to trigger
|
||||
// an error on any semantic moves. But we don't have a great way of telling LLVM to
|
||||
// allocate our new object directly on the heap without using a temporary. So to do that
|
||||
// (and also please tenacious), we pass zeroed memory into the Arc constructor, and _then_
|
||||
// use make_mut to get a reference to pass to the Gecko constructor. Since the refcount is
|
||||
// guaranteed to be 1, make_mut will always pass us a direct reference instead of taking
|
||||
// the copy-on-write path.
|
||||
let mut result = Arc::new(${style_struct.gecko_struct_name} { gecko: unsafe { zeroed() } });
|
||||
unsafe {
|
||||
Gecko_Construct_${style_struct.gecko_ffi_name}(&mut Arc::make_mut(&mut result).gecko);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue