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/pass/concurrency/spin_loops_nopreempt.rs
src/tools/miri/tests/pass/concurrency/spin_loops_nopreempt.rs
// This specifically tests behavior *without* preemption. //@compile-flags: -Zmiri-deterministic-concurrency use std::cell::Cell; use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering}; use std::sync::mpsc; use std::thread; /// When a thread yields, Miri's scheduler used to pick the thread with the lowest 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/pass/concurrency/sync_nopreempt.rs
src/tools/miri/tests/pass/concurrency/sync_nopreempt.rs
// We are making scheduler assumptions here. //@compile-flags: -Zmiri-deterministic-concurrency use std::sync::{Arc, Condvar, Mutex, RwLock}; use std::thread; fn check_conditional_variables_notify_all() { let pair = Arc::new(((Mutex::new(())), Condvar::new())); // Spawn threads and block them on the conditio...
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/concurrency/disable_data_race_detector.rs
src/tools/miri/tests/pass/concurrency/disable_data_race_detector.rs
//@compile-flags: -Zmiri-disable-data-race-detector // Avoid non-determinism //@compile-flags: -Zmiri-deterministic-concurrency use std::thread::spawn; #[derive(Copy, Clone)] struct EvilSend<T>(pub T); unsafe impl<T> Send for EvilSend<T> {} unsafe impl<T> Sync for EvilSend<T> {} fn main() { let mut a = 0u32; ...
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/concurrency/thread_park_isolated.rs
src/tools/miri/tests/pass/concurrency/thread_park_isolated.rs
//@ignore-target: apple # park_timeout on macOS uses the system clock use std::thread; use std::time::{Duration, Instant}; fn main() { let start = Instant::now(); thread::park_timeout(Duration::from_millis(200)); // Thanks to deterministic execution, this will wait *exactly* 200ms, plus the time for the ...
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/intrinsics/portable-simd-ptrs.rs
src/tools/miri/tests/pass/intrinsics/portable-simd-ptrs.rs
// Separate test without strict provenance //@compile-flags: -Zmiri-permissive-provenance #![feature(portable_simd)] use std::ptr; use std::simd::prelude::*; fn main() { // Pointer casts let _val: Simd<*const u8, 4> = Simd::<*const i32, 4>::splat(ptr::null()).cast(); let addrs = Simd::<*const i32, 4>::spla...
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/intrinsics/type-id.rs
src/tools/miri/tests/pass/intrinsics/type-id.rs
use std::any::{Any, TypeId}; fn main() { let t1 = TypeId::of::<u64>(); let t2 = TypeId::of::<u64>(); assert_eq!(t1, t2); let t3 = TypeId::of::<usize>(); assert_ne!(t1, t3); let _ = format!("{t1:?}"); // test that we can debug-print let b = Box::new(0u64) as Box<dyn Any>; assert_eq!(*b...
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/intrinsics/integer.rs
src/tools/miri/tests/pass/intrinsics/integer.rs
// SPDX-License-Identifier: MIT OR Apache-2.0 // SPDX-FileCopyrightText: The Rust Project Developers (see https://thanks.rust-lang.org) #![feature(core_intrinsics, funnel_shifts)] use std::intrinsics::*; fn main() { unsafe { [assert_eq!(ctpop(0u8), 0), assert_eq!(ctpop(0i8), 0)]; [assert_eq!(ctpop...
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/intrinsics/simd-intrinsic-generic-elements.rs
src/tools/miri/tests/pass/intrinsics/simd-intrinsic-generic-elements.rs
#![feature(repr_simd)] #[repr(simd)] #[derive(Copy, Clone, Debug, PartialEq)] #[allow(non_camel_case_types)] struct i32x2([i32; 2]); #[repr(simd)] #[derive(Copy, Clone, Debug, PartialEq)] #[allow(non_camel_case_types)] struct i32x4([i32; 4]); #[repr(simd)] #[derive(Copy, Clone, Debug, PartialEq)] #[allow(non_camel_cas...
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/intrinsics/portable-simd.rs
src/tools/miri/tests/pass/intrinsics/portable-simd.rs
//@compile-flags: -Zmiri-strict-provenance #![feature( portable_simd, unsized_const_params, adt_const_params, rustc_attrs, intrinsics, core_intrinsics, repr_simd, f16, f128 )] #![allow(incomplete_features, internal_features, non_camel_case_types)] use std::fmt::{self, Debug, Formatte...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
true
rust-lang/rust
https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/miri/tests/pass/intrinsics/volatile.rs
src/tools/miri/tests/pass/intrinsics/volatile.rs
// related: #58645 #![feature(core_intrinsics)] use std::intrinsics::{volatile_load, volatile_store}; fn main() { unsafe { let i: &mut (isize, isize) = &mut (0, 0); volatile_store(i, (1, 2)); assert_eq!(volatile_load(i), (1, 2)); assert_eq!(i, &mut (1, 2)); } }
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/intrinsics/fmuladd_nondeterministic.rs
src/tools/miri/tests/pass/intrinsics/fmuladd_nondeterministic.rs
#![feature(core_intrinsics, portable_simd)] use std::intrinsics::simd::simd_relaxed_fma; use std::intrinsics::{fmuladdf32, fmuladdf64}; use std::simd::prelude::*; #[path = "../../utils/mod.rs"] mod utils; use utils::check_nondet; fn main() { check_nondet(|| { let a = std::hint::black_box(0.1_f64); ...
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/intrinsics/intrinsics.rs
src/tools/miri/tests/pass/intrinsics/intrinsics.rs
//@compile-flags: -Zmiri-permissive-provenance #![feature(core_intrinsics, layout_for_ptr, ptr_metadata)] //! Tests for various intrinsics that do not fit anywhere else. use std::intrinsics; use std::mem::{discriminant, size_of, size_of_val, size_of_val_raw}; struct Bomb; impl Drop for Bomb { fn drop(&mut self) ...
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/panic/std-panic-locations.rs
src/tools/miri/tests/pass/panic/std-panic-locations.rs
//! Test that panic locations for `#[track_caller]` functions in std have the correct //! location reported. use std::sync::atomic::{AtomicUsize, Ordering}; static HOOK_COUNT: AtomicUsize = AtomicUsize::new(0); fn main() { // inspect the `PanicInfo` we receive to ensure the right file is the source std::pani...
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/panic/nested_panic_caught.rs
src/tools/miri/tests/pass/panic/nested_panic_caught.rs
//@normalize-stderr-test: "\| +\^+" -> "| ^" //@normalize-stderr-test: "\n +[0-9]+:[^\n]+" -> "" //@normalize-stderr-test: "\n +at [^\n]+" -> "" // Checks that nested panics work correctly. use std::panic::catch_unwind; fn double() { struct Double; impl Drop for Double { fn drop(&mut self) { ...
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/panic/catch_panic.rs
src/tools/miri/tests/pass/panic/catch_panic.rs
#![feature(never_type)] #![allow(unconditional_panic, non_fmt_panics)] use std::cell::Cell; use std::panic::{AssertUnwindSafe, catch_unwind}; use std::process; thread_local! { static MY_COUNTER: Cell<usize> = Cell::new(0); static DROPPED: Cell<bool> = Cell::new(false); static HOOK_CALLED: Cell<bool> = Cel...
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/panic/concurrent-panic.rs
src/tools/miri/tests/pass/panic/concurrent-panic.rs
// We are making scheduler assumptions here. //@compile-flags: -Zmiri-deterministic-concurrency //! Cause a panic in one thread while another thread is unwinding. This checks //! that separate threads have their own panicking state. use std::sync::{Arc, Condvar, Mutex}; use std::thread::{JoinHandle, spawn}; struct B...
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/panic/unwind_dwarf.rs
src/tools/miri/tests/pass/panic/unwind_dwarf.rs
//@ignore-target: windows # Windows uses a different unwinding mechanism #![feature(core_intrinsics, panic_unwind, rustc_attrs)] #![allow(internal_features)] //! Unwinding using `_Unwind_RaiseException` extern crate unwind as uw; use std::any::Any; use std::ptr; #[repr(C)] struct Exception { _uwe: uw::_Unwind_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/pass/panic/thread_panic.rs
src/tools/miri/tests/pass/panic/thread_panic.rs
//! Panicking in other threads. use std::thread; fn panic() { let result = thread::spawn(|| panic!("Hello!")).join().unwrap_err(); let msg = result.downcast_ref::<&'static str>().unwrap(); assert_eq!(*msg, "Hello!"); } fn panic_named() { thread::Builder::new() .name("childthread".to_string())...
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/0weak_memory/consistency_sc.rs
src/tools/miri/tests/pass/0weak_memory/consistency_sc.rs
//@compile-flags: -Zmiri-ignore-leaks -Zmiri-disable-stacked-borrows -Zmiri-disable-validation // This test's runtime explodes if the GC interval is set to 1 (which we do in CI), so we // override it internally back to the default frequency. //@compile-flags: -Zmiri-provenance-gc=10000 // The following tests check whe...
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/0weak_memory/consistency.rs
src/tools/miri/tests/pass/0weak_memory/consistency.rs
//@compile-flags: -Zmiri-ignore-leaks -Zmiri-disable-stacked-borrows -Zmiri-disable-validation // This test's runtime explodes if the GC interval is set to 1 (which we do in CI), so we // override it internally back to the default frequency. //@compile-flags: -Zmiri-provenance-gc=10000 // The following tests check whe...
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/0weak_memory/weak.rs
src/tools/miri/tests/pass/0weak_memory/weak.rs
//@compile-flags: -Zmiri-ignore-leaks -Zmiri-fixed-schedule // This test's runtime explodes if the GC interval is set to 1 (which we do in CI), so we // override it internally back to the default frequency. //@compile-flags: -Zmiri-provenance-gc=10000 // Tests showing weak memory behaviours are exhibited, even with a ...
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/0weak_memory/extra_cpp.rs
src/tools/miri/tests/pass/0weak_memory/extra_cpp.rs
//@compile-flags: -Zmiri-ignore-leaks // Tests operations not performable through C++'s atomic API // but doable in safe (at least sound) Rust. #![feature(atomic_from_mut)] use std::sync::atomic::Ordering::*; use std::sync::atomic::{AtomicU16, AtomicU32}; use std::thread::spawn; fn static_atomic_mut(val: u32) -> &'...
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/tree_borrows/reserved.rs
src/tools/miri/tests/pass/tree_borrows/reserved.rs
// We disable the GC for this test because it would change what is printed. //@compile-flags: -Zmiri-tree-borrows -Zmiri-provenance-gc=0 #[path = "../../utils/mod.rs"] #[macro_use] mod utils; use std::cell::UnsafeCell; // We exhaustively check that Reserved behaves as we want under all of the // following conditions...
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/tree_borrows/read_retag_no_race.rs
src/tools/miri/tests/pass/tree_borrows/read_retag_no_race.rs
//@compile-flags: -Zmiri-tree-borrows // This test relies on a specific interleaving that cannot be enforced // with just barriers. We must remove preemption so that the execution and the // error messages are deterministic. //@compile-flags: -Zmiri-deterministic-concurrency use std::ptr::addr_of_mut; use std::sync::{A...
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/tree_borrows/reborrow-is-read.rs
src/tools/miri/tests/pass/tree_borrows/reborrow-is-read.rs
// We disable the GC for this test because it would change what is printed. //@compile-flags: -Zmiri-tree-borrows -Zmiri-provenance-gc=0 #[path = "../../utils/mod.rs"] #[macro_use] mod utils; // To check that a reborrow is counted as a Read access, we use a reborrow // with no additional Read to Freeze an Unique poin...
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/tree_borrows/end-of-protector.rs
src/tools/miri/tests/pass/tree_borrows/end-of-protector.rs
// We disable the GC for this test because it would change what is printed. //@compile-flags: -Zmiri-tree-borrows -Zmiri-provenance-gc=0 // Check that a protector goes back to normal behavior when the function // returns. #[path = "../../utils/mod.rs"] #[macro_use] mod utils; fn main() { unsafe { let data...
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/tree_borrows/cell-inside-box.rs
src/tools/miri/tests/pass/tree_borrows/cell-inside-box.rs
//@compile-flags: -Zmiri-tree-borrows #![feature(box_as_ptr)] #[path = "../../utils/mod.rs"] #[macro_use] mod utils; use std::cell::UnsafeCell; fn main() { let cell = UnsafeCell::new(42); let box1 = Box::new(cell); unsafe { let ptr1: *mut UnsafeCell<i32> = Box::into_raw(box1); name!(ptr1)...
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/tree_borrows/cell-alternate-writes.rs
src/tools/miri/tests/pass/tree_borrows/cell-alternate-writes.rs
// We disable the GC for this test because it would change what is printed. //@compile-flags: -Zmiri-tree-borrows -Zmiri-provenance-gc=0 #[path = "../../utils/mod.rs"] #[macro_use] mod utils; use std::cell::UnsafeCell; // UnsafeCells use the `Cell` state, so it is possible to use them with // few restrictions when on...
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/tree_borrows/cell-inside-struct.rs
src/tools/miri/tests/pass/tree_borrows/cell-inside-struct.rs
//! The same as `tests/fail/tree-borrows/cell-inside-struct` but with //! precise tracking of interior mutability disabled. //@compile-flags: -Zmiri-tree-borrows -Zmiri-tree-borrows-no-precise-interior-mut #[path = "../../utils/mod.rs"] #[macro_use] mod utils; use std::cell::Cell; struct Foo { field1: u32, fi...
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/tree_borrows/spurious_read.rs
src/tools/miri/tests/pass/tree_borrows/spurious_read.rs
// We ensure a deterministic execution. // Note that we are *also* using barriers: the barriers enforce the // specific interleaving of operations that we want, but only the preemption // rate guarantees that the error message is also deterministic. //@compile-flags: -Zmiri-deterministic-concurrency //@compile-flags: -...
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/tree_borrows/tree-borrows.rs
src/tools/miri/tests/pass/tree_borrows/tree-borrows.rs
//@compile-flags: -Zmiri-tree-borrows #![feature(allocator_api)] use std::{mem, ptr}; // Test various tree-borrows-specific things // (i.e., these do not work the same under SB). fn main() { aliasing_read_only_mutable_refs(); string_as_mut_ptr(); two_mut_protected_same_alloc(); direct_mut_to_const_raw...
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/tree_borrows/cell-lazy-write-to-surrounding.rs
src/tools/miri/tests/pass/tree_borrows/cell-lazy-write-to-surrounding.rs
//@compile-flags: -Zmiri-tree-borrows use std::cell::Cell; fn foo(x: &Cell<i32>) { unsafe { let ptr = x as *const Cell<i32> as *mut Cell<i32> as *mut i32; ptr.offset(1).write(0); } } fn main() { let arr = [Cell::new(1), Cell::new(1)]; foo(&arr[0]); let pair = (Cell::new(1), 1); ...
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/tree_borrows/transmute-unsafecell.rs
src/tools/miri/tests/pass/tree_borrows/transmute-unsafecell.rs
//@compile-flags: -Zmiri-tree-borrows //! Testing `mem::transmute` between types with and without interior mutability. //! All transmutations should work, as long as we don't do any actual accesses //! that violate immutability. use core::cell::UnsafeCell; use core::mem; fn main() { unsafe { ref_to_cell(...
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/tree_borrows/copy-nonoverlapping.rs
src/tools/miri/tests/pass/tree_borrows/copy-nonoverlapping.rs
//@compile-flags: -Zmiri-tree-borrows // copy_nonoverlapping works regardless of the order in which we construct // the arguments. fn main() { test_to_from(); test_from_to(); } fn test_to_from() { unsafe { let data = &mut [0u64, 1]; let to = data.as_mut_ptr().add(1); let from = dat...
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/tree_borrows/sb_fails.rs
src/tools/miri/tests/pass/tree_borrows/sb_fails.rs
//@compile-flags: -Zmiri-tree-borrows // These tests fail Stacked Borrows, but pass Tree Borrows. // The first four have in common that in SB a mutable reborrow is enough to produce // write access errors, but in TB an actual write is needed. // A modified version of each is also available that fails Tree Borrows. m...
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/tree_borrows/formatting.rs
src/tools/miri/tests/pass/tree_borrows/formatting.rs
// We disable the GC for this test because it would change what is printed. //@compile-flags: -Zmiri-tree-borrows -Zmiri-provenance-gc=0 #[path = "../../utils/mod.rs"] #[macro_use] mod utils; // Check the formatting of the trees. fn main() { unsafe { alignment_check(); structure_check(); } } ...
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/tree_borrows/wildcard/wildcard.rs
src/tools/miri/tests/pass/tree_borrows/wildcard/wildcard.rs
//@compile-flags: -Zmiri-tree-borrows -Zmiri-permissive-provenance pub fn main() { multiple_exposed_siblings(); multiple_exposed_child(); dealloc(); protector(); protector_conflicted_release(); returned_mut_is_usable(); } /// Checks that an access through a wildcard reference /// doesn't disab...
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/tree_borrows/wildcard/undetected_ub.rs
src/tools/miri/tests/pass/tree_borrows/wildcard/undetected_ub.rs
//@compile-flags: -Zmiri-tree-borrows -Zmiri-permissive-provenance // NOTE: This file documents UB that is not detected by wildcard provenance. pub fn main() { uncertain_provenance(); protected_exposed(); cross_tree_update_older_invalid_exposed(); } /// Currently, if we do not know for a tag if an access ...
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/tree_borrows/wildcard/reborrow.rs
src/tools/miri/tests/pass/tree_borrows/wildcard/reborrow.rs
//@compile-flags: -Zmiri-tree-borrows -Zmiri-permissive-provenance pub fn main() { multiple_exposed_siblings1(); multiple_exposed_siblings2(); reborrow3(); returned_mut_is_usable(); only_foreign_is_temporary(); } /// Checks that accessing through a reborrowed wildcard doesn't /// disable any expos...
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/tree_borrows/wildcard/formatting.rs
src/tools/miri/tests/pass/tree_borrows/wildcard/formatting.rs
// We disable the GC for this test because it would change what is printed. //@compile-flags: -Zmiri-tree-borrows -Zmiri-permissive-provenance -Zmiri-provenance-gc=0 #[path = "../../../utils/mod.rs"] #[macro_use] mod utils; fn main() { unsafe { let x = &0u8; name!(x); let xa = &*x; ...
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/backtrace/backtrace-std.rs
src/tools/miri/tests/pass/backtrace/backtrace-std.rs
//@compile-flags: -Zmiri-disable-isolation //@rustc-env: RUST_BACKTRACE=1 use std::backtrace::Backtrace; #[inline(never)] fn func_a() -> Backtrace { func_b::<u8>() } #[inline(never)] fn func_b<T>() -> Backtrace { func_c() } macro_rules! invoke_func_d { () => { func_d() }; } #[inline(never)] ...
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/backtrace/backtrace-global-alloc.rs
src/tools/miri/tests/pass/backtrace/backtrace-global-alloc.rs
//@compile-flags: -Zmiri-disable-isolation //@rustc-env: RUST_BACKTRACE=1 use std::alloc::System; use std::backtrace::Backtrace; #[global_allocator] static GLOBAL_ALLOCATOR: System = System; fn main() { eprint!("{}", Backtrace::capture()); }
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/backtrace/backtrace-api-v1.rs
src/tools/miri/tests/pass/backtrace/backtrace-api-v1.rs
//@normalize-stderr-test: "::<.*>" -> "" #[inline(never)] fn func_a() -> Box<[*mut ()]> { func_b::<u8>() } #[inline(never)] fn func_b<T>() -> Box<[*mut ()]> { func_c() } macro_rules! invoke_func_d { () => { func_d() }; } #[inline(never)] fn func_c() -> Box<[*mut ()]> { invoke_func_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/panic/overflowing-rsh-2.rs
src/tools/miri/tests/panic/overflowing-rsh-2.rs
#![allow(arithmetic_overflow)] fn main() { // Make sure we catch overflows that would be hidden by first casting the RHS to u32 let _n = 1i64 >> (u32::MAX as i64 + 1); }
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/panic/overflowing-rsh-1.rs
src/tools/miri/tests/panic/overflowing-rsh-1.rs
#![allow(arithmetic_overflow)] fn main() { let _n = 1i64 >> 64; }
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/panic/mir-validation.rs
src/tools/miri/tests/panic/mir-validation.rs
//! Ensure that the MIR validator runs on Miri's input. //@rustc-env:RUSTC_ICE=0 //@normalize-stderr-test: "\n +[0-9]+:.+" -> "" //@normalize-stderr-test: "\n +at .+" -> "" //@normalize-stderr-test: "\n +\[\.\.\. omitted [0-9]+ frames? \.\.\.\].*" -> "" //@normalize-stderr-test: "\n[ =]*note:.*" -> "" //@normalize-stde...
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/panic/panic2.rs
src/tools/miri/tests/panic/panic2.rs
fn main() { std::panic!("{}-panicking from libstd", 42); }
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/panic/alloc_error_handler_hook.rs
src/tools/miri/tests/panic/alloc_error_handler_hook.rs
#![feature(allocator_api, alloc_error_hook)] use std::alloc::*; struct Bomb; impl Drop for Bomb { fn drop(&mut self) { eprintln!("yes we are unwinding!"); } } #[allow(unreachable_code, unused_variables)] fn main() { // This is a particularly tricky hook, since it unwinds, which the default one do...
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/panic/panic3.rs
src/tools/miri/tests/panic/panic3.rs
fn main() { core::panic!("panicking from libcore"); }
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/panic/transmute_fat2.rs
src/tools/miri/tests/panic/transmute_fat2.rs
#![allow(integer_to_ptr_transmutes)] fn main() { #[cfg(all(target_endian = "little", target_pointer_width = "64"))] let bad = unsafe { std::mem::transmute::<u128, &[u8]>(42) }; #[cfg(all(target_endian = "big", target_pointer_width = "64"))] let bad = unsafe { std::mem::transmute::<u128, &[u8]>(42 << 64...
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/panic/panic4.rs
src/tools/miri/tests/panic/panic4.rs
fn main() { core::panic!("{}-panicking from libcore", 42); }
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/panic/oob_subslice.rs
src/tools/miri/tests/panic/oob_subslice.rs
// This once failed with "unwinding past a stack frame that does not allow unwinding", // fixed by https://github.com/rust-lang/rust/issues/110233. fn main() { let x = [1, 2, 3, 4]; let _val = &x[..=4]; }
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/panic/overflowing-lsh-neg.rs
src/tools/miri/tests/panic/overflowing-lsh-neg.rs
#![allow(arithmetic_overflow)] fn main() { let _n = 2i64 << -1; }
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/panic/panic1.rs
src/tools/miri/tests/panic/panic1.rs
//@rustc-env: RUST_BACKTRACE=1 //@compile-flags: -Zmiri-disable-isolation fn main() { std::panic!("panicking from libstd"); }
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/panic/div-by-zero-2.rs
src/tools/miri/tests/panic/div-by-zero-2.rs
#![allow(unconditional_panic)] fn main() { let _n = 1 / 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/panic/function_calls/exported_symbol_good_unwind.rs
src/tools/miri/tests/panic/function_calls/exported_symbol_good_unwind.rs
// Make sure the workaround for "crate ... required to be available in rlib format, but was not // found in this form" errors works without `-C prefer-dynamic` (`panic!` calls foreign function // `__rust_start_panic`). // no-prefer-dynamic #![feature(unboxed_closures)] use std::panic; #[no_mangle] extern "C-unwind" f...
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/utils/mod.no_std.rs
src/tools/miri/tests/utils/mod.no_std.rs
#![allow(dead_code)] #![allow(unused_imports)] #[macro_use] mod macros; mod io; mod miri_extern; pub use self::io::*; pub use self::miri_extern::*;
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/utils/miri_extern.rs
src/tools/miri/tests/utils/miri_extern.rs
#[repr(C)] /// Layout of the return value of `miri_resolve_frame`, /// with fields in the exact same order. pub struct MiriFrame { // The size of the name of the function being executed, encoded in UTF-8 pub name_len: usize, // The size of filename of the function being executed, encoded in UTF-8 pub fi...
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/utils/io.rs
src/tools/miri/tests/utils/io.rs
use core::fmt::{self, Write}; use super::miri_extern; pub struct MiriStderr; impl Write for MiriStderr { fn write_str(&mut self, s: &str) -> fmt::Result { unsafe { miri_extern::miri_write_to_stderr(s.as_bytes()); } Ok(()) } } pub struct MiriStdout; impl Write for MiriStd...
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/utils/genmc.rs
src/tools/miri/tests/utils/genmc.rs
#![allow(unused)] use std::ffi::c_void; use libc::{self, pthread_attr_t, pthread_t}; /// Spawn a thread using `pthread_create`, abort the process on any errors. pub unsafe fn spawn_pthread( f: extern "C" fn(*mut c_void) -> *mut c_void, value: *mut c_void, ) -> pthread_t { let mut thread_id: pthread_t = 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/utils/fs.rs
src/tools/miri/tests/utils/fs.rs
use std::ffi::OsString; use std::path::PathBuf; use std::{fs, io}; use super::miri_extern; pub fn host_to_target_path(path: OsString) -> PathBuf { use std::ffi::{CStr, CString}; // Once into_encoded_bytes is stable we can use it here. // (Unstable features would need feature flags in each test...) le...
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/utils/libc.rs
src/tools/miri/tests/utils/libc.rs
//! Utils that need libc. #![allow(dead_code)] use std::{fmt, io}; /// Handles the usual libc function that returns `-1` to indicate an error. #[track_caller] pub fn errno_result<T: From<i8> + Ord>(ret: T) -> io::Result<T> { use std::cmp::Ordering; match ret.cmp(&(-1i8).into()) { Ordering::Equal => Er...
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/utils/macros.rs
src/tools/miri/tests/utils/macros.rs
#![allow(unused_macros)] #![allow(unused_macro_rules)] #![allow(unused_imports)] /// `alloc_id!(ptr)`: obtain the allocation id from a pointer. /// /// `ptr` should be any pointer or reference that can be converted with `_ as *const u8`. /// /// The id obtained can be passed directly to `print_state!`. macro_rules! al...
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/utils/mod.rs
src/tools/miri/tests/utils/mod.rs
#![allow(dead_code)] #![allow(unused_imports)] #[macro_use] mod macros; mod fs; mod io; mod miri_extern; pub use self::fs::*; pub use self::io::*; pub use self::miri_extern::*; pub fn run_provenance_gc() { // SAFETY: No preconditions. The GC is fine to run at any time. unsafe { miri_run_provenance_gc() } } ...
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/deps/src/main.rs
src/tools/miri/tests/deps/src/main.rs
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/pass-dep/regions-mock-trans.rs
src/tools/miri/tests/pass-dep/regions-mock-trans.rs
use std::mem; struct Arena(()); struct Bcx<'a> { fcx: &'a Fcx<'a>, } #[allow(dead_code)] struct Fcx<'a> { arena: &'a Arena, ccx: &'a Ccx, } #[allow(dead_code)] struct Ccx { x: isize, } fn alloc<'a>(_bcx: &'a Arena) -> &'a mut Bcx<'a> { unsafe { mem::transmute(libc::malloc(mem::size_of::<Bcx<'a>...
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-dep/extra_fn_ptr_gc.rs
src/tools/miri/tests/pass-dep/extra_fn_ptr_gc.rs
//@ignore-target: windows # No `dlsym` on Windows //@compile-flags: -Zmiri-permissive-provenance #[path = "../utils/mod.rs"] mod utils; type GetEntropyFn = unsafe extern "C" fn(*mut u8, libc::size_t) -> libc::c_int; fn main() { let name = "getentropy\0"; let addr = unsafe { libc::dlsym(libc::RTLD_DEFAULT, na...
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-dep/page_size.rs
src/tools/miri/tests/pass-dep/page_size.rs
fn main() { let page_size = page_size::get(); // In particular, this checks that it is not 0. assert!(page_size.is_power_of_two(), "page size not a power of two: {}", page_size); // Most architectures have 4k pages by default #[cfg(not(any( target_arch = "wasm32", target_arch = "was...
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-dep/getrandom.rs
src/tools/miri/tests/pass-dep/getrandom.rs
// mac-os `getrandom_01` does some pointer shenanigans //@compile-flags: -Zmiri-permissive-provenance //@revisions: isolation no_isolation //@[no_isolation]compile-flags: -Zmiri-disable-isolation /// Test direct calls of getrandom 0.1, 0.2 and 0.3. fn main() { let mut data = vec![0; 16]; // Old Solaris had a ...
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-dep/foreign-fn-linkname.rs
src/tools/miri/tests/pass-dep/foreign-fn-linkname.rs
use std::ffi::CString; mod mlibc { use libc::{c_char, size_t}; extern "C" { #[link_name = "strlen"] pub fn my_strlen(str: *const c_char) -> size_t; } } fn strlen(str: String) -> usize { // C string is terminated with a zero let s = CString::new(str).unwrap(); unsafe { mlibc::my...
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-dep/page_size_override.rs
src/tools/miri/tests/pass-dep/page_size_override.rs
//@compile-flags: -Zmiri-force-page-size=8 fn main() { let page_size = page_size::get(); assert!(page_size == 8 * 1024, "8k page size override not respected: {}", page_size); }
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-dep/wcslen.rs
src/tools/miri/tests/pass-dep/wcslen.rs
fn to_c_wchar_t_str(s: &str) -> Vec<libc::wchar_t> { let mut r = Vec::<libc::wchar_t>::new(); for c in s.bytes() { if c == 0 { panic!("can't contain a null character"); } if c >= 128 { panic!("only ASCII supported"); } r.push(c.into()); } 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/pass-dep/tempfile.rs
src/tools/miri/tests/pass-dep/tempfile.rs
//@ignore-target: windows # File handling is not implemented yet //@ignore-host: windows # Only supported for UNIX hosts //@compile-flags: -Zmiri-disable-isolation #[path = "../utils/mod.rs"] mod utils; /// Test that the [`tempfile`] crate is compatible with miri for UNIX hosts and targets fn main() { test_tempfi...
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-dep/num_cpus.rs
src/tools/miri/tests/pass-dep/num_cpus.rs
//@compile-flags: -Zmiri-disable-isolation fn main() { assert_eq!(num_cpus::get(), 1); }
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-dep/libc/libc-env.rs
src/tools/miri/tests/pass-dep/libc/libc-env.rs
//@ignore-target: windows # No libc //@compile-flags: -Zmiri-disable-isolation use std::ffi::CStr; fn test_getenv() { let s = unsafe { libc::getenv(c"MIRI_ENV_VAR_TEST".as_ptr()) }; assert!(!s.is_null()); let value = unsafe { CStr::from_ptr(s).to_str().unwrap() }; assert_eq!(value, "0"); // Get a...
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-dep/libc/mmap.rs
src/tools/miri/tests/pass-dep/libc/mmap.rs
//@ignore-target: windows # No mmap on Windows //@compile-flags: -Zmiri-disable-isolation -Zmiri-permissive-provenance use std::io::Error; use std::{ptr, slice}; fn test_mmap<Offset: Default>( mmap: unsafe extern "C" fn( *mut libc::c_void, libc::size_t, libc::c_int, libc::c_int, ...
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-dep/libc/libc-strerror_r.rs
src/tools/miri/tests/pass-dep/libc/libc-strerror_r.rs
//@ignore-target: windows # Supported only on unixes fn main() { unsafe { let mut buf = vec![0u8; 32]; assert_eq!(libc::strerror_r(libc::EPERM, buf.as_mut_ptr().cast(), buf.len()), 0); let mut buf2 = vec![0u8; 64]; assert_eq!(libc::strerror_r(-1i32, buf2.as_mut_ptr().cast(), buf2.le...
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-dep/libc/libc-pipe.rs
src/tools/miri/tests/pass-dep/libc/libc-pipe.rs
//@ignore-target: windows # No libc pipe on Windows // test_race depends on a deterministic schedule. //@compile-flags: -Zmiri-deterministic-concurrency use std::thread; #[path = "../../utils/libc.rs"] mod libc_utils; fn main() { test_pipe(); test_pipe_threaded(); test_race(); test_pipe_array(); #...
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-dep/libc/libc_pthread_cond_timedwait_isolated.rs
src/tools/miri/tests/pass-dep/libc/libc_pthread_cond_timedwait_isolated.rs
//@ignore-target: windows # No pthreads on Windows //@ignore-target: apple # pthread_condattr_setclock is not supported on MacOS. /// Test that conditional variable timeouts are working properly /// with monotonic clocks even under isolation. use std::mem::MaybeUninit; use std::time::Instant; fn test_timed_wait_timeo...
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-dep/libc/libc_pthread_cond_timedwait.rs
src/tools/miri/tests/pass-dep/libc/libc_pthread_cond_timedwait.rs
//@ignore-target: windows # No pthreads on Windows //@ignore-target: apple # pthread_condattr_setclock is not supported on MacOS. //@compile-flags: -Zmiri-disable-isolation /// Test that conditional variable timeouts are working properly with both /// monotonic and system clocks. use std::mem::MaybeUninit; use std::ti...
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-dep/libc/pthread-sync.rs
src/tools/miri/tests/pass-dep/libc/pthread-sync.rs
//@ignore-target: windows # No pthreads on Windows // We use `yield` to test specific interleavings, so disable automatic preemption. //@compile-flags: -Zmiri-deterministic-concurrency #![feature(sync_unsafe_cell)] use std::cell::SyncUnsafeCell; use std::mem::MaybeUninit; use std::{mem, ptr, 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/pass-dep/libc/libc-fs-symlink.rs
src/tools/miri/tests/pass-dep/libc/libc-fs-symlink.rs
// Symlink tests are separate since they don't in general work on a Windows host. //@ignore-host: windows # creating symlinks requires admin permissions on Windows //@ignore-target: windows # File handling is not implemented yet //@compile-flags: -Zmiri-disable-isolation use std::ffi::CString; use std::io::{Error, Err...
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-dep/libc/gettid.rs
src/tools/miri/tests/pass-dep/libc/gettid.rs
//@only-target: linux //@revisions: with_isolation without_isolation //@[without_isolation] compile-flags: -Zmiri-disable-isolation use std::thread; use libc::{getpid, gettid}; fn main() { thread::spawn(|| { // Test that in isolation mode a deterministic value will be returned. // The value 1001 ...
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-dep/libc/libc-mem.rs
src/tools/miri/tests/pass-dep/libc/libc-mem.rs
#![feature(pointer_is_aligned_to)] use std::{mem, ptr, slice}; #[path = "../../utils/mod.rs"] mod utils; use utils::check_nondet; fn test_memcpy() { unsafe { let src = [1i8, 2, 3]; let dest = libc::calloc(3, 1); libc::memcpy(dest, src.as_ptr() as *const libc::c_void, 3); let slc = ...
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-dep/libc/libc-sysconf.rs
src/tools/miri/tests/pass-dep/libc/libc-sysconf.rs
//@ignore-target: windows # Supported only on unixes fn test_sysconfbasic() { unsafe { let ncpus = libc::sysconf(libc::_SC_NPROCESSORS_CONF); assert!(ncpus >= 1); let psz = libc::sysconf(libc::_SC_PAGESIZE); assert!(psz % 4096 == 0); // note that in reality it can return -1 ...
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-dep/libc/ccrandomgeneratebytes_apple.rs
src/tools/miri/tests/pass-dep/libc/ccrandomgeneratebytes_apple.rs
//@only-target: apple # This directly tests apple-only functions fn main() { let mut bytes = [0u8; 24]; let ret = unsafe { libc::CCRandomGenerateBytes(bytes.as_mut_ptr().cast(), bytes.len()) }; assert_eq!(ret, libc::kCCSuccess); }
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-dep/libc/libc-random.rs
src/tools/miri/tests/pass-dep/libc/libc-random.rs
//@ignore-target: windows # no libc //@revisions: isolation no_isolation //@[no_isolation]compile-flags: -Zmiri-disable-isolation fn main() { test_getentropy(); #[cfg(not(target_os = "macos"))] test_getrandom(); #[cfg(any(target_os = "freebsd", target_os = "illumos", target_os = "solaris"))] test_a...
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-dep/libc/libc-fs.rs
src/tools/miri/tests/pass-dep/libc/libc-fs.rs
//@ignore-target: windows # File handling is not implemented yet //@compile-flags: -Zmiri-disable-isolation #![feature(io_error_more)] #![feature(io_error_uncategorized)] use std::ffi::{CStr, CString, OsString}; use std::fs::{File, canonicalize, remove_file}; use std::io::{Error, ErrorKind, Write}; use std::os::unix:...
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-dep/libc/pthread_cond_timedwait_relative_np_apple.rs
src/tools/miri/tests/pass-dep/libc/pthread_cond_timedwait_relative_np_apple.rs
//@only-target: apple # `pthread_cond_timedwait_relative_np` is a non-standard extension use std::time::Instant; // FIXME: remove once this is in libc. mod libc { pub use ::libc::*; unsafe extern "C" { pub unsafe fn pthread_cond_timedwait_relative_np( cond: *mut libc::pthread_cond_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/pass-dep/libc/libc-time.rs
src/tools/miri/tests/pass-dep/libc/libc-time.rs
//@ignore-target: windows # no libc time APIs on Windows //@compile-flags: -Zmiri-disable-isolation use std::time::{Duration, Instant}; use std::{env, mem, ptr}; fn main() { test_clocks(); test_posix_gettimeofday(); test_localtime_r_gmt(); test_localtime_r_pst(); test_localtime_r_epoch(); #[cfg...
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-dep/libc/libc-misc.rs
src/tools/miri/tests/pass-dep/libc/libc-misc.rs
//@ignore-target: windows # only very limited libc on Windows //@compile-flags: -Zmiri-disable-isolation #![feature(io_error_more)] #![feature(pointer_is_aligned_to)] use std::mem::transmute; /// Tests whether each thread has its own `__errno_location`. fn test_thread_local_errno() { #[cfg(any(target_os = "illumo...
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-dep/libc/pthread-threadname.rs
src/tools/miri/tests/pass-dep/libc/pthread-threadname.rs
//@ignore-target: windows # No pthreads on Windows //@ignore-target: android # No pthread_{get,set}_name on Android use std::ffi::{CStr, CString}; use std::thread; const MAX_THREAD_NAME_LEN: usize = { cfg_if::cfg_if! { if #[cfg(any(target_os = "linux"))] { 16 } else if #[cfg(any(target_...
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-dep/libc/libc-affinity.rs
src/tools/miri/tests/pass-dep/libc/libc-affinity.rs
//@only-target: linux # these are Linux-specific APIs //@compile-flags: -Zmiri-disable-isolation -Zmiri-num-cpus=4 #![feature(io_error_more)] #![feature(pointer_is_aligned_to)] use std::mem::{size_of, size_of_val}; use libc::{cpu_set_t, sched_getaffinity, sched_setaffinity}; // If pid is zero, then the calling 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/pass-dep/libc/prctl-threadname.rs
src/tools/miri/tests/pass-dep/libc/prctl-threadname.rs
//@only-target: android # Miri supports prctl for Android only use std::ffi::{CStr, CString}; use std::thread; // The Linux kernel all names 16 bytes long including the null terminator. const MAX_THREAD_NAME_LEN: usize = 16; fn main() { // The short name should be shorter than 16 bytes which POSIX promises /...
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-dep/libc/fcntl_f-fullfsync_apple.rs
src/tools/miri/tests/pass-dep/libc/fcntl_f-fullfsync_apple.rs
//@only-target: apple # F_FULLFSYNC only on apple systems //@compile-flags: -Zmiri-isolation-error=warn-nobacktrace use std::io::Error; fn main() { // test `fcntl(F_FULLFSYNC)` unsafe { assert_eq!(libc::fcntl(1, libc::F_FULLFSYNC, 0), -1); assert_eq!(Error::last_os_error().raw_os_error(), Some...
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-dep/libc/libc-epoll-blocking.rs
src/tools/miri/tests/pass-dep/libc/libc-epoll-blocking.rs
//@only-target: linux android illumos // test_epoll_block_then_unblock and test_epoll_race depend on a deterministic schedule. //@compile-flags: -Zmiri-deterministic-concurrency use std::convert::TryInto; use std::thread; #[path = "../../utils/libc.rs"] mod libc_utils; // This is a set of testcases for blocking epol...
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-dep/libc/libc-fs-flock.rs
src/tools/miri/tests/pass-dep/libc/libc-fs-flock.rs
//@ignore-target: windows # File handling is not implemented yet //@ignore-target: solaris # Does not have flock //@compile-flags: -Zmiri-disable-isolation use std::fs::File; use std::os::fd::AsRawFd; #[path = "../../utils/libc.rs"] mod libc_utils; #[path = "../../utils/mod.rs"] mod utils; use libc_utils::*; 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/pass-dep/libc/libc-socketpair.rs
src/tools/miri/tests/pass-dep/libc/libc-socketpair.rs
//@ignore-target: windows # No libc socketpair on Windows // test_race depends on a deterministic schedule. //@compile-flags: -Zmiri-deterministic-concurrency // FIXME(static_mut_refs): Do not allow `static_mut_refs` lint #![allow(static_mut_refs)] use std::thread; #[path = "../../utils/libc.rs"] mod libc_utils; 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/pass-dep/libc/libc-fs-with-isolation.rs
src/tools/miri/tests/pass-dep/libc/libc-fs-with-isolation.rs
//@ignore-target: windows # File handling is not implemented yet //@compile-flags: -Zmiri-isolation-error=warn-nobacktrace //@normalize-stderr-test: "(stat(x)?)" -> "$$STAT" use std::fs; use std::io::{Error, ErrorKind}; fn main() { // test `fcntl(F_DUPFD): should work even with isolation.` unsafe { as...
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-dep/libc/libc-eventfd.rs
src/tools/miri/tests/pass-dep/libc/libc-eventfd.rs
//@only-target: linux android illumos // test_race, test_blocking_read and test_blocking_write depend on a deterministic schedule. //@compile-flags: -Zmiri-deterministic-concurrency // FIXME(static_mut_refs): Do not allow `static_mut_refs` lint #![allow(static_mut_refs)] use std::thread; fn main() { test_read_wr...
rust
Apache-2.0
f8b1d59a81c700cb7aa25cf69e3032b3ce333150
2026-01-04T15:31:58.503980Z
false