]> git.lizzy.rs Git - rust.git/blob - src/librustc/middle/mod.rs
Update const_forget.rs
[rust.git] / src / librustc / middle / mod.rs
1 pub mod codegen_fn_attrs;
2 pub mod cstore;
3 pub mod dependency_format;
4 pub mod exported_symbols;
5 pub mod free_region;
6 pub mod lang_items;
7 pub mod lib_features {
8     use rustc_data_structures::fx::{FxHashMap, FxHashSet};
9     use rustc_span::symbol::Symbol;
10
11     #[derive(HashStable)]
12     pub struct LibFeatures {
13         // A map from feature to stabilisation version.
14         pub stable: FxHashMap<Symbol, Symbol>,
15         pub unstable: FxHashSet<Symbol>,
16     }
17
18     impl LibFeatures {
19         pub fn to_vec(&self) -> Vec<(Symbol, Option<Symbol>)> {
20             let mut all_features: Vec<_> = self
21                 .stable
22                 .iter()
23                 .map(|(f, s)| (*f, Some(*s)))
24                 .chain(self.unstable.iter().map(|f| (*f, None)))
25                 .collect();
26             all_features.sort_unstable_by_key(|f| f.0.as_str());
27             all_features
28         }
29     }
30 }
31 pub mod privacy;
32 pub mod recursion_limit;
33 pub mod region;
34 pub mod resolve_lifetime;
35 pub mod stability;