Skip to content

Commit 821a44d

Browse files
committed
move some configuration enums to a more logical place
1 parent 8236def commit 821a44d

File tree

3 files changed

+63
-65
lines changed

3 files changed

+63
-65
lines changed

src/tools/miri/src/eval.rs

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -32,65 +32,6 @@ pub enum MiriEntryFnType {
3232
/// will hang the program.
3333
const MAIN_THREAD_YIELDS_AT_SHUTDOWN: u32 = 256;
3434

35-
#[derive(Copy, Clone, Debug, PartialEq)]
36-
pub enum AlignmentCheck {
37-
/// Do not check alignment.
38-
None,
39-
/// Check alignment "symbolically", i.e., using only the requested alignment for an allocation and not its real base address.
40-
Symbolic,
41-
/// Check alignment on the actual physical integer address.
42-
Int,
43-
}
44-
45-
#[derive(Copy, Clone, Debug, PartialEq)]
46-
pub enum RejectOpWith {
47-
/// Isolated op is rejected with an abort of the machine.
48-
Abort,
49-
50-
/// If not Abort, miri returns an error for an isolated op.
51-
/// Following options determine if user should be warned about such error.
52-
/// Do not print warning about rejected isolated op.
53-
NoWarning,
54-
55-
/// Print a warning about rejected isolated op, with backtrace.
56-
Warning,
57-
58-
/// Print a warning about rejected isolated op, without backtrace.
59-
WarningWithoutBacktrace,
60-
}
61-
62-
#[derive(Copy, Clone, Debug, PartialEq)]
63-
pub enum IsolatedOp {
64-
/// Reject an op requiring communication with the host. By
65-
/// default, miri rejects the op with an abort. If not, it returns
66-
/// an error code, and prints a warning about it. Warning levels
67-
/// are controlled by `RejectOpWith` enum.
68-
Reject(RejectOpWith),
69-
70-
/// Execute op requiring communication with the host, i.e. disable isolation.
71-
Allow,
72-
}
73-
74-
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
75-
pub enum BacktraceStyle {
76-
/// Prints a terser backtrace which ideally only contains relevant information.
77-
Short,
78-
/// Prints a backtrace with all possible information.
79-
Full,
80-
/// Prints only the frame that the error occurs in.
81-
Off,
82-
}
83-
84-
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
85-
pub enum ValidationMode {
86-
/// Do not perform any kind of validation.
87-
No,
88-
/// Validate the interior of the value, but not things behind references.
89-
Shallow,
90-
/// Fully recursively validate references.
91-
Deep,
92-
}
93-
9435
/// Configuration needed to spawn a Miri instance.
9536
#[derive(Clone)]
9637
pub struct MiriConfig {

src/tools/miri/src/lib.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,13 @@ pub use crate::data_structures::mono_hash_map::MonoHashMap;
138138
pub use crate::diagnostics::{
139139
EvalContextExt as _, NonHaltingDiagnostic, TerminationInfo, report_error,
140140
};
141-
pub use crate::eval::{
142-
AlignmentCheck, BacktraceStyle, IsolatedOp, MiriConfig, MiriEntryFnType, RejectOpWith,
143-
ValidationMode, create_ecx, eval_entry,
144-
};
141+
pub use crate::eval::{MiriConfig, MiriEntryFnType, create_ecx, eval_entry};
145142
pub use crate::helpers::{AccessKind, EvalContextExt as _, ToU64 as _, ToUsize as _};
146143
pub use crate::intrinsics::EvalContextExt as _;
147144
pub use crate::machine::{
148-
AllocExtra, DynMachineCallback, FrameExtra, MachineCallback, MemoryKind, MiriInterpCx,
149-
MiriInterpCxExt, MiriMachine, MiriMemoryKind, PrimitiveLayouts, Provenance, ProvenanceExtra,
145+
AlignmentCheck, AllocExtra, BacktraceStyle, DynMachineCallback, FrameExtra, IsolatedOp,
146+
MachineCallback, MemoryKind, MiriInterpCx, MiriInterpCxExt, MiriMachine, MiriMemoryKind,
147+
PrimitiveLayouts, Provenance, ProvenanceExtra, RejectOpWith, ValidationMode,
150148
};
151149
pub use crate::operator::EvalContextExt as _;
152150
pub use crate::provenance_gc::{EvalContextExt as _, LiveAllocs, VisitProvenance, VisitWith};

src/tools/miri/src/machine.rs

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,65 @@ pub const SIGRTMAX: i32 = 42;
4949
/// base address for each evaluation would produce unbounded memory usage.
5050
const ADDRS_PER_ANON_GLOBAL: usize = 32;
5151

52+
#[derive(Copy, Clone, Debug, PartialEq)]
53+
pub enum AlignmentCheck {
54+
/// Do not check alignment.
55+
None,
56+
/// Check alignment "symbolically", i.e., using only the requested alignment for an allocation and not its real base address.
57+
Symbolic,
58+
/// Check alignment on the actual physical integer address.
59+
Int,
60+
}
61+
62+
#[derive(Copy, Clone, Debug, PartialEq)]
63+
pub enum RejectOpWith {
64+
/// Isolated op is rejected with an abort of the machine.
65+
Abort,
66+
67+
/// If not Abort, miri returns an error for an isolated op.
68+
/// Following options determine if user should be warned about such error.
69+
/// Do not print warning about rejected isolated op.
70+
NoWarning,
71+
72+
/// Print a warning about rejected isolated op, with backtrace.
73+
Warning,
74+
75+
/// Print a warning about rejected isolated op, without backtrace.
76+
WarningWithoutBacktrace,
77+
}
78+
79+
#[derive(Copy, Clone, Debug, PartialEq)]
80+
pub enum IsolatedOp {
81+
/// Reject an op requiring communication with the host. By
82+
/// default, miri rejects the op with an abort. If not, it returns
83+
/// an error code, and prints a warning about it. Warning levels
84+
/// are controlled by `RejectOpWith` enum.
85+
Reject(RejectOpWith),
86+
87+
/// Execute op requiring communication with the host, i.e. disable isolation.
88+
Allow,
89+
}
90+
91+
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
92+
pub enum BacktraceStyle {
93+
/// Prints a terser backtrace which ideally only contains relevant information.
94+
Short,
95+
/// Prints a backtrace with all possible information.
96+
Full,
97+
/// Prints only the frame that the error occurs in.
98+
Off,
99+
}
100+
101+
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
102+
pub enum ValidationMode {
103+
/// Do not perform any kind of validation.
104+
No,
105+
/// Validate the interior of the value, but not things behind references.
106+
Shallow,
107+
/// Fully recursively validate references.
108+
Deep,
109+
}
110+
52111
/// Extra data stored with each stack frame
53112
pub struct FrameExtra<'tcx> {
54113
/// Extra data for the Borrow Tracker.

0 commit comments

Comments
 (0)