67 lines
2.2 KiB
Rust
Raw Normal View History

2015-08-18 17:59:21 -04:00
/*!
2020-02-21 11:03:21 -03:00
Rust MIR: a lowered representation of Rust.
2015-08-18 17:59:21 -04:00
*/
#![feature(assert_matches)]
2016-02-11 18:05:28 +02:00
#![feature(box_patterns)]
#![feature(control_flow_enum)]
#![feature(decl_macro)]
#![feature(exact_size_is_empty)]
#![feature(let_chains)]
#![feature(let_else)]
#![feature(map_try_insert)]
#![feature(min_specialization)]
#![feature(slice_ptr_get)]
2021-03-10 08:48:09 -06:00
#![feature(option_get_or_insert_default)]
#![feature(never_type)]
#![feature(trait_alias)]
#![feature(trusted_len)]
#![feature(trusted_step)]
#![feature(try_blocks)]
2022-05-29 01:19:52 -07:00
#![feature(yeet_expr)]
2021-09-01 21:05:35 +02:00
#![recursion_limit = "256"]
2022-02-23 08:06:22 -05:00
#![allow(rustc::potential_query_instability)]
2015-08-18 17:59:21 -04:00
2019-12-22 17:42:04 -05:00
#[macro_use]
2020-08-13 23:05:01 -07:00
extern crate tracing;
2019-12-22 17:42:04 -05:00
#[macro_use]
2020-03-29 16:41:09 +02:00
extern crate rustc_middle;
2015-08-18 17:59:21 -04:00
2019-12-22 17:42:04 -05:00
pub mod const_eval;
pub mod interpret;
pub mod transform;
pub mod util;
2020-03-29 16:41:09 +02:00
use rustc_middle::ty::query::Providers;
pub fn provide(providers: &mut Providers) {
const_eval::provide(providers);
providers.eval_to_const_value_raw = const_eval::eval_to_const_value_raw_provider;
providers.eval_to_allocation_raw = const_eval::eval_to_allocation_raw_provider;
providers.const_caller_location = const_eval::const_caller_location;
providers.try_destructure_const = |tcx, param_env_and_val| {
let (param_env, c) = param_env_and_val.into_parts();
const_eval::try_destructure_const(tcx, param_env, c).ok()
};
providers.eval_to_valtree = |tcx, param_env_and_value| {
let (param_env, raw) = param_env_and_value.into_parts();
const_eval::eval_to_valtree(tcx, param_env, raw)
};
providers.try_destructure_mir_constant = |tcx, param_env_and_value| {
let (param_env, value) = param_env_and_value.into_parts();
const_eval::try_destructure_mir_constant(tcx, param_env, value).ok()
};
providers.valtree_to_const_val =
|tcx, (ty, valtree)| const_eval::valtree_to_const_value(tcx, ty, valtree);
providers.deref_const = |tcx, param_env_and_value| {
let (param_env, value) = param_env_and_value.into_parts();
const_eval::deref_const(tcx, param_env, value)
};
providers.deref_mir_constant = |tcx, param_env_and_value| {
let (param_env, value) = param_env_and_value.into_parts();
const_eval::deref_mir_constant(tcx, param_env, value)
};
}