mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-11 16:15:03 +00:00
28 lines
405 B
Rust
28 lines
405 B
Rust
#![crate_type = "cdylib"]
|
|
|
|
#[no_mangle]
|
|
#[cfg(a)]
|
|
pub fn foo() {
|
|
panic!("test");
|
|
}
|
|
|
|
#[no_mangle]
|
|
#[cfg(b)]
|
|
pub fn foo() {
|
|
panic!("{}", 1);
|
|
}
|
|
|
|
#[no_mangle]
|
|
#[cfg(c)]
|
|
pub fn foo() {
|
|
panic!("{}", "a");
|
|
}
|
|
|
|
#[no_mangle]
|
|
#[cfg(d)]
|
|
pub fn foo() -> usize {
|
|
use std::cell::Cell;
|
|
thread_local!(static A: Cell<Vec<u32>> = Cell::new(Vec::new()));
|
|
A.try_with(|x| x.take().len()).unwrap_or(0)
|
|
}
|