Add builtin for PtrLen
diff --git a/gen/src/write.rs b/gen/src/write.rs
index c690995..8af2fe5 100644
--- a/gen/src/write.rs
+++ b/gen/src/write.rs
@@ -353,6 +353,7 @@
write!(out, "{} ", annotation);
}
if efn.throws {
+ out.builtin.ptr_len = true;
write!(out, "::rust::repr::PtrLen ");
} else {
write_extern_return_type_space(out, &efn.ret);
@@ -425,6 +426,7 @@
writeln!(out, ";");
write!(out, " ");
if efn.throws {
+ out.builtin.ptr_len = true;
out.builtin.trycatch = true;
writeln!(out, "::rust::repr::PtrLen throw$;");
writeln!(out, " ::rust::behavior::trycatch(");
@@ -551,6 +553,7 @@
indirect_call: bool,
) {
if sig.throws {
+ out.builtin.ptr_len = true;
write!(out, "::rust::repr::PtrLen ");
} else {
write_extern_return_type_space(out, &sig.ret);
@@ -695,6 +698,7 @@
}
}
if sig.throws {
+ out.builtin.ptr_len = true;
write!(out, "::rust::repr::PtrLen error$ = ");
}
write!(out, "{}(", invoke);
@@ -811,7 +815,10 @@
write_type(out, &ty.inner);
write!(out, " *");
}
- Some(Type::Str(_)) => write!(out, "::rust::repr::PtrLen "),
+ Some(Type::Str(_)) => {
+ out.builtin.ptr_len = true;
+ write!(out, "::rust::repr::PtrLen ");
+ }
Some(Type::SliceRefU8(_)) => write!(out, "::rust::Slice<uint8_t>::Repr "),
Some(ty) if out.types.needs_indirect_abi(ty) => write!(out, "void "),
_ => write_return_type(out, ty),
@@ -824,7 +831,10 @@
write_type_space(out, &ty.inner);
write!(out, "*");
}
- Type::Str(_) => write!(out, "::rust::repr::PtrLen "),
+ Type::Str(_) => {
+ out.builtin.ptr_len = true;
+ write!(out, "::rust::repr::PtrLen ");
+ }
Type::SliceRefU8(_) => write!(out, "::rust::Slice<uint8_t>::Repr "),
_ => write_type_space(out, &arg.ty),
}