@@ -350,11 +350,11 @@ pub(super) fn write(out: &mut OutFile) {
350
350
writeln ! ( out, "template <>" ) ;
351
351
writeln ! ( out, "class impl<Error> final {{" ) ;
352
352
writeln ! ( out, "public:" ) ;
353
- writeln ! ( out, " static Error error(repr::PtrLen repr) noexcept {{" ) ;
353
+ writeln ! ( out, " static void error(const char* msg, size_t len) {{" ) ;
354
354
writeln ! ( out, " Error error;" ) ;
355
- writeln ! ( out, " error.msg = static_cast<char const *>(repr.ptr) ;" ) ;
356
- writeln ! ( out, " error.len = repr. len;" ) ;
357
- writeln ! ( out, " return error;" ) ;
355
+ writeln ! ( out, " error.msg = msg ;" ) ;
356
+ writeln ! ( out, " error.len = len;" ) ;
357
+ writeln ! ( out, " throw error;" ) ;
358
358
writeln ! ( out, " }}" ) ;
359
359
writeln ! ( out, "}};" ) ;
360
360
}
@@ -393,6 +393,15 @@ pub(super) fn write(out: &mut OutFile) {
393
393
}
394
394
395
395
out. end_block ( Block :: AnonymousNamespace ) ;
396
+
397
+ if builtin. rust_error {
398
+ out. next_section ( ) ;
399
+ writeln ! (
400
+ out,
401
+ "inline void (*throw_rust_error)(const char*, size_t) = impl<Error>::error;"
402
+ ) ;
403
+ }
404
+
396
405
out. end_block ( Block :: InlineNamespace ( "cxxbridge1" ) ) ;
397
406
398
407
if builtin. trycatch {
0 commit comments