mirror of
https://github.com/servo/servo
synced 2026-04-28 10:27:40 +02:00
Make callbacks' new methods unsafe
They take raw pointers to contexts and objects.
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user