]> git.lizzy.rs Git - rust.git/blob - src/librustc_mir/lib.rs
aaa97e337265331ca88cea0774cf109902206553
[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 #![cfg_attr(stage0, 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 #![feature(exhaustive_patterns)]
29 #![feature(range_contains)]
30 #![feature(rustc_diagnostic_macros)]
31 #![feature(rustc_attrs)]
32 #![feature(never_type)]
33 #![feature(specialization)]
34 #![feature(try_trait)]
35 #![feature(unicode_internals)]
36 #![feature(step_trait)]
37 #![feature(slice_concat_ext)]
38 #![feature(if_while_or_patterns)]
39 #![feature(try_from)]
40 #![feature(reverse_bits)]
41 #![feature(underscore_imports)]
42
43 #![recursion_limit="256"]
44
45 extern crate arena;
46
47 #[macro_use]
48 extern crate bitflags;
49 #[macro_use] extern crate log;
50 extern crate either;
51 extern crate graphviz as dot;
52 extern crate polonius_engine;
53 #[macro_use]
54 extern crate rustc;
55 #[macro_use] extern crate rustc_data_structures;
56 extern crate serialize as rustc_serialize;
57 extern crate rustc_errors;
58 #[macro_use]
59 extern crate syntax;
60 extern crate syntax_pos;
61 extern crate rustc_target;
62 extern crate log_settings;
63 extern crate rustc_apfloat;
64 extern crate byteorder;
65 extern crate core;
66 extern crate smallvec;
67
68 // Once we can use edition 2018 in the compiler,
69 // replace this with real try blocks.
70 macro_rules! try_block {
71     ($($inside:tt)*) => (
72         (||{ ::std::ops::Try::from_ok({ $($inside)* }) })()
73     )
74 }
75
76 mod diagnostics;
77
78 mod borrow_check;
79 mod build;
80 mod dataflow;
81 mod hair;
82 mod lints;
83 mod shim;
84 pub mod transform;
85 pub mod util;
86 pub mod interpret;
87 pub mod monomorphize;
88 pub mod const_eval;
89
90 pub use hair::pattern::check_crate as matchck_crate;
91 use rustc::ty::query::Providers;
92
93 pub fn provide(providers: &mut Providers) {
94     borrow_check::provide(providers);
95     shim::provide(providers);
96     transform::provide(providers);
97     providers.const_eval = const_eval::const_eval_provider;
98     providers.const_eval_raw = const_eval::const_eval_raw_provider;
99     providers.check_match = hair::pattern::check_match;
100 }
101
102 __build_diagnostic_array! { librustc_mir, DIAGNOSTICS }