1 // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // ignore-musl no dylibs
12 // aux-build:allocator-dylib.rs
13 // aux-build:allocator1.rs
15 // error-pattern: cannot link together two allocators
17 // Verify that the allocator for statically linked dynamic libraries is the
18 // system allocator. Do this by linking in jemalloc and making sure that we get
21 // ignore-emscripten FIXME: What "other allocator" should we use for emcc?
23 #![feature(alloc_jemalloc)]
25 extern crate allocator_dylib;
27 // The main purpose of this test is to ensure that `alloc_jemalloc` **fails**
28 // here (specifically the jemalloc allocator), but currently jemalloc is
29 // disabled on quite a few platforms (bsds, emscripten, msvc, etc). To ensure
30 // that this just passes on those platforms we link in some other allocator to
31 // ensure we get the same error.
33 // So long as we CI linux/macOS we should be good.
34 #[cfg(any(target_os = "linux", target_os = "macos"))]
35 extern crate alloc_jemalloc;
36 #[cfg(not(any(target_os = "linux", target_os = "macos")))]
37 extern crate allocator1;
40 allocator_dylib::foo();