rust/src/lib.rs

75 lines
2.5 KiB
Rust
Raw Normal View History

2019-03-18 07:30:57 -05:00
#![feature(rustc_private)]
#![feature(option_expect_none, option_unwrap_none)]
2020-02-16 16:51:02 -06:00
#![feature(map_first_last)]
2020-03-12 14:46:58 -05:00
#![feature(never_type)]
2019-07-24 09:24:26 -05:00
#![warn(rust_2018_idioms)]
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.
extern crate rustc_apfloat;
2020-03-01 03:22:13 -06:00
extern crate rustc_ast;
2019-12-23 05:56:23 -06:00
#[macro_use]
extern crate rustc;
2017-12-14 04:03:55 -06:00
extern crate rustc_data_structures;
2020-03-01 03:26:24 -06:00
extern crate rustc_hir;
2018-05-03 17:29:13 -05:00
extern crate rustc_mir;
2020-03-01 03:26:24 -06:00
extern crate rustc_span;
2018-05-01 11:13:22 -05:00
extern crate rustc_target;
2017-07-21 10:25:30 -05:00
2019-12-23 17:11:40 -06:00
mod diagnostics;
2019-12-23 05:56:23 -06:00
mod eval;
2019-02-15 19:29:38 -06:00
mod helpers;
2019-06-20 14:21:47 -05:00
mod intptrcast;
mod machine;
2019-12-23 05:56:23 -06:00
mod mono_hash_map;
mod operator;
mod range_map;
mod shims;
mod stacked_borrows;
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
pub use crate::shims::dlsym::{Dlsym, EvalContextExt as DlsymEvalContextExt};
2019-08-14 15:44:37 -05:00
pub use crate::shims::env::{EnvVars, EvalContextExt as EnvEvalContextExt};
2019-12-23 05:56:23 -06:00
pub use crate::shims::foreign_items::EvalContextExt as ForeignItemsEvalContextExt;
2020-01-25 12:57:15 -06:00
pub use crate::shims::fs::{DirHandler, EvalContextExt as FileEvalContextExt, FileHandler};
2019-12-23 05:56:23 -06:00
pub use crate::shims::intrinsics::EvalContextExt as IntrinsicsEvalContextExt;
pub use crate::shims::panic::{CatchUnwindData, EvalContextExt as PanicEvalContextExt};
2019-12-23 05:56:23 -06:00
pub use crate::shims::time::EvalContextExt as TimeEvalContextExt;
pub use crate::shims::tls::{EvalContextExt as TlsEvalContextExt, TlsData};
pub use crate::shims::EvalContextExt as ShimsEvalContextExt;
pub use crate::diagnostics::{
register_diagnostic, report_error, EvalContextExt as DiagnosticsEvalContextExt,
TerminationInfo, NonHaltingDiagnostic,
};
pub use crate::eval::{create_ecx, eval_main, MiriConfig};
2019-12-23 05:56:23 -06:00
pub use crate::helpers::EvalContextExt as HelpersEvalContextExt;
pub use crate::machine::{
AllocExtra, Evaluator, FrameData, MemoryExtra, MiriEvalContext, MiriEvalContextExt,
MiriMemoryKind, NUM_CPUS, PAGE_SIZE, STACK_ADDR, STACK_SIZE,
};
pub use crate::mono_hash_map::MonoHashMap;
2018-11-27 07:41:53 -06:00
pub use crate::operator::EvalContextExt as OperatorEvalContextExt;
pub use crate::range_map::RangeMap;
pub use crate::stacked_borrows::{
2020-03-01 03:26:24 -06:00
EvalContextExt as StackedBorEvalContextExt, Item, Permission, PtrId, Stack, Stacks, Tag,
2019-06-29 07:37:41 -05:00
};
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] {
2020-03-01 03:26:24 -06:00
&[
"-Zalways-encode-mir",
"-Zmir-emit-retag",
"-Zmir-opt-level=0",
"--cfg=miri",
"-Cdebug-assertions=on",
]
}