]> git.lizzy.rs Git - rust.git/blob - src/librustc_mir/lib.rs
Add a MIR transform to remove fake reads
[rust.git] / src / librustc_mir / lib.rs
1 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 /*!
12
13 Rust MIR: a lowered representation of Rust. Also: an experiment!
14
15 */
16
17 #![feature(nll)]
18 #![feature(in_band_lifetimes)]
19 #![feature(impl_header_lifetime_elision)]
20 #![feature(slice_patterns)]
21 #![feature(slice_sort_by_cached_key)]
22 #![feature(box_patterns)]
23 #![feature(box_syntax)]
24 #![feature(crate_visibility_modifier)]
25 #![feature(core_intrinsics)]
26 #![feature(const_fn)]
27 #![feature(decl_macro)]
28 #![cfg_attr(stage0, feature(macro_vis_matcher))]
29 #![feature(exhaustive_patterns)]
30 #![feature(range_contains)]
31 #![feature(rustc_diagnostic_macros)]
32 #![feature(rustc_attrs)]
33 #![cfg_attr(stage0, feature(attr_literals))]
34 #![feature(never_type)]
35 #![feature(specialization)]
36 #![feature(try_trait)]
37 #![feature(unicode_internals)]
38 #![feature(step_trait)]
39 #![feature(slice_concat_ext)]
40 #![feature(if_while_or_patterns)]
41 #![feature(try_from)]
42 #![feature(reverse_bits)]
43 #![feature(underscore_imports)]
44
45 #![recursion_limit="256"]
46
47 extern crate arena;
48
49 #[macro_use]
50 extern crate bitflags;
51 #[macro_use] extern crate log;
52 extern crate either;
53 extern crate graphviz as dot;
54 extern crate polonius_engine;
55 #[macro_use]
56 extern crate rustc;
57 #[macro_use] extern crate rustc_data_structures;
58 extern crate serialize as rustc_serialize;
59 extern crate rustc_errors;
60 #[macro_use]
61 extern crate syntax;
62 extern crate syntax_pos;
63 extern crate rustc_target;
64 extern crate log_settings;
65 extern crate rustc_apfloat;
66 extern crate byteorder;
67 extern crate core;
68 extern crate smallvec;
69
70 // Once we can use edition 2018 in the compiler,
71 // replace this with real try blocks.
72 macro_rules! try_block {
73     ($($inside:tt)*) => (
74         (||{ ::std::ops::Try::from_ok({ $($inside)* }) })()
75     )
76 }
77
78 mod diagnostics;
79
80 mod borrow_check;
81 mod build;
82 mod dataflow;
83 mod hair;
84 mod shim;
85 pub mod transform;
86 pub mod util;
87 pub mod interpret;
88 pub mod monomorphize;
89 pub mod const_eval;
90
91 pub use hair::pattern::check_crate as matchck_crate;
92 use rustc::ty::query::Providers;
93
94 pub fn provide(providers: &mut Providers) {
95     borrow_check::provide(providers);
96     shim::provide(providers);
97     transform::provide(providers);
98     providers.const_eval = const_eval::const_eval_provider;
99     providers.check_match = hair::pattern::check_match;
100 }
101
102 __build_diagnostic_array! { librustc_mir, DIAGNOSTICS }