diff options
| author | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2019-06-14 00:48:52 +0300 |
|---|---|---|
| committer | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2019-06-14 18:58:23 +0300 |
| commit | f3f9d6dfd92dfaeb14df891ad27b2531809dd734 (patch) | |
| tree | cc6b503f85dcfa52dde1c95b52a35c3b94569a84 /src/librustc/middle | |
| parent | 0e4a56b4b04ea98bb16caada30cb2418dd06e250 (diff) | |
| download | rust-f3f9d6dfd92dfaeb14df891ad27b2531809dd734.tar.gz rust-f3f9d6dfd92dfaeb14df891ad27b2531809dd734.zip | |
Unify all uses of 'gcx and 'tcx.
Diffstat (limited to 'src/librustc/middle')
| -rw-r--r-- | src/librustc/middle/cstore.rs | 4 | ||||
| -rw-r--r-- | src/librustc/middle/dead.rs | 16 | ||||
| -rw-r--r-- | src/librustc/middle/dependency_format.rs | 10 | ||||
| -rw-r--r-- | src/librustc/middle/entry.rs | 6 | ||||
| -rw-r--r-- | src/librustc/middle/exported_symbols.rs | 8 | ||||
| -rw-r--r-- | src/librustc/middle/expr_use_visitor.rs | 20 | ||||
| -rw-r--r-- | src/librustc/middle/free_region.rs | 8 | ||||
| -rw-r--r-- | src/librustc/middle/intrinsicck.rs | 8 | ||||
| -rw-r--r-- | src/librustc/middle/lang_items.rs | 8 | ||||
| -rw-r--r-- | src/librustc/middle/lib_features.rs | 6 | ||||
| -rw-r--r-- | src/librustc/middle/liveness.rs | 8 | ||||
| -rw-r--r-- | src/librustc/middle/mem_categorization.rs | 24 | ||||
| -rw-r--r-- | src/librustc/middle/reachable.rs | 10 | ||||
| -rw-r--r-- | src/librustc/middle/region.rs | 14 | ||||
| -rw-r--r-- | src/librustc/middle/resolve_lifetime.rs | 18 | ||||
| -rw-r--r-- | src/librustc/middle/stability.rs | 18 | ||||
| -rw-r--r-- | src/librustc/middle/weak_lang_items.rs | 10 |
17 files changed, 98 insertions, 98 deletions
diff --git a/src/librustc/middle/cstore.rs b/src/librustc/middle/cstore.rs index f258f06b87d..2e9e1ac582f 100644 --- a/src/librustc/middle/cstore.rs +++ b/src/librustc/middle/cstore.rs @@ -211,7 +211,7 @@ pub trait CrateStore { fn crates_untracked(&self) -> Vec<CrateNum>; // utility functions - fn encode_metadata<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx>) -> EncodedMetadata; + fn encode_metadata<'tcx>(&self, tcx: TyCtxt<'tcx>) -> EncodedMetadata; fn metadata_encoding_version(&self) -> &[u8]; } @@ -226,7 +226,7 @@ pub type CrateStoreDyn = dyn CrateStore + sync::Sync; // In order to get this left-to-right dependency ordering, we perform a // topological sort of all crates putting the leaves at the right-most // positions. -pub fn used_crates(tcx: TyCtxt<'_, '_>, prefer: LinkagePreference) -> Vec<(CrateNum, LibSource)> { +pub fn used_crates(tcx: TyCtxt<'_>, prefer: LinkagePreference) -> Vec<(CrateNum, LibSource)> { let mut libs = tcx.crates() .iter() .cloned() diff --git a/src/librustc/middle/dead.rs b/src/librustc/middle/dead.rs index 18e19e802e8..0356e7e1072 100644 --- a/src/librustc/middle/dead.rs +++ b/src/librustc/middle/dead.rs @@ -26,7 +26,7 @@ use syntax_pos; // explored. For example, if it's a live Node::Item that is a // function, then we should explore its block to check for codes that // may need to be marked as live. -fn should_explore<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, hir_id: hir::HirId) -> bool { +fn should_explore<'tcx>(tcx: TyCtxt<'tcx>, hir_id: hir::HirId) -> bool { match tcx.hir().find_by_hir_id(hir_id) { Some(Node::Item(..)) | Some(Node::ImplItem(..)) | @@ -40,7 +40,7 @@ fn should_explore<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, hir_id: hir::HirId) -> bool { struct MarkSymbolVisitor<'a, 'tcx: 'a> { worklist: Vec<hir::HirId>, - tcx: TyCtxt<'tcx, 'tcx>, + tcx: TyCtxt<'tcx>, tables: &'a ty::TypeckTables<'tcx>, live_symbols: FxHashSet<hir::HirId>, repr_has_repr_c: bool, @@ -302,7 +302,7 @@ impl<'a, 'tcx> Visitor<'tcx> for MarkSymbolVisitor<'a, 'tcx> { } fn has_allow_dead_code_or_lang_attr( - tcx: TyCtxt<'_, '_>, + tcx: TyCtxt<'_>, id: hir::HirId, attrs: &[ast::Attribute], ) -> bool { @@ -354,7 +354,7 @@ fn has_allow_dead_code_or_lang_attr( struct LifeSeeder<'k, 'tcx: 'k> { worklist: Vec<hir::HirId>, krate: &'k hir::Crate, - tcx: TyCtxt<'tcx, 'tcx>, + tcx: TyCtxt<'tcx>, // see `MarkSymbolVisitor::struct_constructors` struct_constructors: FxHashMap<hir::HirId, hir::HirId>, } @@ -425,7 +425,7 @@ impl<'v, 'k, 'tcx> ItemLikeVisitor<'v> for LifeSeeder<'k, 'tcx> { } fn create_and_seed_worklist<'tcx>( - tcx: TyCtxt<'tcx, 'tcx>, + tcx: TyCtxt<'tcx>, access_levels: &privacy::AccessLevels, krate: &hir::Crate, ) -> (Vec<hir::HirId>, FxHashMap<hir::HirId, hir::HirId>) { @@ -453,7 +453,7 @@ fn create_and_seed_worklist<'tcx>( } fn find_live<'tcx>( - tcx: TyCtxt<'tcx, 'tcx>, + tcx: TyCtxt<'tcx>, access_levels: &privacy::AccessLevels, krate: &hir::Crate, ) -> FxHashSet<hir::HirId> { @@ -474,7 +474,7 @@ fn find_live<'tcx>( } struct DeadVisitor<'tcx> { - tcx: TyCtxt<'tcx, 'tcx>, + tcx: TyCtxt<'tcx>, live_symbols: FxHashSet<hir::HirId>, } @@ -662,7 +662,7 @@ impl Visitor<'tcx> for DeadVisitor<'tcx> { } } -pub fn check_crate<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) { +pub fn check_crate<'tcx>(tcx: TyCtxt<'tcx>) { let access_levels = &tcx.privacy_access_levels(LOCAL_CRATE); let krate = tcx.hir().krate(); let live_symbols = find_live(tcx, access_levels, krate); diff --git a/src/librustc/middle/dependency_format.rs b/src/librustc/middle/dependency_format.rs index 2f6a3f2f027..879da6413e2 100644 --- a/src/librustc/middle/dependency_format.rs +++ b/src/librustc/middle/dependency_format.rs @@ -81,7 +81,7 @@ pub enum Linkage { Dynamic, } -pub fn calculate<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) { +pub fn calculate<'tcx>(tcx: TyCtxt<'tcx>) { let sess = &tcx.sess; let fmts = sess.crate_types.borrow().iter().map(|&ty| { let linkage = calculate_type(tcx, ty); @@ -92,7 +92,7 @@ pub fn calculate<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) { sess.dependency_formats.set(fmts); } -fn calculate_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, ty: config::CrateType) -> DependencyList { +fn calculate_type<'tcx>(tcx: TyCtxt<'tcx>, ty: config::CrateType) -> DependencyList { let sess = &tcx.sess; if !sess.opts.output_types.should_codegen() { @@ -241,7 +241,7 @@ fn calculate_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, ty: config::CrateType) -> Depen } fn add_library( - tcx: TyCtxt<'_, '_>, + tcx: TyCtxt<'_>, cnum: CrateNum, link: LinkagePreference, m: &mut FxHashMap<CrateNum, LinkagePreference>, @@ -267,7 +267,7 @@ fn add_library( } } -fn attempt_static<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) -> Option<DependencyList> { +fn attempt_static<'tcx>(tcx: TyCtxt<'tcx>) -> Option<DependencyList> { let sess = &tcx.sess; let crates = cstore::used_crates(tcx, RequireStatic); if !crates.iter().by_ref().all(|&(_, ref p)| p.is_some()) { @@ -324,7 +324,7 @@ fn activate_injected_dep(injected: Option<CrateNum>, // After the linkage for a crate has been determined we need to verify that // there's only going to be one allocator in the output. -fn verify_ok<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, list: &[Linkage]) { +fn verify_ok<'tcx>(tcx: TyCtxt<'tcx>, list: &[Linkage]) { let sess = &tcx.sess; if list.len() == 0 { return diff --git a/src/librustc/middle/entry.rs b/src/librustc/middle/entry.rs index 024196e3564..704be9600fa 100644 --- a/src/librustc/middle/entry.rs +++ b/src/librustc/middle/entry.rs @@ -47,7 +47,7 @@ impl<'a, 'tcx> ItemLikeVisitor<'tcx> for EntryContext<'a, 'tcx> { } } -fn entry_fn(tcx: TyCtxt<'_, '_>, cnum: CrateNum) -> Option<(DefId, EntryFnType)> { +fn entry_fn(tcx: TyCtxt<'_>, cnum: CrateNum) -> Option<(DefId, EntryFnType)> { assert_eq!(cnum, LOCAL_CRATE); let any_exe = tcx.sess.crate_types.borrow().iter().any(|ty| { @@ -141,7 +141,7 @@ fn find_item(item: &Item, ctxt: &mut EntryContext<'_, '_>, at_root: bool) { } fn configure_main( - tcx: TyCtxt<'_, '_>, + tcx: TyCtxt<'_>, visitor: &EntryContext<'_, '_>, ) -> Option<(DefId, EntryFnType)> { if let Some((hir_id, _)) = visitor.start_fn { @@ -179,7 +179,7 @@ fn configure_main( } } -pub fn find_entry_point(tcx: TyCtxt<'_, '_>) -> Option<(DefId, EntryFnType)> { +pub fn find_entry_point(tcx: TyCtxt<'_>) -> Option<(DefId, EntryFnType)> { tcx.entry_fn(LOCAL_CRATE) } diff --git a/src/librustc/middle/exported_symbols.rs b/src/librustc/middle/exported_symbols.rs index 9e7af280408..78a3e3ff268 100644 --- a/src/librustc/middle/exported_symbols.rs +++ b/src/librustc/middle/exported_symbols.rs @@ -38,7 +38,7 @@ pub enum ExportedSymbol<'tcx> { } impl<'tcx> ExportedSymbol<'tcx> { - pub fn symbol_name(&self, tcx: TyCtxt<'tcx, '_>) -> ty::SymbolName { + pub fn symbol_name(&self, tcx: TyCtxt<'tcx>) -> ty::SymbolName { match *self { ExportedSymbol::NonGeneric(def_id) => { tcx.symbol_name(ty::Instance::mono(tcx, def_id)) @@ -54,7 +54,7 @@ impl<'tcx> ExportedSymbol<'tcx> { pub fn compare_stable( &self, - tcx: TyCtxt<'tcx, '_>, + tcx: TyCtxt<'tcx>, other: &ExportedSymbol<'tcx>, ) -> cmp::Ordering { match *self { @@ -91,13 +91,13 @@ impl<'tcx> ExportedSymbol<'tcx> { } } -pub fn metadata_symbol_name(tcx: TyCtxt<'_, '_>) -> String { +pub fn metadata_symbol_name(tcx: TyCtxt<'_>) -> String { format!("rust_metadata_{}_{}", tcx.original_crate_name(LOCAL_CRATE), tcx.crate_disambiguator(LOCAL_CRATE).to_fingerprint().to_hex()) } -impl<'a, 'gcx> HashStable<StableHashingContext<'a>> for ExportedSymbol<'gcx> { +impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for ExportedSymbol<'tcx> { fn hash_stable<W: StableHasherResult>(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher<W>) { diff --git a/src/librustc/middle/expr_use_visitor.rs b/src/librustc/middle/expr_use_visitor.rs index 3ed926d7582..80c26c132f6 100644 --- a/src/librustc/middle/expr_use_visitor.rs +++ b/src/librustc/middle/expr_use_visitor.rs @@ -202,7 +202,7 @@ enum OverloadedCallType { } impl OverloadedCallType { - fn from_trait_id(tcx: TyCtxt<'_, '_>, trait_id: DefId) -> OverloadedCallType { + fn from_trait_id(tcx: TyCtxt<'_>, trait_id: DefId) -> OverloadedCallType { for &(maybe_function_trait, overloaded_call_type) in &[ (tcx.lang_items().fn_once_trait(), FnOnceOverloadedCall), (tcx.lang_items().fn_mut_trait(), FnMutOverloadedCall), @@ -219,7 +219,7 @@ impl OverloadedCallType { bug!("overloaded call didn't map to known function trait") } - fn from_method_id(tcx: TyCtxt<'_, '_>, method_id: DefId) -> OverloadedCallType { + fn from_method_id(tcx: TyCtxt<'_>, method_id: DefId) -> OverloadedCallType { let method = tcx.associated_item(method_id); OverloadedCallType::from_trait_id(tcx, method.container.id()) } @@ -229,8 +229,8 @@ impl OverloadedCallType { // The ExprUseVisitor type // // This is the code that actually walks the tree. -pub struct ExprUseVisitor<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { - mc: mc::MemCategorizationContext<'a, 'gcx, 'tcx>, +pub struct ExprUseVisitor<'a, 'tcx: 'a> { + mc: mc::MemCategorizationContext<'a, 'tcx>, delegate: &'a mut dyn Delegate<'tcx>, param_env: ty::ParamEnv<'tcx>, } @@ -254,7 +254,7 @@ macro_rules! return_if_err { ) } -impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx, 'tcx> { +impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> { /// Creates the ExprUseVisitor, configuring it with the various options provided: /// /// - `delegate` -- who receives the callbacks @@ -268,7 +268,7 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx, 'tcx> { /// See also `with_infer`, which is used *during* typeck. pub fn new( delegate: &'a mut (dyn Delegate<'tcx> + 'a), - tcx: TyCtxt<'tcx, 'tcx>, + tcx: TyCtxt<'tcx>, body_owner: DefId, param_env: ty::ParamEnv<'tcx>, region_scope_tree: &'a region::ScopeTree, @@ -287,9 +287,9 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx, 'tcx> { } } -impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> { +impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> { pub fn with_infer(delegate: &'a mut (dyn Delegate<'tcx>+'a), - infcx: &'a InferCtxt<'a, 'gcx, 'tcx>, + infcx: &'a InferCtxt<'a, 'tcx>, body_owner: DefId, param_env: ty::ParamEnv<'tcx>, region_scope_tree: &'a region::ScopeTree, @@ -333,7 +333,7 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> { self.consume_expr(&body.value); } - fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'tcx> { self.mc.tcx } @@ -974,7 +974,7 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> { } } -fn copy_or_move<'a, 'gcx, 'tcx>(mc: &mc::MemCategorizationContext<'a, 'gcx, 'tcx>, +fn copy_or_move<'a, 'tcx>(mc: &mc::MemCategorizationContext<'a, 'tcx>, param_env: ty::ParamEnv<'tcx>, cmt: &mc::cmt_<'tcx>, move_reason: MoveReason) diff --git a/src/librustc/middle/free_region.rs b/src/librustc/middle/free_region.rs index 74c50cabab0..a8a7df08469 100644 --- a/src/librustc/middle/free_region.rs +++ b/src/librustc/middle/free_region.rs @@ -15,8 +15,8 @@ use crate::ty::{self, TyCtxt, Region}; /// /// This stuff is a bit convoluted and should be refactored, but as we /// transition to NLL, it'll all go away anyhow. -pub struct RegionRelations<'a, 'gcx: 'tcx, 'tcx: 'a> { - pub tcx: TyCtxt<'gcx, 'tcx>, +pub struct RegionRelations<'a, 'tcx: 'a> { + pub tcx: TyCtxt<'tcx>, /// The context used to fetch the region maps. pub context: DefId, @@ -28,9 +28,9 @@ pub struct RegionRelations<'a, 'gcx: 'tcx, 'tcx: 'a> { pub free_regions: &'a FreeRegionMap<'tcx>, } -impl<'a, 'gcx, 'tcx> RegionRelations<'a, 'gcx, 'tcx> { +impl<'a, 'tcx> RegionRelations<'a, 'tcx> { pub fn new( - tcx: TyCtxt<'gcx, 'tcx>, + tcx: TyCtxt<'tcx>, context: DefId, region_scope_tree: &'a region::ScopeTree, free_regions: &'a FreeRegionMap<'tcx>, diff --git a/src/librustc/middle/intrinsicck.rs b/src/librustc/middle/intrinsicck.rs index d3ed818c4be..e8d68e0b7a7 100644 --- a/src/librustc/middle/intrinsicck.rs +++ b/src/librustc/middle/intrinsicck.rs @@ -10,7 +10,7 @@ use syntax_pos::{Span, sym}; use crate::hir::intravisit::{self, Visitor, NestedVisitorMap}; use crate::hir; -fn check_mod_intrinsics<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, module_def_id: DefId) { +fn check_mod_intrinsics<'tcx>(tcx: TyCtxt<'tcx>, module_def_id: DefId) { tcx.hir().visit_item_likes_in_module( module_def_id, &mut ItemVisitor { tcx }.as_deep_visitor() @@ -25,18 +25,18 @@ pub fn provide(providers: &mut Providers<'_>) { } struct ItemVisitor<'tcx> { - tcx: TyCtxt<'tcx, 'tcx>, + tcx: TyCtxt<'tcx>, } struct ExprVisitor<'tcx> { - tcx: TyCtxt<'tcx, 'tcx>, + tcx: TyCtxt<'tcx>, tables: &'tcx ty::TypeckTables<'tcx>, param_env: ty::ParamEnv<'tcx>, } /// If the type is `Option<T>`, it will return `T`, otherwise /// the type itself. Works on most `Option`-like types. -fn unpack_option_like<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, ty: Ty<'tcx>) -> Ty<'tcx> { +fn unpack_option_like<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> Ty<'tcx> { let (def, substs) = match ty.sty { ty::Adt(def, substs) => (def, substs), _ => return ty diff --git a/src/librustc/middle/lang_items.rs b/src/librustc/middle/lang_items.rs index 02163409b32..d7abdb8ecbe 100644 --- a/src/librustc/middle/lang_items.rs +++ b/src/librustc/middle/lang_items.rs @@ -106,7 +106,7 @@ impl LanguageItems { struct LanguageItemCollector<'tcx> { items: LanguageItems, - tcx: TyCtxt<'tcx, 'tcx>, + tcx: TyCtxt<'tcx>, /// A mapping from the name of the lang item to its order and the form it must be of. item_refs: FxHashMap<&'static str, (usize, Target)>, } @@ -160,7 +160,7 @@ impl ItemLikeVisitor<'v> for LanguageItemCollector<'tcx> { } impl LanguageItemCollector<'tcx> { - fn new(tcx: TyCtxt<'tcx, 'tcx>) -> LanguageItemCollector<'tcx> { + fn new(tcx: TyCtxt<'tcx>) -> LanguageItemCollector<'tcx> { let mut item_refs = FxHashMap::default(); $( item_refs.insert($name, ($variant as usize, $target)); )* @@ -217,7 +217,7 @@ pub fn extract(attrs: &[ast::Attribute]) -> Option<(Symbol, Span)> { } /// Traverse and collect all the lang items in all crates. -pub fn collect<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) -> LanguageItems { +pub fn collect<'tcx>(tcx: TyCtxt<'tcx>) -> LanguageItems { // Initialize the collector. let mut collector = LanguageItemCollector::new(tcx); @@ -402,7 +402,7 @@ language_item_table! { Rc, "rc", rc, Target::Struct; } -impl<'tcx, 'gcx> TyCtxt<'tcx, 'gcx> { +impl<'tcx> TyCtxt<'tcx> { /// Returns the `DefId` for a given `LangItem`. /// If not found, fatally abort compilation. pub fn require_lang_item(&self, lang_item: LangItem) -> DefId { diff --git a/src/librustc/middle/lib_features.rs b/src/librustc/middle/lib_features.rs index b05ede53d1c..9c131ce6342 100644 --- a/src/librustc/middle/lib_features.rs +++ b/src/librustc/middle/lib_features.rs @@ -38,12 +38,12 @@ impl LibFeatures { } pub struct LibFeatureCollector<'tcx> { - tcx: TyCtxt<'tcx, 'tcx>, + tcx: TyCtxt<'tcx>, lib_features: LibFeatures, } impl LibFeatureCollector<'tcx> { - fn new(tcx: TyCtxt<'tcx, 'tcx>) -> LibFeatureCollector<'tcx> { + fn new(tcx: TyCtxt<'tcx>) -> LibFeatureCollector<'tcx> { LibFeatureCollector { tcx, lib_features: LibFeatures::new(), @@ -142,7 +142,7 @@ impl Visitor<'tcx> for LibFeatureCollector<'tcx> { } } -pub fn collect<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) -> LibFeatures { +pub fn collect<'tcx>(tcx: TyCtxt<'tcx>) -> LibFeatures { let mut collector = LibFeatureCollector::new(tcx); intravisit::walk_crate(&mut collector, tcx.hir().krate()); collector.lib_features diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs index 92cb407f67d..260935a38d6 100644 --- a/src/librustc/middle/liveness.rs +++ b/src/librustc/middle/liveness.rs @@ -150,7 +150,7 @@ enum LiveNodeKind { ExitNode } -fn live_node_kind_to_string(lnk: LiveNodeKind, tcx: TyCtxt<'_, '_>) -> String { +fn live_node_kind_to_string(lnk: LiveNodeKind, tcx: TyCtxt<'_>) -> String { let cm = tcx.sess.source_map(); match lnk { UpvarNode(s) => { @@ -181,7 +181,7 @@ impl<'tcx> Visitor<'tcx> for IrMaps<'tcx> { fn visit_arm(&mut self, a: &'tcx hir::Arm) { visit_arm(self, a); } } -fn check_mod_liveness<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, module_def_id: DefId) { +fn check_mod_liveness<'tcx>(tcx: TyCtxt<'tcx>, module_def_id: DefId) { tcx.hir().visit_item_likes_in_module( module_def_id, &mut IrMaps::new(tcx, module_def_id).as_deep_visitor(), @@ -257,7 +257,7 @@ enum VarKind { } struct IrMaps<'tcx> { - tcx: TyCtxt<'tcx, 'tcx>, + tcx: TyCtxt<'tcx>, body_owner: DefId, num_live_nodes: usize, num_vars: usize, @@ -269,7 +269,7 @@ struct IrMaps<'tcx> { } impl IrMaps<'tcx> { - fn new(tcx: TyCtxt<'tcx, 'tcx>, body_owner: DefId) -> IrMaps<'tcx> { + fn new(tcx: TyCtxt<'tcx>, body_owner: DefId) -> IrMaps<'tcx> { IrMaps { tcx, body_owner, diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs index 4b5b901f470..bc87aa8f872 100644 --- a/src/librustc/middle/mem_categorization.rs +++ b/src/librustc/middle/mem_categorization.rs @@ -287,14 +287,14 @@ impl HirNode for hir::Pat { } #[derive(Clone)] -pub struct MemCategorizationContext<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { - pub tcx: TyCtxt<'gcx, 'tcx>, +pub struct MemCategorizationContext<'a, 'tcx> { + pub tcx: TyCtxt<'tcx>, pub body_owner: DefId, pub upvars: Option<&'tcx FxIndexMap<hir::HirId, hir::Upvar>>, pub region_scope_tree: &'a region::ScopeTree, pub tables: &'a ty::TypeckTables<'tcx>, rvalue_promotable_map: Option<&'tcx ItemLocalSet>, - infcx: Option<&'a InferCtxt<'a, 'gcx, 'tcx>>, + infcx: Option<&'a InferCtxt<'a, 'tcx>>, } pub type McResult<T> = Result<T, ()>; @@ -340,7 +340,7 @@ impl MutabilityCategory { } fn from_local( - tcx: TyCtxt<'_, '_>, + tcx: TyCtxt<'_>, tables: &ty::TypeckTables<'_>, id: ast::NodeId, ) -> MutabilityCategory { @@ -402,14 +402,14 @@ impl MutabilityCategory { } } -impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx, 'tcx> { +impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> { pub fn new( - tcx: TyCtxt<'tcx, 'tcx>, + tcx: TyCtxt<'tcx>, body_owner: DefId, region_scope_tree: &'a region::ScopeTree, tables: &'a ty::TypeckTables<'tcx>, rvalue_promotable_map: Option<&'tcx ItemLocalSet>, - ) -> MemCategorizationContext<'a, 'tcx, 'tcx> { + ) -> MemCategorizationContext<'a, 'tcx> { MemCategorizationContext { tcx, body_owner, @@ -422,7 +422,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx, 'tcx> { } } -impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> { +impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> { /// Creates a `MemCategorizationContext` during type inference. /// This is used during upvar analysis and a few other places. /// Because the typeck tables are not yet complete, the results @@ -432,11 +432,11 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> { /// temporaries may be overly conservative; /// - similarly, as the results of upvar analysis are not yet /// known, the results around upvar accesses may be incorrect. - pub fn with_infer(infcx: &'a InferCtxt<'a, 'gcx, 'tcx>, + pub fn with_infer(infcx: &'a InferCtxt<'a, 'tcx>, body_owner: DefId, region_scope_tree: &'a region::ScopeTree, tables: &'a ty::TypeckTables<'tcx>) - -> MemCategorizationContext<'a, 'gcx, 'tcx> { + -> MemCategorizationContext<'a, 'tcx> { let tcx = infcx.tcx; // Subtle: we can't do rvalue promotion analysis until the @@ -586,7 +586,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> { pub fn cat_expr(&self, expr: &hir::Expr) -> McResult<cmt_<'tcx>> { // This recursion helper avoids going through *too many* // adjustments, since *only* non-overloaded deref recurses. - fn helper<'a, 'gcx, 'tcx>(mc: &MemCategorizationContext<'a, 'gcx, 'tcx>, + fn helper<'a, 'tcx>(mc: &MemCategorizationContext<'a, 'tcx>, expr: &hir::Expr, adjustments: &[adjustment::Adjustment<'tcx>]) -> McResult<cmt_<'tcx>> { @@ -1518,7 +1518,7 @@ impl<'tcx> cmt_<'tcx> { } } - pub fn descriptive_string(&self, tcx: TyCtxt<'_, '_>) -> Cow<'static, str> { + pub fn descriptive_string(&self, tcx: TyCtxt<'_>) -> Cow<'static, str> { match self.cat { Categorization::StaticItem => { "static item".into() diff --git a/src/librustc/middle/reachable.rs b/src/librustc/middle/reachable.rs index b0068a191da..363ccd74c08 100644 --- a/src/librustc/middle/reachable.rs +++ b/src/librustc/middle/reachable.rs @@ -27,7 +27,7 @@ use crate::hir::intravisit; // Returns true if the given item must be inlined because it may be // monomorphized or it was marked with `#[inline]`. This will only return // true for functions. -fn item_might_be_inlined(tcx: TyCtxt<'tcx, 'tcx>, item: &hir::Item, attrs: CodegenFnAttrs) -> bool { +fn item_might_be_inlined(tcx: TyCtxt<'tcx>, item: &hir::Item, attrs: CodegenFnAttrs) -> bool { if attrs.requests_inline() { return true } @@ -43,7 +43,7 @@ fn item_might_be_inlined(tcx: TyCtxt<'tcx, 'tcx>, item: &hir::Item, attrs: Codeg } fn method_might_be_inlined<'tcx>( - tcx: TyCtxt<'tcx, 'tcx>, + tcx: TyCtxt<'tcx>, impl_item: &hir::ImplItem, impl_src: DefId, ) -> bool { @@ -67,7 +67,7 @@ fn method_might_be_inlined<'tcx>( // Information needed while computing reachability. struct ReachableContext<'a, 'tcx: 'a> { // The type context. - tcx: TyCtxt<'tcx, 'tcx>, + tcx: TyCtxt<'tcx>, tables: &'a ty::TypeckTables<'tcx>, // The set of items which must be exported in the linkage sense. reachable_symbols: HirIdSet, @@ -335,7 +335,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> { // trait items are used from inlinable code through method call syntax or UFCS, or their // trait is a lang item. struct CollectPrivateImplItemsVisitor<'a, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'tcx>, + tcx: TyCtxt<'tcx>, access_levels: &'a privacy::AccessLevels, worklist: &'a mut Vec<hir::HirId>, } @@ -391,7 +391,7 @@ impl<'a, 'tcx: 'a> ItemLikeVisitor<'tcx> for CollectPrivateImplItemsVisitor<'a, #[derive(Clone, HashStable)] pub struct ReachableSet(pub Lrc<HirIdSet>); -fn reachable_set<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, crate_num: CrateNum) -> ReachableSet { +fn reachable_set<'tcx>(tcx: TyCtxt<'tcx>, crate_num: CrateNum) -> ReachableSet { debug_assert!(crate_num == LOCAL_CRATE); let access_levels = &tcx.privacy_access_levels(LOCAL_CRATE); diff --git a/src/librustc/middle/region.rs b/src/librustc/middle/region.rs index 5968933721d..546d51e9124 100644 --- a/src/librustc/middle/region.rs +++ b/src/librustc/middle/region.rs @@ -169,7 +169,7 @@ impl Scope { self.id } - pub fn node_id(&self, tcx: TyCtxt<'_, '_>, scope_tree: &ScopeTree) -> ast::NodeId { + pub fn node_id(&self, tcx: TyCtxt<'_>, scope_tree: &ScopeTree) -> ast::NodeId { match scope_tree.root_body { Some(hir_id) => { tcx.hir().hir_to_node_id(hir::HirId { @@ -184,7 +184,7 @@ impl Scope { /// Returns the span of this `Scope`. Note that in general the /// returned span may not correspond to the span of any `NodeId` in /// the AST. - pub fn span(&self, tcx: TyCtxt<'_, '_>, scope_tree: &ScopeTree) -> Span { + pub fn span(&self, tcx: TyCtxt<'_>, scope_tree: &ScopeTree) -> Span { let node_id = self.node_id(tcx, scope_tree); if node_id == ast::DUMMY_NODE_ID { return DUMMY_SP; @@ -359,7 +359,7 @@ pub struct Context { } struct RegionResolutionVisitor<'tcx> { - tcx: TyCtxt<'tcx, 'tcx>, + tcx: TyCtxt<'tcx>, // The number of expressions and patterns visited in the current body expr_and_pat_count: usize, @@ -646,9 +646,9 @@ impl<'tcx> ScopeTree { /// Assuming that the provided region was defined within this `ScopeTree`, /// returns the outermost `Scope` that the region outlives. - pub fn early_free_scope<'gcx>( + pub fn early_free_scope( &self, - tcx: TyCtxt<'gcx, 'tcx>, + tcx: TyCtxt<'tcx>, br: &ty::EarlyBoundRegion, ) -> Scope { let param_owner = tcx.parent(br.def_id).unwrap(); @@ -679,7 +679,7 @@ impl<'tcx> ScopeTree { /// Assuming that the provided region was defined within this `ScopeTree`, /// returns the outermost `Scope` that the region outlives. - pub fn free_scope<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>, fr: &ty::FreeRegion) -> Scope { + pub fn free_scope(&self, tcx: TyCtxt<'tcx>, fr: &ty::FreeRegion) -> Scope { let param_owner = match fr.bound_region { ty::BoundRegion::BrNamed(def_id, _) => { tcx.parent(def_id).unwrap() @@ -1334,7 +1334,7 @@ impl<'tcx> Visitor<'tcx> for RegionResolutionVisitor<'tcx> { } } -fn region_scope_tree<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> &'tcx ScopeTree { +fn region_scope_tree<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> &'tcx ScopeTree { let closure_base_def_id = tcx.closure_base_def_id(def_id); if closure_base_def_id != def_id { return tcx.region_scope_tree(closure_base_def_id); diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs index edd5cb4541a..e187a3ced3f 100644 --- a/src/librustc/middle/resolve_lifetime.rs +++ b/src/librustc/middle/resolve_lifetime.rs @@ -218,7 +218,7 @@ impl_stable_hash_for!(struct crate::middle::resolve_lifetime::ResolveLifetimes { }); struct LifetimeContext<'a, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'tcx>, + tcx: TyCtxt<'tcx>, map: &'a mut NamedRegionMap, scope: ScopeRef<'a>, @@ -368,7 +368,7 @@ pub fn provide(providers: &mut ty::query::Providers<'_>) { /// entire crate. You should not read the result of this query /// directly, but rather use `named_region_map`, `is_late_bound_map`, /// etc. -fn resolve_lifetimes<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, for_krate: CrateNum) -> &'tcx ResolveLifetimes { +fn resolve_lifetimes<'tcx>(tcx: TyCtxt<'tcx>, for_krate: CrateNum) -> &'tcx ResolveLifetimes { assert_eq!(for_krate, LOCAL_CRATE); let named_region_map = krate(tcx); @@ -395,7 +395,7 @@ fn resolve_lifetimes<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, for_krate: CrateNum) -> &'tc tcx.arena.alloc(rl) } -fn krate<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) -> NamedRegionMap { +fn krate<'tcx>(tcx: TyCtxt<'tcx>) -> NamedRegionMap { let krate = tcx.hir().krate(); let mut map = NamedRegionMap { defs: Default::default(), @@ -1098,7 +1098,7 @@ impl ShadowKind { } } -fn check_mixed_explicit_and_in_band_defs(tcx: TyCtxt<'_, '_>, params: &P<[hir::GenericParam]>) { +fn check_mixed_explicit_and_in_band_defs(tcx: TyCtxt<'_>, params: &P<[hir::GenericParam]>) { let lifetime_params: Vec<_> = params .iter() .filter_map(|param| match param.kind { @@ -1126,7 +1126,7 @@ fn check_mixed_explicit_and_in_band_defs(tcx: TyCtxt<'_, '_>, params: &P<[hir::G } fn signal_shadowing_problem( - tcx: TyCtxt<'_, '_>, + tcx: TyCtxt<'_>, name: ast::Name, orig: Original, shadower: Shadower, @@ -1166,7 +1166,7 @@ fn signal_shadowing_problem( // if one of the label shadows a lifetime or another label. fn extract_labels(ctxt: &mut LifetimeContext<'_, '_>, body: &hir::Body) { struct GatherLabels<'a, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'tcx>, + tcx: TyCtxt<'tcx>, scope: ScopeRef<'a>, labels_in_fn: &'a mut Vec<ast::Ident>, } @@ -1215,7 +1215,7 @@ fn extract_labels(ctxt: &mut LifetimeContext<'_, '_>, body: &hir::Body) { } fn check_if_label_shadows_lifetime( - tcx: TyCtxt<'_, '_>, + tcx: TyCtxt<'_>, mut scope: ScopeRef<'_>, label: ast::Ident, ) { @@ -1253,7 +1253,7 @@ fn extract_labels(ctxt: &mut LifetimeContext<'_, '_>, body: &hir::Body) { } } -fn compute_object_lifetime_defaults(tcx: TyCtxt<'_, '_>) -> HirIdMap<Vec<ObjectLifetimeDefault>> { +fn compute_object_lifetime_defaults(tcx: TyCtxt<'_>) -> HirIdMap<Vec<ObjectLifetimeDefault>> { let mut map = HirIdMap::default(); for item in tcx.hir().krate().items.values() { match item.node { @@ -1310,7 +1310,7 @@ fn compute_object_lifetime_defaults(tcx: TyCtxt<'_, '_>) -> HirIdMap<Vec<ObjectL /// of the form `T:'a` so as to determine the `ObjectLifetimeDefault` /// for each type parameter. fn object_lifetime_defaults_for_item( - tcx: TyCtxt<'_, '_>, + tcx: TyCtxt<'_>, generics: &hir::Generics, ) -> Vec<ObjectLifetimeDefault> { fn add_bounds(set: &mut Set1<hir::LifetimeName>, bounds: &[hir::GenericBound]) { diff --git a/src/librustc/middle/stability.rs b/src/librustc/middle/stability.rs index dbd008256b0..19d127a565f 100644 --- a/src/librustc/middle/stability.rs +++ b/src/librustc/middle/stability.rs @@ -106,7 +106,7 @@ impl_stable_hash_for!(struct self::Index<'tcx> { // A private tree-walker for producing an Index. struct Annotator<'a, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'tcx>, + tcx: TyCtxt<'tcx>, index: &'a mut Index<'tcx>, parent_stab: Option<&'tcx Stability>, parent_depr: Option<DeprecationEntry>, @@ -317,7 +317,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> { } struct MissingStabilityAnnotations<'a, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'tcx>, + tcx: TyCtxt<'tcx>, access_levels: &'a AccessLevels, } @@ -390,7 +390,7 @@ impl<'a, 'tcx> Visitor<'tcx> for MissingStabilityAnnotations<'a, 'tcx> { } impl<'tcx> Index<'tcx> { - pub fn new(tcx: TyCtxt<'tcx, 'tcx>) -> Index<'tcx> { + pub fn new(tcx: TyCtxt<'tcx>) -> Index<'tcx> { let is_staged_api = tcx.sess.opts.debugging_opts.force_unstable_if_unmarked || tcx.features().staged_api; @@ -466,7 +466,7 @@ impl<'tcx> Index<'tcx> { /// Cross-references the feature names of unstable APIs with enabled /// features and possibly prints errors. -fn check_mod_unstable_api_usage<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, module_def_id: DefId) { +fn check_mod_unstable_api_usage<'tcx>(tcx: TyCtxt<'tcx>, module_def_id: DefId) { tcx.hir().visit_item_likes_in_module(module_def_id, &mut Checker { tcx }.as_deep_visitor()); } @@ -502,7 +502,7 @@ pub fn deprecation_in_effect(since: &str) -> bool { } struct Checker<'tcx> { - tcx: TyCtxt<'tcx, 'tcx>, + tcx: TyCtxt<'tcx>, } /// Result of `TyCtxt::eval_stability`. @@ -521,7 +521,7 @@ pub enum EvalResult { Unmarked, } -impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> { +impl<'tcx> TyCtxt<'tcx> { // See issue #38412. fn skip_stability_check_due_to_privacy(self, mut def_id: DefId) -> bool { // Check if `def_id` is a trait method. @@ -827,7 +827,7 @@ impl Visitor<'tcx> for Checker<'tcx> { } } -impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> { +impl<'tcx> TyCtxt<'tcx> { pub fn lookup_deprecation(self, id: DefId) -> Option<Deprecation> { self.lookup_deprecation_entry(id).map(|depr| depr.attr) } @@ -836,7 +836,7 @@ impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> { /// Given the list of enabled features that were not language features (i.e., that /// were expected to be library features), and the list of features used from /// libraries, identify activated features that don't exist and error about them. -pub fn check_unused_or_stable_features<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) { +pub fn check_unused_or_stable_features<'tcx>(tcx: TyCtxt<'tcx>) { let access_levels = &tcx.privacy_access_levels(LOCAL_CRATE); if tcx.stability().staged_api[&LOCAL_CRATE] { @@ -921,7 +921,7 @@ pub fn check_unused_or_stable_features<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) { } fn unnecessary_stable_feature_lint<'tcx>( - tcx: TyCtxt<'tcx, 'tcx>, + tcx: TyCtxt<'tcx>, span: Span, feature: Symbol, since: Symbol, diff --git a/src/librustc/middle/weak_lang_items.rs b/src/librustc/middle/weak_lang_items.rs index 45d405df950..422ff3f2fd3 100644 --- a/src/librustc/middle/weak_lang_items.rs +++ b/src/librustc/middle/weak_lang_items.rs @@ -18,13 +18,13 @@ macro_rules! weak_lang_items { ($($name:ident, $item:ident, $sym:ident;)*) => ( struct Context<'a, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'tcx>, + tcx: TyCtxt<'tcx>, items: &'a mut lang_items::LanguageItems, } /// Checks the crate for usage of weak lang items, returning a vector of all the /// language items required by this crate, but not defined yet. -pub fn check_crate<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, +pub fn check_crate<'tcx>(tcx: TyCtxt<'tcx>, items: &mut lang_items::LanguageItems) { // These are never called by user code, they're generated by the compiler. // They will never implicitly be added to the `missing` array unless we do @@ -60,7 +60,7 @@ pub fn link_name(attrs: &[ast::Attribute]) -> Option<Symbol> { /// Not all lang items are always required for each compilation, particularly in /// the case of panic=abort. In these situations some lang items are injected by /// crates and don't actually need to be defined in libstd. -pub fn whitelisted(tcx: TyCtxt<'_, '_>, lang_item: lang_items::LangItem) -> bool { +pub fn whitelisted(tcx: TyCtxt<'_>, lang_item: lang_items::LangItem) -> bool { // If we're not compiling with unwinding, we won't actually need these // symbols. Other panic runtimes ensure that the relevant symbols are // available to link things together, but they're never exercised. @@ -72,7 +72,7 @@ pub fn whitelisted(tcx: TyCtxt<'_, '_>, lang_item: lang_items::LangItem) -> bool false } -fn verify<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, +fn verify<'tcx>(tcx: TyCtxt<'tcx>, items: &lang_items::LanguageItems) { // We only need to check for the presence of weak lang items if we're // emitting something that's not an rlib. @@ -142,7 +142,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for Context<'a, 'tcx> { } } -impl<'tcx, 'gcx> TyCtxt<'tcx, 'gcx> { +impl<'tcx> TyCtxt<'tcx> { pub fn is_weak_lang_item(&self, item_def_id: DefId) -> bool { let lang_items = self.lang_items(); let did = Some(item_def_id); |
