Skip to content

Commit

Permalink
Bug 1503031 - use ::nserror::nsresult everywhere in IDL-generated Rus…
Browse files Browse the repository at this point in the history
…t files r=froydnj

After bug 1496622, the IDL parser converts some references to `nsresult` in IDL files to `::nserror::nsresult` in IDL-generated Rust files.  But it doesn't convert others.  It should convert them all consistently, and this patch makes it do so by adding conversion of the return type of attribute getters/setters and references generated by the IDL parser's Typedef class.

MozReview-Commit-ID: 838K8XGjvTx

Differential Revision: https://phabricator.services.mozilla.com/D10121

--HG--
extra : moz-landing-system : lando
  • Loading branch information
mykmelez committed Oct 29, 2018
1 parent 3df3ea0 commit 9b692b9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion xpcom/idl-parser/xpidl/rust_macros.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def attrAsMethodStruct(iface, m, getter):
return derive_method_tmpl % {
'name': rust.attributeNativeName(m, getter),
'params': ', '.join(params),
'ret': 'nsresult',
'ret': '::nserror::nsresult',
}


Expand Down
3 changes: 3 additions & 0 deletions xpcom/idl-parser/xpidl/xpidl.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,9 @@ def nativeType(self, calltype):
return "%s %s" % (self.name, '*' if 'out' in calltype else '')

def rustType(self, calltype):
if self.name == 'nsresult':
return '::nserror::nsresult'

return "%s%s" % (calltype != 'in' and '*mut ' or '',
self.name)

Expand Down

0 comments on commit 9b692b9

Please sign in to comment.