]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_mir/src/lib.rs
Auto merge of #85815 - YuhanLiin:buf-read-data-left, r=m-ou-se
[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 #![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 #![recursion_limit = "256"]
33
34 #[macro_use]
35 extern crate tracing;
36 #[macro_use]
37 extern crate rustc_middle;
38
39 mod borrow_check;
40 pub mod const_eval;
41 pub mod dataflow;
42 pub mod interpret;
43 pub mod monomorphize;
44 mod shim;
45 pub mod transform;
46 pub mod util;
47
48 use rustc_middle::ty::query::Providers;
49
50 pub fn provide(providers: &mut Providers) {
51     borrow_check::provide(providers);
52     const_eval::provide(providers);
53     shim::provide(providers);
54     transform::provide(providers);
55     monomorphize::partitioning::provide(providers);
56     monomorphize::polymorphize::provide(providers);
57     providers.eval_to_const_value_raw = const_eval::eval_to_const_value_raw_provider;
58     providers.eval_to_allocation_raw = const_eval::eval_to_allocation_raw_provider;
59     providers.const_caller_location = const_eval::const_caller_location;
60     providers.mir_callgraph_reachable = transform::inline::cycle::mir_callgraph_reachable;
61     providers.mir_inliner_callees = transform::inline::cycle::mir_inliner_callees;
62     providers.destructure_const = |tcx, param_env_and_value| {
63         let (param_env, value) = param_env_and_value.into_parts();
64         const_eval::destructure_const(tcx, param_env, value)
65     };
66     providers.const_to_valtree = |tcx, param_env_and_value| {
67         let (param_env, raw) = param_env_and_value.into_parts();
68         const_eval::const_to_valtree(tcx, param_env, raw)
69     };
70     providers.deref_const = |tcx, param_env_and_value| {
71         let (param_env, value) = param_env_and_value.into_parts();
72         const_eval::deref_const(tcx, param_env, value)
73     };
74 }