]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc/mir/mono.rs
Run `rustfmt --file-lines ...` for changes from previous commits.
[rust.git] / src / librustc / mir / mono.rs
index 79228a5c56f2d3fa016c5a114526b8b95a474e36..cf1126efc0f86e5d01caa974c14ed9acdc3e5a00 100644 (file)
@@ -48,7 +48,7 @@ pub enum MonoItem<'tcx> {
 }
 
 impl<'tcx> MonoItem<'tcx> {
-    pub fn size_estimate<'a>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> usize {
+    pub fn size_estimate(&self, tcx: TyCtxt<'tcx, 'tcx>) -> usize {
         match *self {
             MonoItem::Fn(instance) => {
                 // Estimate the size of a function based on how many statements
@@ -72,7 +72,7 @@ pub fn is_generic_fn(&self) -> bool {
         }
     }
 
-    pub fn symbol_name(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> SymbolName {
+    pub fn symbol_name(&self, tcx: TyCtxt<'tcx, 'tcx>) -> SymbolName {
         match *self {
             MonoItem::Fn(instance) => tcx.symbol_name(instance),
             MonoItem::Static(def_id) => {
@@ -87,9 +87,7 @@ pub fn symbol_name(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> SymbolName {
         }
     }
 
-    pub fn instantiation_mode(&self,
-                          tcx: TyCtxt<'a, 'tcx, 'tcx>)
-                          -> InstantiationMode {
+    pub fn instantiation_mode(&self, tcx: TyCtxt<'tcx, 'tcx>) -> InstantiationMode {
         let inline_in_all_cgus =
             tcx.sess.opts.debugging_opts.inline_in_all_cgus.unwrap_or_else(|| {
                 tcx.sess.opts.optimize != OptLevel::No
@@ -133,7 +131,7 @@ pub fn instantiation_mode(&self,
         }
     }
 
-    pub fn explicit_linkage(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Option<Linkage> {
+    pub fn explicit_linkage(&self, tcx: TyCtxt<'tcx, 'tcx>) -> Option<Linkage> {
         let def_id = match *self {
             MonoItem::Fn(ref instance) => instance.def_id(),
             MonoItem::Static(def_id) => def_id,
@@ -169,7 +167,7 @@ pub fn explicit_linkage(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Option<Linkage> {
     /// Similarly, if a vtable method has such a signature, and therefore can't
     /// be used, we can just not emit it and have a placeholder (a null pointer,
     /// which will never be accessed) in its place.
-    pub fn is_instantiable(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> bool {
+    pub fn is_instantiable(&self, tcx: TyCtxt<'tcx, 'tcx>) -> bool {
         debug!("is_instantiable({:?})", self);
         let (def_id, substs) = match *self {
             MonoItem::Fn(ref instance) => (instance.def_id(), instance.substs),
@@ -181,7 +179,7 @@ pub fn is_instantiable(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> bool {
         tcx.substitute_normalize_and_test_predicates((def_id, &substs))
     }
 
-    pub fn to_string(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, debug: bool) -> String {
+    pub fn to_string(&self, tcx: TyCtxt<'tcx, 'tcx>, debug: bool) -> String {
         return match *self {
             MonoItem::Fn(instance) => {
                 to_string_internal(tcx, "fn ", instance, debug)
@@ -195,11 +193,12 @@ pub fn to_string(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, debug: bool) -> String {
             }
         };
 
-        fn to_string_internal<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
-                                        prefix: &str,
-                                        instance: Instance<'tcx>,
-                                        debug: bool)
-                                        -> String {
+        fn to_string_internal<'tcx>(
+            tcx: TyCtxt<'tcx, 'tcx>,
+            prefix: &str,
+            instance: Instance<'tcx>,
+            debug: bool,
+        ) -> String {
             let mut result = String::with_capacity(32);
             result.push_str(prefix);
             let printer = DefPathBasedNames::new(tcx, false, false);
@@ -208,7 +207,7 @@ fn to_string_internal<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
         }
     }
 
-    pub fn local_span(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Option<Span> {
+    pub fn local_span(&self, tcx: TyCtxt<'tcx, 'tcx>) -> Option<Span> {
         match *self {
             MonoItem::Fn(Instance { def, .. }) => {
                 tcx.hir().as_local_hir_id(def.def_id())
@@ -334,7 +333,7 @@ pub fn mangle_name(human_readable_name: &str) -> String {
         base_n::encode(hash, base_n::CASE_INSENSITIVE)
     }
 
-    pub fn estimate_size<'a>(&mut self, tcx: TyCtxt<'a, 'tcx, 'tcx>) {
+    pub fn estimate_size(&mut self, tcx: TyCtxt<'tcx, 'tcx>) {
         // Estimate the size of a codegen unit as (approximately) the number of MIR
         // statements it corresponds to.
         self.size_estimate = Some(self.items.keys().map(|mi| mi.size_estimate(tcx)).sum());
@@ -360,7 +359,7 @@ pub fn work_product_id(&self) -> WorkProductId {
         WorkProductId::from_cgu_name(&self.name().as_str())
     }
 
-    pub fn work_product(&self, tcx: TyCtxt<'_, '_, '_>) -> WorkProduct {
+    pub fn work_product(&self, tcx: TyCtxt<'_, '_>) -> WorkProduct {
         let work_product_id = self.work_product_id();
         tcx.dep_graph
            .previous_work_product(&work_product_id)
@@ -369,17 +368,16 @@ pub fn work_product(&self, tcx: TyCtxt<'_, '_, '_>) -> WorkProduct {
             })
     }
 
-    pub fn items_in_deterministic_order<'a>(&self,
-                                        tcx: TyCtxt<'a, 'tcx, 'tcx>)
-                                        -> Vec<(MonoItem<'tcx>,
-                                                (Linkage, Visibility))> {
+    pub fn items_in_deterministic_order(
+        &self,
+        tcx: TyCtxt<'tcx, 'tcx>,
+    ) -> Vec<(MonoItem<'tcx>, (Linkage, Visibility))> {
         // The codegen tests rely on items being process in the same order as
         // they appear in the file, so for local items, we sort by node_id first
         #[derive(PartialEq, Eq, PartialOrd, Ord)]
         pub struct ItemSortKey(Option<HirId>, SymbolName);
 
-        fn item_sort_key<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
-                                   item: MonoItem<'tcx>) -> ItemSortKey {
+        fn item_sort_key<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, item: MonoItem<'tcx>) -> ItemSortKey {
             ItemSortKey(match item {
                 MonoItem::Fn(ref instance) => {
                     match instance.def {
@@ -415,7 +413,7 @@ fn item_sort_key<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
         items
     }
 
-    pub fn codegen_dep_node(&self, tcx: TyCtxt<'_, 'tcx, 'tcx>) -> DepNode {
+    pub fn codegen_dep_node(&self, tcx: TyCtxt<'tcx, 'tcx>) -> DepNode {
         DepNode::new(tcx, DepConstructor::CompileCodegenUnit(self.name().clone()))
     }
 }
@@ -445,14 +443,13 @@ fn hash_stable<W: StableHasherResult>(&self,
     }
 }
 
-pub struct CodegenUnitNameBuilder<'a, 'gcx: 'tcx, 'tcx: 'a> {
-    tcx: TyCtxt<'a, 'gcx, 'tcx>,
+pub struct CodegenUnitNameBuilder<'gcx, 'tcx> {
+    tcx: TyCtxt<'gcx, 'tcx>,
     cache: FxHashMap<CrateNum, String>,
 }
 
-impl<'a, 'gcx: 'tcx, 'tcx: 'a> CodegenUnitNameBuilder<'a, 'gcx, 'tcx> {
-
-    pub fn new(tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Self {
+impl CodegenUnitNameBuilder<'gcx, 'tcx> {
+    pub fn new(tcx: TyCtxt<'gcx, 'tcx>) -> Self {
         CodegenUnitNameBuilder {
             tcx,
             cache: Default::default(),