1 // Make sure we detect when the `Global` and `System` allocators are mixed
2 // (even when the default `Global` uses `System`).
3 //@error-pattern: /deallocating .*, which is Rust heap memory, using .* heap deallocation operation/
5 //@normalize-stderr-test: "using [A-Za-z]+ heap deallocation operation" -> "using PLATFORM heap deallocation operation"
6 //@normalize-stderr-test: "\| +\^+" -> "| ^"
7 //@normalize-stderr-test: "libc::free\([^()]*\)|unsafe \{ HeapFree\([^()]*\) \};" -> "FREE();"
9 #![feature(allocator_api, slice_ptr_get)]
11 use std::alloc::{Allocator, Global, Layout, System};
14 let l = Layout::from_size_align(1, 1).unwrap();
15 let ptr = Global.allocate(l).unwrap().as_non_null_ptr();
17 System.deallocate(ptr, l);