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
|
|
|
|
|
|
|
*/
|
|
|
|
|
2021-03-04 06:06:01 -06: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)]
|
2020-12-30 11:48:40 -06:00
|
|
|
#![feature(control_flow_enum)]
|
2018-04-06 14:18:01 -05:00
|
|
|
#![feature(crate_visibility_modifier)]
|
2020-04-27 12:01:30 -05:00
|
|
|
#![feature(decl_macro)]
|
2020-08-28 01:02:46 -05:00
|
|
|
#![feature(exact_size_is_empty)]
|
2020-12-30 11:48:40 -06:00
|
|
|
#![feature(in_band_lifetimes)]
|
2021-03-08 17:32:41 -06:00
|
|
|
#![feature(iter_zip)]
|
2021-10-15 20:45:14 -05:00
|
|
|
#![feature(let_else)]
|
2021-03-04 06:06:01 -06:00
|
|
|
#![feature(map_try_insert)]
|
2020-05-09 06:59:21 -05:00
|
|
|
#![feature(min_specialization)]
|
2021-05-16 11:53:20 -05:00
|
|
|
#![feature(slice_ptr_get)]
|
2021-03-10 08:48:09 -06:00
|
|
|
#![feature(option_get_or_insert_default)]
|
2020-12-30 11:48:40 -06:00
|
|
|
#![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;
|
2015-11-10 14:38:36 -06:00
|
|
|
pub mod transform;
|
2017-03-09 12:10:05 -06:00
|
|
|
pub mod util;
|
2016-09-15 20:18:40 -05:00
|
|
|
|
2020-03-29 09:41:09 -05:00
|
|
|
use rustc_middle::ty::query::Providers;
|
2017-02-19 19:55:28 -06:00
|
|
|
|
2020-07-05 15:00:14 -05:00
|
|
|
pub fn provide(providers: &mut Providers) {
|
2020-01-01 11:06:00 -06:00
|
|
|
const_eval::provide(providers);
|
2020-09-19 03:57:14 -05:00
|
|
|
providers.eval_to_const_value_raw = const_eval::eval_to_const_value_raw_provider;
|
2020-08-20 11:55:07 -05:00
|
|
|
providers.eval_to_allocation_raw = const_eval::eval_to_allocation_raw_provider;
|
2019-10-24 19:35:02 -05:00
|
|
|
providers.const_caller_location = const_eval::const_caller_location;
|
2020-01-05 09:46:44 -06:00
|
|
|
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)
|
2020-01-10 20:22:36 -06:00
|
|
|
};
|
2021-02-22 08:09:24 -06:00
|
|
|
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)
|
|
|
|
};
|
2020-07-01 04:41:38 -05:00
|
|
|
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)
|
|
|
|
};
|
2017-03-14 14:22:38 -05:00
|
|
|
}
|