]> git.lizzy.rs Git - rust.git/blob - src/lib.rs
move most of the stuff from lib.rs into machine.rs, and initialization + main loop...
[rust.git] / src / lib.rs
1 #![feature(rustc_private)]
2
3 #![allow(clippy::cast_lossless)]
4
5 #[macro_use]
6 extern crate log;
7 // From rustc.
8 extern crate syntax;
9 extern crate rustc_apfloat;
10 #[macro_use] extern crate rustc;
11 extern crate rustc_data_structures;
12 extern crate rustc_mir;
13 extern crate rustc_target;
14
15 mod fn_call;
16 mod operator;
17 mod intrinsic;
18 mod helpers;
19 mod tls;
20 mod range_map;
21 mod mono_hash_map;
22 mod stacked_borrows;
23 mod intptrcast;
24 mod machine;
25 mod eval;
26
27 // Make all those symbols available in the same place as our own.
28 pub use rustc_mir::interpret::*;
29 // Resolve ambiguity.
30 pub use rustc_mir::interpret::{self, AllocMap, PlaceTy};
31
32 pub use crate::fn_call::EvalContextExt as MissingFnsEvalContextExt;
33 pub use crate::operator::EvalContextExt as OperatorEvalContextExt;
34 pub use crate::intrinsic::EvalContextExt as IntrinsicEvalContextExt;
35 pub use crate::tls::{EvalContextExt as TlsEvalContextExt, TlsData};
36 pub use crate::range_map::RangeMap;
37 pub use crate::helpers::{EvalContextExt as HelpersEvalContextExt};
38 pub use crate::mono_hash_map::MonoHashMap;
39 pub use crate::stacked_borrows::{EvalContextExt as StackedBorEvalContextExt, Tag, Permission, Stack, Stacks, Item};
40 pub use crate::machine::{MemoryExtra, AllocExtra, MiriMemoryKind, Evaluator, MiriEvalContext, MiriEvalContextExt};
41 pub use crate::eval::{eval_main, create_ecx, MiriConfig};
42
43 /// Insert rustc arguments at the beginning of the argument list that Miri wants to be
44 /// set per default, for maximal validation power.
45 pub fn miri_default_args() -> &'static [&'static str] {
46     // The flags here should be kept in sync with what bootstrap adds when `test-miri` is
47     // set, which happens in `bootstrap/bin/rustc.rs` in the rustc sources.
48     &["-Zalways-encode-mir", "-Zmir-emit-retag", "-Zmir-opt-level=0", "--cfg=miri"]
49 }