mirror of
https://github.com/rust-lang/rust.git
synced 2026-06-01 05:57:03 +03:00
test thread-local key with no dtor
This commit is contained in:
@@ -727,7 +727,6 @@ fn call_c_abi(
|
||||
|
||||
// Extract the function type out of the signature (that seems easier than constructing it ourselves...)
|
||||
let dtor_ptr = args[1].read_ptr(&self.memory)?;
|
||||
// TODO: The null-pointer case here is entirely untested
|
||||
let dtor = if dtor_ptr.is_null_ptr() { None } else { Some(self.memory.get_fn(dtor_ptr.alloc_id)?) };
|
||||
|
||||
// Figure out how large a pthread TLS key actually is. This is libc::pthread_key_t.
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
#![feature(libc)]
|
||||
extern crate libc;
|
||||
|
||||
use std::mem;
|
||||
|
||||
pub type Key = libc::pthread_key_t;
|
||||
|
||||
pub unsafe fn create(dtor: Option<unsafe extern fn(*mut u8)>) -> Key {
|
||||
let mut key = 0;
|
||||
assert_eq!(libc::pthread_key_create(&mut key, mem::transmute(dtor)), 0);
|
||||
key
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let _ = unsafe { create(None) };
|
||||
}
|
||||
Reference in New Issue
Block a user