about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorRustyYato <krishna.sd.2012@gmail.com>2021-02-03 16:59:28 -0500
committerRustyYato <krishna.sd.2012@gmail.com>2021-02-03 20:46:16 -0500
commitd06384ac29098c3a4b3e21eb2f70093e800bd1b6 (patch)
treefcb742f4ff19d13b36e8b3ccd340acbcf6b309f6 /src/test
parent120b2a704a60d4341286bd82f6e638c65ca169b6 (diff)
make Allocator object-safe
add test to ensure object-safety
This allows for runtime polymorphic allocators
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/allocator/object-safe.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/test/ui/allocator/object-safe.rs b/src/test/ui/allocator/object-safe.rs
new file mode 100644
index 00000000000..fae7ab7fe33
--- /dev/null
+++ b/src/test/ui/allocator/object-safe.rs
@@ -0,0 +1,13 @@
+// run-pass
+
+// Check that `Allocator` is object safe, this allows for polymorphic allocators
+
+#![feature(allocator_api)]
+
+use std::alloc::{Allocator, System};
+
+fn ensure_object_safe(_: &dyn Allocator) {}
+
+fn main() {
+    ensure_object_safe(&System);
+}