summaryrefslogtreecommitdiff
path: root/vendor/ref-cast/tests/test_custom.rs
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/ref-cast/tests/test_custom.rs')
-rw-r--r--vendor/ref-cast/tests/test_custom.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/vendor/ref-cast/tests/test_custom.rs b/vendor/ref-cast/tests/test_custom.rs
new file mode 100644
index 00000000..73d9bd69
--- /dev/null
+++ b/vendor/ref-cast/tests/test_custom.rs
@@ -0,0 +1,18 @@
+#[forbid(unsafe_code)]
+mod forbid_unsafe {
+ use ref_cast::{ref_cast_custom, RefCastCustom};
+
+ #[derive(RefCastCustom)]
+ #[repr(transparent)]
+ pub struct Custom(#[allow(dead_code)] str);
+
+ impl Custom {
+ #[ref_cast_custom]
+ pub fn new(s: &str) -> &Custom;
+ }
+}
+
+#[test]
+fn test_forbid_unsafe() {
+ forbid_unsafe::Custom::new("...");
+}