From d06384ac29098c3a4b3e21eb2f70093e800bd1b6 Mon Sep 17 00:00:00 2001 From: RustyYato Date: Wed, 3 Feb 2021 16:59:28 -0500 Subject: make Allocator object-safe add test to ensure object-safety This allows for runtime polymorphic allocators --- src/test/ui/allocator/object-safe.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/test/ui/allocator/object-safe.rs (limited to 'src') 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); +} -- cgit 1.4.1-3-g733a5