| David Tolnay | 3c90cd2 | 2020-04-30 07:28:21 -0700 | [diff] [blame^] | 1 | use std::slice; |
| 2 | |||||
| 3 | #[export_name = "cxxbridge03$exception"] | ||||
| 4 | unsafe extern "C" fn exception(ptr: *const u8, len: usize) -> *const u8 { | ||||
| 5 | let slice = slice::from_raw_parts(ptr, len); | ||||
| 6 | let boxed = String::from_utf8_lossy(slice).into_owned().into_boxed_str(); | ||||
| 7 | Box::leak(boxed).as_ptr() | ||||
| 8 | } | ||||