]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_mir/src/lib.rs
Auto merge of #87465 - audunhalland:refactor_typeck_primary_body_of, r=eddyb
[rust.git] / compiler / rustc_mir / src / lib.rs
1 /*!
2
3 Rust MIR: a lowered representation of Rust.
4
5 */
6
7 #![feature(nll)]
8 #![feature(in_band_lifetimes)]
9 #![feature(array_windows)]
10 #![feature(assert_matches)]
11 #![cfg_attr(bootstrap, feature(bindings_after_at))]
12 #![feature(bool_to_option)]
13 #![feature(box_patterns)]
14 #![feature(box_syntax)]
15 #![feature(crate_visibility_modifier)]
16 #![feature(decl_macro)]
17 #![feature(exact_size_is_empty)]
18 #![feature(format_args_capture)]
19 #![feature(iter_zip)]
20 #![feature(never_type)]
21 #![feature(map_try_insert)]
22 #![feature(min_specialization)]
23 #![feature(slice_ptr_get)]
24 #![feature(trusted_len)]
25 #![feature(try_blocks)]
26 #![feature(associated_type_defaults)]
27 #![feature(stmt_expr_attributes)]
28 #![feature(trait_alias)]
29 #![feature(option_get_or_insert_default)]
30 #![feature(once_cell)]
31 #![feature(control_flow_enum)]
32 #![feature(try_reserve)]
33 #![feature(try_reserve_kind)]
34 #![recursion_limit = "256"]
35
36 #[macro_use]
37 extern crate tracing;
38 #[macro_use]
39 extern crate rustc_middle;
40
41 mod borrow_check;
42 pub mod const_eval;
43 pub mod dataflow;
44 pub mod interpret;
45 pub mod monomorphize;
46 mod shim;
47 pub mod transform;
48 pub mod util;
49
50 use rustc_middle::ty::query::Providers;
51
52 pub fn provide(providers: &mut Providers) {
53     borrow_check::provide(providers);
54     const_eval::provide(providers);
55     shim::provide(providers);
56     transform::provide(providers);
57     monomorphize::partitioning::provide(providers);
58     monomorphize::polymorphize::provide(providers);
59     providers.eval_to_const_value_raw = const_eval::eval_to_const_value_raw_provider;
60     providers.eval_to_allocation_raw = const_eval::eval_to_allocation_raw_provider;
61     providers.const_caller_location = const_eval::const_caller_location;
62     providers.mir_callgraph_reachable = transform::inline::cycle::mir_callgraph_reachable;
63     providers.mir_inliner_callees = transform::inline::cycle::mir_inliner_callees;
64     providers.destructure_const = |tcx, param_env_and_value| {
65         let (param_env, value) = param_env_and_value.into_parts();
66         const_eval::destructure_const(tcx, param_env, value)
67     };
68     providers.const_to_valtree = |tcx, param_env_and_value| {
69         let (param_env, raw) = param_env_and_value.into_parts();
70         const_eval::const_to_valtree(tcx, param_env, raw)
71     };
72     providers.deref_const = |tcx, param_env_and_value| {
73         let (param_env, value) = param_env_and_value.into_parts();
74         const_eval::deref_const(tcx, param_env, value)
75     };
76 }