Bump namespace to 05

This commit is contained in:
David Tolnay 2020-10-08 18:21:13 -07:00
parent 66ebdd1d1f
commit 8f16ae75f3
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
18 changed files with 181 additions and 181 deletions

View File

@ -3,7 +3,7 @@ name = "cxx"
version = "0.4.7" # remember to update html_root_url
authors = ["David Tolnay <dtolnay@gmail.com>"]
edition = "2018"
links = "cxxbridge04"
links = "cxxbridge05"
license = "MIT OR Apache-2.0"
description = "Safe interop between Rust and C++"
repository = "https://github.com/dtolnay/cxx"

View File

@ -7,7 +7,7 @@ fn main() {
.cpp(true)
.cpp_link_stdlib(None) // linked via link-cplusplus crate
.flag_if_supported(cxxbridge_flags::STD)
.compile("cxxbridge04");
.compile("cxxbridge05");
println!("cargo:rerun-if-changed=src/cxx.cc");
println!("cargo:rerun-if-changed=include/cxx.h");
println!("cargo:rustc-cfg=built_with_cargo");

View File

@ -263,7 +263,7 @@ fn make_include_dir(prj: &Project) -> Result<PathBuf> {
let include_dir = prj.out_dir.join("cxxbridge").join("include");
let cxx_h = include_dir.join("rust").join("cxx.h");
let ref shared_cxx_h = prj.shared_dir.join("rust").join("cxx.h");
if let Some(ref original) = env::var_os("DEP_CXXBRIDGE04_HEADER") {
if let Some(ref original) = env::var_os("DEP_CXXBRIDGE05_HEADER") {
out::symlink_file(original, cxx_h)?;
out::symlink_file(original, shared_cxx_h)?;
} else {

View File

@ -245,7 +245,7 @@ fn write_include_cxxbridge(out: &mut OutFile, apis: &[Api], types: &Types) {
}
out.begin_block("namespace rust");
out.begin_block("inline namespace cxxbridge04");
out.begin_block("inline namespace cxxbridge05");
if needs_panic
|| needs_rust_string
@ -263,22 +263,22 @@ fn write_include_cxxbridge(out: &mut OutFile, apis: &[Api], types: &Types) {
writeln!(out, "// #include \"rust/cxx.h\"");
}
include::write(out, needs_panic, "CXXBRIDGE04_PANIC");
include::write(out, needs_panic, "CXXBRIDGE05_PANIC");
if needs_rust_string {
out.next_section();
writeln!(out, "struct unsafe_bitcopy_t;");
}
include::write(out, needs_rust_string, "CXXBRIDGE04_RUST_STRING");
include::write(out, needs_rust_str, "CXXBRIDGE04_RUST_STR");
include::write(out, needs_rust_slice, "CXXBRIDGE04_RUST_SLICE");
include::write(out, needs_rust_box, "CXXBRIDGE04_RUST_BOX");
include::write(out, needs_unsafe_bitcopy, "CXXBRIDGE04_RUST_BITCOPY");
include::write(out, needs_rust_vec, "CXXBRIDGE04_RUST_VEC");
include::write(out, needs_rust_fn, "CXXBRIDGE04_RUST_FN");
include::write(out, needs_rust_error, "CXXBRIDGE04_RUST_ERROR");
include::write(out, needs_rust_isize, "CXXBRIDGE04_RUST_ISIZE");
include::write(out, needs_rust_string, "CXXBRIDGE05_RUST_STRING");
include::write(out, needs_rust_str, "CXXBRIDGE05_RUST_STR");
include::write(out, needs_rust_slice, "CXXBRIDGE05_RUST_SLICE");
include::write(out, needs_rust_box, "CXXBRIDGE05_RUST_BOX");
include::write(out, needs_unsafe_bitcopy, "CXXBRIDGE05_RUST_BITCOPY");
include::write(out, needs_rust_vec, "CXXBRIDGE05_RUST_VEC");
include::write(out, needs_rust_fn, "CXXBRIDGE05_RUST_FN");
include::write(out, needs_rust_error, "CXXBRIDGE05_RUST_ERROR");
include::write(out, needs_rust_isize, "CXXBRIDGE05_RUST_ISIZE");
if needs_manually_drop {
out.next_section();
@ -304,7 +304,7 @@ fn write_include_cxxbridge(out: &mut OutFile, apis: &[Api], types: &Types) {
writeln!(out, "}};");
}
out.end_block("namespace cxxbridge04");
out.end_block("namespace cxxbridge05");
if needs_trycatch {
out.begin_block("namespace behavior");
@ -333,7 +333,7 @@ fn write_include_cxxbridge(out: &mut OutFile, apis: &[Api], types: &Types) {
}
fn write_struct(out: &mut OutFile, strct: &Struct) {
let guard = format!("CXXBRIDGE04_STRUCT_{}{}", out.namespace, strct.ident);
let guard = format!("CXXBRIDGE05_STRUCT_{}{}", out.namespace, strct.ident);
writeln!(out, "#ifndef {}", guard);
writeln!(out, "#define {}", guard);
for line in strct.doc.to_string().lines() {
@ -358,7 +358,7 @@ fn write_struct_using(out: &mut OutFile, ident: &Ident) {
}
fn write_struct_with_methods(out: &mut OutFile, ety: &ExternType, methods: &[&ExternFn]) {
let guard = format!("CXXBRIDGE04_STRUCT_{}{}", out.namespace, ety.ident);
let guard = format!("CXXBRIDGE05_STRUCT_{}{}", out.namespace, ety.ident);
writeln!(out, "#ifndef {}", guard);
writeln!(out, "#define {}", guard);
for line in ety.doc.to_string().lines() {
@ -379,7 +379,7 @@ fn write_struct_with_methods(out: &mut OutFile, ety: &ExternType, methods: &[&Ex
}
fn write_enum(out: &mut OutFile, enm: &Enum) {
let guard = format!("CXXBRIDGE04_ENUM_{}{}", out.namespace, enm.ident);
let guard = format!("CXXBRIDGE05_ENUM_{}{}", out.namespace, enm.ident);
writeln!(out, "#ifndef {}", guard);
writeln!(out, "#define {}", guard);
for line in enm.doc.to_string().lines() {
@ -465,7 +465,7 @@ fn write_exception_glue(out: &mut OutFile, apis: &[Api]) {
out.next_section();
writeln!(
out,
"const char *cxxbridge04$exception(const char *, size_t);",
"const char *cxxbridge05$exception(const char *, size_t);",
);
}
}
@ -610,7 +610,7 @@ fn write_cxx_function_shim(
writeln!(out, " throw$.len = ::std::strlen(catch$);");
writeln!(
out,
" throw$.ptr = cxxbridge04$exception(catch$, throw$.len);",
" throw$.ptr = cxxbridge05$exception(catch$, throw$.len);",
);
writeln!(out, " }});");
writeln!(out, " return throw$;");
@ -1089,7 +1089,7 @@ fn write_generic_instantiations(out: &mut OutFile, types: &Types) {
out.end_block("extern \"C\"");
out.begin_block("namespace rust");
out.begin_block("inline namespace cxxbridge04");
out.begin_block("inline namespace cxxbridge05");
for ty in types {
if let Type::RustBox(ty) = ty {
if let Type::Ident(inner) = &ty.inner {
@ -1103,7 +1103,7 @@ fn write_generic_instantiations(out: &mut OutFile, types: &Types) {
}
}
}
out.end_block("namespace cxxbridge04");
out.end_block("namespace cxxbridge05");
out.end_block("namespace rust");
}
@ -1116,19 +1116,19 @@ fn write_rust_box_extern(out: &mut OutFile, ident: &Ident) {
inner += &ident.to_string();
let instance = inner.replace("::", "$");
writeln!(out, "#ifndef CXXBRIDGE04_RUST_BOX_{}", instance);
writeln!(out, "#define CXXBRIDGE04_RUST_BOX_{}", instance);
writeln!(out, "#ifndef CXXBRIDGE05_RUST_BOX_{}", instance);
writeln!(out, "#define CXXBRIDGE05_RUST_BOX_{}", instance);
writeln!(
out,
"void cxxbridge04$box${}$uninit(::rust::Box<{}> *ptr) noexcept;",
"void cxxbridge05$box${}$uninit(::rust::Box<{}> *ptr) noexcept;",
instance, inner,
);
writeln!(
out,
"void cxxbridge04$box${}$drop(::rust::Box<{}> *ptr) noexcept;",
"void cxxbridge05$box${}$drop(::rust::Box<{}> *ptr) noexcept;",
instance, inner,
);
writeln!(out, "#endif // CXXBRIDGE04_RUST_BOX_{}", instance);
writeln!(out, "#endif // CXXBRIDGE05_RUST_BOX_{}", instance);
}
fn write_rust_vec_extern(out: &mut OutFile, element: &Ident) {
@ -1136,34 +1136,34 @@ fn write_rust_vec_extern(out: &mut OutFile, element: &Ident) {
let inner = to_typename(&out.namespace, &element);
let instance = to_mangled(&out.namespace, &element);
writeln!(out, "#ifndef CXXBRIDGE04_RUST_VEC_{}", instance);
writeln!(out, "#define CXXBRIDGE04_RUST_VEC_{}", instance);
writeln!(out, "#ifndef CXXBRIDGE05_RUST_VEC_{}", instance);
writeln!(out, "#define CXXBRIDGE05_RUST_VEC_{}", instance);
writeln!(
out,
"void cxxbridge04$rust_vec${}$new(const ::rust::Vec<{}> *ptr) noexcept;",
"void cxxbridge05$rust_vec${}$new(const ::rust::Vec<{}> *ptr) noexcept;",
instance, inner,
);
writeln!(
out,
"void cxxbridge04$rust_vec${}$drop(::rust::Vec<{}> *ptr) noexcept;",
"void cxxbridge05$rust_vec${}$drop(::rust::Vec<{}> *ptr) noexcept;",
instance, inner,
);
writeln!(
out,
"size_t cxxbridge04$rust_vec${}$len(const ::rust::Vec<{}> *ptr) noexcept;",
"size_t cxxbridge05$rust_vec${}$len(const ::rust::Vec<{}> *ptr) noexcept;",
instance, inner,
);
writeln!(
out,
"const {} *cxxbridge04$rust_vec${}$data(const ::rust::Vec<{0}> *ptr) noexcept;",
"const {} *cxxbridge05$rust_vec${}$data(const ::rust::Vec<{0}> *ptr) noexcept;",
inner, instance,
);
writeln!(
out,
"size_t cxxbridge04$rust_vec${}$stride() noexcept;",
"size_t cxxbridge05$rust_vec${}$stride() noexcept;",
instance,
);
writeln!(out, "#endif // CXXBRIDGE04_RUST_VEC_{}", instance);
writeln!(out, "#endif // CXXBRIDGE05_RUST_VEC_{}", instance);
}
fn write_rust_box_impl(out: &mut OutFile, ident: &Ident) {
@ -1177,12 +1177,12 @@ fn write_rust_box_impl(out: &mut OutFile, ident: &Ident) {
writeln!(out, "template <>");
writeln!(out, "void Box<{}>::uninit() noexcept {{", inner);
writeln!(out, " cxxbridge04$box${}$uninit(this);", instance);
writeln!(out, " cxxbridge05$box${}$uninit(this);", instance);
writeln!(out, "}}");
writeln!(out, "template <>");
writeln!(out, "void Box<{}>::drop() noexcept {{", inner);
writeln!(out, " cxxbridge04$box${}$drop(this);", instance);
writeln!(out, " cxxbridge05$box${}$drop(this);", instance);
writeln!(out, "}}");
}
@ -1193,35 +1193,35 @@ fn write_rust_vec_impl(out: &mut OutFile, element: &Ident) {
writeln!(out, "template <>");
writeln!(out, "Vec<{}>::Vec() noexcept {{", inner);
writeln!(out, " cxxbridge04$rust_vec${}$new(this);", instance);
writeln!(out, " cxxbridge05$rust_vec${}$new(this);", instance);
writeln!(out, "}}");
writeln!(out, "template <>");
writeln!(out, "void Vec<{}>::drop() noexcept {{", inner);
writeln!(
out,
" return cxxbridge04$rust_vec${}$drop(this);",
" return cxxbridge05$rust_vec${}$drop(this);",
instance,
);
writeln!(out, "}}");
writeln!(out, "template <>");
writeln!(out, "size_t Vec<{}>::size() const noexcept {{", inner);
writeln!(out, " return cxxbridge04$rust_vec${}$len(this);", instance);
writeln!(out, " return cxxbridge05$rust_vec${}$len(this);", instance);
writeln!(out, "}}");
writeln!(out, "template <>");
writeln!(out, "const {} *Vec<{0}>::data() const noexcept {{", inner);
writeln!(
out,
" return cxxbridge04$rust_vec${}$data(this);",
" return cxxbridge05$rust_vec${}$data(this);",
instance,
);
writeln!(out, "}}");
writeln!(out, "template <>");
writeln!(out, "size_t Vec<{}>::stride() noexcept {{", inner);
writeln!(out, " return cxxbridge04$rust_vec${}$stride();", instance);
writeln!(out, " return cxxbridge05$rust_vec${}$stride();", instance);
writeln!(out, "}}");
}
@ -1229,12 +1229,12 @@ fn write_unique_ptr(out: &mut OutFile, ident: &Ident, types: &Types) {
let ty = Type::Ident(ident.clone());
let instance = to_mangled(&out.namespace, &ty);
writeln!(out, "#ifndef CXXBRIDGE04_UNIQUE_PTR_{}", instance);
writeln!(out, "#define CXXBRIDGE04_UNIQUE_PTR_{}", instance);
writeln!(out, "#ifndef CXXBRIDGE05_UNIQUE_PTR_{}", instance);
writeln!(out, "#define CXXBRIDGE05_UNIQUE_PTR_{}", instance);
write_unique_ptr_common(out, &ty, types);
writeln!(out, "#endif // CXXBRIDGE04_UNIQUE_PTR_{}", instance);
writeln!(out, "#endif // CXXBRIDGE05_UNIQUE_PTR_{}", instance);
}
// Shared by UniquePtr<T> and UniquePtr<CxxVector<T>>.
@ -1261,7 +1261,7 @@ fn write_unique_ptr_common(out: &mut OutFile, ty: &Type, types: &Types) {
);
writeln!(
out,
"void cxxbridge04$unique_ptr${}$null(::std::unique_ptr<{}> *ptr) noexcept {{",
"void cxxbridge05$unique_ptr${}$null(::std::unique_ptr<{}> *ptr) noexcept {{",
instance, inner,
);
writeln!(out, " new (ptr) ::std::unique_ptr<{}>();", inner);
@ -1269,7 +1269,7 @@ fn write_unique_ptr_common(out: &mut OutFile, ty: &Type, types: &Types) {
if can_construct_from_value {
writeln!(
out,
"void cxxbridge04$unique_ptr${}$new(::std::unique_ptr<{}> *ptr, {} *value) noexcept {{",
"void cxxbridge05$unique_ptr${}$new(::std::unique_ptr<{}> *ptr, {} *value) noexcept {{",
instance, inner, inner,
);
writeln!(
@ -1281,28 +1281,28 @@ fn write_unique_ptr_common(out: &mut OutFile, ty: &Type, types: &Types) {
}
writeln!(
out,
"void cxxbridge04$unique_ptr${}$raw(::std::unique_ptr<{}> *ptr, {} *raw) noexcept {{",
"void cxxbridge05$unique_ptr${}$raw(::std::unique_ptr<{}> *ptr, {} *raw) noexcept {{",
instance, inner, inner,
);
writeln!(out, " new (ptr) ::std::unique_ptr<{}>(raw);", inner);
writeln!(out, "}}");
writeln!(
out,
"const {} *cxxbridge04$unique_ptr${}$get(const ::std::unique_ptr<{}>& ptr) noexcept {{",
"const {} *cxxbridge05$unique_ptr${}$get(const ::std::unique_ptr<{}>& ptr) noexcept {{",
inner, instance, inner,
);
writeln!(out, " return ptr.get();");
writeln!(out, "}}");
writeln!(
out,
"{} *cxxbridge04$unique_ptr${}$release(::std::unique_ptr<{}>& ptr) noexcept {{",
"{} *cxxbridge05$unique_ptr${}$release(::std::unique_ptr<{}>& ptr) noexcept {{",
inner, instance, inner,
);
writeln!(out, " return ptr.release();");
writeln!(out, "}}");
writeln!(
out,
"void cxxbridge04$unique_ptr${}$drop(::std::unique_ptr<{}> *ptr) noexcept {{",
"void cxxbridge05$unique_ptr${}$drop(::std::unique_ptr<{}> *ptr) noexcept {{",
instance, inner,
);
writeln!(out, " ptr->~unique_ptr();");
@ -1314,18 +1314,18 @@ fn write_cxx_vector(out: &mut OutFile, vector_ty: &Type, element: &Ident, types:
let inner = to_typename(&out.namespace, &element);
let instance = to_mangled(&out.namespace, &element);
writeln!(out, "#ifndef CXXBRIDGE04_VECTOR_{}", instance);
writeln!(out, "#define CXXBRIDGE04_VECTOR_{}", instance);
writeln!(out, "#ifndef CXXBRIDGE05_VECTOR_{}", instance);
writeln!(out, "#define CXXBRIDGE05_VECTOR_{}", instance);
writeln!(
out,
"size_t cxxbridge04$std$vector${}$size(const ::std::vector<{}> &s) noexcept {{",
"size_t cxxbridge05$std$vector${}$size(const ::std::vector<{}> &s) noexcept {{",
instance, inner,
);
writeln!(out, " return s.size();");
writeln!(out, "}}");
writeln!(
out,
"const {} *cxxbridge04$std$vector${}$get_unchecked(const ::std::vector<{}> &s, size_t pos) noexcept {{",
"const {} *cxxbridge05$std$vector${}$get_unchecked(const ::std::vector<{}> &s, size_t pos) noexcept {{",
inner, instance, inner,
);
writeln!(out, " return &s[pos];");
@ -1333,5 +1333,5 @@ fn write_cxx_vector(out: &mut OutFile, vector_ty: &Type, element: &Ident, types:
write_unique_ptr_common(out, vector_ty, types);
writeln!(out, "#endif // CXXBRIDGE04_VECTOR_{}", instance);
writeln!(out, "#endif // CXXBRIDGE05_VECTOR_{}", instance);
}

View File

@ -15,12 +15,12 @@
#endif
namespace rust {
inline namespace cxxbridge04 {
inline namespace cxxbridge05 {
struct unsafe_bitcopy_t;
#ifndef CXXBRIDGE04_RUST_STRING
#define CXXBRIDGE04_RUST_STRING
#ifndef CXXBRIDGE05_RUST_STRING
#define CXXBRIDGE05_RUST_STRING
class String final {
public:
String() noexcept;
@ -49,10 +49,10 @@ private:
// Size and alignment statically verified by rust_string.rs.
std::array<uintptr_t, 3> repr;
};
#endif // CXXBRIDGE04_RUST_STRING
#endif // CXXBRIDGE05_RUST_STRING
#ifndef CXXBRIDGE04_RUST_STR
#define CXXBRIDGE04_RUST_STR
#ifndef CXXBRIDGE05_RUST_STR
#define CXXBRIDGE05_RUST_STR
class Str final {
public:
Str() noexcept;
@ -86,9 +86,9 @@ public:
private:
Repr repr;
};
#endif // CXXBRIDGE04_RUST_STR
#endif // CXXBRIDGE05_RUST_STR
#ifndef CXXBRIDGE04_RUST_SLICE
#ifndef CXXBRIDGE05_RUST_SLICE
template <typename T>
class Slice final {
public:
@ -117,9 +117,9 @@ public:
private:
Repr repr;
};
#endif // CXXBRIDGE04_RUST_SLICE
#endif // CXXBRIDGE05_RUST_SLICE
#ifndef CXXBRIDGE04_RUST_BOX
#ifndef CXXBRIDGE05_RUST_BOX
template <typename T>
class Box final {
public:
@ -158,9 +158,9 @@ private:
void drop() noexcept;
T *ptr;
};
#endif // CXXBRIDGE04_RUST_BOX
#endif // CXXBRIDGE05_RUST_BOX
#ifndef CXXBRIDGE04_RUST_VEC
#ifndef CXXBRIDGE05_RUST_VEC
template <typename T>
class Vec final {
public:
@ -218,10 +218,10 @@ private:
// Size and alignment statically verified by rust_vec.rs.
std::array<uintptr_t, 3> repr;
};
#endif // CXXBRIDGE04_RUST_VEC
#endif // CXXBRIDGE05_RUST_VEC
#ifndef CXXBRIDGE04_RUST_FN
#define CXXBRIDGE04_RUST_FN
#ifndef CXXBRIDGE05_RUST_FN
#define CXXBRIDGE05_RUST_FN
template <typename Signature, bool Throws = false>
class Fn;
@ -238,10 +238,10 @@ private:
template <typename Signature>
using TryFn = Fn<Signature, true>;
#endif // CXXBRIDGE04_RUST_FN
#endif // CXXBRIDGE05_RUST_FN
#ifndef CXXBRIDGE04_RUST_ERROR
#define CXXBRIDGE04_RUST_ERROR
#ifndef CXXBRIDGE05_RUST_ERROR
#define CXXBRIDGE05_RUST_ERROR
class Error final : public std::exception {
public:
Error(const Error &);
@ -253,16 +253,16 @@ public:
private:
Str::Repr msg;
};
#endif // CXXBRIDGE04_RUST_ERROR
#endif // CXXBRIDGE05_RUST_ERROR
#ifndef CXXBRIDGE04_RUST_ISIZE
#define CXXBRIDGE04_RUST_ISIZE
#ifndef CXXBRIDGE05_RUST_ISIZE
#define CXXBRIDGE05_RUST_ISIZE
#if defined(_WIN32)
using isize = SSIZE_T;
#else
using isize = ssize_t;
#endif
#endif // CXXBRIDGE04_RUST_ISIZE
#endif // CXXBRIDGE05_RUST_ISIZE
std::ostream &operator<<(std::ostream &, const String &);
std::ostream &operator<<(std::ostream &, const Str &);
@ -287,11 +287,11 @@ using try_fn = TryFn<Signature>;
////////////////////////////////////////////////////////////////////////////////
/// end public API, begin implementation details
#ifndef CXXBRIDGE04_PANIC
#define CXXBRIDGE04_PANIC
#ifndef CXXBRIDGE05_PANIC
#define CXXBRIDGE05_PANIC
template <typename Exception>
void panic [[noreturn]] (const char *msg);
#endif // CXXBRIDGE04_PANIC
#endif // CXXBRIDGE05_PANIC
template <typename Ret, typename... Args, bool Throws>
Ret Fn<Ret(Args...), Throws>::operator()(Args... args) const noexcept(!Throws) {
@ -303,17 +303,17 @@ Fn<Ret(Args...), Throws> Fn<Ret(Args...), Throws>::operator*() const noexcept {
return *this;
}
#ifndef CXXBRIDGE04_RUST_BITCOPY
#define CXXBRIDGE04_RUST_BITCOPY
#ifndef CXXBRIDGE05_RUST_BITCOPY
#define CXXBRIDGE05_RUST_BITCOPY
struct unsafe_bitcopy_t {
explicit unsafe_bitcopy_t() = default;
};
constexpr unsafe_bitcopy_t unsafe_bitcopy{};
#endif // CXXBRIDGE04_RUST_BITCOPY
#endif // CXXBRIDGE05_RUST_BITCOPY
#ifndef CXXBRIDGE04_RUST_SLICE
#define CXXBRIDGE04_RUST_SLICE
#ifndef CXXBRIDGE05_RUST_SLICE
#define CXXBRIDGE05_RUST_SLICE
template <typename T>
Slice<T>::Slice() noexcept : repr(Repr{reinterpret_cast<const T *>(this), 0}) {}
@ -351,10 +351,10 @@ template <typename T>
Slice<T>::operator Repr() noexcept {
return this->repr;
}
#endif // CXXBRIDGE04_RUST_SLICE
#endif // CXXBRIDGE05_RUST_SLICE
#ifndef CXXBRIDGE04_RUST_BOX
#define CXXBRIDGE04_RUST_BOX
#ifndef CXXBRIDGE05_RUST_BOX
#define CXXBRIDGE05_RUST_BOX
template <typename T>
Box<T>::Box(const Box &other) : Box(*other) {}
@ -450,10 +450,10 @@ T *Box<T>::into_raw() noexcept {
template <typename T>
Box<T>::Box() noexcept {}
#endif // CXXBRIDGE04_RUST_BOX
#endif // CXXBRIDGE05_RUST_BOX
#ifndef CXXBRIDGE04_RUST_VEC
#define CXXBRIDGE04_RUST_VEC
#ifndef CXXBRIDGE05_RUST_VEC
#define CXXBRIDGE05_RUST_VEC
template <typename T>
Vec<T>::Vec(Vec &&other) noexcept {
this->repr = other.repr;
@ -558,7 +558,7 @@ typename Vec<T>::const_iterator Vec<T>::end() const noexcept {
// Internal API only intended for the cxxbridge code generator.
template <typename T>
Vec<T>::Vec(unsafe_bitcopy_t, const Vec &bits) noexcept : repr(bits.repr) {}
#endif // CXXBRIDGE04_RUST_VEC
#endif // CXXBRIDGE05_RUST_VEC
} // namespace cxxbridge04
} // namespace cxxbridge05
} // namespace rust

View File

@ -727,7 +727,7 @@ fn type_id(namespace: &Namespace, ident: &Ident) -> TokenStream {
}
fn expand_rust_box(namespace: &Namespace, ident: &Ident) -> TokenStream {
let link_prefix = format!("cxxbridge04$box${}{}$", namespace, ident);
let link_prefix = format!("cxxbridge05$box${}{}$", namespace, ident);
let link_uninit = format!("{}uninit", link_prefix);
let link_drop = format!("{}drop", link_prefix);
@ -756,7 +756,7 @@ fn expand_rust_box(namespace: &Namespace, ident: &Ident) -> TokenStream {
}
fn expand_rust_vec(namespace: &Namespace, elem: &Ident) -> TokenStream {
let link_prefix = format!("cxxbridge04$rust_vec${}{}$", namespace, elem);
let link_prefix = format!("cxxbridge05$rust_vec${}{}$", namespace, elem);
let link_new = format!("{}new", link_prefix);
let link_drop = format!("{}drop", link_prefix);
let link_len = format!("{}len", link_prefix);
@ -807,7 +807,7 @@ fn expand_unique_ptr(
explicit_impl: Option<&Impl>,
) -> TokenStream {
let name = ident.to_string();
let prefix = format!("cxxbridge04$unique_ptr${}{}$", namespace, ident);
let prefix = format!("cxxbridge05$unique_ptr${}{}$", namespace, ident);
let link_null = format!("{}null", prefix);
let link_new = format!("{}new", prefix);
let link_raw = format!("{}raw", prefix);
@ -890,10 +890,10 @@ fn expand_cxx_vector(
) -> TokenStream {
let _ = explicit_impl;
let name = elem.to_string();
let prefix = format!("cxxbridge04$std$vector${}{}$", namespace, elem);
let prefix = format!("cxxbridge05$std$vector${}{}$", namespace, elem);
let link_size = format!("{}size", prefix);
let link_get_unchecked = format!("{}get_unchecked", prefix);
let unique_ptr_prefix = format!("cxxbridge04$unique_ptr$std$vector${}{}$", namespace, elem);
let unique_ptr_prefix = format!("cxxbridge05$unique_ptr$std$vector${}{}$", namespace, elem);
let link_unique_ptr_null = format!("{}null", unique_ptr_prefix);
let link_unique_ptr_raw = format!("{}raw", unique_ptr_prefix);
let link_unique_ptr_get = format!("{}get", unique_ptr_prefix);

View File

@ -7,30 +7,30 @@
#include <vector>
extern "C" {
const char *cxxbridge04$cxx_string$data(const std::string &s) noexcept {
const char *cxxbridge05$cxx_string$data(const std::string &s) noexcept {
return s.data();
}
size_t cxxbridge04$cxx_string$length(const std::string &s) noexcept {
size_t cxxbridge05$cxx_string$length(const std::string &s) noexcept {
return s.length();
}
// rust::String
void cxxbridge04$string$new(rust::String *self) noexcept;
void cxxbridge04$string$clone(rust::String *self,
void cxxbridge05$string$new(rust::String *self) noexcept;
void cxxbridge05$string$clone(rust::String *self,
const rust::String &other) noexcept;
bool cxxbridge04$string$from(rust::String *self, const char *ptr,
bool cxxbridge05$string$from(rust::String *self, const char *ptr,
size_t len) noexcept;
void cxxbridge04$string$drop(rust::String *self) noexcept;
const char *cxxbridge04$string$ptr(const rust::String *self) noexcept;
size_t cxxbridge04$string$len(const rust::String *self) noexcept;
void cxxbridge05$string$drop(rust::String *self) noexcept;
const char *cxxbridge05$string$ptr(const rust::String *self) noexcept;
size_t cxxbridge05$string$len(const rust::String *self) noexcept;
// rust::Str
bool cxxbridge04$str$valid(const char *ptr, size_t len) noexcept;
bool cxxbridge05$str$valid(const char *ptr, size_t len) noexcept;
} // extern "C"
namespace rust {
inline namespace cxxbridge04 {
inline namespace cxxbridge05 {
template <typename Exception>
void panic [[noreturn]] (const char *msg) {
@ -44,42 +44,42 @@ void panic [[noreturn]] (const char *msg) {
template void panic<std::out_of_range>[[noreturn]] (const char *msg);
String::String() noexcept { cxxbridge04$string$new(this); }
String::String() noexcept { cxxbridge05$string$new(this); }
String::String(const String &other) noexcept {
cxxbridge04$string$clone(this, other);
cxxbridge05$string$clone(this, other);
}
String::String(String &&other) noexcept {
this->repr = other.repr;
cxxbridge04$string$new(&other);
cxxbridge05$string$new(&other);
}
String::~String() noexcept { cxxbridge04$string$drop(this); }
String::~String() noexcept { cxxbridge05$string$drop(this); }
String::String(const std::string &s) : String(s.data(), s.length()) {}
String::String(const char *s) : String(s, std::strlen(s)) {}
String::String(const char *s, size_t len) {
if (!cxxbridge04$string$from(this, s, len)) {
if (!cxxbridge05$string$from(this, s, len)) {
panic<std::invalid_argument>("data for rust::String is not utf-8");
}
}
String &String::operator=(const String &other) noexcept {
if (this != &other) {
cxxbridge04$string$drop(this);
cxxbridge04$string$clone(this, other);
cxxbridge05$string$drop(this);
cxxbridge05$string$clone(this, other);
}
return *this;
}
String &String::operator=(String &&other) noexcept {
if (this != &other) {
cxxbridge04$string$drop(this);
cxxbridge05$string$drop(this);
this->repr = other.repr;
cxxbridge04$string$new(&other);
cxxbridge05$string$new(&other);
}
return *this;
}
@ -89,12 +89,12 @@ String::operator std::string() const {
}
const char *String::data() const noexcept {
return cxxbridge04$string$ptr(this);
return cxxbridge05$string$ptr(this);
}
size_t String::size() const noexcept { return cxxbridge04$string$len(this); }
size_t String::size() const noexcept { return cxxbridge05$string$len(this); }
size_t String::length() const noexcept { return cxxbridge04$string$len(this); }
size_t String::length() const noexcept { return cxxbridge05$string$len(this); }
String::String(unsafe_bitcopy_t, const String &bits) noexcept
: repr(bits.repr) {}
@ -113,7 +113,7 @@ Str::Str(const std::string &s) : Str(s.data(), s.length()) {}
Str::Str(const char *s) : Str(s, std::strlen(s)) {}
Str::Str(const char *s, size_t len) : repr(Repr{s, len}) {
if (!cxxbridge04$str$valid(this->repr.ptr, this->repr.len)) {
if (!cxxbridge05$str$valid(this->repr.ptr, this->repr.len)) {
panic<std::invalid_argument>("data for rust::Str is not utf-8");
}
}
@ -143,7 +143,7 @@ std::ostream &operator<<(std::ostream &os, const Str &s) {
}
extern "C" {
const char *cxxbridge04$error(const char *ptr, size_t len) {
const char *cxxbridge05$error(const char *ptr, size_t len) {
char *copy = new char[len];
strncpy(copy, ptr, len);
return copy;
@ -153,7 +153,7 @@ const char *cxxbridge04$error(const char *ptr, size_t len) {
Error::Error(Str::Repr msg) noexcept : msg(msg) {}
Error::Error(const Error &other) {
this->msg.ptr = cxxbridge04$error(other.msg.ptr, other.msg.len);
this->msg.ptr = cxxbridge05$error(other.msg.ptr, other.msg.len);
this->msg.len = other.msg.len;
}
@ -168,96 +168,96 @@ Error::~Error() noexcept { delete[] this->msg.ptr; }
const char *Error::what() const noexcept { return this->msg.ptr; }
} // namespace cxxbridge04
} // namespace cxxbridge05
} // namespace rust
extern "C" {
void cxxbridge04$unique_ptr$std$string$null(
void cxxbridge05$unique_ptr$std$string$null(
std::unique_ptr<std::string> *ptr) noexcept {
new (ptr) std::unique_ptr<std::string>();
}
void cxxbridge04$unique_ptr$std$string$raw(std::unique_ptr<std::string> *ptr,
void cxxbridge05$unique_ptr$std$string$raw(std::unique_ptr<std::string> *ptr,
std::string *raw) noexcept {
new (ptr) std::unique_ptr<std::string>(raw);
}
const std::string *cxxbridge04$unique_ptr$std$string$get(
const std::string *cxxbridge05$unique_ptr$std$string$get(
const std::unique_ptr<std::string> &ptr) noexcept {
return ptr.get();
}
std::string *cxxbridge04$unique_ptr$std$string$release(
std::string *cxxbridge05$unique_ptr$std$string$release(
std::unique_ptr<std::string> &ptr) noexcept {
return ptr.release();
}
void cxxbridge04$unique_ptr$std$string$drop(
void cxxbridge05$unique_ptr$std$string$drop(
std::unique_ptr<std::string> *ptr) noexcept {
ptr->~unique_ptr();
}
} // extern "C"
#define STD_VECTOR_OPS(RUST_TYPE, CXX_TYPE) \
size_t cxxbridge04$std$vector$##RUST_TYPE##$size( \
size_t cxxbridge05$std$vector$##RUST_TYPE##$size( \
const std::vector<CXX_TYPE> &s) noexcept { \
return s.size(); \
} \
const CXX_TYPE *cxxbridge04$std$vector$##RUST_TYPE##$get_unchecked( \
const CXX_TYPE *cxxbridge05$std$vector$##RUST_TYPE##$get_unchecked( \
const std::vector<CXX_TYPE> &s, size_t pos) noexcept { \
return &s[pos]; \
} \
void cxxbridge04$unique_ptr$std$vector$##RUST_TYPE##$null( \
void cxxbridge05$unique_ptr$std$vector$##RUST_TYPE##$null( \
std::unique_ptr<std::vector<CXX_TYPE>> *ptr) noexcept { \
new (ptr) std::unique_ptr<std::vector<CXX_TYPE>>(); \
} \
void cxxbridge04$unique_ptr$std$vector$##RUST_TYPE##$raw( \
void cxxbridge05$unique_ptr$std$vector$##RUST_TYPE##$raw( \
std::unique_ptr<std::vector<CXX_TYPE>> *ptr, \
std::vector<CXX_TYPE> *raw) noexcept { \
new (ptr) std::unique_ptr<std::vector<CXX_TYPE>>(raw); \
} \
const std::vector<CXX_TYPE> \
*cxxbridge04$unique_ptr$std$vector$##RUST_TYPE##$get( \
*cxxbridge05$unique_ptr$std$vector$##RUST_TYPE##$get( \
const std::unique_ptr<std::vector<CXX_TYPE>> &ptr) noexcept { \
return ptr.get(); \
} \
std::vector<CXX_TYPE> \
*cxxbridge04$unique_ptr$std$vector$##RUST_TYPE##$release( \
*cxxbridge05$unique_ptr$std$vector$##RUST_TYPE##$release( \
std::unique_ptr<std::vector<CXX_TYPE>> &ptr) noexcept { \
return ptr.release(); \
} \
void cxxbridge04$unique_ptr$std$vector$##RUST_TYPE##$drop( \
void cxxbridge05$unique_ptr$std$vector$##RUST_TYPE##$drop( \
std::unique_ptr<std::vector<CXX_TYPE>> *ptr) noexcept { \
ptr->~unique_ptr(); \
}
#define RUST_VEC_EXTERNS(RUST_TYPE, CXX_TYPE) \
void cxxbridge04$rust_vec$##RUST_TYPE##$new( \
void cxxbridge05$rust_vec$##RUST_TYPE##$new( \
rust::Vec<CXX_TYPE> *ptr) noexcept; \
void cxxbridge04$rust_vec$##RUST_TYPE##$drop( \
void cxxbridge05$rust_vec$##RUST_TYPE##$drop( \
rust::Vec<CXX_TYPE> *ptr) noexcept; \
size_t cxxbridge04$rust_vec$##RUST_TYPE##$len( \
size_t cxxbridge05$rust_vec$##RUST_TYPE##$len( \
const rust::Vec<CXX_TYPE> *ptr) noexcept; \
const CXX_TYPE *cxxbridge04$rust_vec$##RUST_TYPE##$data( \
const CXX_TYPE *cxxbridge05$rust_vec$##RUST_TYPE##$data( \
const rust::Vec<CXX_TYPE> *ptr) noexcept; \
size_t cxxbridge04$rust_vec$##RUST_TYPE##$stride() noexcept;
size_t cxxbridge05$rust_vec$##RUST_TYPE##$stride() noexcept;
#define RUST_VEC_OPS(RUST_TYPE, CXX_TYPE) \
template <> \
Vec<CXX_TYPE>::Vec() noexcept { \
cxxbridge04$rust_vec$##RUST_TYPE##$new(this); \
cxxbridge05$rust_vec$##RUST_TYPE##$new(this); \
} \
template <> \
void Vec<CXX_TYPE>::drop() noexcept { \
return cxxbridge04$rust_vec$##RUST_TYPE##$drop(this); \
return cxxbridge05$rust_vec$##RUST_TYPE##$drop(this); \
} \
template <> \
size_t Vec<CXX_TYPE>::size() const noexcept { \
return cxxbridge04$rust_vec$##RUST_TYPE##$len(this); \
return cxxbridge05$rust_vec$##RUST_TYPE##$len(this); \
} \
template <> \
const CXX_TYPE *Vec<CXX_TYPE>::data() const noexcept { \
return cxxbridge04$rust_vec$##RUST_TYPE##$data(this); \
return cxxbridge05$rust_vec$##RUST_TYPE##$data(this); \
} \
template <> \
size_t Vec<CXX_TYPE>::stride() noexcept { \
return cxxbridge04$rust_vec$##RUST_TYPE##$stride(); \
return cxxbridge05$rust_vec$##RUST_TYPE##$stride(); \
}
// Usize and isize are the same type as one of the below.
@ -290,7 +290,7 @@ FOR_EACH_RUST_VEC(RUST_VEC_EXTERNS)
} // extern "C"
namespace rust {
inline namespace cxxbridge04 {
inline namespace cxxbridge05 {
FOR_EACH_RUST_VEC(RUST_VEC_OPS)
} // namespace cxxbridge04
} // namespace cxxbridge05
} // namespace rust

View File

@ -5,9 +5,9 @@ use core::slice;
use core::str::{self, Utf8Error};
extern "C" {
#[link_name = "cxxbridge04$cxx_string$data"]
#[link_name = "cxxbridge05$cxx_string$data"]
fn string_data(_: &CxxString) -> *const u8;
#[link_name = "cxxbridge04$cxx_string$length"]
#[link_name = "cxxbridge05$cxx_string$length"]
fn string_length(_: &CxxString) -> usize;
}

View File

@ -157,7 +157,7 @@ macro_rules! impl_vector_element {
fn __vector_size(v: &CxxVector<$ty>) -> usize {
extern "C" {
attr! {
#[link_name = concat!("cxxbridge04$std$vector$", $segment, "$size")]
#[link_name = concat!("cxxbridge05$std$vector$", $segment, "$size")]
fn __vector_size(_: &CxxVector<$ty>) -> usize;
}
}
@ -166,7 +166,7 @@ macro_rules! impl_vector_element {
unsafe fn __get_unchecked(v: &CxxVector<$ty>, pos: usize) -> *const $ty {
extern "C" {
attr! {
#[link_name = concat!("cxxbridge04$std$vector$", $segment, "$get_unchecked")]
#[link_name = concat!("cxxbridge05$std$vector$", $segment, "$get_unchecked")]
fn __get_unchecked(_: &CxxVector<$ty>, _: usize) -> *const $ty;
}
}
@ -175,7 +175,7 @@ macro_rules! impl_vector_element {
fn __unique_ptr_null() -> *mut c_void {
extern "C" {
attr! {
#[link_name = concat!("cxxbridge04$unique_ptr$std$vector$", $segment, "$null")]
#[link_name = concat!("cxxbridge05$unique_ptr$std$vector$", $segment, "$null")]
fn __unique_ptr_null(this: *mut *mut c_void);
}
}
@ -186,7 +186,7 @@ macro_rules! impl_vector_element {
unsafe fn __unique_ptr_raw(raw: *mut CxxVector<Self>) -> *mut c_void {
extern "C" {
attr! {
#[link_name = concat!("cxxbridge04$unique_ptr$std$vector$", $segment, "$raw")]
#[link_name = concat!("cxxbridge05$unique_ptr$std$vector$", $segment, "$raw")]
fn __unique_ptr_raw(this: *mut *mut c_void, raw: *mut CxxVector<$ty>);
}
}
@ -197,7 +197,7 @@ macro_rules! impl_vector_element {
unsafe fn __unique_ptr_get(repr: *mut c_void) -> *const CxxVector<Self> {
extern "C" {
attr! {
#[link_name = concat!("cxxbridge04$unique_ptr$std$vector$", $segment, "$get")]
#[link_name = concat!("cxxbridge05$unique_ptr$std$vector$", $segment, "$get")]
fn __unique_ptr_get(this: *const *mut c_void) -> *const CxxVector<$ty>;
}
}
@ -206,7 +206,7 @@ macro_rules! impl_vector_element {
unsafe fn __unique_ptr_release(mut repr: *mut c_void) -> *mut CxxVector<Self> {
extern "C" {
attr! {
#[link_name = concat!("cxxbridge04$unique_ptr$std$vector$", $segment, "$release")]
#[link_name = concat!("cxxbridge05$unique_ptr$std$vector$", $segment, "$release")]
fn __unique_ptr_release(this: *mut *mut c_void) -> *mut CxxVector<$ty>;
}
}
@ -215,7 +215,7 @@ macro_rules! impl_vector_element {
unsafe fn __unique_ptr_drop(mut repr: *mut c_void) {
extern "C" {
attr! {
#[link_name = concat!("cxxbridge04$unique_ptr$std$vector$", $segment, "$drop")]
#[link_name = concat!("cxxbridge05$unique_ptr$std$vector$", $segment, "$drop")]
fn __unique_ptr_drop(this: *mut *mut c_void);
}
}

View File

@ -34,7 +34,7 @@ unsafe fn to_c_error(msg: String) -> Result {
let len = msg.len();
extern "C" {
#[link_name = "cxxbridge04$error"]
#[link_name = "cxxbridge05$error"]
fn error(ptr: *const u8, len: usize) -> *const u8;
}

View File

@ -2,7 +2,7 @@ use alloc::boxed::Box;
use alloc::string::String;
use core::slice;
#[export_name = "cxxbridge04$exception"]
#[export_name = "cxxbridge05$exception"]
unsafe extern "C" fn exception(ptr: *const u8, len: usize) -> *const u8 {
let slice = slice::from_raw_parts(ptr, len);
let boxed = String::from_utf8_lossy(slice).into_owned().into_boxed_str();

View File

@ -1,7 +1,7 @@
use core::slice;
use core::str;
#[export_name = "cxxbridge04$str$valid"]
#[export_name = "cxxbridge05$str$valid"]
unsafe extern "C" fn str_valid(ptr: *const u8, len: usize) -> bool {
let slice = slice::from_raw_parts(ptr, len);
str::from_utf8(slice).is_ok()

View File

@ -5,17 +5,17 @@ use core::ptr;
use core::slice;
use core::str;
#[export_name = "cxxbridge04$string$new"]
#[export_name = "cxxbridge05$string$new"]
unsafe extern "C" fn string_new(this: &mut MaybeUninit<String>) {
ptr::write(this.as_mut_ptr(), String::new());
}
#[export_name = "cxxbridge04$string$clone"]
#[export_name = "cxxbridge05$string$clone"]
unsafe extern "C" fn string_clone(this: &mut MaybeUninit<String>, other: &String) {
ptr::write(this.as_mut_ptr(), other.clone());
}
#[export_name = "cxxbridge04$string$from"]
#[export_name = "cxxbridge05$string$from"]
unsafe extern "C" fn string_from(
this: &mut MaybeUninit<String>,
ptr: *const u8,
@ -31,17 +31,17 @@ unsafe extern "C" fn string_from(
}
}
#[export_name = "cxxbridge04$string$drop"]
#[export_name = "cxxbridge05$string$drop"]
unsafe extern "C" fn string_drop(this: &mut ManuallyDrop<String>) {
ManuallyDrop::drop(this);
}
#[export_name = "cxxbridge04$string$ptr"]
#[export_name = "cxxbridge05$string$ptr"]
unsafe extern "C" fn string_ptr(this: &String) -> *const u8 {
this.as_ptr()
}
#[export_name = "cxxbridge04$string$len"]
#[export_name = "cxxbridge05$string$len"]
unsafe extern "C" fn string_len(this: &String) -> usize {
this.len()
}

View File

@ -11,31 +11,31 @@ macro_rules! rust_vec_shims {
const _: () = {
attr! {
#[export_name = concat!("cxxbridge04$rust_vec$", $segment, "$new")]
#[export_name = concat!("cxxbridge05$rust_vec$", $segment, "$new")]
unsafe extern "C" fn __new(this: *mut RustVec<$ty>) {
ptr::write(this, RustVec { repr: Vec::new() });
}
}
attr! {
#[export_name = concat!("cxxbridge04$rust_vec$", $segment, "$drop")]
#[export_name = concat!("cxxbridge05$rust_vec$", $segment, "$drop")]
unsafe extern "C" fn __drop(this: *mut RustVec<$ty>) {
ptr::drop_in_place(this);
}
}
attr! {
#[export_name = concat!("cxxbridge04$rust_vec$", $segment, "$len")]
#[export_name = concat!("cxxbridge05$rust_vec$", $segment, "$len")]
unsafe extern "C" fn __len(this: *const RustVec<$ty>) -> usize {
(*this).repr.len()
}
}
attr! {
#[export_name = concat!("cxxbridge04$rust_vec$", $segment, "$data")]
#[export_name = concat!("cxxbridge05$rust_vec$", $segment, "$data")]
unsafe extern "C" fn __data(this: *const RustVec<$ty>) -> *const $ty {
(*this).repr.as_ptr()
}
}
attr! {
#[export_name = concat!("cxxbridge04$rust_vec$", $segment, "$stride")]
#[export_name = concat!("cxxbridge05$rust_vec$", $segment, "$stride")]
unsafe extern "C" fn __stride() -> usize {
mem::size_of::<$ty>()
}

View File

@ -174,15 +174,15 @@ pub unsafe trait UniquePtrTarget {
}
extern "C" {
#[link_name = "cxxbridge04$unique_ptr$std$string$null"]
#[link_name = "cxxbridge05$unique_ptr$std$string$null"]
fn unique_ptr_std_string_null(this: *mut *mut c_void);
#[link_name = "cxxbridge04$unique_ptr$std$string$raw"]
#[link_name = "cxxbridge05$unique_ptr$std$string$raw"]
fn unique_ptr_std_string_raw(this: *mut *mut c_void, raw: *mut CxxString);
#[link_name = "cxxbridge04$unique_ptr$std$string$get"]
#[link_name = "cxxbridge05$unique_ptr$std$string$get"]
fn unique_ptr_std_string_get(this: *const *mut c_void) -> *const CxxString;
#[link_name = "cxxbridge04$unique_ptr$std$string$release"]
#[link_name = "cxxbridge05$unique_ptr$std$string$release"]
fn unique_ptr_std_string_release(this: *mut *mut c_void) -> *mut CxxString;
#[link_name = "cxxbridge04$unique_ptr$std$string$drop"]
#[link_name = "cxxbridge05$unique_ptr$std$string$drop"]
fn unique_ptr_std_string_drop(this: *mut *mut c_void);
}

View File

@ -3,7 +3,7 @@ use crate::syntax::symbol::{self, Symbol};
use crate::syntax::ExternFn;
use proc_macro2::Ident;
const CXXBRIDGE: &str = "cxxbridge04";
const CXXBRIDGE: &str = "cxxbridge05";
macro_rules! join {
($($segment:expr),*) => {

View File

@ -4,7 +4,7 @@ use quote::ToTokens;
use std::fmt::{self, Display, Write};
// A mangled symbol consisting of segments separated by '$'.
// For example: cxxbridge04$string$new
// For example: cxxbridge05$string$new
pub struct Symbol(String);
impl Display for Symbol {

View File

@ -18,7 +18,7 @@ fn test_extern_c_function() {
let output = str::from_utf8(&generated.implementation).unwrap();
// To avoid continual breakage we won't test every byte.
// Let's look for the major features.
assert!(output.contains("void cxxbridge04$do_cpp_thing(::rust::Str::Repr foo)"));
assert!(output.contains("void cxxbridge05$do_cpp_thing(::rust::Str::Repr foo)"));
}
#[test]
@ -28,5 +28,5 @@ fn test_impl_annotation() {
let source = BRIDGE0.parse().unwrap();
let generated = generate_header_and_cc(source, &opt).unwrap();
let output = str::from_utf8(&generated.implementation).unwrap();
assert!(output.contains("ANNOTATION void cxxbridge04$do_cpp_thing(::rust::Str::Repr foo)"));
assert!(output.contains("ANNOTATION void cxxbridge05$do_cpp_thing(::rust::Str::Repr foo)"));
}