rust/compiler/rustc_const_eval/src/lib.rs

58 lines
1.7 KiB
Rust
Raw Normal View History

2015-08-18 16:59:21 -05:00
/*!
2020-02-21 08:03:21 -06:00
Rust MIR: a lowered representation of Rust.
2015-08-18 16:59:21 -05:00
*/
#![feature(assert_matches)]
2019-10-07 19:14:42 -05:00
#![feature(bool_to_option)]
2016-02-11 10:05:28 -06:00
#![feature(box_patterns)]
#![feature(control_flow_enum)]
#![feature(crate_visibility_modifier)]
#![feature(decl_macro)]
#![feature(exact_size_is_empty)]
#![feature(in_band_lifetimes)]
2021-03-08 17:32:41 -06:00
#![feature(iter_zip)]
#![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)]
2021-09-01 14:05:35 -05:00
#![recursion_limit = "256"]
2015-08-18 16:59:21 -05:00
2019-12-22 16:42:04 -06:00
#[macro_use]
2020-08-14 01:05:01 -05:00
extern crate tracing;
2019-12-22 16:42:04 -06:00
#[macro_use]
2020-03-29 09:41:09 -05:00
extern crate rustc_middle;
2015-08-18 16:59:21 -05:00
2019-12-22 16:42:04 -06:00
pub mod const_eval;
pub mod interpret;
pub mod transform;
pub mod util;
2020-03-29 09:41:09 -05: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.destructure_const = |tcx, param_env_and_value| {
let (param_env, value) = param_env_and_value.into_parts();
const_eval::destructure_const(tcx, param_env, value)
};
providers.const_to_valtree = |tcx, param_env_and_value| {
let (param_env, raw) = param_env_and_value.into_parts();
const_eval::const_to_valtree(tcx, param_env, raw)
};
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)
};
}