]> git.proxmox.com Git - rustc.git/blame - src/test/compile-fail/allocator-rust-dylib-is-jemalloc.rs
Imported Upstream version 1.9.0+dfsg1
[rustc.git] / src / test / compile-fail / allocator-rust-dylib-is-jemalloc.rs
CommitLineData
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-dylib2.rs
54a0048b 13// aux-build:allocator1.rs
e9174d1e
SL
14// error-pattern: cannot link together two allocators
15
16// Ensure that rust dynamic libraries use jemalloc as their allocator, verifying
17// by linking in the system allocator here and ensuring that we get a complaint.
18
19#![feature(alloc_system)]
20
21extern crate allocator_dylib2;
54a0048b
SL
22
23// The main purpose of this test is to ensure that `alloc_system` **fails**
24// here (specifically the system allocator), but currently system is
25// disabled on quite a few platforms (bsds, emscripten, msvc, etc). To ensure
26// that this just passes on those platforms we link in some other allocator to
27// ensure we get the same error.
28//
29// So long as we CI linux/OSX we should be good.
30#[cfg(any(target_os = "linux", target_os = "macos"))]
e9174d1e 31extern crate alloc_system;
54a0048b
SL
32#[cfg(not(any(target_os = "linux", target_os = "macos")))]
33extern crate allocator1;
e9174d1e
SL
34
35fn main() {
36 allocator_dylib2::foo();
37}