repo stringlengths 6 65 | file_url stringlengths 81 311 | file_path stringlengths 6 227 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:31:58 2026-01-04 20:25:31 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/genmc/pass/litmus/ccr.rs | src/tools/miri/tests/genmc/pass/litmus/ccr.rs | //@compile-flags: -Zmiri-genmc -Zmiri-disable-stacked-borrows
// Translated from GenMC's test "litmus/ccr".
#![no_main]
#[path = "../../../utils/genmc.rs"]
mod genmc;
use std::sync::atomic::AtomicU64;
use std::sync::atomic::Ordering::*;
use crate::genmc::*;
static X: AtomicU64 = AtomicU64::new(0);
#[unsafe(no_ma... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/genmc/pass/litmus/2w2w_4sc.rs | src/tools/miri/tests/genmc/pass/litmus/2w2w_4sc.rs | //@compile-flags: -Zmiri-genmc -Zmiri-disable-stacked-borrows
// Translated from GenMC's test "2+2W+4c".
//
// The pass tests "2w2w_3sc_1rel.rs", "2w2w_4rel" and "2w2w_4sc" and the fail test "2w2w_weak.rs" are related.
// Check "2w2w_weak.rs" for a more detailed description.
#![no_main]
#[path = "../../../utils/genm... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/genmc/pass/litmus/Z6_U.rs | src/tools/miri/tests/genmc/pass/litmus/Z6_U.rs | //@revisions: weak sc
//@compile-flags: -Zmiri-genmc -Zmiri-disable-stacked-borrows
//@[sc]compile-flags: -Zmiri-disable-weak-memory-emulation
// Translated from GenMC's "litmus/Z6.U" test.
//
// The `sc` variant of this test checks that we get fewer executions when weak memory emulation is disabled.
// NOTE: the ord... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/genmc/pass/litmus/2w2w_3sc_1rel.rs | src/tools/miri/tests/genmc/pass/litmus/2w2w_3sc_1rel.rs | //@compile-flags: -Zmiri-genmc -Zmiri-disable-stacked-borrows
//@revisions: release1 release2
// Translated from GenMC's test "2+2W+3sc+rel1" and "2+2W+3sc+rel2" (two variants that swap which store is `Release`).
//
// The pass tests "2w2w_3sc_1rel.rs", "2w2w_4rel" and "2w2w_4sc" and the fail test "2w2w_weak.rs" are r... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/genmc/pass/litmus/MPU2_rels_acqf.rs | src/tools/miri/tests/genmc/pass/litmus/MPU2_rels_acqf.rs | //@compile-flags: -Zmiri-genmc -Zmiri-disable-stacked-borrows
// Translated from GenMC's "litmus/MPU2+rels+acqf" test.
#![no_main]
#[path = "../../../utils/genmc.rs"]
mod genmc;
#[path = "../../../utils/mod.rs"]
mod utils;
use std::fmt::Write;
use std::sync::atomic::AtomicU64;
use std::sync::atomic::Ordering::*;
u... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/genmc/pass/litmus/IRIW-acq-sc.rs | src/tools/miri/tests/genmc/pass/litmus/IRIW-acq-sc.rs | //@compile-flags: -Zmiri-genmc -Zmiri-disable-stacked-borrows
// Translated from GenMC's "litmus/IRIW-acq-sc" test.
#![no_main]
#[path = "../../../utils/genmc.rs"]
mod genmc;
use std::sync::atomic::AtomicU64;
use std::sync::atomic::Ordering::*;
use crate::genmc::*;
static X: AtomicU64 = AtomicU64::new(0);
static ... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/genmc/pass/litmus/Z6_acq.rs | src/tools/miri/tests/genmc/pass/litmus/Z6_acq.rs | //@compile-flags: -Zmiri-genmc -Zmiri-disable-stacked-borrows
// Translated from GenMC's "litmus/Z6+acq" test.
#![no_main]
#[path = "../../../utils/genmc.rs"]
mod genmc;
use std::sync::atomic::AtomicU64;
use std::sync::atomic::Ordering::*;
use crate::genmc::*;
static X: AtomicU64 = AtomicU64::new(0);
static Y: At... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/genmc/pass/litmus/cii.rs | src/tools/miri/tests/genmc/pass/litmus/cii.rs | //@compile-flags: -Zmiri-genmc -Zmiri-disable-stacked-borrows
// Translated from GenMC's test "litmus/cii".
#![no_main]
#[path = "../../../utils/genmc.rs"]
mod genmc;
use std::sync::atomic::AtomicU64;
use std::sync::atomic::Ordering::*;
use crate::genmc::*;
static X: AtomicU64 = AtomicU64::new(0);
#[unsafe(no_ma... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/genmc/pass/litmus/corr.rs | src/tools/miri/tests/genmc/pass/litmus/corr.rs | //@compile-flags: -Zmiri-genmc -Zmiri-disable-stacked-borrows
// Translated from GenMC's "CoRR" test.
#![no_main]
#[path = "../../../utils/genmc.rs"]
mod genmc;
use std::sync::atomic::AtomicU64;
use std::sync::atomic::Ordering::*;
use crate::genmc::*;
static X: AtomicU64 = AtomicU64::new(0);
#[unsafe(no_mangle)]
... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/genmc/pass/litmus/inc_inc_RR_W_RR.rs | src/tools/miri/tests/genmc/pass/litmus/inc_inc_RR_W_RR.rs | //@compile-flags: -Zmiri-genmc -Zmiri-disable-stacked-borrows
#![no_main]
#[path = "../../../utils/genmc.rs"]
mod genmc;
use std::ffi::c_void;
use std::sync::atomic::AtomicU64;
use std::sync::atomic::Ordering::*;
use crate::genmc::*;
static X: AtomicU64 = AtomicU64::new(0);
static mut A: u64 = 0;
static mut B: u6... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/genmc/pass/litmus/MP_rels_acqf.rs | src/tools/miri/tests/genmc/pass/litmus/MP_rels_acqf.rs | //@compile-flags: -Zmiri-genmc -Zmiri-disable-stacked-borrows
// Translated from GenMC's "litmus/MP+rels+acqf" test.
#![no_main]
#[path = "../../../utils/genmc.rs"]
mod genmc;
use std::sync::atomic::AtomicU64;
use std::sync::atomic::Ordering::*;
// Note: the GenMC equivalent of this test (genmc/tests/correct/litmu... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/genmc/pass/std/spawn_std_threads.rs | src/tools/miri/tests/genmc/pass/std/spawn_std_threads.rs | //@compile-flags: -Zmiri-genmc -Zmiri-disable-stacked-borrows
// We should be able to spawn and join standard library threads in GenMC mode.
// Since these threads do nothing, we should only explore 1 program execution.
const N: usize = 2;
fn main() {
let handles: Vec<_> = (0..N).map(|_| std::thread::spawn(threa... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/genmc/pass/std/empty_main.rs | src/tools/miri/tests/genmc/pass/std/empty_main.rs | //@compile-flags: -Zmiri-genmc -Zmiri-disable-stacked-borrows
// A lot of code runs before main, which we should be able to handle in GenMC mode.
fn main() {}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/genmc/pass/std/thread_locals.rs | src/tools/miri/tests/genmc/pass/std/thread_locals.rs | //@compile-flags: -Zmiri-ignore-leaks -Zmiri-genmc -Zmiri-disable-stacked-borrows
use std::alloc::{Layout, alloc};
use std::cell::Cell;
use std::sync::atomic::AtomicPtr;
use std::sync::atomic::Ordering::*;
static X: AtomicPtr<u64> = AtomicPtr::new(std::ptr::null_mut());
thread_local! {
static R: Cell<*mut u64> =... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/genmc/pass/std/arc.rs | src/tools/miri/tests/genmc/pass/std/arc.rs | //@compile-flags: -Zmiri-genmc -Zmiri-disable-stacked-borrows
//@revisions: check_count try_upgrade
// Check that various operations on `std::sync::Arc` are handled properly in GenMC mode.
//
// The number of explored executions in the expected output of this test may change if
// the implementation of `Arc` is ever c... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/libc/prctl-get-name-buffer-too-small.rs | src/tools/miri/tests/fail-dep/libc/prctl-get-name-buffer-too-small.rs | //! Ensure we report UB when the buffer is smaller than 16 bytes (even if the thread
//! name would fit in the smaller buffer).
//@only-target: android # Miri supports prctl for Android only
fn main() {
let mut buf = vec![0u8; 15];
unsafe {
libc::prctl(libc::PR_GET_NAME, buf.as_mut_ptr().cast::<libc::... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/libc/libc_epoll_block_two_thread.rs | src/tools/miri/tests/fail-dep/libc/libc_epoll_block_two_thread.rs | //@compile-flags: -Zmiri-deterministic-concurrency
//@only-target: linux android illumos
//@error-in-other-file: deadlock
use std::convert::TryInto;
use std::thread;
#[path = "../../utils/libc.rs"]
mod libc_utils;
// Using `as` cast since `EPOLLET` wraps around
const EPOLL_IN_OUT_ET: u32 = (libc::EPOLLIN | libc::EPO... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/libc/memcmp_null.rs | src/tools/miri/tests/fail-dep/libc/memcmp_null.rs | use std::ptr;
// null is explicitly called out as UB in the C docs.
fn main() {
unsafe {
libc::memcmp(ptr::null(), ptr::null(), 0); //~ERROR: null pointer
}
}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/libc/socketpair_block_write_twice.rs | src/tools/miri/tests/fail-dep/libc/socketpair_block_write_twice.rs | //@ignore-target: windows # No libc socketpair on Windows
// test_race depends on a deterministic schedule.
//@compile-flags: -Zmiri-deterministic-concurrency
//@error-in-other-file: deadlock
//@require-annotations-for-level: error
use std::thread;
#[path = "../../utils/libc.rs"]
mod libc_utils;
// Test the behaviou... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/libc/mmap_use_after_munmap.rs | src/tools/miri/tests/fail-dep/libc/mmap_use_after_munmap.rs | //@compile-flags: -Zmiri-disable-isolation
//@ignore-target: windows # No mmap on Windows
#![feature(rustc_private)]
fn main() {
unsafe {
let ptr = libc::mmap(
std::ptr::null_mut(),
4096,
libc::PROT_READ | libc::PROT_WRITE,
libc::MAP_PRIVATE | libc::MAP_ANON... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/libc/affinity.rs | src/tools/miri/tests/fail-dep/libc/affinity.rs | //@only-target: linux # these are Linux-specific APIs
//@compile-flags: -Zmiri-disable-isolation -Zmiri-num-cpus=4
fn main() {
use std::mem::size_of;
use libc::{cpu_set_t, sched_setaffinity};
// If pid is zero, then the calling thread is used.
const PID: i32 = 0;
let cpuset: cpu_set_t = unsafe {... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/libc/memrchr_null.rs | src/tools/miri/tests/fail-dep/libc/memrchr_null.rs | //@only-target: linux # `memrchr` is a GNU extension
use std::ptr;
// null is explicitly called out as UB in the C docs for `memchr`.
fn main() {
unsafe {
libc::memrchr(ptr::null(), 0, 0); //~ERROR: null pointer
}
}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/libc/mmap_invalid_dealloc.rs | src/tools/miri/tests/fail-dep/libc/mmap_invalid_dealloc.rs | //@compile-flags: -Zmiri-disable-isolation
//@ignore-target: windows # No mmap on Windows
#![feature(rustc_private)]
fn main() {
unsafe {
let ptr = libc::mmap(
std::ptr::null_mut(),
4096,
libc::PROT_READ | libc::PROT_WRITE,
libc::MAP_PRIVATE | libc::MAP_ANON... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/libc/memset_null.rs | src/tools/miri/tests/fail-dep/libc/memset_null.rs | use std::ptr;
// null is explicitly called out as UB in the C docs for `memset`.
fn main() {
unsafe {
libc::memset(ptr::null_mut(), 0, 0); //~ERROR: null pointer
}
}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/libc/libc-read-and-uninit-premature-eof.rs | src/tools/miri/tests/fail-dep/libc/libc-read-and-uninit-premature-eof.rs | //! We test that if we requested to read 4 bytes, but actually read 3 bytes,
//! then 3 bytes (not 4) will be initialized.
//@ignore-target: windows # no file system support on Windows
//@compile-flags: -Zmiri-disable-isolation
use std::ffi::CString;
use std::fs::remove_file;
use std::mem::MaybeUninit;
#[path = "../.... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/libc/malloc_zero_double_free.rs | src/tools/miri/tests/fail-dep/libc/malloc_zero_double_free.rs | fn main() {
unsafe {
let ptr = libc::malloc(0);
libc::free(ptr);
libc::free(ptr); //~ERROR: dangling
}
}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/libc/munmap_partial.rs | src/tools/miri/tests/fail-dep/libc/munmap_partial.rs | //! The man pages for mmap/munmap suggest that it is possible to partly unmap a previously-mapped
//! region of address space, but to LLVM that would be partial deallocation, which LLVM does not
//! support. So even though the man pages say this sort of use is possible, we must report UB.
//@ignore-target: windows # No... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/libc/socketpair-data-race.rs | src/tools/miri/tests/fail-dep/libc/socketpair-data-race.rs | //! This is a regression test for <https://github.com/rust-lang/miri/issues/3947>: we had some
//! faulty logic around `release_clock` that led to this code not reporting a data race.
//@ignore-target: windows # no libc socketpair on Windows
//@compile-flags: -Zmiri-deterministic-concurrency
use std::thread;
fn main()... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/libc/memcpy_zero.rs | src/tools/miri/tests/fail-dep/libc/memcpy_zero.rs | //@compile-flags: -Zmiri-permissive-provenance
// C's memcpy is 0 bytes is UB for some pointers that are allowed in Rust's `copy_nonoverlapping`.
fn main() {
let from = 42 as *const u8;
let to = 23 as *mut u8;
unsafe {
to.copy_from(from, 0); // this is fine
libc::memcpy(to.cast(), from.cast... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/libc/env-set_var-data-race.rs | src/tools/miri/tests/fail-dep/libc/env-set_var-data-race.rs | //@compile-flags: -Zmiri-disable-isolation -Zmiri-deterministic-concurrency
//@ignore-target: windows # No libc env support on Windows
use std::{env, thread};
fn main() {
let t = thread::spawn(|| unsafe {
// Access the environment in another thread without taking the env lock.
// This represents s... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/libc/fcntl_fsetfl_while_blocking.rs | src/tools/miri/tests/fail-dep/libc/fcntl_fsetfl_while_blocking.rs | //@ignore-target: windows # Sockets/pipes are not implemented yet
//@compile-flags: -Zmiri-deterministic-concurrency
use std::thread;
/// If an O_NONBLOCK flag is set while the fd is blocking, that fd will not be woken up.
fn main() {
let mut fds = [-1, -1];
let res = unsafe { libc::pipe(fds.as_mut_ptr()) };
... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/libc/socketpair-close-while-blocked.rs | src/tools/miri/tests/fail-dep/libc/socketpair-close-while-blocked.rs | //! This is a regression test for <https://github.com/rust-lang/miri/issues/3947>: we had some
//! faulty logic around `release_clock` that led to this code not reporting a data race.
//@ignore-target: windows # no libc socketpair on Windows
//@compile-flags: -Zmiri-deterministic-concurrency
//@error-in-other-file: dea... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/libc/realloc-zero.rs | src/tools/miri/tests/fail-dep/libc/realloc-zero.rs | fn main() {
unsafe {
let p1 = libc::malloc(20);
// C made this UB...
let p2 = libc::realloc(p1, 0); //~ERROR: `realloc` with a size of zero
assert!(p2.is_null());
}
}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/libc/memchr_null.rs | src/tools/miri/tests/fail-dep/libc/memchr_null.rs | use std::ptr;
// null is explicitly called out as UB in the C docs.
fn main() {
unsafe {
libc::memchr(ptr::null(), 0, 0); //~ERROR: null pointer
}
}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/libc/posix_memalign_size_zero_double_free.rs | src/tools/miri/tests/fail-dep/libc/posix_memalign_size_zero_double_free.rs | //@ignore-target: windows # No posix_memalign on Windows
use std::ptr;
fn main() {
let mut ptr: *mut libc::c_void = ptr::null_mut();
let align = 64;
let size = 0;
unsafe {
let _ = libc::posix_memalign(&mut ptr, align, size);
libc::free(ptr);
libc::free(ptr); //~ERROR: dangling
... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/libc/unsupported_incomplete_function.rs | src/tools/miri/tests/fail-dep/libc/unsupported_incomplete_function.rs | //! `signal()` is special on Linux and macOS that it's only supported within libstd.
//! The implementation is not complete enough to permit user code to call it.
//@ignore-target: windows # No `libc: #signal` on Windows
//@normalize-stderr-test: "OS `.*`" -> "$$OS"
fn main() {
unsafe {
libc::signal(libc::... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/libc/memcmp_zero.rs | src/tools/miri/tests/fail-dep/libc/memcmp_zero.rs | //@compile-flags: -Zmiri-permissive-provenance
// C says that passing "invalid" pointers is UB for all string functions.
// It is unclear whether `(int*)42` is "invalid", but there is no actually
// a `char` living at that address, so arguably it cannot be a valid pointer.
// Hence this is UB.
fn main() {
let ptr ... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/libc/malloc_zero_memory_leak.rs | src/tools/miri/tests/fail-dep/libc/malloc_zero_memory_leak.rs | fn main() {
unsafe {
let _ptr = libc::malloc(0); //~ERROR: memory leak
}
}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/libc/socketpair_block_read_twice.rs | src/tools/miri/tests/fail-dep/libc/socketpair_block_read_twice.rs | //@ignore-target: windows # No libc socketpair on Windows
// test_race depends on a deterministic schedule.
//@compile-flags: -Zmiri-deterministic-concurrency
//@error-in-other-file: deadlock
//@require-annotations-for-level: error
use std::thread;
// Test the behaviour of a thread being blocked on read, get unblocke... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/libc/eventfd_block_read_twice.rs | src/tools/miri/tests/fail-dep/libc/eventfd_block_read_twice.rs | //@only-target: linux android illumos
//@compile-flags: -Zmiri-deterministic-concurrency
//@error-in-other-file: deadlock
use std::thread;
// Test the behaviour of a thread being blocked on an eventfd read, get unblocked, and then
// get blocked again.
// The expected execution is
// 1. Thread 1 blocks.
// 2. Thread... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/libc/libc-epoll-data-race.rs | src/tools/miri/tests/fail-dep/libc/libc-epoll-data-race.rs | //! This ensures that when an epoll_wait wakes up and there are multiple events,
//! and we only read one of them, we do not synchronize with the other events
//! and therefore still report a data race for things that need to see the second event
//! to be considered synchronized.
//@only-target: linux android illumos
... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/libc/aligned_alloc_size_zero_leak.rs | src/tools/miri/tests/fail-dep/libc/aligned_alloc_size_zero_leak.rs | //@ignore-target: windows # Windows does not support the standard C11 aligned_alloc.
fn main() {
// libc doesn't have this function (https://github.com/rust-lang/libc/issues/3689),
// so we declare it ourselves.
extern "C" {
fn aligned_alloc(alignment: libc::size_t, size: libc::size_t) -> *mut libc... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/libc/eventfd_block_write_twice.rs | src/tools/miri/tests/fail-dep/libc/eventfd_block_write_twice.rs | //@only-target: linux android illumos
//@compile-flags: -Zmiri-deterministic-concurrency
//@error-in-other-file: deadlock
use std::thread;
// Test the behaviour of a thread being blocked on an eventfd `write`, get unblocked, and then
// get blocked again.
// The expected execution is
// 1. Thread 1 blocks.
// 2. Thr... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/libc/posix_memalign_size_zero_leak.rs | src/tools/miri/tests/fail-dep/libc/posix_memalign_size_zero_leak.rs | //@ignore-target: windows # No posix_memalign on Windows
use std::ptr;
fn main() {
let mut ptr: *mut libc::c_void = ptr::null_mut();
let align = 64;
let size = 0;
let _ = unsafe { libc::posix_memalign(&mut ptr, align, size) }; //~ERROR: memory leak
}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/libc/libc_epoll_unsupported_fd.rs | src/tools/miri/tests/fail-dep/libc/libc_epoll_unsupported_fd.rs | //@only-target: linux android illumos
// This is a test for registering unsupported fd with epoll.
// Register epoll fd with epoll is allowed in real system, but we do not support this.
fn main() {
// Create two epoll instance.
let epfd0 = unsafe { libc::epoll_create1(0) };
assert_ne!(epfd0, -1);
let e... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/libc/fs/read_from_stdout.rs | src/tools/miri/tests/fail-dep/libc/fs/read_from_stdout.rs | //@compile-flags: -Zmiri-disable-isolation
//@ignore-target: windows # No libc IO on Windows
fn main() -> std::io::Result<()> {
let mut bytes = [0u8; 512];
unsafe {
libc::read(1, bytes.as_mut_ptr() as *mut libc::c_void, 512); //~ ERROR: cannot read from stdout
}
Ok(())
}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/libc/fs/close_stdout.rs | src/tools/miri/tests/fail-dep/libc/fs/close_stdout.rs | //@ignore-target: windows # No libc IO on Windows
//@compile-flags: -Zmiri-disable-isolation
// FIXME: standard handles cannot be closed (https://github.com/rust-lang/rust/issues/40032)
fn main() {
unsafe {
libc::close(1); //~ ERROR: cannot close stdout
}
}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/libc/fs/mkstemp_immutable_arg.rs | src/tools/miri/tests/fail-dep/libc/fs/mkstemp_immutable_arg.rs | //@ignore-target: windows # No mkstemp on Windows
//@compile-flags: -Zmiri-disable-isolation
fn main() {
test_mkstemp_immutable_arg();
}
fn test_mkstemp_immutable_arg() {
let s: *mut libc::c_char = b"fooXXXXXX\0" as *const _ as *mut _;
let _fd = unsafe { libc::mkstemp(s) }; //~ ERROR: Undefined Behavior: ... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/libc/fs/write_to_stdin.rs | src/tools/miri/tests/fail-dep/libc/fs/write_to_stdin.rs | //@ignore-target: windows # No libc IO on Windows
fn main() -> std::io::Result<()> {
let bytes = b"hello";
unsafe {
libc::write(0, bytes.as_ptr() as *const libc::c_void, 5); //~ ERROR: cannot write to stdin
}
Ok(())
}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/libc/fs/unix_open_missing_required_mode.rs | src/tools/miri/tests/fail-dep/libc/fs/unix_open_missing_required_mode.rs | //@ignore-target: windows # No libc IO on Windows
//@compile-flags: -Zmiri-disable-isolation
fn main() {
test_file_open_missing_needed_mode();
}
fn test_file_open_missing_needed_mode() {
let name = b"missing_arg.txt\0";
let name_ptr = name.as_ptr().cast::<libc::c_char>();
let _fd = unsafe { libc::open... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/concurrency/apple_os_unfair_lock_reentrant.rs | src/tools/miri/tests/fail-dep/concurrency/apple_os_unfair_lock_reentrant.rs | //@only-target: darwin
use std::cell::UnsafeCell;
fn main() {
let lock = UnsafeCell::new(libc::OS_UNFAIR_LOCK_INIT);
unsafe {
libc::os_unfair_lock_lock(lock.get());
libc::os_unfair_lock_lock(lock.get());
//~^ error: abnormal termination: attempted to lock an os_unfair_lock that is alr... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_mutex_wrong_owner.rs | src/tools/miri/tests/fail-dep/concurrency/libc_pthread_mutex_wrong_owner.rs | //@ignore-target: windows # No pthreads on Windows
use std::cell::UnsafeCell;
use std::sync::Arc;
use std::thread;
struct Mutex(UnsafeCell<libc::pthread_mutex_t>);
unsafe impl Send for Mutex {}
unsafe impl Sync for Mutex {}
fn new_lock() -> Arc<Mutex> {
Arc::new(Mutex(UnsafeCell::new(libc::PTHREAD_MUTEX_INITIAL... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/concurrency/apple_os_unfair_lock_move_with_queue.rs | src/tools/miri/tests/fail-dep/concurrency/apple_os_unfair_lock_move_with_queue.rs | //@only-target: darwin
//@compile-flags: -Zmiri-fixed-schedule
#![feature(sync_unsafe_cell)]
use std::cell::SyncUnsafeCell;
use std::sync::atomic::*;
use std::thread;
fn main() {
let lock = SyncUnsafeCell::new(libc::OS_UNFAIR_LOCK_INIT);
thread::scope(|s| {
// First thread: grabs the lock.
s.... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_mutex_read_while_queued.rs | src/tools/miri/tests/fail-dep/concurrency/libc_pthread_mutex_read_while_queued.rs | //@ignore-target: windows # No pthreads on Windows
//@compile-flags: -Zmiri-deterministic-concurrency
use std::cell::UnsafeCell;
use std::sync::atomic::*;
use std::thread;
struct Mutex(UnsafeCell<libc::pthread_mutex_t>);
impl Mutex {
fn get(&self) -> *mut libc::pthread_mutex_t {
self.0.get()
}
}
unsa... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_mutex_normal_unlock_unlocked.rs | src/tools/miri/tests/fail-dep/concurrency/libc_pthread_mutex_normal_unlock_unlocked.rs | //@ignore-target: windows # No pthreads on Windows
fn main() {
unsafe {
let mut mutexattr: libc::pthread_mutexattr_t = std::mem::zeroed();
assert_eq!(
libc::pthread_mutexattr_settype(&mut mutexattr as *mut _, libc::PTHREAD_MUTEX_NORMAL),
0,
);
let mut mutex: ... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_rwlock_unlock_unlocked.rs | src/tools/miri/tests/fail-dep/concurrency/libc_pthread_rwlock_unlock_unlocked.rs | //@ignore-target: windows # No pthreads on Windows
fn main() {
let rw = std::cell::UnsafeCell::new(libc::PTHREAD_RWLOCK_INITIALIZER);
unsafe {
libc::pthread_rwlock_unlock(rw.get()); //~ ERROR: was not locked
}
}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_rwlock_write_write_deadlock_single_thread.rs | src/tools/miri/tests/fail-dep/concurrency/libc_pthread_rwlock_write_write_deadlock_single_thread.rs | //@ignore-target: windows # No pthreads on Windows
fn main() {
let rw = std::cell::UnsafeCell::new(libc::PTHREAD_RWLOCK_INITIALIZER);
unsafe {
assert_eq!(libc::pthread_rwlock_wrlock(rw.get()), 0);
libc::pthread_rwlock_wrlock(rw.get()); //~ ERROR: deadlock
}
}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_rwlock_double_destroy.rs | src/tools/miri/tests/fail-dep/concurrency/libc_pthread_rwlock_double_destroy.rs | //@ignore-target: windows # No pthreads on Windows
//@ normalize-stderr-test: "(\n)ALLOC \(.*\) \{\n(.*\n)*\}(\n)" -> "${1}ALLOC DUMP${3}"
//@ normalize-stderr-test: "\[0x[0-9a-z]+..0x[0-9a-z]+\]" -> "[0xX..0xY]"
/// Test that destroying a pthread_rwlock twice fails, even without a check for number validity
fn main()... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_rwlock_read_write_deadlock_single_thread.rs | src/tools/miri/tests/fail-dep/concurrency/libc_pthread_rwlock_read_write_deadlock_single_thread.rs | //@ignore-target: windows # No pthreads on Windows
fn main() {
let rw = std::cell::UnsafeCell::new(libc::PTHREAD_RWLOCK_INITIALIZER);
unsafe {
assert_eq!(libc::pthread_rwlock_rdlock(rw.get()), 0);
libc::pthread_rwlock_wrlock(rw.get()); //~ ERROR: deadlock
}
}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_rwlock_destroy_read_locked.rs | src/tools/miri/tests/fail-dep/concurrency/libc_pthread_rwlock_destroy_read_locked.rs | //@ignore-target: windows # No pthreads on Windows
fn main() {
let rw = std::cell::UnsafeCell::new(libc::PTHREAD_RWLOCK_INITIALIZER);
unsafe {
assert_eq!(libc::pthread_rwlock_rdlock(rw.get()), 0);
libc::pthread_rwlock_destroy(rw.get()); //~ ERROR: destroyed a locked rwlock
}
}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_create_too_few_args.rs | src/tools/miri/tests/fail-dep/concurrency/libc_pthread_create_too_few_args.rs | //@ignore-target: windows # No pthreads on Windows
//! The thread function must have exactly one argument.
use std::{mem, ptr};
extern "C" fn thread_start() -> *mut libc::c_void {
panic!()
}
fn main() {
unsafe {
let mut native: libc::pthread_t = mem::zeroed();
let thread_start: extern "C" fn... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_mutex_overwrite.rs | src/tools/miri/tests/fail-dep/concurrency/libc_pthread_mutex_overwrite.rs | //@ignore-target: windows # No pthreads on Windows
fn main() {
unsafe {
let mut m: libc::pthread_mutex_t = libc::PTHREAD_MUTEX_INITIALIZER;
libc::pthread_mutex_lock(&mut m as *mut _);
// Overwrite the mutex with itself. This de-initializes it.
let copy = m;
m = copy;
... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/concurrency/apple_os_unfair_lock_unowned.rs | src/tools/miri/tests/fail-dep/concurrency/apple_os_unfair_lock_unowned.rs | //@only-target: darwin
use std::cell::UnsafeCell;
fn main() {
let lock = UnsafeCell::new(libc::OS_UNFAIR_LOCK_INIT);
unsafe {
libc::os_unfair_lock_unlock(lock.get());
//~^ error: abnormal termination: attempted to unlock an os_unfair_lock not owned by the current thread
}
}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/concurrency/windows_join_main.rs | src/tools/miri/tests/fail-dep/concurrency/windows_join_main.rs | //@only-target: windows # Uses win32 api functions
// We are making scheduler assumptions here.
//@compile-flags: -Zmiri-deterministic-concurrency
//@error-in-other-file: deadlock
// On windows, joining main is not UB, but it will block a thread forever.
use std::thread;
use windows_sys::Win32::Foundation::{HANDLE, ... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_join_self.rs | src/tools/miri/tests/fail-dep/concurrency/libc_pthread_join_self.rs | //@ignore-target: windows # No pthreads on Windows
// We are making scheduler assumptions here.
//@compile-flags: -Zmiri-deterministic-concurrency
// Joining itself is undefined behavior.
use std::{ptr, thread};
fn main() {
let handle = thread::spawn(|| {
unsafe {
let native: libc::pthread_t ... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_mutex_double_destroy.rs | src/tools/miri/tests/fail-dep/concurrency/libc_pthread_mutex_double_destroy.rs | //@ignore-target: windows # No pthreads on Windows
//@ normalize-stderr-test: "(\n)ALLOC \(.*\) \{\n(.*\n)*\}(\n)" -> "${1}ALLOC DUMP${3}"
//@ normalize-stderr-test: "\[0x[0-9a-z]+..0x[0-9a-z]+\]" -> "[0xX..0xY]"
/// Test that destroying a pthread_mutex twice fails, even without a check for number validity
fn main() ... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_join_multiple.rs | src/tools/miri/tests/fail-dep/concurrency/libc_pthread_join_multiple.rs | //@ignore-target: windows # No pthreads on Windows
// Joining the same thread from multiple threads is undefined behavior.
use std::{mem, ptr, thread};
extern "C" fn thread_start(_null: *mut libc::c_void) -> *mut libc::c_void {
// Yield the thread several times so that other threads can join it.
thread::yiel... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_mutexattr_double_destroy.rs | src/tools/miri/tests/fail-dep/concurrency/libc_pthread_mutexattr_double_destroy.rs | //@ignore-target: windows # No pthreads on Windows
//@ normalize-stderr-test: "(\n)ALLOC \(.*\) \{\n(.*\n)*\}(\n)" -> "${1}ALLOC DUMP${3}"
//@ normalize-stderr-test: "\[0x[0-9a-z]..0x[0-9a-z]\]" -> "[0xX..0xY]"
/// Test that destroying a pthread_mutexattr twice fails, even without a check for number validity
fn main(... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_create_too_many_args.rs | src/tools/miri/tests/fail-dep/concurrency/libc_pthread_create_too_many_args.rs | //@ignore-target: windows # No pthreads on Windows
//! The thread function must have exactly one argument.
use std::{mem, ptr};
extern "C" fn thread_start(_null: *mut libc::c_void, _x: i32) -> *mut libc::c_void {
panic!()
}
fn main() {
unsafe {
let mut native: libc::pthread_t = mem::zeroed();
... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_cond_move.rs | src/tools/miri/tests/fail-dep/concurrency/libc_pthread_cond_move.rs | //@revisions: static_initializer init
//@ignore-target: windows # No pthreads on Windows
/// Test that moving a pthread_cond between uses fails.
fn main() {
check()
}
#[cfg(init)]
fn check() {
unsafe {
use core::mem::MaybeUninit;
let mut cond = MaybeUninit::<libc::pthread_cond_t>::uninit();
... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_mutex_deadlock.rs | src/tools/miri/tests/fail-dep/concurrency/libc_pthread_mutex_deadlock.rs | //@ignore-target: windows # No pthreads on Windows
//@error-in-other-file: deadlock
// We are making scheduler assumptions here.
//@compile-flags: -Zmiri-deterministic-concurrency
use std::cell::UnsafeCell;
use std::sync::Arc;
use std::thread;
struct Mutex(UnsafeCell<libc::pthread_mutex_t>);
unsafe impl Send for Mut... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_rwlock_destroy_write_locked.rs | src/tools/miri/tests/fail-dep/concurrency/libc_pthread_rwlock_destroy_write_locked.rs | //@ignore-target: windows # No pthreads on Windows
fn main() {
let rw = std::cell::UnsafeCell::new(libc::PTHREAD_RWLOCK_INITIALIZER);
unsafe {
assert_eq!(libc::pthread_rwlock_wrlock(rw.get()), 0);
libc::pthread_rwlock_destroy(rw.get()); //~ ERROR: destroyed a locked rwlock
}
}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/concurrency/apple_os_unfair_lock_assert_not_owner.rs | src/tools/miri/tests/fail-dep/concurrency/apple_os_unfair_lock_assert_not_owner.rs | //@only-target: darwin
use std::cell::UnsafeCell;
fn main() {
let lock = UnsafeCell::new(libc::OS_UNFAIR_LOCK_INIT);
unsafe {
libc::os_unfair_lock_lock(lock.get());
libc::os_unfair_lock_assert_not_owner(lock.get());
//~^ error: abnormal termination: called os_unfair_lock_assert_not_ow... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_join_detached.rs | src/tools/miri/tests/fail-dep/concurrency/libc_pthread_join_detached.rs | //@ignore-target: windows # No pthreads on Windows
// Joining a detached thread is undefined behavior.
use std::{mem, ptr};
extern "C" fn thread_start(_null: *mut libc::c_void) -> *mut libc::c_void {
ptr::null_mut()
}
fn main() {
unsafe {
let mut native: libc::pthread_t = mem::zeroed();
asse... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_mutex_free_while_queued.rs | src/tools/miri/tests/fail-dep/concurrency/libc_pthread_mutex_free_while_queued.rs | //@ignore-target: windows # No pthreads on Windows
//@compile-flags: -Zmiri-deterministic-concurrency
//@error-in-other-file: deallocation of `pthread_mutex_t` is forbidden while the queue is non-empty
use std::cell::UnsafeCell;
use std::sync::atomic::*;
use std::thread;
struct Mutex(UnsafeCell<libc::pthread_mutex_t>... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/concurrency/libx_pthread_rwlock_moved.rs | src/tools/miri/tests/fail-dep/concurrency/libx_pthread_rwlock_moved.rs | //@ignore-target: windows # No pthreads on Windows
fn main() {
unsafe {
let mut rw = libc::PTHREAD_RWLOCK_INITIALIZER;
libc::pthread_rwlock_rdlock(&mut rw as *mut _);
// Move rwlock
let mut rw2 = rw;
libc::pthread_rwlock_unlock(&mut rw2 as *mut _); //~ ERROR: not properly... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_condattr_double_destroy.rs | src/tools/miri/tests/fail-dep/concurrency/libc_pthread_condattr_double_destroy.rs | //@ignore-target: windows # No pthreads on Windows
//@ignore-target: apple # Our macOS condattr don't have any fields so we do not notice this.
//@ normalize-stderr-test: "(\n)ALLOC \(.*\) \{\n(.*\n)*\}(\n)" -> "${1}ALLOC DUMP${3}"
//@ normalize-stderr-test: "\[0x[0-9a-z]..0x[0-9a-z]\]" -> "[0xX..0xY]"
/// Test that d... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_create_main_terminate.rs | src/tools/miri/tests/fail-dep/concurrency/libc_pthread_create_main_terminate.rs | //@ignore-target: windows # No pthreads on Windows
//@error-in-other-file: the main thread terminated without waiting for all remaining threads
// Check that we terminate the program when the main thread terminates.
use std::{mem, ptr};
extern "C" fn thread_start(_null: *mut libc::c_void) -> *mut libc::c_void {
... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_join_joined.rs | src/tools/miri/tests/fail-dep/concurrency/libc_pthread_join_joined.rs | //@ignore-target: windows # No pthreads on Windows
// Joining an already joined thread is undefined behavior.
use std::{mem, ptr};
extern "C" fn thread_start(_null: *mut libc::c_void) -> *mut libc::c_void {
ptr::null_mut()
}
fn main() {
unsafe {
let mut native: libc::pthread_t = mem::zeroed();
... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_rwlock_write_write_deadlock.rs | src/tools/miri/tests/fail-dep/concurrency/libc_pthread_rwlock_write_write_deadlock.rs | //@ignore-target: windows # No pthreads on Windows
//@error-in-other-file: deadlock
// We are making scheduler assumptions here.
//@compile-flags: -Zmiri-deterministic-concurrency
use std::cell::UnsafeCell;
use std::sync::Arc;
use std::thread;
struct RwLock(UnsafeCell<libc::pthread_rwlock_t>);
unsafe impl Send for R... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/concurrency/windows_join_detached.rs | src/tools/miri/tests/fail-dep/concurrency/windows_join_detached.rs | //@only-target: windows # Uses win32 api functions
//@error-in-other-file: Undefined Behavior: trying to join a detached thread
// Joining a detached thread is undefined behavior.
use std::os::windows::io::AsRawHandle;
use std::thread;
use windows_sys::Win32::Foundation::{CloseHandle, HANDLE};
fn main() {
let t... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_mutex_NULL_reentrant.rs | src/tools/miri/tests/fail-dep/concurrency/libc_pthread_mutex_NULL_reentrant.rs | //@ignore-target: windows # No pthreads on Windows
//
// Check that if we pass NULL attribute, then reentrant locking is UB.
fn main() {
unsafe {
let mut mutex: libc::pthread_mutex_t = std::mem::zeroed();
assert_eq!(libc::pthread_mutex_init(&mut mutex as *mut _, std::ptr::null() as *const _), 0);
... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_mutex_default_reentrant.rs | src/tools/miri/tests/fail-dep/concurrency/libc_pthread_mutex_default_reentrant.rs | //@ignore-target: windows # No pthreads on Windows
//
// Check that if we do not set the mutex type, it is UB to do reentrant locking. glibc apparently
// actually exploits this, see
// <https://github.molgen.mpg.de/git-mirror/glibc/blob/master/nptl/pthread_mutexattr_settype.c#L31>:
// one must actively call pthread_mu... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_mutex_normal_reentrant.rs | src/tools/miri/tests/fail-dep/concurrency/libc_pthread_mutex_normal_reentrant.rs | //@ignore-target: windows # No pthreads on Windows
fn main() {
unsafe {
let mut mutexattr: libc::pthread_mutexattr_t = std::mem::zeroed();
assert_eq!(
libc::pthread_mutexattr_settype(&mut mutexattr as *mut _, libc::PTHREAD_MUTEX_NORMAL),
0,
);
let mut mutex: ... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_join_main.rs | src/tools/miri/tests/fail-dep/concurrency/libc_pthread_join_main.rs | //@ignore-target: windows # No pthreads on Windows
// Joining the main thread is undefined behavior.
use std::{ptr, thread};
fn main() {
let thread_id: libc::pthread_t = unsafe { libc::pthread_self() };
let handle = thread::spawn(move || {
unsafe {
assert_eq!(libc::pthread_join(thread_id,... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_rwlock_write_read_deadlock_single_thread.rs | src/tools/miri/tests/fail-dep/concurrency/libc_pthread_rwlock_write_read_deadlock_single_thread.rs | //@ignore-target: windows # No pthreads on Windows
fn main() {
let rw = std::cell::UnsafeCell::new(libc::PTHREAD_RWLOCK_INITIALIZER);
unsafe {
assert_eq!(libc::pthread_rwlock_wrlock(rw.get()), 0);
libc::pthread_rwlock_rdlock(rw.get()); //~ ERROR: deadlock
}
}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/concurrency/windows_join_self.rs | src/tools/miri/tests/fail-dep/concurrency/windows_join_self.rs | //@only-target: windows # Uses win32 api functions
// We are making scheduler assumptions here.
//@compile-flags: -Zmiri-deterministic-concurrency
//@error-in-other-file: deadlock
// On windows, a thread joining itself is not UB, but it will deadlock.
use std::thread;
use windows_sys::Win32::Foundation::WAIT_OBJECT_... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_rwlock_write_read_deadlock.rs | src/tools/miri/tests/fail-dep/concurrency/libc_pthread_rwlock_write_read_deadlock.rs | //@ignore-target: windows # No pthreads on Windows
//@error-in-other-file: deadlock
// We are making scheduler assumptions here.
//@compile-flags: -Zmiri-deterministic-concurrency
use std::cell::UnsafeCell;
use std::sync::Arc;
use std::thread;
struct RwLock(UnsafeCell<libc::pthread_rwlock_t>);
unsafe impl Send for R... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/concurrency/windows_thread_invalid.rs | src/tools/miri/tests/fail-dep/concurrency/windows_thread_invalid.rs | //! Ensure we error if thread functions are called with invalid handles
//@only-target: windows # testing Windows API
use windows_sys::Win32::System::Threading::GetThreadId;
fn main() {
let _tid = unsafe { GetThreadId(std::ptr::dangling_mut()) };
//~^ ERROR: invalid handle
}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/concurrency/apple_os_unfair_lock_assert_owner.rs | src/tools/miri/tests/fail-dep/concurrency/apple_os_unfair_lock_assert_owner.rs | //@only-target: darwin
use std::cell::UnsafeCell;
fn main() {
let lock = UnsafeCell::new(libc::OS_UNFAIR_LOCK_INIT);
unsafe {
libc::os_unfair_lock_assert_owner(lock.get());
//~^ error: abnormal termination: called os_unfair_lock_assert_owner on an os_unfair_lock not owned by the current threa... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_mutex_destroy_locked.rs | src/tools/miri/tests/fail-dep/concurrency/libc_pthread_mutex_destroy_locked.rs | //@ignore-target: windows # No pthreads on Windows
fn main() {
unsafe {
let mut mutexattr: libc::pthread_mutexattr_t = std::mem::zeroed();
assert_eq!(
libc::pthread_mutexattr_settype(&mut mutexattr as *mut _, libc::PTHREAD_MUTEX_NORMAL),
0,
);
let mut mutex: ... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_cond_double_destroy.rs | src/tools/miri/tests/fail-dep/concurrency/libc_pthread_cond_double_destroy.rs | //@ignore-target: windows # No pthreads on Windows
//@ normalize-stderr-test: "(\n)ALLOC \(.*\) \{\n(.*\n)*\}(\n)" -> "${1}ALLOC DUMP${3}"
//@ normalize-stderr-test: "\[0x[0-9a-z]+..0x[0-9a-z]+\]" -> "[0xX..0xY]"
/// Test that destroying a pthread_cond twice fails, even without a check for number validity
fn main() {... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_mutex_move.rs | src/tools/miri/tests/fail-dep/concurrency/libc_pthread_mutex_move.rs | //@ignore-target: windows # No pthreads on Windows
//@revisions: static_initializer init
fn main() {
check();
}
#[cfg(init)]
fn check() {
unsafe {
let mut m: libc::pthread_mutex_t = std::mem::zeroed();
assert_eq!(libc::pthread_mutex_init(&mut m as *mut _, std::ptr::null()), 0);
let mu... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_rwlock_read_wrong_owner.rs | src/tools/miri/tests/fail-dep/concurrency/libc_pthread_rwlock_read_wrong_owner.rs | //@ignore-target: windows # No pthreads on Windows
use std::cell::UnsafeCell;
use std::sync::Arc;
use std::thread;
struct RwLock(UnsafeCell<libc::pthread_rwlock_t>);
unsafe impl Send for RwLock {}
unsafe impl Sync for RwLock {}
fn new_lock() -> Arc<RwLock> {
Arc::new(RwLock(UnsafeCell::new(libc::PTHREAD_RWLOCK_... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/concurrency/tls_pthread_dtor_wrong_abi.rs | src/tools/miri/tests/fail-dep/concurrency/tls_pthread_dtor_wrong_abi.rs | //@ignore-target: windows # No pthreads on Windows
use std::{mem, ptr};
pub type Key = libc::pthread_key_t;
pub unsafe fn create(dtor: unsafe fn(*mut u8)) -> Key {
let mut key = 0;
assert_eq!(libc::pthread_key_create(&mut key, mem::transmute(dtor)), 0);
//~^ERROR: calling a function with calling conventi... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_mutex_write_while_queued.rs | src/tools/miri/tests/fail-dep/concurrency/libc_pthread_mutex_write_while_queued.rs | //@ignore-target: windows # No pthreads on Windows
//@compile-flags: -Zmiri-deterministic-concurrency
use std::cell::UnsafeCell;
use std::sync::atomic::*;
use std::thread;
struct Mutex(UnsafeCell<libc::pthread_mutex_t>);
impl Mutex {
fn get(&self) -> *mut libc::pthread_mutex_t {
self.0.get()
}
}
unsa... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_rwlock_write_wrong_owner.rs | src/tools/miri/tests/fail-dep/concurrency/libc_pthread_rwlock_write_wrong_owner.rs | //@ignore-target: windows # No pthreads on Windows
use std::cell::UnsafeCell;
use std::sync::Arc;
use std::thread;
struct RwLock(UnsafeCell<libc::pthread_rwlock_t>);
unsafe impl Send for RwLock {}
unsafe impl Sync for RwLock {}
fn new_lock() -> Arc<RwLock> {
Arc::new(RwLock(UnsafeCell::new(libc::PTHREAD_RWLOCK_... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_mutex_staticinit_reentrant.rs | src/tools/miri/tests/fail-dep/concurrency/libc_pthread_mutex_staticinit_reentrant.rs | //@ignore-target: windows # No pthreads on Windows
//
// Check that if we use PTHREAD_MUTEX_INITIALIZER, then reentrant locking is UB.
// glibc apparently actually exploits this so we better catch it!
fn main() {
unsafe {
let mut mutex: libc::pthread_mutex_t = libc::PTHREAD_MUTEX_INITIALIZER;
asser... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/fail-dep/concurrency/apple_os_unfair_lock_move_deadlock.rs | src/tools/miri/tests/fail-dep/concurrency/apple_os_unfair_lock_move_deadlock.rs | //@only-target: darwin
use std::cell::UnsafeCell;
fn main() {
let lock = UnsafeCell::new(libc::OS_UNFAIR_LOCK_INIT);
unsafe { libc::os_unfair_lock_lock(lock.get()) };
let lock = lock;
// This needs to either error or deadlock.
unsafe { libc::os_unfair_lock_lock(lock.get()) };
//~^ error: lock... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/pass/align_repeat_into_packed_field.rs | src/tools/miri/tests/pass/align_repeat_into_packed_field.rs | #![feature(custom_mir, core_intrinsics)]
use std::intrinsics::mir::*;
#[repr(packed)]
struct S {
field: [u32; 2],
}
#[custom_mir(dialect = "runtime", phase = "optimized")]
fn test() {
mir! {
let s: S;
{
// Store a repeat expression directly into a field of a packed struct.
... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.