Restore compatibility with rustc pre 1.53
The signature of NonNull::as_ref is more restrictive on lifetimes in
older standard libraries.
error[E0515]: cannot return value referencing local variable `repr`
--> src/rust_str.rs:19:9
|
19 | repr.as_ref()
| ----^^^^^^^^^
| |
| returns a value referencing data owned by the current function
| `repr` is borrowed here
diff --git a/src/rust_str.rs b/src/rust_str.rs
index 02bd442..2f9c95b 100644
--- a/src/rust_str.rs
+++ b/src/rust_str.rs
@@ -16,7 +16,7 @@
pub unsafe fn as_str<'a>(self) -> &'a str {
let repr = mem::transmute::<RustStr, NonNull<str>>(self);
- repr.as_ref()
+ &*repr.as_ptr()
}
}