aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings/codegen/CodegenRust.py
diff options
context:
space:
mode:
authorAnthony Ramine <n.oxyde@gmail.com>2018-01-25 11:25:23 +0100
committerAnthony Ramine <n.oxyde@gmail.com>2018-01-25 11:25:23 +0100
commitf903da0a7bba2806e3a200eee8414a629d27ffa8 (patch)
tree1c33166825453e5ae71fd6bd8c7aae52c48c98ff /components/script/dom/bindings/codegen/CodegenRust.py
parent9c1307307575637f5ad360413c6a8395579ab511 (diff)
downloadservo-f903da0a7bba2806e3a200eee8414a629d27ffa8.tar.gz
servo-f903da0a7bba2806e3a200eee8414a629d27ffa8.zip
Make callbacks' new methods unsafe
They take raw pointers to contexts and objects.
Diffstat (limited to 'components/script/dom/bindings/codegen/CodegenRust.py')
-rw-r--r--components/script/dom/bindings/codegen/CodegenRust.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py
index 92f6b3a71b6..cc9a37a5ecc 100644
--- a/components/script/dom/bindings/codegen/CodegenRust.py
+++ b/components/script/dom/bindings/codegen/CodegenRust.py
@@ -4549,7 +4549,7 @@ class ClassConstructor(ClassItem):
"});\n"
"// Note: callback cannot be moved after calling init.\n"
"match Rc::get_mut(&mut ret) {\n"
- " Some(ref mut callback) => unsafe { callback.parent.init(%s, %s) },\n"
+ " Some(ref mut callback) => callback.parent.init(%s, %s),\n"
" None => unreachable!(),\n"
"};\n"
"ret") % (cgClass.name, '\n'.join(initializers),
@@ -4564,7 +4564,7 @@ class ClassConstructor(ClassItem):
body = ' {\n' + body + '}'
return string.Template("""\
-pub fn ${decorators}new(${args}) -> Rc<${className}>${body}
+pub unsafe fn ${decorators}new(${args}) -> Rc<${className}>${body}
""").substitute({'decorators': self.getDecorators(True),
'className': cgClass.getNameString(),
'args': args,