]> git.lizzy.rs Git - rust.git/blob - src/librustc_mir/lib.rs
Auto merge of #53384 - gootorov:use-servo-smallvec, r=michaelwoerister
[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 #![cfg_attr(not(stage0), feature(nll))]
18 #![feature(infer_outlives_requirements)]
19 #![feature(in_band_lifetimes)]
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(const_fn)]
26 #![feature(core_intrinsics)]
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(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
41 #![recursion_limit="256"]
42
43 extern crate arena;
44
45 #[macro_use]
46 extern crate bitflags;
47 #[macro_use] extern crate log;
48 extern crate either;
49 extern crate graphviz as dot;
50 extern crate polonius_engine;
51 #[macro_use]
52 extern crate rustc;
53 #[macro_use] extern crate rustc_data_structures;
54 extern crate serialize as rustc_serialize;
55 extern crate rustc_errors;
56 #[macro_use]
57 extern crate syntax;
58 extern crate syntax_pos;
59 extern crate rustc_target;
60 extern crate log_settings;
61 extern crate rustc_apfloat;
62 extern crate byteorder;
63 extern crate core;
64 extern crate smallvec;
65
66 // Once we can use edition 2018 in the compiler,
67 // replace this with real try blocks.
68 macro_rules! try_block {
69     ($($inside:tt)*) => (
70         (||{ ::std::ops::Try::from_ok({ $($inside)* }) })()
71     )
72 }
73
74 mod diagnostics;
75
76 mod borrow_check;
77 mod build;
78 mod dataflow;
79 mod hair;
80 mod shim;
81 pub mod transform;
82 pub mod util;
83 pub mod interpret;
84 pub mod monomorphize;
85
86 pub use hair::pattern::check_crate as matchck_crate;
87 use rustc::ty::query::Providers;
88
89 pub fn provide(providers: &mut Providers) {
90     borrow_check::provide(providers);
91     shim::provide(providers);
92     transform::provide(providers);
93     providers.const_eval = interpret::const_eval_provider;
94     providers.const_to_allocation = interpret::const_to_allocation_provider;
95     providers.check_match = hair::pattern::check_match;
96 }
97
98 __build_diagnostic_array! { librustc_mir, DIAGNOSTICS }