Auto merge of #3927 - RalfJung:fmt-imports, r=oli-obk,saethlin
let rustfmt format imports This matches the recent change in rustc. `@rust-lang/miri` what do you think?
This commit is contained in:
commit
e239d0794c
@ -1,8 +1,9 @@
|
||||
//! Extracted from the backtrace crate's test test_frame_conversion
|
||||
|
||||
use backtrace::{Backtrace, BacktraceFrame};
|
||||
use std::fmt::Write;
|
||||
|
||||
use backtrace::{Backtrace, BacktraceFrame};
|
||||
|
||||
fn main() {
|
||||
let mut frames = vec![];
|
||||
backtrace::trace(|frame| {
|
||||
|
File diff suppressed because one or more lines are too long
@ -8,7 +8,8 @@
|
||||
|
||||
use rustc_version::VersionMeta;
|
||||
|
||||
use crate::{setup::*, util::*};
|
||||
use crate::setup::*;
|
||||
use crate::util::*;
|
||||
|
||||
const CARGO_MIRI_HELP: &str = r"Runs binary crates and tests in Miri
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
use std::env;
|
||||
use std::iter;
|
||||
use std::{env, iter};
|
||||
|
||||
use anyhow::{Result, bail};
|
||||
|
||||
|
@ -1,12 +1,9 @@
|
||||
use std::env;
|
||||
use std::ffi::{OsStr, OsString};
|
||||
use std::io::Write;
|
||||
use std::net;
|
||||
use std::ops::Not;
|
||||
use std::ops::Range;
|
||||
use std::ops::{Not, Range};
|
||||
use std::path::PathBuf;
|
||||
use std::process;
|
||||
use std::time::Duration;
|
||||
use std::{env, net, process};
|
||||
|
||||
use anyhow::{Context, Result, anyhow, bail};
|
||||
use path_macro::path;
|
||||
|
@ -1,5 +1,10 @@
|
||||
# This matches rustc
|
||||
style_edition = "2024"
|
||||
use_small_heuristics = "Max"
|
||||
group_imports = "StdExternalCrate"
|
||||
imports_granularity = "Module"
|
||||
|
||||
# Miri-specific settings
|
||||
force_multiline_blocks = true
|
||||
match_arm_blocks = false
|
||||
match_arm_leading_pipes = "Preserve"
|
||||
force_multiline_blocks = true
|
||||
|
@ -7,14 +7,13 @@
|
||||
use std::cmp::max;
|
||||
|
||||
use rand::Rng;
|
||||
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
use rustc_span::Span;
|
||||
use rustc_target::abi::{Align, Size};
|
||||
|
||||
use crate::{concurrency::VClock, *};
|
||||
|
||||
use self::reuse_pool::ReusePool;
|
||||
use crate::concurrency::VClock;
|
||||
use crate::*;
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
||||
pub enum ProvenanceMode {
|
||||
|
@ -1,10 +1,10 @@
|
||||
//! Manages a pool of addresses that can be reused.
|
||||
|
||||
use rand::Rng;
|
||||
|
||||
use rustc_target::abi::{Align, Size};
|
||||
|
||||
use crate::{MemoryKind, MiriConfig, ThreadId, concurrency::VClock};
|
||||
use crate::concurrency::VClock;
|
||||
use crate::{MemoryKind, MiriConfig, ThreadId};
|
||||
|
||||
const MAX_POOL_SIZE: usize = 64;
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
use std::alloc;
|
||||
use std::alloc::Layout;
|
||||
use std::borrow::Cow;
|
||||
use std::slice;
|
||||
use std::{alloc, slice};
|
||||
|
||||
use rustc_middle::mir::interpret::AllocBytes;
|
||||
use rustc_target::abi::{Align, Size};
|
||||
|
@ -28,31 +28,27 @@
|
||||
use std::path::PathBuf;
|
||||
use std::str::FromStr;
|
||||
|
||||
use tracing::debug;
|
||||
|
||||
use miri::{BacktraceStyle, BorrowTrackerMethod, ProvenanceMode, RetagFields, ValidationMode};
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
use rustc_driver::Compilation;
|
||||
use rustc_hir::def_id::LOCAL_CRATE;
|
||||
use rustc_hir::{self as hir, Node};
|
||||
use rustc_hir_analysis::check::check_function_signature;
|
||||
use rustc_interface::interface::Config;
|
||||
use rustc_middle::{
|
||||
middle::{
|
||||
codegen_fn_attrs::CodegenFnAttrFlags,
|
||||
exported_symbols::{ExportedSymbol, SymbolExportInfo, SymbolExportKind, SymbolExportLevel},
|
||||
},
|
||||
query::LocalCrate,
|
||||
traits::{ObligationCause, ObligationCauseCode},
|
||||
ty::{self, Ty, TyCtxt},
|
||||
util::Providers,
|
||||
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
|
||||
use rustc_middle::middle::exported_symbols::{
|
||||
ExportedSymbol, SymbolExportInfo, SymbolExportKind, SymbolExportLevel,
|
||||
};
|
||||
use rustc_middle::query::LocalCrate;
|
||||
use rustc_middle::traits::{ObligationCause, ObligationCauseCode};
|
||||
use rustc_middle::ty::{self, Ty, TyCtxt};
|
||||
use rustc_middle::util::Providers;
|
||||
use rustc_session::config::{CrateType, EntryFnType, ErrorOutputType, OptLevel};
|
||||
use rustc_session::search_paths::PathKind;
|
||||
use rustc_session::{CtfeBacktrace, EarlyDiagCtxt};
|
||||
use rustc_span::def_id::DefId;
|
||||
use rustc_target::spec::abi::Abi;
|
||||
|
||||
use miri::{BacktraceStyle, BorrowTrackerMethod, ProvenanceMode, RetagFields, ValidationMode};
|
||||
use tracing::debug;
|
||||
|
||||
struct MiriCompilerCalls {
|
||||
miri_config: miri::MiriConfig,
|
||||
|
@ -2,11 +2,10 @@
|
||||
use std::fmt;
|
||||
use std::num::NonZero;
|
||||
|
||||
use smallvec::SmallVec;
|
||||
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
use rustc_middle::mir::RetagKind;
|
||||
use rustc_target::abi::Size;
|
||||
use smallvec::SmallVec;
|
||||
|
||||
use crate::*;
|
||||
pub mod stacked_borrows;
|
||||
|
@ -1,9 +1,9 @@
|
||||
use smallvec::SmallVec;
|
||||
use std::fmt;
|
||||
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_span::{Span, SpanData};
|
||||
use rustc_target::abi::Size;
|
||||
use smallvec::SmallVec;
|
||||
|
||||
use crate::borrow_tracker::{GlobalStateInner, ProtectorKind};
|
||||
use crate::*;
|
||||
|
@ -6,25 +6,24 @@
|
||||
mod stack;
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::cmp;
|
||||
use std::fmt::Write;
|
||||
use std::mem;
|
||||
use std::{cmp, mem};
|
||||
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_middle::mir::{Mutability, RetagKind};
|
||||
use rustc_middle::ty::{self, Ty, layout::HasParamEnv};
|
||||
use rustc_middle::ty::layout::HasParamEnv;
|
||||
use rustc_middle::ty::{self, Ty};
|
||||
use rustc_target::abi::{Abi, Size};
|
||||
|
||||
use crate::borrow_tracker::{
|
||||
GlobalStateInner, ProtectorKind,
|
||||
stacked_borrows::diagnostics::{AllocHistory, DiagnosticCx, DiagnosticCxBuilder},
|
||||
};
|
||||
use crate::concurrency::data_race::{NaReadType, NaWriteType};
|
||||
use crate::*;
|
||||
|
||||
use self::diagnostics::{RetagCause, RetagInfo};
|
||||
pub use self::item::{Item, Permission};
|
||||
pub use self::stack::Stack;
|
||||
use crate::borrow_tracker::stacked_borrows::diagnostics::{
|
||||
AllocHistory, DiagnosticCx, DiagnosticCxBuilder,
|
||||
};
|
||||
use crate::borrow_tracker::{GlobalStateInner, ProtectorKind};
|
||||
use crate::concurrency::data_race::{NaReadType, NaWriteType};
|
||||
use crate::*;
|
||||
|
||||
pub type AllocState = Stacks;
|
||||
|
||||
|
@ -5,10 +5,8 @@
|
||||
use tracing::trace;
|
||||
|
||||
use crate::ProvenanceExtra;
|
||||
use crate::borrow_tracker::{
|
||||
AccessKind, BorTag,
|
||||
stacked_borrows::{Item, Permission},
|
||||
};
|
||||
use crate::borrow_tracker::stacked_borrows::{Item, Permission};
|
||||
use crate::borrow_tracker::{AccessKind, BorTag};
|
||||
|
||||
/// Exactly what cache size we should use is a difficult trade-off. There will always be some
|
||||
/// workload which has a `BorTag` working set which exceeds the size of the cache, and ends up
|
||||
|
@ -5,11 +5,9 @@
|
||||
use rustc_span::{Span, SpanData};
|
||||
|
||||
use crate::borrow_tracker::ProtectorKind;
|
||||
use crate::borrow_tracker::tree_borrows::{
|
||||
perms::{PermTransition, Permission},
|
||||
tree::LocationState,
|
||||
unimap::UniIndex,
|
||||
};
|
||||
use crate::borrow_tracker::tree_borrows::perms::{PermTransition, Permission};
|
||||
use crate::borrow_tracker::tree_borrows::tree::LocationState;
|
||||
use crate::borrow_tracker::tree_borrows::unimap::UniIndex;
|
||||
use crate::*;
|
||||
|
||||
/// Cause of an access: either a real access or one
|
||||
|
@ -1,15 +1,12 @@
|
||||
use rustc_middle::{
|
||||
mir::{Mutability, RetagKind},
|
||||
ty::{self, Ty, layout::HasParamEnv},
|
||||
};
|
||||
use rustc_middle::mir::{Mutability, RetagKind};
|
||||
use rustc_middle::ty::layout::HasParamEnv;
|
||||
use rustc_middle::ty::{self, Ty};
|
||||
use rustc_span::def_id::DefId;
|
||||
use rustc_target::abi::{Abi, Size};
|
||||
|
||||
use crate::borrow_tracker::{GlobalState, GlobalStateInner, ProtectorKind};
|
||||
use crate::concurrency::data_race::NaReadType;
|
||||
use crate::*;
|
||||
use crate::{
|
||||
borrow_tracker::{GlobalState, GlobalStateInner, ProtectorKind},
|
||||
concurrency::data_race::NaReadType,
|
||||
};
|
||||
|
||||
pub mod diagnostics;
|
||||
mod perms;
|
||||
|
@ -12,18 +12,17 @@
|
||||
|
||||
use std::{fmt, mem};
|
||||
|
||||
use smallvec::SmallVec;
|
||||
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_span::Span;
|
||||
use rustc_target::abi::Size;
|
||||
use smallvec::SmallVec;
|
||||
|
||||
use crate::borrow_tracker::tree_borrows::{
|
||||
Permission,
|
||||
diagnostics::{self, NodeDebugInfo, TbError, TransitionError},
|
||||
perms::PermTransition,
|
||||
unimap::{UniEntry, UniIndex, UniKeyMap, UniValMap},
|
||||
use crate::borrow_tracker::tree_borrows::Permission;
|
||||
use crate::borrow_tracker::tree_borrows::diagnostics::{
|
||||
self, NodeDebugInfo, TbError, TransitionError,
|
||||
};
|
||||
use crate::borrow_tracker::tree_borrows::perms::PermTransition;
|
||||
use crate::borrow_tracker::tree_borrows::unimap::{UniEntry, UniIndex, UniKeyMap, UniValMap};
|
||||
use crate::borrow_tracker::{GlobalState, ProtectorKind};
|
||||
use crate::*;
|
||||
|
||||
|
@ -1,9 +1,10 @@
|
||||
//! Tests for the tree
|
||||
#![cfg(test)]
|
||||
|
||||
use std::fmt;
|
||||
|
||||
use super::*;
|
||||
use crate::borrow_tracker::tree_borrows::exhaustive::{Exhaustive, precondition};
|
||||
use std::fmt;
|
||||
|
||||
impl Exhaustive for LocationState {
|
||||
fn exhaustive() -> Box<dyn Iterator<Item = Self>> {
|
||||
|
@ -12,7 +12,8 @@
|
||||
|
||||
#![allow(dead_code)]
|
||||
|
||||
use std::{hash::Hash, mem};
|
||||
use std::hash::Hash;
|
||||
use std::mem;
|
||||
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
|
||||
|
@ -40,28 +40,23 @@
|
||||
//! code some atomic operations may increment the timestamp when not necessary but this has no effect
|
||||
//! on the data-race detection code.
|
||||
|
||||
use std::{
|
||||
cell::{Cell, Ref, RefCell, RefMut},
|
||||
fmt::Debug,
|
||||
mem,
|
||||
};
|
||||
use std::cell::{Cell, Ref, RefCell, RefMut};
|
||||
use std::fmt::Debug;
|
||||
use std::mem;
|
||||
|
||||
use rustc_ast::Mutability;
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
use rustc_index::{Idx, IndexVec};
|
||||
use rustc_middle::{mir, ty::Ty};
|
||||
use rustc_middle::mir;
|
||||
use rustc_middle::ty::Ty;
|
||||
use rustc_span::Span;
|
||||
use rustc_target::abi::{Align, HasDataLayout, Size};
|
||||
|
||||
use super::vector_clock::{VClock, VTimestamp, VectorIdx};
|
||||
use super::weak_memory::EvalContextExt as _;
|
||||
use crate::diagnostics::RacingOp;
|
||||
use crate::*;
|
||||
|
||||
use super::{
|
||||
vector_clock::{VClock, VTimestamp, VectorIdx},
|
||||
weak_memory::EvalContextExt as _,
|
||||
};
|
||||
|
||||
pub type AllocState = VClockAlloc;
|
||||
|
||||
/// Valid atomic read-write orderings, alias of atomic::Ordering (not non-exhaustive).
|
||||
|
@ -2,10 +2,10 @@
|
||||
//! ranges and data are discrete and non-splittable -- they represent distinct "objects". An
|
||||
//! allocation in the map will always have the same range until explicitly removed
|
||||
|
||||
use rustc_target::abi::Size;
|
||||
use std::ops::{Index, IndexMut, Range};
|
||||
|
||||
use rustc_const_eval::interpret::AllocRange;
|
||||
use rustc_target::abi::Size;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
struct Elem<T> {
|
||||
|
@ -1,5 +1,6 @@
|
||||
use std::any::Any;
|
||||
use std::collections::{VecDeque, hash_map::Entry};
|
||||
use std::collections::VecDeque;
|
||||
use std::collections::hash_map::Entry;
|
||||
use std::ops::Not;
|
||||
use std::time::Duration;
|
||||
|
||||
|
@ -7,7 +7,6 @@
|
||||
use std::time::{Duration, SystemTime};
|
||||
|
||||
use either::Either;
|
||||
|
||||
use rustc_const_eval::CTRL_C_RECEIVED;
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_hir::def_id::DefId;
|
||||
|
@ -1,11 +1,10 @@
|
||||
use std::cmp::Ordering;
|
||||
use std::fmt::Debug;
|
||||
use std::ops::{Index, Shr};
|
||||
|
||||
use rustc_index::Idx;
|
||||
use rustc_span::{DUMMY_SP, Span, SpanData};
|
||||
use smallvec::SmallVec;
|
||||
use std::{
|
||||
cmp::Ordering,
|
||||
fmt::Debug,
|
||||
ops::{Index, Shr},
|
||||
};
|
||||
|
||||
use super::data_race::NaReadType;
|
||||
|
||||
@ -430,10 +429,12 @@ fn index(&self, index: VectorIdx) -> &VTimestamp {
|
||||
/// test suite
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::cmp::Ordering;
|
||||
|
||||
use rustc_span::DUMMY_SP;
|
||||
|
||||
use super::{VClock, VTimestamp, VectorIdx};
|
||||
use crate::concurrency::data_race::NaReadType;
|
||||
use rustc_span::DUMMY_SP;
|
||||
use std::cmp::Ordering;
|
||||
|
||||
#[test]
|
||||
fn test_equal() {
|
||||
|
@ -76,21 +76,16 @@
|
||||
// (https://github.com/ChrisLidbury/tsan11/blob/ecbd6b81e9b9454e01cba78eb9d88684168132c7/lib/tsan/rtl/tsan_relaxed.cc#L295)
|
||||
// and here.
|
||||
|
||||
use std::{
|
||||
cell::{Ref, RefCell},
|
||||
collections::VecDeque,
|
||||
};
|
||||
use std::cell::{Ref, RefCell};
|
||||
use std::collections::VecDeque;
|
||||
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
|
||||
use super::data_race::{GlobalState as DataRaceState, ThreadClockSet};
|
||||
use super::range_object_map::{AccessType, RangeObjectMap};
|
||||
use super::vector_clock::{VClock, VTimestamp, VectorIdx};
|
||||
use crate::*;
|
||||
|
||||
use super::{
|
||||
data_race::{GlobalState as DataRaceState, ThreadClockSet},
|
||||
range_object_map::{AccessType, RangeObjectMap},
|
||||
vector_clock::{VClock, VTimestamp, VectorIdx},
|
||||
};
|
||||
|
||||
pub type AllocState = StoreBufferAlloc;
|
||||
|
||||
// Each store buffer must be bounded otherwise it will grow indefinitely.
|
||||
|
@ -1,25 +1,21 @@
|
||||
//! Main evaluator loop and setting up the initial stack frame.
|
||||
|
||||
use std::ffi::{OsStr, OsString};
|
||||
use std::iter;
|
||||
use std::panic::{self, AssertUnwindSafe};
|
||||
use std::path::PathBuf;
|
||||
use std::task::Poll;
|
||||
use std::thread;
|
||||
use std::{iter, thread};
|
||||
|
||||
use crate::concurrency::thread::TlsAllocAction;
|
||||
use crate::diagnostics::report_leaks;
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
use rustc_hir::def::Namespace;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_middle::ty::{
|
||||
self, Ty, TyCtxt,
|
||||
layout::{LayoutCx, LayoutOf},
|
||||
};
|
||||
use rustc_middle::ty::layout::{LayoutCx, LayoutOf};
|
||||
use rustc_middle::ty::{self, Ty, TyCtxt};
|
||||
use rustc_session::config::EntryFnType;
|
||||
use rustc_target::spec::abi::Abi;
|
||||
|
||||
use rustc_session::config::EntryFnType;
|
||||
|
||||
use crate::concurrency::thread::TlsAllocAction;
|
||||
use crate::diagnostics::report_leaks;
|
||||
use crate::shims::tls;
|
||||
use crate::*;
|
||||
|
||||
|
@ -1,29 +1,22 @@
|
||||
use std::cmp;
|
||||
use std::collections::BTreeSet;
|
||||
use std::iter;
|
||||
use std::num::NonZero;
|
||||
use std::sync::Mutex;
|
||||
use std::time::Duration;
|
||||
use std::{cmp, iter};
|
||||
|
||||
use rand::RngCore;
|
||||
|
||||
use rustc_apfloat::Float;
|
||||
use rustc_apfloat::ieee::{Double, Half, Quad, Single};
|
||||
use rustc_hir::{
|
||||
Safety,
|
||||
def::{DefKind, Namespace},
|
||||
def_id::{CRATE_DEF_INDEX, CrateNum, DefId, LOCAL_CRATE},
|
||||
};
|
||||
use rustc_hir::Safety;
|
||||
use rustc_hir::def::{DefKind, Namespace};
|
||||
use rustc_hir::def_id::{CRATE_DEF_INDEX, CrateNum, DefId, LOCAL_CRATE};
|
||||
use rustc_index::IndexVec;
|
||||
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
|
||||
use rustc_middle::middle::dependency_format::Linkage;
|
||||
use rustc_middle::middle::exported_symbols::ExportedSymbol;
|
||||
use rustc_middle::mir;
|
||||
use rustc_middle::ty::layout::{FnAbiOf, MaybeResult};
|
||||
use rustc_middle::ty::{
|
||||
self, FloatTy, IntTy, Ty, TyCtxt, UintTy,
|
||||
layout::{LayoutOf, TyAndLayout},
|
||||
};
|
||||
use rustc_middle::ty::layout::{FnAbiOf, LayoutOf, MaybeResult, TyAndLayout};
|
||||
use rustc_middle::ty::{self, FloatTy, IntTy, Ty, TyCtxt, UintTy};
|
||||
use rustc_session::config::CrateType;
|
||||
use rustc_span::{Span, Symbol};
|
||||
use rustc_target::abi::{Align, FieldIdx, FieldsShape, Size, Variants};
|
||||
|
@ -1,4 +1,5 @@
|
||||
use rustc_middle::{mir, mir::BinOp, ty};
|
||||
use rustc_middle::mir::BinOp;
|
||||
use rustc_middle::{mir, ty};
|
||||
|
||||
use self::helpers::check_arg_count;
|
||||
use crate::*;
|
||||
|
@ -5,10 +5,8 @@
|
||||
|
||||
use rand::Rng;
|
||||
use rustc_apfloat::{Float, Round};
|
||||
use rustc_middle::{
|
||||
mir,
|
||||
ty::{self, FloatTy},
|
||||
};
|
||||
use rustc_middle::mir;
|
||||
use rustc_middle::ty::{self, FloatTy};
|
||||
use rustc_span::{Symbol, sym};
|
||||
use rustc_target::abi::Size;
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
use either::Either;
|
||||
|
||||
use rustc_apfloat::{Float, Round};
|
||||
use rustc_middle::ty::FloatTy;
|
||||
use rustc_middle::ty::layout::{HasParamEnv, LayoutOf};
|
||||
use rustc_middle::{mir, ty, ty::FloatTy};
|
||||
use rustc_middle::{mir, ty};
|
||||
use rustc_span::{Symbol, sym};
|
||||
use rustc_target::abi::{Endian, HasDataLayout};
|
||||
|
||||
|
@ -92,15 +92,14 @@
|
||||
mod shims;
|
||||
|
||||
// Establish a "crate-wide prelude": we often import `crate::*`.
|
||||
use rustc_middle::{bug, span_bug};
|
||||
use tracing::{info, trace};
|
||||
|
||||
// Make all those symbols available in the same place as our own.
|
||||
#[doc(no_inline)]
|
||||
pub use rustc_const_eval::interpret::*;
|
||||
// Resolve ambiguity.
|
||||
#[doc(no_inline)]
|
||||
pub use rustc_const_eval::interpret::{self, AllocMap, Provenance as _};
|
||||
use rustc_middle::{bug, span_bug};
|
||||
use tracing::{info, trace};
|
||||
|
||||
// Type aliases that set the provenance parameter.
|
||||
pub type Pointer = interpret::Pointer<Option<machine::Provenance>>;
|
||||
@ -111,15 +110,6 @@
|
||||
pub type PlaceTy<'tcx> = interpret::PlaceTy<'tcx, machine::Provenance>;
|
||||
pub type MPlaceTy<'tcx> = interpret::MPlaceTy<'tcx, machine::Provenance>;
|
||||
|
||||
pub use crate::intrinsics::EvalContextExt as _;
|
||||
pub use crate::shims::EmulateItemResult;
|
||||
pub use crate::shims::env::{EnvVars, EvalContextExt as _};
|
||||
pub use crate::shims::foreign_items::{DynSym, EvalContextExt as _};
|
||||
pub use crate::shims::os_str::EvalContextExt as _;
|
||||
pub use crate::shims::panic::{CatchUnwindData, EvalContextExt as _};
|
||||
pub use crate::shims::time::EvalContextExt as _;
|
||||
pub use crate::shims::tls::TlsData;
|
||||
|
||||
pub use crate::alloc_addresses::{EvalContextExt as _, ProvenanceMode};
|
||||
pub use crate::alloc_bytes::MiriAllocBytes;
|
||||
pub use crate::borrow_tracker::stacked_borrows::{
|
||||
@ -128,15 +118,17 @@
|
||||
pub use crate::borrow_tracker::tree_borrows::{EvalContextExt as _, Tree};
|
||||
pub use crate::borrow_tracker::{BorTag, BorrowTrackerMethod, EvalContextExt as _, RetagFields};
|
||||
pub use crate::clock::{Clock, Instant};
|
||||
pub use crate::concurrency::{
|
||||
cpu_affinity::MAX_CPUS,
|
||||
data_race::{AtomicFenceOrd, AtomicReadOrd, AtomicRwOrd, AtomicWriteOrd, EvalContextExt as _},
|
||||
init_once::{EvalContextExt as _, InitOnceId},
|
||||
sync::{CondvarId, EvalContextExt as _, MutexId, RwLockId, SynchronizationObjects},
|
||||
thread::{
|
||||
BlockReason, EvalContextExt as _, StackEmptyCallback, ThreadId, ThreadManager,
|
||||
TimeoutAnchor, TimeoutClock, UnblockCallback,
|
||||
},
|
||||
pub use crate::concurrency::cpu_affinity::MAX_CPUS;
|
||||
pub use crate::concurrency::data_race::{
|
||||
AtomicFenceOrd, AtomicReadOrd, AtomicRwOrd, AtomicWriteOrd, EvalContextExt as _,
|
||||
};
|
||||
pub use crate::concurrency::init_once::{EvalContextExt as _, InitOnceId};
|
||||
pub use crate::concurrency::sync::{
|
||||
CondvarId, EvalContextExt as _, MutexId, RwLockId, SynchronizationObjects,
|
||||
};
|
||||
pub use crate::concurrency::thread::{
|
||||
BlockReason, EvalContextExt as _, StackEmptyCallback, ThreadId, ThreadManager, TimeoutAnchor,
|
||||
TimeoutClock, UnblockCallback,
|
||||
};
|
||||
pub use crate::diagnostics::{
|
||||
EvalContextExt as _, NonHaltingDiagnostic, TerminationInfo, report_error,
|
||||
@ -146,6 +138,7 @@
|
||||
create_ecx, eval_entry,
|
||||
};
|
||||
pub use crate::helpers::{AccessKind, EvalContextExt as _};
|
||||
pub use crate::intrinsics::EvalContextExt as _;
|
||||
pub use crate::machine::{
|
||||
AllocExtra, FrameExtra, MemoryKind, MiriInterpCx, MiriInterpCxExt, MiriMachine, MiriMemoryKind,
|
||||
PrimitiveLayouts, Provenance, ProvenanceExtra,
|
||||
@ -154,6 +147,13 @@
|
||||
pub use crate::operator::EvalContextExt as _;
|
||||
pub use crate::provenance_gc::{EvalContextExt as _, LiveAllocs, VisitProvenance, VisitWith};
|
||||
pub use crate::range_map::RangeMap;
|
||||
pub use crate::shims::EmulateItemResult;
|
||||
pub use crate::shims::env::{EnvVars, EvalContextExt as _};
|
||||
pub use crate::shims::foreign_items::{DynSym, EvalContextExt as _};
|
||||
pub use crate::shims::os_str::EvalContextExt as _;
|
||||
pub use crate::shims::panic::{CatchUnwindData, EvalContextExt as _};
|
||||
pub use crate::shims::time::EvalContextExt as _;
|
||||
pub use crate::shims::tls::TlsData;
|
||||
|
||||
/// Insert rustc arguments at the beginning of the argument list that Miri wants to be
|
||||
/// set per default, for maximal validation power.
|
||||
|
@ -4,40 +4,29 @@
|
||||
use std::borrow::Cow;
|
||||
use std::cell::RefCell;
|
||||
use std::collections::hash_map::Entry;
|
||||
use std::fmt;
|
||||
use std::path::Path;
|
||||
use std::process;
|
||||
use std::{fmt, process};
|
||||
|
||||
use rand::Rng;
|
||||
use rand::SeedableRng;
|
||||
use rand::rngs::StdRng;
|
||||
|
||||
use rand::{Rng, SeedableRng};
|
||||
use rustc_attr::InlineAttr;
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
#[allow(unused)]
|
||||
use rustc_data_structures::static_assert_size;
|
||||
use rustc_middle::{
|
||||
mir,
|
||||
query::TyCtxtAt,
|
||||
ty::{
|
||||
self, Instance, Ty, TyCtxt,
|
||||
layout::{HasTyCtxt, LayoutCx, LayoutError, LayoutOf, TyAndLayout},
|
||||
},
|
||||
};
|
||||
use rustc_middle::mir;
|
||||
use rustc_middle::query::TyCtxtAt;
|
||||
use rustc_middle::ty::layout::{HasTyCtxt, LayoutCx, LayoutError, LayoutOf, TyAndLayout};
|
||||
use rustc_middle::ty::{self, Instance, Ty, TyCtxt};
|
||||
use rustc_session::config::InliningThreshold;
|
||||
use rustc_span::def_id::{CrateNum, DefId};
|
||||
use rustc_span::{Span, SpanData, Symbol};
|
||||
use rustc_target::abi::{Align, Size};
|
||||
use rustc_target::spec::abi::Abi;
|
||||
|
||||
use crate::{
|
||||
concurrency::{
|
||||
cpu_affinity::{self, CpuAffinityMask},
|
||||
data_race::{self, NaReadType, NaWriteType},
|
||||
weak_memory,
|
||||
},
|
||||
*,
|
||||
};
|
||||
use crate::concurrency::cpu_affinity::{self, CpuAffinityMask};
|
||||
use crate::concurrency::data_race::{self, NaReadType, NaWriteType};
|
||||
use crate::concurrency::weak_memory;
|
||||
use crate::*;
|
||||
|
||||
/// First real-time signal.
|
||||
/// `signal(7)` says this must be between 32 and 64 and specifies 34 or 35
|
||||
|
@ -1,6 +1,7 @@
|
||||
use std::iter;
|
||||
|
||||
use rand::{Rng, seq::IteratorRandom};
|
||||
use rand::Rng;
|
||||
use rand::seq::IteratorRandom;
|
||||
use rustc_apfloat::{Float, FloatConvert};
|
||||
use rustc_middle::mir;
|
||||
use rustc_target::abi::Size;
|
||||
|
@ -1,5 +1,4 @@
|
||||
use either::Either;
|
||||
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
|
||||
use crate::*;
|
||||
|
@ -1,9 +1,11 @@
|
||||
use crate::*;
|
||||
use rustc_ast::ast::Mutability;
|
||||
use rustc_middle::ty::layout::LayoutOf as _;
|
||||
use rustc_middle::ty::{self, Instance, Ty};
|
||||
use rustc_span::{BytePos, Loc, Symbol, hygiene};
|
||||
use rustc_target::{abi::Size, spec::abi::Abi};
|
||||
use rustc_target::abi::Size;
|
||||
use rustc_target::spec::abi::Abi;
|
||||
|
||||
use crate::*;
|
||||
|
||||
impl<'tcx> EvalContextExt<'tcx> for crate::MiriInterpCx<'tcx> {}
|
||||
pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
||||
|
@ -2,7 +2,8 @@
|
||||
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
|
||||
use self::shims::{unix::UnixEnvVars, windows::WindowsEnvVars};
|
||||
use self::shims::unix::UnixEnvVars;
|
||||
use self::shims::windows::WindowsEnvVars;
|
||||
use crate::*;
|
||||
|
||||
#[derive(Default)]
|
||||
|
@ -1,16 +1,17 @@
|
||||
use std::{collections::hash_map::Entry, io::Write, iter, path::Path};
|
||||
use std::collections::hash_map::Entry;
|
||||
use std::io::Write;
|
||||
use std::iter;
|
||||
use std::path::Path;
|
||||
|
||||
use rustc_apfloat::Float;
|
||||
use rustc_ast::expand::allocator::alloc_error_handler_name;
|
||||
use rustc_hir::{def::DefKind, def_id::CrateNum};
|
||||
use rustc_hir::def::DefKind;
|
||||
use rustc_hir::def_id::CrateNum;
|
||||
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
|
||||
use rustc_middle::mir;
|
||||
use rustc_middle::ty;
|
||||
use rustc_middle::{mir, ty};
|
||||
use rustc_span::Symbol;
|
||||
use rustc_target::{
|
||||
abi::{Align, AlignFromBytesError, Size},
|
||||
spec::abi::Abi,
|
||||
};
|
||||
use rustc_target::abi::{Align, AlignFromBytesError, Size};
|
||||
use rustc_target::spec::abi::Abi;
|
||||
|
||||
use self::helpers::{ToHost, ToSoft};
|
||||
use super::alloc::EvalContextExt as _;
|
||||
|
@ -1,7 +1,8 @@
|
||||
//! Implements calling functions from a native library.
|
||||
use libffi::{high::call as ffi, low::CodePtr};
|
||||
use std::ops::Deref;
|
||||
|
||||
use libffi::high::call as ffi;
|
||||
use libffi::low::CodePtr;
|
||||
use rustc_middle::ty::{self as ty, IntTy, UintTy};
|
||||
use rustc_span::Symbol;
|
||||
use rustc_target::abi::{Abi, HasDataLayout};
|
||||
|
@ -1,11 +1,10 @@
|
||||
use std::borrow::Cow;
|
||||
use std::ffi::{OsStr, OsString};
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
#[cfg(unix)]
|
||||
use std::os::unix::ffi::{OsStrExt, OsStringExt};
|
||||
#[cfg(windows)]
|
||||
use std::os::windows::ffi::{OsStrExt, OsStringExt};
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use rustc_middle::ty::Ty;
|
||||
use rustc_middle::ty::layout::LayoutOf;
|
||||
|
@ -1,7 +1,6 @@
|
||||
use std::env;
|
||||
use std::ffi::{OsStr, OsString};
|
||||
use std::io::ErrorKind;
|
||||
use std::mem;
|
||||
use std::{env, mem};
|
||||
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_middle::ty::Ty;
|
||||
|
@ -5,8 +5,7 @@
|
||||
use std::collections::BTreeMap;
|
||||
use std::io::{self, ErrorKind, IsTerminal, Read, SeekFrom, Write};
|
||||
use std::ops::Deref;
|
||||
use std::rc::Rc;
|
||||
use std::rc::Weak;
|
||||
use std::rc::{Rc, Weak};
|
||||
|
||||
use rustc_target::abi::Size;
|
||||
|
||||
|
@ -6,16 +6,15 @@
|
||||
use rustc_target::abi::Size;
|
||||
use rustc_target::spec::abi::Abi;
|
||||
|
||||
use crate::concurrency::cpu_affinity::CpuAffinityMask;
|
||||
use crate::shims::alloc::EvalContextExt as _;
|
||||
use crate::shims::unix::*;
|
||||
use crate::*;
|
||||
|
||||
use self::shims::unix::android::foreign_items as android;
|
||||
use self::shims::unix::freebsd::foreign_items as freebsd;
|
||||
use self::shims::unix::linux::foreign_items as linux;
|
||||
use self::shims::unix::macos::foreign_items as macos;
|
||||
use self::shims::unix::solarish::foreign_items as solarish;
|
||||
use crate::concurrency::cpu_affinity::CpuAffinityMask;
|
||||
use crate::shims::alloc::EvalContextExt as _;
|
||||
use crate::shims::unix::*;
|
||||
use crate::*;
|
||||
|
||||
pub fn is_dyn_sym(name: &str, target_os: &str) -> bool {
|
||||
match name {
|
||||
|
@ -11,14 +11,13 @@
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_target::abi::Size;
|
||||
|
||||
use self::fd::FlockOp;
|
||||
use self::shims::time::system_time_to_duration;
|
||||
use crate::shims::os_str::bytes_to_os_str;
|
||||
use crate::shims::unix::fd::FileDescriptionRef;
|
||||
use crate::shims::unix::*;
|
||||
use crate::*;
|
||||
|
||||
use self::fd::FlockOp;
|
||||
|
||||
#[derive(Debug)]
|
||||
struct FileHandle {
|
||||
file: File,
|
||||
@ -186,12 +185,14 @@ fn flock<'tcx>(
|
||||
#[cfg(target_family = "windows")]
|
||||
{
|
||||
use std::os::windows::io::AsRawHandle;
|
||||
use windows_sys::Win32::{
|
||||
Foundation::{ERROR_IO_PENDING, ERROR_LOCK_VIOLATION, FALSE, HANDLE, TRUE},
|
||||
Storage::FileSystem::{
|
||||
LOCKFILE_EXCLUSIVE_LOCK, LOCKFILE_FAIL_IMMEDIATELY, LockFileEx, UnlockFile,
|
||||
},
|
||||
|
||||
use windows_sys::Win32::Foundation::{
|
||||
ERROR_IO_PENDING, ERROR_LOCK_VIOLATION, FALSE, HANDLE, TRUE,
|
||||
};
|
||||
use windows_sys::Win32::Storage::FileSystem::{
|
||||
LOCKFILE_EXCLUSIVE_LOCK, LOCKFILE_FAIL_IMMEDIATELY, LockFileEx, UnlockFile,
|
||||
};
|
||||
|
||||
let fh = self.file.as_raw_handle() as HANDLE;
|
||||
|
||||
use FlockOp::*;
|
||||
|
@ -3,10 +3,11 @@
|
||||
use std::io;
|
||||
use std::io::{Error, ErrorKind};
|
||||
|
||||
use crate::concurrency::VClock;
|
||||
use crate::shims::unix::fd::FileDescriptionRef;
|
||||
use crate::shims::unix::linux::epoll::{EpollReadyEvents, EvalContextExt as _};
|
||||
use crate::shims::unix::*;
|
||||
use crate::{concurrency::VClock, *};
|
||||
use crate::*;
|
||||
|
||||
/// Maximum value that the eventfd counter can hold.
|
||||
const MAX_COUNTER: u64 = u64::MAX - 1;
|
||||
|
@ -5,8 +5,7 @@
|
||||
use self::shims::unix::linux::eventfd::EvalContextExt as _;
|
||||
use self::shims::unix::linux::mem::EvalContextExt as _;
|
||||
use self::shims::unix::linux::sync::futex;
|
||||
use crate::machine::SIGRTMAX;
|
||||
use crate::machine::SIGRTMIN;
|
||||
use crate::machine::{SIGRTMAX, SIGRTMIN};
|
||||
use crate::shims::unix::*;
|
||||
use crate::*;
|
||||
|
||||
|
@ -1,9 +1,10 @@
|
||||
//! This follows the pattern in src/shims/unix/mem.rs: We only support uses of mremap that would
|
||||
//! correspond to valid uses of realloc.
|
||||
|
||||
use crate::*;
|
||||
use rustc_target::abi::Size;
|
||||
|
||||
use crate::*;
|
||||
|
||||
impl<'tcx> EvalContextExt<'tcx> for crate::MiriInterpCx<'tcx> {}
|
||||
pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
||||
fn mremap(
|
||||
|
@ -14,9 +14,10 @@
|
||||
//! munmap shim which would partially unmap a region of address space previously mapped by mmap will
|
||||
//! report UB.
|
||||
|
||||
use crate::*;
|
||||
use rustc_target::abi::Size;
|
||||
|
||||
use crate::*;
|
||||
|
||||
impl<'tcx> EvalContextExt<'tcx> for crate::MiriInterpCx<'tcx> {}
|
||||
pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
||||
fn mmap(
|
||||
|
@ -14,14 +14,11 @@
|
||||
mod macos;
|
||||
mod solarish;
|
||||
|
||||
pub use self::env::UnixEnvVars;
|
||||
pub use self::fd::{FdTable, FileDescription};
|
||||
pub use self::fs::DirTable;
|
||||
pub use self::linux::epoll::EpollInterestTable;
|
||||
// All the Unix-specific extension traits
|
||||
pub use self::env::EvalContextExt as _;
|
||||
pub use self::fd::EvalContextExt as _;
|
||||
pub use self::fs::EvalContextExt as _;
|
||||
pub use self::env::{EvalContextExt as _, UnixEnvVars};
|
||||
pub use self::fd::{EvalContextExt as _, FdTable, FileDescription};
|
||||
pub use self::fs::{DirTable, EvalContextExt as _};
|
||||
pub use self::linux::epoll::EpollInterestTable;
|
||||
pub use self::mem::EvalContextExt as _;
|
||||
pub use self::sync::EvalContextExt as _;
|
||||
pub use self::thread::EvalContextExt as _;
|
||||
|
@ -1,6 +1,7 @@
|
||||
use crate::*;
|
||||
use rustc_target::spec::abi::Abi;
|
||||
|
||||
use crate::*;
|
||||
|
||||
impl<'tcx> EvalContextExt<'tcx> for crate::MiriInterpCx<'tcx> {}
|
||||
pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
||||
fn pthread_create(
|
||||
|
@ -9,10 +9,11 @@
|
||||
|
||||
use rustc_target::abi::Size;
|
||||
|
||||
use crate::concurrency::VClock;
|
||||
use crate::shims::unix::fd::{FileDescriptionRef, WeakFileDescriptionRef};
|
||||
use crate::shims::unix::linux::epoll::{EpollReadyEvents, EvalContextExt as _};
|
||||
use crate::shims::unix::*;
|
||||
use crate::{concurrency::VClock, *};
|
||||
use crate::*;
|
||||
|
||||
/// The maximum capacity of the socketpair buffer in bytes.
|
||||
/// This number is arbitrary as the value can always
|
||||
|
@ -1,8 +1,6 @@
|
||||
use std::ffi::OsStr;
|
||||
use std::io;
|
||||
use std::iter;
|
||||
use std::path::{self, Path, PathBuf};
|
||||
use std::str;
|
||||
use std::{io, iter, str};
|
||||
|
||||
use rustc_span::Symbol;
|
||||
use rustc_target::abi::{Align, Size};
|
||||
|
@ -1,6 +1,7 @@
|
||||
use rustc_target::abi::HasDataLayout;
|
||||
use std::mem::variant_count;
|
||||
|
||||
use rustc_target::abi::HasDataLayout;
|
||||
|
||||
use crate::*;
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
|
@ -5,9 +5,8 @@
|
||||
mod sync;
|
||||
mod thread;
|
||||
|
||||
pub use self::env::WindowsEnvVars;
|
||||
// All the Windows-specific extension traits
|
||||
pub use self::env::EvalContextExt as _;
|
||||
pub use self::env::{EvalContextExt as _, WindowsEnvVars};
|
||||
pub use self::handle::EvalContextExt as _;
|
||||
pub use self::sync::EvalContextExt as _;
|
||||
pub use self::thread::EvalContextExt as _;
|
||||
|
@ -1,4 +1,4 @@
|
||||
use rustc_apfloat::{ieee::Double, ieee::Single};
|
||||
use rustc_apfloat::ieee::{Double, Single};
|
||||
use rustc_middle::mir;
|
||||
use rustc_middle::ty::Ty;
|
||||
use rustc_middle::ty::layout::LayoutOf as _;
|
||||
|
@ -1,6 +1,6 @@
|
||||
use rand::Rng as _;
|
||||
|
||||
use rustc_apfloat::{Float, ieee::Single};
|
||||
use rustc_apfloat::Float;
|
||||
use rustc_apfloat::ieee::Single;
|
||||
use rustc_middle::ty::Ty;
|
||||
use rustc_middle::ty::layout::LayoutOf as _;
|
||||
use rustc_middle::{mir, ty};
|
||||
|
@ -1,9 +1,10 @@
|
||||
use byteorder::{BigEndian, ByteOrder};
|
||||
use std::env;
|
||||
#[cfg(unix)]
|
||||
use std::io::{self, BufRead};
|
||||
use std::path::PathBuf;
|
||||
|
||||
use byteorder::{BigEndian, ByteOrder};
|
||||
|
||||
fn main() {
|
||||
// Check env var set by `build.rs`.
|
||||
assert_eq!(env!("MIRITESTVAR"), "testval");
|
||||
|
@ -1,5 +1,4 @@
|
||||
use std::env;
|
||||
|
||||
use std::path::PathBuf;
|
||||
|
||||
use byteorder::{ByteOrder, LittleEndian};
|
||||
|
@ -2,8 +2,7 @@
|
||||
|
||||
// Joining the same thread from multiple threads is undefined behavior.
|
||||
|
||||
use std::thread;
|
||||
use std::{mem, ptr};
|
||||
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.
|
||||
|
@ -3,10 +3,10 @@
|
||||
//@compile-flags: -Zmiri-disable-isolation -Zmiri-num-cpus=4
|
||||
|
||||
fn main() {
|
||||
use libc::{cpu_set_t, sched_setaffinity};
|
||||
|
||||
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;
|
||||
|
||||
|
@ -1,8 +1,7 @@
|
||||
//@compile-flags: -Zmiri-disable-isolation -Zmiri-preemption-rate=0
|
||||
//@ignore-target: windows # No libc env support on Windows
|
||||
|
||||
use std::env;
|
||||
use std::thread;
|
||||
use std::{env, thread};
|
||||
|
||||
fn main() {
|
||||
let t = thread::spawn(|| unsafe {
|
||||
|
@ -1,10 +1,8 @@
|
||||
//@compile-flags: -Zmiri-disable-validation -Zmiri-disable-stacked-borrows
|
||||
#![feature(coroutines, coroutine_trait, stmt_expr_attributes)]
|
||||
|
||||
use std::{
|
||||
ops::{Coroutine, CoroutineState},
|
||||
pin::Pin,
|
||||
};
|
||||
use std::ops::{Coroutine, CoroutineState};
|
||||
use std::pin::Pin;
|
||||
|
||||
fn firstn() -> impl Coroutine<Yield = u64, Return = ()> {
|
||||
#[coroutine]
|
||||
|
@ -3,8 +3,7 @@
|
||||
// Avoid accidental synchronization via address reuse inside `thread::spawn`.
|
||||
//@compile-flags: -Zmiri-address-reuse-cross-thread-rate=0
|
||||
|
||||
use std::sync::atomic::AtomicUsize;
|
||||
use std::sync::atomic::Ordering;
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
use std::thread::spawn;
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
|
@ -3,8 +3,7 @@
|
||||
// Avoid accidental synchronization via address reuse inside `thread::spawn`.
|
||||
//@compile-flags: -Zmiri-address-reuse-cross-thread-rate=0
|
||||
|
||||
use std::sync::atomic::AtomicUsize;
|
||||
use std::sync::atomic::Ordering;
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
use std::thread::spawn;
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
|
@ -3,8 +3,7 @@
|
||||
// Avoid accidental synchronization via address reuse inside `thread::spawn`.
|
||||
//@compile-flags: -Zmiri-address-reuse-cross-thread-rate=0
|
||||
|
||||
use std::sync::atomic::AtomicUsize;
|
||||
use std::sync::atomic::Ordering;
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
use std::thread::spawn;
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
|
@ -8,8 +8,7 @@
|
||||
|
||||
#![feature(ptr_internals)]
|
||||
|
||||
use core::ptr::Unique;
|
||||
use core::ptr::addr_of_mut;
|
||||
use core::ptr::{Unique, addr_of_mut};
|
||||
|
||||
fn main() {
|
||||
let mut data = 0u8;
|
||||
|
@ -6,8 +6,7 @@
|
||||
|
||||
use std::mem::MaybeUninit;
|
||||
use std::ptr::{self, addr_of};
|
||||
use std::sync::atomic::AtomicI32;
|
||||
use std::sync::atomic::Ordering;
|
||||
use std::sync::atomic::{AtomicI32, Ordering};
|
||||
use std::thread;
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
|
@ -8,8 +8,7 @@
|
||||
// FIXME(static_mut_refs): Do not allow `static_mut_refs` lint
|
||||
#![allow(static_mut_refs)]
|
||||
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
use std::{mem, ptr};
|
||||
|
||||
pub type Key = libc::pthread_key_t;
|
||||
|
||||
|
@ -2,9 +2,10 @@
|
||||
//@revisions: with_isolation without_isolation
|
||||
//@[without_isolation] compile-flags: -Zmiri-disable-isolation
|
||||
|
||||
use libc::{getpid, gettid};
|
||||
use std::thread;
|
||||
|
||||
use libc::{getpid, gettid};
|
||||
|
||||
fn main() {
|
||||
thread::spawn(|| {
|
||||
// Test that in isolation mode a deterministic value will be returned.
|
||||
|
@ -5,9 +5,10 @@
|
||||
#![feature(pointer_is_aligned_to)]
|
||||
#![feature(strict_provenance)]
|
||||
|
||||
use libc::{cpu_set_t, sched_getaffinity, sched_setaffinity};
|
||||
use std::mem::{size_of, size_of_val};
|
||||
|
||||
use libc::{cpu_set_t, sched_getaffinity, sched_setaffinity};
|
||||
|
||||
// If pid is zero, then the calling thread is used.
|
||||
const PID: i32 = 0;
|
||||
|
||||
|
@ -1,7 +1,9 @@
|
||||
//@ignore-target: windows # File handling is not implemented yet
|
||||
//@compile-flags: -Zmiri-disable-isolation
|
||||
|
||||
use std::{fs::File, io::Error, os::fd::AsRawFd};
|
||||
use std::fs::File;
|
||||
use std::io::Error;
|
||||
use std::os::fd::AsRawFd;
|
||||
|
||||
#[path = "../../utils/mod.rs"]
|
||||
mod utils;
|
||||
|
@ -230,8 +230,7 @@ fn test_posix_mkstemp() {
|
||||
|
||||
/// Test allocating variant of `realpath`.
|
||||
fn test_posix_realpath_alloc() {
|
||||
use std::os::unix::ffi::OsStrExt;
|
||||
use std::os::unix::ffi::OsStringExt;
|
||||
use std::os::unix::ffi::{OsStrExt, OsStringExt};
|
||||
|
||||
let buf;
|
||||
let path = utils::tmp().join("miri_test_libc_posix_realpath_alloc");
|
||||
|
@ -2,6 +2,7 @@
|
||||
//@only-target: linux # We only support tokio on Linux
|
||||
|
||||
use std::fs::remove_file;
|
||||
|
||||
use tokio::fs::{File, OpenOptions};
|
||||
use tokio::io::{self, AsyncReadExt, AsyncWriteExt};
|
||||
|
||||
|
@ -1,13 +1,11 @@
|
||||
//@revisions: stack tree
|
||||
//@[tree]compile-flags: -Zmiri-tree-borrows
|
||||
|
||||
use std::{
|
||||
future::Future,
|
||||
mem::MaybeUninit,
|
||||
pin::Pin,
|
||||
sync::Arc,
|
||||
task::{Context, Poll, Wake},
|
||||
};
|
||||
use std::future::Future;
|
||||
use std::mem::MaybeUninit;
|
||||
use std::pin::Pin;
|
||||
use std::sync::Arc;
|
||||
use std::task::{Context, Poll, Wake};
|
||||
|
||||
struct ThingAdder<'a> {
|
||||
// Using `MaybeUninit` to ensure there are no niches here.
|
||||
|
@ -1,5 +1,6 @@
|
||||
//@compile-flags: -Zmiri-compare-exchange-weak-failure-rate=0.0
|
||||
use std::sync::atomic::{AtomicBool, Ordering::*};
|
||||
use std::sync::atomic::AtomicBool;
|
||||
use std::sync::atomic::Ordering::*;
|
||||
|
||||
// Ensure that compare_exchange_weak never fails.
|
||||
fn main() {
|
||||
|
@ -6,9 +6,8 @@
|
||||
// FIXME(static_mut_refs): Do not allow `static_mut_refs` lint
|
||||
#![allow(static_mut_refs)]
|
||||
|
||||
use std::sync::atomic::{
|
||||
AtomicBool, AtomicIsize, AtomicPtr, AtomicU64, Ordering::*, compiler_fence, fence,
|
||||
};
|
||||
use std::sync::atomic::Ordering::*;
|
||||
use std::sync::atomic::{AtomicBool, AtomicIsize, AtomicPtr, AtomicU64, compiler_fence, fence};
|
||||
|
||||
fn main() {
|
||||
atomic_bool();
|
||||
|
@ -7,13 +7,11 @@
|
||||
#![feature(allocator_api)]
|
||||
#![feature(strict_provenance)]
|
||||
|
||||
use std::{
|
||||
alloc::{AllocError, Allocator, Layout},
|
||||
cell::{Cell, UnsafeCell},
|
||||
mem,
|
||||
ptr::{self, NonNull, addr_of},
|
||||
thread::{self, ThreadId},
|
||||
};
|
||||
use std::alloc::{AllocError, Allocator, Layout};
|
||||
use std::cell::{Cell, UnsafeCell};
|
||||
use std::mem;
|
||||
use std::ptr::{self, NonNull, addr_of};
|
||||
use std::thread::{self, ThreadId};
|
||||
|
||||
const BIN_SIZE: usize = 8;
|
||||
|
||||
|
@ -3,8 +3,7 @@
|
||||
#![allow(incomplete_features)] // for trait upcasting
|
||||
#![feature(allocator_api, trait_upcasting)]
|
||||
|
||||
use std::alloc::Layout;
|
||||
use std::alloc::{AllocError, Allocator};
|
||||
use std::alloc::{AllocError, Allocator, Layout};
|
||||
use std::cell::Cell;
|
||||
use std::mem::MaybeUninit;
|
||||
use std::ptr::{self, NonNull};
|
||||
|
@ -5,7 +5,8 @@
|
||||
#![feature(sync_unsafe_cell)]
|
||||
|
||||
use std::cell::SyncUnsafeCell;
|
||||
use std::sync::atomic::{AtomicUsize, Ordering::Relaxed};
|
||||
use std::sync::atomic::AtomicUsize;
|
||||
use std::sync::atomic::Ordering::Relaxed;
|
||||
use std::thread;
|
||||
|
||||
static ADDR: AtomicUsize = AtomicUsize::new(0);
|
||||
|
@ -1,6 +1,5 @@
|
||||
use std::hint;
|
||||
use std::sync::atomic;
|
||||
use std::sync::{Mutex, TryLockError};
|
||||
use std::sync::{Mutex, TryLockError, atomic};
|
||||
|
||||
fn main() {
|
||||
test_mutex_stdlib();
|
||||
|
@ -4,10 +4,8 @@
|
||||
|
||||
use std::fmt::Debug;
|
||||
use std::mem::ManuallyDrop;
|
||||
use std::ops::{
|
||||
Coroutine,
|
||||
CoroutineState::{self, *},
|
||||
};
|
||||
use std::ops::Coroutine;
|
||||
use std::ops::CoroutineState::{self, *};
|
||||
use std::pin::Pin;
|
||||
use std::ptr;
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
|
@ -21,7 +21,9 @@ fn bar(self: Pin<&mut Self>) -> bool {
|
||||
}
|
||||
|
||||
fn stdlib_pointers() {
|
||||
use std::{pin::Pin, rc::Rc, sync::Arc};
|
||||
use std::pin::Pin;
|
||||
use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
|
||||
trait Trait {
|
||||
fn by_rc(self: Rc<Self>) -> i64;
|
||||
@ -60,10 +62,8 @@ fn by_pin_box(self: Pin<Box<Self>>) -> i64 {
|
||||
}
|
||||
|
||||
fn pointers_and_wrappers() {
|
||||
use std::{
|
||||
marker::Unsize,
|
||||
ops::{CoerceUnsized, Deref, DispatchFromDyn},
|
||||
};
|
||||
use std::marker::Unsize;
|
||||
use std::ops::{CoerceUnsized, Deref, DispatchFromDyn};
|
||||
|
||||
struct Ptr<T: ?Sized>(Box<T>);
|
||||
|
||||
|
@ -1,7 +1,5 @@
|
||||
use std::mem;
|
||||
use std::num;
|
||||
use std::ptr;
|
||||
use std::rc::Rc;
|
||||
use std::{mem, num, ptr};
|
||||
|
||||
#[derive(Copy, Clone, Default)]
|
||||
struct Zst;
|
||||
|
@ -11,7 +11,8 @@
|
||||
#![allow(incomplete_features, internal_features)]
|
||||
use std::intrinsics::simd as intrinsics;
|
||||
use std::ptr;
|
||||
use std::simd::{StdFloat, prelude::*};
|
||||
use std::simd::StdFloat;
|
||||
use std::simd::prelude::*;
|
||||
|
||||
extern "rust-intrinsic" {
|
||||
#[rustc_nounwind]
|
||||
|
@ -2,7 +2,8 @@
|
||||
// This test is the result of minimizing the `emplacable` crate to reproduce
|
||||
// <https://github.com/rust-lang/miri/issues/3541>.
|
||||
|
||||
use std::{ops::FnMut, ptr::Pointee};
|
||||
use std::ops::FnMut;
|
||||
use std::ptr::Pointee;
|
||||
|
||||
pub type EmplacerFn<'a, T> = dyn for<'b> FnMut(<T as Pointee>::Metadata) + 'a;
|
||||
|
||||
|
@ -1,7 +1,5 @@
|
||||
use std::{
|
||||
ptr,
|
||||
sync::atomic::{AtomicPtr, Ordering},
|
||||
};
|
||||
use std::ptr;
|
||||
use std::sync::atomic::{AtomicPtr, Ordering};
|
||||
|
||||
static mut LEAKER: Option<Box<Vec<i32>>> = None;
|
||||
|
||||
|
@ -2,8 +2,7 @@
|
||||
// Tree Borrows doesn't support int2ptr casts, but let's make sure we don't immediately crash either.
|
||||
//@[tree]compile-flags: -Zmiri-tree-borrows
|
||||
//@[stack]compile-flags: -Zmiri-permissive-provenance
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
use std::{mem, ptr};
|
||||
|
||||
fn eq_ref<T>(x: &T, y: &T) -> bool {
|
||||
x as *const _ == y as *const _
|
||||
|
3
src/tools/miri/tests/pass/shims/env/var.rs
vendored
3
src/tools/miri/tests/pass/shims/env/var.rs
vendored
@ -1,6 +1,5 @@
|
||||
//@compile-flags: -Zmiri-preemption-rate=0
|
||||
use std::env;
|
||||
use std::thread;
|
||||
use std::{env, thread};
|
||||
|
||||
fn main() {
|
||||
// Test that miri environment is isolated when communication is disabled.
|
||||
|
@ -1,9 +1,8 @@
|
||||
//@only-target: windows # this directly tests windows-only functions
|
||||
|
||||
use core::ffi::c_void;
|
||||
use std::ffi::OsStr;
|
||||
use std::os::windows::ffi::OsStrExt;
|
||||
|
||||
use core::ffi::c_void;
|
||||
type HANDLE = *mut c_void;
|
||||
type PWSTR = *mut u16;
|
||||
type PCWSTR = *const u16;
|
||||
|
@ -6,8 +6,7 @@
|
||||
#![feature(layout_for_ptr)]
|
||||
#![feature(strict_provenance)]
|
||||
|
||||
use std::ptr;
|
||||
use std::slice;
|
||||
use std::{ptr, slice};
|
||||
|
||||
fn slice_of_zst() {
|
||||
fn foo<T>(v: &[T]) -> Option<&[T]> {
|
||||
|
@ -2,10 +2,8 @@
|
||||
// this fails when Stacked Borrows is strictly applied even to `!Unpin` types.
|
||||
#![feature(coroutines, coroutine_trait, stmt_expr_attributes)]
|
||||
|
||||
use std::{
|
||||
ops::{Coroutine, CoroutineState},
|
||||
pin::Pin,
|
||||
};
|
||||
use std::ops::{Coroutine, CoroutineState};
|
||||
use std::pin::Pin;
|
||||
|
||||
fn firstn() -> impl Coroutine<Yield = u64, Return = ()> {
|
||||
#[coroutine]
|
||||
|
@ -3,10 +3,8 @@
|
||||
//@compile-flags: -Zmiri-permissive-provenance -Zmiri-provenance-gc=0
|
||||
|
||||
#![feature(strict_provenance)]
|
||||
use std::{
|
||||
alloc::{self, Layout},
|
||||
mem::ManuallyDrop,
|
||||
};
|
||||
use std::alloc::{self, Layout};
|
||||
use std::mem::ManuallyDrop;
|
||||
|
||||
extern "Rust" {
|
||||
fn miri_get_alloc_id(ptr: *const u8) -> u64;
|
||||
|
@ -3,8 +3,7 @@
|
||||
//@[uniq]compile-flags: -Zmiri-unique-is-unique
|
||||
#![feature(allocator_api)]
|
||||
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
use std::{mem, ptr};
|
||||
|
||||
fn main() {
|
||||
aliasing_read_only_mutable_refs();
|
||||
|
@ -1,8 +1,9 @@
|
||||
use std::env;
|
||||
use std::ffi::OsString;
|
||||
use std::num::NonZero;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::Command;
|
||||
use std::sync::OnceLock;
|
||||
use std::{env, process::Command};
|
||||
|
||||
use colored::*;
|
||||
use regex::bytes::Regex;
|
||||
|
Loading…
Reference in New Issue
Block a user