]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_middle/src/middle/mod.rs
Move ty::print methods to Drop-based scope guards
[rust.git] / compiler / rustc_middle / src / middle / mod.rs
1 pub mod codegen_fn_attrs;
2 pub mod dependency_format;
3 pub mod exported_symbols;
4 pub mod lang_items;
5 pub mod lib_features {
6     use rustc_data_structures::fx::{FxHashMap, FxHashSet};
7     use rustc_span::symbol::Symbol;
8
9     #[derive(HashStable, Debug)]
10     pub struct LibFeatures {
11         // A map from feature to stabilisation version.
12         pub stable: FxHashMap<Symbol, Symbol>,
13         pub unstable: FxHashSet<Symbol>,
14     }
15
16     impl LibFeatures {
17         pub fn to_vec(&self) -> Vec<(Symbol, Option<Symbol>)> {
18             let mut all_features: Vec<_> = self
19                 .stable
20                 .iter()
21                 .map(|(f, s)| (*f, Some(*s)))
22                 .chain(self.unstable.iter().map(|f| (*f, None)))
23                 .collect();
24             all_features.sort_unstable_by(|a, b| a.0.as_str().partial_cmp(b.0.as_str()).unwrap());
25             all_features
26         }
27     }
28 }
29 pub mod limits;
30 pub mod privacy;
31 pub mod region;
32 pub mod resolve_lifetime;
33 pub mod stability;
34
35 pub fn provide(providers: &mut crate::ty::query::Providers) {
36     limits::provide(providers);
37 }