Remove Borrowed<T>/BorrowedMut<T>, use Option<&T> instead.

This commit is contained in:
Manish Goregaokar 2016-10-04 15:01:49 +05:30
parent fc251384a7
commit b416ccfcae
6 changed files with 41 additions and 171 deletions

View file

@ -440,7 +440,7 @@ def build(objdir, target_name, debug, debugger, kind_name=None,
flags.append("{}BorrowedOrNull".format(ty))
flags.append("--raw-line")
flags.append("pub type {0}BorrowedOrNull<'a> = \
::gecko_bindings::sugar::ownership::Borrowed<'a, {0}>;".format(ty))
Option<&'a {0}>;".format(ty))
flags.append("--blacklist-type")
flags.append("{}Borrowed".format(ty))
flags.append("--raw-line")
@ -457,7 +457,7 @@ def build(objdir, target_name, debug, debugger, kind_name=None,
flags.append("{}BorrowedOrNull".format(ty))
flags.append("--raw-line")
flags.append("pub type {0}BorrowedOrNull<'a> = \
::gecko_bindings::sugar::ownership::Borrowed<'a, {0}>;".format(ty))
Option<&'a {0}>;".format(ty))
# Right now the only immutable borrow types are ones which we import
# from the |structs| module. As such, we don't need to create an opaque
# type with zero_size_type. If we ever introduce immutable borrow types
@ -487,12 +487,12 @@ def build(objdir, target_name, debug, debugger, kind_name=None,
flags.append("--blacklist-type")
flags.append("{}BorrowedOrNull".format(ty))
flags.append("--raw-line")
flags.append("pub type {0}BorrowedOrNull<'a> = ::gecko_bindings::sugar::ownership::Borrowed<'a, {0}>;"
flags.append("pub type {0}BorrowedOrNull<'a> = Option<&'a {0}>;"
.format(ty))
flags.append("--blacklist-type")
flags.append("{}BorrowedMutOrNull".format(ty))
flags.append("--raw-line")
flags.append("pub type {0}BorrowedMutOrNull<'a> = ::gecko_bindings::sugar::ownership::BorrowedMut<'a, {0}>;"
flags.append("pub type {0}BorrowedMutOrNull<'a> = Option<&'a mut {0}>;"
.format(ty))
flags.append("--blacklist-type")
flags.append("{}OwnedOrNull".format(ty))