]>
Commit | Line | Data |
---|---|---|
e9174d1e SL |
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. | |
4 | // | |
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. | |
10 | ||
54a0048b | 11 | // ignore-musl no dylibs |
e9174d1e | 12 | // aux-build:allocator-dylib.rs |
54a0048b | 13 | // aux-build:allocator1.rs |
e9174d1e SL |
14 | // no-prefer-dynamic |
15 | // error-pattern: cannot link together two allocators | |
16 | ||
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 | |
19 | // an error. | |
20 | ||
21 | #![feature(alloc_jemalloc)] | |
22 | ||
23 | extern crate allocator_dylib; | |
54a0048b SL |
24 | |
25 | // The main purpose of this test is to ensure that `alloc_jemalloc` **fails** | |
26 | // here (specifically the jemalloc allocator), but currently jemalloc is | |
27 | // disabled on quite a few platforms (bsds, emscripten, msvc, etc). To ensure | |
28 | // that this just passes on those platforms we link in some other allocator to | |
29 | // ensure we get the same error. | |
30 | // | |
31 | // So long as we CI linux/OSX we should be good. | |
32 | #[cfg(any(target_os = "linux", target_os = "macos"))] | |
e9174d1e | 33 | extern crate alloc_jemalloc; |
54a0048b SL |
34 | #[cfg(not(any(target_os = "linux", target_os = "macos")))] |
35 | extern crate allocator1; | |
e9174d1e SL |
36 | |
37 | fn main() { | |
38 | allocator_dylib::foo(); | |
39 | } |