rust/src/lib.rs

55 lines
2.0 KiB
Rust
Raw Normal View History

2019-03-18 07:30:57 -05:00
#![feature(rustc_private)]
2017-07-21 10:25:30 -05:00
2018-11-25 08:44:28 -06:00
#![allow(clippy::cast_lossless)]
2018-07-10 10:32:38 -05:00
2017-07-21 10:25:30 -05:00
#[macro_use]
extern crate log;
2018-01-06 09:21:24 -06:00
// From rustc.
2018-10-31 04:19:20 -05:00
extern crate syntax;
extern crate rustc_apfloat;
#[macro_use] extern crate rustc;
2017-12-14 04:03:55 -06:00
extern crate rustc_data_structures;
2018-05-03 17:29:13 -05:00
extern crate rustc_mir;
2018-05-01 11:13:22 -05:00
extern crate rustc_target;
2017-07-21 10:25:30 -05:00
2019-02-15 19:29:38 -06:00
mod fn_call;
mod operator;
mod intrinsic;
mod helpers;
mod tls;
mod range_map;
mod mono_hash_map;
mod stacked_borrows;
2019-06-20 14:21:47 -05:00
mod intptrcast;
mod machine;
mod eval;
2019-02-15 19:29:38 -06:00
// Make all those symbols available in the same place as our own.
2019-02-15 19:29:38 -06:00
pub use rustc_mir::interpret::*;
// Resolve ambiguity.
pub use rustc_mir::interpret::{self, AllocMap, PlaceTy};
2017-07-21 10:25:30 -05:00
2018-11-27 07:41:53 -06:00
pub use crate::fn_call::EvalContextExt as MissingFnsEvalContextExt;
pub use crate::operator::EvalContextExt as OperatorEvalContextExt;
pub use crate::intrinsic::EvalContextExt as IntrinsicEvalContextExt;
pub use crate::tls::{EvalContextExt as TlsEvalContextExt, TlsData};
pub use crate::range_map::RangeMap;
2018-12-11 07:32:59 -06:00
pub use crate::helpers::{EvalContextExt as HelpersEvalContextExt};
pub use crate::mono_hash_map::MonoHashMap;
pub use crate::stacked_borrows::{EvalContextExt as StackedBorEvalContextExt, Tag, Permission, Stack, Stacks, Item};
pub use crate::machine::{MemoryExtra, AllocExtra, MiriMemoryKind, Evaluator, MiriEvalContext, MiriEvalContextExt};
pub use crate::eval::{eval_main, create_ecx, MiriConfig};
2019-06-29 06:33:47 -05:00
// Some global facts about the emulated machine.
pub const PAGE_SIZE: u64 = 4*1024;
2019-06-29 06:37:38 -05:00
pub const STACK_ADDR: u64 = 16*PAGE_SIZE; // not really about the "stack", but where we start assigning integer addresses to allocations
2019-06-29 06:33:47 -05:00
pub const NUM_CPUS: u64 = 1;
2019-02-15 19:29:38 -06:00
/// Insert rustc arguments at the beginning of the argument list that Miri wants to be
/// set per default, for maximal validation power.
2018-11-03 05:03:53 -05:00
pub fn miri_default_args() -> &'static [&'static str] {
// The flags here should be kept in sync with what bootstrap adds when `test-miri` is
// set, which happens in `bootstrap/bin/rustc.rs` in the rustc sources.
&["-Zalways-encode-mir", "-Zmir-emit-retag", "-Zmir-opt-level=0", "--cfg=miri"]
}