From 37799a5552d308da5d74d9654036f2f541f3c8c3 Mon Sep 17 00:00:00 2001 From: Eduard-Mihai Burtescu Date: Tue, 11 Jun 2019 22:03:44 +0300 Subject: [PATCH 1/7] rustc: replace `TyCtxt<'a, 'gcx, 'tcx>` with `TyCtxt<'tcx, 'gcx, 'tcx>`. --- src/librustc/cfg/construct.rs | 4 +- src/librustc/cfg/graphviz.rs | 2 +- src/librustc/cfg/mod.rs | 2 +- src/librustc/dep_graph/dep_node.rs | 42 +++--- src/librustc/dep_graph/graph.rs | 6 +- src/librustc/dep_graph/safe.rs | 2 +- src/librustc/hir/check_attr.rs | 10 +- src/librustc/hir/upvars.rs | 2 +- src/librustc/ich/hcx.rs | 4 +- src/librustc/infer/canonical/canonicalizer.rs | 6 +- src/librustc/infer/canonical/mod.rs | 2 +- .../infer/canonical/query_response.rs | 4 +- src/librustc/infer/canonical/substitute.rs | 10 +- src/librustc/infer/combine.rs | 10 +- src/librustc/infer/equate.rs | 6 +- src/librustc/infer/error_reporting/mod.rs | 10 +- .../nice_region_error/find_anon_type.rs | 12 +- .../error_reporting/nice_region_error/mod.rs | 2 +- .../nice_region_error/placeholder_error.rs | 12 +- src/librustc/infer/freshen.rs | 2 +- src/librustc/infer/fudge.rs | 2 +- src/librustc/infer/glb.rs | 6 +- src/librustc/infer/lattice.rs | 2 +- .../infer/lexical_region_resolve/mod.rs | 6 +- src/librustc/infer/lub.rs | 6 +- src/librustc/infer/mod.rs | 22 +-- src/librustc/infer/nll_relate/mod.rs | 8 +- src/librustc/infer/opaque_types/mod.rs | 12 +- .../infer/outlives/free_region_map.rs | 4 +- src/librustc/infer/outlives/obligations.rs | 4 +- src/librustc/infer/outlives/verify.rs | 4 +- .../infer/region_constraints/leak_check.rs | 4 +- src/librustc/infer/region_constraints/mod.rs | 10 +- src/librustc/infer/resolve.rs | 6 +- src/librustc/infer/sub.rs | 6 +- src/librustc/infer/unify_key.rs | 6 +- src/librustc/lint/context.rs | 20 +-- src/librustc/lint/mod.rs | 10 +- src/librustc/macros.rs | 4 +- src/librustc/middle/cstore.rs | 2 +- src/librustc/middle/dead.rs | 20 +-- src/librustc/middle/dependency_format.rs | 8 +- src/librustc/middle/expr_use_visitor.rs | 4 +- src/librustc/middle/free_region.rs | 4 +- src/librustc/middle/intrinsicck.rs | 18 +-- src/librustc/middle/lang_items.rs | 14 +- src/librustc/middle/lib_features.rs | 12 +- src/librustc/middle/liveness.rs | 28 ++-- src/librustc/middle/mem_categorization.rs | 4 +- src/librustc/middle/reachable.rs | 10 +- src/librustc/middle/region.rs | 32 ++-- src/librustc/middle/resolve_lifetime.rs | 8 +- src/librustc/middle/stability.rs | 22 +-- src/librustc/middle/weak_lang_items.rs | 8 +- src/librustc/mir/interpret/error.rs | 10 +- src/librustc/mir/interpret/mod.rs | 5 +- src/librustc/mir/mod.rs | 4 +- src/librustc/mir/mono.rs | 33 ++--- src/librustc/mir/tcx.rs | 14 +- src/librustc/traits/auto_trait.rs | 14 +- src/librustc/traits/codegen/mod.rs | 4 +- src/librustc/traits/coherence.rs | 8 +- src/librustc/traits/engine.rs | 2 +- src/librustc/traits/error_reporting.rs | 6 +- src/librustc/traits/mod.rs | 20 +-- src/librustc/traits/object_safety.rs | 4 +- src/librustc/traits/on_unimplemented.rs | 12 +- src/librustc/traits/project.rs | 4 +- src/librustc/traits/query/dropck_outlives.rs | 6 +- src/librustc/traits/query/normalize.rs | 2 +- .../traits/query/normalize_erasing_regions.rs | 10 +- .../traits/query/type_op/ascribe_user_type.rs | 4 +- src/librustc/traits/query/type_op/eq.rs | 4 +- .../query/type_op/implied_outlives_bounds.rs | 4 +- src/librustc/traits/query/type_op/mod.rs | 4 +- .../traits/query/type_op/normalize.rs | 14 +- src/librustc/traits/query/type_op/outlives.rs | 4 +- .../traits/query/type_op/prove_predicate.rs | 4 +- src/librustc/traits/query/type_op/subtype.rs | 4 +- src/librustc/traits/select.rs | 4 +- src/librustc/traits/specialize/mod.rs | 6 +- .../traits/specialize/specialization_graph.rs | 20 +-- src/librustc/traits/structural_impls.rs | 20 +-- src/librustc/traits/util.rs | 66 ++++----- src/librustc/ty/_match.rs | 12 +- src/librustc/ty/adjustment.rs | 2 +- src/librustc/ty/codec.rs | 31 ++-- src/librustc/ty/constness.rs | 8 +- src/librustc/ty/context.rs | 28 ++-- src/librustc/ty/erase_regions.rs | 12 +- src/librustc/ty/error.rs | 4 +- src/librustc/ty/fast_reject.rs | 2 +- src/librustc/ty/fold.rs | 44 +++--- .../ty/inhabitedness/def_id_forest.rs | 8 +- src/librustc/ty/inhabitedness/mod.rs | 10 +- src/librustc/ty/instance.rs | 26 ++-- src/librustc/ty/layout.rs | 44 +++--- src/librustc/ty/mod.rs | 90 +++++------ src/librustc/ty/outlives.rs | 2 +- src/librustc/ty/print/mod.rs | 2 +- src/librustc/ty/print/obsolete.rs | 8 +- src/librustc/ty/print/pretty.rs | 6 +- src/librustc/ty/query/config.rs | 8 +- src/librustc/ty/query/job.rs | 4 +- src/librustc/ty/query/on_disk_cache.rs | 140 +++++++++--------- src/librustc/ty/query/plumbing.rs | 34 ++--- src/librustc/ty/query/values.rs | 12 +- src/librustc/ty/relate.rs | 82 +++++----- src/librustc/ty/structural_impls.rs | 64 ++++---- src/librustc/ty/sty.rs | 72 ++++----- src/librustc/ty/subst.rs | 26 ++-- src/librustc/ty/trait_def.rs | 6 +- src/librustc/ty/util.rs | 56 +++---- src/librustc/ty/wf.rs | 2 +- src/librustc_borrowck/borrowck/check_loans.rs | 10 +- .../borrowck/gather_loans/gather_moves.rs | 2 +- .../borrowck/gather_loans/mod.rs | 2 +- src/librustc_borrowck/borrowck/mod.rs | 32 ++-- src/librustc_borrowck/borrowck/move_data.rs | 36 ++--- src/librustc_borrowck/dataflow.rs | 22 +-- src/librustc_borrowck/graphviz.rs | 4 +- src/librustc_borrowck/lib.rs | 1 + src/librustc_codegen_llvm/base.rs | 6 +- src/librustc_codegen_llvm/builder.rs | 2 +- src/librustc_codegen_llvm/context.rs | 6 +- src/librustc_codegen_llvm/lib.rs | 8 +- .../back/symbol_export.rs | 12 +- src/librustc_codegen_ssa/base.rs | 6 +- .../debuginfo/type_names.rs | 8 +- src/librustc_codegen_ssa/traits/backend.rs | 6 +- src/librustc_codegen_utils/codegen_backend.rs | 2 +- src/librustc_codegen_utils/symbol_names.rs | 2 +- .../symbol_names/legacy.rs | 16 +- src/librustc_codegen_utils/symbol_names/v0.rs | 12 +- .../symbol_names_test.rs | 10 +- src/librustc_driver/pretty.rs | 6 +- src/librustc_incremental/assert_dep_graph.rs | 12 +- .../assert_module_sources.rs | 8 +- src/librustc_incremental/lib.rs | 1 + .../persist/dirty_clean.rs | 20 ++- src/librustc_incremental/persist/load.rs | 2 +- src/librustc_incremental/persist/save.rs | 2 +- src/librustc_interface/passes.rs | 6 +- src/librustc_interface/proc_macro_decls.rs | 4 +- src/librustc_lint/lib.rs | 2 +- src/librustc_lint/types.rs | 6 +- src/librustc_macros/src/query.rs | 6 +- src/librustc_metadata/cstore_impl.rs | 4 +- src/librustc_metadata/decoder.rs | 34 ++--- src/librustc_metadata/encoder.rs | 52 +++---- src/librustc_metadata/foreign_modules.rs | 8 +- src/librustc_metadata/link_args.rs | 2 +- src/librustc_metadata/native_libs.rs | 10 +- src/librustc_mir/borrow_check/borrow_set.rs | 4 +- src/librustc_mir/borrow_check/mod.rs | 2 +- src/librustc_mir/borrow_check/move_errors.rs | 2 +- .../borrow_check/mutability_errors.rs | 6 +- .../nll/explain_borrow/find_use.rs | 6 +- .../borrow_check/nll/explain_borrow/mod.rs | 2 +- .../borrow_check/nll/invalidation.rs | 4 +- .../error_reporting/region_name.rs | 8 +- .../region_infer/error_reporting/var_name.rs | 8 +- .../borrow_check/nll/region_infer/mod.rs | 16 +- .../nll/type_check/constraint_conversion.rs | 2 +- .../nll/type_check/liveness/mod.rs | 2 +- .../borrow_check/nll/type_check/mod.rs | 6 +- .../borrow_check/nll/universal_regions.rs | 10 +- src/librustc_mir/borrow_check/path_utils.rs | 2 +- src/librustc_mir/borrow_check/place_ext.rs | 4 +- .../borrow_check/places_conflict.rs | 10 +- src/librustc_mir/borrow_check/prefixes.rs | 2 +- src/librustc_mir/build/mod.rs | 12 +- src/librustc_mir/const_eval.rs | 72 ++++----- .../dataflow/drop_flag_effects.rs | 18 +-- src/librustc_mir/dataflow/impls/borrows.rs | 4 +- src/librustc_mir/dataflow/impls/mod.rs | 16 +- src/librustc_mir/dataflow/mod.rs | 4 +- .../dataflow/move_paths/builder.rs | 6 +- src/librustc_mir/dataflow/move_paths/mod.rs | 2 +- src/librustc_mir/hair/constant.rs | 2 +- src/librustc_mir/hair/cx/mod.rs | 6 +- src/librustc_mir/hair/pattern/_match.rs | 35 +++-- src/librustc_mir/hair/pattern/check_match.rs | 4 +- src/librustc_mir/hair/pattern/mod.rs | 10 +- src/librustc_mir/hair/util.rs | 2 +- src/librustc_mir/interpret/cast.rs | 2 +- src/librustc_mir/interpret/eval_context.rs | 32 ++-- src/librustc_mir/interpret/intrinsics.rs | 2 +- .../interpret/intrinsics/type_name.rs | 16 +- src/librustc_mir/interpret/machine.rs | 22 +-- src/librustc_mir/interpret/memory.rs | 32 ++-- src/librustc_mir/interpret/operand.rs | 2 +- src/librustc_mir/interpret/operator.rs | 4 +- src/librustc_mir/interpret/place.rs | 6 +- src/librustc_mir/interpret/snapshot.rs | 34 ++--- src/librustc_mir/interpret/step.rs | 2 +- src/librustc_mir/interpret/terminator.rs | 2 +- src/librustc_mir/interpret/traits.rs | 2 +- src/librustc_mir/interpret/validity.rs | 14 +- src/librustc_mir/interpret/visitor.rs | 30 ++-- src/librustc_mir/lints.rs | 4 +- src/librustc_mir/monomorphize/collector.rs | 50 +++---- src/librustc_mir/monomorphize/item.rs | 18 +-- src/librustc_mir/monomorphize/mod.rs | 2 +- src/librustc_mir/monomorphize/partitioning.rs | 26 ++-- src/librustc_mir/shim.rs | 22 +-- src/librustc_mir/transform/add_call_guards.rs | 2 +- .../transform/add_moves_for_packed_drops.rs | 8 +- src/librustc_mir/transform/add_retag.rs | 4 +- src/librustc_mir/transform/check_unsafety.rs | 14 +- .../transform/cleanup_post_borrowck.rs | 2 +- src/librustc_mir/transform/const_prop.rs | 26 ++-- src/librustc_mir/transform/copy_prop.rs | 2 +- src/librustc_mir/transform/deaggregator.rs | 2 +- src/librustc_mir/transform/dump_mir.rs | 6 +- src/librustc_mir/transform/elaborate_drops.rs | 10 +- src/librustc_mir/transform/erase_regions.rs | 12 +- src/librustc_mir/transform/generator.rs | 34 ++--- src/librustc_mir/transform/inline.rs | 10 +- src/librustc_mir/transform/instcombine.rs | 12 +- src/librustc_mir/transform/lower_128bit.rs | 10 +- src/librustc_mir/transform/mod.rs | 18 +-- src/librustc_mir/transform/no_landing_pads.rs | 4 +- src/librustc_mir/transform/promote_consts.rs | 4 +- src/librustc_mir/transform/qualify_consts.rs | 8 +- .../transform/qualify_min_const_fn.rs | 12 +- .../transform/remove_noop_landing_pads.rs | 4 +- src/librustc_mir/transform/rustc_peek.rs | 8 +- src/librustc_mir/transform/simplify.rs | 4 +- .../transform/simplify_branches.rs | 2 +- .../transform/uniform_array_move_out.rs | 6 +- src/librustc_mir/util/alignment.rs | 4 +- src/librustc_mir/util/borrowck_errors.rs | 10 +- src/librustc_mir/util/elaborate_drops.rs | 4 +- src/librustc_mir/util/graphviz.rs | 6 +- src/librustc_mir/util/liveness.rs | 6 +- src/librustc_mir/util/mod.rs | 2 +- src/librustc_mir/util/pretty.rs | 26 ++-- src/librustc_passes/layout_test.rs | 24 +-- src/librustc_passes/lib.rs | 1 + src/librustc_passes/loops.rs | 2 +- src/librustc_passes/rvalue_promotion.rs | 6 +- src/librustc_plugin/build.rs | 4 +- src/librustc_privacy/lib.rs | 91 ++++++------ src/librustc_save_analysis/dump_visitor.rs | 2 +- src/librustc_save_analysis/lib.rs | 4 +- src/librustc_traits/chalk_context/mod.rs | 18 +-- .../chalk_context/program_clauses/builtin.rs | 8 +- .../chalk_context/program_clauses/mod.rs | 4 +- .../program_clauses/primitive.rs | 14 +- .../chalk_context/resolvent_ops.rs | 4 +- src/librustc_traits/dropck_outlives.rs | 6 +- src/librustc_traits/evaluate_obligation.rs | 2 +- src/librustc_traits/generic_types.rs | 16 +- .../implied_outlives_bounds.rs | 2 +- src/librustc_traits/lowering/environment.rs | 14 +- src/librustc_traits/lowering/mod.rs | 22 +-- .../normalize_erasing_regions.rs | 2 +- .../normalize_projection_ty.rs | 2 +- src/librustc_traits/type_op.rs | 18 +-- src/librustc_typeck/astconv.rs | 6 +- src/librustc_typeck/check/autoderef.rs | 2 +- src/librustc_typeck/check/compare_method.rs | 16 +- src/librustc_typeck/check/dropck.rs | 6 +- src/librustc_typeck/check/intrinsic.rs | 6 +- src/librustc_typeck/check/method/probe.rs | 2 +- src/librustc_typeck/check/method/suggest.rs | 14 +- src/librustc_typeck/check/mod.rs | 78 +++++----- src/librustc_typeck/check/wfcheck.rs | 57 ++++--- src/librustc_typeck/check/writeback.rs | 6 +- src/librustc_typeck/check_unused.rs | 14 +- src/librustc_typeck/coherence/builtin.rs | 20 +-- .../coherence/inherent_impls.rs | 12 +- .../coherence/inherent_impls_overlap.rs | 10 +- src/librustc_typeck/coherence/mod.rs | 8 +- src/librustc_typeck/coherence/orphan.rs | 8 +- src/librustc_typeck/coherence/unsafety.rs | 10 +- src/librustc_typeck/collect.rs | 100 ++++++------- .../constrained_generic_params.rs | 2 +- src/librustc_typeck/impl_wf_check.rs | 14 +- src/librustc_typeck/lib.rs | 17 ++- src/librustc_typeck/outlives/explicit.rs | 2 +- .../outlives/implicit_infer.rs | 8 +- src/librustc_typeck/outlives/mod.rs | 4 +- src/librustc_typeck/outlives/test.rs | 8 +- src/librustc_typeck/outlives/utils.rs | 4 +- src/librustc_typeck/variance/constraints.rs | 2 +- src/librustc_typeck/variance/mod.rs | 4 +- src/librustc_typeck/variance/terms.rs | 4 +- src/librustc_typeck/variance/test.rs | 8 +- src/librustdoc/clean/auto_trait.rs | 10 +- .../hotplug_codegen_backend/the_backend.rs | 2 +- 292 files changed, 1824 insertions(+), 1838 deletions(-) diff --git a/src/librustc/cfg/construct.rs b/src/librustc/cfg/construct.rs index ef0d4be268eaf..0bff16334db09 100644 --- a/src/librustc/cfg/construct.rs +++ b/src/librustc/cfg/construct.rs @@ -8,7 +8,7 @@ use crate::hir::{self, PatKind}; use crate::hir::def_id::DefId; struct CFGBuilder<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, owner_def_id: DefId, tables: &'a ty::TypeckTables<'tcx>, graph: CFGGraph, @@ -30,7 +30,7 @@ struct LoopScope { break_index: CFGIndex, // where to go on a `break` } -pub fn construct<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +pub fn construct<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, body: &hir::Body) -> CFG { let mut graph = graph::Graph::new(); let entry = graph.add_node(CFGNodeData::Entry); diff --git a/src/librustc/cfg/graphviz.rs b/src/librustc/cfg/graphviz.rs index 969c38bd66329..57a63f3bd7348 100644 --- a/src/librustc/cfg/graphviz.rs +++ b/src/librustc/cfg/graphviz.rs @@ -12,7 +12,7 @@ pub type Node<'a> = (cfg::CFGIndex, &'a cfg::CFGNode); pub type Edge<'a> = &'a cfg::CFGEdge; pub struct LabelledCFG<'a, 'tcx: 'a> { - pub tcx: TyCtxt<'a, 'tcx, 'tcx>, + pub tcx: TyCtxt<'tcx, 'tcx, 'tcx>, pub cfg: &'a cfg::CFG, pub name: String, /// `labelled_edges` controls whether we emit labels on the edges diff --git a/src/librustc/cfg/mod.rs b/src/librustc/cfg/mod.rs index 345dff88b5f0b..e2144c20e9290 100644 --- a/src/librustc/cfg/mod.rs +++ b/src/librustc/cfg/mod.rs @@ -49,7 +49,7 @@ pub type CFGNode = graph::Node; pub type CFGEdge = graph::Edge; impl CFG { - pub fn new<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, + pub fn new<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, body: &hir::Body) -> CFG { construct::construct(tcx, body) } diff --git a/src/librustc/dep_graph/dep_node.rs b/src/librustc/dep_graph/dep_node.rs index a364a6da2e497..01dcdbf0ce545 100644 --- a/src/librustc/dep_graph/dep_node.rs +++ b/src/librustc/dep_graph/dep_node.rs @@ -204,7 +204,7 @@ macro_rules! define_dep_nodes { impl DepNode { #[allow(unreachable_code, non_snake_case)] #[inline(always)] - pub fn new<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, + pub fn new<'a, 'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, dep: DepConstructor<'gcx>) -> DepNode where 'gcx: 'a + 'tcx, @@ -442,49 +442,49 @@ rustc_dep_node_append!([define_dep_nodes!][ <'tcx> ]); pub trait RecoverKey<'tcx>: Sized { - fn recover(tcx: TyCtxt<'_, 'tcx, 'tcx>, dep_node: &DepNode) -> Option; + fn recover(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, dep_node: &DepNode) -> Option; } impl RecoverKey<'tcx> for CrateNum { - fn recover(tcx: TyCtxt<'_, 'tcx, 'tcx>, dep_node: &DepNode) -> Option { + fn recover(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, dep_node: &DepNode) -> Option { dep_node.extract_def_id(tcx).map(|id| id.krate) } } impl RecoverKey<'tcx> for DefId { - fn recover(tcx: TyCtxt<'_, 'tcx, 'tcx>, dep_node: &DepNode) -> Option { + fn recover(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, dep_node: &DepNode) -> Option { dep_node.extract_def_id(tcx) } } impl RecoverKey<'tcx> for DefIndex { - fn recover(tcx: TyCtxt<'_, 'tcx, 'tcx>, dep_node: &DepNode) -> Option { + fn recover(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, dep_node: &DepNode) -> Option { dep_node.extract_def_id(tcx).map(|id| id.index) } } -trait DepNodeParams<'a, 'gcx: 'tcx + 'a, 'tcx: 'a> : fmt::Debug { +trait DepNodeParams<'gcx: 'tcx, 'tcx>: fmt::Debug { const CAN_RECONSTRUCT_QUERY_KEY: bool; /// This method turns the parameters of a DepNodeConstructor into an opaque /// Fingerprint to be used in DepNode. /// Not all DepNodeParams support being turned into a Fingerprint (they /// don't need to if the corresponding DepNode is anonymous). - fn to_fingerprint(&self, _: TyCtxt<'a, 'gcx, 'tcx>) -> Fingerprint { + fn to_fingerprint(&self, _: TyCtxt<'tcx, 'gcx, 'tcx>) -> Fingerprint { panic!("Not implemented. Accidentally called on anonymous node?") } - fn to_debug_str(&self, _: TyCtxt<'a, 'gcx, 'tcx>) -> String { + fn to_debug_str(&self, _: TyCtxt<'tcx, 'gcx, 'tcx>) -> String { format!("{:?}", self) } } -impl<'a, 'gcx: 'tcx + 'a, 'tcx: 'a, T> DepNodeParams<'a, 'gcx, 'tcx> for T - where T: HashStable> + fmt::Debug +impl<'gcx: 'tcx, 'tcx, T> DepNodeParams<'gcx, 'tcx> for T + where T: HashStable> + fmt::Debug { default const CAN_RECONSTRUCT_QUERY_KEY: bool = false; - default fn to_fingerprint(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Fingerprint { + default fn to_fingerprint(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Fingerprint { let mut hcx = tcx.create_stable_hashing_context(); let mut hasher = StableHasher::new(); @@ -493,36 +493,36 @@ impl<'a, 'gcx: 'tcx + 'a, 'tcx: 'a, T> DepNodeParams<'a, 'gcx, 'tcx> for T hasher.finish() } - default fn to_debug_str(&self, _: TyCtxt<'a, 'gcx, 'tcx>) -> String { + default fn to_debug_str(&self, _: TyCtxt<'tcx, 'gcx, 'tcx>) -> String { format!("{:?}", *self) } } -impl<'a, 'gcx: 'tcx + 'a, 'tcx: 'a> DepNodeParams<'a, 'gcx, 'tcx> for DefId { +impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for DefId { const CAN_RECONSTRUCT_QUERY_KEY: bool = true; fn to_fingerprint(&self, tcx: TyCtxt<'_, '_, '_>) -> Fingerprint { tcx.def_path_hash(*self).0 } - fn to_debug_str(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> String { + fn to_debug_str(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> String { tcx.def_path_str(*self) } } -impl<'a, 'gcx: 'tcx + 'a, 'tcx: 'a> DepNodeParams<'a, 'gcx, 'tcx> for DefIndex { +impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for DefIndex { const CAN_RECONSTRUCT_QUERY_KEY: bool = true; fn to_fingerprint(&self, tcx: TyCtxt<'_, '_, '_>) -> Fingerprint { tcx.hir().definitions().def_path_hash(*self).0 } - fn to_debug_str(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> String { + fn to_debug_str(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> String { tcx.def_path_str(DefId::local(*self)) } } -impl<'a, 'gcx: 'tcx + 'a, 'tcx: 'a> DepNodeParams<'a, 'gcx, 'tcx> for CrateNum { +impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for CrateNum { const CAN_RECONSTRUCT_QUERY_KEY: bool = true; fn to_fingerprint(&self, tcx: TyCtxt<'_, '_, '_>) -> Fingerprint { @@ -533,12 +533,12 @@ impl<'a, 'gcx: 'tcx + 'a, 'tcx: 'a> DepNodeParams<'a, 'gcx, 'tcx> for CrateNum { tcx.def_path_hash(def_id).0 } - fn to_debug_str(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> String { + fn to_debug_str(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> String { tcx.crate_name(*self).as_str().to_string() } } -impl<'a, 'gcx: 'tcx + 'a, 'tcx: 'a> DepNodeParams<'a, 'gcx, 'tcx> for (DefId, DefId) { +impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for (DefId, DefId) { const CAN_RECONSTRUCT_QUERY_KEY: bool = false; // We actually would not need to specialize the implementation of this @@ -553,7 +553,7 @@ impl<'a, 'gcx: 'tcx + 'a, 'tcx: 'a> DepNodeParams<'a, 'gcx, 'tcx> for (DefId, De def_path_hash_0.0.combine(def_path_hash_1.0) } - fn to_debug_str(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> String { + fn to_debug_str(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> String { let (def_id_0, def_id_1) = *self; format!("({}, {})", @@ -562,7 +562,7 @@ impl<'a, 'gcx: 'tcx + 'a, 'tcx: 'a> DepNodeParams<'a, 'gcx, 'tcx> for (DefId, De } } -impl<'a, 'gcx: 'tcx + 'a, 'tcx: 'a> DepNodeParams<'a, 'gcx, 'tcx> for HirId { +impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for HirId { const CAN_RECONSTRUCT_QUERY_KEY: bool = false; // We actually would not need to specialize the implementation of this diff --git a/src/librustc/dep_graph/graph.rs b/src/librustc/dep_graph/graph.rs index a87c98a04a4ab..a9598e9d4342a 100644 --- a/src/librustc/dep_graph/graph.rs +++ b/src/librustc/dep_graph/graph.rs @@ -604,7 +604,7 @@ impl DepGraph { /// Try to mark a dep-node which existed in the previous compilation session as green. fn try_mark_previous_green<'tcx>( &self, - tcx: TyCtxt<'_, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, data: &DepGraphData, prev_dep_node_index: SerializedDepNodeIndex, dep_node: &DepNode @@ -791,7 +791,7 @@ impl DepGraph { #[inline(never)] fn emit_diagnostics<'tcx>( &self, - tcx: TyCtxt<'_, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, data: &DepGraphData, dep_node_index: DepNodeIndex, did_allocation: bool, @@ -842,7 +842,7 @@ impl DepGraph { // // This method will only load queries that will end up in the disk cache. // Other queries will not be executed. - pub fn exec_cache_promotions<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) { + pub fn exec_cache_promotions<'a, 'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { let green_nodes: Vec = { let data = self.data.as_ref().unwrap(); data.colors.values.indices().filter_map(|prev_index| { diff --git a/src/librustc/dep_graph/safe.rs b/src/librustc/dep_graph/safe.rs index fc767defe9c71..eb77e4ce4350a 100644 --- a/src/librustc/dep_graph/safe.rs +++ b/src/librustc/dep_graph/safe.rs @@ -33,7 +33,7 @@ impl DepGraphSafe for DefId { /// The type context itself can be used to access all kinds of tracked /// state, but those accesses should always generate read events. -impl<'a, 'gcx, 'tcx> DepGraphSafe for TyCtxt<'a, 'gcx, 'tcx> { +impl<'a, 'gcx, 'tcx> DepGraphSafe for TyCtxt<'tcx, 'gcx, 'tcx> { } /// Tuples make it easy to build up state. diff --git a/src/librustc/hir/check_attr.rs b/src/librustc/hir/check_attr.rs index f7d1094b3a2d1..5b517677a43f0 100644 --- a/src/librustc/hir/check_attr.rs +++ b/src/librustc/hir/check_attr.rs @@ -87,11 +87,11 @@ impl Target { } } -struct CheckAttrVisitor<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, +struct CheckAttrVisitor<'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } -impl<'a, 'tcx> CheckAttrVisitor<'a, 'tcx> { +impl CheckAttrVisitor<'tcx> { /// Checks any attribute. fn check_attributes(&self, item: &hir::Item, target: Target) { if target == Target::Fn || target == Target::Const { @@ -310,7 +310,7 @@ impl<'a, 'tcx> CheckAttrVisitor<'a, 'tcx> { } } -impl<'a, 'tcx> Visitor<'tcx> for CheckAttrVisitor<'a, 'tcx> { +impl Visitor<'tcx> for CheckAttrVisitor<'tcx> { fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> { NestedVisitorMap::OnlyBodies(&self.tcx.hir()) } @@ -347,7 +347,7 @@ fn is_c_like_enum(item: &hir::Item) -> bool { } } -fn check_mod_attrs<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, module_def_id: DefId) { +fn check_mod_attrs<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, module_def_id: DefId) { tcx.hir().visit_item_likes_in_module( module_def_id, &mut CheckAttrVisitor { tcx }.as_deep_visitor() diff --git a/src/librustc/hir/upvars.rs b/src/librustc/hir/upvars.rs index a053deb558464..8c92a0f5d7713 100644 --- a/src/librustc/hir/upvars.rs +++ b/src/librustc/hir/upvars.rs @@ -55,7 +55,7 @@ impl Visitor<'tcx> for LocalCollector { } struct CaptureCollector<'a, 'tcx> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, locals: &'a FxHashSet, upvars: FxIndexMap, } diff --git a/src/librustc/ich/hcx.rs b/src/librustc/ich/hcx.rs index eff42efa67b92..535c61df1c527 100644 --- a/src/librustc/ich/hcx.rs +++ b/src/librustc/ich/hcx.rs @@ -205,8 +205,8 @@ for &'b mut T { } } -impl<'a, 'gcx, 'lcx> StableHashingContextProvider<'a> for TyCtxt<'a, 'gcx, 'lcx> { - fn get_stable_hashing_context(&self) -> StableHashingContext<'a> { +impl StableHashingContextProvider<'lcx> for TyCtxt<'lcx, 'gcx, 'lcx> { + fn get_stable_hashing_context(&self) -> StableHashingContext<'lcx> { (*self).create_stable_hashing_context() } } diff --git a/src/librustc/infer/canonical/canonicalizer.rs b/src/librustc/infer/canonical/canonicalizer.rs index ae4bfcaa90373..f24f7f05a1fa6 100644 --- a/src/librustc/infer/canonical/canonicalizer.rs +++ b/src/librustc/infer/canonical/canonicalizer.rs @@ -277,7 +277,7 @@ impl CanonicalizeRegionMode for CanonicalizeFreeRegionsOtherThanStatic { struct Canonicalizer<'cx, 'gcx: 'tcx, 'tcx: 'cx> { infcx: Option<&'cx InferCtxt<'cx, 'gcx, 'tcx>>, - tcx: TyCtxt<'cx, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, variables: SmallVec<[CanonicalVarInfo; 8]>, query_state: &'cx mut OriginalQueryValues<'tcx>, // Note that indices is only used once `var_values` is big enough to be @@ -290,7 +290,7 @@ struct Canonicalizer<'cx, 'gcx: 'tcx, 'tcx: 'cx> { } impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for Canonicalizer<'cx, 'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'b, 'gcx, 'tcx> { + fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.tcx } @@ -501,7 +501,7 @@ impl<'cx, 'gcx, 'tcx> Canonicalizer<'cx, 'gcx, 'tcx> { fn canonicalize( value: &V, infcx: Option<&InferCtxt<'_, 'gcx, 'tcx>>, - tcx: TyCtxt<'_, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, canonicalize_region_mode: &dyn CanonicalizeRegionMode, query_state: &mut OriginalQueryValues<'tcx>, ) -> Canonicalized<'gcx, V> diff --git a/src/librustc/infer/canonical/mod.rs b/src/librustc/infer/canonical/mod.rs index 42f53bf1e95e8..1d630d10a3cb8 100644 --- a/src/librustc/infer/canonical/mod.rs +++ b/src/librustc/infer/canonical/mod.rs @@ -478,7 +478,7 @@ impl<'tcx> CanonicalVarValues<'tcx> { /// `self.var_values == [Type(u32), Lifetime('a), Type(u64)]` /// we'll return a substitution `subst` with: /// `subst.var_values == [Type(^0), Lifetime(^1), Type(^2)]`. - pub fn make_identity<'a>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Self { + pub fn make_identity<'a>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Self { use crate::ty::subst::UnpackedKind; CanonicalVarValues { diff --git a/src/librustc/infer/canonical/query_response.rs b/src/librustc/infer/canonical/query_response.rs index 413c1428ff954..7defbac7e545b 100644 --- a/src/librustc/infer/canonical/query_response.rs +++ b/src/librustc/infer/canonical/query_response.rs @@ -29,7 +29,7 @@ use crate::ty::subst::{Kind, UnpackedKind}; use crate::ty::{self, BoundVar, InferConst, Lift, Ty, TyCtxt}; use crate::util::captures::Captures; -impl<'cx, 'gcx, 'tcx> InferCtxtBuilder<'cx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> InferCtxtBuilder<'gcx, 'tcx> { /// The "main method" for a canonicalized trait query. Given the /// canonical key `canonical_key`, this method will create a new /// inference context, instantiate the key, and run your operation @@ -647,7 +647,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> { /// Given the region obligations and constraints scraped from the infcx, /// creates query region constraints. pub fn make_query_outlives<'tcx>( - tcx: TyCtxt<'_, '_, 'tcx>, + tcx: TyCtxt<'tcx, '_, 'tcx>, outlives_obligations: impl Iterator, ty::Region<'tcx>)>, region_constraints: &RegionConstraintData<'tcx>, ) -> Vec> { diff --git a/src/librustc/infer/canonical/substitute.rs b/src/librustc/infer/canonical/substitute.rs index 6b716d6c3b8ea..43f6f62bc4880 100644 --- a/src/librustc/infer/canonical/substitute.rs +++ b/src/librustc/infer/canonical/substitute.rs @@ -14,7 +14,11 @@ use crate::ty::{self, TyCtxt}; impl<'tcx, V> Canonical<'tcx, V> { /// Instantiate the wrapped value, replacing each canonical value /// with the value given in `var_values`. - pub fn substitute(&self, tcx: TyCtxt<'_, '_, 'tcx>, var_values: &CanonicalVarValues<'tcx>) -> V + pub fn substitute( + &self, + tcx: TyCtxt<'tcx, '_, 'tcx>, + var_values: &CanonicalVarValues<'tcx>, + ) -> V where V: TypeFoldable<'tcx>, { @@ -29,7 +33,7 @@ impl<'tcx, V> Canonical<'tcx, V> { /// V, replacing each of the canonical variables. pub fn substitute_projected( &self, - tcx: TyCtxt<'_, '_, 'tcx>, + tcx: TyCtxt<'tcx, '_, 'tcx>, var_values: &CanonicalVarValues<'tcx>, projection_fn: impl FnOnce(&V) -> &T, ) -> T @@ -46,7 +50,7 @@ impl<'tcx, V> Canonical<'tcx, V> { /// must be values for the set of canonical variables that appear in /// `value`. pub(super) fn substitute_value<'a, 'tcx, T>( - tcx: TyCtxt<'_, '_, 'tcx>, + tcx: TyCtxt<'tcx, '_, 'tcx>, var_values: &CanonicalVarValues<'tcx>, value: &'a T, ) -> T diff --git a/src/librustc/infer/combine.rs b/src/librustc/infer/combine.rs index 4e6d534b940c1..10a53767f5370 100644 --- a/src/librustc/infer/combine.rs +++ b/src/librustc/infer/combine.rs @@ -63,7 +63,7 @@ impl<'infcx, 'gcx, 'tcx> InferCtxt<'infcx, 'gcx, 'tcx> { a: Ty<'tcx>, b: Ty<'tcx>) -> RelateResult<'tcx, Ty<'tcx>> - where R: TypeRelation<'infcx, 'gcx, 'tcx> + where R: TypeRelation<'gcx, 'tcx> { let a_is_expected = relation.a_is_expected(); @@ -123,7 +123,7 @@ impl<'infcx, 'gcx, 'tcx> InferCtxt<'infcx, 'gcx, 'tcx> { b: &'tcx ty::Const<'tcx>, ) -> RelateResult<'tcx, &'tcx ty::Const<'tcx>> where - R: TypeRelation<'infcx, 'gcx, 'tcx>, + R: TypeRelation<'gcx, 'tcx>, { let a_is_expected = relation.a_is_expected(); @@ -207,7 +207,7 @@ impl<'infcx, 'gcx, 'tcx> InferCtxt<'infcx, 'gcx, 'tcx> { } impl<'infcx, 'gcx, 'tcx> CombineFields<'infcx, 'gcx, 'tcx> { - pub fn tcx(&self) -> TyCtxt<'infcx, 'gcx, 'tcx> { + pub fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.infcx.tcx } @@ -413,8 +413,8 @@ struct Generalization<'tcx> { needs_wf: bool, } -impl<'cx, 'gcx, 'tcx> TypeRelation<'cx, 'gcx, 'tcx> for Generalizer<'cx, 'gcx, 'tcx> { - fn tcx(&self) -> TyCtxt<'cx, 'gcx, 'tcx> { +impl TypeRelation<'gcx, 'tcx> for Generalizer<'_, 'gcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.infcx.tcx } diff --git a/src/librustc/infer/equate.rs b/src/librustc/infer/equate.rs index f61408696ecbf..d74a05fddbcf8 100644 --- a/src/librustc/infer/equate.rs +++ b/src/librustc/infer/equate.rs @@ -24,12 +24,10 @@ impl<'combine, 'infcx, 'gcx, 'tcx> Equate<'combine, 'infcx, 'gcx, 'tcx> { } } -impl<'combine, 'infcx, 'gcx, 'tcx> TypeRelation<'infcx, 'gcx, 'tcx> - for Equate<'combine, 'infcx, 'gcx, 'tcx> -{ +impl TypeRelation<'gcx, 'tcx> for Equate<'combine, 'infcx, 'gcx, 'tcx> { fn tag(&self) -> &'static str { "Equate" } - fn tcx(&self) -> TyCtxt<'infcx, 'gcx, 'tcx> { self.fields.tcx() } + fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.fields.tcx() } fn a_is_expected(&self) -> bool { self.a_is_expected } diff --git a/src/librustc/infer/error_reporting/mod.rs b/src/librustc/infer/error_reporting/mod.rs index b1eba7d5934f9..415490488510a 100644 --- a/src/librustc/infer/error_reporting/mod.rs +++ b/src/librustc/infer/error_reporting/mod.rs @@ -67,7 +67,7 @@ mod need_type_info; pub mod nice_region_error; -impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { +impl<'a, 'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { pub fn note_and_explain_region( self, region_scope_tree: ®ion::ScopeTree, @@ -445,13 +445,13 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { use ty::print::Printer; use ty::subst::Kind; - struct AbsolutePathPrinter<'a, 'gcx, 'tcx> { - tcx: TyCtxt<'a, 'gcx, 'tcx>, + struct AbsolutePathPrinter<'gcx, 'tcx> { + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, } struct NonTrivialPath; - impl<'gcx, 'tcx> Printer<'gcx, 'tcx> for AbsolutePathPrinter<'_, 'gcx, 'tcx> { + impl<'gcx, 'tcx> Printer<'gcx, 'tcx> for AbsolutePathPrinter<'gcx, 'tcx> { type Error = NonTrivialPath; type Path = Vec; @@ -460,7 +460,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { type DynExistential = !; type Const = !; - fn tcx<'a>(&'a self) -> TyCtxt<'a, 'gcx, 'tcx> { + fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.tcx } diff --git a/src/librustc/infer/error_reporting/nice_region_error/find_anon_type.rs b/src/librustc/infer/error_reporting/nice_region_error/find_anon_type.rs index ea748874fc4e2..b384a97f38d79 100644 --- a/src/librustc/infer/error_reporting/nice_region_error/find_anon_type.rs +++ b/src/librustc/infer/error_reporting/nice_region_error/find_anon_type.rs @@ -81,8 +81,8 @@ impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> { // walk the types like &mut Vec<&u8> and &u8 looking for the HIR // where that lifetime appears. This allows us to highlight the // specific part of the type in the error message. -struct FindNestedTypeVisitor<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { - tcx: TyCtxt<'a, 'gcx, 'tcx>, +struct FindNestedTypeVisitor<'gcx, 'tcx> { + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, // The bound_region corresponding to the Refree(freeregion) // associated with the anonymous region we are looking for. bound_region: ty::BoundRegion, @@ -92,7 +92,7 @@ struct FindNestedTypeVisitor<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { current_index: ty::DebruijnIndex, } -impl<'a, 'gcx, 'tcx> Visitor<'gcx> for FindNestedTypeVisitor<'a, 'gcx, 'tcx> { +impl Visitor<'gcx> for FindNestedTypeVisitor<'gcx, 'tcx> { fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'gcx> { NestedVisitorMap::OnlyBodies(&self.tcx.hir()) } @@ -208,14 +208,14 @@ impl<'a, 'gcx, 'tcx> Visitor<'gcx> for FindNestedTypeVisitor<'a, 'gcx, 'tcx> { // and would walk the types like Vec in the above example and Ref looking for the HIR // where that lifetime appears. This allows us to highlight the // specific part of the type in the error message. -struct TyPathVisitor<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { - tcx: TyCtxt<'a, 'gcx, 'tcx>, +struct TyPathVisitor<'gcx, 'tcx> { + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, found_it: bool, bound_region: ty::BoundRegion, current_index: ty::DebruijnIndex, } -impl<'a, 'gcx, 'tcx> Visitor<'gcx> for TyPathVisitor<'a, 'gcx, 'tcx> { +impl Visitor<'gcx> for TyPathVisitor<'gcx, 'tcx> { fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'gcx> { NestedVisitorMap::OnlyBodies(&self.tcx.hir()) } diff --git a/src/librustc/infer/error_reporting/nice_region_error/mod.rs b/src/librustc/infer/error_reporting/nice_region_error/mod.rs index d995fe92337c4..bd7fc9554e8d5 100644 --- a/src/librustc/infer/error_reporting/nice_region_error/mod.rs +++ b/src/librustc/infer/error_reporting/nice_region_error/mod.rs @@ -56,7 +56,7 @@ impl<'cx, 'gcx, 'tcx> NiceRegionError<'cx, 'gcx, 'tcx> { Self { infcx, error: None, regions: Some((span, sub, sup)), tables } } - fn tcx(&self) -> TyCtxt<'cx, 'gcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.infcx.tcx } diff --git a/src/librustc/infer/error_reporting/nice_region_error/placeholder_error.rs b/src/librustc/infer/error_reporting/nice_region_error/placeholder_error.rs index 1dd391950254d..c9bda63aa75cc 100644 --- a/src/librustc/infer/error_reporting/nice_region_error/placeholder_error.rs +++ b/src/librustc/infer/error_reporting/nice_region_error/placeholder_error.rs @@ -321,14 +321,14 @@ impl NiceRegionError<'me, 'gcx, 'tcx> { ) { // HACK(eddyb) maybe move this in a more central location. #[derive(Copy, Clone)] - struct Highlighted<'a, 'gcx, 'tcx, T> { - tcx: TyCtxt<'a, 'gcx, 'tcx>, + struct Highlighted<'gcx, 'tcx, T> { + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, highlight: RegionHighlightMode, value: T, } - impl<'a, 'gcx, 'tcx, T> Highlighted<'a, 'gcx, 'tcx, T> { - fn map(self, f: impl FnOnce(T) -> U) -> Highlighted<'a, 'gcx, 'tcx, U> { + impl<'gcx, 'tcx, T> Highlighted<'gcx, 'tcx, T> { + fn map(self, f: impl FnOnce(T) -> U) -> Highlighted<'gcx, 'tcx, U> { Highlighted { tcx: self.tcx, highlight: self.highlight, @@ -337,8 +337,8 @@ impl NiceRegionError<'me, 'gcx, 'tcx> { } } - impl<'a, 'gcx, 'tcx, T> fmt::Display for Highlighted<'a, 'gcx, 'tcx, T> - where T: for<'b, 'c> Print<'gcx, 'tcx, + impl<'gcx, 'tcx, T> fmt::Display for Highlighted<'gcx, 'tcx, T> + where T: for<'a, 'b, 'c> Print<'gcx, 'tcx, FmtPrinter<'a, 'gcx, 'tcx, &'b mut fmt::Formatter<'c>>, Error = fmt::Error, >, diff --git a/src/librustc/infer/freshen.rs b/src/librustc/infer/freshen.rs index 8f52ef7a3f3a4..ed8b0ff54c8d8 100644 --- a/src/librustc/infer/freshen.rs +++ b/src/librustc/infer/freshen.rs @@ -114,7 +114,7 @@ impl<'a, 'gcx, 'tcx> TypeFreshener<'a, 'gcx, 'tcx> { } impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for TypeFreshener<'a, 'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'b, 'gcx, 'tcx> { + fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.infcx.tcx } diff --git a/src/librustc/infer/fudge.rs b/src/librustc/infer/fudge.rs index 7461d8bc72860..ebab1f8f2f6d9 100644 --- a/src/librustc/infer/fudge.rs +++ b/src/librustc/infer/fudge.rs @@ -143,7 +143,7 @@ pub struct InferenceFudger<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { } impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for InferenceFudger<'a, 'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'b, 'gcx, 'tcx> { + fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.infcx.tcx } diff --git a/src/librustc/infer/glb.rs b/src/librustc/infer/glb.rs index 63a8f17398a04..f84ab59fdae60 100644 --- a/src/librustc/infer/glb.rs +++ b/src/librustc/infer/glb.rs @@ -21,12 +21,10 @@ impl<'combine, 'infcx, 'gcx, 'tcx> Glb<'combine, 'infcx, 'gcx, 'tcx> { } } -impl<'combine, 'infcx, 'gcx, 'tcx> TypeRelation<'infcx, 'gcx, 'tcx> - for Glb<'combine, 'infcx, 'gcx, 'tcx> -{ +impl TypeRelation<'gcx, 'tcx> for Glb<'combine, 'infcx, 'gcx, 'tcx> { fn tag(&self) -> &'static str { "Glb" } - fn tcx(&self) -> TyCtxt<'infcx, 'gcx, 'tcx> { self.fields.tcx() } + fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.fields.tcx() } fn a_is_expected(&self) -> bool { self.a_is_expected } diff --git a/src/librustc/infer/lattice.rs b/src/librustc/infer/lattice.rs index 0053b4c762118..6f76ee9e26dc9 100644 --- a/src/librustc/infer/lattice.rs +++ b/src/librustc/infer/lattice.rs @@ -27,7 +27,7 @@ use crate::ty::TyVar; use crate::ty::{self, Ty}; use crate::ty::relate::{RelateResult, TypeRelation}; -pub trait LatticeDir<'f, 'gcx: 'f+'tcx, 'tcx: 'f> : TypeRelation<'f, 'gcx, 'tcx> { +pub trait LatticeDir<'f, 'gcx: 'f+'tcx, 'tcx: 'f> : TypeRelation<'gcx, 'tcx> { fn infcx(&self) -> &'f InferCtxt<'f, 'gcx, 'tcx>; fn cause(&self) -> &ObligationCause<'tcx>; diff --git a/src/librustc/infer/lexical_region_resolve/mod.rs b/src/librustc/infer/lexical_region_resolve/mod.rs index bde2ed5e7ccb4..5d83cdcb176de 100644 --- a/src/librustc/infer/lexical_region_resolve/mod.rs +++ b/src/librustc/infer/lexical_region_resolve/mod.rs @@ -103,7 +103,7 @@ struct LexicalResolver<'cx, 'gcx: 'tcx, 'tcx: 'cx> { } impl<'cx, 'gcx, 'tcx> LexicalResolver<'cx, 'gcx, 'tcx> { - fn tcx(&self) -> TyCtxt<'cx, 'gcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.region_rels.tcx } @@ -136,7 +136,7 @@ impl<'cx, 'gcx, 'tcx> LexicalResolver<'cx, 'gcx, 'tcx> { /// Initially, the value for all variables is set to `'empty`, the /// empty region. The `expansion` phase will grow this larger. - fn construct_var_data(&self, tcx: TyCtxt<'_, '_, 'tcx>) -> LexicalRegionResolutions<'tcx> { + fn construct_var_data(&self, tcx: TyCtxt<'tcx, '_, 'tcx>) -> LexicalRegionResolutions<'tcx> { LexicalRegionResolutions { error_region: tcx.lifetimes.re_static, values: IndexVec::from_elem_n(VarValue::Value(tcx.lifetimes.re_empty), self.num_vars()) @@ -785,7 +785,7 @@ impl<'tcx> fmt::Debug for RegionAndOrigin<'tcx> { } impl<'tcx> LexicalRegionResolutions<'tcx> { - fn normalize(&self, tcx: TyCtxt<'_, '_, 'tcx>, value: T) -> T + fn normalize(&self, tcx: TyCtxt<'tcx, '_, 'tcx>, value: T) -> T where T: TypeFoldable<'tcx>, { diff --git a/src/librustc/infer/lub.rs b/src/librustc/infer/lub.rs index 29b319ef8f5ff..f123690ada4d9 100644 --- a/src/librustc/infer/lub.rs +++ b/src/librustc/infer/lub.rs @@ -21,12 +21,10 @@ impl<'combine, 'infcx, 'gcx, 'tcx> Lub<'combine, 'infcx, 'gcx, 'tcx> { } } -impl<'combine, 'infcx, 'gcx, 'tcx> TypeRelation<'infcx, 'gcx, 'tcx> - for Lub<'combine, 'infcx, 'gcx, 'tcx> -{ +impl TypeRelation<'gcx, 'tcx> for Lub<'combine, 'infcx, 'gcx, 'tcx> { fn tag(&self) -> &'static str { "Lub" } - fn tcx(&self) -> TyCtxt<'infcx, 'gcx, 'tcx> { self.fields.tcx() } + fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.fields.tcx() } fn a_is_expected(&self) -> bool { self.a_is_expected } diff --git a/src/librustc/infer/mod.rs b/src/librustc/infer/mod.rs index 57ab2c9c7e9a9..8c2ca633497ed 100644 --- a/src/librustc/infer/mod.rs +++ b/src/librustc/infer/mod.rs @@ -102,8 +102,8 @@ impl SuppressRegionErrors { } } -pub struct InferCtxt<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { - pub tcx: TyCtxt<'a, 'gcx, 'tcx>, +pub struct InferCtxt<'a, 'gcx, 'tcx> { + pub tcx: TyCtxt<'tcx, 'gcx, 'tcx>, /// During type-checking/inference of a body, `in_progress_tables` /// contains a reference to the tables being built up, which are @@ -465,13 +465,13 @@ impl<'tcx> fmt::Display for FixupError<'tcx> { /// Helper type of a temporary returned by `tcx.infer_ctxt()`. /// Necessary because we can't write the following bound: /// `F: for<'b, 'tcx> where 'gcx: 'tcx FnOnce(InferCtxt<'b, 'gcx, 'tcx>)`. -pub struct InferCtxtBuilder<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { - global_tcx: TyCtxt<'a, 'gcx, 'gcx>, +pub struct InferCtxtBuilder<'gcx, 'tcx> { + global_tcx: TyCtxt<'gcx, 'gcx, 'gcx>, fresh_tables: Option>>, } -impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'gcx> { - pub fn infer_ctxt(self) -> InferCtxtBuilder<'a, 'gcx, 'tcx> { +impl TyCtxt<'gcx, 'gcx, 'gcx> { + pub fn infer_ctxt<'tcx>(self) -> InferCtxtBuilder<'gcx, 'tcx> { InferCtxtBuilder { global_tcx: self, fresh_tables: None, @@ -479,7 +479,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'gcx> { } } -impl<'a, 'gcx, 'tcx> InferCtxtBuilder<'a, 'gcx, 'tcx> { +impl<'gcx, 'tcx> InferCtxtBuilder<'gcx, 'tcx> { /// Used only by `rustc_typeck` during body type-checking/inference, /// will initialize `in_progress_tables` with fresh `TypeckTables`. pub fn with_fresh_in_progress_tables(mut self, table_owner: DefId) -> Self { @@ -498,7 +498,7 @@ impl<'a, 'gcx, 'tcx> InferCtxtBuilder<'a, 'gcx, 'tcx> { &'tcx mut self, span: Span, canonical: &Canonical<'tcx, T>, - f: impl for<'b> FnOnce(InferCtxt<'b, 'gcx, 'tcx>, T, CanonicalVarValues<'tcx>) -> R, + f: impl for<'a> FnOnce(InferCtxt<'a, 'gcx, 'tcx>, T, CanonicalVarValues<'tcx>) -> R, ) -> R where T: TypeFoldable<'tcx>, @@ -510,7 +510,7 @@ impl<'a, 'gcx, 'tcx> InferCtxtBuilder<'a, 'gcx, 'tcx> { }) } - pub fn enter(&'tcx mut self, f: impl for<'b> FnOnce(InferCtxt<'b, 'gcx, 'tcx>) -> R) -> R { + pub fn enter(&'tcx mut self, f: impl for<'a> FnOnce(InferCtxt<'a, 'gcx, 'tcx>) -> R) -> R { let InferCtxtBuilder { global_tcx, ref fresh_tables, @@ -1600,7 +1600,7 @@ impl<'a, 'gcx, 'tcx> ShallowResolver<'a, 'gcx, 'tcx> { } impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for ShallowResolver<'a, 'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'b, 'gcx, 'tcx> { + fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.infcx.tcx } @@ -1641,7 +1641,7 @@ impl<'a, 'gcx, 'tcx> TypeTrace<'tcx> { } } - pub fn dummy(tcx: TyCtxt<'a, 'gcx, 'tcx>) -> TypeTrace<'tcx> { + pub fn dummy(tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> TypeTrace<'tcx> { TypeTrace { cause: ObligationCause::dummy(), values: Types(ExpectedFound { diff --git a/src/librustc/infer/nll_relate/mod.rs b/src/librustc/infer/nll_relate/mod.rs index c00fa9b1b09b3..6ac087027ac6e 100644 --- a/src/librustc/infer/nll_relate/mod.rs +++ b/src/librustc/infer/nll_relate/mod.rs @@ -494,11 +494,11 @@ impl VidValuePair<'tcx> for (Ty<'tcx>, ty::TyVid) { } } -impl TypeRelation<'me, 'gcx, 'tcx> for TypeRelating<'me, 'gcx, 'tcx, D> +impl TypeRelation<'gcx, 'tcx> for TypeRelating<'me, 'gcx, 'tcx, D> where D: TypeRelatingDelegate<'tcx>, { - fn tcx(&self) -> TyCtxt<'me, 'gcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.infcx.tcx } @@ -823,11 +823,11 @@ where universe: ty::UniverseIndex, } -impl TypeRelation<'me, 'gcx, 'tcx> for TypeGeneralizer<'me, 'gcx, 'tcx, D> +impl TypeRelation<'gcx, 'tcx> for TypeGeneralizer<'me, 'gcx, 'tcx, D> where D: TypeRelatingDelegate<'tcx>, { - fn tcx(&self) -> TyCtxt<'me, 'gcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.infcx.tcx } diff --git a/src/librustc/infer/opaque_types/mod.rs b/src/librustc/infer/opaque_types/mod.rs index aa415dbf36d76..a054869874af9 100644 --- a/src/librustc/infer/opaque_types/mod.rs +++ b/src/librustc/infer/opaque_types/mod.rs @@ -552,8 +552,8 @@ impl<'tcx> TypeVisitor<'tcx> for OpaqueTypeOutlivesVisitor<'_, '_, 'tcx> } } -struct ReverseMapper<'cx, 'gcx: 'tcx, 'tcx: 'cx> { - tcx: TyCtxt<'cx, 'gcx, 'tcx>, +struct ReverseMapper<'gcx, 'tcx> { + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, /// If errors have already been reported in this fn, we suppress /// our own errors because they are sometimes derivative. @@ -567,9 +567,9 @@ struct ReverseMapper<'cx, 'gcx: 'tcx, 'tcx: 'cx> { hidden_ty: Option>, } -impl<'cx, 'gcx, 'tcx> ReverseMapper<'cx, 'gcx, 'tcx> { +impl ReverseMapper<'gcx, 'tcx> { fn new( - tcx: TyCtxt<'cx, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, tainted_by_errors: bool, opaque_type_def_id: DefId, map: FxHashMap, Kind<'gcx>>, @@ -599,8 +599,8 @@ impl<'cx, 'gcx, 'tcx> ReverseMapper<'cx, 'gcx, 'tcx> { } } -impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for ReverseMapper<'cx, 'gcx, 'tcx> { - fn tcx(&self) -> TyCtxt<'_, 'gcx, 'tcx> { +impl TypeFolder<'gcx, 'tcx> for ReverseMapper<'gcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.tcx } diff --git a/src/librustc/infer/outlives/free_region_map.rs b/src/librustc/infer/outlives/free_region_map.rs index 5349e990a7761..308c510d0eabb 100644 --- a/src/librustc/infer/outlives/free_region_map.rs +++ b/src/librustc/infer/outlives/free_region_map.rs @@ -29,7 +29,7 @@ impl<'tcx> FreeRegionMap<'tcx> { /// avoid making arbitrary choices. See /// `TransitiveRelation::postdom_upper_bound` for more details. pub fn lub_free_regions<'a, 'gcx>(&self, - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, r_a: Region<'tcx>, r_b: Region<'tcx>) -> Region<'tcx> { @@ -90,7 +90,7 @@ impl_stable_hash_for!(struct FreeRegionMap<'tcx> { impl<'a, 'tcx> Lift<'tcx> for FreeRegionMap<'a> { type Lifted = FreeRegionMap<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option> { + fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option> { self.relation.maybe_map(|&fr| tcx.lift(&fr)) .map(|relation| FreeRegionMap { relation }) } diff --git a/src/librustc/infer/outlives/obligations.rs b/src/librustc/infer/outlives/obligations.rs index 90b3be213854c..86384f511c682 100644 --- a/src/librustc/infer/outlives/obligations.rs +++ b/src/librustc/infer/outlives/obligations.rs @@ -233,7 +233,7 @@ where // See the comments on `process_registered_region_obligations` for the meaning // of these fields. delegate: D, - tcx: TyCtxt<'cx, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, verify_bound: VerifyBoundCx<'cx, 'gcx, 'tcx>, } @@ -260,7 +260,7 @@ where { pub fn new( delegate: D, - tcx: TyCtxt<'cx, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, region_bound_pairs: &'cx RegionBoundPairs<'tcx>, implicit_region_bound: Option>, param_env: ty::ParamEnv<'tcx>, diff --git a/src/librustc/infer/outlives/verify.rs b/src/librustc/infer/outlives/verify.rs index e1ad5aeea19fc..154d0612d7d11 100644 --- a/src/librustc/infer/outlives/verify.rs +++ b/src/librustc/infer/outlives/verify.rs @@ -13,7 +13,7 @@ use crate::util::captures::Captures; /// accrues them into the `region_obligations` code, but for NLL we /// use something else. pub struct VerifyBoundCx<'cx, 'gcx: 'tcx, 'tcx: 'cx> { - tcx: TyCtxt<'cx, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, region_bound_pairs: &'cx RegionBoundPairs<'tcx>, implicit_region_bound: Option>, param_env: ty::ParamEnv<'tcx>, @@ -21,7 +21,7 @@ pub struct VerifyBoundCx<'cx, 'gcx: 'tcx, 'tcx: 'cx> { impl<'cx, 'gcx, 'tcx> VerifyBoundCx<'cx, 'gcx, 'tcx> { pub fn new( - tcx: TyCtxt<'cx, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, region_bound_pairs: &'cx RegionBoundPairs<'tcx>, implicit_region_bound: Option>, param_env: ty::ParamEnv<'tcx>, diff --git a/src/librustc/infer/region_constraints/leak_check.rs b/src/librustc/infer/region_constraints/leak_check.rs index 8085258610d84..fa6bbdbbbe724 100644 --- a/src/librustc/infer/region_constraints/leak_check.rs +++ b/src/librustc/infer/region_constraints/leak_check.rs @@ -22,7 +22,7 @@ impl<'tcx> RegionConstraintCollector<'tcx> { /// refactor the constraint set. pub fn leak_check( &mut self, - tcx: TyCtxt<'_, '_, 'tcx>, + tcx: TyCtxt<'tcx, '_, 'tcx>, overly_polymorphic: bool, placeholder_map: &PlaceholderMap<'tcx>, _snapshot: &CombinedSnapshot<'_, 'tcx>, @@ -109,7 +109,7 @@ impl<'tcx> TaintSet<'tcx> { fn fixed_point( &mut self, - tcx: TyCtxt<'_, '_, 'tcx>, + tcx: TyCtxt<'tcx, '_, 'tcx>, undo_log: &[UndoLog<'tcx>], verifys: &[Verify<'tcx>], ) { diff --git a/src/librustc/infer/region_constraints/mod.rs b/src/librustc/infer/region_constraints/mod.rs index b6fe57636e904..f63860f539014 100644 --- a/src/librustc/infer/region_constraints/mod.rs +++ b/src/librustc/infer/region_constraints/mod.rs @@ -700,7 +700,7 @@ impl<'tcx> RegionConstraintCollector<'tcx> { pub fn lub_regions( &mut self, - tcx: TyCtxt<'_, '_, 'tcx>, + tcx: TyCtxt<'tcx, '_, 'tcx>, origin: SubregionOrigin<'tcx>, a: Region<'tcx>, b: Region<'tcx>, @@ -722,7 +722,7 @@ impl<'tcx> RegionConstraintCollector<'tcx> { pub fn glb_regions( &mut self, - tcx: TyCtxt<'_, '_, 'tcx>, + tcx: TyCtxt<'tcx, '_, 'tcx>, origin: SubregionOrigin<'tcx>, a: Region<'tcx>, b: Region<'tcx>, @@ -744,7 +744,7 @@ impl<'tcx> RegionConstraintCollector<'tcx> { pub fn opportunistic_resolve_var( &mut self, - tcx: TyCtxt<'_, '_, 'tcx>, + tcx: TyCtxt<'tcx, '_, 'tcx>, rid: RegionVid, ) -> ty::Region<'tcx> { let vid = self.unification_table.probe_value(rid).min_vid; @@ -760,7 +760,7 @@ impl<'tcx> RegionConstraintCollector<'tcx> { fn combine_vars( &mut self, - tcx: TyCtxt<'_, '_, 'tcx>, + tcx: TyCtxt<'tcx, '_, 'tcx>, t: CombineMapType, a: Region<'tcx>, b: Region<'tcx>, @@ -850,7 +850,7 @@ impl<'tcx> fmt::Display for GenericKind<'tcx> { } impl<'a, 'gcx, 'tcx> GenericKind<'tcx> { - pub fn to_ty(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Ty<'tcx> { + pub fn to_ty(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx> { match *self { GenericKind::Param(ref p) => p.to_ty(tcx), GenericKind::Projection(ref p) => tcx.mk_projection(p.item_def_id, p.substs), diff --git a/src/librustc/infer/resolve.rs b/src/librustc/infer/resolve.rs index f487e7c8def0c..ea9d8dbbb1e89 100644 --- a/src/librustc/infer/resolve.rs +++ b/src/librustc/infer/resolve.rs @@ -24,7 +24,7 @@ impl<'a, 'gcx, 'tcx> OpportunisticVarResolver<'a, 'gcx, 'tcx> { } impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for OpportunisticVarResolver<'a, 'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'b, 'gcx, 'tcx> { + fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.infcx.tcx } @@ -61,7 +61,7 @@ impl<'a, 'gcx, 'tcx> OpportunisticTypeAndRegionResolver<'a, 'gcx, 'tcx> { } impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for OpportunisticTypeAndRegionResolver<'a, 'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'b, 'gcx, 'tcx> { + fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.infcx.tcx } @@ -177,7 +177,7 @@ struct FullTypeResolver<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { } impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for FullTypeResolver<'a, 'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'b, 'gcx, 'tcx> { + fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.infcx.tcx } diff --git a/src/librustc/infer/sub.rs b/src/librustc/infer/sub.rs index f2f36d59cbef6..4f73f229423c3 100644 --- a/src/librustc/infer/sub.rs +++ b/src/librustc/infer/sub.rs @@ -31,11 +31,9 @@ impl<'combine, 'infcx, 'gcx, 'tcx> Sub<'combine, 'infcx, 'gcx, 'tcx> { } } -impl<'combine, 'infcx, 'gcx, 'tcx> TypeRelation<'infcx, 'gcx, 'tcx> - for Sub<'combine, 'infcx, 'gcx, 'tcx> -{ +impl TypeRelation<'gcx, 'tcx> for Sub<'combine, 'infcx, 'gcx, 'tcx> { fn tag(&self) -> &'static str { "Sub" } - fn tcx(&self) -> TyCtxt<'infcx, 'gcx, 'tcx> { self.fields.infcx.tcx } + fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.fields.infcx.tcx } fn a_is_expected(&self) -> bool { self.a_is_expected } fn with_cause(&mut self, cause: Cause, f: F) -> R diff --git a/src/librustc/infer/unify_key.rs b/src/librustc/infer/unify_key.rs index 287a666fc8043..4d9c236598acc 100644 --- a/src/librustc/infer/unify_key.rs +++ b/src/librustc/infer/unify_key.rs @@ -10,7 +10,7 @@ use std::marker::PhantomData; use std::cell::RefMut; pub trait ToType { - fn to_type<'a, 'gcx, 'tcx>(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Ty<'tcx>; + fn to_type<'a, 'gcx, 'tcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx>; } impl UnifyKey for ty::IntVid { @@ -52,7 +52,7 @@ impl UnifyKey for ty::RegionVid { } impl ToType for IntVarValue { - fn to_type<'a, 'gcx, 'tcx>(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Ty<'tcx> { + fn to_type<'a, 'gcx, 'tcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx> { match *self { ty::IntType(i) => tcx.mk_mach_int(i), ty::UintType(i) => tcx.mk_mach_uint(i), @@ -72,7 +72,7 @@ impl UnifyKey for ty::FloatVid { impl EqUnifyValue for FloatVarValue {} impl ToType for FloatVarValue { - fn to_type<'a, 'gcx, 'tcx>(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Ty<'tcx> { + fn to_type<'a, 'gcx, 'tcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx> { tcx.mk_mach_float(self.0) } } diff --git a/src/librustc/lint/context.rs b/src/librustc/lint/context.rs index b51257c520601..3ddf57faa709b 100644 --- a/src/librustc/lint/context.rs +++ b/src/librustc/lint/context.rs @@ -509,7 +509,7 @@ impl LintStore { /// Context for lint checking after type checking. pub struct LateContext<'a, 'tcx: 'a> { /// Type context we're checking in. - pub tcx: TyCtxt<'a, 'tcx, 'tcx>, + pub tcx: TyCtxt<'tcx, 'tcx, 'tcx>, /// Side-tables for the body we are in. // FIXME: Make this lazy to avoid running the TypeckTables query? @@ -780,11 +780,11 @@ impl<'a, 'tcx> LateContext<'a, 'tcx> { /// } /// ``` pub fn get_def_path(&self, def_id: DefId) -> Vec { - pub struct AbsolutePathPrinter<'a, 'tcx> { - pub tcx: TyCtxt<'a, 'tcx, 'tcx>, + pub struct AbsolutePathPrinter<'tcx> { + pub tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } - impl<'tcx> Printer<'tcx, 'tcx> for AbsolutePathPrinter<'_, 'tcx> { + impl<'tcx> Printer<'tcx, 'tcx> for AbsolutePathPrinter<'tcx> { type Error = !; type Path = Vec; @@ -793,7 +793,7 @@ impl<'a, 'tcx> LateContext<'a, 'tcx> { type DynExistential = (); type Const = (); - fn tcx<'a>(&'a self) -> TyCtxt<'a, 'tcx, 'tcx> { + fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx, 'tcx> { self.tcx } @@ -1372,7 +1372,7 @@ macro_rules! late_lint_pass_impl { late_lint_methods!(late_lint_pass_impl, [], ['tcx]); fn late_lint_mod_pass<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>( - tcx: TyCtxt<'_, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, module_def_id: DefId, pass: T, ) { @@ -1404,7 +1404,7 @@ fn late_lint_mod_pass<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>( } pub fn late_lint_mod<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>( - tcx: TyCtxt<'_, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, module_def_id: DefId, builtin_lints: T, ) { @@ -1424,7 +1424,7 @@ pub fn late_lint_mod<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>( } fn late_lint_pass_crate<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>( - tcx: TyCtxt<'_, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, pass: T ) { let access_levels = &tcx.privacy_access_levels(LOCAL_CRATE); @@ -1460,7 +1460,7 @@ fn late_lint_pass_crate<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>( } fn late_lint_crate<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>( - tcx: TyCtxt<'_, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, builtin_lints: T ) { let mut passes = tcx.sess.lint_store.borrow().late_passes.lock().take().unwrap(); @@ -1494,7 +1494,7 @@ fn late_lint_crate<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>( /// Performs lint checking on a crate. pub fn check_crate<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>( - tcx: TyCtxt<'_, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, builtin_lints: impl FnOnce() -> T + Send, ) { join(|| { diff --git a/src/librustc/lint/mod.rs b/src/librustc/lint/mod.rs index f4eff6121c043..676b9d81162a0 100644 --- a/src/librustc/lint/mod.rs +++ b/src/librustc/lint/mod.rs @@ -766,7 +766,7 @@ pub fn maybe_lint_level_root(tcx: TyCtxt<'_, '_, '_>, id: hir::HirId) -> bool { attrs.iter().any(|attr| Level::from_symbol(attr.name_or_empty()).is_some()) } -fn lint_levels<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, cnum: CrateNum) +fn lint_levels<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, cnum: CrateNum) -> &'tcx LintLevelMap { assert_eq!(cnum, LOCAL_CRATE); @@ -787,12 +787,12 @@ fn lint_levels<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, cnum: CrateNum) tcx.arena.alloc(builder.levels.build_map()) } -struct LintLevelMapBuilder<'a, 'tcx: 'a> { +struct LintLevelMapBuilder<'tcx> { levels: levels::LintLevelsBuilder<'tcx>, - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } -impl<'a, 'tcx> LintLevelMapBuilder<'a, 'tcx> { +impl LintLevelMapBuilder<'tcx> { fn with_lint_attrs(&mut self, id: hir::HirId, attrs: &[ast::Attribute], @@ -808,7 +808,7 @@ impl<'a, 'tcx> LintLevelMapBuilder<'a, 'tcx> { } } -impl<'a, 'tcx> intravisit::Visitor<'tcx> for LintLevelMapBuilder<'a, 'tcx> { +impl intravisit::Visitor<'tcx> for LintLevelMapBuilder<'tcx> { fn nested_visit_map<'this>(&'this mut self) -> intravisit::NestedVisitorMap<'this, 'tcx> { intravisit::NestedVisitorMap::All(&self.tcx.hir()) } diff --git a/src/librustc/macros.rs b/src/librustc/macros.rs index b4088201f3bf1..d2ea26c9686fe 100644 --- a/src/librustc/macros.rs +++ b/src/librustc/macros.rs @@ -264,7 +264,7 @@ macro_rules! BraceStructLiftImpl { { type Lifted = $lifted; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option<$lifted> { + fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option<$lifted> { $(let $field = tcx.lift(&self.$field)?;)* Some(Self::Lifted { $($field),* }) } @@ -283,7 +283,7 @@ macro_rules! EnumLiftImpl { { type Lifted = $lifted; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option<$lifted> { + fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option<$lifted> { EnumLiftImpl!(@Variants(self, tcx) input($($variants)*) output()) } } diff --git a/src/librustc/middle/cstore.rs b/src/librustc/middle/cstore.rs index 6f9abcd624f99..b83bc2365ec96 100644 --- a/src/librustc/middle/cstore.rs +++ b/src/librustc/middle/cstore.rs @@ -212,7 +212,7 @@ pub trait CrateStore { // utility functions fn encode_metadata<'a, 'tcx>(&self, - tcx: TyCtxt<'a, 'tcx, 'tcx>) + tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> EncodedMetadata; fn metadata_encoding_version(&self) -> &[u8]; } diff --git a/src/librustc/middle/dead.rs b/src/librustc/middle/dead.rs index 04f5b35a0061a..3343aa9169147 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<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn should_explore<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, hir_id: hir::HirId) -> bool { match tcx.hir().find_by_hir_id(hir_id) { Some(Node::Item(..)) | @@ -41,7 +41,7 @@ fn should_explore<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, struct MarkSymbolVisitor<'a, 'tcx: 'a> { worklist: Vec, - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, tables: &'a ty::TypeckTables<'tcx>, live_symbols: FxHashSet, repr_has_repr_c: bool, @@ -353,7 +353,7 @@ fn has_allow_dead_code_or_lang_attr(tcx: TyCtxt<'_, '_, '_>, struct LifeSeeder<'k, 'tcx: 'k> { worklist: Vec, krate: &'k hir::Crate, - tcx: TyCtxt<'k, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, // see `MarkSymbolVisitor::struct_constructors` struct_constructors: FxHashMap, } @@ -424,7 +424,7 @@ impl<'v, 'k, 'tcx> ItemLikeVisitor<'v> for LifeSeeder<'k, 'tcx> { } fn create_and_seed_worklist<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, access_levels: &privacy::AccessLevels, krate: &hir::Crate, ) -> (Vec, FxHashMap) { @@ -451,7 +451,7 @@ fn create_and_seed_worklist<'a, 'tcx>( (life_seeder.worklist, life_seeder.struct_constructors) } -fn find_live<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn find_live<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, access_levels: &privacy::AccessLevels, krate: &hir::Crate) -> FxHashSet { @@ -471,12 +471,12 @@ fn find_live<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, symbol_visitor.live_symbols } -struct DeadVisitor<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, +struct DeadVisitor<'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, live_symbols: FxHashSet, } -impl<'a, 'tcx> DeadVisitor<'a, 'tcx> { +impl DeadVisitor<'tcx> { fn should_warn_about_item(&mut self, item: &hir::Item) -> bool { let should_warn = match item.node { hir::ItemKind::Static(..) @@ -554,7 +554,7 @@ impl<'a, 'tcx> DeadVisitor<'a, 'tcx> { } } -impl<'a, 'tcx> Visitor<'tcx> for DeadVisitor<'a, 'tcx> { +impl Visitor<'tcx> for DeadVisitor<'tcx> { /// Walk nested items in place so that we don't report dead-code /// on inner functions when the outer function is already getting /// an error. We could do this also by checking the parents, but @@ -660,7 +660,7 @@ impl<'a, 'tcx> Visitor<'tcx> for DeadVisitor<'a, 'tcx> { } } -pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { +pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, '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 a24d25cba1184..684bbe443a743 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<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { +pub fn calculate<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, '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<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { sess.dependency_formats.set(fmts); } -fn calculate_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn calculate_type<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ty: config::CrateType) -> DependencyList { let sess = &tcx.sess; @@ -267,7 +267,7 @@ fn add_library(tcx: TyCtxt<'_, '_, '_>, } } -fn attempt_static<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Option { +fn attempt_static<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Option { 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, // 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<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, list: &[Linkage]) { +fn verify_ok<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, list: &[Linkage]) { let sess = &tcx.sess; if list.len() == 0 { return diff --git a/src/librustc/middle/expr_use_visitor.rs b/src/librustc/middle/expr_use_visitor.rs index 34cea2d75eaa8..0565e05b95019 100644 --- a/src/librustc/middle/expr_use_visitor.rs +++ b/src/librustc/middle/expr_use_visitor.rs @@ -267,7 +267,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<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, '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<'a, 'gcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.mc.tcx } diff --git a/src/librustc/middle/free_region.rs b/src/librustc/middle/free_region.rs index dae33e34f305b..31fb097e54705 100644 --- a/src/librustc/middle/free_region.rs +++ b/src/librustc/middle/free_region.rs @@ -16,7 +16,7 @@ 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<'a, 'gcx, 'tcx>, + pub tcx: TyCtxt<'tcx, 'gcx, 'tcx>, /// The context used to fetch the region maps. pub context: DefId, @@ -30,7 +30,7 @@ pub struct RegionRelations<'a, 'gcx: 'tcx, 'tcx: 'a> { impl<'a, 'gcx, 'tcx> RegionRelations<'a, 'gcx, 'tcx> { pub fn new( - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, '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 1f25dba2915c4..1fc1f889f5b14 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, 'tcx, 'tcx>, module_def_id: DefId) { tcx.hir().visit_item_likes_in_module( module_def_id, &mut ItemVisitor { tcx }.as_deep_visitor() @@ -24,19 +24,19 @@ pub fn provide(providers: &mut Providers<'_>) { }; } -struct ItemVisitor<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx> +struct ItemVisitor<'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx> } -struct ExprVisitor<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, +struct ExprVisitor<'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, tables: &'tcx ty::TypeckTables<'tcx>, param_env: ty::ParamEnv<'tcx>, } /// If the type is `Option`, it will return `T`, otherwise /// the type itself. Works on most `Option`-like types. -fn unpack_option_like<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn unpack_option_like<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ty: Ty<'tcx>) -> Ty<'tcx> { let (def, substs) = match ty.sty { @@ -66,7 +66,7 @@ fn unpack_option_like<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ty } -impl<'a, 'tcx> ExprVisitor<'a, 'tcx> { +impl ExprVisitor<'tcx> { fn def_id_is_transmute(&self, def_id: DefId) -> bool { self.tcx.fn_sig(def_id).abi() == RustIntrinsic && self.tcx.item_name(def_id) == sym::transmute @@ -131,7 +131,7 @@ impl<'a, 'tcx> ExprVisitor<'a, 'tcx> { } } -impl<'a, 'tcx> Visitor<'tcx> for ItemVisitor<'a, 'tcx> { +impl Visitor<'tcx> for ItemVisitor<'tcx> { fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> { NestedVisitorMap::None } @@ -146,7 +146,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ItemVisitor<'a, 'tcx> { } } -impl<'a, 'tcx> Visitor<'tcx> for ExprVisitor<'a, 'tcx> { +impl Visitor<'tcx> for ExprVisitor<'tcx> { fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> { NestedVisitorMap::None } diff --git a/src/librustc/middle/lang_items.rs b/src/librustc/middle/lang_items.rs index 034ef32aafe01..b8b1a8443027c 100644 --- a/src/librustc/middle/lang_items.rs +++ b/src/librustc/middle/lang_items.rs @@ -104,14 +104,14 @@ impl LanguageItems { )* } -struct LanguageItemCollector<'a, 'tcx: 'a> { +struct LanguageItemCollector<'tcx> { items: LanguageItems, - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, '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)>, } -impl<'a, 'v, 'tcx> ItemLikeVisitor<'v> for LanguageItemCollector<'a, 'tcx> { +impl ItemLikeVisitor<'v> for LanguageItemCollector<'tcx> { fn visit_item(&mut self, item: &hir::Item) { if let Some((value, span)) = extract(&item.attrs) { let actual_target = Target::from_item(item); @@ -159,8 +159,8 @@ impl<'a, 'v, 'tcx> ItemLikeVisitor<'v> for LanguageItemCollector<'a, 'tcx> { } } -impl<'a, 'tcx> LanguageItemCollector<'a, 'tcx> { - fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> LanguageItemCollector<'a, 'tcx> { +impl LanguageItemCollector<'tcx> { + fn new(tcx: TyCtxt<'tcx, 'tcx, '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<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> LanguageItems { +pub fn collect<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> LanguageItems { // Initialize the collector. let mut collector = LanguageItemCollector::new(tcx); @@ -402,7 +402,7 @@ language_item_table! { Rc, "rc", rc, Target::Struct; } -impl<'a, 'tcx, 'gcx> TyCtxt<'a, 'tcx, 'gcx> { +impl<'a, 'tcx, 'gcx> TyCtxt<'gcx, 'tcx, 'gcx> { /// 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 76934ddd69b1b..4066fe001ffb4 100644 --- a/src/librustc/middle/lib_features.rs +++ b/src/librustc/middle/lib_features.rs @@ -37,13 +37,13 @@ impl LibFeatures { } } -pub struct LibFeatureCollector<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, +pub struct LibFeatureCollector<'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, lib_features: LibFeatures, } -impl<'a, 'tcx> LibFeatureCollector<'a, 'tcx> { - fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> LibFeatureCollector<'a, 'tcx> { +impl LibFeatureCollector<'tcx> { + fn new(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> LibFeatureCollector<'tcx> { LibFeatureCollector { tcx, lib_features: LibFeatures::new(), @@ -130,7 +130,7 @@ impl<'a, 'tcx> LibFeatureCollector<'a, 'tcx> { } } -impl<'a, 'tcx> Visitor<'tcx> for LibFeatureCollector<'a, 'tcx> { +impl Visitor<'tcx> for LibFeatureCollector<'tcx> { fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> { NestedVisitorMap::All(&self.tcx.hir()) } @@ -142,7 +142,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LibFeatureCollector<'a, 'tcx> { } } -pub fn collect<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> LibFeatures { +pub fn collect<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, '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 45b4fb5605695..8d82e2fbca59d 100644 --- a/src/librustc/middle/liveness.rs +++ b/src/librustc/middle/liveness.rs @@ -166,7 +166,7 @@ fn live_node_kind_to_string(lnk: LiveNodeKind, tcx: TyCtxt<'_, '_, '_>) -> Strin } } -impl<'a, 'tcx> Visitor<'tcx> for IrMaps<'a, 'tcx> { +impl<'a, 'tcx> Visitor<'tcx> for IrMaps<'tcx> { fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> { NestedVisitorMap::OnlyBodies(&self.tcx.hir()) } @@ -181,7 +181,7 @@ impl<'a, 'tcx> Visitor<'tcx> for IrMaps<'a, '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, 'tcx, '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(), @@ -256,8 +256,8 @@ enum VarKind { CleanExit } -struct IrMaps<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, +struct IrMaps<'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, body_owner: DefId, num_live_nodes: usize, num_vars: usize, @@ -268,8 +268,8 @@ struct IrMaps<'a, 'tcx: 'a> { lnks: Vec, } -impl<'a, 'tcx> IrMaps<'a, 'tcx> { - fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>, body_owner: DefId) -> IrMaps<'a, 'tcx> { +impl IrMaps<'tcx> { + fn new(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, body_owner: DefId) -> IrMaps<'tcx> { IrMaps { tcx, body_owner, @@ -352,7 +352,7 @@ impl<'a, 'tcx> IrMaps<'a, 'tcx> { } } -fn visit_fn<'a, 'tcx: 'a>(ir: &mut IrMaps<'a, 'tcx>, +fn visit_fn<'a, 'tcx: 'a>(ir: &mut IrMaps<'tcx>, fk: FnKind<'tcx>, decl: &'tcx hir::FnDecl, body_id: hir::BodyId, @@ -374,7 +374,7 @@ fn visit_fn<'a, 'tcx: 'a>(ir: &mut IrMaps<'a, 'tcx>, } } - debug!("creating fn_maps: {:?}", &fn_maps as *const IrMaps<'_, '_>); + debug!("creating fn_maps: {:p}", &fn_maps); let body = ir.tcx.hir().body(body_id); @@ -411,7 +411,7 @@ fn visit_fn<'a, 'tcx: 'a>(ir: &mut IrMaps<'a, 'tcx>, lsets.warn_about_unused_args(body, entry_ln); } -fn add_from_pat<'a, 'tcx>(ir: &mut IrMaps<'a, 'tcx>, pat: &P) { +fn add_from_pat<'a, 'tcx>(ir: &mut IrMaps<'tcx>, pat: &P) { // For struct patterns, take note of which fields used shorthand // (`x` rather than `x: x`). let mut shorthand_field_ids = HirIdSet::default(); @@ -457,19 +457,19 @@ fn add_from_pat<'a, 'tcx>(ir: &mut IrMaps<'a, 'tcx>, pat: &P) { }); } -fn visit_local<'a, 'tcx>(ir: &mut IrMaps<'a, 'tcx>, local: &'tcx hir::Local) { +fn visit_local<'a, 'tcx>(ir: &mut IrMaps<'tcx>, local: &'tcx hir::Local) { add_from_pat(ir, &local.pat); intravisit::walk_local(ir, local); } -fn visit_arm<'a, 'tcx>(ir: &mut IrMaps<'a, 'tcx>, arm: &'tcx hir::Arm) { +fn visit_arm<'a, 'tcx>(ir: &mut IrMaps<'tcx>, arm: &'tcx hir::Arm) { for pat in &arm.pats { add_from_pat(ir, pat); } intravisit::walk_arm(ir, arm); } -fn visit_expr<'a, 'tcx>(ir: &mut IrMaps<'a, 'tcx>, expr: &'tcx Expr) { +fn visit_expr<'a, 'tcx>(ir: &mut IrMaps<'tcx>, expr: &'tcx Expr) { match expr.node { // live nodes required for uses or definitions of variables: hir::ExprKind::Path(hir::QPath::Resolved(_, ref path)) => { @@ -681,7 +681,7 @@ const ACC_WRITE: u32 = 2; const ACC_USE: u32 = 4; struct Liveness<'a, 'tcx: 'a> { - ir: &'a mut IrMaps<'a, 'tcx>, + ir: &'a mut IrMaps<'tcx>, tables: &'a ty::TypeckTables<'tcx>, s: Specials, successors: Vec, @@ -695,7 +695,7 @@ struct Liveness<'a, 'tcx: 'a> { } impl<'a, 'tcx> Liveness<'a, 'tcx> { - fn new(ir: &'a mut IrMaps<'a, 'tcx>, body: hir::BodyId) -> Liveness<'a, 'tcx> { + fn new(ir: &'a mut IrMaps<'tcx>, body: hir::BodyId) -> Liveness<'a, 'tcx> { // Special nodes and variables: // - exit_ln represents the end of the fn, either by return or panic // - implicit_ret_var is a pseudo-variable that represents diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs index 7011948148d84..d1814b5fe77d2 100644 --- a/src/librustc/middle/mem_categorization.rs +++ b/src/librustc/middle/mem_categorization.rs @@ -288,7 +288,7 @@ impl HirNode for hir::Pat { #[derive(Clone)] pub struct MemCategorizationContext<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { - pub tcx: TyCtxt<'a, 'gcx, 'tcx>, + pub tcx: TyCtxt<'tcx, 'gcx, 'tcx>, pub body_owner: DefId, pub upvars: Option<&'tcx FxIndexMap>, pub region_scope_tree: &'a region::ScopeTree, @@ -400,7 +400,7 @@ impl MutabilityCategory { } impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx, 'tcx> { - pub fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>, + pub fn new(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, body_owner: DefId, region_scope_tree: &'a region::ScopeTree, tables: &'a ty::TypeckTables<'tcx>, diff --git a/src/librustc/middle/reachable.rs b/src/librustc/middle/reachable.rs index 45e1d983511c0..4be7b699932ab 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<'a, 'tcx, 'tcx>, +fn item_might_be_inlined(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item: &hir::Item, attrs: CodegenFnAttrs) -> bool { if attrs.requests_inline() { @@ -44,7 +44,7 @@ fn item_might_be_inlined(tcx: TyCtxt<'a, 'tcx, 'tcx>, } } -fn method_might_be_inlined<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn method_might_be_inlined<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_item: &hir::ImplItem, impl_src: DefId) -> bool { let codegen_fn_attrs = tcx.codegen_fn_attrs(impl_item.hir_id.owner_def_id()); @@ -67,7 +67,7 @@ fn method_might_be_inlined<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // Information needed while computing reachability. struct ReachableContext<'a, 'tcx: 'a> { // The type context. - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, '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<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, access_levels: &'a privacy::AccessLevels, worklist: &'a mut Vec, } @@ -391,7 +391,7 @@ impl<'a, 'tcx: 'a> ItemLikeVisitor<'tcx> for CollectPrivateImplItemsVisitor<'a, #[derive(Clone, HashStable)] pub struct ReachableSet(pub Lrc); -fn reachable_set<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, crate_num: CrateNum) -> ReachableSet { +fn reachable_set<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, '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 3d78b9b6382b7..3c2bb07ae12c7 100644 --- a/src/librustc/middle/region.rs +++ b/src/librustc/middle/region.rs @@ -358,8 +358,8 @@ pub struct Context { parent: Option<(Scope, ScopeDepth)>, } -struct RegionResolutionVisitor<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, +struct RegionResolutionVisitor<'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, // The number of expressions and patterns visited in the current body expr_and_pat_count: usize, @@ -646,7 +646,7 @@ 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<'a, 'gcx>(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, + pub fn early_free_scope<'a, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, br: &ty::EarlyBoundRegion) -> Scope { let param_owner = tcx.parent(br.def_id).unwrap(); @@ -677,7 +677,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<'a, 'gcx>(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, fr: &ty::FreeRegion) + pub fn free_scope<'a, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, fr: &ty::FreeRegion) -> Scope { let param_owner = match fr.bound_region { ty::BoundRegion::BrNamed(def_id, _) => { @@ -734,7 +734,7 @@ impl<'tcx> ScopeTree { } /// Records the lifetime of a local variable as `cx.var_parent` -fn record_var_lifetime(visitor: &mut RegionResolutionVisitor<'_, '_>, +fn record_var_lifetime(visitor: &mut RegionResolutionVisitor<'_>, var_id: hir::ItemLocalId, _sp: Span) { match visitor.cx.var_parent { @@ -748,7 +748,7 @@ fn record_var_lifetime(visitor: &mut RegionResolutionVisitor<'_, '_>, } } -fn resolve_block<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'a, 'tcx>, blk: &'tcx hir::Block) { +fn resolve_block<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, blk: &'tcx hir::Block) { debug!("resolve_block(blk.hir_id={:?})", blk.hir_id); let prev_cx = visitor.cx; @@ -816,7 +816,7 @@ fn resolve_block<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'a, 'tcx>, blk: visitor.cx = prev_cx; } -fn resolve_arm<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'a, 'tcx>, arm: &'tcx hir::Arm) { +fn resolve_arm<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, arm: &'tcx hir::Arm) { let prev_cx = visitor.cx; visitor.enter_scope( @@ -838,7 +838,7 @@ fn resolve_arm<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'a, 'tcx>, arm: & visitor.cx = prev_cx; } -fn resolve_pat<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'a, 'tcx>, pat: &'tcx hir::Pat) { +fn resolve_pat<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, pat: &'tcx hir::Pat) { visitor.record_child_scope(Scope { id: pat.hir_id.local_id, data: ScopeData::Node }); // If this is a binding then record the lifetime of that binding. @@ -855,7 +855,7 @@ fn resolve_pat<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'a, 'tcx>, pat: & debug!("resolve_pat - post-increment {} pat = {:?}", visitor.expr_and_pat_count, pat); } -fn resolve_stmt<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'a, 'tcx>, stmt: &'tcx hir::Stmt) { +fn resolve_stmt<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, stmt: &'tcx hir::Stmt) { let stmt_id = stmt.hir_id.local_id; debug!("resolve_stmt(stmt.id={:?})", stmt_id); @@ -874,7 +874,7 @@ fn resolve_stmt<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'a, 'tcx>, stmt: visitor.cx.parent = prev_parent; } -fn resolve_expr<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'a, 'tcx>, expr: &'tcx hir::Expr) { +fn resolve_expr<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, expr: &'tcx hir::Expr) { debug!("resolve_expr - pre-increment {} expr = {:?}", visitor.expr_and_pat_count, expr); let prev_cx = visitor.cx; @@ -977,7 +977,7 @@ fn resolve_expr<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'a, 'tcx>, expr: visitor.cx = prev_cx; } -fn resolve_local<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'a, 'tcx>, +fn resolve_local<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, pat: Option<&'tcx hir::Pat>, init: Option<&'tcx hir::Expr>) { debug!("resolve_local(pat={:?}, init={:?})", pat, init); @@ -1128,7 +1128,7 @@ fn resolve_local<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'a, 'tcx>, /// | E& as ... /// | ( E& ) fn record_rvalue_scope_if_borrow_expr<'a, 'tcx>( - visitor: &mut RegionResolutionVisitor<'a, 'tcx>, + visitor: &mut RegionResolutionVisitor<'tcx>, expr: &hir::Expr, blk_id: Option) { @@ -1178,7 +1178,7 @@ fn resolve_local<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'a, 'tcx>, /// | /// /// Note: ET is intended to match "rvalues or places based on rvalues". - fn record_rvalue_scope<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'a, 'tcx>, + fn record_rvalue_scope<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, expr: &hir::Expr, blk_scope: Option) { let mut expr = expr; @@ -1205,7 +1205,7 @@ fn resolve_local<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'a, 'tcx>, } } -impl<'a, 'tcx> RegionResolutionVisitor<'a, 'tcx> { +impl<'a, 'tcx> RegionResolutionVisitor<'tcx> { /// Records the current parent (if any) as the parent of `child_scope`. /// Returns the depth of `child_scope`. fn record_child_scope(&mut self, child_scope: Scope) -> ScopeDepth { @@ -1235,7 +1235,7 @@ impl<'a, 'tcx> RegionResolutionVisitor<'a, 'tcx> { } } -impl<'a, 'tcx> Visitor<'tcx> for RegionResolutionVisitor<'a, 'tcx> { +impl<'a, 'tcx> Visitor<'tcx> for RegionResolutionVisitor<'tcx> { fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> { NestedVisitorMap::None } @@ -1327,7 +1327,7 @@ impl<'a, 'tcx> Visitor<'tcx> for RegionResolutionVisitor<'a, 'tcx> { } } -fn region_scope_tree<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) +fn region_scope_tree<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ScopeTree { let closure_base_def_id = tcx.closure_base_def_id(def_id); diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs index 331b74db080bf..83c2cab74e435 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<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, map: &'a mut NamedRegionMap, scope: ScopeRef<'a>, @@ -369,7 +369,7 @@ pub fn provide(providers: &mut ty::query::Providers<'_>) { /// directly, but rather use `named_region_map`, `is_late_bound_map`, /// etc. fn resolve_lifetimes<'tcx>( - tcx: TyCtxt<'_, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, for_krate: CrateNum, ) -> &'tcx ResolveLifetimes { assert_eq!(for_krate, LOCAL_CRATE); @@ -398,7 +398,7 @@ fn resolve_lifetimes<'tcx>( tcx.arena.alloc(rl) } -fn krate<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>) -> NamedRegionMap { +fn krate<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> NamedRegionMap { let krate = tcx.hir().krate(); let mut map = NamedRegionMap { defs: Default::default(), @@ -1169,7 +1169,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<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, scope: ScopeRef<'a>, labels_in_fn: &'a mut Vec, } diff --git a/src/librustc/middle/stability.rs b/src/librustc/middle/stability.rs index 815c68b6b1cb6..45be13a756ba8 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<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, index: &'a mut Index<'tcx>, parent_stab: Option<&'tcx Stability>, parent_depr: Option, @@ -317,7 +317,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> { } struct MissingStabilityAnnotations<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, access_levels: &'a AccessLevels, } @@ -390,7 +390,7 @@ impl<'a, 'tcx> Visitor<'tcx> for MissingStabilityAnnotations<'a, 'tcx> { } impl<'a, 'tcx> Index<'tcx> { - pub fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Index<'tcx> { + pub fn new(tcx: TyCtxt<'tcx, 'tcx, '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<'a, '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, 'tcx, 'tcx>, module_def_id: DefId) { tcx.hir().visit_item_likes_in_module(module_def_id, &mut Checker { tcx }.as_deep_visitor()); } @@ -501,8 +501,8 @@ pub fn deprecation_in_effect(since: &str) -> bool { } } -struct Checker<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, +struct Checker<'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } /// Result of `TyCtxt::eval_stability`. @@ -521,7 +521,7 @@ pub enum EvalResult { Unmarked, } -impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { +impl<'a, 'gcx, 'tcx> TyCtxt<'tcx, 'gcx, '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. @@ -752,7 +752,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } } -impl<'a, 'tcx> Visitor<'tcx> for Checker<'a, 'tcx> { +impl Visitor<'tcx> for Checker<'tcx> { /// Because stability levels are scoped lexically, we want to walk /// nested items in the context of the outer item, so enable /// deep-walking. @@ -827,7 +827,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Checker<'a, 'tcx> { } } -impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { +impl<'a, 'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { pub fn lookup_deprecation(self, id: DefId) -> Option { self.lookup_deprecation_entry(id).map(|depr| depr.attr) } @@ -836,7 +836,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, '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<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { +pub fn check_unused_or_stable_features<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, '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<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { } fn unnecessary_stable_feature_lint<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, '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 75c21c738f7a0..2d2213672b64b 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<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, '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<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, '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 @@ -72,7 +72,7 @@ pub fn whitelisted(tcx: TyCtxt<'_, '_, '_>, lang_item: lang_items::LangItem) -> false } -fn verify<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn verify<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, '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<'a, 'tcx, 'gcx> TyCtxt<'a, 'tcx, 'gcx> { +impl<'a, 'tcx, 'gcx> TyCtxt<'gcx, 'tcx, 'gcx> { pub fn is_weak_lang_item(&self, item_def_id: DefId) -> bool { let lang_items = self.lang_items(); let did = Some(item_def_id); diff --git a/src/librustc/mir/interpret/error.rs b/src/librustc/mir/interpret/error.rs index a9a34f78f54d7..7024129c9d6f0 100644 --- a/src/librustc/mir/interpret/error.rs +++ b/src/librustc/mir/interpret/error.rs @@ -76,7 +76,7 @@ impl<'tcx> fmt::Display for FrameInfo<'tcx> { impl<'a, 'gcx, 'tcx> ConstEvalErr<'tcx> { pub fn struct_error(&self, - tcx: TyCtxtAt<'a, 'gcx, 'tcx>, + tcx: TyCtxtAt<'gcx, 'tcx>, message: &str) -> Result, ErrorHandled> { @@ -84,7 +84,7 @@ impl<'a, 'gcx, 'tcx> ConstEvalErr<'tcx> { } pub fn report_as_error(&self, - tcx: TyCtxtAt<'a, 'gcx, 'tcx>, + tcx: TyCtxtAt<'gcx, 'tcx>, message: &str ) -> ErrorHandled { let err = self.struct_error(tcx, message); @@ -98,7 +98,7 @@ impl<'a, 'gcx, 'tcx> ConstEvalErr<'tcx> { } pub fn report_as_lint(&self, - tcx: TyCtxtAt<'a, 'gcx, 'tcx>, + tcx: TyCtxtAt<'gcx, 'tcx>, message: &str, lint_root: hir::HirId, span: Option, @@ -131,7 +131,7 @@ impl<'a, 'gcx, 'tcx> ConstEvalErr<'tcx> { fn struct_generic( &self, - tcx: TyCtxtAt<'a, 'gcx, 'tcx>, + tcx: TyCtxtAt<'gcx, 'tcx>, message: &str, lint_root: Option, ) -> Result, ErrorHandled> { @@ -173,7 +173,7 @@ impl<'a, 'gcx, 'tcx> ConstEvalErr<'tcx> { } pub fn struct_error<'a, 'gcx, 'tcx>( - tcx: TyCtxtAt<'a, 'gcx, 'tcx>, + tcx: TyCtxtAt<'gcx, 'tcx>, msg: &str, ) -> DiagnosticBuilder<'tcx> { struct_span_err!(tcx.sess, tcx.span, E0080, "{}", msg) diff --git a/src/librustc/mir/interpret/mod.rs b/src/librustc/mir/interpret/mod.rs index 15b09f65c74c9..3e8bbbcb5c2f0 100644 --- a/src/librustc/mir/interpret/mod.rs +++ b/src/librustc/mir/interpret/mod.rs @@ -69,7 +69,7 @@ pub fn specialized_encode_alloc_id< E: Encoder, >( encoder: &mut E, - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, alloc_id: AllocId, ) -> Result<(), E::Error> { let alloc: GlobalAlloc<'tcx> = @@ -150,8 +150,7 @@ impl<'s> AllocDecodingSession<'s> { pub fn decode_alloc_id<'a, 'tcx, D>(&self, decoder: &mut D) -> Result - where D: TyDecoder<'a, 'tcx>, - 'tcx: 'a, + where D: TyDecoder<'tcx>, { // Read the index of the allocation let idx = decoder.read_u32()? as usize; diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs index 310228838e0ad..7753c64d7e338 100644 --- a/src/librustc/mir/mod.rs +++ b/src/librustc/mir/mod.rs @@ -1241,7 +1241,7 @@ impl<'tcx> Terminator<'tcx> { impl<'tcx> TerminatorKind<'tcx> { pub fn if_<'a, 'gcx>( - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, cond: Operand<'tcx>, t: BasicBlock, f: BasicBlock, @@ -2324,7 +2324,7 @@ impl<'tcx> Operand<'tcx> { /// with given `DefId` and substs. Since this is used to synthesize /// MIR, assumes `user_ty` is None. pub fn function_handle<'a>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, substs: SubstsRef<'tcx>, span: Span, diff --git a/src/librustc/mir/mono.rs b/src/librustc/mir/mono.rs index 79228a5c56f2d..60598d1e7673a 100644 --- a/src/librustc/mir/mono.rs +++ b/src/librustc/mir/mono.rs @@ -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<'a>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> usize { match *self { MonoItem::Fn(instance) => { // Estimate the size of a function based on how many statements @@ -72,7 +72,7 @@ impl<'tcx> MonoItem<'tcx> { } } - pub fn symbol_name(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> SymbolName { + pub fn symbol_name(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> SymbolName { match *self { MonoItem::Fn(instance) => tcx.symbol_name(instance), MonoItem::Static(def_id) => { @@ -88,7 +88,7 @@ impl<'tcx> MonoItem<'tcx> { } pub fn instantiation_mode(&self, - tcx: TyCtxt<'a, 'tcx, 'tcx>) + tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> InstantiationMode { let inline_in_all_cgus = tcx.sess.opts.debugging_opts.inline_in_all_cgus.unwrap_or_else(|| { @@ -133,7 +133,7 @@ impl<'tcx> MonoItem<'tcx> { } } - pub fn explicit_linkage(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Option { + pub fn explicit_linkage(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Option { let def_id = match *self { MonoItem::Fn(ref instance) => instance.def_id(), MonoItem::Static(def_id) => def_id, @@ -169,7 +169,7 @@ impl<'tcx> MonoItem<'tcx> { /// 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, 'tcx>) -> bool { debug!("is_instantiable({:?})", self); let (def_id, substs) = match *self { MonoItem::Fn(ref instance) => (instance.def_id(), instance.substs), @@ -181,7 +181,7 @@ impl<'tcx> MonoItem<'tcx> { 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, 'tcx>, debug: bool) -> String { return match *self { MonoItem::Fn(instance) => { to_string_internal(tcx, "fn ", instance, debug) @@ -195,7 +195,7 @@ impl<'tcx> MonoItem<'tcx> { } }; - fn to_string_internal<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, + fn to_string_internal<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, prefix: &str, instance: Instance<'tcx>, debug: bool) @@ -208,7 +208,7 @@ impl<'tcx> MonoItem<'tcx> { } } - pub fn local_span(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Option { + pub fn local_span(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Option { match *self { MonoItem::Fn(Instance { def, .. }) => { tcx.hir().as_local_hir_id(def.def_id()) @@ -334,7 +334,7 @@ impl<'tcx> CodegenUnit<'tcx> { base_n::encode(hash, base_n::CASE_INSENSITIVE) } - pub fn estimate_size<'a>(&mut self, tcx: TyCtxt<'a, 'tcx, 'tcx>) { + pub fn estimate_size<'a>(&mut self, tcx: TyCtxt<'tcx, '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()); @@ -370,7 +370,7 @@ impl<'tcx> CodegenUnit<'tcx> { } pub fn items_in_deterministic_order<'a>(&self, - tcx: TyCtxt<'a, 'tcx, 'tcx>) + tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Vec<(MonoItem<'tcx>, (Linkage, Visibility))> { // The codegen tests rely on items being process in the same order as @@ -378,7 +378,7 @@ impl<'tcx> CodegenUnit<'tcx> { #[derive(PartialEq, Eq, PartialOrd, Ord)] pub struct ItemSortKey(Option, SymbolName); - fn item_sort_key<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, + fn item_sort_key<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item: MonoItem<'tcx>) -> ItemSortKey { ItemSortKey(match item { MonoItem::Fn(ref instance) => { @@ -415,7 +415,7 @@ impl<'tcx> CodegenUnit<'tcx> { items } - pub fn codegen_dep_node(&self, tcx: TyCtxt<'_, 'tcx, 'tcx>) -> DepNode { + pub fn codegen_dep_node(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> DepNode { DepNode::new(tcx, DepConstructor::CompileCodegenUnit(self.name().clone())) } } @@ -445,14 +445,13 @@ impl<'a, 'tcx> HashStable> for CodegenUnit<'tcx> { } } -pub struct CodegenUnitNameBuilder<'a, 'gcx: 'tcx, 'tcx: 'a> { - tcx: TyCtxt<'a, 'gcx, 'tcx>, +pub struct CodegenUnitNameBuilder<'gcx, 'tcx> { + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, cache: FxHashMap, } -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<'tcx, 'gcx, 'tcx>) -> Self { CodegenUnitNameBuilder { tcx, cache: Default::default(), diff --git a/src/librustc/mir/tcx.rs b/src/librustc/mir/tcx.rs index 5135aeb2392cd..30676bb6044f1 100644 --- a/src/librustc/mir/tcx.rs +++ b/src/librustc/mir/tcx.rs @@ -33,7 +33,7 @@ impl<'a, 'gcx, 'tcx> PlaceTy<'tcx> { /// not carry a `Ty` for `T`.) /// /// Note that the resulting type has not been normalized. - pub fn field_ty(self, tcx: TyCtxt<'a, 'gcx, 'tcx>, f: &Field) -> Ty<'tcx> + pub fn field_ty(self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, f: &Field) -> Ty<'tcx> { let answer = match self.ty.sty { ty::Adt(adt_def, substs) => { @@ -57,7 +57,7 @@ impl<'a, 'gcx, 'tcx> PlaceTy<'tcx> { /// Convenience wrapper around `projection_ty_core` for /// `PlaceElem`, where we can just use the `Ty` that is already /// stored inline on field projection elems. - pub fn projection_ty(self, tcx: TyCtxt<'a, 'gcx, 'tcx>, + pub fn projection_ty(self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, elem: &PlaceElem<'tcx>) -> PlaceTy<'tcx> { @@ -71,7 +71,7 @@ impl<'a, 'gcx, 'tcx> PlaceTy<'tcx> { /// (which should be trivial when `T` = `Ty`). pub fn projection_ty_core( self, - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, elem: &ProjectionElem, mut handle_field: impl FnMut(&Self, &Field, &T) -> Ty<'tcx>) -> PlaceTy<'tcx> @@ -121,7 +121,7 @@ BraceStructTypeFoldableImpl! { } impl<'tcx> Place<'tcx> { - pub fn ty<'a, 'gcx, D>(&self, local_decls: &D, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> PlaceTy<'tcx> + pub fn ty<'a, 'gcx, D>(&self, local_decls: &D, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> PlaceTy<'tcx> where D: HasLocalDecls<'tcx> { match *self { @@ -141,7 +141,7 @@ pub enum RvalueInitializationState { } impl<'tcx> Rvalue<'tcx> { - pub fn ty<'a, 'gcx, D>(&self, local_decls: &D, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Ty<'tcx> + pub fn ty<'a, 'gcx, D>(&self, local_decls: &D, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx> where D: HasLocalDecls<'tcx> { match *self { @@ -222,7 +222,7 @@ impl<'tcx> Rvalue<'tcx> { } impl<'tcx> Operand<'tcx> { - pub fn ty<'a, 'gcx, D>(&self, local_decls: &D, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Ty<'tcx> + pub fn ty<'a, 'gcx, D>(&self, local_decls: &D, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx> where D: HasLocalDecls<'tcx> { match self { @@ -234,7 +234,7 @@ impl<'tcx> Operand<'tcx> { } impl<'tcx> BinOp { - pub fn ty<'a, 'gcx>(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, + pub fn ty<'a, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, lhs_ty: Ty<'tcx>, rhs_ty: Ty<'tcx>) -> Ty<'tcx> { diff --git a/src/librustc/traits/auto_trait.rs b/src/librustc/traits/auto_trait.rs index 9ce35d15d3c33..480d76b308dee 100644 --- a/src/librustc/traits/auto_trait.rs +++ b/src/librustc/traits/auto_trait.rs @@ -47,12 +47,12 @@ pub struct AutoTraitInfo<'cx> { pub vid_to_region: FxHashMap>, } -pub struct AutoTraitFinder<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, +pub struct AutoTraitFinder<'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } -impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { - pub fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Self { +impl<'tcx> AutoTraitFinder<'tcx> { + pub fn new(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Self { AutoTraitFinder { tcx } } @@ -232,7 +232,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { } } -impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { +impl AutoTraitFinder<'tcx> { // The core logic responsible for computing the bounds for our synthesized impl. // // To calculate the bounds, we call SelectionContext.select in a loop. Like FulfillmentContext, @@ -834,11 +834,11 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { // Replaces all ReVars in a type with ty::Region's, using the provided map pub struct RegionReplacer<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { vid_to_region: &'a FxHashMap>, - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, } impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for RegionReplacer<'a, 'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'b, 'gcx, 'tcx> { + fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.tcx } diff --git a/src/librustc/traits/codegen/mod.rs b/src/librustc/traits/codegen/mod.rs index 591557eb2bea5..d576c13844d1e 100644 --- a/src/librustc/traits/codegen/mod.rs +++ b/src/librustc/traits/codegen/mod.rs @@ -18,7 +18,7 @@ use crate::ty::fold::TypeFoldable; /// that type check should guarantee to us that all nested /// obligations *could be* resolved if we wanted to. /// Assumes that this is run after the entire crate has been successfully type-checked. -pub fn codegen_fulfill_obligation<'a, 'tcx>(ty: TyCtxt<'a, 'tcx, 'tcx>, +pub fn codegen_fulfill_obligation<'a, 'tcx>(ty: TyCtxt<'tcx, 'tcx, 'tcx>, (param_env, trait_ref): (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>)) -> Vtable<'tcx, ()> @@ -74,7 +74,7 @@ pub fn codegen_fulfill_obligation<'a, 'tcx>(ty: TyCtxt<'a, 'tcx, 'tcx>, }) } -impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { +impl<'a, 'tcx> TyCtxt<'tcx, 'tcx, 'tcx> { /// Monomorphizes a type from the AST by first applying the /// in-scope substitutions and then normalizing any associated /// types. diff --git a/src/librustc/traits/coherence.rs b/src/librustc/traits/coherence.rs index c6521a931bb29..db9e7fc4b6d9b 100644 --- a/src/librustc/traits/coherence.rs +++ b/src/librustc/traits/coherence.rs @@ -49,7 +49,7 @@ pub fn add_placeholder_note(err: &mut errors::DiagnosticBuilder<'_>) { /// with a suitably-freshened `ImplHeader` with those types /// substituted. Otherwise, invokes `no_overlap`. pub fn overlapping_impls<'gcx, F1, F2, R>( - tcx: TyCtxt<'_, 'gcx, 'gcx>, + tcx: TyCtxt<'gcx, 'gcx, 'gcx>, impl1_def_id: DefId, impl2_def_id: DefId, intercrate_mode: IntercrateMode, @@ -183,7 +183,7 @@ fn overlap_within_probe( Some(OverlapResult { impl_header, intercrate_ambiguity_causes, involves_placeholder }) } -pub fn trait_ref_is_knowable<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, +pub fn trait_ref_is_knowable<'a, 'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, trait_ref: ty::TraitRef<'tcx>) -> Option { @@ -229,7 +229,7 @@ pub fn trait_ref_is_knowable<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, } } -pub fn trait_ref_is_local_or_fundamental<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, +pub fn trait_ref_is_local_or_fundamental<'a, 'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, trait_ref: ty::TraitRef<'tcx>) -> bool { trait_ref.def_id.krate == LOCAL_CRATE || tcx.has_attr(trait_ref.def_id, sym::fundamental) @@ -246,7 +246,7 @@ pub enum OrphanCheckErr<'tcx> { /// /// 1. All type parameters in `Self` must be "covered" by some local type constructor. /// 2. Some local type must appear in `Self`. -pub fn orphan_check<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, +pub fn orphan_check<'a, 'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, impl_def_id: DefId) -> Result<(), OrphanCheckErr<'tcx>> { diff --git a/src/librustc/traits/engine.rs b/src/librustc/traits/engine.rs index 2f019d823ff5d..23bbd9192b1cc 100644 --- a/src/librustc/traits/engine.rs +++ b/src/librustc/traits/engine.rs @@ -78,7 +78,7 @@ impl> TraitEngineExt<'tcx> for T { } impl dyn TraitEngine<'tcx> { - pub fn new(tcx: TyCtxt<'_, '_, 'tcx>) -> Box { + pub fn new(tcx: TyCtxt<'tcx, '_, 'tcx>) -> Box { if tcx.sess.opts.debugging_opts.chalk { Box::new(ChalkFulfillmentContext::new()) } else { diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs index 50d2eeef421c1..5b3e0dde0cc72 100644 --- a/src/librustc/traits/error_reporting.rs +++ b/src/librustc/traits/error_reporting.rs @@ -1249,7 +1249,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { found: ty::PolyTraitRef<'tcx>) -> DiagnosticBuilder<'tcx> { - fn build_fn_sig_string<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, + fn build_fn_sig_string<'a, 'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, trait_ref: &ty::TraitRef<'tcx>) -> String { let inputs = trait_ref.substs.type_at(1); let sig = if let ty::Tuple(inputs) = inputs.sty { @@ -1294,7 +1294,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { } } -impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { +impl<'a, 'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { pub fn recursive_type_with_infinite_size_error(self, type_def_id: DefId) -> DiagnosticBuilder<'tcx> @@ -1457,7 +1457,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { } impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for ParamToVarFolder<'a, 'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'b, 'gcx, 'tcx> { self.infcx.tcx } + fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.infcx.tcx } fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> { if let ty::Param(ty::ParamTy {name, .. }) = ty.sty { diff --git a/src/librustc/traits/mod.rs b/src/librustc/traits/mod.rs index fd2d8fd0661a5..774150ce7ad33 100644 --- a/src/librustc/traits/mod.rs +++ b/src/librustc/traits/mod.rs @@ -140,7 +140,7 @@ pub struct ObligationCause<'tcx> { } impl<'tcx> ObligationCause<'tcx> { - pub fn span<'a, 'gcx>(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Span { + pub fn span<'a, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Span { match self.code { ObligationCauseCode::CompareImplMethodObligation { .. } | ObligationCauseCode::MainFunctionType | @@ -365,7 +365,7 @@ impl<'tcx> DomainGoal<'tcx> { impl<'tcx> GoalKind<'tcx> { pub fn from_poly_domain_goal<'a, 'gcx>( domain_goal: PolyDomainGoal<'tcx>, - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, ) -> GoalKind<'tcx> { match domain_goal.no_bound_vars() { Some(p) => p.into_goal(), @@ -710,7 +710,7 @@ pub fn type_known_to_meet_bound_modulo_regions<'a, 'gcx, 'tcx>( } } -fn do_normalize_predicates<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn do_normalize_predicates<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, region_context: DefId, cause: ObligationCause<'tcx>, elaborated_env: ty::ParamEnv<'tcx>, @@ -795,7 +795,7 @@ fn do_normalize_predicates<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // FIXME: this is gonna need to be removed ... /// Normalizes the parameter environment, reporting errors if they occur. -pub fn normalize_param_env_or_error<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +pub fn normalize_param_env_or_error<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, region_context: DefId, unnormalized_env: ty::ParamEnv<'tcx>, cause: ObligationCause<'tcx>) @@ -936,7 +936,7 @@ pub fn fully_normalize<'a, 'gcx, 'tcx, T>( /// environment. If this returns false, then either normalize /// encountered an error or one of the predicates did not hold. Used /// when creating vtables to check for unsatisfiable methods. -fn normalize_and_test_predicates<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn normalize_and_test_predicates<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, predicates: Vec>) -> bool { @@ -965,7 +965,7 @@ fn normalize_and_test_predicates<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, result } -fn substitute_normalize_and_test_predicates<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn substitute_normalize_and_test_predicates<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, key: (DefId, SubstsRef<'tcx>)) -> bool { @@ -984,7 +984,7 @@ fn substitute_normalize_and_test_predicates<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx /// that come from `trait_ref`, including its supertraits. #[inline] // FIXME(#35870): avoid closures being unexported due to `impl Trait`. fn vtable_methods<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, trait_ref: ty::PolyTraitRef<'tcx>) -> &'tcx [Option<(DefId, SubstsRef<'tcx>)>] { @@ -1207,16 +1207,16 @@ where fn lift_ex_clause_to_tcx<'a, 'gcx>( ex_clause: &chalk_engine::ExClause, - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, ) -> Option; fn lift_delayed_literal_to_tcx<'a, 'gcx>( ex_clause: &chalk_engine::DelayedLiteral, - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, ) -> Option; fn lift_literal_to_tcx<'a, 'gcx>( ex_clause: &chalk_engine::Literal, - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, ) -> Option; } diff --git a/src/librustc/traits/object_safety.rs b/src/librustc/traits/object_safety.rs index 5006ff75667e8..9e8cb58e6ea77 100644 --- a/src/librustc/traits/object_safety.rs +++ b/src/librustc/traits/object_safety.rs @@ -83,7 +83,7 @@ pub enum MethodViolationCode { UndispatchableReceiver, } -impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { +impl<'a, 'tcx> TyCtxt<'tcx, 'tcx, 'tcx> { /// Returns the object safety violations that affect /// astconv -- currently, `Self` in supertraits. This is needed @@ -703,7 +703,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { } } -pub(super) fn is_object_safe_provider<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +pub(super) fn is_object_safe_provider<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, trait_def_id: DefId) -> bool { tcx.object_safety_violations(trait_def_id).is_empty() } diff --git a/src/librustc/traits/on_unimplemented.rs b/src/librustc/traits/on_unimplemented.rs index b78396c90dc65..5ddc3e8fe5103 100644 --- a/src/librustc/traits/on_unimplemented.rs +++ b/src/librustc/traits/on_unimplemented.rs @@ -52,7 +52,7 @@ fn parse_error(tcx: TyCtxt<'_, '_, '_>, span: Span, } impl<'a, 'gcx, 'tcx> OnUnimplementedDirective { - fn parse(tcx: TyCtxt<'a, 'gcx, 'tcx>, + fn parse(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, trait_def_id: DefId, items: &[NestedMetaItem], span: Span, @@ -133,7 +133,7 @@ impl<'a, 'gcx, 'tcx> OnUnimplementedDirective { } - pub fn of_item(tcx: TyCtxt<'a, 'gcx, 'tcx>, + pub fn of_item(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, trait_def_id: DefId, impl_def_id: DefId) -> Result, ErrorReported> @@ -165,7 +165,7 @@ impl<'a, 'gcx, 'tcx> OnUnimplementedDirective { } pub fn evaluate(&self, - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, trait_ref: ty::TraitRef<'tcx>, options: &[(Symbol, Option)]) -> OnUnimplementedNote @@ -215,7 +215,7 @@ impl<'a, 'gcx, 'tcx> OnUnimplementedDirective { } impl<'a, 'gcx, 'tcx> OnUnimplementedFormatString { - fn try_parse(tcx: TyCtxt<'a, 'gcx, 'tcx>, + fn try_parse(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, trait_def_id: DefId, from: LocalInternedString, err_sp: Span) @@ -228,7 +228,7 @@ impl<'a, 'gcx, 'tcx> OnUnimplementedFormatString { fn verify( &self, - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, trait_def_id: DefId, span: Span, ) -> Result<(), ErrorReported> { @@ -274,7 +274,7 @@ impl<'a, 'gcx, 'tcx> OnUnimplementedFormatString { pub fn format( &self, - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, trait_ref: ty::TraitRef<'tcx>, options: &FxHashMap, ) -> String { diff --git a/src/librustc/traits/project.rs b/src/librustc/traits/project.rs index 3ee6d0cc67b45..6f52aaa020532 100644 --- a/src/librustc/traits/project.rs +++ b/src/librustc/traits/project.rs @@ -323,7 +323,7 @@ impl<'a, 'b, 'gcx, 'tcx> AssocTypeNormalizer<'a, 'b, 'gcx, 'tcx> { } impl<'a, 'b, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for AssocTypeNormalizer<'a, 'b, 'gcx, 'tcx> { - fn tcx<'c>(&'c self) -> TyCtxt<'c, 'gcx, 'tcx> { + fn tcx<'c>(&'c self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.selcx.tcx() } @@ -836,7 +836,7 @@ struct Progress<'tcx> { } impl<'tcx> Progress<'tcx> { - fn error<'a,'gcx>(tcx: TyCtxt<'a,'gcx,'tcx>) -> Self { + fn error<'a,'gcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Self { Progress { ty: tcx.types.err, obligations: vec![], diff --git a/src/librustc/traits/query/dropck_outlives.rs b/src/librustc/traits/query/dropck_outlives.rs index c4aa14d2b7ebc..7fdf3ddceb55b 100644 --- a/src/librustc/traits/query/dropck_outlives.rs +++ b/src/librustc/traits/query/dropck_outlives.rs @@ -87,7 +87,7 @@ pub struct DropckOutlivesResult<'tcx> { impl<'tcx> DropckOutlivesResult<'tcx> { pub fn report_overflows( &self, - tcx: TyCtxt<'_, '_, 'tcx>, + tcx: TyCtxt<'tcx, '_, 'tcx>, span: Span, ty: Ty<'tcx>, ) { @@ -106,7 +106,7 @@ impl<'tcx> DropckOutlivesResult<'tcx> { pub fn into_kinds_reporting_overflows( self, - tcx: TyCtxt<'_, '_, 'tcx>, + tcx: TyCtxt<'tcx, '_, 'tcx>, span: Span, ty: Ty<'tcx>, ) -> Vec> { @@ -190,7 +190,7 @@ impl_stable_hash_for!(struct DtorckConstraint<'tcx> { /// /// Note also that `needs_drop` requires a "global" type (i.e., one /// with erased regions), but this function does not. -pub fn trivial_dropck_outlives<'tcx>(tcx: TyCtxt<'_, '_, 'tcx>, ty: Ty<'tcx>) -> bool { +pub fn trivial_dropck_outlives<'tcx>(tcx: TyCtxt<'tcx, '_, 'tcx>, ty: Ty<'tcx>) -> bool { match ty.sty { // None of these types have a destructor and hence they do not // require anything in particular to outlive the dtor's diff --git a/src/librustc/traits/query/normalize.rs b/src/librustc/traits/query/normalize.rs index 0b20ec884fc4d..8ee5447ab292a 100644 --- a/src/librustc/traits/query/normalize.rs +++ b/src/librustc/traits/query/normalize.rs @@ -83,7 +83,7 @@ struct QueryNormalizer<'cx, 'gcx: 'tcx, 'tcx: 'cx> { } impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for QueryNormalizer<'cx, 'gcx, 'tcx> { - fn tcx<'c>(&'c self) -> TyCtxt<'c, 'gcx, 'tcx> { + fn tcx<'c>(&'c self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.infcx.tcx } diff --git a/src/librustc/traits/query/normalize_erasing_regions.rs b/src/librustc/traits/query/normalize_erasing_regions.rs index 0c1252680c1db..6c8f0d779290d 100644 --- a/src/librustc/traits/query/normalize_erasing_regions.rs +++ b/src/librustc/traits/query/normalize_erasing_regions.rs @@ -10,7 +10,7 @@ use crate::ty::{self, Ty, TyCtxt}; use crate::ty::fold::{TypeFoldable, TypeFolder}; -impl<'cx, 'tcx> TyCtxt<'cx, 'tcx, 'tcx> { +impl<'cx, 'tcx> TyCtxt<'tcx, 'tcx, 'tcx> { /// Erase the regions in `value` and then fully normalize all the /// types found within. The result will also have regions erased. /// @@ -62,13 +62,13 @@ impl<'cx, 'tcx> TyCtxt<'cx, 'tcx, 'tcx> { } } -struct NormalizeAfterErasingRegionsFolder<'cx, 'tcx: 'cx> { - tcx: TyCtxt<'cx, 'tcx, 'tcx>, +struct NormalizeAfterErasingRegionsFolder<'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, } -impl<'cx, 'tcx> TypeFolder<'tcx, 'tcx> for NormalizeAfterErasingRegionsFolder<'cx, 'tcx> { - fn tcx<'a>(&'a self) -> TyCtxt<'a, 'tcx, 'tcx> { +impl TypeFolder<'tcx, 'tcx> for NormalizeAfterErasingRegionsFolder<'tcx> { + fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx, 'tcx> { self.tcx } diff --git a/src/librustc/traits/query/type_op/ascribe_user_type.rs b/src/librustc/traits/query/type_op/ascribe_user_type.rs index d9f573eb7e291..bb6b2272c783d 100644 --- a/src/librustc/traits/query/type_op/ascribe_user_type.rs +++ b/src/librustc/traits/query/type_op/ascribe_user_type.rs @@ -25,14 +25,14 @@ impl<'gcx: 'tcx, 'tcx> super::QueryTypeOp<'gcx, 'tcx> for AscribeUserType<'tcx> type QueryResponse = (); fn try_fast_path( - _tcx: TyCtxt<'_, 'gcx, 'tcx>, + _tcx: TyCtxt<'tcx, 'gcx, 'tcx>, _key: &ParamEnvAnd<'tcx, Self>, ) -> Option { None } fn perform_query( - tcx: TyCtxt<'_, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Self>>, ) -> Fallible> { tcx.type_op_ascribe_user_type(canonicalized) diff --git a/src/librustc/traits/query/type_op/eq.rs b/src/librustc/traits/query/type_op/eq.rs index 5c3ccc9a99537..a8e786809467d 100644 --- a/src/librustc/traits/query/type_op/eq.rs +++ b/src/librustc/traits/query/type_op/eq.rs @@ -18,7 +18,7 @@ impl<'gcx: 'tcx, 'tcx> super::QueryTypeOp<'gcx, 'tcx> for Eq<'tcx> { type QueryResponse = (); fn try_fast_path( - _tcx: TyCtxt<'_, 'gcx, 'tcx>, + _tcx: TyCtxt<'tcx, 'gcx, 'tcx>, key: &ParamEnvAnd<'tcx, Eq<'tcx>>, ) -> Option { if key.value.a == key.value.b { @@ -29,7 +29,7 @@ impl<'gcx: 'tcx, 'tcx> super::QueryTypeOp<'gcx, 'tcx> for Eq<'tcx> { } fn perform_query( - tcx: TyCtxt<'_, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Self>>, ) -> Fallible> { tcx.type_op_eq(canonicalized) diff --git a/src/librustc/traits/query/type_op/implied_outlives_bounds.rs b/src/librustc/traits/query/type_op/implied_outlives_bounds.rs index c48ca33b13fbc..537f6ccee62b7 100644 --- a/src/librustc/traits/query/type_op/implied_outlives_bounds.rs +++ b/src/librustc/traits/query/type_op/implied_outlives_bounds.rs @@ -18,14 +18,14 @@ impl<'gcx: 'tcx, 'tcx> super::QueryTypeOp<'gcx, 'tcx> for ImpliedOutlivesBounds< type QueryResponse = Vec>; fn try_fast_path( - _tcx: TyCtxt<'_, 'gcx, 'tcx>, + _tcx: TyCtxt<'tcx, 'gcx, 'tcx>, _key: &ParamEnvAnd<'tcx, Self>, ) -> Option { None } fn perform_query( - tcx: TyCtxt<'_, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Self>>, ) -> Fallible> { // FIXME this `unchecked_map` is only necessary because the diff --git a/src/librustc/traits/query/type_op/mod.rs b/src/librustc/traits/query/type_op/mod.rs index fd13acc7796f8..c1f76eb2f2f28 100644 --- a/src/librustc/traits/query/type_op/mod.rs +++ b/src/librustc/traits/query/type_op/mod.rs @@ -53,7 +53,7 @@ pub trait QueryTypeOp<'gcx: 'tcx, 'tcx>: /// actually hits the tcx cache lookup etc. Return `Some(r)` with /// a final result or `None` to do the full path. fn try_fast_path( - tcx: TyCtxt<'_, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, key: &ParamEnvAnd<'tcx, Self>, ) -> Option; @@ -64,7 +64,7 @@ pub trait QueryTypeOp<'gcx: 'tcx, 'tcx>: /// bad, because it would create subregion relationships that are /// not captured in the return value. fn perform_query( - tcx: TyCtxt<'_, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Self>>, ) -> Fallible>; diff --git a/src/librustc/traits/query/type_op/normalize.rs b/src/librustc/traits/query/type_op/normalize.rs index 594f55e52f8e6..3fc3d9607e777 100644 --- a/src/librustc/traits/query/type_op/normalize.rs +++ b/src/librustc/traits/query/type_op/normalize.rs @@ -24,7 +24,7 @@ where { type QueryResponse = T; - fn try_fast_path(_tcx: TyCtxt<'_, 'gcx, 'tcx>, key: &ParamEnvAnd<'tcx, Self>) -> Option { + fn try_fast_path(_tcx: TyCtxt<'tcx, 'gcx, 'tcx>, key: &ParamEnvAnd<'tcx, Self>) -> Option { if !key.value.value.has_projections() { Some(key.value.value) } else { @@ -33,7 +33,7 @@ where } fn perform_query( - tcx: TyCtxt<'_, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Self>>, ) -> Fallible> { T::type_op_method(tcx, canonicalized) @@ -48,7 +48,7 @@ where pub trait Normalizable<'gcx, 'tcx>: fmt::Debug + TypeFoldable<'tcx> + Lift<'gcx> + Copy { fn type_op_method( - tcx: TyCtxt<'_, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Normalize>>, ) -> Fallible>; @@ -64,7 +64,7 @@ where 'gcx: 'tcx, { fn type_op_method( - tcx: TyCtxt<'_, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Normalize>>, ) -> Fallible> { tcx.type_op_normalize_ty(canonicalized) @@ -82,7 +82,7 @@ where 'gcx: 'tcx, { fn type_op_method( - tcx: TyCtxt<'_, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Normalize>>, ) -> Fallible> { tcx.type_op_normalize_predicate(canonicalized) @@ -100,7 +100,7 @@ where 'gcx: 'tcx, { fn type_op_method( - tcx: TyCtxt<'_, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Normalize>>, ) -> Fallible> { tcx.type_op_normalize_poly_fn_sig(canonicalized) @@ -118,7 +118,7 @@ where 'gcx: 'tcx, { fn type_op_method( - tcx: TyCtxt<'_, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Normalize>>, ) -> Fallible> { tcx.type_op_normalize_fn_sig(canonicalized) diff --git a/src/librustc/traits/query/type_op/outlives.rs b/src/librustc/traits/query/type_op/outlives.rs index fc0c1c022fc80..ee5cd30bde841 100644 --- a/src/librustc/traits/query/type_op/outlives.rs +++ b/src/librustc/traits/query/type_op/outlives.rs @@ -22,7 +22,7 @@ where type QueryResponse = DropckOutlivesResult<'tcx>; fn try_fast_path( - tcx: TyCtxt<'_, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, key: &ParamEnvAnd<'tcx, Self>, ) -> Option { if trivial_dropck_outlives(tcx, key.value.dropped_ty) { @@ -33,7 +33,7 @@ where } fn perform_query( - tcx: TyCtxt<'_, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Self>>, ) -> Fallible> { // Subtle: note that we are not invoking diff --git a/src/librustc/traits/query/type_op/prove_predicate.rs b/src/librustc/traits/query/type_op/prove_predicate.rs index 50dedf6e87f40..6a46ea4057562 100644 --- a/src/librustc/traits/query/type_op/prove_predicate.rs +++ b/src/librustc/traits/query/type_op/prove_predicate.rs @@ -17,7 +17,7 @@ impl<'gcx: 'tcx, 'tcx> super::QueryTypeOp<'gcx, 'tcx> for ProvePredicate<'tcx> { type QueryResponse = (); fn try_fast_path( - tcx: TyCtxt<'_, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, key: &ParamEnvAnd<'tcx, Self>, ) -> Option { // Proving Sized, very often on "obviously sized" types like @@ -38,7 +38,7 @@ impl<'gcx: 'tcx, 'tcx> super::QueryTypeOp<'gcx, 'tcx> for ProvePredicate<'tcx> { } fn perform_query( - tcx: TyCtxt<'_, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Self>>, ) -> Fallible> { tcx.type_op_prove_predicate(canonicalized) diff --git a/src/librustc/traits/query/type_op/subtype.rs b/src/librustc/traits/query/type_op/subtype.rs index c45fb06313e16..346af0dd9df07 100644 --- a/src/librustc/traits/query/type_op/subtype.rs +++ b/src/librustc/traits/query/type_op/subtype.rs @@ -20,7 +20,7 @@ impl<'tcx> Subtype<'tcx> { impl<'gcx: 'tcx, 'tcx> super::QueryTypeOp<'gcx, 'tcx> for Subtype<'tcx> { type QueryResponse = (); - fn try_fast_path(_tcx: TyCtxt<'_, 'gcx, 'tcx>, key: &ParamEnvAnd<'tcx, Self>) -> Option<()> { + fn try_fast_path(_tcx: TyCtxt<'tcx, 'gcx, 'tcx>, key: &ParamEnvAnd<'tcx, Self>) -> Option<()> { if key.value.sub == key.value.sup { Some(()) } else { @@ -29,7 +29,7 @@ impl<'gcx: 'tcx, 'tcx> super::QueryTypeOp<'gcx, 'tcx> for Subtype<'tcx> { } fn perform_query( - tcx: TyCtxt<'_, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Self>>, ) -> Fallible> { tcx.type_op_subtype(canonicalized) diff --git a/src/librustc/traits/select.rs b/src/librustc/traits/select.rs index af0b51e637a36..4643e2498fc99 100644 --- a/src/librustc/traits/select.rs +++ b/src/librustc/traits/select.rs @@ -300,7 +300,7 @@ enum SelectionCandidate<'tcx> { impl<'a, 'tcx> ty::Lift<'tcx> for SelectionCandidate<'a> { type Lifted = SelectionCandidate<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { Some(match *self { BuiltinCandidate { has_nested } => BuiltinCandidate { has_nested }, ImplCandidate(def_id) => ImplCandidate(def_id), @@ -568,7 +568,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { self.infcx } - pub fn tcx(&self) -> TyCtxt<'cx, 'gcx, 'tcx> { + pub fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.infcx.tcx } diff --git a/src/librustc/traits/specialize/mod.rs b/src/librustc/traits/specialize/mod.rs index b5d45d040fb99..8043bca8e09a3 100644 --- a/src/librustc/traits/specialize/mod.rs +++ b/src/librustc/traits/specialize/mod.rs @@ -110,7 +110,7 @@ pub fn translate_substs<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>, /// that impl, a less specialized impl, or the trait default, /// whichever applies. pub fn find_associated_item<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, item: &ty::AssocItem, substs: SubstsRef<'tcx>, @@ -149,7 +149,7 @@ pub fn find_associated_item<'a, 'tcx>( /// Specialization is determined by the sets of types to which the impls apply; /// `impl1` specializes `impl2` if it applies to a subset of the types `impl2` applies /// to. -pub(super) fn specializes<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +pub(super) fn specializes<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, (impl1_def_id, impl2_def_id): (DefId, DefId)) -> bool { @@ -286,7 +286,7 @@ fn fulfill_implication<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>, // Query provider for `specialization_graph_of`. pub(super) fn specialization_graph_provider<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, trait_id: DefId, ) -> &'tcx specialization_graph::Graph { let mut sg = specialization_graph::Graph::new(); diff --git a/src/librustc/traits/specialize/specialization_graph.rs b/src/librustc/traits/specialize/specialization_graph.rs index 9a90b9fdaeaaa..8b386f3c0a0f5 100644 --- a/src/librustc/traits/specialize/specialization_graph.rs +++ b/src/librustc/traits/specialize/specialization_graph.rs @@ -84,7 +84,7 @@ enum Inserted { impl<'a, 'gcx, 'tcx> Children { /// Insert an impl into this set of children without comparing to any existing impls. fn insert_blindly(&mut self, - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, impl_def_id: DefId) { let trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap(); if let Some(sty) = fast_reject::simplify_type(tcx, trait_ref.self_ty(), false) { @@ -100,7 +100,7 @@ impl<'a, 'gcx, 'tcx> Children { /// an impl with a parent. The impl must be present in the list of /// children already. fn remove_existing(&mut self, - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, impl_def_id: DefId) { let trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap(); let vec: &mut Vec; @@ -119,7 +119,7 @@ impl<'a, 'gcx, 'tcx> Children { /// Attempt to insert an impl into this set of children, while comparing for /// specialization relationships. fn insert(&mut self, - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, impl_def_id: DefId, simplified_self: Option) -> Result @@ -294,7 +294,7 @@ impl<'a, 'gcx, 'tcx> Graph { /// conflicts with it (has overlap, but neither specializes the other), /// information about the area of overlap is returned in the `Err`. pub fn insert(&mut self, - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, impl_def_id: DefId) -> Result, OverlapError> { assert!(impl_def_id.is_local()); @@ -387,7 +387,7 @@ impl<'a, 'gcx, 'tcx> Graph { /// Insert cached metadata mapping from a child impl back to its parent. pub fn record_impl_from_cstore(&mut self, - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, parent: DefId, child: DefId) { if self.parent.insert(child, parent).is_some() { @@ -425,8 +425,8 @@ impl<'a, 'gcx, 'tcx> Node { /// Iterate over the items defined directly by the given (impl or trait) node. pub fn items( &self, - tcx: TyCtxt<'a, 'gcx, 'tcx>, - ) -> ty::AssocItemsIterator<'a, 'gcx, 'tcx> { + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + ) -> ty::AssocItemsIterator<'gcx, 'tcx> { tcx.associated_items(self.def_id()) } @@ -475,18 +475,18 @@ impl NodeItem { } } -impl<'a, 'gcx, 'tcx> Ancestors<'gcx> { +impl<'gcx, 'tcx> Ancestors<'gcx> { /// Search the items from the given ancestors, returning each definition /// with the given name and the given kind. // FIXME(#35870): avoid closures being unexported due to `impl Trait`. #[inline] pub fn defs( self, - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, trait_item_name: Ident, trait_item_kind: ty::AssocKind, trait_def_id: DefId, - ) -> impl Iterator> + Captures<'gcx> + Captures<'tcx> + 'a { + ) -> impl Iterator> + Captures<'gcx> + 'tcx { self.flat_map(move |node| { use crate::ty::AssocKind::*; node.items(tcx).filter(move |impl_item| match (trait_item_kind, impl_item.kind) { diff --git a/src/librustc/traits/structural_impls.rs b/src/librustc/traits/structural_impls.rs index f6108f2a28699..1591cad9ae51a 100644 --- a/src/librustc/traits/structural_impls.rs +++ b/src/librustc/traits/structural_impls.rs @@ -446,7 +446,7 @@ impl<'tcx> fmt::Display for traits::Clause<'tcx> { impl<'a, 'tcx> Lift<'tcx> for traits::SelectionError<'a> { type Lifted = traits::SelectionError<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { match *self { super::Unimplemented => Some(super::Unimplemented), super::OutputTypeParameterMismatch(a, b, ref err) => { @@ -464,7 +464,7 @@ impl<'a, 'tcx> Lift<'tcx> for traits::SelectionError<'a> { impl<'a, 'tcx> Lift<'tcx> for traits::ObligationCauseCode<'a> { type Lifted = traits::ObligationCauseCode<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { match *self { super::ReturnNoExpression => Some(super::ReturnNoExpression), super::MiscObligation => Some(super::MiscObligation), @@ -546,7 +546,7 @@ impl<'a, 'tcx> Lift<'tcx> for traits::ObligationCauseCode<'a> { impl<'a, 'tcx> Lift<'tcx> for traits::DerivedObligationCause<'a> { type Lifted = traits::DerivedObligationCause<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { tcx.lift(&self.parent_trait_ref).and_then(|trait_ref| tcx.lift(&*self.parent_code) .map(|code| traits::DerivedObligationCause { @@ -559,7 +559,7 @@ impl<'a, 'tcx> Lift<'tcx> for traits::DerivedObligationCause<'a> { impl<'a, 'tcx> Lift<'tcx> for traits::ObligationCause<'a> { type Lifted = traits::ObligationCause<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { tcx.lift(&self.code).map(|code| traits::ObligationCause { span: self.span, body_id: self.body_id, @@ -571,7 +571,7 @@ impl<'a, 'tcx> Lift<'tcx> for traits::ObligationCause<'a> { // For codegen only. impl<'a, 'tcx> Lift<'tcx> for traits::Vtable<'a, ()> { type Lifted = traits::Vtable<'tcx, ()>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { match self.clone() { traits::VtableImpl(traits::VtableImplData { impl_def_id, @@ -691,7 +691,7 @@ EnumLiftImpl! { impl<'a, 'tcx> Lift<'tcx> for traits::Environment<'a> { type Lifted = traits::Environment<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { tcx.lift(&self.clauses).map(|clauses| { traits::Environment { clauses, @@ -702,7 +702,7 @@ impl<'a, 'tcx> Lift<'tcx> for traits::Environment<'a> { impl<'a, 'tcx, G: Lift<'tcx>> Lift<'tcx> for traits::InEnvironment<'a, G> { type Lifted = traits::InEnvironment<'tcx, G::Lifted>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { tcx.lift(&self.environment).and_then(|environment| { tcx.lift(&self.goal).map(|goal| { traits::InEnvironment { @@ -721,7 +721,7 @@ where { type Lifted = C::LiftedExClause; - fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { ::lift_ex_clause_to_tcx(self, tcx) } } @@ -733,7 +733,7 @@ where { type Lifted = C::LiftedDelayedLiteral; - fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { ::lift_delayed_literal_to_tcx(self, tcx) } } @@ -745,7 +745,7 @@ where { type Lifted = C::LiftedLiteral; - fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { ::lift_literal_to_tcx(self, tcx) } } diff --git a/src/librustc/traits/util.rs b/src/librustc/traits/util.rs index 2f87a743a012c..3f0ac9036f8ba 100644 --- a/src/librustc/traits/util.rs +++ b/src/librustc/traits/util.rs @@ -12,7 +12,7 @@ use crate::util::nodemap::FxHashSet; use super::{Obligation, ObligationCause, PredicateObligation, SelectionContext, Normalized}; -fn anonymize_predicate<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, +fn anonymize_predicate<'a, 'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, pred: &ty::Predicate<'tcx>) -> ty::Predicate<'tcx> { match *pred { @@ -45,13 +45,13 @@ fn anonymize_predicate<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, } } -struct PredicateSet<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { - tcx: TyCtxt<'a, 'gcx, 'tcx>, +struct PredicateSet<'gcx, 'tcx> { + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, set: FxHashSet>, } -impl<'a, 'gcx, 'tcx> PredicateSet<'a, 'gcx, 'tcx> { - fn new(tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Self { +impl PredicateSet<'gcx, 'tcx> { + fn new(tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Self { Self { tcx: tcx, set: Default::default() } } @@ -70,7 +70,7 @@ impl<'a, 'gcx, 'tcx> PredicateSet<'a, 'gcx, 'tcx> { } } -impl<'a, 'gcx, 'tcx, T: AsRef>> Extend for PredicateSet<'a, 'gcx, 'tcx> { +impl>> Extend for PredicateSet<'gcx, 'tcx> { fn extend>(&mut self, iter: I) { for pred in iter { self.insert(pred.as_ref()); @@ -88,39 +88,39 @@ impl<'a, 'gcx, 'tcx, T: AsRef>> Extend for PredicateSet<' /// if we know that `T: Ord`, the elaborator would deduce that `T: PartialOrd` /// holds as well. Similarly, if we have `trait Foo: 'static`, and we know that /// `T: Foo`, then we know that `T: 'static`. -pub struct Elaborator<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { +pub struct Elaborator<'gcx, 'tcx> { stack: Vec>, - visited: PredicateSet<'a, 'gcx, 'tcx>, + visited: PredicateSet<'gcx, 'tcx>, } pub fn elaborate_trait_ref<'cx, 'gcx, 'tcx>( - tcx: TyCtxt<'cx, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, trait_ref: ty::PolyTraitRef<'tcx>) - -> Elaborator<'cx, 'gcx, 'tcx> + -> Elaborator<'gcx, 'tcx> { elaborate_predicates(tcx, vec![trait_ref.to_predicate()]) } pub fn elaborate_trait_refs<'cx, 'gcx, 'tcx>( - tcx: TyCtxt<'cx, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, trait_refs: impl Iterator>) - -> Elaborator<'cx, 'gcx, 'tcx> + -> Elaborator<'gcx, 'tcx> { let predicates = trait_refs.map(|trait_ref| trait_ref.to_predicate()).collect(); elaborate_predicates(tcx, predicates) } pub fn elaborate_predicates<'cx, 'gcx, 'tcx>( - tcx: TyCtxt<'cx, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, mut predicates: Vec>) - -> Elaborator<'cx, 'gcx, 'tcx> + -> Elaborator<'gcx, 'tcx> { let mut visited = PredicateSet::new(tcx); predicates.retain(|pred| visited.insert(pred)); Elaborator { stack: predicates, visited } } -impl<'cx, 'gcx, 'tcx> Elaborator<'cx, 'gcx, 'tcx> { +impl Elaborator<'gcx, 'tcx> { pub fn filter_to_traits(self) -> FilterToTraits { FilterToTraits::new(self) } @@ -232,7 +232,7 @@ impl<'cx, 'gcx, 'tcx> Elaborator<'cx, 'gcx, 'tcx> { } } -impl<'cx, 'gcx, 'tcx> Iterator for Elaborator<'cx, 'gcx, 'tcx> { +impl Iterator for Elaborator<'gcx, 'tcx> { type Item = ty::Predicate<'tcx>; fn size_hint(&self) -> (usize, Option) { @@ -254,17 +254,17 @@ impl<'cx, 'gcx, 'tcx> Iterator for Elaborator<'cx, 'gcx, 'tcx> { // Supertrait iterator /////////////////////////////////////////////////////////////////////////// -pub type Supertraits<'cx, 'gcx, 'tcx> = FilterToTraits>; +pub type Supertraits<'gcx, 'tcx> = FilterToTraits>; -pub fn supertraits<'cx, 'gcx, 'tcx>(tcx: TyCtxt<'cx, 'gcx, 'tcx>, +pub fn supertraits<'cx, 'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, trait_ref: ty::PolyTraitRef<'tcx>) - -> Supertraits<'cx, 'gcx, 'tcx> { + -> Supertraits<'gcx, 'tcx> { elaborate_trait_ref(tcx, trait_ref).filter_to_traits() } -pub fn transitive_bounds<'cx, 'gcx, 'tcx>(tcx: TyCtxt<'cx, 'gcx, 'tcx>, +pub fn transitive_bounds<'cx, 'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, bounds: impl Iterator>) - -> Supertraits<'cx, 'gcx, 'tcx> { + -> Supertraits<'gcx, 'tcx> { elaborate_trait_refs(tcx, bounds).filter_to_traits() } @@ -280,8 +280,8 @@ pub fn transitive_bounds<'cx, 'gcx, 'tcx>(tcx: TyCtxt<'cx, 'gcx, 'tcx>, /// `Read + Write + Sync + Send`. /// Expansion is done via a DFS (depth-first search), and the `visited` field /// is used to avoid cycles. -pub struct TraitAliasExpander<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { - tcx: TyCtxt<'a, 'gcx, 'tcx>, +pub struct TraitAliasExpander<'gcx, 'tcx> { + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, stack: Vec>, } @@ -338,9 +338,9 @@ impl<'tcx> TraitAliasExpansionInfo<'tcx> { } pub fn expand_trait_aliases<'cx, 'gcx, 'tcx>( - tcx: TyCtxt<'cx, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, trait_refs: impl IntoIterator, Span)> -) -> TraitAliasExpander<'cx, 'gcx, 'tcx> { +) -> TraitAliasExpander<'gcx, 'tcx> { let items: Vec<_> = trait_refs .into_iter() .map(|(trait_ref, span)| TraitAliasExpansionInfo::new(trait_ref, span)) @@ -348,7 +348,7 @@ pub fn expand_trait_aliases<'cx, 'gcx, 'tcx>( TraitAliasExpander { tcx, stack: items } } -impl<'cx, 'gcx, 'tcx> TraitAliasExpander<'cx, 'gcx, 'tcx> { +impl<'cx, 'gcx, 'tcx> TraitAliasExpander<'gcx, 'tcx> { /// If `item` is a trait alias and its predicate has not yet been visited, then expands `item` /// to the definition, pushes the resulting expansion onto `self.stack`, and returns `false`. /// Otherwise, immediately returns `true` if `item` is a regular trait, or `false` if it is a @@ -393,7 +393,7 @@ impl<'cx, 'gcx, 'tcx> TraitAliasExpander<'cx, 'gcx, 'tcx> { } } -impl<'cx, 'gcx, 'tcx> Iterator for TraitAliasExpander<'cx, 'gcx, 'tcx> { +impl<'cx, 'gcx, 'tcx> Iterator for TraitAliasExpander<'gcx, 'tcx> { type Item = TraitAliasExpansionInfo<'tcx>; fn size_hint(&self) -> (usize, Option) { @@ -414,15 +414,15 @@ impl<'cx, 'gcx, 'tcx> Iterator for TraitAliasExpander<'cx, 'gcx, 'tcx> { // Iterator over def-IDs of supertraits /////////////////////////////////////////////////////////////////////////// -pub struct SupertraitDefIds<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { - tcx: TyCtxt<'a, 'gcx, 'tcx>, +pub struct SupertraitDefIds<'gcx, 'tcx> { + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, stack: Vec, visited: FxHashSet, } -pub fn supertrait_def_ids<'cx, 'gcx, 'tcx>(tcx: TyCtxt<'cx, 'gcx, 'tcx>, +pub fn supertrait_def_ids<'cx, 'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, trait_def_id: DefId) - -> SupertraitDefIds<'cx, 'gcx, 'tcx> + -> SupertraitDefIds<'gcx, 'tcx> { SupertraitDefIds { tcx, @@ -431,7 +431,7 @@ pub fn supertrait_def_ids<'cx, 'gcx, 'tcx>(tcx: TyCtxt<'cx, 'gcx, 'tcx>, } } -impl<'cx, 'gcx, 'tcx> Iterator for SupertraitDefIds<'cx, 'gcx, 'tcx> { +impl Iterator for SupertraitDefIds<'gcx, 'tcx> { type Item = DefId; fn next(&mut self) -> Option { @@ -552,7 +552,7 @@ pub fn predicate_for_trait_ref<'tcx>( } } -impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { +impl<'a, 'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { pub fn predicate_for_trait_def(self, param_env: ty::ParamEnv<'tcx>, cause: ObligationCause<'tcx>, diff --git a/src/librustc/ty/_match.rs b/src/librustc/ty/_match.rs index 8640216b071ae..aca22baf7d1a7 100644 --- a/src/librustc/ty/_match.rs +++ b/src/librustc/ty/_match.rs @@ -19,19 +19,19 @@ use crate::mir::interpret::ConstValue; /// Like subtyping, matching is really a binary relation, so the only /// important thing about the result is Ok/Err. Also, matching never /// affects any type variables or unification state. -pub struct Match<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { - tcx: TyCtxt<'a, 'gcx, 'tcx> +pub struct Match<'gcx, 'tcx> { + tcx: TyCtxt<'tcx, 'gcx, 'tcx> } -impl<'a, 'gcx, 'tcx> Match<'a, 'gcx, 'tcx> { - pub fn new(tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Match<'a, 'gcx, 'tcx> { +impl Match<'gcx, 'tcx> { + pub fn new(tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Match<'gcx, 'tcx> { Match { tcx } } } -impl<'a, 'gcx, 'tcx> TypeRelation<'a, 'gcx, 'tcx> for Match<'a, 'gcx, 'tcx> { +impl TypeRelation<'gcx, 'tcx> for Match<'gcx, 'tcx> { fn tag(&self) -> &'static str { "Match" } - fn tcx(&self) -> TyCtxt<'a, 'gcx, 'tcx> { self.tcx } + fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.tcx } fn a_is_expected(&self) -> bool { true } // irrelevant fn relate_with_variance>(&mut self, diff --git a/src/librustc/ty/adjustment.rs b/src/librustc/ty/adjustment.rs index 11aad87b70dd3..191a584dd64a6 100644 --- a/src/librustc/ty/adjustment.rs +++ b/src/librustc/ty/adjustment.rs @@ -104,7 +104,7 @@ pub struct OverloadedDeref<'tcx> { } impl<'a, 'gcx, 'tcx> OverloadedDeref<'tcx> { - pub fn method_call(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, source: Ty<'tcx>) + pub fn method_call(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, source: Ty<'tcx>) -> (DefId, SubstsRef<'tcx>) { let trait_def_id = match self.mutbl { hir::MutImmutable => tcx.lang_items().deref_trait(), diff --git a/src/librustc/ty/codec.rs b/src/librustc/ty/codec.rs index a76cc3dfdec02..ade084a2135bf 100644 --- a/src/librustc/ty/codec.rs +++ b/src/librustc/ty/codec.rs @@ -107,9 +107,8 @@ pub fn encode_predicates<'tcx, E, C>(encoder: &mut E, Ok(()) } -pub trait TyDecoder<'a, 'tcx: 'a>: Decoder { - - fn tcx(&self) -> TyCtxt<'a, 'tcx, 'tcx>; +pub trait TyDecoder<'tcx>: Decoder { + fn tcx(&self) -> TyCtxt<'tcx, 'tcx, 'tcx>; fn peek_byte(&self) -> u8; @@ -135,7 +134,7 @@ pub trait TyDecoder<'a, 'tcx: 'a>: Decoder { pub fn decode_arena_allocable<'a, 'tcx, D, T: ArenaAllocatable + Decodable>( decoder: &mut D ) -> Result<&'tcx T, D::Error> - where D: TyDecoder<'a, 'tcx>, + where D: TyDecoder<'tcx>, 'tcx: 'a, { Ok(decoder.tcx().arena.alloc(Decodable::decode(decoder)?)) @@ -145,7 +144,7 @@ pub fn decode_arena_allocable<'a, 'tcx, D, T: ArenaAllocatable + Decodable>( pub fn decode_arena_allocable_slice<'a, 'tcx, D, T: ArenaAllocatable + Decodable>( decoder: &mut D ) -> Result<&'tcx [T], D::Error> - where D: TyDecoder<'a, 'tcx>, + where D: TyDecoder<'tcx>, 'tcx: 'a, { Ok(decoder.tcx().arena.alloc_from_iter( as Decodable>::decode(decoder)?)) @@ -153,7 +152,7 @@ pub fn decode_arena_allocable_slice<'a, 'tcx, D, T: ArenaAllocatable + Decodable #[inline] pub fn decode_cnum<'a, 'tcx, D>(decoder: &mut D) -> Result - where D: TyDecoder<'a, 'tcx>, + where D: TyDecoder<'tcx>, 'tcx: 'a, { let cnum = CrateNum::from_u32(u32::decode(decoder)?); @@ -162,7 +161,7 @@ pub fn decode_cnum<'a, 'tcx, D>(decoder: &mut D) -> Result #[inline] pub fn decode_ty<'a, 'tcx, D>(decoder: &mut D) -> Result, D::Error> - where D: TyDecoder<'a, 'tcx>, + where D: TyDecoder<'tcx>, 'tcx: 'a, { // Handle shorthands first, if we have an usize > 0x80. @@ -183,7 +182,7 @@ pub fn decode_ty<'a, 'tcx, D>(decoder: &mut D) -> Result, D::Error> #[inline] pub fn decode_predicates<'a, 'tcx, D>(decoder: &mut D) -> Result, D::Error> - where D: TyDecoder<'a, 'tcx>, + where D: TyDecoder<'tcx>, 'tcx: 'a, { Ok(ty::GenericPredicates { @@ -207,7 +206,7 @@ pub fn decode_predicates<'a, 'tcx, D>(decoder: &mut D) #[inline] pub fn decode_substs<'a, 'tcx, D>(decoder: &mut D) -> Result, D::Error> - where D: TyDecoder<'a, 'tcx>, + where D: TyDecoder<'tcx>, 'tcx: 'a, { let len = decoder.read_usize()?; @@ -217,7 +216,7 @@ pub fn decode_substs<'a, 'tcx, D>(decoder: &mut D) -> Result, D: #[inline] pub fn decode_region<'a, 'tcx, D>(decoder: &mut D) -> Result, D::Error> - where D: TyDecoder<'a, 'tcx>, + where D: TyDecoder<'tcx>, 'tcx: 'a, { Ok(decoder.tcx().mk_region(Decodable::decode(decoder)?)) @@ -226,7 +225,7 @@ pub fn decode_region<'a, 'tcx, D>(decoder: &mut D) -> Result, D #[inline] pub fn decode_ty_slice<'a, 'tcx, D>(decoder: &mut D) -> Result<&'tcx ty::List>, D::Error> - where D: TyDecoder<'a, 'tcx>, + where D: TyDecoder<'tcx>, 'tcx: 'a, { let len = decoder.read_usize()?; @@ -236,7 +235,7 @@ pub fn decode_ty_slice<'a, 'tcx, D>(decoder: &mut D) #[inline] pub fn decode_adt_def<'a, 'tcx, D>(decoder: &mut D) -> Result<&'tcx ty::AdtDef, D::Error> - where D: TyDecoder<'a, 'tcx>, + where D: TyDecoder<'tcx>, 'tcx: 'a, { let def_id = DefId::decode(decoder)?; @@ -246,7 +245,7 @@ pub fn decode_adt_def<'a, 'tcx, D>(decoder: &mut D) #[inline] pub fn decode_existential_predicate_slice<'a, 'tcx, D>(decoder: &mut D) -> Result<&'tcx ty::List>, D::Error> - where D: TyDecoder<'a, 'tcx>, + where D: TyDecoder<'tcx>, 'tcx: 'a, { let len = decoder.read_usize()?; @@ -257,7 +256,7 @@ pub fn decode_existential_predicate_slice<'a, 'tcx, D>(decoder: &mut D) #[inline] pub fn decode_canonical_var_infos<'a, 'tcx, D>(decoder: &mut D) -> Result, D::Error> - where D: TyDecoder<'a, 'tcx>, + where D: TyDecoder<'tcx>, 'tcx: 'a, { let len = decoder.read_usize()?; @@ -270,7 +269,7 @@ pub fn decode_canonical_var_infos<'a, 'tcx, D>(decoder: &mut D) #[inline] pub fn decode_const<'a, 'tcx, D>(decoder: &mut D) -> Result<&'tcx ty::Const<'tcx>, D::Error> - where D: TyDecoder<'a, 'tcx>, + where D: TyDecoder<'tcx>, 'tcx: 'a, { Ok(decoder.tcx().mk_const(Decodable::decode(decoder)?)) @@ -279,7 +278,7 @@ pub fn decode_const<'a, 'tcx, D>(decoder: &mut D) #[inline] pub fn decode_allocation<'a, 'tcx, D>(decoder: &mut D) -> Result<&'tcx Allocation, D::Error> - where D: TyDecoder<'a, 'tcx>, + where D: TyDecoder<'tcx>, 'tcx: 'a, { Ok(decoder.tcx().intern_const_alloc(Decodable::decode(decoder)?)) diff --git a/src/librustc/ty/constness.rs b/src/librustc/ty/constness.rs index 56f75e800f255..8cb2a9f33fba9 100644 --- a/src/librustc/ty/constness.rs +++ b/src/librustc/ty/constness.rs @@ -6,7 +6,7 @@ use syntax_pos::symbol::{sym, Symbol}; use crate::hir::map::blocks::FnLikeNode; use syntax::attr; -impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { +impl<'a, 'tcx> TyCtxt<'tcx, 'tcx, 'tcx> { /// Whether the `def_id` counts as const fn in your current crate, considering all active /// feature gates pub fn is_const_fn(self, def_id: DefId) -> bool { @@ -69,7 +69,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { pub fn provide<'tcx>(providers: &mut Providers<'tcx>) { /// only checks whether the function has a `const` modifier - fn is_const_fn_raw<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> bool { + fn is_const_fn_raw<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> bool { let hir_id = tcx.hir().as_local_hir_id(def_id) .expect("Non-local call to local provider is_const_fn"); @@ -83,7 +83,7 @@ pub fn provide<'tcx>(providers: &mut Providers<'tcx>) { } } - fn is_promotable_const_fn<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> bool { + fn is_promotable_const_fn<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> bool { tcx.is_const_fn(def_id) && match tcx.lookup_stability(def_id) { Some(stab) => { if cfg!(debug_assertions) && stab.promotable { @@ -101,7 +101,7 @@ pub fn provide<'tcx>(providers: &mut Providers<'tcx>) { } } - fn const_fn_is_allowed_fn_ptr<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> bool { + fn const_fn_is_allowed_fn_ptr<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> bool { tcx.is_const_fn(def_id) && tcx.lookup_stability(def_id) .map(|stab| stab.allow_const_fn_ptr).unwrap_or(false) diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index e60022033cc54..9e6c63026ddeb 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -1119,7 +1119,7 @@ pub struct GlobalCtxt<'tcx> { output_filenames: Arc, } -impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { +impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { /// Gets the global `TyCtxt`. #[inline] pub fn global_tcx(self) -> TyCtxt<'gcx, 'gcx, 'gcx> { @@ -1131,7 +1131,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } #[inline(always)] - pub fn hir(self) -> &'a hir_map::Map<'gcx> { + pub fn hir(self) -> &'tcx hir_map::Map<'gcx> { &self.hir_map } @@ -1469,7 +1469,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } #[inline(always)] - pub fn create_stable_hashing_context(self) -> StableHashingContext<'a> { + pub fn create_stable_hashing_context(self) -> StableHashingContext<'tcx> { let krate = self.gcx.hir_map.forest.untracked_krate(); StableHashingContext::new(self.sess, @@ -1666,7 +1666,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } } -impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { +impl<'a, 'tcx> TyCtxt<'tcx, 'tcx, 'tcx> { pub fn encode_metadata(self) -> EncodedMetadata { @@ -1725,7 +1725,7 @@ impl<'gcx> GlobalCtxt<'gcx> { /// e.g., `()` or `u8`, was interned in a different context. pub trait Lift<'tcx>: fmt::Debug { type Lifted: fmt::Debug + 'tcx; - fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Option; + fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option; } @@ -1733,7 +1733,7 @@ macro_rules! nop_lift { ($ty:ty => $lifted:ty) => { impl<'a, 'tcx> Lift<'tcx> for $ty { type Lifted = $lifted; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { if tcx.interners.arena.in_arena(*self as *const _) { return Some(unsafe { mem::transmute(*self) }); } @@ -1752,7 +1752,7 @@ macro_rules! nop_list_lift { ($ty:ty => $lifted:ty) => { impl<'a, 'tcx> Lift<'tcx> for &'a List<$ty> { type Lifted = &'tcx List<$lifted>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { if self.is_empty() { return Some(List::empty()); } @@ -1978,7 +1978,7 @@ pub mod tls { /// Creates a TyCtxt and ImplicitCtxt based on the GCX_PTR thread local. /// This is used in the deadlock handler. pub unsafe fn with_global(f: F) -> R - where F: for<'a, 'gcx, 'tcx> FnOnce(TyCtxt<'a, 'gcx, 'tcx>) -> R + where F: for<'a, 'gcx, 'tcx> FnOnce(TyCtxt<'tcx, 'gcx, 'tcx>) -> R { let gcx = GCX_PTR.with(|lock| *lock.lock()); assert!(gcx != 0); @@ -2030,7 +2030,7 @@ pub mod tls { /// This will panic if you pass it a TyCtxt which has a different global interner from /// the current ImplicitCtxt's tcx field. #[inline] - pub fn with_related_context<'a, 'gcx, 'tcx1, F, R>(tcx: TyCtxt<'a, 'gcx, 'tcx1>, f: F) -> R + pub fn with_related_context<'gcx, 'tcx1, F, R>(tcx: TyCtxt<'tcx1, 'gcx, 'tcx1>, f: F) -> R where F: for<'b, 'tcx2> FnOnce(&ImplicitCtxt<'b, 'gcx, 'tcx2>) -> R { with_context(|context| { @@ -2048,7 +2048,7 @@ pub mod tls { /// This will panic if you pass it a TyCtxt which has a different global interner or /// a different local interner from the current ImplicitCtxt's tcx field. #[inline] - pub fn with_fully_related_context<'a, 'gcx, 'tcx, F, R>(tcx: TyCtxt<'a, 'gcx, 'tcx>, f: F) -> R + pub fn with_fully_related_context<'gcx, 'tcx, F, R>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, f: F) -> R where F: for<'b> FnOnce(&ImplicitCtxt<'b, 'gcx, 'tcx>) -> R { with_context(|context| { @@ -2065,7 +2065,7 @@ pub mod tls { /// Panics if there is no ImplicitCtxt available #[inline] pub fn with(f: F) -> R - where F: for<'a, 'gcx, 'tcx> FnOnce(TyCtxt<'a, 'gcx, 'tcx>) -> R + where F: for<'a, 'gcx, 'tcx> FnOnce(TyCtxt<'tcx, 'gcx, 'tcx>) -> R { with_context(|context| f(context.tcx)) } @@ -2074,7 +2074,7 @@ pub mod tls { /// The closure is passed None if there is no ImplicitCtxt available #[inline] pub fn with_opt(f: F) -> R - where F: for<'a, 'gcx, 'tcx> FnOnce(Option>) -> R + where F: for<'a, 'gcx, 'tcx> FnOnce(Option>) -> R { with_context_opt(|opt_context| f(opt_context.map(|context| context.tcx))) } @@ -2151,7 +2151,7 @@ macro_rules! sty_debug_print { }} } -impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { +impl<'a, 'tcx> TyCtxt<'tcx, 'tcx, 'tcx> { pub fn print_debug_stats(self) { sty_debug_print!( self, @@ -2400,7 +2400,7 @@ intern_method! { ) -> List } -impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { +impl<'a, 'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { /// Given a `fn` type, returns an equivalent `unsafe fn` type; /// that is, a `fn` type that is equivalent in every way for being /// unsafe. diff --git a/src/librustc/ty/erase_regions.rs b/src/librustc/ty/erase_regions.rs index 1f2d45a4e7ff7..5f41aa9fac937 100644 --- a/src/librustc/ty/erase_regions.rs +++ b/src/librustc/ty/erase_regions.rs @@ -8,13 +8,13 @@ pub(super) fn provide(providers: &mut ty::query::Providers<'_>) { }; } -fn erase_regions_ty<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ty: Ty<'tcx>) -> Ty<'tcx> { +fn erase_regions_ty<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ty: Ty<'tcx>) -> Ty<'tcx> { // N.B., use `super_fold_with` here. If we used `fold_with`, it // could invoke the `erase_regions_ty` query recursively. ty.super_fold_with(&mut RegionEraserVisitor { tcx }) } -impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { +impl<'a, 'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { /// Returns an equivalent value with all free regions removed (note /// that late-bound regions remain, because they are important for /// subtyping, but they are anonymized and normalized as well).. @@ -32,12 +32,12 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } } -struct RegionEraserVisitor<'a, 'gcx: 'tcx, 'tcx: 'a> { - tcx: TyCtxt<'a, 'gcx, 'tcx>, +struct RegionEraserVisitor<'gcx, 'tcx> { + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, } -impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for RegionEraserVisitor<'a, 'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'b, 'gcx, 'tcx> { +impl TypeFolder<'gcx, 'tcx> for RegionEraserVisitor<'gcx, 'tcx> { + fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.tcx } diff --git a/src/librustc/ty/error.rs b/src/librustc/ty/error.rs index 09426fe19e11e..3855b856562de 100644 --- a/src/librustc/ty/error.rs +++ b/src/librustc/ty/error.rs @@ -184,7 +184,7 @@ impl<'tcx> fmt::Display for TypeError<'tcx> { } impl<'a, 'gcx, 'lcx, 'tcx> ty::TyS<'tcx> { - pub fn sort_string(&self, tcx: TyCtxt<'a, 'gcx, 'lcx>) -> Cow<'static, str> { + pub fn sort_string(&self, tcx: TyCtxt<'lcx, 'gcx, 'lcx>) -> Cow<'static, str> { match self.sty { ty::Bool | ty::Char | ty::Int(_) | ty::Uint(_) | ty::Float(_) | ty::Str | ty::Never => self.to_string().into(), @@ -249,7 +249,7 @@ impl<'a, 'gcx, 'lcx, 'tcx> ty::TyS<'tcx> { } } -impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { +impl<'a, 'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { pub fn note_and_explain_type_err(self, db: &mut DiagnosticBuilder<'_>, err: &TypeError<'tcx>, diff --git a/src/librustc/ty/fast_reject.rs b/src/librustc/ty/fast_reject.rs index 908bbbcd1d77d..de148018b8383 100644 --- a/src/librustc/ty/fast_reject.rs +++ b/src/librustc/ty/fast_reject.rs @@ -55,7 +55,7 @@ pub enum SimplifiedTypeGen /// then we can't say much about whether two types would unify. Put another way, /// `can_simplify_params` should be true if type parameters appear free in `ty` and `false` if they /// are to be considered bound. -pub fn simplify_type<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, +pub fn simplify_type<'a, 'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, ty: Ty<'_>, can_simplify_params: bool) -> Option diff --git a/src/librustc/ty/fold.rs b/src/librustc/ty/fold.rs index dae28d51efc2e..0a0ac3f2861aa 100644 --- a/src/librustc/ty/fold.rs +++ b/src/librustc/ty/fold.rs @@ -156,7 +156,7 @@ pub trait TypeFoldable<'tcx>: fmt::Debug + Clone { /// identity fold, it should invoke `foo.fold_with(self)` to fold each /// sub-item. pub trait TypeFolder<'gcx: 'tcx, 'tcx> : Sized { - fn tcx<'a>(&'a self) -> TyCtxt<'a, 'gcx, 'tcx>; + fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'gcx, 'tcx>; fn fold_binder(&mut self, t: &Binder) -> Binder where T : TypeFoldable<'tcx> @@ -198,23 +198,23 @@ pub trait TypeVisitor<'tcx> : Sized { /////////////////////////////////////////////////////////////////////////// // Some sample folders -pub struct BottomUpFolder<'a, 'gcx: 'a+'tcx, 'tcx: 'a, F, G, H> +pub struct BottomUpFolder<'gcx, 'tcx, F, G, H> where F: FnMut(Ty<'tcx>) -> Ty<'tcx>, G: FnMut(ty::Region<'tcx>) -> ty::Region<'tcx>, H: FnMut(&'tcx ty::Const<'tcx>) -> &'tcx ty::Const<'tcx>, { - pub tcx: TyCtxt<'a, 'gcx, 'tcx>, + pub tcx: TyCtxt<'tcx, 'gcx, 'tcx>, pub ty_op: F, pub lt_op: G, pub ct_op: H, } -impl<'a, 'gcx, 'tcx, F, G, H> TypeFolder<'gcx, 'tcx> for BottomUpFolder<'a, 'gcx, 'tcx, F, G, H> +impl<'gcx, 'tcx, F, G, H> TypeFolder<'gcx, 'tcx> for BottomUpFolder<'gcx, 'tcx, F, G, H> where F: FnMut(Ty<'tcx>) -> Ty<'tcx>, G: FnMut(ty::Region<'tcx>) -> ty::Region<'tcx>, H: FnMut(&'tcx ty::Const<'tcx>) -> &'tcx ty::Const<'tcx>, { - fn tcx<'b>(&'b self) -> TyCtxt<'b, 'gcx, 'tcx> { self.tcx } + fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.tcx } fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> { let t = ty.super_fold_with(self); @@ -235,7 +235,7 @@ impl<'a, 'gcx, 'tcx, F, G, H> TypeFolder<'gcx, 'tcx> for BottomUpFolder<'a, 'gcx /////////////////////////////////////////////////////////////////////////// // Region folder -impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { +impl<'a, 'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { /// Collects the free and escaping regions in `value` into `region_set`. Returns /// whether any late-bound regions were skipped pub fn collect_regions(self, @@ -362,7 +362,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { /// visited by `fld_r`. pub struct RegionFolder<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, skipped_regions: &'a mut bool, /// Stores the index of a binder *just outside* the stuff we have @@ -382,7 +382,7 @@ pub struct RegionFolder<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { impl<'a, 'gcx, 'tcx> RegionFolder<'a, 'gcx, 'tcx> { #[inline] pub fn new( - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, skipped_regions: &'a mut bool, fold_region_fn: &'a mut dyn FnMut(ty::Region<'tcx>, ty::DebruijnIndex) -> ty::Region<'tcx>, ) -> RegionFolder<'a, 'gcx, 'tcx> { @@ -396,7 +396,7 @@ impl<'a, 'gcx, 'tcx> RegionFolder<'a, 'gcx, 'tcx> { } impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for RegionFolder<'a, 'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'b, 'gcx, 'tcx> { self.tcx } + fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.tcx } fn fold_binder>(&mut self, t: &ty::Binder) -> ty::Binder { self.current_index.shift_in(1); @@ -427,7 +427,7 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for RegionFolder<'a, 'gcx, 'tcx> { /// Replaces the escaping bound vars (late bound regions or bound types) in a type. struct BoundVarReplacer<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, /// As with `RegionFolder`, represents the index of a binder *just outside* /// the ones we have visited. @@ -440,7 +440,7 @@ struct BoundVarReplacer<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { impl<'a, 'gcx, 'tcx> BoundVarReplacer<'a, 'gcx, 'tcx> { fn new( - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, fld_r: &'a mut F, fld_t: &'a mut G, fld_c: &'a mut H, @@ -460,7 +460,7 @@ impl<'a, 'gcx, 'tcx> BoundVarReplacer<'a, 'gcx, 'tcx> { } impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for BoundVarReplacer<'a, 'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'b, 'gcx, 'tcx> { self.tcx } + fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.tcx } fn fold_binder>(&mut self, t: &ty::Binder) -> ty::Binder { self.current_index.shift_in(1); @@ -542,7 +542,7 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for BoundVarReplacer<'a, 'gcx, 'tcx> } } -impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { +impl<'a, 'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { /// Replaces all regions bound by the given `Binder` with the /// results returned by the closure; the closure is expected to /// return a free region (relative to this binder), and hence the @@ -722,15 +722,15 @@ enum Direction { Out, } -struct Shifter<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { - tcx: TyCtxt<'a, 'gcx, 'tcx>, +struct Shifter<'gcx, 'tcx> { + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, current_index: ty::DebruijnIndex, amount: u32, direction: Direction, } -impl Shifter<'a, 'gcx, 'tcx> { - pub fn new(tcx: TyCtxt<'a, 'gcx, 'tcx>, amount: u32, direction: Direction) -> Self { +impl Shifter<'gcx, 'tcx> { + pub fn new(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, amount: u32, direction: Direction) -> Self { Shifter { tcx, current_index: ty::INNERMOST, @@ -740,8 +740,8 @@ impl Shifter<'a, 'gcx, 'tcx> { } } -impl TypeFolder<'gcx, 'tcx> for Shifter<'a, 'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'b, 'gcx, 'tcx> { self.tcx } +impl TypeFolder<'gcx, 'tcx> for Shifter<'gcx, 'tcx> { + fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.tcx } fn fold_binder>(&mut self, t: &ty::Binder) -> ty::Binder { self.current_index.shift_in(1); @@ -818,7 +818,7 @@ impl TypeFolder<'gcx, 'tcx> for Shifter<'a, 'gcx, 'tcx> { } pub fn shift_region<'a, 'gcx, 'tcx>( - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, region: ty::Region<'tcx>, amount: u32 ) -> ty::Region<'tcx> { @@ -833,7 +833,7 @@ pub fn shift_region<'a, 'gcx, 'tcx>( } pub fn shift_vars<'a, 'gcx, 'tcx, T>( - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, value: &T, amount: u32 ) -> T where T: TypeFoldable<'tcx> { @@ -844,7 +844,7 @@ pub fn shift_vars<'a, 'gcx, 'tcx, T>( } pub fn shift_out_vars<'a, 'gcx, 'tcx, T>( - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, value: &T, amount: u32 ) -> T where T: TypeFoldable<'tcx> { diff --git a/src/librustc/ty/inhabitedness/def_id_forest.rs b/src/librustc/ty/inhabitedness/def_id_forest.rs index 581fc41fda49d..a0be4b3e7d838 100644 --- a/src/librustc/ty/inhabitedness/def_id_forest.rs +++ b/src/librustc/ty/inhabitedness/def_id_forest.rs @@ -32,7 +32,7 @@ impl<'a, 'gcx, 'tcx> DefIdForest { /// Creates a forest consisting of a single tree representing the entire /// crate. #[inline] - pub fn full(tcx: TyCtxt<'a, 'gcx, 'tcx>) -> DefIdForest { + pub fn full(tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> DefIdForest { let crate_id = tcx.hir().local_def_id(CRATE_NODE_ID); DefIdForest::from_id(crate_id) } @@ -53,14 +53,14 @@ impl<'a, 'gcx, 'tcx> DefIdForest { /// Tests whether the forest contains a given DefId. pub fn contains(&self, - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, id: DefId) -> bool { self.root_ids.iter().any(|root_id| tcx.is_descendant_of(id, *root_id)) } /// Calculate the intersection of a collection of forests. - pub fn intersection(tcx: TyCtxt<'a, 'gcx, 'tcx>, + pub fn intersection(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, iter: I) -> DefIdForest where I: IntoIterator { @@ -97,7 +97,7 @@ impl<'a, 'gcx, 'tcx> DefIdForest { } /// Calculate the union of a collection of forests. - pub fn union(tcx: TyCtxt<'a, 'gcx, 'tcx>, + pub fn union(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, iter: I) -> DefIdForest where I: IntoIterator { diff --git a/src/librustc/ty/inhabitedness/mod.rs b/src/librustc/ty/inhabitedness/mod.rs index be1d973c2cdd5..fe05a86377671 100644 --- a/src/librustc/ty/inhabitedness/mod.rs +++ b/src/librustc/ty/inhabitedness/mod.rs @@ -51,7 +51,7 @@ mod def_id_forest; // This code should only compile in modules where the uninhabitedness of Foo is // visible. -impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { +impl<'a, 'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { /// Checks whether a type is visibly uninhabited from a particular module. /// # Example /// ```rust @@ -110,7 +110,7 @@ impl<'a, 'gcx, 'tcx> AdtDef { /// Calculate the forest of DefIds from which this adt is visibly uninhabited. fn uninhabited_from( &self, - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, substs: SubstsRef<'tcx>) -> DefIdForest { // Non-exhaustive ADTs from other crates are always considered inhabited. @@ -128,7 +128,7 @@ impl<'a, 'gcx, 'tcx> VariantDef { /// Calculate the forest of DefIds from which this variant is visibly uninhabited. pub fn uninhabited_from( &self, - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, substs: SubstsRef<'tcx>, adt_kind: AdtKind) -> DefIdForest { @@ -154,7 +154,7 @@ impl<'a, 'gcx, 'tcx> FieldDef { /// Calculate the forest of DefIds from which this field is visibly uninhabited. fn uninhabited_from( &self, - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, substs: SubstsRef<'tcx>, is_enum: bool, ) -> DefIdForest { @@ -182,7 +182,7 @@ impl<'a, 'gcx, 'tcx> FieldDef { impl<'a, 'gcx, 'tcx> TyS<'tcx> { /// Calculate the forest of DefIds from which this type is visibly uninhabited. - fn uninhabited_from(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> DefIdForest + fn uninhabited_from(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> DefIdForest { match self.sty { Adt(def, substs) => def.uninhabited_from(tcx, substs), diff --git a/src/librustc/ty/instance.rs b/src/librustc/ty/instance.rs index ba42cecbe5b83..e35b7226f4941 100644 --- a/src/librustc/ty/instance.rs +++ b/src/librustc/ty/instance.rs @@ -44,7 +44,7 @@ pub enum InstanceDef<'tcx> { impl<'a, 'tcx> Instance<'tcx> { pub fn ty(&self, - tcx: TyCtxt<'a, 'tcx, 'tcx>) + tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Ty<'tcx> { let ty = tcx.type_of(self.def.def_id()); @@ -55,7 +55,7 @@ impl<'a, 'tcx> Instance<'tcx> { ) } - fn fn_sig_noadjust(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> PolyFnSig<'tcx> { + fn fn_sig_noadjust(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> PolyFnSig<'tcx> { let ty = self.ty(tcx); match ty.sty { ty::FnDef(..) | @@ -105,7 +105,7 @@ impl<'a, 'tcx> Instance<'tcx> { } } - pub fn fn_sig(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> ty::PolyFnSig<'tcx> { + pub fn fn_sig(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> ty::PolyFnSig<'tcx> { let mut fn_sig = self.fn_sig_noadjust(tcx); if let InstanceDef::VtableShim(..) = self.def { // Modify fn(self, ...) to fn(self: *mut Self, ...) @@ -136,13 +136,13 @@ impl<'tcx> InstanceDef<'tcx> { } #[inline] - pub fn attrs<'a>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> ty::Attributes<'tcx> { + pub fn attrs<'a>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> ty::Attributes<'tcx> { tcx.get_attrs(self.def_id()) } pub fn is_inline<'a>( &self, - tcx: TyCtxt<'a, 'tcx, 'tcx> + tcx: TyCtxt<'tcx, 'tcx, 'tcx> ) -> bool { use crate::hir::map::DefPathData; let def_id = match *self { @@ -158,7 +158,7 @@ impl<'tcx> InstanceDef<'tcx> { pub fn requires_local<'a>( &self, - tcx: TyCtxt<'a, 'tcx, 'tcx> + tcx: TyCtxt<'tcx, 'tcx, 'tcx> ) -> bool { if self.is_inline(tcx) { return true @@ -218,7 +218,7 @@ impl<'a, 'b, 'tcx> Instance<'tcx> { Instance { def: InstanceDef::Item(def_id), substs: substs } } - pub fn mono(tcx: TyCtxt<'a, 'tcx, 'b>, def_id: DefId) -> Instance<'tcx> { + pub fn mono(tcx: TyCtxt<'b, 'tcx, 'b>, def_id: DefId) -> Instance<'tcx> { Instance::new(def_id, tcx.global_tcx().empty_substs_for_def_id(def_id)) } @@ -245,7 +245,7 @@ impl<'a, 'b, 'tcx> Instance<'tcx> { /// Presuming that coherence and type-check have succeeded, if this method is invoked /// in a monomorphic context (i.e., like during codegen), then it is guaranteed to return /// `Some`. - pub fn resolve(tcx: TyCtxt<'a, 'tcx, 'tcx>, + pub fn resolve(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, def_id: DefId, substs: SubstsRef<'tcx>) -> Option> { @@ -297,7 +297,7 @@ impl<'a, 'b, 'tcx> Instance<'tcx> { result } - pub fn resolve_for_vtable(tcx: TyCtxt<'a, 'tcx, 'tcx>, + pub fn resolve_for_vtable(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, def_id: DefId, substs: SubstsRef<'tcx>) -> Option> { @@ -317,7 +317,7 @@ impl<'a, 'b, 'tcx> Instance<'tcx> { } pub fn resolve_closure( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, substs: ty::ClosureSubsts<'tcx>, requested_kind: ty::ClosureKind) @@ -332,7 +332,7 @@ impl<'a, 'b, 'tcx> Instance<'tcx> { } pub fn resolve_drop_in_place( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ty: Ty<'tcx>) -> ty::Instance<'tcx> { @@ -342,7 +342,7 @@ impl<'a, 'b, 'tcx> Instance<'tcx> { } pub fn fn_once_adapter_instance( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, closure_did: DefId, substs: ty::ClosureSubsts<'tcx>) -> Instance<'tcx> @@ -377,7 +377,7 @@ impl<'a, 'b, 'tcx> Instance<'tcx> { } fn resolve_associated_item<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, trait_item: &ty::AssocItem, param_env: ty::ParamEnv<'tcx>, trait_id: DefId, diff --git a/src/librustc/ty/layout.rs b/src/librustc/ty/layout.rs index 65cdd4ec4d7aa..d433c3920bff2 100644 --- a/src/librustc/ty/layout.rs +++ b/src/librustc/ty/layout.rs @@ -31,9 +31,9 @@ use rustc_target::abi::call::{ pub trait IntegerExt { - fn to_ty<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, signed: bool) -> Ty<'tcx>; + fn to_ty<'a, 'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, signed: bool) -> Ty<'tcx>; fn from_attr(cx: &C, ity: attr::IntType) -> Integer; - fn repr_discr<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, + fn repr_discr<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ty: Ty<'tcx>, repr: &ReprOptions, min: i128, @@ -42,7 +42,7 @@ pub trait IntegerExt { } impl IntegerExt for Integer { - fn to_ty<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, signed: bool) -> Ty<'tcx> { + fn to_ty<'a, 'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, signed: bool) -> Ty<'tcx> { match (*self, signed) { (I8, false) => tcx.types.u8, (I16, false) => tcx.types.u16, @@ -77,7 +77,7 @@ impl IntegerExt for Integer { /// signed discriminant range and #[repr] attribute. /// N.B.: u128 values above i128::MAX will be treated as signed, but /// that shouldn't affect anything, other than maybe debuginfo. - fn repr_discr<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, + fn repr_discr<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ty: Ty<'tcx>, repr: &ReprOptions, min: i128, @@ -126,11 +126,11 @@ impl IntegerExt for Integer { } pub trait PrimitiveExt { - fn to_ty<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Ty<'tcx>; + fn to_ty<'a, 'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Ty<'tcx>; } impl PrimitiveExt for Primitive { - fn to_ty<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Ty<'tcx> { + fn to_ty<'a, 'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Ty<'tcx> { match *self { Int(i, signed) => i.to_ty(tcx, signed), Float(FloatTy::F32) => tcx.types.f32, @@ -171,7 +171,7 @@ impl<'tcx> fmt::Display for LayoutError<'tcx> { } } -fn layout_raw<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn layout_raw<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, query: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> Result<&'tcx LayoutDetails, LayoutError<'tcx>> { @@ -226,7 +226,7 @@ enum StructKind { Prefixed(Size, Align), } -impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { +impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'tcx, 'tcx, 'tcx>> { fn scalar_pair(&self, a: Scalar, b: Scalar) -> LayoutDetails { let dl = self.data_layout(); let b_align = b.value.align(dl); @@ -1221,7 +1221,7 @@ enum SavedLocalEligibility { // Also included in the layout are the upvars and the discriminant. // These are included as fields on the "outer" layout; they are not part // of any variant. -impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { +impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'tcx, 'tcx, 'tcx>> { /// Compute the eligibility and assignment of each local. fn generator_saved_local_eligibility(&self, info: &GeneratorLayout<'tcx>) -> (BitSet, IndexVec) { @@ -1442,9 +1442,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { debug!("generator layout ({:?}): {:#?}", ty, layout); Ok(layout) } -} -impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { /// This is invoked by the `layout_raw` query to record the final /// layout of each type. #[inline(always)] @@ -1607,7 +1605,7 @@ pub enum SizeSkeleton<'tcx> { impl<'a, 'tcx> SizeSkeleton<'tcx> { pub fn compute(ty: Ty<'tcx>, - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>) -> Result, LayoutError<'tcx>> { debug_assert!(!ty.has_infer_types()); @@ -1729,21 +1727,21 @@ impl<'a, 'tcx> SizeSkeleton<'tcx> { } pub trait HasTyCtxt<'tcx>: HasDataLayout { - fn tcx<'a>(&'a self) -> TyCtxt<'a, 'tcx, 'tcx>; + fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx, 'tcx>; } pub trait HasParamEnv<'tcx> { fn param_env(&self) -> ty::ParamEnv<'tcx>; } -impl<'a, 'gcx, 'tcx> HasDataLayout for TyCtxt<'a, 'gcx, 'tcx> { +impl<'a, 'gcx, 'tcx> HasDataLayout for TyCtxt<'tcx, 'gcx, 'tcx> { fn data_layout(&self) -> &TargetDataLayout { &self.data_layout } } -impl<'a, 'gcx, 'tcx> HasTyCtxt<'gcx> for TyCtxt<'a, 'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'b, 'gcx, 'gcx> { +impl<'a, 'gcx, 'tcx> HasTyCtxt<'gcx> for TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'gcx, 'gcx> { self.global_tcx() } } @@ -1761,7 +1759,7 @@ impl<'tcx, T: HasDataLayout> HasDataLayout for LayoutCx<'tcx, T> { } impl<'gcx, 'tcx, T: HasTyCtxt<'gcx>> HasTyCtxt<'gcx> for LayoutCx<'tcx, T> { - fn tcx<'b>(&'b self) -> TyCtxt<'b, 'gcx, 'gcx> { + fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'gcx, 'gcx> { self.tcx.tcx() } } @@ -1798,7 +1796,7 @@ impl MaybeResult for Result { pub type TyLayout<'tcx> = ::rustc_target::abi::TyLayout<'tcx, Ty<'tcx>>; -impl<'a, 'tcx> LayoutOf for LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { +impl<'a, 'tcx> LayoutOf for LayoutCx<'tcx, TyCtxt<'tcx, 'tcx, 'tcx>> { type Ty = Ty<'tcx>; type TyLayout = Result, LayoutError<'tcx>>; @@ -1825,7 +1823,7 @@ impl<'a, 'tcx> LayoutOf for LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { } } -impl<'a, 'tcx> LayoutOf for LayoutCx<'tcx, ty::query::TyCtxtAt<'a, 'tcx, 'tcx>> { +impl LayoutOf for LayoutCx<'tcx, ty::query::TyCtxtAt<'tcx, 'tcx>> { type Ty = Ty<'tcx>; type TyLayout = Result, LayoutError<'tcx>>; @@ -1857,7 +1855,7 @@ impl<'a, 'tcx> LayoutOf for LayoutCx<'tcx, ty::query::TyCtxtAt<'a, 'tcx, 'tcx>> } // Helper (inherent) `layout_of` methods to avoid pushing `LayoutCx` to users. -impl TyCtxt<'a, 'tcx, '_> { +impl TyCtxt<'_, 'tcx, '_> { /// Computes the layout of a type. Note that this implicitly /// executes in "reveal all" mode. #[inline] @@ -1871,7 +1869,7 @@ impl TyCtxt<'a, 'tcx, '_> { } } -impl ty::query::TyCtxtAt<'a, 'tcx, '_> { +impl ty::query::TyCtxtAt<'tcx, '_> { /// Computes the layout of a type. Note that this implicitly /// executes in "reveal all" mode. #[inline] @@ -2191,7 +2189,7 @@ struct Niche { impl Niche { fn reserve<'a, 'tcx>( &self, - cx: &LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>>, + cx: &LayoutCx<'tcx, TyCtxt<'tcx, 'tcx, 'tcx>>, count: u128, ) -> Option<(u128, Scalar)> { if count > self.available { @@ -2207,7 +2205,7 @@ impl Niche { } } -impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { +impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'tcx, 'tcx, 'tcx>> { /// Find the offset of a niche leaf field, starting from /// the given type and recursing through aggregates. // FIXME(eddyb) traverse already optimized enums. diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index d858d37424444..687de97f4ceaf 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -213,7 +213,7 @@ impl AssocItem { } } - pub fn signature<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> String { + pub fn signature<'a, 'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> String { match self.kind { ty::AssocKind::Method => { // We skip the binder here because the binder would deanonymize all @@ -259,7 +259,7 @@ pub trait DefIdTree: Copy { } } -impl<'a, 'gcx, 'tcx> DefIdTree for TyCtxt<'a, 'gcx, 'tcx> { +impl<'a, 'gcx, 'tcx> DefIdTree for TyCtxt<'tcx, 'gcx, 'tcx> { fn parent(self, id: DefId) -> Option { self.def_key(id).parent.map(|index| DefId { index: index, ..id }) } @@ -934,7 +934,7 @@ impl<'a, 'gcx, 'tcx> Generics { own_counts } - pub fn requires_monomorphization(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> bool { + pub fn requires_monomorphization(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> bool { if self.own_requires_monomorphization() { return true; } @@ -959,7 +959,7 @@ impl<'a, 'gcx, 'tcx> Generics { pub fn region_param(&'tcx self, param: &EarlyBoundRegion, - tcx: TyCtxt<'a, 'gcx, 'tcx>) + tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> &'tcx GenericParamDef { if let Some(index) = param.index.checked_sub(self.parent_count as u32) { @@ -977,7 +977,7 @@ impl<'a, 'gcx, 'tcx> Generics { /// Returns the `GenericParamDef` associated with this `ParamTy`. pub fn type_param(&'tcx self, param: &ParamTy, - tcx: TyCtxt<'a, 'gcx, 'tcx>) + tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> &'tcx GenericParamDef { if let Some(index) = param.index.checked_sub(self.parent_count as u32) { let param = &self.params[index as usize]; @@ -994,7 +994,7 @@ impl<'a, 'gcx, 'tcx> Generics { /// Returns the `ConstParameterDef` associated with this `ParamConst`. pub fn const_param(&'tcx self, param: &ParamConst, - tcx: TyCtxt<'a, 'gcx, 'tcx>) + tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> &GenericParamDef { if let Some(index) = param.index.checked_sub(self.parent_count as u32) { let param = &self.params[index as usize]; @@ -1020,21 +1020,21 @@ impl<'tcx> serialize::UseSpecializedEncodable for GenericPredicates<'tcx> {} impl<'tcx> serialize::UseSpecializedDecodable for GenericPredicates<'tcx> {} impl<'a, 'gcx, 'tcx> GenericPredicates<'tcx> { - pub fn instantiate(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, substs: SubstsRef<'tcx>) + pub fn instantiate(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, substs: SubstsRef<'tcx>) -> InstantiatedPredicates<'tcx> { let mut instantiated = InstantiatedPredicates::empty(); self.instantiate_into(tcx, &mut instantiated, substs); instantiated } - pub fn instantiate_own(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, substs: SubstsRef<'tcx>) + pub fn instantiate_own(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, substs: SubstsRef<'tcx>) -> InstantiatedPredicates<'tcx> { InstantiatedPredicates { predicates: self.predicates.iter().map(|(p, _)| p.subst(tcx, substs)).collect(), } } - fn instantiate_into(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, + fn instantiate_into(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, instantiated: &mut InstantiatedPredicates<'tcx>, substs: SubstsRef<'tcx>) { if let Some(def_id) = self.parent { @@ -1045,14 +1045,14 @@ impl<'a, 'gcx, 'tcx> GenericPredicates<'tcx> { ); } - pub fn instantiate_identity(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) + pub fn instantiate_identity(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> InstantiatedPredicates<'tcx> { let mut instantiated = InstantiatedPredicates::empty(); self.instantiate_identity_into(tcx, &mut instantiated); instantiated } - fn instantiate_identity_into(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, + fn instantiate_identity_into(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, instantiated: &mut InstantiatedPredicates<'tcx>) { if let Some(def_id) = self.parent { tcx.predicates_of(def_id).instantiate_identity_into(tcx, instantiated); @@ -1060,7 +1060,7 @@ impl<'a, 'gcx, 'tcx> GenericPredicates<'tcx> { instantiated.predicates.extend(self.predicates.iter().map(|&(p, _)| p)) } - pub fn instantiate_supertrait(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, + pub fn instantiate_supertrait(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, poly_trait_ref: &ty::PolyTraitRef<'tcx>) -> InstantiatedPredicates<'tcx> { @@ -1134,7 +1134,7 @@ impl<'a, 'gcx, 'tcx> Predicate<'tcx> { /// poly-trait-ref holds. This is slightly different from a normal /// substitution in terms of what happens with bound regions. See /// lengthy comment below for details. - pub fn subst_supertrait(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, + pub fn subst_supertrait(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, trait_ref: &ty::PolyTraitRef<'tcx>) -> ty::Predicate<'tcx> { @@ -1856,7 +1856,7 @@ impl<'a, 'gcx, 'tcx> VariantDef { /// If someone speeds up attribute loading to not be a performance concern, they can /// remove this hack and use the constructor `DefId` everywhere. pub fn new( - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, ident: Ident, variant_did: Option, ctor_def_id: Option, @@ -2143,7 +2143,7 @@ impl ReprOptions { } -impl<'a, 'gcx, 'tcx> AdtDef { +impl<'gcx, 'tcx> AdtDef { /// Creates a new `AdtDef`. fn new( tcx: TyCtxt<'_, '_, '_>, @@ -2286,7 +2286,7 @@ impl<'a, 'gcx, 'tcx> AdtDef { } /// Returns `true` if this type has a destructor. - pub fn has_dtor(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> bool { + pub fn has_dtor(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> bool { self.destructor(tcx).is_some() } @@ -2297,7 +2297,7 @@ impl<'a, 'gcx, 'tcx> AdtDef { } #[inline] - pub fn predicates(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> &'tcx GenericPredicates<'gcx> { + pub fn predicates(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> &'tcx GenericPredicates<'gcx> { tcx.predicates_of(self.did) } @@ -2351,7 +2351,7 @@ impl<'a, 'gcx, 'tcx> AdtDef { #[inline] pub fn eval_explicit_discr( &self, - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, expr_did: DefId, ) -> Option> { let param_env = ParamEnv::empty(); @@ -2397,9 +2397,9 @@ impl<'a, 'gcx, 'tcx> AdtDef { #[inline] pub fn discriminants( - &'a self, - tcx: TyCtxt<'a, 'gcx, 'tcx>, - ) -> impl Iterator)> + Captures<'gcx> + 'a { + &'tcx self, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + ) -> impl Iterator)> + Captures<'gcx> { let repr_type = self.repr.discr_type(); let initial = repr_type.initial_discriminant(tcx.global_tcx()); let mut prev_discr = None::>; @@ -2428,7 +2428,7 @@ impl<'a, 'gcx, 'tcx> AdtDef { /// assuming there are no constant-evaluation errors there. #[inline] pub fn discriminant_for_variant(&self, - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, variant_index: VariantIdx) -> Discr<'tcx> { let (val, offset) = self.discriminant_def_for_variant(variant_index); @@ -2465,7 +2465,7 @@ impl<'a, 'gcx, 'tcx> AdtDef { (expr_did, variant_index.as_u32() - explicit_index) } - pub fn destructor(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Option { + pub fn destructor(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { tcx.adt_destructor(self.did) } @@ -2479,12 +2479,12 @@ impl<'a, 'gcx, 'tcx> AdtDef { /// /// Due to normalization being eager, this applies even if /// the associated type is behind a pointer (e.g., issue #31299). - pub fn sized_constraint(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> &'tcx [Ty<'tcx>] { + pub fn sized_constraint(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> &'tcx [Ty<'tcx>] { tcx.adt_sized_constraint(self.did).0 } fn sized_constraint_for_ty(&self, - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ty: Ty<'tcx>) -> Vec> { let result = match ty.sty { @@ -2564,7 +2564,7 @@ impl<'a, 'gcx, 'tcx> AdtDef { } impl<'a, 'gcx, 'tcx> FieldDef { - pub fn ty(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, subst: SubstsRef<'tcx>) -> Ty<'tcx> { + pub fn ty(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, subst: SubstsRef<'tcx>) -> Ty<'tcx> { tcx.type_of(self.did).subst(tcx, subst) } } @@ -2590,7 +2590,7 @@ impl<'a, 'tcx> ClosureKind { // This is the initial value used when doing upvar inference. pub const LATTICE_BOTTOM: ClosureKind = ClosureKind::Fn; - pub fn trait_did(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> DefId { + pub fn trait_did(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> DefId { match *self { ClosureKind::Fn => tcx.require_lang_item(FnTraitLangItem), ClosureKind::FnMut => { @@ -2618,7 +2618,7 @@ impl<'a, 'tcx> ClosureKind { /// Returns the representative scalar type for this closure kind. /// See `TyS::to_opt_closure_kind` for more details. - pub fn to_ty(self, tcx: TyCtxt<'_, '_, 'tcx>) -> Ty<'tcx> { + pub fn to_ty(self, tcx: TyCtxt<'tcx, '_, 'tcx>) -> Ty<'tcx> { match self { ty::ClosureKind::Fn => tcx.types.i8, ty::ClosureKind::FnMut => tcx.types.i16, @@ -2755,7 +2755,7 @@ pub enum ImplOverlapKind { Issue33140 } -impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { +impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { pub fn body_tables(self, body: hir::BodyId) -> &'gcx TypeckTables<'gcx> { self.typeck_tables_of(self.hir().body_owner_def_id(body)) } @@ -2765,7 +2765,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { /// themselves, you can do `self.hir().krate().body_ids.iter()`. pub fn body_owners( self, - ) -> impl Iterator + Captures<'tcx> + Captures<'gcx> + 'a { + ) -> impl Iterator + Captures<'gcx> + 'tcx { self.hir().krate() .body_ids .iter() @@ -2892,7 +2892,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { pub fn associated_items( self, def_id: DefId, - ) -> AssocItemsIterator<'a, 'gcx, 'tcx> { + ) -> AssocItemsIterator<'gcx, 'tcx> { // Ideally, we would use `-> impl Iterator` here, but it falls // afoul of the conservative "capture [restrictions]" we put // in place, so we use a hand-written iterator. @@ -3115,13 +3115,13 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } } -pub struct AssocItemsIterator<'a, 'gcx: 'tcx, 'tcx: 'a> { - tcx: TyCtxt<'a, 'gcx, 'tcx>, +pub struct AssocItemsIterator<'gcx, 'tcx> { + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, def_ids: &'gcx [DefId], next_index: usize, } -impl Iterator for AssocItemsIterator<'_, '_, '_> { +impl Iterator for AssocItemsIterator<'_, '_> { type Item = AssocItem; fn next(&mut self) -> Option { @@ -3131,7 +3131,7 @@ impl Iterator for AssocItemsIterator<'_, '_, '_> { } } -fn associated_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> AssocItem { +fn associated_item<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> AssocItem { let id = tcx.hir().as_local_hir_id(def_id).unwrap(); let parent_id = tcx.hir().get_parent_item(id); let parent_def_id = tcx.hir().local_def_id_from_hir_id(parent_id); @@ -3176,7 +3176,7 @@ pub struct AdtSizedConstraint<'tcx>(pub &'tcx [Ty<'tcx>]); /// such. /// - a Error, if a type contained itself. The representability /// check should catch this case. -fn adt_sized_constraint<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn adt_sized_constraint<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> AdtSizedConstraint<'tcx> { let def = tcx.adt_def(def_id); @@ -3192,7 +3192,7 @@ fn adt_sized_constraint<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, AdtSizedConstraint(result) } -fn associated_item_def_ids<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn associated_item_def_ids<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx [DefId] { let id = tcx.hir().as_local_hir_id(def_id).unwrap(); @@ -3217,14 +3217,14 @@ fn associated_item_def_ids<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } } -fn def_span<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Span { +fn def_span<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> Span { tcx.hir().span_if_local(def_id).unwrap() } /// If the given `DefId` describes an item belonging to a trait, /// returns the `DefId` of the trait that the trait item belongs to; /// otherwise, returns `None`. -fn trait_of_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Option { +fn trait_of_item<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> Option { tcx.opt_associated_item(def_id) .and_then(|associated_item| { match associated_item.container { @@ -3247,7 +3247,7 @@ pub fn is_impl_trait_defn(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> Option(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn param_env<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> ParamEnv<'tcx> { @@ -3285,26 +3285,26 @@ fn param_env<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, traits::normalize_param_env_or_error(tcx, def_id, unnormalized_env, cause) } -fn crate_disambiguator<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn crate_disambiguator<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, crate_num: CrateNum) -> CrateDisambiguator { assert_eq!(crate_num, LOCAL_CRATE); tcx.sess.local_crate_disambiguator() } -fn original_crate_name<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn original_crate_name<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, crate_num: CrateNum) -> Symbol { assert_eq!(crate_num, LOCAL_CRATE); tcx.crate_name.clone() } -fn crate_hash<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn crate_hash<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, crate_num: CrateNum) -> Svh { assert_eq!(crate_num, LOCAL_CRATE); tcx.hir().crate_hash } -fn instance_def_size_estimate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn instance_def_size_estimate<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, instance_def: InstanceDef<'tcx>) -> usize { match instance_def { @@ -3321,7 +3321,7 @@ fn instance_def_size_estimate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, /// If `def_id` is an issue 33140 hack impl, returns its self type; otherwise, returns `None`. /// /// See [`ImplOverlapKind::Issue33140`] for more details. -fn issue33140_self_ty<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn issue33140_self_ty<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> Option> { diff --git a/src/librustc/ty/outlives.rs b/src/librustc/ty/outlives.rs index 5b21ed5abd77b..772886ea21cdc 100644 --- a/src/librustc/ty/outlives.rs +++ b/src/librustc/ty/outlives.rs @@ -45,7 +45,7 @@ pub enum Component<'tcx> { EscapingProjection(Vec>), } -impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { +impl<'a, 'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { /// Push onto `out` all the things that must outlive `'a` for the condition /// `ty0: 'a` to hold. Note that `ty0` must be a **fully resolved type**. pub fn push_outlives_components(&self, ty0: Ty<'tcx>, diff --git a/src/librustc/ty/print/mod.rs b/src/librustc/ty/print/mod.rs index d6bc4e537581b..9954160396c73 100644 --- a/src/librustc/ty/print/mod.rs +++ b/src/librustc/ty/print/mod.rs @@ -37,7 +37,7 @@ pub trait Printer<'gcx: 'tcx, 'tcx>: Sized { type DynExistential; type Const; - fn tcx(&'a self) -> TyCtxt<'a, 'gcx, 'tcx>; + fn tcx(&'a self) -> TyCtxt<'tcx, 'gcx, 'tcx>; fn print_def_path( self, diff --git a/src/librustc/ty/print/obsolete.rs b/src/librustc/ty/print/obsolete.rs index 85d338699b0e0..b429539658ff2 100644 --- a/src/librustc/ty/print/obsolete.rs +++ b/src/librustc/ty/print/obsolete.rs @@ -16,15 +16,15 @@ use syntax::ast; /// Same as `unique_type_name()` but with the result pushed onto the given /// `output` parameter. -pub struct DefPathBasedNames<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, +pub struct DefPathBasedNames<'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, omit_disambiguators: bool, omit_local_crate_name: bool, } -impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> { +impl DefPathBasedNames<'tcx> { pub fn new( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, omit_disambiguators: bool, omit_local_crate_name: bool, ) -> Self { diff --git a/src/librustc/ty/print/pretty.rs b/src/librustc/ty/print/pretty.rs index 513ffd69ccaad..d688202381a5d 100644 --- a/src/librustc/ty/print/pretty.rs +++ b/src/librustc/ty/print/pretty.rs @@ -934,7 +934,7 @@ pub trait PrettyPrinter<'gcx: 'tcx, 'tcx>: pub struct FmtPrinter<'a, 'gcx, 'tcx, F>(Box>); pub struct FmtPrinterData<'a, 'gcx, 'tcx, F> { - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, fmt: F, empty_path: bool, @@ -963,7 +963,7 @@ impl DerefMut for FmtPrinter<'_, '_, '_, F> { } impl FmtPrinter<'a, 'gcx, 'tcx, F> { - pub fn new(tcx: TyCtxt<'a, 'gcx, 'tcx>, fmt: F, ns: Namespace) -> Self { + pub fn new(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, fmt: F, ns: Namespace) -> Self { FmtPrinter(Box::new(FmtPrinterData { tcx, fmt, @@ -1025,7 +1025,7 @@ impl Printer<'gcx, 'tcx> for FmtPrinter<'_, 'gcx, 'tcx, F> { type DynExistential = Self; type Const = Self; - fn tcx(&'a self) -> TyCtxt<'a, 'gcx, 'tcx> { + fn tcx(&'a self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.tcx } diff --git a/src/librustc/ty/query/config.rs b/src/librustc/ty/query/config.rs index 286894c82b7e2..3e2bc7308ffbf 100644 --- a/src/librustc/ty/query/config.rs +++ b/src/librustc/ty/query/config.rs @@ -50,11 +50,11 @@ pub(crate) trait QueryDescription<'tcx>: QueryAccessors<'tcx> { fn describe(tcx: TyCtxt<'_, '_, '_>, key: Self::Key) -> Cow<'static, str>; #[inline] - fn cache_on_disk(_: TyCtxt<'_, 'tcx, 'tcx>, _: Self::Key) -> bool { + fn cache_on_disk(_: TyCtxt<'tcx, 'tcx, 'tcx>, _: Self::Key) -> bool { false } - fn try_load_from_disk(_: TyCtxt<'_, 'tcx, 'tcx>, + fn try_load_from_disk(_: TyCtxt<'tcx, 'tcx, 'tcx>, _: SerializedDepNodeIndex) -> Option { bug!("QueryDescription::load_from_disk() called for an unsupported query.") @@ -82,12 +82,12 @@ macro_rules! impl_disk_cacheable_query( ($query_name:ident, |$tcx:tt, $key:tt| $cond:expr) => { impl<'tcx> QueryDescription<'tcx> for queries::$query_name<'tcx> { #[inline] - fn cache_on_disk($tcx: TyCtxt<'_, 'tcx, 'tcx>, $key: Self::Key) -> bool { + fn cache_on_disk($tcx: TyCtxt<'tcx, 'tcx, 'tcx>, $key: Self::Key) -> bool { $cond } #[inline] - fn try_load_from_disk<'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>, + fn try_load_from_disk<'a>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, id: SerializedDepNodeIndex) -> Option { tcx.queries.on_disk_cache.try_load_query_result(tcx, id) diff --git a/src/librustc/ty/query/job.rs b/src/librustc/ty/query/job.rs index 8e68c9fa30431..a595f22bfb323 100644 --- a/src/librustc/ty/query/job.rs +++ b/src/librustc/ty/query/job.rs @@ -77,7 +77,7 @@ impl<'tcx> QueryJob<'tcx> { #[cfg(parallel_compiler)] pub(super) fn r#await<'lcx>( &self, - tcx: TyCtxt<'_, 'tcx, 'lcx>, + tcx: TyCtxt<'lcx, 'tcx, 'lcx>, span: Span, ) -> Result<(), CycleError<'tcx>> { tls::with_related_context(tcx, move |icx| { @@ -102,7 +102,7 @@ impl<'tcx> QueryJob<'tcx> { #[cfg(not(parallel_compiler))] pub(super) fn find_cycle_in_stack<'lcx>( &self, - tcx: TyCtxt<'_, 'tcx, 'lcx>, + tcx: TyCtxt<'lcx, 'tcx, 'lcx>, span: Span, ) -> CycleError<'tcx> { // Get the current executing query (waiter) and find the waitee amongst its parents diff --git a/src/librustc/ty/query/on_disk_cache.rs b/src/librustc/ty/query/on_disk_cache.rs index 4dbc2ab1b358e..088e2bc33cf4d 100644 --- a/src/librustc/ty/query/on_disk_cache.rs +++ b/src/librustc/ty/query/on_disk_cache.rs @@ -157,7 +157,7 @@ impl<'sess> OnDiskCache<'sess> { } pub fn serialize<'a, 'tcx, E>(&self, - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, encoder: &mut E) -> Result<(), E::Error> where E: ty_codec::TyEncoder @@ -327,7 +327,7 @@ impl<'sess> OnDiskCache<'sess> { /// Loads a diagnostic emitted during the previous compilation session. pub fn load_diagnostics<'a, 'tcx>(&self, - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, dep_node_index: SerializedDepNodeIndex) -> Vec { let diagnostics: Option = self.load_indexed( @@ -355,7 +355,7 @@ impl<'sess> OnDiskCache<'sess> { /// Returns the cached query result if there is something in the cache for /// the given `SerializedDepNodeIndex`; otherwise returns `None`. pub fn try_load_query_result<'tcx, T>(&self, - tcx: TyCtxt<'_, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, dep_node_index: SerializedDepNodeIndex) -> Option where T: Decodable @@ -383,7 +383,7 @@ impl<'sess> OnDiskCache<'sess> { } fn load_indexed<'tcx, T>(&self, - tcx: TyCtxt<'_, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, dep_node_index: SerializedDepNodeIndex, index: &FxHashMap, @@ -457,18 +457,18 @@ impl<'sess> OnDiskCache<'sess> { /// A decoder that can read the incr. comp. cache. It is similar to the one /// we use for crate metadata decoding in that it can rebase spans and /// eventually will also handle things that contain `Ty` instances. -struct CacheDecoder<'a, 'tcx: 'a, 'x> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, - opaque: opaque::Decoder<'x>, - source_map: &'x SourceMap, - cnum_map: &'x IndexVec>, - synthetic_expansion_infos: &'x Lock>, - file_index_to_file: &'x Lock>>, - file_index_to_stable_id: &'x FxHashMap, - alloc_decoding_session: AllocDecodingSession<'x>, +struct CacheDecoder<'a, 'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + opaque: opaque::Decoder<'a>, + source_map: &'a SourceMap, + cnum_map: &'a IndexVec>, + synthetic_expansion_infos: &'a Lock>, + file_index_to_file: &'a Lock>>, + file_index_to_stable_id: &'a FxHashMap, + alloc_decoding_session: AllocDecodingSession<'a>, } -impl<'a, 'tcx, 'x> CacheDecoder<'a, 'tcx, 'x> { +impl<'a, 'tcx> CacheDecoder<'a, 'tcx> { fn file_index_to_file(&self, index: SourceFileIndex) -> Lrc { let CacheDecoder { ref file_index_to_file, @@ -489,13 +489,13 @@ trait DecoderWithPosition: Decoder { fn position(&self) -> usize; } -impl<'enc> DecoderWithPosition for opaque::Decoder<'enc> { +impl<'a> DecoderWithPosition for opaque::Decoder<'a> { fn position(&self) -> usize { self.position() } } -impl<'a, 'tcx, 'x> DecoderWithPosition for CacheDecoder<'a, 'tcx, 'x> { +impl<'a, 'tcx> DecoderWithPosition for CacheDecoder<'a, 'tcx> { fn position(&self) -> usize { self.opaque.position() } @@ -525,10 +525,9 @@ fn decode_tagged<'a, 'tcx, D, T, V>(decoder: &mut D, } -impl<'a, 'tcx: 'a, 'x> ty_codec::TyDecoder<'a, 'tcx> for CacheDecoder<'a, 'tcx, 'x> { - +impl<'a, 'tcx> ty_codec::TyDecoder<'tcx> for CacheDecoder<'a, 'tcx> { #[inline] - fn tcx(&self) -> TyCtxt<'a, 'tcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'tcx, 'tcx, 'tcx> { self.tcx } @@ -584,16 +583,16 @@ impl<'a, 'tcx: 'a, 'x> ty_codec::TyDecoder<'a, 'tcx> for CacheDecoder<'a, 'tcx, } } -implement_ty_decoder!( CacheDecoder<'a, 'tcx, 'x> ); +implement_ty_decoder!( CacheDecoder<'a, 'tcx> ); -impl<'a, 'tcx, 'x> SpecializedDecoder for CacheDecoder<'a, 'tcx, 'x> { +impl<'a, 'tcx> SpecializedDecoder for CacheDecoder<'a, 'tcx> { fn specialized_decode(&mut self) -> Result { let alloc_decoding_session = self.alloc_decoding_session; alloc_decoding_session.decode_alloc_id(self) } } -impl<'a, 'tcx, 'x> SpecializedDecoder for CacheDecoder<'a, 'tcx, 'x> { +impl<'a, 'tcx> SpecializedDecoder for CacheDecoder<'a, 'tcx> { fn specialized_decode(&mut self) -> Result { let tag: u8 = Decodable::decode(self)?; @@ -656,7 +655,7 @@ impl<'a, 'tcx, 'x> SpecializedDecoder for CacheDecoder<'a, 'tcx, 'x> { // DefIndex that is not contained in a DefId. Such a case would be problematic // because we would not know how to transform the DefIndex to the current // context. -impl<'a, 'tcx, 'x> SpecializedDecoder for CacheDecoder<'a, 'tcx, 'x> { +impl<'a, 'tcx> SpecializedDecoder for CacheDecoder<'a, 'tcx> { fn specialized_decode(&mut self) -> Result { bug!("Trying to decode DefIndex outside the context of a DefId") } @@ -665,7 +664,7 @@ impl<'a, 'tcx, 'x> SpecializedDecoder for CacheDecoder<'a, 'tcx, 'x> { // Both the CrateNum and the DefIndex of a DefId can change in between two // compilation sessions. We use the DefPathHash, which is stable across // sessions, to map the old DefId to the new one. -impl<'a, 'tcx, 'x> SpecializedDecoder for CacheDecoder<'a, 'tcx, 'x> { +impl<'a, 'tcx> SpecializedDecoder for CacheDecoder<'a, 'tcx> { #[inline] fn specialized_decode(&mut self) -> Result { // Load the DefPathHash which is was we encoded the DefId as. @@ -676,14 +675,14 @@ impl<'a, 'tcx, 'x> SpecializedDecoder for CacheDecoder<'a, 'tcx, 'x> { } } -impl<'a, 'tcx, 'x> SpecializedDecoder for CacheDecoder<'a, 'tcx, 'x> { +impl<'a, 'tcx> SpecializedDecoder for CacheDecoder<'a, 'tcx> { #[inline] fn specialized_decode(&mut self) -> Result { Ok(LocalDefId::from_def_id(DefId::decode(self)?)) } } -impl<'a, 'tcx, 'x> SpecializedDecoder for CacheDecoder<'a, 'tcx, 'x> { +impl<'a, 'tcx> SpecializedDecoder for CacheDecoder<'a, 'tcx> { fn specialized_decode(&mut self) -> Result { // Load the DefPathHash which is was we encoded the DefIndex as. let def_path_hash = DefPathHash::decode(self)?; @@ -710,7 +709,7 @@ impl<'a, 'tcx, 'x> SpecializedDecoder for CacheDecoder<'a, 'tcx, 'x> // NodeIds are not stable across compilation sessions, so we store them in their // HirId representation. This allows use to map them to the current NodeId. -impl<'a, 'tcx, 'x> SpecializedDecoder for CacheDecoder<'a, 'tcx, 'x> { +impl<'a, 'tcx> SpecializedDecoder for CacheDecoder<'a, 'tcx> { #[inline] fn specialized_decode(&mut self) -> Result { let hir_id = hir::HirId::decode(self)?; @@ -718,14 +717,14 @@ impl<'a, 'tcx, 'x> SpecializedDecoder for CacheDecoder<'a, 'tcx, 'x> { } } -impl<'a, 'tcx, 'x> SpecializedDecoder for CacheDecoder<'a, 'tcx, 'x> { +impl<'a, 'tcx> SpecializedDecoder for CacheDecoder<'a, 'tcx> { fn specialized_decode(&mut self) -> Result { Fingerprint::decode_opaque(&mut self.opaque) } } -impl<'a, 'tcx, 'x, T: Decodable> SpecializedDecoder> -for CacheDecoder<'a, 'tcx, 'x> { +impl<'a, 'tcx, T: Decodable> SpecializedDecoder> +for CacheDecoder<'a, 'tcx> { #[inline] fn specialized_decode(&mut self) -> Result, Self::Error> { let discr = u8::decode(self)?; @@ -745,12 +744,9 @@ for CacheDecoder<'a, 'tcx, 'x> { //- ENCODING ------------------------------------------------------------------- -struct CacheEncoder<'enc, 'a, 'tcx, E> - where E: 'enc + ty_codec::TyEncoder, - 'tcx: 'a, -{ - tcx: TyCtxt<'a, 'tcx, 'tcx>, - encoder: &'enc mut E, +struct CacheEncoder<'a, 'tcx, E: ty_codec::TyEncoder> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + encoder: &'a mut E, type_shorthands: FxHashMap, usize>, predicate_shorthands: FxHashMap, usize>, expn_info_shorthands: FxHashMap, @@ -760,8 +756,8 @@ struct CacheEncoder<'enc, 'a, 'tcx, E> file_to_file_index: FxHashMap<*const SourceFile, SourceFileIndex>, } -impl<'enc, 'a, 'tcx, E> CacheEncoder<'enc, 'a, 'tcx, E> - where E: 'enc + ty_codec::TyEncoder +impl<'a, 'tcx, E> CacheEncoder<'a, 'tcx, E> + where E: 'a + ty_codec::TyEncoder { fn source_file_index(&mut self, source_file: Lrc) -> SourceFileIndex { self.file_to_file_index[&(&*source_file as *const SourceFile)] @@ -787,8 +783,8 @@ impl<'enc, 'a, 'tcx, E> CacheEncoder<'enc, 'a, 'tcx, E> } } -impl<'enc, 'a, 'tcx, E> SpecializedEncoder for CacheEncoder<'enc, 'a, 'tcx, E> - where E: 'enc + ty_codec::TyEncoder +impl<'a, 'tcx, E> SpecializedEncoder for CacheEncoder<'a, 'tcx, E> + where E: 'a + ty_codec::TyEncoder { fn specialized_encode(&mut self, alloc_id: &interpret::AllocId) -> Result<(), Self::Error> { use std::collections::hash_map::Entry; @@ -806,8 +802,8 @@ impl<'enc, 'a, 'tcx, E> SpecializedEncoder for CacheEncoder< } } -impl<'enc, 'a, 'tcx, E> SpecializedEncoder for CacheEncoder<'enc, 'a, 'tcx, E> - where E: 'enc + ty_codec::TyEncoder +impl<'a, 'tcx, E> SpecializedEncoder for CacheEncoder<'a, 'tcx, E> + where E: 'a + ty_codec::TyEncoder { fn specialized_encode(&mut self, span: &Span) -> Result<(), Self::Error> { @@ -862,8 +858,8 @@ impl<'enc, 'a, 'tcx, E> SpecializedEncoder for CacheEncoder<'enc, 'a, 'tcx } } -impl<'enc, 'a, 'tcx, E> ty_codec::TyEncoder for CacheEncoder<'enc, 'a, 'tcx, E> - where E: 'enc + ty_codec::TyEncoder +impl<'a, 'tcx, E> ty_codec::TyEncoder for CacheEncoder<'a, 'tcx, E> + where E: 'a + ty_codec::TyEncoder { #[inline] fn position(&self) -> usize { @@ -871,8 +867,8 @@ impl<'enc, 'a, 'tcx, E> ty_codec::TyEncoder for CacheEncoder<'enc, 'a, 'tcx, E> } } -impl<'enc, 'a, 'tcx, E> SpecializedEncoder for CacheEncoder<'enc, 'a, 'tcx, E> - where E: 'enc + ty_codec::TyEncoder +impl<'a, 'tcx, E> SpecializedEncoder for CacheEncoder<'a, 'tcx, E> + where E: 'a + ty_codec::TyEncoder { #[inline] fn specialized_encode(&mut self, cnum: &CrateNum) -> Result<(), Self::Error> { @@ -880,8 +876,8 @@ impl<'enc, 'a, 'tcx, E> SpecializedEncoder for CacheEncoder<'enc, 'a, } } -impl<'enc, 'a, 'tcx, E> SpecializedEncoder> for CacheEncoder<'enc, 'a, 'tcx, E> - where E: 'enc + ty_codec::TyEncoder +impl<'a, 'tcx, E> SpecializedEncoder> for CacheEncoder<'a, 'tcx, E> + where E: 'a + ty_codec::TyEncoder { #[inline] fn specialized_encode(&mut self, ty: &Ty<'tcx>) -> Result<(), Self::Error> { @@ -890,9 +886,9 @@ impl<'enc, 'a, 'tcx, E> SpecializedEncoder> for CacheEncoder<'enc, 'a, } } -impl<'enc, 'a, 'tcx, E> SpecializedEncoder> - for CacheEncoder<'enc, 'a, 'tcx, E> - where E: 'enc + ty_codec::TyEncoder +impl<'a, 'tcx, E> SpecializedEncoder> + for CacheEncoder<'a, 'tcx, E> + where E: 'a + ty_codec::TyEncoder { #[inline] fn specialized_encode(&mut self, @@ -903,8 +899,8 @@ impl<'enc, 'a, 'tcx, E> SpecializedEncoder> } } -impl<'enc, 'a, 'tcx, E> SpecializedEncoder for CacheEncoder<'enc, 'a, 'tcx, E> - where E: 'enc + ty_codec::TyEncoder +impl<'a, 'tcx, E> SpecializedEncoder for CacheEncoder<'a, 'tcx, E> + where E: 'a + ty_codec::TyEncoder { #[inline] fn specialized_encode(&mut self, id: &hir::HirId) -> Result<(), Self::Error> { @@ -921,8 +917,8 @@ impl<'enc, 'a, 'tcx, E> SpecializedEncoder for CacheEncoder<'enc, 'a } -impl<'enc, 'a, 'tcx, E> SpecializedEncoder for CacheEncoder<'enc, 'a, 'tcx, E> - where E: 'enc + ty_codec::TyEncoder +impl<'a, 'tcx, E> SpecializedEncoder for CacheEncoder<'a, 'tcx, E> + where E: 'a + ty_codec::TyEncoder { #[inline] fn specialized_encode(&mut self, id: &DefId) -> Result<(), Self::Error> { @@ -931,8 +927,8 @@ impl<'enc, 'a, 'tcx, E> SpecializedEncoder for CacheEncoder<'enc, 'a, 'tc } } -impl<'enc, 'a, 'tcx, E> SpecializedEncoder for CacheEncoder<'enc, 'a, 'tcx, E> - where E: 'enc + ty_codec::TyEncoder +impl<'a, 'tcx, E> SpecializedEncoder for CacheEncoder<'a, 'tcx, E> + where E: 'a + ty_codec::TyEncoder { #[inline] fn specialized_encode(&mut self, id: &LocalDefId) -> Result<(), Self::Error> { @@ -940,8 +936,8 @@ impl<'enc, 'a, 'tcx, E> SpecializedEncoder for CacheEncoder<'enc, 'a } } -impl<'enc, 'a, 'tcx, E> SpecializedEncoder for CacheEncoder<'enc, 'a, 'tcx, E> - where E: 'enc + ty_codec::TyEncoder +impl<'a, 'tcx, E> SpecializedEncoder for CacheEncoder<'a, 'tcx, E> + where E: 'a + ty_codec::TyEncoder { fn specialized_encode(&mut self, _: &DefIndex) -> Result<(), Self::Error> { bug!("Encoding DefIndex without context.") @@ -950,8 +946,8 @@ impl<'enc, 'a, 'tcx, E> SpecializedEncoder for CacheEncoder<'enc, 'a, // NodeIds are not stable across compilation sessions, so we store them in their // HirId representation. This allows use to map them to the current NodeId. -impl<'enc, 'a, 'tcx, E> SpecializedEncoder for CacheEncoder<'enc, 'a, 'tcx, E> - where E: 'enc + ty_codec::TyEncoder +impl<'a, 'tcx, E> SpecializedEncoder for CacheEncoder<'a, 'tcx, E> + where E: 'a + ty_codec::TyEncoder { #[inline] fn specialized_encode(&mut self, node_id: &NodeId) -> Result<(), Self::Error> { @@ -960,17 +956,17 @@ impl<'enc, 'a, 'tcx, E> SpecializedEncoder for CacheEncoder<'enc, 'a, 't } } -impl<'enc, 'a, 'tcx> SpecializedEncoder -for CacheEncoder<'enc, 'a, 'tcx, opaque::Encoder> +impl<'a, 'tcx> SpecializedEncoder +for CacheEncoder<'a, 'tcx, opaque::Encoder> { fn specialized_encode(&mut self, f: &Fingerprint) -> Result<(), Self::Error> { f.encode_opaque(&mut self.encoder) } } -impl<'enc, 'a, 'tcx, E, T> SpecializedEncoder> -for CacheEncoder<'enc, 'a, 'tcx, E> - where E: 'enc + ty_codec::TyEncoder, +impl<'a, 'tcx, E, T> SpecializedEncoder> +for CacheEncoder<'a, 'tcx, E> + where E: 'a + ty_codec::TyEncoder, T: Encodable, { #[inline] @@ -997,8 +993,8 @@ macro_rules! encoder_methods { } } -impl<'enc, 'a, 'tcx, E> Encoder for CacheEncoder<'enc, 'a, 'tcx, E> - where E: 'enc + ty_codec::TyEncoder +impl<'a, 'tcx, E> Encoder for CacheEncoder<'a, 'tcx, E> + where E: 'a + ty_codec::TyEncoder { type Error = E::Error; @@ -1051,7 +1047,7 @@ impl SpecializedEncoder for opaque::Encoder { } } -impl<'enc> SpecializedDecoder for opaque::Decoder<'enc> { +impl<'a> SpecializedDecoder for opaque::Decoder<'a> { fn specialized_decode(&mut self) -> Result { let mut value: u64 = 0; let start_pos = self.position(); @@ -1068,12 +1064,12 @@ impl<'enc> SpecializedDecoder for opaque::Decoder<'enc> } } -fn encode_query_results<'enc, 'a, 'tcx, Q, E>(tcx: TyCtxt<'a, 'tcx, 'tcx>, - encoder: &mut CacheEncoder<'enc, 'a, 'tcx, E>, +fn encode_query_results<'a, 'tcx, Q, E>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + encoder: &mut CacheEncoder<'a, 'tcx, E>, query_result_index: &mut EncodedQueryResultIndex) -> Result<(), E::Error> where Q: super::config::QueryDescription<'tcx>, - E: 'enc + TyEncoder, + E: 'a + TyEncoder, Q::Value: Encodable, { let desc = &format!("encode_query_results for {}", diff --git a/src/librustc/ty/query/plumbing.rs b/src/librustc/ty/query/plumbing.rs index c2760ccb0c0a2..d2ad8861def17 100644 --- a/src/librustc/ty/query/plumbing.rs +++ b/src/librustc/ty/query/plumbing.rs @@ -247,7 +247,7 @@ pub(super) enum TryGetJob<'a, 'tcx: 'a, D: QueryDescription<'tcx> + 'a> { Cycle(D::Value), } -impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { +impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { /// Executes a job by changing the ImplicitCtxt to point to the /// new query job while it executes. It returns the diagnostics /// captured during execution and the actual result. @@ -259,7 +259,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { compute: F) -> R where - F: for<'b, 'lcx> FnOnce(TyCtxt<'b, 'gcx, 'lcx>) -> R + F: for<'b, 'lcx> FnOnce(TyCtxt<'lcx, 'gcx, 'lcx>) -> R { // The TyCtxt stored in TLS has the same global interner lifetime // as `self`, so we use `with_related_context` to relate the 'gcx lifetimes @@ -286,7 +286,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { pub(super) fn report_cycle( self, CycleError { usage, cycle: stack }: CycleError<'gcx> - ) -> DiagnosticBuilder<'a> + ) -> DiagnosticBuilder<'tcx> { assert!(!stack.is_empty()); @@ -996,11 +996,11 @@ macro_rules! define_queries_inner { })* #[derive(Copy, Clone)] - pub struct TyCtxtEnsure<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { - pub tcx: TyCtxt<'a, 'gcx, 'tcx>, + pub struct TyCtxtEnsure<'gcx, 'tcx> { + pub tcx: TyCtxt<'tcx, 'gcx, 'tcx>, } - impl<'a, $tcx, 'lcx> TyCtxtEnsure<'a, $tcx, 'lcx> { + impl TyCtxtEnsure<$tcx, 'lcx> { $($(#[$attr])* #[inline(always)] pub fn $name(self, key: $K) { @@ -1009,24 +1009,24 @@ macro_rules! define_queries_inner { } #[derive(Copy, Clone)] - pub struct TyCtxtAt<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { - pub tcx: TyCtxt<'a, 'gcx, 'tcx>, + pub struct TyCtxtAt<'gcx, 'tcx> { + pub tcx: TyCtxt<'tcx, 'gcx, 'tcx>, pub span: Span, } - impl<'a, 'gcx, 'tcx> Deref for TyCtxtAt<'a, 'gcx, 'tcx> { - type Target = TyCtxt<'a, 'gcx, 'tcx>; + impl Deref for TyCtxtAt<'gcx, 'tcx> { + type Target = TyCtxt<'tcx, 'gcx, 'tcx>; #[inline(always)] fn deref(&self) -> &Self::Target { &self.tcx } } - impl<'a, $tcx, 'lcx> TyCtxt<'a, $tcx, 'lcx> { + impl TyCtxt<'lcx, $tcx, 'lcx> { /// Returns a transparent wrapper for `TyCtxt`, which ensures queries /// are executed instead of just returing their results. #[inline(always)] - pub fn ensure(self) -> TyCtxtEnsure<'a, $tcx, 'lcx> { + pub fn ensure(self) -> TyCtxtEnsure<$tcx, 'lcx> { TyCtxtEnsure { tcx: self, } @@ -1035,7 +1035,7 @@ macro_rules! define_queries_inner { /// Returns a transparent wrapper for `TyCtxt` which uses /// `span` as the location of queries performed through it. #[inline(always)] - pub fn at(self, span: Span) -> TyCtxtAt<'a, $tcx, 'lcx> { + pub fn at(self, span: Span) -> TyCtxtAt<$tcx, 'lcx> { TyCtxtAt { tcx: self, span @@ -1049,7 +1049,7 @@ macro_rules! define_queries_inner { })* } - impl<'a, $tcx, 'lcx> TyCtxtAt<'a, $tcx, 'lcx> { + impl TyCtxtAt<$tcx, 'lcx> { $($(#[$attr])* #[inline(always)] pub fn $name(self, key: $K) -> $V { @@ -1090,12 +1090,12 @@ macro_rules! define_provider_struct { (tcx: $tcx:tt, input: ($(([$($modifiers:tt)*] [$name:ident] [$K:ty] [$R:ty]))*)) => { pub struct Providers<$tcx> { - $(pub $name: for<'a> fn(TyCtxt<'a, $tcx, $tcx>, $K) -> $R,)* + $(pub $name: fn(TyCtxt<$tcx, $tcx, $tcx>, $K) -> $R,)* } impl<$tcx> Default for Providers<$tcx> { fn default() -> Self { - $(fn $name<'a, $tcx>(_: TyCtxt<'a, $tcx, $tcx>, key: $K) -> $R { + $(fn $name<$tcx>(_: TyCtxt<$tcx, $tcx, $tcx>, key: $K) -> $R { bug!("tcx.{}({:?}) unsupported by its crate", stringify!($name), key); })* @@ -1149,7 +1149,7 @@ macro_rules! define_provider_struct { /// add it to the "We don't have enough information to reconstruct..." group in /// the match below. pub fn force_from_dep_node<'tcx>( - tcx: TyCtxt<'_, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, dep_node: &DepNode ) -> bool { use crate::dep_graph::RecoverKey; diff --git a/src/librustc/ty/query/values.rs b/src/librustc/ty/query/values.rs index 01d431b0ef0e7..66a6c52da3816 100644 --- a/src/librustc/ty/query/values.rs +++ b/src/librustc/ty/query/values.rs @@ -4,36 +4,36 @@ use crate::ty::util::NeedsDrop; use syntax::symbol::InternedString; pub(super) trait Value<'tcx>: Sized { - fn from_cycle_error<'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Self; + fn from_cycle_error<'a>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Self; } impl<'tcx, T> Value<'tcx> for T { - default fn from_cycle_error<'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> T { + default fn from_cycle_error<'a>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> T { tcx.sess.abort_if_errors(); bug!("Value::from_cycle_error called without errors"); } } impl<'tcx> Value<'tcx> for Ty<'tcx> { - fn from_cycle_error<'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Ty<'tcx> { + fn from_cycle_error<'a>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Ty<'tcx> { tcx.types.err } } impl<'tcx> Value<'tcx> for ty::SymbolName { - fn from_cycle_error<'a>(_: TyCtxt<'a, 'tcx, 'tcx>) -> Self { + fn from_cycle_error<'a>(_: TyCtxt<'tcx, 'tcx, 'tcx>) -> Self { ty::SymbolName { name: InternedString::intern("") } } } impl<'tcx> Value<'tcx> for NeedsDrop { - fn from_cycle_error(_: TyCtxt<'_, 'tcx, 'tcx>) -> Self { + fn from_cycle_error(_: TyCtxt<'tcx, 'tcx, 'tcx>) -> Self { NeedsDrop(false) } } impl<'tcx> Value<'tcx> for AdtSizedConstraint<'tcx> { - fn from_cycle_error(tcx: TyCtxt<'_, 'tcx, 'tcx>) -> Self { + fn from_cycle_error(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Self { AdtSizedConstraint(tcx.intern_type_list(&[tcx.types.err])) } } diff --git a/src/librustc/ty/relate.rs b/src/librustc/ty/relate.rs index 0440be13a7271..288e203902a14 100644 --- a/src/librustc/ty/relate.rs +++ b/src/librustc/ty/relate.rs @@ -22,8 +22,8 @@ pub enum Cause { ExistentialRegionBound, // relating an existential region bound } -pub trait TypeRelation<'a, 'gcx: 'a+'tcx, 'tcx: 'a> : Sized { - fn tcx(&self) -> TyCtxt<'a, 'gcx, 'tcx>; +pub trait TypeRelation<'gcx: 'tcx, 'tcx> : Sized { + fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx>; /// Returns a static string we can use for printouts. fn tag(&self) -> &'static str; @@ -96,7 +96,7 @@ pub trait TypeRelation<'a, 'gcx: 'a+'tcx, 'tcx: 'a> : Sized { pub trait Relate<'tcx>: TypeFoldable<'tcx> { fn relate<'a, 'gcx, R>(relation: &mut R, a: &Self, b: &Self) -> RelateResult<'tcx, Self> - where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a; + where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a; } /////////////////////////////////////////////////////////////////////////// @@ -107,7 +107,7 @@ impl<'tcx> Relate<'tcx> for ty::TypeAndMut<'tcx> { a: &ty::TypeAndMut<'tcx>, b: &ty::TypeAndMut<'tcx>) -> RelateResult<'tcx, ty::TypeAndMut<'tcx>> - where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a + where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a { debug!("{}.mts({:?}, {:?})", relation.tag(), @@ -132,7 +132,7 @@ pub fn relate_substs<'a, 'gcx, 'tcx, R>(relation: &mut R, a_subst: SubstsRef<'tcx>, b_subst: SubstsRef<'tcx>) -> RelateResult<'tcx, SubstsRef<'tcx>> - where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a + where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a { let tcx = relation.tcx(); @@ -149,7 +149,7 @@ impl<'tcx> Relate<'tcx> for ty::FnSig<'tcx> { a: &ty::FnSig<'tcx>, b: &ty::FnSig<'tcx>) -> RelateResult<'tcx, ty::FnSig<'tcx>> - where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a + where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a { let tcx = relation.tcx(); @@ -189,7 +189,7 @@ impl<'tcx> Relate<'tcx> for ast::Unsafety { a: &ast::Unsafety, b: &ast::Unsafety) -> RelateResult<'tcx, ast::Unsafety> - where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a + where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a { if a != b { Err(TypeError::UnsafetyMismatch(expected_found(relation, a, b))) @@ -204,7 +204,7 @@ impl<'tcx> Relate<'tcx> for abi::Abi { a: &abi::Abi, b: &abi::Abi) -> RelateResult<'tcx, abi::Abi> - where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a + where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a { if a == b { Ok(*a) @@ -219,7 +219,7 @@ impl<'tcx> Relate<'tcx> for ty::ProjectionTy<'tcx> { a: &ty::ProjectionTy<'tcx>, b: &ty::ProjectionTy<'tcx>) -> RelateResult<'tcx, ty::ProjectionTy<'tcx>> - where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a + where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a { if a.item_def_id != b.item_def_id { Err(TypeError::ProjectionMismatched( @@ -239,7 +239,7 @@ impl<'tcx> Relate<'tcx> for ty::ExistentialProjection<'tcx> { a: &ty::ExistentialProjection<'tcx>, b: &ty::ExistentialProjection<'tcx>) -> RelateResult<'tcx, ty::ExistentialProjection<'tcx>> - where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a + where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a { if a.item_def_id != b.item_def_id { Err(TypeError::ProjectionMismatched( @@ -261,7 +261,7 @@ impl<'tcx> Relate<'tcx> for Vec> { a: &Vec>, b: &Vec>) -> RelateResult<'tcx, Vec>> - where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a + where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a { // To be compatible, `a` and `b` must be for precisely the // same set of traits and item names. We always require that @@ -284,7 +284,7 @@ impl<'tcx> Relate<'tcx> for ty::TraitRef<'tcx> { a: &ty::TraitRef<'tcx>, b: &ty::TraitRef<'tcx>) -> RelateResult<'tcx, ty::TraitRef<'tcx>> - where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a + where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a { // Different traits cannot be related if a.def_id != b.def_id { @@ -301,7 +301,7 @@ impl<'tcx> Relate<'tcx> for ty::ExistentialTraitRef<'tcx> { a: &ty::ExistentialTraitRef<'tcx>, b: &ty::ExistentialTraitRef<'tcx>) -> RelateResult<'tcx, ty::ExistentialTraitRef<'tcx>> - where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a + where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a { // Different traits cannot be related if a.def_id != b.def_id { @@ -327,7 +327,7 @@ impl<'tcx> Relate<'tcx> for GeneratorWitness<'tcx> { a: &GeneratorWitness<'tcx>, b: &GeneratorWitness<'tcx>) -> RelateResult<'tcx, GeneratorWitness<'tcx>> - where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a + where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a { assert_eq!(a.0.len(), b.0.len()); let tcx = relation.tcx(); @@ -341,7 +341,7 @@ impl<'tcx> Relate<'tcx> for Ty<'tcx> { a: &Ty<'tcx>, b: &Ty<'tcx>) -> RelateResult<'tcx, Ty<'tcx>> - where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a + where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a { relation.tys(a, b) } @@ -354,7 +354,7 @@ pub fn super_relate_tys<'a, 'gcx, 'tcx, R>(relation: &mut R, a: Ty<'tcx>, b: Ty<'tcx>) -> RelateResult<'tcx, Ty<'tcx>> - where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a + where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a { let tcx = relation.tcx(); debug!("super_relate_tys: a={:?} b={:?}", a, b); @@ -556,7 +556,7 @@ pub fn super_relate_consts<'a, 'gcx, 'tcx, R>( b: &'tcx ty::Const<'tcx> ) -> RelateResult<'tcx, &'tcx ty::Const<'tcx>> where - R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a + R: TypeRelation<'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a { let tcx = relation.tcx(); @@ -636,7 +636,7 @@ impl<'tcx> Relate<'tcx> for &'tcx ty::List> { a: &Self, b: &Self) -> RelateResult<'tcx, Self> - where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a { + where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a { if a.len() != b.len() { return Err(TypeError::ExistentialMismatch(expected_found(relation, a, b))); @@ -661,7 +661,7 @@ impl<'tcx> Relate<'tcx> for ty::ClosureSubsts<'tcx> { a: &ty::ClosureSubsts<'tcx>, b: &ty::ClosureSubsts<'tcx>) -> RelateResult<'tcx, ty::ClosureSubsts<'tcx>> - where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a + where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a { let substs = relate_substs(relation, None, a.substs, b.substs)?; Ok(ty::ClosureSubsts { substs }) @@ -673,7 +673,7 @@ impl<'tcx> Relate<'tcx> for ty::GeneratorSubsts<'tcx> { a: &ty::GeneratorSubsts<'tcx>, b: &ty::GeneratorSubsts<'tcx>) -> RelateResult<'tcx, ty::GeneratorSubsts<'tcx>> - where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a + where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a { let substs = relate_substs(relation, None, a.substs, b.substs)?; Ok(ty::GeneratorSubsts { substs }) @@ -685,7 +685,7 @@ impl<'tcx> Relate<'tcx> for SubstsRef<'tcx> { a: &SubstsRef<'tcx>, b: &SubstsRef<'tcx>) -> RelateResult<'tcx, SubstsRef<'tcx>> - where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a + where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a { relate_substs(relation, None, a, b) } @@ -696,7 +696,7 @@ impl<'tcx> Relate<'tcx> for ty::Region<'tcx> { a: &ty::Region<'tcx>, b: &ty::Region<'tcx>) -> RelateResult<'tcx, ty::Region<'tcx>> - where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a + where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a { relation.regions(*a, *b) } @@ -707,7 +707,7 @@ impl<'tcx> Relate<'tcx> for &'tcx ty::Const<'tcx> { a: &&'tcx ty::Const<'tcx>, b: &&'tcx ty::Const<'tcx>) -> RelateResult<'tcx, &'tcx ty::Const<'tcx>> - where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a + where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a { relation.consts(*a, *b) } @@ -718,7 +718,7 @@ impl<'tcx, T: Relate<'tcx>> Relate<'tcx> for ty::Binder { a: &ty::Binder, b: &ty::Binder) -> RelateResult<'tcx, ty::Binder> - where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a + where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a { relation.binders(a, b) } @@ -729,7 +729,7 @@ impl<'tcx, T: Relate<'tcx>> Relate<'tcx> for Rc { a: &Rc, b: &Rc) -> RelateResult<'tcx, Rc> - where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a + where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a { let a: &T = a; let b: &T = b; @@ -742,7 +742,7 @@ impl<'tcx, T: Relate<'tcx>> Relate<'tcx> for Box { a: &Box, b: &Box) -> RelateResult<'tcx, Box> - where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a + where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a { let a: &T = a; let b: &T = b; @@ -757,7 +757,7 @@ impl<'tcx> Relate<'tcx> for Kind<'tcx> { b: &Kind<'tcx> ) -> RelateResult<'tcx, Kind<'tcx>> where - R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a, + R: TypeRelation<'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a, { match (a.unpack(), b.unpack()) { (UnpackedKind::Lifetime(a_lt), UnpackedKind::Lifetime(b_lt)) => { @@ -788,7 +788,7 @@ impl<'tcx> Relate<'tcx> for ty::TraitPredicate<'tcx> { a: &ty::TraitPredicate<'tcx>, b: &ty::TraitPredicate<'tcx> ) -> RelateResult<'tcx, ty::TraitPredicate<'tcx>> - where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'tcx, 'tcx: 'a + where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'tcx, 'tcx: 'a { Ok(ty::TraitPredicate { trait_ref: relation.relate(&a.trait_ref, &b.trait_ref)?, @@ -802,7 +802,7 @@ impl<'tcx> Relate<'tcx> for ty::ProjectionPredicate<'tcx> { a: &ty::ProjectionPredicate<'tcx>, b: &ty::ProjectionPredicate<'tcx>, ) -> RelateResult<'tcx, ty::ProjectionPredicate<'tcx>> - where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'tcx, 'tcx: 'a + where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'tcx, 'tcx: 'a { Ok(ty::ProjectionPredicate { projection_ty: relation.relate(&a.projection_ty, &b.projection_ty)?, @@ -817,7 +817,7 @@ impl<'tcx> Relate<'tcx> for traits::WhereClause<'tcx> { a: &traits::WhereClause<'tcx>, b: &traits::WhereClause<'tcx> ) -> RelateResult<'tcx, traits::WhereClause<'tcx>> - where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'tcx, 'tcx: 'a + where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'tcx, 'tcx: 'a { use crate::traits::WhereClause::*; match (a, b) { @@ -854,7 +854,7 @@ impl<'tcx> Relate<'tcx> for traits::WellFormed<'tcx> { a: &traits::WellFormed<'tcx>, b: &traits::WellFormed<'tcx> ) -> RelateResult<'tcx, traits::WellFormed<'tcx>> - where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'tcx, 'tcx: 'a + where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'tcx, 'tcx: 'a { use crate::traits::WellFormed::*; match (a, b) { @@ -871,7 +871,7 @@ impl<'tcx> Relate<'tcx> for traits::FromEnv<'tcx> { a: &traits::FromEnv<'tcx>, b: &traits::FromEnv<'tcx> ) -> RelateResult<'tcx, traits::FromEnv<'tcx>> - where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'tcx, 'tcx: 'a + where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'tcx, 'tcx: 'a { use crate::traits::FromEnv::*; match (a, b) { @@ -888,7 +888,7 @@ impl<'tcx> Relate<'tcx> for traits::DomainGoal<'tcx> { a: &traits::DomainGoal<'tcx>, b: &traits::DomainGoal<'tcx> ) -> RelateResult<'tcx, traits::DomainGoal<'tcx>> - where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'tcx, 'tcx: 'a + where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'tcx, 'tcx: 'a { use crate::traits::DomainGoal::*; match (a, b) { @@ -911,7 +911,7 @@ impl<'tcx> Relate<'tcx> for traits::Goal<'tcx> { a: &traits::Goal<'tcx>, b: &traits::Goal<'tcx> ) -> RelateResult<'tcx, traits::Goal<'tcx>> - where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'tcx, 'tcx: 'a + where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'tcx, 'tcx: 'a { use crate::traits::GoalKind::*; match (a, b) { @@ -957,7 +957,7 @@ impl<'tcx> Relate<'tcx> for traits::Goals<'tcx> { a: &traits::Goals<'tcx>, b: &traits::Goals<'tcx> ) -> RelateResult<'tcx, traits::Goals<'tcx>> - where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'tcx, 'tcx: 'a + where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'tcx, 'tcx: 'a { if a.len() != b.len() { return Err(TypeError::Mismatch); @@ -975,7 +975,7 @@ impl<'tcx> Relate<'tcx> for traits::Clause<'tcx> { a: &traits::Clause<'tcx>, b: &traits::Clause<'tcx> ) -> RelateResult<'tcx, traits::Clause<'tcx>> - where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'tcx, 'tcx: 'a + where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'tcx, 'tcx: 'a { use crate::traits::Clause::*; match (a, b) { @@ -1000,7 +1000,7 @@ impl<'tcx> Relate<'tcx> for traits::Clauses<'tcx> { a: &traits::Clauses<'tcx>, b: &traits::Clauses<'tcx> ) -> RelateResult<'tcx, traits::Clauses<'tcx>> - where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'tcx, 'tcx: 'a + where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'tcx, 'tcx: 'a { if a.len() != b.len() { return Err(TypeError::Mismatch); @@ -1018,7 +1018,7 @@ impl<'tcx> Relate<'tcx> for traits::ProgramClause<'tcx> { a: &traits::ProgramClause<'tcx>, b: &traits::ProgramClause<'tcx> ) -> RelateResult<'tcx, traits::ProgramClause<'tcx>> - where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'tcx, 'tcx: 'a + where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'tcx, 'tcx: 'a { Ok(traits::ProgramClause { goal: relation.relate(&a.goal, &b.goal)?, @@ -1034,7 +1034,7 @@ impl<'tcx> Relate<'tcx> for traits::Environment<'tcx> { a: &traits::Environment<'tcx>, b: &traits::Environment<'tcx> ) -> RelateResult<'tcx, traits::Environment<'tcx>> - where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'tcx, 'tcx: 'a + where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'tcx, 'tcx: 'a { Ok(traits::Environment { clauses: relation.relate(&a.clauses, &b.clauses)?, @@ -1050,7 +1050,7 @@ impl<'tcx, G> Relate<'tcx> for traits::InEnvironment<'tcx, G> a: &traits::InEnvironment<'tcx, G>, b: &traits::InEnvironment<'tcx, G> ) -> RelateResult<'tcx, traits::InEnvironment<'tcx, G>> - where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'tcx, 'tcx: 'a + where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'tcx, 'tcx: 'a { Ok(traits::InEnvironment { environment: relation.relate(&a.environment, &b.environment)?, @@ -1066,7 +1066,7 @@ pub fn expected_found<'a, 'gcx, 'tcx, R, T>(relation: &mut R, a: &T, b: &T) -> ExpectedFound - where R: TypeRelation<'a, 'gcx, 'tcx>, T: Clone, 'gcx: 'a+'tcx, 'tcx: 'a + where R: TypeRelation<'gcx, 'tcx>, T: Clone, 'gcx: 'a+'tcx, 'tcx: 'a { expected_found_bool(relation.a_is_expected(), a, b) } diff --git a/src/librustc/ty/structural_impls.rs b/src/librustc/ty/structural_impls.rs index 56d47a7f849cf..ab090558167c3 100644 --- a/src/librustc/ty/structural_impls.rs +++ b/src/librustc/ty/structural_impls.rs @@ -337,14 +337,14 @@ CloneTypeFoldableAndLiftImpls! { // FIXME(eddyb) replace all the uses of `Option::map` with `?`. impl<'tcx, A: Lift<'tcx>, B: Lift<'tcx>> Lift<'tcx> for (A, B) { type Lifted = (A::Lifted, B::Lifted); - fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { tcx.lift(&self.0).and_then(|a| tcx.lift(&self.1).map(|b| (a, b))) } } impl<'tcx, A: Lift<'tcx>, B: Lift<'tcx>, C: Lift<'tcx>> Lift<'tcx> for (A, B, C) { type Lifted = (A::Lifted, B::Lifted, C::Lifted); - fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { tcx.lift(&self.0).and_then(|a| { tcx.lift(&self.1).and_then(|b| tcx.lift(&self.2).map(|c| (a, b, c))) }) @@ -353,7 +353,7 @@ impl<'tcx, A: Lift<'tcx>, B: Lift<'tcx>, C: Lift<'tcx>> Lift<'tcx> for (A, B, C) impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for Option { type Lifted = Option; - fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { match *self { Some(ref x) => tcx.lift(x).map(Some), None => Some(None) @@ -363,7 +363,7 @@ impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for Option { impl<'tcx, T: Lift<'tcx>, E: Lift<'tcx>> Lift<'tcx> for Result { type Lifted = Result; - fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { match *self { Ok(ref x) => tcx.lift(x).map(Ok), Err(ref e) => tcx.lift(e).map(Err) @@ -373,14 +373,14 @@ impl<'tcx, T: Lift<'tcx>, E: Lift<'tcx>> Lift<'tcx> for Result { impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for Box { type Lifted = Box; - fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { tcx.lift(&**self).map(Box::new) } } impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for [T] { type Lifted = Vec; - fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { // type annotation needed to inform `projection_must_outlive` let mut result : Vec<>::Lifted> = Vec::with_capacity(self.len()); @@ -397,14 +397,14 @@ impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for [T] { impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for Vec { type Lifted = Vec; - fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { tcx.lift(&self[..]) } } impl<'tcx, I: Idx, T: Lift<'tcx>> Lift<'tcx> for IndexVec { type Lifted = IndexVec; - fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { self.iter() .map(|e| tcx.lift(e)) .collect() @@ -413,7 +413,7 @@ impl<'tcx, I: Idx, T: Lift<'tcx>> Lift<'tcx> for IndexVec { impl<'a, 'tcx> Lift<'tcx> for ty::TraitRef<'a> { type Lifted = ty::TraitRef<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { tcx.lift(&self.substs).map(|substs| ty::TraitRef { def_id: self.def_id, substs, @@ -423,7 +423,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::TraitRef<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::ExistentialTraitRef<'a> { type Lifted = ty::ExistentialTraitRef<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { tcx.lift(&self.substs).map(|substs| ty::ExistentialTraitRef { def_id: self.def_id, substs, @@ -433,7 +433,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::ExistentialTraitRef<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::ExistentialPredicate<'a> { type Lifted = ty::ExistentialPredicate<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { match self { ty::ExistentialPredicate::Trait(x) => { tcx.lift(x).map(ty::ExistentialPredicate::Trait) @@ -450,7 +450,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::ExistentialPredicate<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::TraitPredicate<'a> { type Lifted = ty::TraitPredicate<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) + fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option> { tcx.lift(&self.trait_ref).map(|trait_ref| ty::TraitPredicate { trait_ref, @@ -460,7 +460,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::TraitPredicate<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::SubtypePredicate<'a> { type Lifted = ty::SubtypePredicate<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) + fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option> { tcx.lift(&(self.a, self.b)).map(|(a, b)| ty::SubtypePredicate { a_is_expected: self.a_is_expected, @@ -472,14 +472,14 @@ impl<'a, 'tcx> Lift<'tcx> for ty::SubtypePredicate<'a> { impl<'tcx, A: Copy+Lift<'tcx>, B: Copy+Lift<'tcx>> Lift<'tcx> for ty::OutlivesPredicate { type Lifted = ty::OutlivesPredicate; - fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { tcx.lift(&(self.0, self.1)).map(|(a, b)| ty::OutlivesPredicate(a, b)) } } impl<'a, 'tcx> Lift<'tcx> for ty::ProjectionTy<'a> { type Lifted = ty::ProjectionTy<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) + fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option> { tcx.lift(&self.substs).map(|substs| { ty::ProjectionTy { @@ -492,7 +492,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::ProjectionTy<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::ProjectionPredicate<'a> { type Lifted = ty::ProjectionPredicate<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) + fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option> { tcx.lift(&(self.projection_ty, self.ty)).map(|(projection_ty, ty)| { ty::ProjectionPredicate { @@ -505,7 +505,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::ProjectionPredicate<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::ExistentialProjection<'a> { type Lifted = ty::ExistentialProjection<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { tcx.lift(&self.substs).map(|substs| { ty::ExistentialProjection { substs, @@ -518,7 +518,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::ExistentialProjection<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::Predicate<'a> { type Lifted = ty::Predicate<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { match *self { ty::Predicate::Trait(ref binder) => { tcx.lift(binder).map(ty::Predicate::Trait) @@ -558,14 +558,14 @@ impl<'a, 'tcx> Lift<'tcx> for ty::Predicate<'a> { impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for ty::Binder { type Lifted = ty::Binder; - fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { tcx.lift(self.skip_binder()).map(ty::Binder::bind) } } impl<'a, 'tcx> Lift<'tcx> for ty::ParamEnv<'a> { type Lifted = ty::ParamEnv<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { tcx.lift(&self.caller_bounds).map(|caller_bounds| { ty::ParamEnv { reveal: self.reveal, @@ -578,7 +578,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::ParamEnv<'a> { impl<'a, 'tcx, T: Lift<'tcx>> Lift<'tcx> for ty::ParamEnvAnd<'a, T> { type Lifted = ty::ParamEnvAnd<'tcx, T::Lifted>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { tcx.lift(&self.param_env).and_then(|param_env| { tcx.lift(&self.value).map(|value| { ty::ParamEnvAnd { @@ -592,7 +592,7 @@ impl<'a, 'tcx, T: Lift<'tcx>> Lift<'tcx> for ty::ParamEnvAnd<'a, T> { impl<'a, 'tcx> Lift<'tcx> for ty::ClosureSubsts<'a> { type Lifted = ty::ClosureSubsts<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { tcx.lift(&self.substs).map(|substs| { ty::ClosureSubsts { substs } }) @@ -601,7 +601,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::ClosureSubsts<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::GeneratorSubsts<'a> { type Lifted = ty::GeneratorSubsts<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { tcx.lift(&self.substs).map(|substs| { ty::GeneratorSubsts { substs } }) @@ -610,7 +610,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::GeneratorSubsts<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::adjustment::Adjustment<'a> { type Lifted = ty::adjustment::Adjustment<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { tcx.lift(&self.kind).and_then(|kind| { tcx.lift(&self.target).map(|target| { ty::adjustment::Adjustment { kind, target } @@ -621,7 +621,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::adjustment::Adjustment<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::adjustment::Adjust<'a> { type Lifted = ty::adjustment::Adjust<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { match *self { ty::adjustment::Adjust::NeverToAny => Some(ty::adjustment::Adjust::NeverToAny), @@ -639,7 +639,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::adjustment::Adjust<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::adjustment::OverloadedDeref<'a> { type Lifted = ty::adjustment::OverloadedDeref<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { tcx.lift(&self.region).map(|region| { ty::adjustment::OverloadedDeref { region, @@ -651,7 +651,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::adjustment::OverloadedDeref<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::adjustment::AutoBorrow<'a> { type Lifted = ty::adjustment::AutoBorrow<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { match *self { ty::adjustment::AutoBorrow::Ref(r, m) => { tcx.lift(&r).map(|r| ty::adjustment::AutoBorrow::Ref(r, m)) @@ -665,7 +665,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::adjustment::AutoBorrow<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::GenSig<'a> { type Lifted = ty::GenSig<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { tcx.lift(&(self.yield_ty, self.return_ty)) .map(|(yield_ty, return_ty)| { ty::GenSig { @@ -678,7 +678,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::GenSig<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::FnSig<'a> { type Lifted = ty::FnSig<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { tcx.lift(&self.inputs_and_output).map(|x| { ty::FnSig { inputs_and_output: x, @@ -692,7 +692,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::FnSig<'a> { impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for ty::error::ExpectedFound { type Lifted = ty::error::ExpectedFound; - fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { tcx.lift(&self.expected).and_then(|expected| { tcx.lift(&self.found).map(|found| { ty::error::ExpectedFound { @@ -706,7 +706,7 @@ impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for ty::error::ExpectedFound { impl<'a, 'tcx> Lift<'tcx> for ty::error::TypeError<'a> { type Lifted = ty::error::TypeError<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { use crate::ty::error::TypeError::*; Some(match *self { @@ -743,7 +743,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::error::TypeError<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::InstanceDef<'a> { type Lifted = ty::InstanceDef<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { match *self { ty::InstanceDef::Item(def_id) => Some(ty::InstanceDef::Item(def_id)), diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs index 0e5c906024c3f..959031c7c9fbf 100644 --- a/src/librustc/ty/sty.rs +++ b/src/librustc/ty/sty.rs @@ -368,7 +368,7 @@ impl<'tcx> ClosureSubsts<'tcx> { /// there are no type variables. /// /// If you have an inference context, use `infcx.closure_kind()`. - pub fn closure_kind(self, def_id: DefId, tcx: TyCtxt<'_, 'tcx, 'tcx>) -> ty::ClosureKind { + pub fn closure_kind(self, def_id: DefId, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> ty::ClosureKind { self.split(def_id, tcx).closure_kind_ty.to_opt_closure_kind().unwrap() } @@ -377,7 +377,7 @@ impl<'tcx> ClosureSubsts<'tcx> { /// there are no type variables. /// /// If you have an inference context, use `infcx.closure_sig()`. - pub fn closure_sig(self, def_id: DefId, tcx: TyCtxt<'_, 'tcx, 'tcx>) -> ty::PolyFnSig<'tcx> { + pub fn closure_sig(self, def_id: DefId, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> ty::PolyFnSig<'tcx> { let ty = self.closure_sig_ty(def_id, tcx); match ty.sty { ty::FnPtr(sig) => sig, @@ -465,7 +465,7 @@ impl<'tcx> GeneratorSubsts<'tcx> { } } -impl<'a, 'gcx, 'tcx> GeneratorSubsts<'tcx> { +impl<'gcx, 'tcx> GeneratorSubsts<'tcx> { /// Generator have not been resumed yet pub const UNRESUMED: usize = 0; /// Generator has returned / is completed @@ -479,7 +479,7 @@ impl<'a, 'gcx, 'tcx> GeneratorSubsts<'tcx> { /// The valid variant indices of this Generator. #[inline] - pub fn variant_range(&self, def_id: DefId, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Range { + pub fn variant_range(&self, def_id: DefId, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Range { // FIXME requires optimized MIR let num_variants = tcx.generator_layout(def_id).variant_fields.len(); (VariantIdx::new(0)..VariantIdx::new(num_variants)) @@ -489,7 +489,7 @@ impl<'a, 'gcx, 'tcx> GeneratorSubsts<'tcx> { /// out of range. #[inline] pub fn discriminant_for_variant( - &self, def_id: DefId, tcx: TyCtxt<'a, 'gcx, 'tcx>, variant_index: VariantIdx + &self, def_id: DefId, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, variant_index: VariantIdx ) -> Discr<'tcx> { // Generators don't support explicit discriminant values, so they are // the same as the variant index. @@ -501,8 +501,8 @@ impl<'a, 'gcx, 'tcx> GeneratorSubsts<'tcx> { /// variant indices. #[inline] pub fn discriminants( - &'a self, def_id: DefId, tcx: TyCtxt<'a, 'gcx, 'tcx> - ) -> impl Iterator)> + Captures<'gcx> + 'a { + &'tcx self, def_id: DefId, tcx: TyCtxt<'tcx, 'gcx, 'tcx> + ) -> impl Iterator)> + Captures<'gcx> { self.variant_range(def_id, tcx).map(move |index| { (index, Discr { val: index.as_usize() as u128, ty: self.discr_ty(tcx) }) }) @@ -522,7 +522,7 @@ impl<'a, 'gcx, 'tcx> GeneratorSubsts<'tcx> { /// The type of the state discriminant used in the generator type. #[inline] - pub fn discr_ty(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Ty<'tcx> { + pub fn discr_ty(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx> { tcx.types.u32 } @@ -533,8 +533,8 @@ impl<'a, 'gcx, 'tcx> GeneratorSubsts<'tcx> { /// The locals are grouped by their variant number. Note that some locals may /// be repeated in multiple variants. #[inline] - pub fn state_tys(self, def_id: DefId, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> - impl Iterator> + Captures<'gcx> + 'a> + pub fn state_tys(self, def_id: DefId, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> + impl Iterator> + Captures<'gcx>> { let layout = tcx.generator_layout(def_id); layout.variant_fields.iter().map(move |variant| { @@ -547,8 +547,8 @@ impl<'a, 'gcx, 'tcx> GeneratorSubsts<'tcx> { /// This is the types of the fields of a generator which are not stored in a /// variant. #[inline] - pub fn prefix_tys(self, def_id: DefId, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> - impl Iterator> + 'a + pub fn prefix_tys(self, def_id: DefId, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> + impl Iterator> { self.upvar_tys(def_id, tcx) } @@ -593,7 +593,7 @@ pub enum ExistentialPredicate<'tcx> { impl<'a, 'gcx, 'tcx> ExistentialPredicate<'tcx> { /// Compares via an ordering that will not change if modules are reordered or other changes are /// made to the tree. In particular, this ordering is preserved across incremental compilations. - pub fn stable_cmp(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, other: &Self) -> Ordering { + pub fn stable_cmp(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, other: &Self) -> Ordering { use self::ExistentialPredicate::*; match (*self, *other) { (Trait(_), Trait(_)) => Ordering::Equal, @@ -611,7 +611,7 @@ impl<'a, 'gcx, 'tcx> ExistentialPredicate<'tcx> { } impl<'a, 'gcx, 'tcx> Binder> { - pub fn with_self_ty(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, self_ty: Ty<'tcx>) + pub fn with_self_ty(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, self_ty: Ty<'tcx>) -> ty::Predicate<'tcx> { use crate::ty::ToPredicate; match *self.skip_binder() { @@ -744,7 +744,7 @@ impl<'tcx> TraitRef<'tcx> { /// Returns a `TraitRef` of the form `P0: Foo` where `Pi` /// are the parameters defined on trait. - pub fn identity<'a, 'gcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, def_id: DefId) -> TraitRef<'tcx> { + pub fn identity<'a, 'gcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, def_id: DefId) -> TraitRef<'tcx> { TraitRef { def_id, substs: InternalSubsts::identity_for_item(tcx, def_id), @@ -764,7 +764,7 @@ impl<'tcx> TraitRef<'tcx> { self.substs.types() } - pub fn from_method(tcx: TyCtxt<'_, '_, 'tcx>, + pub fn from_method(tcx: TyCtxt<'tcx, '_, 'tcx>, trait_id: DefId, substs: SubstsRef<'tcx>) -> ty::TraitRef<'tcx> { @@ -817,7 +817,7 @@ impl<'a, 'gcx, 'tcx> ExistentialTraitRef<'tcx> { self.substs.types() } - pub fn erase_self_ty(tcx: TyCtxt<'a, 'gcx, 'tcx>, + pub fn erase_self_ty(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, trait_ref: ty::TraitRef<'tcx>) -> ty::ExistentialTraitRef<'tcx> { // Assert there is a Self. @@ -833,7 +833,7 @@ impl<'a, 'gcx, 'tcx> ExistentialTraitRef<'tcx> { /// we convert the principal trait-ref into a normal trait-ref, /// you must give *some* self type. A common choice is `mk_err()` /// or some placeholder type. - pub fn with_self_ty(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, self_ty: Ty<'tcx>) + pub fn with_self_ty(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, self_ty: Ty<'tcx>) -> ty::TraitRef<'tcx> { // otherwise the escaping vars would be captured by the binder // debug_assert!(!self_ty.has_escaping_bound_vars()); @@ -856,7 +856,7 @@ impl<'tcx> PolyExistentialTraitRef<'tcx> { /// we convert the principal trait-ref into a normal trait-ref, /// you must give *some* self type. A common choice is `mk_err()` /// or some placeholder type. - pub fn with_self_ty(&self, tcx: TyCtxt<'_, '_, 'tcx>, + pub fn with_self_ty(&self, tcx: TyCtxt<'tcx, '_, 'tcx>, self_ty: Ty<'tcx>) -> ty::PolyTraitRef<'tcx> { self.map_bound(|trait_ref| trait_ref.with_self_ty(tcx, self_ty)) @@ -1125,7 +1125,7 @@ impl<'a, 'gcx, 'tcx> ParamTy { ParamTy::new(def.index, def.name) } - pub fn to_ty(self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Ty<'tcx> { + pub fn to_ty(self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx> { tcx.mk_ty_param(self.index, self.name) } @@ -1153,7 +1153,7 @@ impl<'a, 'gcx, 'tcx> ParamConst { ParamConst::new(def.index, def.name) } - pub fn to_const(self, tcx: TyCtxt<'a, 'gcx, 'tcx>, ty: Ty<'tcx>) -> &'tcx Const<'tcx> { + pub fn to_const(self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, ty: Ty<'tcx>) -> &'tcx Const<'tcx> { tcx.mk_const_param(self.index, self.name, ty) } } @@ -1421,7 +1421,7 @@ impl<'a, 'tcx, 'gcx> ExistentialProjection<'tcx> { } } - pub fn with_self_ty(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, + pub fn with_self_ty(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, self_ty: Ty<'tcx>) -> ty::ProjectionPredicate<'tcx> { @@ -1439,7 +1439,7 @@ impl<'a, 'tcx, 'gcx> ExistentialProjection<'tcx> { } impl<'a, 'tcx, 'gcx> PolyExistentialProjection<'tcx> { - pub fn with_self_ty(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, self_ty: Ty<'tcx>) + pub fn with_self_ty(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, self_ty: Ty<'tcx>) -> ty::PolyProjectionPredicate<'tcx> { self.map_bound(|p| p.with_self_ty(tcx, self_ty)) } @@ -1687,7 +1687,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { /// `ty.conservative_is_privately_uninhabited` implies that any value of type `ty` /// will be `Abi::Uninhabited`. (Note that uninhabited types may have nonzero /// size, to account for partial initialisation. See #49298 for details.) - pub fn conservative_is_privately_uninhabited(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> bool { + pub fn conservative_is_privately_uninhabited(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> bool { // FIXME(varkor): we can make this less conversative by substituting concrete // type arguments. match self.sty { @@ -1799,7 +1799,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { } } - pub fn sequence_element_type(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Ty<'tcx> { + pub fn sequence_element_type(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx> { match self.sty { Array(ty, _) | Slice(ty) => ty, Str => tcx.mk_mach_uint(ast::UintTy::U8), @@ -1807,7 +1807,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { } } - pub fn simd_type(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Ty<'tcx> { + pub fn simd_type(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx> { match self.sty { Adt(def, substs) => { def.non_enum_variant().fields[0].ty(tcx, substs) @@ -2036,7 +2036,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { } } - pub fn fn_sig(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> PolyFnSig<'tcx> { + pub fn fn_sig(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> PolyFnSig<'tcx> { match self.sty { FnDef(def_id, substs) => { tcx.fn_sig(def_id).subst(tcx, substs) @@ -2084,7 +2084,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { /// If the type contains variants, returns the valid range of variant indices. /// FIXME This requires the optimized MIR in the case of generators. #[inline] - pub fn variant_range(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Option> { + pub fn variant_range(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option> { match self.sty { TyKind::Adt(adt, _) => Some(adt.variant_range()), TyKind::Generator(def_id, substs, _) => Some(substs.variant_range(def_id, tcx)), @@ -2098,7 +2098,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { #[inline] pub fn discriminant_for_variant( &self, - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, variant_index: VariantIdx ) -> Option> { match self.sty { @@ -2189,7 +2189,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { /// /// Returning true means the type is known to be sized. Returning /// `false` means nothing -- could be sized, might not be. - pub fn is_trivially_sized(&self, tcx: TyCtxt<'_, '_, 'tcx>) -> bool { + pub fn is_trivially_sized(&self, tcx: TyCtxt<'tcx, '_, 'tcx>) -> bool { match self.sty { ty::Infer(ty::IntVar(_)) | ty::Infer(ty::FloatVar(_)) | ty::Uint(_) | ty::Int(_) | ty::Bool | ty::Float(_) | @@ -2240,7 +2240,7 @@ static_assert_size!(Const<'_>, 40); impl<'tcx> Const<'tcx> { #[inline] pub fn from_scalar( - tcx: TyCtxt<'_, '_, 'tcx>, + tcx: TyCtxt<'tcx, '_, 'tcx>, val: Scalar, ty: Ty<'tcx>, ) -> &'tcx Self { @@ -2252,7 +2252,7 @@ impl<'tcx> Const<'tcx> { #[inline] pub fn from_bits( - tcx: TyCtxt<'_, '_, 'tcx>, + tcx: TyCtxt<'tcx, '_, 'tcx>, bits: u128, ty: ParamEnvAnd<'tcx, Ty<'tcx>>, ) -> &'tcx Self { @@ -2264,24 +2264,24 @@ impl<'tcx> Const<'tcx> { } #[inline] - pub fn zero_sized(tcx: TyCtxt<'_, '_, 'tcx>, ty: Ty<'tcx>) -> &'tcx Self { + pub fn zero_sized(tcx: TyCtxt<'tcx, '_, 'tcx>, ty: Ty<'tcx>) -> &'tcx Self { Self::from_scalar(tcx, Scalar::zst(), ty) } #[inline] - pub fn from_bool(tcx: TyCtxt<'_, '_, 'tcx>, v: bool) -> &'tcx Self { + pub fn from_bool(tcx: TyCtxt<'tcx, '_, 'tcx>, v: bool) -> &'tcx Self { Self::from_bits(tcx, v as u128, ParamEnv::empty().and(tcx.types.bool)) } #[inline] - pub fn from_usize(tcx: TyCtxt<'_, '_, 'tcx>, n: u64) -> &'tcx Self { + pub fn from_usize(tcx: TyCtxt<'tcx, '_, 'tcx>, n: u64) -> &'tcx Self { Self::from_bits(tcx, n as u128, ParamEnv::empty().and(tcx.types.usize)) } #[inline] pub fn to_bits( &self, - tcx: TyCtxt<'_, '_, 'tcx>, + tcx: TyCtxt<'tcx, '_, 'tcx>, ty: ParamEnvAnd<'tcx, Ty<'tcx>>, ) -> Option { if self.ty != ty.value { diff --git a/src/librustc/ty/subst.rs b/src/librustc/ty/subst.rs index 75ba1dd46ca2a..23b04cb41f9d4 100644 --- a/src/librustc/ty/subst.rs +++ b/src/librustc/ty/subst.rs @@ -138,7 +138,7 @@ impl<'tcx> Kind<'tcx> { impl<'a, 'tcx> Lift<'tcx> for Kind<'a> { type Lifted = Kind<'tcx>; - fn lift_to_tcx<'cx, 'gcx>(&self, tcx: TyCtxt<'cx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'cx, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { match self.unpack() { UnpackedKind::Lifetime(lt) => tcx.lift(<).map(|lt| lt.into()), UnpackedKind::Type(ty) => tcx.lift(&ty).map(|ty| ty.into()), @@ -184,7 +184,7 @@ pub type SubstsRef<'tcx> = &'tcx InternalSubsts<'tcx>; impl<'a, 'gcx, 'tcx> InternalSubsts<'tcx> { /// Creates a `InternalSubsts` that maps each generic parameter to itself. - pub fn identity_for_item(tcx: TyCtxt<'a, 'gcx, 'tcx>, def_id: DefId) -> SubstsRef<'tcx> { + pub fn identity_for_item(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, def_id: DefId) -> SubstsRef<'tcx> { Self::for_item(tcx, def_id, |param, _| { tcx.mk_param_from_def(param) }) @@ -195,7 +195,7 @@ impl<'a, 'gcx, 'tcx> InternalSubsts<'tcx> { /// the type parameter index. For regions, we use the `BoundRegion::BrNamed` /// variant (which has a `DefId`). pub fn bound_vars_for_item( - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, def_id: DefId ) -> SubstsRef<'tcx> { Self::for_item(tcx, def_id, |param, _| { @@ -233,7 +233,7 @@ impl<'a, 'gcx, 'tcx> InternalSubsts<'tcx> { /// The closures get to observe the `InternalSubsts` as they're /// being built, which can be used to correctly /// substitute defaults of generic parameters. - pub fn for_item(tcx: TyCtxt<'a, 'gcx, 'tcx>, + pub fn for_item(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, def_id: DefId, mut mk_kind: F) -> SubstsRef<'tcx> @@ -247,7 +247,7 @@ impl<'a, 'gcx, 'tcx> InternalSubsts<'tcx> { } pub fn extend_to(&self, - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, def_id: DefId, mut mk_kind: F) -> SubstsRef<'tcx> @@ -261,7 +261,7 @@ impl<'a, 'gcx, 'tcx> InternalSubsts<'tcx> { } fn fill_item(substs: &mut SmallVec<[Kind<'tcx>; 8]>, - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, defs: &ty::Generics, mk_kind: &mut F) where F: FnMut(&ty::GenericParamDef, &[Kind<'tcx>]) -> Kind<'tcx> @@ -372,7 +372,7 @@ impl<'a, 'gcx, 'tcx> InternalSubsts<'tcx> { /// in a different item, with `target_substs` as the base for /// the target impl/trait, with the source child-specific /// parameters (e.g., method parameters) on top of that base. - pub fn rebase_onto(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, + pub fn rebase_onto(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, source_ancestor: DefId, target_substs: SubstsRef<'tcx>) -> SubstsRef<'tcx> { @@ -380,7 +380,7 @@ impl<'a, 'gcx, 'tcx> InternalSubsts<'tcx> { tcx.mk_substs(target_substs.iter().chain(&self[defs.params.len()..]).cloned()) } - pub fn truncate_to(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, generics: &ty::Generics) + pub fn truncate_to(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, generics: &ty::Generics) -> SubstsRef<'tcx> { tcx.mk_substs(self.iter().take(generics.count()).cloned()) } @@ -414,19 +414,19 @@ impl<'tcx> serialize::UseSpecializedDecodable for SubstsRef<'tcx> {} // there is more information available (for better errors). pub trait Subst<'tcx>: Sized { - fn subst<'a, 'gcx>(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, + fn subst<'a, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, substs: &[Kind<'tcx>]) -> Self { self.subst_spanned(tcx, substs, None) } - fn subst_spanned<'a, 'gcx>(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, + fn subst_spanned<'a, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, substs: &[Kind<'tcx>], span: Option) -> Self; } impl<'tcx, T:TypeFoldable<'tcx>> Subst<'tcx> for T { - fn subst_spanned<'a, 'gcx>(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, + fn subst_spanned<'a, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, substs: &[Kind<'tcx>], span: Option) -> T @@ -445,7 +445,7 @@ impl<'tcx, T:TypeFoldable<'tcx>> Subst<'tcx> for T { // The actual substitution engine itself is a type folder. struct SubstFolder<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, substs: &'a [Kind<'tcx>], /// The location for which the substitution is performed, if available. @@ -462,7 +462,7 @@ struct SubstFolder<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { } impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for SubstFolder<'a, 'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'b, 'gcx, 'tcx> { self.tcx } + fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.tcx } fn fold_binder>(&mut self, t: &ty::Binder) -> ty::Binder { self.binders_passed += 1; diff --git a/src/librustc/ty/trait_def.rs b/src/librustc/ty/trait_def.rs index a0b409bc4004a..fc08fc46b001e 100644 --- a/src/librustc/ty/trait_def.rs +++ b/src/librustc/ty/trait_def.rs @@ -64,14 +64,14 @@ impl<'a, 'gcx, 'tcx> TraitDef { } } - pub fn ancestors(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, + pub fn ancestors(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, of_impl: DefId) -> specialization_graph::Ancestors<'gcx> { specialization_graph::ancestors(tcx, self.def_id, of_impl) } } -impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { +impl<'a, 'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { pub fn for_each_impl(self, def_id: DefId, mut f: F) { let impls = self.trait_impls_of(def_id); @@ -148,7 +148,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } // Query provider for `trait_impls_of`. -pub(super) fn trait_impls_of_provider<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +pub(super) fn trait_impls_of_provider<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, trait_id: DefId) -> &'tcx TraitImpls { let mut impls = TraitImpls::default(); diff --git a/src/librustc/ty/util.rs b/src/librustc/ty/util.rs index 9b4029f409ba4..7eb57466bbdcd 100644 --- a/src/librustc/ty/util.rs +++ b/src/librustc/ty/util.rs @@ -51,10 +51,10 @@ impl<'tcx> fmt::Display for Discr<'tcx> { impl<'tcx> Discr<'tcx> { /// Adds `1` to the value and wraps around if the maximum for the type is reached. - pub fn wrap_incr<'a, 'gcx>(self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Self { + pub fn wrap_incr<'a, 'gcx>(self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Self { self.checked_add(tcx, 1).0 } - pub fn checked_add<'a, 'gcx>(self, tcx: TyCtxt<'a, 'gcx, 'tcx>, n: u128) -> (Self, bool) { + pub fn checked_add<'a, 'gcx>(self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, n: u128) -> (Self, bool) { let (int, signed) = match self.ty.sty { Int(ity) => (Integer::from_attr(&tcx, SignedInt(ity)), true), Uint(uty) => (Integer::from_attr(&tcx, UnsignedInt(uty)), false), @@ -104,14 +104,14 @@ impl<'tcx> Discr<'tcx> { } pub trait IntTypeExt { - fn to_ty<'a, 'gcx, 'tcx>(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Ty<'tcx>; - fn disr_incr<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, val: Option>) + fn to_ty<'a, 'gcx, 'tcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx>; + fn disr_incr<'a, 'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, val: Option>) -> Option>; - fn initial_discriminant<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Discr<'tcx>; + fn initial_discriminant<'a, 'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Discr<'tcx>; } impl IntTypeExt for attr::IntType { - fn to_ty<'a, 'gcx, 'tcx>(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Ty<'tcx> { + fn to_ty<'a, 'gcx, 'tcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx> { match *self { SignedInt(ast::IntTy::I8) => tcx.types.i8, SignedInt(ast::IntTy::I16) => tcx.types.i16, @@ -128,7 +128,7 @@ impl IntTypeExt for attr::IntType { } } - fn initial_discriminant<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Discr<'tcx> { + fn initial_discriminant<'a, 'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Discr<'tcx> { Discr { val: 0, ty: self.to_ty(tcx) @@ -137,7 +137,7 @@ impl IntTypeExt for attr::IntType { fn disr_incr<'a, 'tcx>( &self, - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, val: Option>, ) -> Option> { if let Some(val) = val { @@ -179,7 +179,7 @@ pub enum Representability { impl<'tcx> ty::ParamEnv<'tcx> { pub fn can_type_implement_copy<'a>(self, - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, self_type: Ty<'tcx>) -> Result<(), CopyImplementationError<'tcx>> { // FIXME: (@jroesch) float this code up @@ -228,7 +228,7 @@ impl<'tcx> ty::ParamEnv<'tcx> { } } -impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { +impl<'a, 'tcx> TyCtxt<'tcx, 'tcx, 'tcx> { /// Creates a hash of the type `Ty` which will be the same no matter what crate /// context it's calculated within. This is used by the `type_id` intrinsic. pub fn type_id_hash(self, ty: Ty<'tcx>) -> u64 { @@ -249,7 +249,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { } } -impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { +impl<'a, 'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { pub fn has_error_field(self, ty: Ty<'tcx>) -> bool { if let ty::Adt(def, substs) = ty.sty { for field in def.all_fields() { @@ -624,7 +624,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { ) -> Result, Ty<'tcx>> { use crate::ty::fold::TypeFolder; - struct OpaqueTypeExpander<'a, 'gcx, 'tcx> { + struct OpaqueTypeExpander<'gcx, 'tcx> { // Contains the DefIds of the opaque types that are currently being // expanded. When we expand an opaque type we insert the DefId of // that type, and when we finish expanding that type we remove the @@ -632,10 +632,10 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { seen_opaque_tys: FxHashSet, primary_def_id: DefId, found_recursion: bool, - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, } - impl<'a, 'gcx, 'tcx> OpaqueTypeExpander<'a, 'gcx, 'tcx> { + impl<'gcx, 'tcx> OpaqueTypeExpander<'gcx, 'tcx> { fn expand_opaque_ty( &mut self, def_id: DefId, @@ -658,8 +658,8 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } } - impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for OpaqueTypeExpander<'a, 'gcx, 'tcx> { - fn tcx(&self) -> TyCtxt<'_, 'gcx, 'tcx> { + impl<'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for OpaqueTypeExpander<'gcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.tcx } @@ -696,7 +696,7 @@ impl<'a, 'tcx> ty::TyS<'tcx> { /// full requirements for the `Copy` trait (cc #29149) -- this /// winds up being reported as an error during NLL borrow check. pub fn is_copy_modulo_regions(&'tcx self, - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, span: Span) -> bool { @@ -710,7 +710,7 @@ impl<'a, 'tcx> ty::TyS<'tcx> { /// strange rules like `>::Bar: Sized` that /// actually carry lifetime requirements. pub fn is_sized(&'tcx self, - tcx_at: TyCtxtAt<'a, 'tcx, 'tcx>, + tcx_at: TyCtxtAt<'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>)-> bool { tcx_at.is_sized_raw(param_env.and(self)) @@ -724,7 +724,7 @@ impl<'a, 'tcx> ty::TyS<'tcx> { /// that the `Freeze` trait is not exposed to end users and is /// effectively an implementation detail. pub fn is_freeze(&'tcx self, - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, span: Span)-> bool { @@ -739,7 +739,7 @@ impl<'a, 'tcx> ty::TyS<'tcx> { /// then `needs_drop` will definitely return `true` for `ty`.) #[inline] pub fn needs_drop(&'tcx self, - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>) -> bool { tcx.needs_drop_raw(param_env.and(self)).0 @@ -761,7 +761,7 @@ impl<'a, 'tcx> ty::TyS<'tcx> { /// Check whether a type is representable. This means it cannot contain unboxed /// structural recursion. This check is needed for structs and enums. pub fn is_representable(&'tcx self, - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, sp: Span) -> Representability { @@ -779,7 +779,7 @@ impl<'a, 'tcx> ty::TyS<'tcx> { } fn are_inner_types_recursive<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, sp: Span, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, sp: Span, seen: &mut Vec>, representable_cache: &mut FxHashMap, Representability>, ty: Ty<'tcx>) @@ -839,7 +839,7 @@ impl<'a, 'tcx> ty::TyS<'tcx> { // Does the type `ty` directly (without indirection through a pointer) // contain any types on stack `seen`? fn is_type_structurally_recursive<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, sp: Span, seen: &mut Vec>, representable_cache: &mut FxHashMap, Representability>, @@ -860,7 +860,7 @@ impl<'a, 'tcx> ty::TyS<'tcx> { } fn is_type_structurally_recursive_inner<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, sp: Span, seen: &mut Vec>, representable_cache: &mut FxHashMap, Representability>, @@ -937,7 +937,7 @@ impl<'a, 'tcx> ty::TyS<'tcx> { } } -fn is_copy_raw<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn is_copy_raw<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, query: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool { @@ -953,7 +953,7 @@ fn is_copy_raw<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, )) } -fn is_sized_raw<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn is_sized_raw<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, query: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool { @@ -969,7 +969,7 @@ fn is_sized_raw<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, )) } -fn is_freeze_raw<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn is_freeze_raw<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, query: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool { @@ -988,7 +988,7 @@ fn is_freeze_raw<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, #[derive(Clone, HashStable)] pub struct NeedsDrop(pub bool); -fn needs_drop_raw<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn needs_drop_raw<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, query: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> NeedsDrop { diff --git a/src/librustc/ty/wf.rs b/src/librustc/ty/wf.rs index c474baac3d129..c6cc5030212dd 100644 --- a/src/librustc/ty/wf.rs +++ b/src/librustc/ty/wf.rs @@ -509,7 +509,7 @@ impl<'a, 'gcx, 'tcx> WfPredicates<'a, 'gcx, 'tcx> { /// `'static` would appear in the list. The hard work is done by /// `ty::required_region_bounds`, see that for more information. pub fn object_region_bounds<'a, 'gcx, 'tcx>( - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, existential_predicates: ty::Binder<&'tcx ty::List>>) -> Vec> { diff --git a/src/librustc_borrowck/borrowck/check_loans.rs b/src/librustc_borrowck/borrowck/check_loans.rs index 35e6c1c5bf5a7..ef46445952ab1 100644 --- a/src/librustc_borrowck/borrowck/check_loans.rs +++ b/src/librustc_borrowck/borrowck/check_loans.rs @@ -80,8 +80,8 @@ fn owned_ptr_base_path_rc<'tcx>(loan_path: &Rc>) -> Rc { bccx: &'a BorrowckCtxt<'a, 'tcx>, - dfcx_loans: &'a LoanDataFlow<'a, 'tcx>, - move_data: &'a move_data::FlowedMoveData<'a, 'tcx>, + dfcx_loans: &'a LoanDataFlow<'tcx>, + move_data: &'a move_data::FlowedMoveData<'tcx>, all_loans: &'a [Loan<'tcx>], movable_generator: bool, } @@ -180,8 +180,8 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for CheckLoanCtxt<'a, 'tcx> { } pub fn check_loans<'a, 'b, 'c, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, - dfcx_loans: &LoanDataFlow<'b, 'tcx>, - move_data: &move_data::FlowedMoveData<'c, 'tcx>, + dfcx_loans: &LoanDataFlow<'tcx>, + move_data: &move_data::FlowedMoveData<'tcx>, all_loans: &[Loan<'tcx>], body: &hir::Body) { debug!("check_loans(body id={})", body.value.hir_id); @@ -229,7 +229,7 @@ fn compatible_borrow_kinds(borrow_kind1: ty::BorrowKind, } impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> { - pub fn tcx(&self) -> TyCtxt<'a, 'tcx, 'tcx> { self.bccx.tcx } + pub fn tcx(&self) -> TyCtxt<'tcx, 'tcx, 'tcx> { self.bccx.tcx } pub fn each_issued_loan(&self, node: hir::ItemLocalId, mut op: F) -> bool where F: FnMut(&Loan<'tcx>) -> bool, diff --git a/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs b/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs index a15d3d10adf0e..8654c3704326e 100644 --- a/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs +++ b/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs @@ -45,7 +45,7 @@ pub enum PatternSource<'tcx> { /// /// In this latter case, this function will return `PatternSource::LetDecl` /// with a reference to the let -fn get_pattern_source<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, pat: &Pat) -> PatternSource<'tcx> { +fn get_pattern_source<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, pat: &Pat) -> PatternSource<'tcx> { let parent = tcx.hir().get_parent_node_by_hir_id(pat.hir_id); diff --git a/src/librustc_borrowck/borrowck/gather_loans/mod.rs b/src/librustc_borrowck/borrowck/gather_loans/mod.rs index e437c08c956ec..08b8894ac89e4 100644 --- a/src/librustc_borrowck/borrowck/gather_loans/mod.rs +++ b/src/librustc_borrowck/borrowck/gather_loans/mod.rs @@ -251,7 +251,7 @@ fn check_mutability<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, } impl<'a, 'tcx> GatherLoanCtxt<'a, 'tcx> { - pub fn tcx(&self) -> TyCtxt<'a, 'tcx, 'tcx> { self.bccx.tcx } + pub fn tcx(&self) -> TyCtxt<'tcx, 'tcx, 'tcx> { self.bccx.tcx } /// Guarantees that `cmt` is assignable, or reports an error. fn guarantee_assignment_valid(&mut self, diff --git a/src/librustc_borrowck/borrowck/mod.rs b/src/librustc_borrowck/borrowck/mod.rs index 669fb9103aaaa..623217f37adf6 100644 --- a/src/librustc_borrowck/borrowck/mod.rs +++ b/src/librustc_borrowck/borrowck/mod.rs @@ -51,9 +51,9 @@ pub mod move_data; #[derive(Clone, Copy)] pub struct LoanDataFlowOperator; -pub type LoanDataFlow<'a, 'tcx> = DataFlowContext<'a, 'tcx, LoanDataFlowOperator>; +pub type LoanDataFlow<'tcx> = DataFlowContext<'tcx, LoanDataFlowOperator>; -pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { +pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { tcx.par_body_owners(|body_owner_def_id| { tcx.ensure().borrowck(body_owner_def_id); }); @@ -67,13 +67,13 @@ pub fn provide(providers: &mut Providers<'_>) { } /// Collection of conclusions determined via borrow checker analyses. -pub struct AnalysisData<'a, 'tcx: 'a> { +pub struct AnalysisData<'tcx> { pub all_loans: Vec>, - pub loans: DataFlowContext<'a, 'tcx, LoanDataFlowOperator>, - pub move_data: move_data::FlowedMoveData<'a, 'tcx>, + pub loans: DataFlowContext<'tcx, LoanDataFlowOperator>, + pub move_data: move_data::FlowedMoveData<'tcx>, } -fn borrowck<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, owner_def_id: DefId) +fn borrowck<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, owner_def_id: DefId) -> &'tcx BorrowCheckResult { assert!(tcx.use_ast_borrowck() || tcx.migrate_borrowck()); @@ -145,7 +145,7 @@ fn build_borrowck_dataflow_data<'a, 'c, 'tcx, F>(this: &mut BorrowckCtxt<'a, 'tc force_analysis: bool, body_id: hir::BodyId, get_cfg: F) - -> Option> + -> Option> where F: FnOnce(&mut BorrowckCtxt<'a, 'tcx>) -> &'c cfg::CFG { // Check the body of fn items. @@ -193,10 +193,10 @@ fn build_borrowck_dataflow_data<'a, 'c, 'tcx, F>(this: &mut BorrowckCtxt<'a, 'tc /// Accessor for introspective clients inspecting `AnalysisData` and /// the `BorrowckCtxt` itself , e.g., the flowgraph visualizer. pub fn build_borrowck_dataflow_data_for_fn<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, body_id: hir::BodyId, cfg: &cfg::CFG) - -> (BorrowckCtxt<'a, 'tcx>, AnalysisData<'a, 'tcx>) + -> (BorrowckCtxt<'a, 'tcx>, AnalysisData<'tcx>) { let owner_id = tcx.hir().body_owner(body_id); let owner_def_id = tcx.hir().local_def_id(owner_id); @@ -220,8 +220,8 @@ pub fn build_borrowck_dataflow_data_for_fn<'a, 'tcx>( // ---------------------------------------------------------------------- // Type definitions -pub struct BorrowckCtxt<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, +pub struct BorrowckCtxt<'a, 'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, // tables for the current thing we are checking; set to // Some in `borrowck_fn` and cleared later @@ -239,13 +239,13 @@ pub struct BorrowckCtxt<'a, 'tcx: 'a> { } -impl<'a, 'tcx: 'a> BorrowckCtxt<'a, 'tcx> { +impl BorrowckCtxt<'_, 'tcx> { fn signal_error(&self) { self.signalled_any_error.set(SignalledError::SawSomeError); } } -impl<'a, 'b, 'tcx: 'b> BorrowckErrors<'a> for &'a BorrowckCtxt<'b, 'tcx> { +impl BorrowckErrors<'a> for &'a BorrowckCtxt<'_, 'tcx> { fn struct_span_err_with_code>(self, sp: S, msg: &str, @@ -406,8 +406,8 @@ fn closure_to_block(closure_id: LocalDefId, } } -impl<'a, 'tcx> LoanPath<'tcx> { - pub fn kill_scope(&self, bccx: &BorrowckCtxt<'a, 'tcx>) -> region::Scope { +impl LoanPath<'tcx> { + pub fn kill_scope(&self, bccx: &BorrowckCtxt<'_, 'tcx>) -> region::Scope { match self.kind { LpVar(hir_id) => { bccx.region_scope_tree.var_scope(hir_id.local_id) @@ -577,7 +577,7 @@ pub enum MovedValueUseKind { /////////////////////////////////////////////////////////////////////////// // Misc -impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> { +impl BorrowckCtxt<'_, 'tcx> { pub fn is_subregion_of(&self, r_sub: ty::Region<'tcx>, r_sup: ty::Region<'tcx>) diff --git a/src/librustc_borrowck/borrowck/move_data.rs b/src/librustc_borrowck/borrowck/move_data.rs index 325d3559f0ab6..2dbc02253992c 100644 --- a/src/librustc_borrowck/borrowck/move_data.rs +++ b/src/librustc_borrowck/borrowck/move_data.rs @@ -39,15 +39,15 @@ pub struct MoveData<'tcx> { pub path_assignments: RefCell>, } -pub struct FlowedMoveData<'a, 'tcx: 'a> { +pub struct FlowedMoveData<'tcx> { pub move_data: MoveData<'tcx>, - pub dfcx_moves: MoveDataFlow<'a, 'tcx>, + pub dfcx_moves: MoveDataFlow<'tcx>, // We could (and maybe should, for efficiency) combine both move // and assign data flow into one, but this way it's easier to // distinguish the bits that correspond to moves and assignments. - pub dfcx_assign: AssignDataFlow<'a, 'tcx> + pub dfcx_assign: AssignDataFlow<'tcx> } /// Index into `MoveData.paths`, used like a pointer @@ -139,12 +139,12 @@ pub struct Assignment { #[derive(Clone, Copy)] pub struct MoveDataFlowOperator; -pub type MoveDataFlow<'a, 'tcx> = DataFlowContext<'a, 'tcx, MoveDataFlowOperator>; +pub type MoveDataFlow<'tcx> = DataFlowContext<'tcx, MoveDataFlowOperator>; #[derive(Clone, Copy)] pub struct AssignDataFlowOperator; -pub type AssignDataFlow<'a, 'tcx> = DataFlowContext<'a, 'tcx, AssignDataFlowOperator>; +pub type AssignDataFlow<'tcx> = DataFlowContext<'tcx, AssignDataFlowOperator>; fn loan_path_is_precise(loan_path: &LoanPath<'_>) -> bool { match loan_path.kind { @@ -167,7 +167,7 @@ fn loan_path_is_precise(loan_path: &LoanPath<'_>) -> bool { } } -impl<'a, 'tcx> MoveData<'tcx> { +impl MoveData<'tcx> { /// Returns `true` if there are no trackable assignments or moves /// in this move data -- that means that there is nothing that /// could cause a borrow error. @@ -223,7 +223,7 @@ impl<'a, 'tcx> MoveData<'tcx> { /// Returns the existing move path index for `lp`, if any, and otherwise adds a new index for /// `lp` and any of its base paths that do not yet have an index. - pub fn move_path(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, + pub fn move_path(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, lp: Rc>) -> MovePathIndex { if let Some(&index) = self.path_map.borrow().get(&lp) { return index; @@ -311,7 +311,7 @@ impl<'a, 'tcx> MoveData<'tcx> { } /// Adds a new move entry for a move of `lp` that occurs at location `id` with kind `kind`. - pub fn add_move(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, + pub fn add_move(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, orig_lp: Rc>, id: hir::ItemLocalId, kind: MoveKind) { @@ -340,7 +340,7 @@ impl<'a, 'tcx> MoveData<'tcx> { self.add_move_helper(tcx, orig_lp, id, kind); } - fn add_move_helper(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, + fn add_move_helper(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, lp: Rc>, id: hir::ItemLocalId, kind: MoveKind) { @@ -365,7 +365,7 @@ impl<'a, 'tcx> MoveData<'tcx> { /// Adds a new record for an assignment to `lp` that occurs at location `id` with the given /// `span`. - pub fn add_assignment(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, + pub fn add_assignment(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, lp: Rc>, assign_id: hir::ItemLocalId, span: Span) { @@ -395,7 +395,7 @@ impl<'a, 'tcx> MoveData<'tcx> { self.add_assignment_helper(tcx, lp, assign_id, span); } - fn add_assignment_helper(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, + fn add_assignment_helper(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, lp: Rc>, assign_id: hir::ItemLocalId, span: Span) { @@ -428,9 +428,9 @@ impl<'a, 'tcx> MoveData<'tcx> { /// scoping. Assignments are generated by assignment to variables and /// killed by scoping. See `README.md` for more details. fn add_gen_kills(&self, - bccx: &BorrowckCtxt<'a, 'tcx>, - dfcx_moves: &mut MoveDataFlow<'_, '_>, - dfcx_assign: &mut AssignDataFlow<'_, '_>) { + bccx: &BorrowckCtxt<'_, 'tcx>, + dfcx_moves: &mut MoveDataFlow<'_>, + dfcx_assign: &mut AssignDataFlow<'_>) { for (i, the_move) in self.moves.borrow().iter().enumerate() { dfcx_moves.add_gen(the_move.id, i); } @@ -538,7 +538,7 @@ impl<'a, 'tcx> MoveData<'tcx> { path: MovePathIndex, kill_id: hir::ItemLocalId, kill_kind: KillFrom, - dfcx_moves: &mut MoveDataFlow<'_, '_>) { + dfcx_moves: &mut MoveDataFlow<'_>) { // We can only perform kills for paths that refer to a unique location, // since otherwise we may kill a move from one location with an // assignment referring to another location. @@ -555,12 +555,12 @@ impl<'a, 'tcx> MoveData<'tcx> { } } -impl<'a, 'tcx> FlowedMoveData<'a, 'tcx> { +impl<'tcx> FlowedMoveData<'tcx> { pub fn new(move_data: MoveData<'tcx>, - bccx: &BorrowckCtxt<'a, 'tcx>, + bccx: &BorrowckCtxt<'_, 'tcx>, cfg: &cfg::CFG, body: &hir::Body) - -> FlowedMoveData<'a, 'tcx> { + -> FlowedMoveData<'tcx> { let tcx = bccx.tcx; let mut dfcx_moves = diff --git a/src/librustc_borrowck/dataflow.rs b/src/librustc_borrowck/dataflow.rs index af10404cba395..ba91676ec648c 100644 --- a/src/librustc_borrowck/dataflow.rs +++ b/src/librustc_borrowck/dataflow.rs @@ -26,8 +26,8 @@ pub enum EntryOrExit { } #[derive(Clone)] -pub struct DataFlowContext<'a, 'tcx: 'a, O> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, +pub struct DataFlowContext<'tcx, O> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, /// a name for the analysis using this dataflow instance analysis_name: &'static str, @@ -80,8 +80,8 @@ pub trait DataFlowOperator : BitwiseOperator { fn initial_value(&self) -> bool; } -struct PropagationContext<'a, 'b: 'a, 'tcx: 'b, O> { - dfcx: &'a mut DataFlowContext<'b, 'tcx, O>, +struct PropagationContext<'a, 'tcx, O> { + dfcx: &'a mut DataFlowContext<'tcx, O>, changed: bool } @@ -91,14 +91,14 @@ fn get_cfg_indices<'a>(id: hir::ItemLocalId, index.get(&id).map_or(&[], |v| &v[..]) } -impl<'a, 'tcx, O: DataFlowOperator> DataFlowContext<'a, 'tcx, O> { +impl<'a, 'tcx, O: DataFlowOperator> DataFlowContext<'tcx, O> { fn has_bitset_for_local_id(&self, n: hir::ItemLocalId) -> bool { assert!(n != hir::DUMMY_ITEM_LOCAL_ID); self.local_id_to_index.contains_key(&n) } } -impl<'a, 'tcx, O:DataFlowOperator> pprust::PpAnn for DataFlowContext<'a, 'tcx, O> { +impl<'a, 'tcx, O:DataFlowOperator> pprust::PpAnn for DataFlowContext<'tcx, O> { fn nested(&self, state: &mut pprust::State<'_>, nested: pprust::Nested) -> io::Result<()> { pprust::PpAnn::nested(self.tcx.hir(), state, nested) } @@ -224,13 +224,13 @@ pub enum KillFrom { Execution, } -impl<'a, 'tcx, O: DataFlowOperator> DataFlowContext<'a, 'tcx, O> { - pub fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>, +impl<'a, 'tcx, O: DataFlowOperator> DataFlowContext<'tcx, O> { + pub fn new(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, analysis_name: &'static str, body: Option<&hir::Body>, cfg: &cfg::CFG, oper: O, - bits_per_id: usize) -> DataFlowContext<'a, 'tcx, O> { + bits_per_id: usize) -> DataFlowContext<'tcx, O> { let usize_bits = mem::size_of::() * 8; let words_per_id = (bits_per_id + usize_bits - 1) / usize_bits; let num_nodes = cfg.graph.all_nodes().len(); @@ -500,7 +500,7 @@ impl<'a, 'tcx, O: DataFlowOperator> DataFlowContext<'a, 'tcx, O> { } // N.B. `Clone + 'static` only needed for pretty printing. -impl<'a, 'tcx, O: DataFlowOperator + Clone + 'static> DataFlowContext<'a, 'tcx, O> { +impl<'a, 'tcx, O: DataFlowOperator + Clone + 'static> DataFlowContext<'tcx, O> { pub fn propagate(&mut self, cfg: &cfg::CFG, body: &hir::Body) { //! Performs the data flow analysis. @@ -537,7 +537,7 @@ impl<'a, 'tcx, O: DataFlowOperator + Clone + 'static> DataFlowContext<'a, 'tcx, } } -impl<'a, 'b, 'tcx, O: DataFlowOperator> PropagationContext<'a, 'b, 'tcx, O> { +impl PropagationContext<'_, 'tcx, O> { fn walk_cfg(&mut self, cfg: &cfg::CFG, nodes_po: &[CFGIndex], diff --git a/src/librustc_borrowck/graphviz.rs b/src/librustc_borrowck/graphviz.rs index 77056d4d3eb15..69c0aa0c6f766 100644 --- a/src/librustc_borrowck/graphviz.rs +++ b/src/librustc_borrowck/graphviz.rs @@ -34,7 +34,7 @@ pub struct DataflowLabeller<'a, 'tcx: 'a> { pub inner: cfg_dot::LabelledCFG<'a, 'tcx>, pub variants: Vec, pub borrowck_ctxt: &'a BorrowckCtxt<'a, 'tcx>, - pub analysis_data: &'a borrowck::AnalysisData<'a, 'tcx>, + pub analysis_data: &'a borrowck::AnalysisData<'tcx>, } impl<'a, 'tcx> DataflowLabeller<'a, 'tcx> { @@ -64,7 +64,7 @@ impl<'a, 'tcx> DataflowLabeller<'a, 'tcx> { fn build_set(&self, e: EntryOrExit, cfgidx: CFGIndex, - dfcx: &DataFlowContext<'a, 'tcx, O>, + dfcx: &DataFlowContext<'tcx, O>, mut to_lp: F) -> String where F: FnMut(usize) -> Rc>, { diff --git a/src/librustc_borrowck/lib.rs b/src/librustc_borrowck/lib.rs index 5d8b0cd14dd27..98e629ce046bb 100644 --- a/src/librustc_borrowck/lib.rs +++ b/src/librustc_borrowck/lib.rs @@ -5,6 +5,7 @@ #![deny(internal)] #![deny(unused_lifetimes)] +#![feature(in_band_lifetimes)] #![feature(nll)] #![recursion_limit="256"] diff --git a/src/librustc_codegen_llvm/base.rs b/src/librustc_codegen_llvm/base.rs index 62374eb21039a..fd8ef55c77f3c 100644 --- a/src/librustc_codegen_llvm/base.rs +++ b/src/librustc_codegen_llvm/base.rs @@ -42,7 +42,7 @@ use rustc::hir::CodegenFnAttrs; use crate::value::Value; pub fn write_compressed_metadata<'a, 'gcx>( - tcx: TyCtxt<'a, 'gcx, 'gcx>, + tcx: TyCtxt<'gcx, 'gcx, 'gcx>, metadata: &EncodedMetadata, llvm_module: &mut ModuleLlvm ) { @@ -103,7 +103,7 @@ pub fn iter_globals(llmod: &'ll llvm::Module) -> ValueIter<'ll> { } } -pub fn compile_codegen_unit(tcx: TyCtxt<'a, 'tcx, 'tcx>, cgu_name: InternedString) { +pub fn compile_codegen_unit(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, cgu_name: InternedString) { let start_time = Instant::now(); let dep_node = tcx.codegen_unit(cgu_name).codegen_dep_node(tcx); @@ -124,7 +124,7 @@ pub fn compile_codegen_unit(tcx: TyCtxt<'a, 'tcx, 'tcx>, cgu_name: InternedStrin submit_codegened_module_to_llvm(&LlvmCodegenBackend(()), tcx, module, cost); fn module_codegen<'ll, 'tcx>( - tcx: TyCtxt<'ll, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, cgu_name: InternedString, ) -> ModuleCodegen { let cgu = tcx.codegen_unit(cgu_name); diff --git a/src/librustc_codegen_llvm/builder.rs b/src/librustc_codegen_llvm/builder.rs index 982156321aa15..af28f43a74f26 100644 --- a/src/librustc_codegen_llvm/builder.rs +++ b/src/librustc_codegen_llvm/builder.rs @@ -66,7 +66,7 @@ impl ty::layout::HasDataLayout for Builder<'_, '_, '_> { } impl ty::layout::HasTyCtxt<'tcx> for Builder<'_, '_, 'tcx> { - fn tcx<'a>(&'a self) -> TyCtxt<'a, 'tcx, 'tcx> { + fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx, 'tcx> { self.cx.tcx } } diff --git a/src/librustc_codegen_llvm/context.rs b/src/librustc_codegen_llvm/context.rs index 2bc46334555ec..ca91814c45bf8 100644 --- a/src/librustc_codegen_llvm/context.rs +++ b/src/librustc_codegen_llvm/context.rs @@ -35,7 +35,7 @@ use crate::abi::Abi; /// `llvm::Context` so that several compilation units may be optimized in parallel. /// All other LLVM data structures in the `CodegenCx` are tied to that `llvm::Context`. pub struct CodegenCx<'ll, 'tcx: 'll> { - pub tcx: TyCtxt<'ll, 'tcx, 'tcx>, + pub tcx: TyCtxt<'tcx, 'tcx, 'tcx>, pub check_overflow: bool, pub use_dll_storage_attrs: bool, pub tls_model: llvm::ThreadLocalMode, @@ -207,7 +207,7 @@ pub unsafe fn create_module( } impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> { - crate fn new(tcx: TyCtxt<'ll, 'tcx, 'tcx>, + crate fn new(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, codegen_unit: Arc>, llvm_module: &'ll crate::ModuleLlvm) -> Self { @@ -838,7 +838,7 @@ impl HasTargetSpec for CodegenCx<'ll, 'tcx> { } impl ty::layout::HasTyCtxt<'tcx> for CodegenCx<'ll, 'tcx> { - fn tcx<'a>(&'a self) -> TyCtxt<'a, 'tcx, 'tcx> { + fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx, 'tcx> { self.tcx } } diff --git a/src/librustc_codegen_llvm/lib.rs b/src/librustc_codegen_llvm/lib.rs index 8391f02fc69ec..89c24c624a249 100644 --- a/src/librustc_codegen_llvm/lib.rs +++ b/src/librustc_codegen_llvm/lib.rs @@ -109,7 +109,7 @@ impl ExtraBackendMethods for LlvmCodegenBackend { fn write_compressed_metadata<'b, 'gcx>( &self, - tcx: TyCtxt<'b, 'gcx, 'gcx>, + tcx: TyCtxt<'gcx, 'gcx, 'gcx>, metadata: &EncodedMetadata, llvm_module: &mut ModuleLlvm ) { @@ -117,7 +117,7 @@ impl ExtraBackendMethods for LlvmCodegenBackend { } fn codegen_allocator<'b, 'gcx>( &self, - tcx: TyCtxt<'b, 'gcx, 'gcx>, + tcx: TyCtxt<'gcx, 'gcx, 'gcx>, mods: &mut ModuleLlvm, kind: AllocatorKind ) { @@ -125,7 +125,7 @@ impl ExtraBackendMethods for LlvmCodegenBackend { } fn compile_codegen_unit<'a, 'tcx: 'a>( &self, - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, cgu_name: InternedString, ) { base::compile_codegen_unit(tcx, cgu_name); @@ -286,7 +286,7 @@ impl CodegenBackend for LlvmCodegenBackend { fn codegen_crate<'b, 'tcx>( &self, - tcx: TyCtxt<'b, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, metadata: EncodedMetadata, need_metadata_module: bool, rx: mpsc::Receiver> diff --git a/src/librustc_codegen_ssa/back/symbol_export.rs b/src/librustc_codegen_ssa/back/symbol_export.rs index fb7ef87646296..845adf0a268b1 100644 --- a/src/librustc_codegen_ssa/back/symbol_export.rs +++ b/src/librustc_codegen_ssa/back/symbol_export.rs @@ -46,7 +46,7 @@ pub fn crates_export_threshold(crate_types: &[config::CrateType]) -> SymbolExpor } } -fn reachable_non_generics_provider<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn reachable_non_generics_provider<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, cnum: CrateNum) -> &'tcx DefIdMap { @@ -157,7 +157,7 @@ fn reachable_non_generics_provider<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, tcx.arena.alloc(reachable_non_generics) } -fn is_reachable_non_generic_provider_local<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn is_reachable_non_generic_provider_local<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> bool { let export_threshold = threshold(tcx); @@ -169,13 +169,13 @@ fn is_reachable_non_generic_provider_local<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx> } } -fn is_reachable_non_generic_provider_extern<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn is_reachable_non_generic_provider_extern<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> bool { tcx.reachable_non_generics(def_id.krate).contains_key(&def_id) } -fn exported_symbols_provider_local<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn exported_symbols_provider_local<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, cnum: CrateNum) -> Arc, SymbolExportLevel)>> @@ -279,7 +279,7 @@ fn exported_symbols_provider_local<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } fn upstream_monomorphizations_provider<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, cnum: CrateNum) -> &'tcx DefIdMap, CrateNum>> { @@ -329,7 +329,7 @@ fn upstream_monomorphizations_provider<'a, 'tcx>( } fn upstream_monomorphizations_for_provider<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> Option<&'tcx FxHashMap, CrateNum>> { diff --git a/src/librustc_codegen_ssa/base.rs b/src/librustc_codegen_ssa/base.rs index 0cd29e0213ee7..4eff29f502257 100644 --- a/src/librustc_codegen_ssa/base.rs +++ b/src/librustc_codegen_ssa/base.rs @@ -480,7 +480,7 @@ pub const CODEGEN_WORKER_ID: usize = ::std::usize::MAX; pub fn codegen_crate( backend: B, - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, metadata: EncodedMetadata, need_metadata_module: bool, rx: mpsc::Receiver> @@ -703,7 +703,7 @@ impl Drop for AbortCodegenOnDrop { } } -fn assert_and_save_dep_graph<'ll, 'tcx>(tcx: TyCtxt<'ll, 'tcx, 'tcx>) { +fn assert_and_save_dep_graph<'ll, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { time(tcx.sess, "assert dep graph", || ::rustc_incremental::assert_dep_graph(tcx)); @@ -850,7 +850,7 @@ pub fn provide_both(providers: &mut Providers<'_>) { }; } -fn determine_cgu_reuse<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn determine_cgu_reuse<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, cgu: &CodegenUnit<'tcx>) -> CguReuse { if !tcx.dep_graph.is_fully_enabled() { diff --git a/src/librustc_codegen_ssa/debuginfo/type_names.rs b/src/librustc_codegen_ssa/debuginfo/type_names.rs index 39aea4b9828fe..df7c33fb2dee0 100644 --- a/src/librustc_codegen_ssa/debuginfo/type_names.rs +++ b/src/librustc_codegen_ssa/debuginfo/type_names.rs @@ -8,7 +8,7 @@ use rustc_data_structures::fx::FxHashSet; // any caching, i.e., calling the function twice with the same type will also do // the work twice. The `qualified` parameter only affects the first level of the // type name, further levels (i.e., type parameters) are always fully qualified. -pub fn compute_debuginfo_type_name<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +pub fn compute_debuginfo_type_name<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, t: Ty<'tcx>, qualified: bool) -> String { @@ -20,7 +20,7 @@ pub fn compute_debuginfo_type_name<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // Pushes the name of the type as it should be stored in debuginfo on the // `output` String. See also compute_debuginfo_type_name(). -pub fn push_debuginfo_type_name<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +pub fn push_debuginfo_type_name<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, t: Ty<'tcx>, qualified: bool, output: &mut String, @@ -208,7 +208,7 @@ pub fn push_debuginfo_type_name<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } } - fn push_item_name(tcx: TyCtxt<'a, 'tcx, 'tcx>, + fn push_item_name(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, qualified: bool, output: &mut String) { @@ -228,7 +228,7 @@ pub fn push_debuginfo_type_name<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // reconstructed for items from non-local crates. For local crates, this // would be possible but with inlining and LTO we have to use the least // common denominator - otherwise we would run into conflicts. - fn push_type_params<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, + fn push_type_params<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, substs: SubstsRef<'tcx>, output: &mut String, visited: &mut FxHashSet>) { diff --git a/src/librustc_codegen_ssa/traits/backend.rs b/src/librustc_codegen_ssa/traits/backend.rs index 0466b47cf148f..64a4c922500ec 100644 --- a/src/librustc_codegen_ssa/traits/backend.rs +++ b/src/librustc_codegen_ssa/traits/backend.rs @@ -34,19 +34,19 @@ pub trait ExtraBackendMethods: CodegenBackend + WriteBackendMethods + Sized + Se fn new_metadata(&self, sess: TyCtxt<'_, '_, '_>, mod_name: &str) -> Self::Module; fn write_compressed_metadata<'b, 'gcx>( &self, - tcx: TyCtxt<'b, 'gcx, 'gcx>, + tcx: TyCtxt<'gcx, 'gcx, 'gcx>, metadata: &EncodedMetadata, llvm_module: &mut Self::Module, ); fn codegen_allocator<'b, 'gcx>( &self, - tcx: TyCtxt<'b, 'gcx, 'gcx>, + tcx: TyCtxt<'gcx, 'gcx, 'gcx>, mods: &mut Self::Module, kind: AllocatorKind ); fn compile_codegen_unit<'a, 'tcx: 'a>( &self, - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, cgu_name: InternedString, ); // If find_features is true this won't access `sess.crate_types` by assuming diff --git a/src/librustc_codegen_utils/codegen_backend.rs b/src/librustc_codegen_utils/codegen_backend.rs index 191c6605b43ff..472b88b5b6686 100644 --- a/src/librustc_codegen_utils/codegen_backend.rs +++ b/src/librustc_codegen_utils/codegen_backend.rs @@ -36,7 +36,7 @@ pub trait CodegenBackend { fn provide_extern(&self, _providers: &mut Providers<'_>); fn codegen_crate<'a, 'tcx>( &self, - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, metadata: EncodedMetadata, need_metadata_module: bool, rx: mpsc::Receiver> diff --git a/src/librustc_codegen_utils/symbol_names.rs b/src/librustc_codegen_utils/symbol_names.rs index 47dc4e5b2cafe..4df96a95e53a1 100644 --- a/src/librustc_codegen_utils/symbol_names.rs +++ b/src/librustc_codegen_utils/symbol_names.rs @@ -112,7 +112,7 @@ pub fn provide(providers: &mut Providers<'_>) { }; } -fn symbol_name(tcx: TyCtxt<'_, 'tcx, 'tcx>, instance: Instance<'tcx>) -> InternedString { +fn symbol_name(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, instance: Instance<'tcx>) -> InternedString { let def_id = instance.def_id(); let substs = instance.substs; diff --git a/src/librustc_codegen_utils/symbol_names/legacy.rs b/src/librustc_codegen_utils/symbol_names/legacy.rs index b6ece06fa6c5d..c7729f28beb60 100644 --- a/src/librustc_codegen_utils/symbol_names/legacy.rs +++ b/src/librustc_codegen_utils/symbol_names/legacy.rs @@ -14,7 +14,7 @@ use std::fmt::{self, Write}; use std::mem::{self, discriminant}; pub(super) fn mangle( - tcx: TyCtxt<'_, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, instance: Instance<'tcx>, instantiating_crate: Option, ) -> String { @@ -69,7 +69,7 @@ pub(super) fn mangle( } fn get_symbol_hash<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, // instance this name will be for instance: Instance<'tcx>, @@ -179,8 +179,8 @@ impl SymbolPath { } } -struct SymbolPrinter<'a, 'tcx> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, +struct SymbolPrinter<'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, path: SymbolPath, // When `true`, `finalize_pending_component` isn't used. @@ -194,7 +194,7 @@ struct SymbolPrinter<'a, 'tcx> { // `PrettyPrinter` aka pretty printing of e.g. types in paths, // symbol names should have their own printing machinery. -impl Printer<'tcx, 'tcx> for SymbolPrinter<'_, 'tcx> { +impl Printer<'tcx, 'tcx> for SymbolPrinter<'tcx> { type Error = fmt::Error; type Path = Self; @@ -203,7 +203,7 @@ impl Printer<'tcx, 'tcx> for SymbolPrinter<'_, 'tcx> { type DynExistential = Self; type Const = Self; - fn tcx(&'a self) -> TyCtxt<'a, 'tcx, 'tcx> { + fn tcx(&'a self) -> TyCtxt<'tcx, 'tcx, 'tcx> { self.tcx } @@ -360,7 +360,7 @@ impl Printer<'tcx, 'tcx> for SymbolPrinter<'_, 'tcx> { } } -impl PrettyPrinter<'tcx, 'tcx> for SymbolPrinter<'_, 'tcx> { +impl PrettyPrinter<'tcx, 'tcx> for SymbolPrinter<'tcx> { fn region_should_not_be_omitted( &self, _region: ty::Region<'_>, @@ -400,7 +400,7 @@ impl PrettyPrinter<'tcx, 'tcx> for SymbolPrinter<'_, 'tcx> { } } -impl fmt::Write for SymbolPrinter<'_, '_> { +impl fmt::Write for SymbolPrinter<'_> { fn write_str(&mut self, s: &str) -> fmt::Result { // Name sanitation. LLVM will happily accept identifiers with weird names, but // gas doesn't! diff --git a/src/librustc_codegen_utils/symbol_names/v0.rs b/src/librustc_codegen_utils/symbol_names/v0.rs index d83d7e5244e65..e3b12fb7f415c 100644 --- a/src/librustc_codegen_utils/symbol_names/v0.rs +++ b/src/librustc_codegen_utils/symbol_names/v0.rs @@ -13,7 +13,7 @@ use std::fmt::Write; use std::ops::Range; pub(super) fn mangle( - tcx: TyCtxt<'_, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, instance: Instance<'tcx>, instantiating_crate: Option, ) -> String { @@ -75,14 +75,14 @@ struct BinderLevel { lifetime_depths: Range, } -struct SymbolMangler<'a, 'tcx> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, +struct SymbolMangler<'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, compress: Option>>, binders: Vec, out: String, } -impl SymbolMangler<'_, 'tcx> { +impl SymbolMangler<'tcx> { fn push(&mut self, s: &str) { self.out.push_str(s); } @@ -214,7 +214,7 @@ impl SymbolMangler<'_, 'tcx> { } } -impl Printer<'tcx, 'tcx> for SymbolMangler<'_, 'tcx> { +impl Printer<'tcx, 'tcx> for SymbolMangler<'tcx> { type Error = !; type Path = Self; @@ -223,7 +223,7 @@ impl Printer<'tcx, 'tcx> for SymbolMangler<'_, 'tcx> { type DynExistential = Self; type Const = Self; - fn tcx<'a>(&'a self) -> TyCtxt<'a, 'tcx, 'tcx> { + fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx, 'tcx> { self.tcx } diff --git a/src/librustc_codegen_utils/symbol_names_test.rs b/src/librustc_codegen_utils/symbol_names_test.rs index 9f7e483395244..b2d77e21200c0 100644 --- a/src/librustc_codegen_utils/symbol_names_test.rs +++ b/src/librustc_codegen_utils/symbol_names_test.rs @@ -11,7 +11,7 @@ use syntax::symbol::{Symbol, sym}; const SYMBOL_NAME: Symbol = sym::rustc_symbol_name; const DEF_PATH: Symbol = sym::rustc_def_path; -pub fn report_symbol_names<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { +pub fn report_symbol_names<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { // if the `rustc_attrs` feature is not enabled, then the // attributes we are interested in cannot be present anyway, so // skip the walk. @@ -25,11 +25,11 @@ pub fn report_symbol_names<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { }) } -struct SymbolNamesTest<'a, 'tcx:'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, +struct SymbolNamesTest<'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } -impl<'a, 'tcx> SymbolNamesTest<'a, 'tcx> { +impl SymbolNamesTest<'tcx> { fn process_attrs(&mut self, hir_id: hir::HirId) { let tcx = self.tcx; @@ -56,7 +56,7 @@ impl<'a, 'tcx> SymbolNamesTest<'a, 'tcx> { } } -impl<'a, 'tcx> hir::itemlikevisit::ItemLikeVisitor<'tcx> for SymbolNamesTest<'a, 'tcx> { +impl hir::itemlikevisit::ItemLikeVisitor<'tcx> for SymbolNamesTest<'tcx> { fn visit_item(&mut self, item: &'tcx hir::Item) { self.process_attrs(item.hir_id); } diff --git a/src/librustc_driver/pretty.rs b/src/librustc_driver/pretty.rs index 812321ff5e6c3..e185fa36fb4cb 100644 --- a/src/librustc_driver/pretty.rs +++ b/src/librustc_driver/pretty.rs @@ -456,7 +456,7 @@ impl<'a> pprust::PpAnn for HygieneAnnotation<'a> { struct TypedAnnotation<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, tables: Cell<&'a ty::TypeckTables<'tcx>>, } @@ -618,7 +618,7 @@ impl UserIdentifiedItem { } fn print_flowgraph<'a, 'tcx, W: Write>(variants: Vec, - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, code: blocks::Code<'tcx>, mode: PpFlowGraphMode, mut out: W) @@ -866,7 +866,7 @@ pub fn print_after_hir_lowering<'tcx>( // with a different callback than the standard driver, so that isn't easy. // Instead, we call that function ourselves. fn print_with_analysis<'tcx>( - tcx: TyCtxt<'_, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ppm: PpMode, uii: Option, ofile: Option<&Path> diff --git a/src/librustc_incremental/assert_dep_graph.rs b/src/librustc_incremental/assert_dep_graph.rs index ea89d2ca76d9f..78dfef1d4c6ba 100644 --- a/src/librustc_incremental/assert_dep_graph.rs +++ b/src/librustc_incremental/assert_dep_graph.rs @@ -51,7 +51,7 @@ use std::io::Write; use syntax::ast; use syntax_pos::Span; -pub fn assert_dep_graph<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { +pub fn assert_dep_graph<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { tcx.dep_graph.with_ignore(|| { if tcx.sess.opts.debugging_opts.dump_dep_graph { dump_graph(tcx); @@ -89,13 +89,13 @@ pub fn assert_dep_graph<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { type Sources = Vec<(Span, DefId, DepNode)>; type Targets = Vec<(Span, ast::Name, hir::HirId, DepNode)>; -struct IfThisChanged<'a, 'tcx:'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, +struct IfThisChanged<'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, if_this_changed: Sources, then_this_would_need: Targets, } -impl<'a, 'tcx> IfThisChanged<'a, 'tcx> { +impl IfThisChanged<'tcx> { fn argument(&self, attr: &ast::Attribute) -> Option { let mut value = None; for list_item in attr.meta_item_list().unwrap_or_default() { @@ -158,7 +158,7 @@ impl<'a, 'tcx> IfThisChanged<'a, 'tcx> { } } -impl<'a, 'tcx> Visitor<'tcx> for IfThisChanged<'a, 'tcx> { +impl Visitor<'tcx> for IfThisChanged<'tcx> { fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> { NestedVisitorMap::OnlyBodies(&self.tcx.hir()) } @@ -184,7 +184,7 @@ impl<'a, 'tcx> Visitor<'tcx> for IfThisChanged<'a, 'tcx> { } } -fn check_paths<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn check_paths<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, if_this_changed: &Sources, then_this_would_need: &Targets) { diff --git a/src/librustc_incremental/assert_module_sources.rs b/src/librustc_incremental/assert_module_sources.rs index 04dad9c5355c5..8cffa4b8284f9 100644 --- a/src/librustc_incremental/assert_module_sources.rs +++ b/src/librustc_incremental/assert_module_sources.rs @@ -35,7 +35,7 @@ const MODULE: Symbol = sym::module; const CFG: Symbol = sym::cfg; const KIND: Symbol = sym::kind; -pub fn assert_module_sources<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { +pub fn assert_module_sources<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { tcx.dep_graph.with_ignore(|| { if tcx.sess.opts.incremental.is_none() { return; @@ -59,12 +59,12 @@ pub fn assert_module_sources<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { }) } -struct AssertModuleSource<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, +struct AssertModuleSource<'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, available_cgus: BTreeSet, } -impl<'a, 'tcx> AssertModuleSource<'a, 'tcx> { +impl AssertModuleSource<'tcx> { fn check_attr(&self, attr: &ast::Attribute) { let (expected_reuse, comp_kind) = if attr.check_name(ATTR_PARTITION_REUSED) { (CguReuse::PreLto, ComparisonKind::AtLeast) diff --git a/src/librustc_incremental/lib.rs b/src/librustc_incremental/lib.rs index 50780ba4e7bb3..ffea495d3ebdb 100644 --- a/src/librustc_incremental/lib.rs +++ b/src/librustc_incremental/lib.rs @@ -2,6 +2,7 @@ #![doc(html_root_url = "https://doc.rust-lang.org/nightly/")] +#![feature(in_band_lifetimes)] #![feature(nll)] #![feature(specialization)] diff --git a/src/librustc_incremental/persist/dirty_clean.rs b/src/librustc_incremental/persist/dirty_clean.rs index f404a4f82e672..06fe5750f9d82 100644 --- a/src/librustc_incremental/persist/dirty_clean.rs +++ b/src/librustc_incremental/persist/dirty_clean.rs @@ -206,7 +206,7 @@ impl Assertion { } } -pub fn check_dirty_clean_annotations<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { +pub fn check_dirty_clean_annotations<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { // can't add `#[rustc_dirty]` etc without opting in to this feature if !tcx.features().rustc_attrs { return; @@ -234,13 +234,12 @@ pub fn check_dirty_clean_annotations<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { }) } -pub struct DirtyCleanVisitor<'a, 'tcx:'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, +pub struct DirtyCleanVisitor<'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, checked_attrs: FxHashSet, } -impl<'a, 'tcx> DirtyCleanVisitor<'a, 'tcx> { - +impl DirtyCleanVisitor<'tcx> { /// Possibly "deserialize" the attribute into a clean/dirty assertion fn assertion_maybe(&mut self, item_id: hir::HirId, attr: &Attribute) -> Option @@ -518,7 +517,7 @@ impl<'a, 'tcx> DirtyCleanVisitor<'a, 'tcx> { } } -impl<'a, 'tcx> ItemLikeVisitor<'tcx> for DirtyCleanVisitor<'a, 'tcx> { +impl ItemLikeVisitor<'tcx> for DirtyCleanVisitor<'tcx> { fn visit_item(&mut self, item: &'tcx hir::Item) { self.check_item(item.hir_id, item.span); } @@ -590,14 +589,13 @@ fn expect_associated_value(tcx: TyCtxt<'_, '_, '_>, item: &NestedMetaItem) -> as // A visitor that collects all #[rustc_dirty]/#[rustc_clean] attributes from // the HIR. It is used to verfiy that we really ran checks for all annotated // nodes. -pub struct FindAllAttrs<'a, 'tcx:'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, +pub struct FindAllAttrs<'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, attr_names: Vec, found_attrs: Vec<&'tcx Attribute>, } -impl<'a, 'tcx> FindAllAttrs<'a, 'tcx> { - +impl FindAllAttrs<'tcx> { fn is_active_attr(&mut self, attr: &Attribute) -> bool { for attr_name in &self.attr_names { if attr.check_name(*attr_name) && check_config(self.tcx, attr) { @@ -618,7 +616,7 @@ impl<'a, 'tcx> FindAllAttrs<'a, 'tcx> { } } -impl<'a, 'tcx> intravisit::Visitor<'tcx> for FindAllAttrs<'a, 'tcx> { +impl intravisit::Visitor<'tcx> for FindAllAttrs<'tcx> { fn nested_visit_map<'this>(&'this mut self) -> intravisit::NestedVisitorMap<'this, 'tcx> { intravisit::NestedVisitorMap::All(&self.tcx.hir()) } diff --git a/src/librustc_incremental/persist/load.rs b/src/librustc_incremental/persist/load.rs index 255a3899d1183..5146453c74665 100644 --- a/src/librustc_incremental/persist/load.rs +++ b/src/librustc_incremental/persist/load.rs @@ -15,7 +15,7 @@ use super::fs::*; use super::file_format; use super::work_product; -pub fn dep_graph_tcx_init<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { +pub fn dep_graph_tcx_init<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { if !tcx.dep_graph.is_fully_enabled() { return } diff --git a/src/librustc_incremental/persist/save.rs b/src/librustc_incremental/persist/save.rs index 34fe2f1c25d04..8e4c0133b4279 100644 --- a/src/librustc_incremental/persist/save.rs +++ b/src/librustc_incremental/persist/save.rs @@ -15,7 +15,7 @@ use super::dirty_clean; use super::file_format; use super::work_product; -pub fn save_dep_graph<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { +pub fn save_dep_graph<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { debug!("save_dep_graph()"); tcx.dep_graph.with_ignore(|| { let sess = tcx.sess; diff --git a/src/librustc_interface/passes.rs b/src/librustc_interface/passes.rs index 9691d0337d7d2..66a4ee8bfc35d 100644 --- a/src/librustc_interface/passes.rs +++ b/src/librustc_interface/passes.rs @@ -879,7 +879,7 @@ pub fn create_global_ctxt( /// Runs the resolution, type-checking, region checking and other /// miscellaneous analysis passes on the crate. fn analysis<'tcx>( - tcx: TyCtxt<'_, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, cnum: CrateNum, ) -> Result<()> { assert_eq!(cnum, LOCAL_CRATE); @@ -999,7 +999,7 @@ fn analysis<'tcx>( } fn encode_and_write_metadata<'tcx>( - tcx: TyCtxt<'_, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, outputs: &OutputFilenames, ) -> (middle::cstore::EncodedMetadata, bool) { #[derive(PartialEq, Eq, PartialOrd, Ord)] @@ -1062,7 +1062,7 @@ fn encode_and_write_metadata<'tcx>( /// be discarded. pub fn start_codegen<'tcx>( codegen_backend: &dyn CodegenBackend, - tcx: TyCtxt<'_, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, rx: mpsc::Receiver>, outputs: &OutputFilenames, ) -> Box { diff --git a/src/librustc_interface/proc_macro_decls.rs b/src/librustc_interface/proc_macro_decls.rs index e9f2f0410d440..82eb2014728d4 100644 --- a/src/librustc_interface/proc_macro_decls.rs +++ b/src/librustc_interface/proc_macro_decls.rs @@ -6,12 +6,12 @@ use rustc::ty::query::Providers; use syntax::attr; use syntax::symbol::sym; -pub fn find<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>) -> Option { +pub fn find<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Option { tcx.proc_macro_decls_static(LOCAL_CRATE) } fn proc_macro_decls_static<'tcx>( - tcx: TyCtxt<'_, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, cnum: CrateNum, ) -> Option { assert_eq!(cnum, LOCAL_CRATE); diff --git a/src/librustc_lint/lib.rs b/src/librustc_lint/lib.rs index 87d46a08d9aa6..59498799f19d0 100644 --- a/src/librustc_lint/lib.rs +++ b/src/librustc_lint/lib.rs @@ -75,7 +75,7 @@ pub fn provide(providers: &mut Providers<'_>) { }; } -fn lint_mod<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, module_def_id: DefId) { +fn lint_mod<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, module_def_id: DefId) { lint::late_lint_mod(tcx, module_def_id, BuiltinCombinedModuleLateLintPass::new()); } diff --git a/src/librustc_lint/types.rs b/src/librustc_lint/types.rs index 45cef61064d78..13e620b6b01f3 100644 --- a/src/librustc_lint/types.rs +++ b/src/librustc_lint/types.rs @@ -519,11 +519,11 @@ enum FfiResult<'tcx> { }, } -fn is_zst<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, did: DefId, ty: Ty<'tcx>) -> bool { +fn is_zst<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, did: DefId, ty: Ty<'tcx>) -> bool { tcx.layout_of(tcx.param_env(did).and(ty)).map(|layout| layout.is_zst()).unwrap_or(false) } -fn ty_is_known_nonnull<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ty: Ty<'tcx>) -> bool { +fn ty_is_known_nonnull<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ty: Ty<'tcx>) -> bool { match ty.sty { ty::FnPtr(_) => true, ty::Ref(..) => true, @@ -555,7 +555,7 @@ fn ty_is_known_nonnull<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ty: Ty<'tcx>) -> b /// to function pointers, references, core::num::NonZero*, /// core::ptr::NonNull, and #[repr(transparent)] newtypes. /// FIXME: This duplicates code in codegen. -fn is_repr_nullable_ptr<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn is_repr_nullable_ptr<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ty: Ty<'tcx>, ty_def: &'tcx ty::AdtDef, substs: SubstsRef<'tcx>) diff --git a/src/librustc_macros/src/query.rs b/src/librustc_macros/src/query.rs index 8eacbfbaccea2..14f46fef874db 100644 --- a/src/librustc_macros/src/query.rs +++ b/src/librustc_macros/src/query.rs @@ -327,7 +327,7 @@ fn add_query_description_impl( quote! { #[inline] fn try_load_from_disk( - #tcx: TyCtxt<'_, 'tcx, 'tcx>, + #tcx: TyCtxt<'tcx, 'tcx, 'tcx>, #id: SerializedDepNodeIndex ) -> Option { #block @@ -338,7 +338,7 @@ fn add_query_description_impl( quote! { #[inline] fn try_load_from_disk( - tcx: TyCtxt<'_, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, id: SerializedDepNodeIndex ) -> Option { tcx.queries.on_disk_cache.try_load_query_result(tcx, id) @@ -350,7 +350,7 @@ fn add_query_description_impl( quote! { #[inline] #[allow(unused_variables)] - fn cache_on_disk(#tcx: TyCtxt<'_, 'tcx, 'tcx>, #key: Self::Key) -> bool { + fn cache_on_disk(#tcx: TyCtxt<'tcx, 'tcx, 'tcx>, #key: Self::Key) -> bool { #expr } diff --git a/src/librustc_metadata/cstore_impl.rs b/src/librustc_metadata/cstore_impl.rs index 35faa1df82b84..9ab482895d9a7 100644 --- a/src/librustc_metadata/cstore_impl.rs +++ b/src/librustc_metadata/cstore_impl.rs @@ -40,7 +40,7 @@ macro_rules! provide { (<$lt:tt> $tcx:ident, $def_id:ident, $other:ident, $cdata:ident, $($name:ident => $compute:block)*) => { pub fn provide_extern<$lt>(providers: &mut Providers<$lt>) { - $(fn $name<'a, $lt:$lt, T>($tcx: TyCtxt<'a, $lt, $lt>, def_id_arg: T) + $(fn $name<$lt:$lt, T>($tcx: TyCtxt<$lt, $lt, $lt>, def_id_arg: T) -> as QueryConfig<$lt>>::Value where T: IntoArgs, @@ -551,7 +551,7 @@ impl CrateStore for cstore::CStore { } fn encode_metadata<'a, 'tcx>(&self, - tcx: TyCtxt<'a, 'tcx, 'tcx>) + tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> EncodedMetadata { encoder::encode_metadata(tcx) diff --git a/src/librustc_metadata/decoder.rs b/src/librustc_metadata/decoder.rs index e3e327d0a5bd0..bcce834c282e0 100644 --- a/src/librustc_metadata/decoder.rs +++ b/src/librustc_metadata/decoder.rs @@ -39,7 +39,7 @@ pub struct DecodeContext<'a, 'tcx: 'a> { opaque: opaque::Decoder<'a>, cdata: Option<&'a CrateMetadata>, sess: Option<&'a Session>, - tcx: Option>, + tcx: Option>, // Cache the last used source_file for translating spans as an optimization. last_source_file_index: usize, @@ -55,7 +55,7 @@ pub trait Metadata<'a, 'tcx>: Copy { fn raw_bytes(self) -> &'a [u8]; fn cdata(self) -> Option<&'a CrateMetadata> { None } fn sess(self) -> Option<&'a Session> { None } - fn tcx(self) -> Option> { None } + fn tcx(self) -> Option> { None } fn decoder(self, pos: usize) -> DecodeContext<'a, 'tcx> { let tcx = self.tcx(); @@ -114,14 +114,14 @@ impl<'a, 'tcx> Metadata<'a, 'tcx> for (&'a CrateMetadata, &'a Session) { } } -impl<'a, 'tcx> Metadata<'a, 'tcx> for (&'a CrateMetadata, TyCtxt<'a, 'tcx, 'tcx>) { +impl<'a, 'tcx> Metadata<'a, 'tcx> for (&'a CrateMetadata, TyCtxt<'tcx, 'tcx, 'tcx>) { fn raw_bytes(self) -> &'a [u8] { self.0.raw_bytes() } fn cdata(self) -> Option<&'a CrateMetadata> { Some(self.0) } - fn tcx(self) -> Option> { + fn tcx(self) -> Option> { Some(self.1) } } @@ -146,7 +146,7 @@ impl<'a, 'tcx: 'a, T: Decodable> LazySeq { } impl<'a, 'tcx> DecodeContext<'a, 'tcx> { - pub fn tcx(&self) -> TyCtxt<'a, 'tcx, 'tcx> { + pub fn tcx(&self) -> TyCtxt<'tcx, 'tcx, 'tcx> { self.tcx.expect("missing TyCtxt in DecodeContext") } @@ -169,10 +169,10 @@ impl<'a, 'tcx> DecodeContext<'a, 'tcx> { } } -impl<'a, 'tcx: 'a> TyDecoder<'a, 'tcx> for DecodeContext<'a, 'tcx> { +impl<'a, 'tcx> TyDecoder<'tcx> for DecodeContext<'a, 'tcx> { #[inline] - fn tcx(&self) -> TyCtxt<'a, 'tcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'tcx, 'tcx, 'tcx> { self.tcx.expect("missing TyCtxt in DecodeContext") } @@ -547,7 +547,7 @@ impl<'a, 'tcx> CrateMetadata { fn get_variant( &self, - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item: &Entry<'_>, index: DefIndex, parent_did: DefId, @@ -590,7 +590,7 @@ impl<'a, 'tcx> CrateMetadata { pub fn get_adt_def(&self, item_id: DefIndex, - tcx: TyCtxt<'a, 'tcx, 'tcx>) + tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> &'tcx ty::AdtDef { let item = self.entry(item_id); let did = self.local_def_id(item_id); @@ -618,21 +618,21 @@ impl<'a, 'tcx> CrateMetadata { pub fn get_predicates(&self, item_id: DefIndex, - tcx: TyCtxt<'a, 'tcx, 'tcx>) + tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> ty::GenericPredicates<'tcx> { self.entry(item_id).predicates.unwrap().decode((self, tcx)) } pub fn get_predicates_defined_on(&self, item_id: DefIndex, - tcx: TyCtxt<'a, 'tcx, 'tcx>) + tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> ty::GenericPredicates<'tcx> { self.entry(item_id).predicates_defined_on.unwrap().decode((self, tcx)) } pub fn get_super_predicates(&self, item_id: DefIndex, - tcx: TyCtxt<'a, 'tcx, 'tcx>) + tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> ty::GenericPredicates<'tcx> { let super_predicates = match self.entry(item_id).kind { EntryKind::Trait(data) => data.decode(self).super_predicates, @@ -650,7 +650,7 @@ impl<'a, 'tcx> CrateMetadata { self.entry(item_id).generics.unwrap().decode((self, sess)) } - pub fn get_type(&self, id: DefIndex, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Ty<'tcx> { + pub fn get_type(&self, id: DefIndex, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Ty<'tcx> { self.entry(id).ty.unwrap().decode((self, tcx)) } @@ -702,7 +702,7 @@ impl<'a, 'tcx> CrateMetadata { pub fn get_impl_trait(&self, id: DefIndex, - tcx: TyCtxt<'a, 'tcx, 'tcx>) + tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Option> { self.get_impl_data(id).trait_ref.map(|tr| tr.decode((self, tcx))) } @@ -885,7 +885,7 @@ impl<'a, 'tcx> CrateMetadata { } pub fn maybe_get_optimized_mir(&self, - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, id: DefIndex) -> Option> { match self.is_proc_macro(id) { @@ -1136,7 +1136,7 @@ impl<'a, 'tcx> CrateMetadata { } pub fn exported_symbols(&self, - tcx: TyCtxt<'a, 'tcx, 'tcx>) + tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Vec<(ExportedSymbol<'tcx>, SymbolExportLevel)> { if self.proc_macros.is_some() { // If this crate is a custom derive crate, then we're not even going to @@ -1194,7 +1194,7 @@ impl<'a, 'tcx> CrateMetadata { pub fn fn_sig(&self, id: DefIndex, - tcx: TyCtxt<'a, 'tcx, 'tcx>) + tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> ty::PolyFnSig<'tcx> { let sig = match self.entry(id).kind { EntryKind::Fn(data) | diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs index 586fc507dd3eb..7fbf50e6b5322 100644 --- a/src/librustc_metadata/encoder.rs +++ b/src/librustc_metadata/encoder.rs @@ -40,9 +40,9 @@ use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::hir::intravisit::{Visitor, NestedVisitorMap}; use rustc::hir::intravisit; -pub struct EncodeContext<'a, 'tcx: 'a> { +pub struct EncodeContext<'tcx> { opaque: opaque::Encoder, - pub tcx: TyCtxt<'a, 'tcx, 'tcx>, + pub tcx: TyCtxt<'tcx, 'tcx, 'tcx>, entries_index: Index<'tcx>, @@ -65,7 +65,7 @@ macro_rules! encoder_methods { } } -impl<'a, 'tcx> Encoder for EncodeContext<'a, 'tcx> { +impl<'a, 'tcx> Encoder for EncodeContext<'tcx> { type Error = ::Error; fn emit_unit(&mut self) -> Result<(), Self::Error> { @@ -95,13 +95,13 @@ impl<'a, 'tcx> Encoder for EncodeContext<'a, 'tcx> { } } -impl<'a, 'tcx, T> SpecializedEncoder> for EncodeContext<'a, 'tcx> { +impl<'tcx, T> SpecializedEncoder> for EncodeContext<'tcx> { fn specialized_encode(&mut self, lazy: &Lazy) -> Result<(), Self::Error> { self.emit_lazy_distance(lazy.position, Lazy::::min_size()) } } -impl<'a, 'tcx, T> SpecializedEncoder> for EncodeContext<'a, 'tcx> { +impl<'tcx, T> SpecializedEncoder> for EncodeContext<'tcx> { fn specialized_encode(&mut self, seq: &LazySeq) -> Result<(), Self::Error> { self.emit_usize(seq.len)?; if seq.len == 0 { @@ -111,14 +111,14 @@ impl<'a, 'tcx, T> SpecializedEncoder> for EncodeContext<'a, 'tcx> { } } -impl<'a, 'tcx> SpecializedEncoder for EncodeContext<'a, 'tcx> { +impl<'tcx> SpecializedEncoder for EncodeContext<'tcx> { #[inline] fn specialized_encode(&mut self, cnum: &CrateNum) -> Result<(), Self::Error> { self.emit_u32(cnum.as_u32()) } } -impl<'a, 'tcx> SpecializedEncoder for EncodeContext<'a, 'tcx> { +impl<'tcx> SpecializedEncoder for EncodeContext<'tcx> { #[inline] fn specialized_encode(&mut self, def_id: &DefId) -> Result<(), Self::Error> { let DefId { @@ -131,14 +131,14 @@ impl<'a, 'tcx> SpecializedEncoder for EncodeContext<'a, 'tcx> { } } -impl<'a, 'tcx> SpecializedEncoder for EncodeContext<'a, 'tcx> { +impl<'tcx> SpecializedEncoder for EncodeContext<'tcx> { #[inline] fn specialized_encode(&mut self, def_index: &DefIndex) -> Result<(), Self::Error> { self.emit_u32(def_index.as_u32()) } } -impl<'a, 'tcx> SpecializedEncoder for EncodeContext<'a, 'tcx> { +impl<'tcx> SpecializedEncoder for EncodeContext<'tcx> { fn specialized_encode(&mut self, span: &Span) -> Result<(), Self::Error> { if span.is_dummy() { return TAG_INVALID_SPAN.encode(self) @@ -173,20 +173,20 @@ impl<'a, 'tcx> SpecializedEncoder for EncodeContext<'a, 'tcx> { } } -impl<'a, 'tcx> SpecializedEncoder for EncodeContext<'a, 'tcx> { +impl<'tcx> SpecializedEncoder for EncodeContext<'tcx> { #[inline] fn specialized_encode(&mut self, def_id: &LocalDefId) -> Result<(), Self::Error> { self.specialized_encode(&def_id.to_def_id()) } } -impl<'a, 'tcx> SpecializedEncoder> for EncodeContext<'a, 'tcx> { +impl<'tcx> SpecializedEncoder> for EncodeContext<'tcx> { fn specialized_encode(&mut self, ty: &Ty<'tcx>) -> Result<(), Self::Error> { ty_codec::encode_with_shorthand(self, ty, |ecx| &mut ecx.type_shorthands) } } -impl<'a, 'tcx> SpecializedEncoder for EncodeContext<'a, 'tcx> { +impl<'tcx> SpecializedEncoder for EncodeContext<'tcx> { fn specialized_encode(&mut self, alloc_id: &interpret::AllocId) -> Result<(), Self::Error> { use std::collections::hash_map::Entry; let index = match self.interpret_allocs.entry(*alloc_id) { @@ -203,7 +203,7 @@ impl<'a, 'tcx> SpecializedEncoder for EncodeContext<'a, 'tcx } } -impl<'a, 'tcx> SpecializedEncoder> for EncodeContext<'a, 'tcx> { +impl<'tcx> SpecializedEncoder> for EncodeContext<'tcx> { fn specialized_encode(&mut self, predicates: &ty::GenericPredicates<'tcx>) -> Result<(), Self::Error> { @@ -211,14 +211,14 @@ impl<'a, 'tcx> SpecializedEncoder> for EncodeContext } } -impl<'a, 'tcx> SpecializedEncoder for EncodeContext<'a, 'tcx> { +impl<'tcx> SpecializedEncoder for EncodeContext<'tcx> { fn specialized_encode(&mut self, f: &Fingerprint) -> Result<(), Self::Error> { f.encode_opaque(&mut self.opaque) } } -impl<'a, 'tcx, T: Encodable> SpecializedEncoder> -for EncodeContext<'a, 'tcx> { +impl<'tcx, T: Encodable> SpecializedEncoder> +for EncodeContext<'tcx> { fn specialized_encode(&mut self, _: &mir::ClearCrossCrate) -> Result<(), Self::Error> { @@ -226,13 +226,13 @@ for EncodeContext<'a, 'tcx> { } } -impl<'a, 'tcx> TyEncoder for EncodeContext<'a, 'tcx> { +impl<'tcx> TyEncoder for EncodeContext<'tcx> { fn position(&self) -> usize { self.opaque.position() } } -impl<'a, 'tcx> EncodeContext<'a, 'tcx> { +impl<'tcx> EncodeContext<'tcx> { fn emit_node R, R>(&mut self, f: F) -> R { assert_eq!(self.lazy_state, LazyState::NoNode); @@ -544,7 +544,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { } } -impl EncodeContext<'_, 'tcx> { +impl EncodeContext<'tcx> { fn encode_variances_of(&mut self, def_id: DefId) -> LazySeq { debug!("EncodeContext::encode_variances_of({:?})", def_id); let tcx = self.tcx; @@ -1648,7 +1648,7 @@ impl EncodeContext<'_, 'tcx> { } } -impl Visitor<'tcx> for EncodeContext<'_, 'tcx> { +impl Visitor<'tcx> for EncodeContext<'tcx> { fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> { NestedVisitorMap::OnlyBodies(&self.tcx.hir()) } @@ -1698,7 +1698,7 @@ impl Visitor<'tcx> for EncodeContext<'_, 'tcx> { } } -impl EncodeContext<'_, 'tcx> { +impl EncodeContext<'tcx> { fn encode_fields(&mut self, adt_def_id: DefId) { let def = self.tcx.adt_def(adt_def_id); for (variant_index, variant) in def.variants.iter_enumerated() { @@ -1817,12 +1817,12 @@ impl EncodeContext<'_, 'tcx> { } } -struct ImplVisitor<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, +struct ImplVisitor<'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impls: FxHashMap>, } -impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for ImplVisitor<'a, 'tcx> { +impl<'tcx, 'v> ItemLikeVisitor<'v> for ImplVisitor<'tcx> { fn visit_item(&mut self, item: &hir::Item) { if let hir::ItemKind::Impl(..) = item.node { let impl_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id); @@ -1865,7 +1865,7 @@ impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for ImplVisitor<'a, 'tcx> { // will allow us to slice the metadata to the precise length that we just // generated regardless of trailing bytes that end up in it. -pub fn encode_metadata<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) +pub fn encode_metadata<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> EncodedMetadata { let mut encoder = opaque::Encoder::new(vec![]); @@ -1909,7 +1909,7 @@ pub fn encode_metadata<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) EncodedMetadata { raw_data: result } } -pub fn get_repr_options<'a, 'tcx, 'gcx>(tcx: TyCtxt<'a, 'tcx, 'gcx>, did: DefId) -> ReprOptions { +pub fn get_repr_options<'tcx, 'gcx>(tcx: TyCtxt<'gcx, 'tcx, 'gcx>, did: DefId) -> ReprOptions { let ty = tcx.type_of(did); match ty.sty { ty::Adt(ref def, _) => return def.repr, diff --git a/src/librustc_metadata/foreign_modules.rs b/src/librustc_metadata/foreign_modules.rs index 284f6796145a8..eb5a6485d2565 100644 --- a/src/librustc_metadata/foreign_modules.rs +++ b/src/librustc_metadata/foreign_modules.rs @@ -3,7 +3,7 @@ use rustc::hir; use rustc::middle::cstore::ForeignModule; use rustc::ty::TyCtxt; -pub fn collect<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Vec { +pub fn collect<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Vec { let mut collector = Collector { tcx, modules: Vec::new(), @@ -12,12 +12,12 @@ pub fn collect<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Vec { return collector.modules } -struct Collector<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, +struct Collector<'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, modules: Vec, } -impl<'a, 'tcx> ItemLikeVisitor<'tcx> for Collector<'a, 'tcx> { +impl ItemLikeVisitor<'tcx> for Collector<'tcx> { fn visit_item(&mut self, it: &'tcx hir::Item) { let fm = match it.node { hir::ItemKind::ForeignMod(ref fm) => fm, diff --git a/src/librustc_metadata/link_args.rs b/src/librustc_metadata/link_args.rs index f4682465a659a..851c2d3ea1218 100644 --- a/src/librustc_metadata/link_args.rs +++ b/src/librustc_metadata/link_args.rs @@ -4,7 +4,7 @@ use rustc::ty::TyCtxt; use rustc_target::spec::abi::Abi; use syntax::symbol::sym; -pub fn collect<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Vec { +pub fn collect<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Vec { let mut collector = Collector { args: Vec::new(), }; diff --git a/src/librustc_metadata/native_libs.rs b/src/librustc_metadata/native_libs.rs index fee08f421549d..0817cce90dfea 100644 --- a/src/librustc_metadata/native_libs.rs +++ b/src/librustc_metadata/native_libs.rs @@ -11,7 +11,7 @@ use syntax::feature_gate::{self, GateIssue}; use syntax::symbol::{Symbol, sym}; use syntax::{span_err, struct_span_err}; -pub fn collect<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Vec { +pub fn collect<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Vec { let mut collector = Collector { tcx, libs: Vec::new(), @@ -28,12 +28,12 @@ pub fn relevant_lib(sess: &Session, lib: &NativeLibrary) -> bool { } } -struct Collector<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, +struct Collector<'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, libs: Vec, } -impl<'a, 'tcx> ItemLikeVisitor<'tcx> for Collector<'a, 'tcx> { +impl ItemLikeVisitor<'tcx> for Collector<'tcx> { fn visit_item(&mut self, it: &'tcx hir::Item) { let fm = match it.node { hir::ItemKind::ForeignMod(ref fm) => fm, @@ -130,7 +130,7 @@ impl<'a, 'tcx> ItemLikeVisitor<'tcx> for Collector<'a, 'tcx> { fn visit_impl_item(&mut self, _it: &'tcx hir::ImplItem) {} } -impl<'a, 'tcx> Collector<'a, 'tcx> { +impl Collector<'tcx> { fn register_native_lib(&mut self, span: Option, lib: NativeLibrary) { if lib.name.as_ref().map(|s| s.as_str().is_empty()).unwrap_or(false) { match span { diff --git a/src/librustc_mir/borrow_check/borrow_set.rs b/src/librustc_mir/borrow_check/borrow_set.rs index 0fc72b83a1668..e1425ed24300d 100644 --- a/src/librustc_mir/borrow_check/borrow_set.rs +++ b/src/librustc_mir/borrow_check/borrow_set.rs @@ -122,7 +122,7 @@ impl LocalsStateAtExit { impl<'tcx> BorrowSet<'tcx> { pub fn build( - tcx: TyCtxt<'_, '_, 'tcx>, + tcx: TyCtxt<'tcx, '_, 'tcx>, body: &Body<'tcx>, locals_are_invalidated_at_exit: bool, move_data: &MoveData<'tcx> @@ -162,7 +162,7 @@ impl<'tcx> BorrowSet<'tcx> { } struct GatherBorrows<'a, 'gcx: 'tcx, 'tcx: 'a> { - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, body: &'a Body<'tcx>, idx_vec: IndexVec>, location_map: FxHashMap, diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs index 502d601f7ce61..aa298659d72f2 100644 --- a/src/librustc_mir/borrow_check/mod.rs +++ b/src/librustc_mir/borrow_check/mod.rs @@ -87,7 +87,7 @@ pub fn provide(providers: &mut Providers<'_>) { }; } -fn mir_borrowck<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> BorrowCheckResult<'tcx> { +fn mir_borrowck<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> BorrowCheckResult<'tcx> { let input_body = tcx.mir_validated(def_id); debug!("run query mir_borrowck: {}", tcx.def_path_str(def_id)); diff --git a/src/librustc_mir/borrow_check/move_errors.rs b/src/librustc_mir/borrow_check/move_errors.rs index f4bc1bc54527a..a7f3022019c1a 100644 --- a/src/librustc_mir/borrow_check/move_errors.rs +++ b/src/librustc_mir/borrow_check/move_errors.rs @@ -96,7 +96,7 @@ impl BorrowedContentSource<'tcx> { } } - fn from_call(func: Ty<'tcx>, tcx: TyCtxt<'_, '_, 'tcx>) -> Option { + fn from_call(func: Ty<'tcx>, tcx: TyCtxt<'tcx, '_, 'tcx>) -> Option { match func.sty { ty::FnDef(def_id, substs) => { let trait_id = tcx.trait_of_item(def_id)?; diff --git a/src/librustc_mir/borrow_check/mutability_errors.rs b/src/librustc_mir/borrow_check/mutability_errors.rs index 46116e3e876bc..8452d1654d8a1 100644 --- a/src/librustc_mir/borrow_check/mutability_errors.rs +++ b/src/librustc_mir/borrow_check/mutability_errors.rs @@ -523,7 +523,7 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> { } fn suggest_ampmut_self<'cx, 'gcx, 'tcx>( - tcx: TyCtxt<'cx, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, local_decl: &mir::LocalDecl<'tcx>, ) -> (Span, String) { let sp = local_decl.source_info.span; @@ -556,7 +556,7 @@ fn suggest_ampmut_self<'cx, 'gcx, 'tcx>( // This implementation attempts to emulate AST-borrowck prioritization // by trying (3.), then (2.) and finally falling back on (1.). fn suggest_ampmut<'cx, 'gcx, 'tcx>( - tcx: TyCtxt<'cx, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, body: &Body<'tcx>, local: Local, local_decl: &mir::LocalDecl<'tcx>, @@ -623,7 +623,7 @@ fn is_closure_or_generator(ty: Ty<'_>) -> bool { /// | ---------- use `&'a mut String` here to make mutable /// ``` fn annotate_struct_field( - tcx: TyCtxt<'cx, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, ty: Ty<'tcx>, field: &mir::Field, ) -> Option<(Span, String)> { diff --git a/src/librustc_mir/borrow_check/nll/explain_borrow/find_use.rs b/src/librustc_mir/borrow_check/nll/explain_borrow/find_use.rs index 31181e72ed7ef..c0848f2afe633 100644 --- a/src/librustc_mir/borrow_check/nll/explain_borrow/find_use.rs +++ b/src/librustc_mir/borrow_check/nll/explain_borrow/find_use.rs @@ -12,7 +12,7 @@ use rustc_data_structures::fx::FxHashSet; crate fn find<'tcx>( body: &Body<'tcx>, regioncx: &Rc>, - tcx: TyCtxt<'_, '_, 'tcx>, + tcx: TyCtxt<'tcx, '_, 'tcx>, region_vid: RegionVid, start_point: Location, ) -> Option { @@ -30,7 +30,7 @@ crate fn find<'tcx>( struct UseFinder<'cx, 'gcx: 'tcx, 'tcx: 'cx> { body: &'cx Body<'tcx>, regioncx: &'cx Rc>, - tcx: TyCtxt<'cx, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, region_vid: RegionVid, start_point: Location, } @@ -101,7 +101,7 @@ impl<'cx, 'gcx, 'tcx> UseFinder<'cx, 'gcx, 'tcx> { struct DefUseVisitor<'cx, 'gcx: 'tcx, 'tcx: 'cx> { body: &'cx Body<'tcx>, - tcx: TyCtxt<'cx, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, region_vid: RegionVid, def_use_result: Option, } diff --git a/src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs b/src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs index f0e6d5636ccd0..143bdeb6f61e8 100644 --- a/src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs +++ b/src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs @@ -53,7 +53,7 @@ impl BorrowExplanation { } pub(in crate::borrow_check) fn add_explanation_to_diagnostic<'cx, 'gcx, 'tcx>( &self, - tcx: TyCtxt<'cx, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, body: &Body<'tcx>, err: &mut DiagnosticBuilder<'_>, borrow_desc: &str, diff --git a/src/librustc_mir/borrow_check/nll/invalidation.rs b/src/librustc_mir/borrow_check/nll/invalidation.rs index 516eb6d2941e5..a870227c762d1 100644 --- a/src/librustc_mir/borrow_check/nll/invalidation.rs +++ b/src/librustc_mir/borrow_check/nll/invalidation.rs @@ -18,7 +18,7 @@ use rustc::mir::{Operand, BorrowKind}; use rustc_data_structures::graph::dominators::Dominators; pub(super) fn generate_invalidates<'cx, 'gcx, 'tcx>( - tcx: TyCtxt<'cx, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, all_facts: &mut Option, location_table: &LocationTable, body: &Body<'tcx>, @@ -44,7 +44,7 @@ pub(super) fn generate_invalidates<'cx, 'gcx, 'tcx>( } struct InvalidationGenerator<'cx, 'tcx: 'cx, 'gcx: 'tcx> { - tcx: TyCtxt<'cx, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, all_facts: &'cx mut AllFacts, location_table: &'cx LocationTable, body: &'cx Body<'tcx>, diff --git a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs index 82720d0091394..2338d6a846674 100644 --- a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs +++ b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs @@ -194,7 +194,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { /// named variants. fn give_name_from_error_region( &self, - tcx: TyCtxt<'_, '_, 'tcx>, + tcx: TyCtxt<'tcx, '_, 'tcx>, mir_def_id: DefId, fr: RegionVid, counter: &mut usize, @@ -303,7 +303,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { /// ``` fn get_named_span( &self, - tcx: TyCtxt<'_, '_, 'tcx>, + tcx: TyCtxt<'tcx, '_, 'tcx>, error_region: &RegionKind, name: InternedString, ) -> Span { @@ -461,7 +461,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { /// to highlighting that closest type instead. fn give_name_if_we_can_match_hir_ty( &self, - tcx: TyCtxt<'_, '_, 'tcx>, + tcx: TyCtxt<'tcx, '_, 'tcx>, needle_fr: RegionVid, argument_ty: Ty<'tcx>, argument_hir_ty: &hir::Ty, @@ -653,7 +653,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { /// ``` fn give_name_if_anonymous_region_appears_in_upvars( &self, - tcx: TyCtxt<'_, '_, 'tcx>, + tcx: TyCtxt<'tcx, '_, 'tcx>, upvars: &[Upvar], fr: RegionVid, counter: &mut usize, diff --git a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/var_name.rs b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/var_name.rs index f2dbcc5db3ab1..77aeb401445a0 100644 --- a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/var_name.rs +++ b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/var_name.rs @@ -10,7 +10,7 @@ use syntax_pos::symbol::Symbol; impl<'tcx> RegionInferenceContext<'tcx> { crate fn get_var_name_and_span_for_region( &self, - tcx: TyCtxt<'_, '_, 'tcx>, + tcx: TyCtxt<'tcx, '_, 'tcx>, body: &Body<'tcx>, upvars: &[Upvar], fr: RegionVid, @@ -35,7 +35,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { /// Search the upvars (if any) to find one that references fr. Return its index. crate fn get_upvar_index_for_region( &self, - tcx: TyCtxt<'_, '_, 'tcx>, + tcx: TyCtxt<'tcx, '_, 'tcx>, fr: RegionVid, ) -> Option { let upvar_index = self @@ -69,7 +69,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { /// declared. crate fn get_upvar_name_and_span_for_region( &self, - tcx: TyCtxt<'_, '_, 'tcx>, + tcx: TyCtxt<'tcx, '_, 'tcx>, upvars: &[Upvar], upvar_index: usize, ) -> (Symbol, Span) { @@ -91,7 +91,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { /// user - in particular, index 0 is not the implicit self parameter. crate fn get_argument_index_for_region( &self, - tcx: TyCtxt<'_, '_, 'tcx>, + tcx: TyCtxt<'tcx, '_, 'tcx>, fr: RegionVid, ) -> Option { let implicit_inputs = self.universal_regions.defining_ty.implicit_inputs(); diff --git a/src/librustc_mir/borrow_check/nll/region_infer/mod.rs b/src/librustc_mir/borrow_check/nll/region_infer/mod.rs index 170f61a63a5b4..a2213f0c7eb58 100644 --- a/src/librustc_mir/borrow_check/nll/region_infer/mod.rs +++ b/src/librustc_mir/borrow_check/nll/region_infer/mod.rs @@ -370,7 +370,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { } /// Adds annotations for `#[rustc_regions]`; see `UniversalRegions::annotate`. - crate fn annotate(&self, tcx: TyCtxt<'_, '_, 'tcx>, err: &mut DiagnosticBuilder<'_>) { + crate fn annotate(&self, tcx: TyCtxt<'tcx, '_, 'tcx>, err: &mut DiagnosticBuilder<'_>) { self.universal_regions.annotate(tcx, err) } @@ -943,7 +943,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { /// `point`. fn eval_verify_bound( &self, - tcx: TyCtxt<'_, '_, 'tcx>, + tcx: TyCtxt<'tcx, '_, 'tcx>, body: &Body<'tcx>, generic_ty: Ty<'tcx>, lower_bound: RegionVid, @@ -976,7 +976,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { fn eval_if_eq( &self, - tcx: TyCtxt<'_, '_, 'tcx>, + tcx: TyCtxt<'tcx, '_, 'tcx>, body: &Body<'tcx>, generic_ty: Ty<'tcx>, lower_bound: RegionVid, @@ -1022,7 +1022,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { /// higher-ranked things and so forth, and right now the inference /// context is not permitted to make more inference variables. So /// we use this kind of hacky solution. - fn normalize_to_scc_representatives(&self, tcx: TyCtxt<'_, '_, 'tcx>, value: T) -> T + fn normalize_to_scc_representatives(&self, tcx: TyCtxt<'tcx, '_, 'tcx>, value: T) -> T where T: TypeFoldable<'tcx>, { @@ -1368,14 +1368,14 @@ impl<'tcx> RegionDefinition<'tcx> { pub trait ClosureRegionRequirementsExt<'gcx, 'tcx> { fn apply_requirements( &self, - tcx: TyCtxt<'_, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, closure_def_id: DefId, closure_substs: SubstsRef<'tcx>, ) -> Vec>; fn subst_closure_mapping( &self, - tcx: TyCtxt<'_, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, closure_mapping: &IndexVec>, value: &T, ) -> T @@ -1398,7 +1398,7 @@ impl<'gcx, 'tcx> ClosureRegionRequirementsExt<'gcx, 'tcx> for ClosureRegionRequi /// requirements. fn apply_requirements( &self, - tcx: TyCtxt<'_, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, closure_def_id: DefId, closure_substs: SubstsRef<'tcx>, ) -> Vec> { @@ -1453,7 +1453,7 @@ impl<'gcx, 'tcx> ClosureRegionRequirementsExt<'gcx, 'tcx> for ClosureRegionRequi fn subst_closure_mapping( &self, - tcx: TyCtxt<'_, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, closure_mapping: &IndexVec>, value: &T, ) -> T diff --git a/src/librustc_mir/borrow_check/nll/type_check/constraint_conversion.rs b/src/librustc_mir/borrow_check/nll/type_check/constraint_conversion.rs index bef159e996b87..381e18f60a2e0 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/constraint_conversion.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/constraint_conversion.rs @@ -15,7 +15,7 @@ use syntax_pos::DUMMY_SP; crate struct ConstraintConversion<'a, 'gcx: 'tcx, 'tcx: 'a> { infcx: &'a InferCtxt<'a, 'gcx, 'tcx>, - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, universal_regions: &'a UniversalRegions<'tcx>, region_bound_pairs: &'a RegionBoundPairs<'tcx>, implicit_region_bound: Option>, diff --git a/src/librustc_mir/borrow_check/nll/type_check/liveness/mod.rs b/src/librustc_mir/borrow_check/nll/type_check/liveness/mod.rs index fb99382e1314a..f4ceb36858e07 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/liveness/mod.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/liveness/mod.rs @@ -75,7 +75,7 @@ pub(super) fn generate<'gcx, 'tcx>( // some region `R` in its type where `R` is not known to outlive a free // region (i.e., where `R` may be valid for just a subset of the fn body). fn compute_live_locals( - tcx: TyCtxt<'_, '_, 'tcx>, + tcx: TyCtxt<'tcx, '_, 'tcx>, free_regions: &FxHashSet, body: &Body<'tcx>, ) -> Vec { diff --git a/src/librustc_mir/borrow_check/nll/type_check/mod.rs b/src/librustc_mir/borrow_check/nll/type_check/mod.rs index d6da42c24cee4..75d5987af0bc1 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/mod.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/mod.rs @@ -391,7 +391,7 @@ impl<'a, 'b, 'gcx, 'tcx> TypeVerifier<'a, 'b, 'gcx, 'tcx> { } } - fn tcx(&self) -> TyCtxt<'a, 'gcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.cx.infcx.tcx } @@ -1313,7 +1313,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { Ok(()) } - fn tcx(&self) -> TyCtxt<'a, 'gcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.infcx.tcx } @@ -2504,7 +2504,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { fn prove_closure_bounds( &mut self, - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, def_id: DefId, substs: SubstsRef<'tcx>, location: Location, diff --git a/src/librustc_mir/borrow_check/nll/universal_regions.rs b/src/librustc_mir/borrow_check/nll/universal_regions.rs index 72e453df56f39..76b1acc52ba31 100644 --- a/src/librustc_mir/borrow_check/nll/universal_regions.rs +++ b/src/librustc_mir/borrow_check/nll/universal_regions.rs @@ -106,7 +106,7 @@ impl<'tcx> DefiningTy<'tcx> { /// not a closure or generator, there are no upvars, and hence it /// will be an empty list. The order of types in this list will /// match up with the upvar order in the HIR, typesystem, and MIR. - pub fn upvar_tys(self, tcx: TyCtxt<'_, '_, 'tcx>) -> impl Iterator> + 'tcx { + pub fn upvar_tys(self, tcx: TyCtxt<'tcx, '_, 'tcx>) -> impl Iterator> + 'tcx { match self { DefiningTy::Closure(def_id, substs) => Either::Left(substs.upvar_tys(def_id, tcx)), DefiningTy::Generator(def_id, substs, _) => { @@ -218,7 +218,7 @@ impl<'tcx> UniversalRegions<'tcx> { /// `'1: '2`, then the caller would impose the constraint that /// `V[1]: V[2]`. pub fn closure_mapping( - tcx: TyCtxt<'_, '_, 'tcx>, + tcx: TyCtxt<'tcx, '_, 'tcx>, closure_substs: SubstsRef<'tcx>, expected_num_vars: usize, closure_base_def_id: DefId, @@ -305,7 +305,7 @@ impl<'tcx> UniversalRegions<'tcx> { /// that this region imposes on others. The methods in this file /// handle the part about dumping the inference context internal /// state. - crate fn annotate(&self, tcx: TyCtxt<'_, '_, 'tcx>, err: &mut DiagnosticBuilder<'_>) { + crate fn annotate(&self, tcx: TyCtxt<'tcx, '_, 'tcx>, err: &mut DiagnosticBuilder<'_>) { match self.defining_ty { DefiningTy::Closure(def_id, substs) => { err.note(&format!( @@ -744,7 +744,7 @@ impl<'tcx> UniversalRegionIndices<'tcx> { /// Replaces all free regions in `value` with region vids, as /// returned by `to_region_vid`. - pub fn fold_to_region_vids(&self, tcx: TyCtxt<'_, '_, 'tcx>, value: &T) -> T + pub fn fold_to_region_vids(&self, tcx: TyCtxt<'tcx, '_, 'tcx>, value: &T) -> T where T: TypeFoldable<'tcx>, { @@ -757,7 +757,7 @@ impl<'tcx> UniversalRegionIndices<'tcx> { /// Iterates over the late-bound regions defined on fn_def_id and /// invokes `f` with the liberated form of each one. fn for_each_late_bound_region_defined_on<'tcx>( - tcx: TyCtxt<'_, '_, 'tcx>, + tcx: TyCtxt<'tcx, '_, 'tcx>, fn_def_id: DefId, mut f: impl FnMut(ty::Region<'tcx>), ) { diff --git a/src/librustc_mir/borrow_check/path_utils.rs b/src/librustc_mir/borrow_check/path_utils.rs index a11e5d9a55687..8377a0910a99c 100644 --- a/src/librustc_mir/borrow_check/path_utils.rs +++ b/src/librustc_mir/borrow_check/path_utils.rs @@ -24,7 +24,7 @@ pub(super) enum Control { /// Encapsulates the idea of iterating over every borrow that involves a particular path pub(super) fn each_borrow_involving_path<'a, 'tcx, 'gcx: 'tcx, F, I, S> ( s: &mut S, - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, body: &Body<'tcx>, _location: Location, access_place: (AccessDepth, &Place<'tcx>), diff --git a/src/librustc_mir/borrow_check/place_ext.rs b/src/librustc_mir/borrow_check/place_ext.rs index 509bd16d4a080..d0c05318d90f3 100644 --- a/src/librustc_mir/borrow_check/place_ext.rs +++ b/src/librustc_mir/borrow_check/place_ext.rs @@ -12,7 +12,7 @@ crate trait PlaceExt<'tcx> { /// for borrows of raw pointer dereferents as well as shared references. fn ignore_borrow( &self, - tcx: TyCtxt<'_, '_, 'tcx>, + tcx: TyCtxt<'tcx, '_, 'tcx>, body: &Body<'tcx>, locals_state_at_exit: &LocalsStateAtExit, ) -> bool; @@ -21,7 +21,7 @@ crate trait PlaceExt<'tcx> { impl<'tcx> PlaceExt<'tcx> for Place<'tcx> { fn ignore_borrow( &self, - tcx: TyCtxt<'_, '_, 'tcx>, + tcx: TyCtxt<'tcx, '_, 'tcx>, body: &Body<'tcx>, locals_state_at_exit: &LocalsStateAtExit, ) -> bool { diff --git a/src/librustc_mir/borrow_check/places_conflict.rs b/src/librustc_mir/borrow_check/places_conflict.rs index a9ee0a65e3af6..cc9bcdc7f6202 100644 --- a/src/librustc_mir/borrow_check/places_conflict.rs +++ b/src/librustc_mir/borrow_check/places_conflict.rs @@ -25,7 +25,7 @@ crate enum PlaceConflictBias { /// This is used to check for places conflicting outside of the borrow checking code (such as in /// dataflow). crate fn places_conflict<'gcx, 'tcx>( - tcx: TyCtxt<'_, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, body: &Body<'tcx>, borrow_place: &Place<'tcx>, access_place: &Place<'tcx>, @@ -47,7 +47,7 @@ crate fn places_conflict<'gcx, 'tcx>( /// array indices, for example) should be interpreted - this depends on what the caller wants in /// order to make the conservative choice and preserve soundness. pub(super) fn borrow_conflicts_with_place<'gcx, 'tcx>( - tcx: TyCtxt<'_, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, body: &Body<'tcx>, borrow_place: &Place<'tcx>, borrow_kind: BorrowKind, @@ -84,7 +84,7 @@ pub(super) fn borrow_conflicts_with_place<'gcx, 'tcx>( } fn place_components_conflict<'gcx, 'tcx>( - tcx: TyCtxt<'_, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, body: &Body<'tcx>, borrow_projections: (&PlaceBase<'tcx>, ProjectionsIter<'_, 'tcx>), borrow_kind: BorrowKind, @@ -299,7 +299,7 @@ fn place_components_conflict<'gcx, 'tcx>( // or disjoint (and have the same type!), return the overlap situation // between `elem1` and `elem2`. fn place_base_conflict<'a, 'gcx: 'tcx, 'tcx>( - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, elem1: &PlaceBase<'tcx>, elem2: &PlaceBase<'tcx>, ) -> Overlap { @@ -366,7 +366,7 @@ fn place_base_conflict<'a, 'gcx: 'tcx, 'tcx>( // or disjoint (and have the same type!), return the overlap situation // between `elem1` and `elem2`. fn place_projection_conflict<'a, 'gcx: 'tcx, 'tcx>( - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, body: &Body<'tcx>, pi1: &Projection<'tcx>, pi2: &Projection<'tcx>, diff --git a/src/librustc_mir/borrow_check/prefixes.rs b/src/librustc_mir/borrow_check/prefixes.rs index 416de1c67e727..b7af985ad494c 100644 --- a/src/librustc_mir/borrow_check/prefixes.rs +++ b/src/librustc_mir/borrow_check/prefixes.rs @@ -39,7 +39,7 @@ impl<'tcx> IsPrefixOf<'tcx> for Place<'tcx> { pub(super) struct Prefixes<'cx, 'gcx: 'tcx, 'tcx: 'cx> { body: &'cx Body<'tcx>, - tcx: TyCtxt<'cx, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, kind: PrefixSet, next: Option<&'cx Place<'tcx>>, } diff --git a/src/librustc_mir/build/mod.rs b/src/librustc_mir/build/mod.rs index 65ece3fa82ff8..aa43d161b6c18 100644 --- a/src/librustc_mir/build/mod.rs +++ b/src/librustc_mir/build/mod.rs @@ -25,7 +25,7 @@ use syntax_pos::Span; use super::lints; /// Construct the MIR for a given `DefId`. -pub fn mir_build<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Body<'tcx> { +pub fn mir_build<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> Body<'tcx> { let id = tcx.hir().as_local_hir_id(def_id).unwrap(); // Figure out what primary body this item has. @@ -184,12 +184,12 @@ pub fn mir_build<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Body<' /// A pass to lift all the types and substitutions in a MIR /// to the global tcx. Sadly, we don't have a "folder" that /// can change `'tcx` so we have to transmute afterwards. -struct GlobalizeMir<'a, 'gcx: 'a> { - tcx: TyCtxt<'a, 'gcx, 'gcx>, +struct GlobalizeMir<'gcx> { + tcx: TyCtxt<'gcx, 'gcx, 'gcx>, span: Span } -impl<'a, 'gcx: 'tcx, 'tcx> MutVisitor<'tcx> for GlobalizeMir<'a, 'gcx> { +impl<'gcx: 'tcx, 'tcx> MutVisitor<'tcx> for GlobalizeMir<'gcx> { fn visit_ty(&mut self, ty: &mut Ty<'tcx>, _: TyContext) { if let Some(lifted) = self.tcx.lift(ty) { *ty = lifted; @@ -234,7 +234,7 @@ impl<'a, 'gcx: 'tcx, 'tcx> MutVisitor<'tcx> for GlobalizeMir<'a, 'gcx> { /////////////////////////////////////////////////////////////////////////// // BuildMir -- walks a crate, looking for fn items and methods to build MIR from -fn liberated_closure_env_ty<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, +fn liberated_closure_env_ty<'a, 'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, closure_expr_id: hir::HirId, body_id: hir::BodyId) -> Ty<'tcx> { @@ -551,7 +551,7 @@ macro_rules! unpack { }; } -fn should_abort_on_panic<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, +fn should_abort_on_panic<'a, 'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, fn_def_id: DefId, abi: Abi) -> bool { diff --git a/src/librustc_mir/const_eval.rs b/src/librustc_mir/const_eval.rs index b938e86ffad16..eb2680f749b75 100644 --- a/src/librustc_mir/const_eval.rs +++ b/src/librustc_mir/const_eval.rs @@ -43,17 +43,17 @@ const DETECTOR_SNAPSHOT_PERIOD: isize = 256; /// that inform us about the generic bounds of the constant. E.g., using an associated constant /// of a function's generic parameter will require knowledge about the bounds on the generic /// parameter. These bounds are passed to `mk_eval_cx` via the `ParamEnv` argument. -pub(crate) fn mk_eval_cx<'a, 'mir, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, +pub(crate) fn mk_eval_cx<'mir, 'tcx>( + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, span: Span, param_env: ty::ParamEnv<'tcx>, -) -> CompileTimeEvalContext<'a, 'mir, 'tcx> { +) -> CompileTimeEvalContext<'mir, 'tcx> { debug!("mk_eval_cx: {:?}", param_env); InterpretCx::new(tcx.at(span), param_env, CompileTimeInterpreter::new()) } -pub(crate) fn eval_promoted<'a, 'mir, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, +pub(crate) fn eval_promoted<'mir, 'tcx>( + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, cid: GlobalId<'tcx>, body: &'mir mir::Body<'tcx>, param_env: ty::ParamEnv<'tcx>, @@ -64,7 +64,7 @@ pub(crate) fn eval_promoted<'a, 'mir, 'tcx>( } fn mplace_to_const<'tcx>( - ecx: &CompileTimeEvalContext<'_, '_, 'tcx>, + ecx: &CompileTimeEvalContext<'_, 'tcx>, mplace: MPlaceTy<'tcx>, ) -> &'tcx ty::Const<'tcx> { let MemPlace { ptr, align, meta } = *mplace; @@ -84,7 +84,7 @@ fn mplace_to_const<'tcx>( } fn op_to_const<'tcx>( - ecx: &CompileTimeEvalContext<'_, '_, 'tcx>, + ecx: &CompileTimeEvalContext<'_, 'tcx>, op: OpTy<'tcx>, ) -> &'tcx ty::Const<'tcx> { // We do not normalize just any data. Only non-union scalars and slices. @@ -137,7 +137,7 @@ fn op_to_const<'tcx>( // Returns a pointer to where the result lives fn eval_body_using_ecx<'mir, 'tcx>( - ecx: &mut CompileTimeEvalContext<'_, 'mir, 'tcx>, + ecx: &mut CompileTimeEvalContext<'mir, 'tcx>, cid: GlobalId<'tcx>, body: &'mir mir::Body<'tcx>, param_env: ty::ParamEnv<'tcx>, @@ -216,7 +216,7 @@ impl Error for ConstEvalError { } // Extra machine state for CTFE, and the Machine instance -pub struct CompileTimeInterpreter<'a, 'mir, 'tcx: 'a+'mir> { +pub struct CompileTimeInterpreter<'mir, 'tcx> { /// When this value is negative, it indicates the number of interpreter /// steps *until* the loop detector is enabled. When it is positive, it is /// the number of steps after the detector has been enabled modulo the loop @@ -224,10 +224,10 @@ pub struct CompileTimeInterpreter<'a, 'mir, 'tcx: 'a+'mir> { pub(super) steps_since_detector_enabled: isize, /// Extra state to detect loops. - pub(super) loop_detector: snapshot::InfiniteLoopDetector<'a, 'mir, 'tcx>, + pub(super) loop_detector: snapshot::InfiniteLoopDetector<'mir, 'tcx>, } -impl<'a, 'mir, 'tcx> CompileTimeInterpreter<'a, 'mir, 'tcx> { +impl<'mir, 'tcx> CompileTimeInterpreter<'mir, 'tcx> { fn new() -> Self { CompileTimeInterpreter { loop_detector: Default::default(), @@ -297,8 +297,8 @@ impl interpret::AllocMap for FxHashMap { } } -type CompileTimeEvalContext<'a, 'mir, 'tcx> = - InterpretCx<'a, 'mir, 'tcx, CompileTimeInterpreter<'a, 'mir, 'tcx>>; +type CompileTimeEvalContext<'mir, 'tcx> = + InterpretCx<'mir, 'tcx, CompileTimeInterpreter<'mir, 'tcx>>; impl interpret::MayLeak for ! { #[inline(always)] @@ -308,8 +308,8 @@ impl interpret::MayLeak for ! { } } -impl<'a, 'mir, 'tcx> interpret::Machine<'a, 'mir, 'tcx> - for CompileTimeInterpreter<'a, 'mir, 'tcx> +impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> + for CompileTimeInterpreter<'mir, 'tcx> { type MemoryKinds = !; type PointerTag = (); @@ -323,12 +323,12 @@ impl<'a, 'mir, 'tcx> interpret::Machine<'a, 'mir, 'tcx> const STATIC_KIND: Option = None; // no copying of statics allowed #[inline(always)] - fn enforce_validity(_ecx: &InterpretCx<'a, 'mir, 'tcx, Self>) -> bool { + fn enforce_validity(_ecx: &InterpretCx<'mir, 'tcx, Self>) -> bool { false // for now, we don't enforce validity } fn find_fn( - ecx: &mut InterpretCx<'a, 'mir, 'tcx, Self>, + ecx: &mut InterpretCx<'mir, 'tcx, Self>, instance: ty::Instance<'tcx>, args: &[OpTy<'tcx>], dest: Option>, @@ -368,7 +368,7 @@ impl<'a, 'mir, 'tcx> interpret::Machine<'a, 'mir, 'tcx> } fn call_intrinsic( - ecx: &mut InterpretCx<'a, 'mir, 'tcx, Self>, + ecx: &mut InterpretCx<'mir, 'tcx, Self>, instance: ty::Instance<'tcx>, args: &[OpTy<'tcx>], dest: PlaceTy<'tcx>, @@ -384,7 +384,7 @@ impl<'a, 'mir, 'tcx> interpret::Machine<'a, 'mir, 'tcx> } fn ptr_op( - _ecx: &InterpretCx<'a, 'mir, 'tcx, Self>, + _ecx: &InterpretCx<'mir, 'tcx, Self>, _bin_op: mir::BinOp, _left: ImmTy<'tcx>, _right: ImmTy<'tcx>, @@ -396,7 +396,7 @@ impl<'a, 'mir, 'tcx> interpret::Machine<'a, 'mir, 'tcx> fn find_foreign_static( _def_id: DefId, - _tcx: TyCtxtAt<'a, 'tcx, 'tcx>, + _tcx: TyCtxtAt<'tcx, 'tcx>, ) -> InterpResult<'tcx, Cow<'tcx, Allocation>> { err!(ReadForeignStatic) } @@ -421,7 +421,7 @@ impl<'a, 'mir, 'tcx> interpret::Machine<'a, 'mir, 'tcx> } fn box_alloc( - _ecx: &mut InterpretCx<'a, 'mir, 'tcx, Self>, + _ecx: &mut InterpretCx<'mir, 'tcx, Self>, _dest: PlaceTy<'tcx>, ) -> InterpResult<'tcx> { Err( @@ -429,7 +429,7 @@ impl<'a, 'mir, 'tcx> interpret::Machine<'a, 'mir, 'tcx> ) } - fn before_terminator(ecx: &mut InterpretCx<'a, 'mir, 'tcx, Self>) -> InterpResult<'tcx> { + fn before_terminator(ecx: &mut InterpretCx<'mir, 'tcx, Self>) -> InterpResult<'tcx> { { let steps = &mut ecx.machine.steps_since_detector_enabled; @@ -455,7 +455,7 @@ impl<'a, 'mir, 'tcx> interpret::Machine<'a, 'mir, 'tcx> #[inline(always)] fn stack_push( - _ecx: &mut InterpretCx<'a, 'mir, 'tcx, Self>, + _ecx: &mut InterpretCx<'mir, 'tcx, Self>, ) -> InterpResult<'tcx> { Ok(()) } @@ -463,7 +463,7 @@ impl<'a, 'mir, 'tcx> interpret::Machine<'a, 'mir, 'tcx> /// Called immediately before a stack frame gets popped. #[inline(always)] fn stack_pop( - _ecx: &mut InterpretCx<'a, 'mir, 'tcx, Self>, + _ecx: &mut InterpretCx<'mir, 'tcx, Self>, _extra: (), ) -> InterpResult<'tcx> { Ok(()) @@ -473,8 +473,8 @@ impl<'a, 'mir, 'tcx> interpret::Machine<'a, 'mir, 'tcx> /// Extracts a field of a (variant of a) const. // this function uses `unwrap` copiously, because an already validated constant must have valid // fields and can thus never fail outside of compiler bugs -pub fn const_field<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, +pub fn const_field<'tcx>( + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, variant: Option, field: mir::Field, @@ -498,8 +498,8 @@ pub fn const_field<'a, 'tcx>( // this function uses `unwrap` copiously, because an already validated constant must have valid // fields and can thus never fail outside of compiler bugs -pub fn const_variant_index<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, +pub fn const_variant_index<'tcx>( + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, val: &'tcx ty::Const<'tcx>, ) -> VariantIdx { @@ -509,8 +509,8 @@ pub fn const_variant_index<'a, 'tcx>( ecx.read_discriminant(op).unwrap().1 } -pub fn error_to_const_error<'a, 'mir, 'tcx>( - ecx: &InterpretCx<'a, 'mir, 'tcx, CompileTimeInterpreter<'a, 'mir, 'tcx>>, +pub fn error_to_const_error<'mir, 'tcx>( + ecx: &InterpretCx<'mir, 'tcx, CompileTimeInterpreter<'mir, 'tcx>>, mut error: InterpErrorInfo<'tcx> ) -> ConstEvalErr<'tcx> { error.print_backtrace(); @@ -518,8 +518,8 @@ pub fn error_to_const_error<'a, 'mir, 'tcx>( ConstEvalErr { error: error.kind, stacktrace, span: ecx.tcx.span } } -fn validate_and_turn_into_const<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn validate_and_turn_into_const<'tcx>( + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, constant: RawConst<'tcx>, key: ty::ParamEnvAnd<'tcx, GlobalId<'tcx>>, ) -> ::rustc::mir::interpret::ConstEvalResult<'tcx> { @@ -561,8 +561,8 @@ fn validate_and_turn_into_const<'a, 'tcx>( }) } -pub fn const_eval_provider<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, +pub fn const_eval_provider<'tcx>( + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, key: ty::ParamEnvAnd<'tcx, GlobalId<'tcx>>, ) -> ::rustc::mir::interpret::ConstEvalResult<'tcx> { // see comment in const_eval_provider for what we're doing here @@ -585,8 +585,8 @@ pub fn const_eval_provider<'a, 'tcx>( }) } -pub fn const_eval_raw_provider<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, +pub fn const_eval_raw_provider<'tcx>( + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, key: ty::ParamEnvAnd<'tcx, GlobalId<'tcx>>, ) -> ::rustc::mir::interpret::ConstEvalRawResult<'tcx> { // Because the constant is computed twice (once per value of `Reveal`), we are at risk of diff --git a/src/librustc_mir/dataflow/drop_flag_effects.rs b/src/librustc_mir/dataflow/drop_flag_effects.rs index b77fdcdd7b6de..dbe5ab902d799 100644 --- a/src/librustc_mir/dataflow/drop_flag_effects.rs +++ b/src/librustc_mir/dataflow/drop_flag_effects.rs @@ -46,7 +46,7 @@ pub fn move_path_children_matching<'tcx, F>(move_data: &MoveData<'tcx>, /// is no need to maintain separate drop flags to track such state. // // FIXME: we have to do something for moving slice patterns. -fn place_contents_drop_state_cannot_differ<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, +fn place_contents_drop_state_cannot_differ<'a, 'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, body: &Body<'tcx>, place: &mir::Place<'tcx>) -> bool { let ty = place.ty(body, tcx).ty; @@ -73,7 +73,7 @@ fn place_contents_drop_state_cannot_differ<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, } pub(crate) fn on_lookup_result_bits<'a, 'gcx, 'tcx, F>( - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, body: &Body<'tcx>, move_data: &MoveData<'tcx>, lookup_result: LookupResult, @@ -91,7 +91,7 @@ pub(crate) fn on_lookup_result_bits<'a, 'gcx, 'tcx, F>( } pub(crate) fn on_all_children_bits<'a, 'gcx, 'tcx, F>( - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, body: &Body<'tcx>, move_data: &MoveData<'tcx>, move_path_index: MovePathIndex, @@ -99,7 +99,7 @@ pub(crate) fn on_all_children_bits<'a, 'gcx, 'tcx, F>( where F: FnMut(MovePathIndex) { fn is_terminal_path<'a, 'gcx, 'tcx>( - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, body: &Body<'tcx>, move_data: &MoveData<'tcx>, path: MovePathIndex) -> bool @@ -109,7 +109,7 @@ pub(crate) fn on_all_children_bits<'a, 'gcx, 'tcx, F>( } fn on_all_children_bits<'a, 'gcx, 'tcx, F>( - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, body: &Body<'tcx>, move_data: &MoveData<'tcx>, move_path_index: MovePathIndex, @@ -132,7 +132,7 @@ pub(crate) fn on_all_children_bits<'a, 'gcx, 'tcx, F>( } pub(crate) fn on_all_drop_children_bits<'a, 'gcx, 'tcx, F>( - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, body: &Body<'tcx>, ctxt: &MoveDataParamEnv<'gcx, 'tcx>, path: MovePathIndex, @@ -155,7 +155,7 @@ pub(crate) fn on_all_drop_children_bits<'a, 'gcx, 'tcx, F>( } pub(crate) fn drop_flag_effects_for_function_entry<'a, 'gcx, 'tcx, F>( - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, body: &Body<'tcx>, ctxt: &MoveDataParamEnv<'gcx, 'tcx>, mut callback: F) @@ -172,7 +172,7 @@ pub(crate) fn drop_flag_effects_for_function_entry<'a, 'gcx, 'tcx, F>( } pub(crate) fn drop_flag_effects_for_location<'a, 'gcx, 'tcx, F>( - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, body: &Body<'tcx>, ctxt: &MoveDataParamEnv<'gcx, 'tcx>, loc: Location, @@ -204,7 +204,7 @@ pub(crate) fn drop_flag_effects_for_location<'a, 'gcx, 'tcx, F>( } pub(crate) fn for_location_inits<'a, 'gcx, 'tcx, F>( - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, body: &Body<'tcx>, move_data: &MoveData<'tcx>, loc: Location, diff --git a/src/librustc_mir/dataflow/impls/borrows.rs b/src/librustc_mir/dataflow/impls/borrows.rs index eedb936aed937..38cb7bd9796c6 100644 --- a/src/librustc_mir/dataflow/impls/borrows.rs +++ b/src/librustc_mir/dataflow/impls/borrows.rs @@ -30,7 +30,7 @@ newtype_index! { /// describing the borrow. These indexes are used for representing the /// borrows in compact bitvectors. pub struct Borrows<'a, 'gcx: 'tcx, 'tcx: 'a> { - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, body: &'a Body<'tcx>, borrow_set: Rc>, @@ -135,7 +135,7 @@ fn precompute_borrows_out_of_scope<'tcx>( impl<'a, 'gcx, 'tcx> Borrows<'a, 'gcx, 'tcx> { crate fn new( - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, body: &'a Body<'tcx>, nonlexical_regioncx: Rc>, borrow_set: &Rc>, diff --git a/src/librustc_mir/dataflow/impls/mod.rs b/src/librustc_mir/dataflow/impls/mod.rs index 55ef861d7926e..3311353ebd3b6 100644 --- a/src/librustc_mir/dataflow/impls/mod.rs +++ b/src/librustc_mir/dataflow/impls/mod.rs @@ -64,13 +64,13 @@ pub(super) mod borrows; /// between this data and `MaybeUninitializedPlaces` yields the set of /// places that would require a dynamic drop-flag at that statement. pub struct MaybeInitializedPlaces<'a, 'gcx: 'tcx, 'tcx: 'a> { - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, body: &'a Body<'tcx>, mdpe: &'a MoveDataParamEnv<'gcx, 'tcx>, } impl<'a, 'gcx: 'tcx, 'tcx> MaybeInitializedPlaces<'a, 'gcx, 'tcx> { - pub fn new(tcx: TyCtxt<'a, 'gcx, 'tcx>, + pub fn new(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, body: &'a Body<'tcx>, mdpe: &'a MoveDataParamEnv<'gcx, 'tcx>) -> Self @@ -119,13 +119,13 @@ impl<'a, 'gcx, 'tcx> HasMoveData<'tcx> for MaybeInitializedPlaces<'a, 'gcx, 'tcx /// between this data and `MaybeInitializedPlaces` yields the set of /// places that would require a dynamic drop-flag at that statement. pub struct MaybeUninitializedPlaces<'a, 'gcx: 'tcx, 'tcx: 'a> { - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, body: &'a Body<'tcx>, mdpe: &'a MoveDataParamEnv<'gcx, 'tcx>, } impl<'a, 'gcx, 'tcx> MaybeUninitializedPlaces<'a, 'gcx, 'tcx> { - pub fn new(tcx: TyCtxt<'a, 'gcx, 'tcx>, + pub fn new(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, body: &'a Body<'tcx>, mdpe: &'a MoveDataParamEnv<'gcx, 'tcx>) -> Self @@ -173,13 +173,13 @@ impl<'a, 'gcx, 'tcx> HasMoveData<'tcx> for MaybeUninitializedPlaces<'a, 'gcx, 't /// this data and `MaybeInitializedPlaces` yields the set of places /// that would require a dynamic drop-flag at that statement. pub struct DefinitelyInitializedPlaces<'a, 'gcx: 'tcx, 'tcx: 'a> { - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, body: &'a Body<'tcx>, mdpe: &'a MoveDataParamEnv<'gcx, 'tcx>, } impl<'a, 'gcx, 'tcx: 'a> DefinitelyInitializedPlaces<'a, 'gcx, 'tcx> { - pub fn new(tcx: TyCtxt<'a, 'gcx, 'tcx>, + pub fn new(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, body: &'a Body<'tcx>, mdpe: &'a MoveDataParamEnv<'gcx, 'tcx>) -> Self @@ -222,13 +222,13 @@ impl<'a, 'gcx, 'tcx: 'a> HasMoveData<'tcx> for DefinitelyInitializedPlaces<'a, ' /// } /// ``` pub struct EverInitializedPlaces<'a, 'gcx: 'tcx, 'tcx: 'a> { - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, body: &'a Body<'tcx>, mdpe: &'a MoveDataParamEnv<'gcx, 'tcx>, } impl<'a, 'gcx: 'tcx, 'tcx: 'a> EverInitializedPlaces<'a, 'gcx, 'tcx> { - pub fn new(tcx: TyCtxt<'a, 'gcx, 'tcx>, + pub fn new(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, body: &'a Body<'tcx>, mdpe: &'a MoveDataParamEnv<'gcx, 'tcx>) -> Self diff --git a/src/librustc_mir/dataflow/mod.rs b/src/librustc_mir/dataflow/mod.rs index 8e2068269ceaa..89b379b95b84c 100644 --- a/src/librustc_mir/dataflow/mod.rs +++ b/src/librustc_mir/dataflow/mod.rs @@ -121,7 +121,7 @@ pub struct MoveDataParamEnv<'gcx, 'tcx> { pub(crate) param_env: ty::ParamEnv<'gcx>, } -pub(crate) fn do_dataflow<'a, 'gcx, 'tcx, BD, P>(tcx: TyCtxt<'a, 'gcx, 'tcx>, +pub(crate) fn do_dataflow<'a, 'gcx, 'tcx, BD, P>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, body: &'a Body<'tcx>, def_id: DefId, attributes: &[ast::Attribute], @@ -139,7 +139,7 @@ pub(crate) fn do_dataflow<'a, 'gcx, 'tcx, BD, P>(tcx: TyCtxt<'a, 'gcx, 'tcx>, impl<'a, 'gcx: 'tcx, 'tcx: 'a, BD> DataflowAnalysis<'a, 'tcx, BD> where BD: BitDenotation<'tcx> { pub(crate) fn run

(self, - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, def_id: DefId, attributes: &[ast::Attribute], p: P) -> DataflowResults<'tcx, BD> diff --git a/src/librustc_mir/dataflow/move_paths/builder.rs b/src/librustc_mir/dataflow/move_paths/builder.rs index 90e6c46f2817e..76926fbd6c476 100644 --- a/src/librustc_mir/dataflow/move_paths/builder.rs +++ b/src/librustc_mir/dataflow/move_paths/builder.rs @@ -14,13 +14,13 @@ use super::IllegalMoveOriginKind::*; struct MoveDataBuilder<'a, 'gcx: 'tcx, 'tcx: 'a> { body: &'a Body<'tcx>, - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, data: MoveData<'tcx>, errors: Vec<(Place<'tcx>, MoveError<'tcx>)>, } impl<'a, 'gcx, 'tcx> MoveDataBuilder<'a, 'gcx, 'tcx> { - fn new(body: &'a Body<'tcx>, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Self { + fn new(body: &'a Body<'tcx>, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Self { let mut move_paths = IndexVec::new(); let mut path_map = IndexVec::new(); let mut init_path_map = IndexVec::new(); @@ -204,7 +204,7 @@ impl<'a, 'gcx, 'tcx> MoveDataBuilder<'a, 'gcx, 'tcx> { pub(super) fn gather_moves<'a, 'gcx, 'tcx>( body: &Body<'tcx>, - tcx: TyCtxt<'a, 'gcx, 'tcx> + tcx: TyCtxt<'tcx, 'gcx, 'tcx> ) -> Result, (MoveData<'tcx>, Vec<(Place<'tcx>, MoveError<'tcx>)>)> { let mut builder = MoveDataBuilder::new(body, tcx); diff --git a/src/librustc_mir/dataflow/move_paths/mod.rs b/src/librustc_mir/dataflow/move_paths/mod.rs index 7d75d352f94c9..315f68b3a5132 100644 --- a/src/librustc_mir/dataflow/move_paths/mod.rs +++ b/src/librustc_mir/dataflow/move_paths/mod.rs @@ -306,7 +306,7 @@ impl<'tcx> MoveError<'tcx> { } impl<'a, 'gcx, 'tcx> MoveData<'tcx> { - pub fn gather_moves(body: &Body<'tcx>, tcx: TyCtxt<'a, 'gcx, 'tcx>) + pub fn gather_moves(body: &Body<'tcx>, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Result, MoveError<'tcx>)>)> { builder::gather_moves(body, tcx) } diff --git a/src/librustc_mir/hair/constant.rs b/src/librustc_mir/hair/constant.rs index 37a2e79dae91f..e8c274177e6d0 100644 --- a/src/librustc_mir/hair/constant.rs +++ b/src/librustc_mir/hair/constant.rs @@ -11,7 +11,7 @@ crate enum LitToConstError { crate fn lit_to_const<'a, 'gcx, 'tcx>( lit: &'tcx ast::LitKind, - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, ty: Ty<'tcx>, neg: bool, ) -> Result<&'tcx ty::Const<'tcx>, LitToConstError> { diff --git a/src/librustc_mir/hair/cx/mod.rs b/src/librustc_mir/hair/cx/mod.rs index f4a23a90dee92..e259c6171a3af 100644 --- a/src/librustc_mir/hair/cx/mod.rs +++ b/src/librustc_mir/hair/cx/mod.rs @@ -22,7 +22,7 @@ use crate::hair::constant::{lit_to_const, LitToConstError}; #[derive(Clone)] pub struct Cx<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, infcx: &'a InferCtxt<'a, 'gcx, 'tcx>, pub root_lint_level: hir::HirId, @@ -200,7 +200,7 @@ impl<'a, 'gcx, 'tcx> Cx<'a, 'gcx, 'tcx> { ty.needs_drop(self.tcx.global_tcx(), param_env) } - pub fn tcx(&self) -> TyCtxt<'a, 'gcx, 'tcx> { + pub fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.tcx } @@ -218,7 +218,7 @@ impl<'a, 'gcx, 'tcx> Cx<'a, 'gcx, 'tcx> { } impl UserAnnotatedTyHelpers<'gcx, 'tcx> for Cx<'_, 'gcx, 'tcx> { - fn tcx(&self) -> TyCtxt<'_, 'gcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.tcx() } diff --git a/src/librustc_mir/hair/pattern/_match.rs b/src/librustc_mir/hair/pattern/_match.rs index 29e9c425685e8..a13a6aaaf9194 100644 --- a/src/librustc_mir/hair/pattern/_match.rs +++ b/src/librustc_mir/hair/pattern/_match.rs @@ -194,11 +194,11 @@ pub fn expand_pattern<'a, 'tcx>(cx: &MatchCheckCtxt<'a, 'tcx>, pat: Pattern<'tcx cx.pattern_arena.alloc(LiteralExpander { tcx: cx.tcx }.fold_pattern(&pat)) } -struct LiteralExpander<'a, 'tcx> { - tcx: TyCtxt<'a, 'tcx, 'tcx> +struct LiteralExpander<'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx> } -impl<'a, 'tcx> LiteralExpander<'a, 'tcx> { +impl LiteralExpander<'tcx> { /// Derefs `val` and potentially unsizes the value if `crty` is an array and `rty` a slice. /// /// `crty` and `rty` can differ because you can use array constants in the presence of slice @@ -239,7 +239,7 @@ impl<'a, 'tcx> LiteralExpander<'a, 'tcx> { } } -impl<'a, 'tcx> PatternFolder<'tcx> for LiteralExpander<'a, 'tcx> { +impl PatternFolder<'tcx> for LiteralExpander<'tcx> { fn fold_pattern(&mut self, pat: &Pattern<'tcx>) -> Pattern<'tcx> { debug!("fold_pattern {:?} {:?} {:?}", pat, pat.ty.sty, pat.kind); match (&pat.ty.sty, &*pat.kind) { @@ -350,7 +350,7 @@ impl<'p, 'tcx> FromIterator; 2]>> for Matrix<'p, 'tc } pub struct MatchCheckCtxt<'a, 'tcx: 'a> { - pub tcx: TyCtxt<'a, 'tcx, 'tcx>, + pub tcx: TyCtxt<'tcx, 'tcx, 'tcx>, /// The module in which the match occurs. This is necessary for /// checking inhabited-ness of types because whether a type is (visibly) /// inhabited can depend on whether it was defined in the current module or @@ -365,7 +365,7 @@ pub struct MatchCheckCtxt<'a, 'tcx: 'a> { impl<'a, 'tcx> MatchCheckCtxt<'a, 'tcx> { pub fn create_and_enter( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, module: DefId, f: F) -> R @@ -827,7 +827,7 @@ struct IntRange<'tcx> { } impl<'tcx> IntRange<'tcx> { - fn from_ctor(tcx: TyCtxt<'_, 'tcx, 'tcx>, + fn from_ctor(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ctor: &Constructor<'tcx>) -> Option> { // Floating-point ranges are permitted and we don't want @@ -867,7 +867,7 @@ impl<'tcx> IntRange<'tcx> { } } - fn from_pat(tcx: TyCtxt<'_, 'tcx, 'tcx>, + fn from_pat(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, mut pat: &Pattern<'tcx>) -> Option> { let range = loop { @@ -889,7 +889,7 @@ impl<'tcx> IntRange<'tcx> { } // The return value of `signed_bias` should be XORed with an endpoint to encode/decode it. - fn signed_bias(tcx: TyCtxt<'_, 'tcx, 'tcx>, ty: Ty<'tcx>) -> u128 { + fn signed_bias(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ty: Ty<'tcx>) -> u128 { match ty.sty { ty::Int(ity) => { let bits = Integer::from_attr(&tcx, SignedInt(ity)).size().bits() as u128; @@ -901,7 +901,7 @@ impl<'tcx> IntRange<'tcx> { /// Converts a `RangeInclusive` to a `ConstantValue` or inclusive `ConstantRange`. fn range_to_ctor( - tcx: TyCtxt<'_, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ty: Ty<'tcx>, r: RangeInclusive, ) -> Constructor<'tcx> { @@ -918,7 +918,7 @@ impl<'tcx> IntRange<'tcx> { /// Returns a collection of ranges that spans the values covered by `ranges`, subtracted /// by the values covered by `self`: i.e., `ranges \ self` (in set notation). fn subtract_from(self, - tcx: TyCtxt<'_, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ranges: Vec>) -> Vec> { let ranges = ranges.into_iter().filter_map(|r| { @@ -988,7 +988,7 @@ enum MissingCtors<'tcx> { // to compute the full set.) fn compute_missing_ctors<'a, 'tcx: 'a>( info: MissingCtorsInfo, - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, all_ctors: &Vec>, used_ctors: &Vec>, ) -> MissingCtors<'tcx> { @@ -1476,7 +1476,10 @@ fn slice_pat_covered_by_const<'tcx>( // Whether to evaluate a constructor using exhaustive integer matching. This is true if the // constructor is a range or constant with an integer type. -fn should_treat_range_exhaustively(tcx: TyCtxt<'_, 'tcx, 'tcx>, ctor: &Constructor<'tcx>) -> bool { +fn should_treat_range_exhaustively( + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + ctor: &Constructor<'tcx>, +) -> bool { let ty = match ctor { ConstantValue(value) => value.ty, ConstantRange(_, _, ty, _) => ty, @@ -1522,7 +1525,7 @@ fn should_treat_range_exhaustively(tcx: TyCtxt<'_, 'tcx, 'tcx>, ctor: &Construct /// between every pair of boundary points. (This essentially sums up to performing the intuitive /// merging operation depicted above.) fn split_grouped_constructors<'p, 'a: 'p, 'tcx: 'a>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ctors: Vec>, &Matrix(ref m): &Matrix<'p, 'tcx>, ty: Ty<'tcx>, @@ -1600,7 +1603,7 @@ fn split_grouped_constructors<'p, 'a: 'p, 'tcx: 'a>( /// Checks whether there exists any shared value in either `ctor` or `pat` by intersecting them. fn constructor_intersects_pattern<'p, 'a: 'p, 'tcx: 'a>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ctor: &Constructor<'tcx>, pat: &'p Pattern<'tcx>, ) -> Option; 2]>> { @@ -1628,7 +1631,7 @@ fn constructor_intersects_pattern<'p, 'a: 'p, 'tcx: 'a>( } fn constructor_covered_by_range<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ctor: &Constructor<'tcx>, pat: &Pattern<'tcx>, ) -> Result { diff --git a/src/librustc_mir/hair/pattern/check_match.rs b/src/librustc_mir/hair/pattern/check_match.rs index 215faee953230..fa71611e230bf 100644 --- a/src/librustc_mir/hair/pattern/check_match.rs +++ b/src/librustc_mir/hair/pattern/check_match.rs @@ -26,7 +26,7 @@ use std::slice; use syntax::ptr::P; use syntax_pos::{Span, DUMMY_SP, MultiSpan}; -pub(crate) fn check_match<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) { +pub(crate) fn check_match<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { let body_id = if let Some(id) = tcx.hir().as_local_hir_id(def_id) { tcx.hir().body_owned_by(id) } else { @@ -48,7 +48,7 @@ fn create_e0004<'a>(sess: &'a Session, sp: Span, error_message: String) -> Diagn } struct MatchVisitor<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, body_owner: DefId, tables: &'a ty::TypeckTables<'tcx>, param_env: ty::ParamEnv<'tcx>, diff --git a/src/librustc_mir/hair/pattern/mod.rs b/src/librustc_mir/hair/pattern/mod.rs index 716838b4fc597..00c1568ebe914 100644 --- a/src/librustc_mir/hair/pattern/mod.rs +++ b/src/librustc_mir/hair/pattern/mod.rs @@ -327,7 +327,7 @@ impl<'tcx> fmt::Display for Pattern<'tcx> { } pub struct PatternContext<'a, 'tcx: 'a> { - pub tcx: TyCtxt<'a, 'tcx, 'tcx>, + pub tcx: TyCtxt<'tcx, 'tcx, 'tcx>, pub param_env: ty::ParamEnv<'tcx>, pub tables: &'a ty::TypeckTables<'tcx>, pub substs: SubstsRef<'tcx>, @@ -335,7 +335,7 @@ pub struct PatternContext<'a, 'tcx: 'a> { } impl<'a, 'tcx> Pattern<'tcx> { - pub fn from_hir(tcx: TyCtxt<'a, 'tcx, 'tcx>, + pub fn from_hir(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, param_env_and_substs: ty::ParamEnvAnd<'tcx, SubstsRef<'tcx>>, tables: &'a ty::TypeckTables<'tcx>, pat: &'tcx hir::Pat) -> Self { @@ -351,7 +351,7 @@ impl<'a, 'tcx> Pattern<'tcx> { } impl<'a, 'tcx> PatternContext<'a, 'tcx> { - pub fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>, + pub fn new(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, param_env_and_substs: ty::ParamEnvAnd<'tcx, SubstsRef<'tcx>>, tables: &'a ty::TypeckTables<'tcx>) -> Self { PatternContext { @@ -1055,7 +1055,7 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { } impl UserAnnotatedTyHelpers<'tcx, 'tcx> for PatternContext<'_, 'tcx> { - fn tcx(&self) -> TyCtxt<'_, 'tcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'tcx, 'tcx, 'tcx> { self.tcx } @@ -1243,7 +1243,7 @@ impl<'tcx> PatternFoldable<'tcx> for PatternKind<'tcx> { } pub fn compare_const_vals<'a, 'gcx, 'tcx>( - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, a: &'tcx ty::Const<'tcx>, b: &'tcx ty::Const<'tcx>, ty: ty::ParamEnvAnd<'tcx, Ty<'tcx>>, diff --git a/src/librustc_mir/hair/util.rs b/src/librustc_mir/hair/util.rs index c9dae6990795b..32ea39e35a5e5 100644 --- a/src/librustc_mir/hair/util.rs +++ b/src/librustc_mir/hair/util.rs @@ -2,7 +2,7 @@ use rustc::hir; use rustc::ty::{self, CanonicalUserType, TyCtxt, UserType}; crate trait UserAnnotatedTyHelpers<'gcx: 'tcx, 'tcx> { - fn tcx(&self) -> TyCtxt<'_, 'gcx, 'tcx>; + fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx>; fn tables(&self) -> &ty::TypeckTables<'tcx>; diff --git a/src/librustc_mir/interpret/cast.rs b/src/librustc_mir/interpret/cast.rs index 6392e0996aec2..fbacdf6cd93bb 100644 --- a/src/librustc_mir/interpret/cast.rs +++ b/src/librustc_mir/interpret/cast.rs @@ -13,7 +13,7 @@ use rustc::mir::CastKind; use super::{InterpretCx, Machine, PlaceTy, OpTy, Immediate}; -impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> InterpretCx<'a, 'mir, 'tcx, M> { +impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpretCx<'mir, 'tcx, M> { fn type_is_fat_ptr(&self, ty: Ty<'tcx>) -> bool { match ty.sty { ty::RawPtr(ty::TypeAndMut { ty, .. }) | diff --git a/src/librustc_mir/interpret/eval_context.rs b/src/librustc_mir/interpret/eval_context.rs index a34889e6f33bc..f085580f68cc7 100644 --- a/src/librustc_mir/interpret/eval_context.rs +++ b/src/librustc_mir/interpret/eval_context.rs @@ -26,18 +26,18 @@ use super::{ Memory, Machine }; -pub struct InterpretCx<'a, 'mir, 'tcx: 'a + 'mir, M: Machine<'a, 'mir, 'tcx>> { +pub struct InterpretCx<'mir, 'tcx, M: Machine<'mir, 'tcx>> { /// Stores the `Machine` instance. pub machine: M, /// The results of the type checker, from rustc. - pub tcx: TyCtxtAt<'a, 'tcx, 'tcx>, + pub tcx: TyCtxtAt<'tcx, 'tcx>, /// Bounds in scope for polymorphic evaluations. pub(crate) param_env: ty::ParamEnv<'tcx>, /// The virtual memory system. - pub(crate) memory: Memory<'a, 'mir, 'tcx, M>, + pub(crate) memory: Memory<'mir, 'tcx, M>, /// The virtual call stack. pub(crate) stack: Vec>, @@ -160,8 +160,8 @@ impl<'tcx, Tag: Copy + 'static> LocalState<'tcx, Tag> { } } -impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> HasDataLayout - for InterpretCx<'a, 'mir, 'tcx, M> +impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> HasDataLayout + for InterpretCx<'mir, 'tcx, M> { #[inline] fn data_layout(&self) -> &layout::TargetDataLayout { @@ -169,25 +169,25 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> HasDataLayout } } -impl<'a, 'mir, 'tcx, M> layout::HasTyCtxt<'tcx> for InterpretCx<'a, 'mir, 'tcx, M> - where M: Machine<'a, 'mir, 'tcx> +impl<'mir, 'tcx, M> layout::HasTyCtxt<'tcx> for InterpretCx<'mir, 'tcx, M> + where M: Machine<'mir, 'tcx> { #[inline] - fn tcx<'d>(&'d self) -> TyCtxt<'d, 'tcx, 'tcx> { + fn tcx<'d>(&'d self) -> TyCtxt<'tcx, 'tcx, 'tcx> { *self.tcx } } -impl<'a, 'mir, 'tcx, M> layout::HasParamEnv<'tcx> for InterpretCx<'a, 'mir, 'tcx, M> - where M: Machine<'a, 'mir, 'tcx> +impl<'mir, 'tcx, M> layout::HasParamEnv<'tcx> for InterpretCx<'mir, 'tcx, M> + where M: Machine<'mir, 'tcx> { fn param_env(&self) -> ty::ParamEnv<'tcx> { self.param_env } } -impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> LayoutOf - for InterpretCx<'a, 'mir, 'tcx, M> +impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> LayoutOf + for InterpretCx<'mir, 'tcx, M> { type Ty = Ty<'tcx>; type TyLayout = InterpResult<'tcx, TyLayout<'tcx>>; @@ -199,9 +199,9 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> LayoutOf } } -impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> InterpretCx<'a, 'mir, 'tcx, M> { +impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpretCx<'mir, 'tcx, M> { pub fn new( - tcx: TyCtxtAt<'a, 'tcx, 'tcx>, + tcx: TyCtxtAt<'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, machine: M, ) -> Self { @@ -216,12 +216,12 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> InterpretCx<'a, 'mir, 'tc } #[inline(always)] - pub fn memory(&self) -> &Memory<'a, 'mir, 'tcx, M> { + pub fn memory(&self) -> &Memory<'mir, 'tcx, M> { &self.memory } #[inline(always)] - pub fn memory_mut(&mut self) -> &mut Memory<'a, 'mir, 'tcx, M> { + pub fn memory_mut(&mut self) -> &mut Memory<'mir, 'tcx, M> { &mut self.memory } diff --git a/src/librustc_mir/interpret/intrinsics.rs b/src/librustc_mir/interpret/intrinsics.rs index 8888d7ded8bb4..beb5049307117 100644 --- a/src/librustc_mir/interpret/intrinsics.rs +++ b/src/librustc_mir/interpret/intrinsics.rs @@ -39,7 +39,7 @@ fn numeric_intrinsic<'tcx, Tag>( Ok(Scalar::from_uint(bits_out, size)) } -impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> InterpretCx<'a, 'mir, 'tcx, M> { +impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpretCx<'mir, 'tcx, M> { /// Returns `true` if emulation happened. pub fn emulate_intrinsic( &mut self, diff --git a/src/librustc_mir/interpret/intrinsics/type_name.rs b/src/librustc_mir/interpret/intrinsics/type_name.rs index 1270b35ebb955..5ef5899e60eef 100644 --- a/src/librustc_mir/interpret/intrinsics/type_name.rs +++ b/src/librustc_mir/interpret/intrinsics/type_name.rs @@ -9,12 +9,12 @@ use rustc::hir::def_id::CrateNum; use std::fmt::Write; use rustc::mir::interpret::{Allocation, ConstValue}; -struct AbsolutePathPrinter<'a, 'tcx> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, +struct AbsolutePathPrinter<'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, path: String, } -impl<'tcx> Printer<'tcx, 'tcx> for AbsolutePathPrinter<'_, 'tcx> { +impl<'tcx> Printer<'tcx, 'tcx> for AbsolutePathPrinter<'tcx> { type Error = std::fmt::Error; type Path = Self; @@ -23,7 +23,7 @@ impl<'tcx> Printer<'tcx, 'tcx> for AbsolutePathPrinter<'_, 'tcx> { type DynExistential = Self; type Const = Self; - fn tcx<'a>(&'a self) -> TyCtxt<'a, 'tcx, 'tcx> { + fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx, 'tcx> { self.tcx } @@ -167,7 +167,7 @@ impl<'tcx> Printer<'tcx, 'tcx> for AbsolutePathPrinter<'_, 'tcx> { } } } -impl PrettyPrinter<'tcx, 'tcx> for AbsolutePathPrinter<'_, 'tcx> { +impl PrettyPrinter<'tcx, 'tcx> for AbsolutePathPrinter<'tcx> { fn region_should_not_be_omitted( &self, _region: ty::Region<'_>, @@ -204,7 +204,7 @@ impl PrettyPrinter<'tcx, 'tcx> for AbsolutePathPrinter<'_, 'tcx> { } } -impl Write for AbsolutePathPrinter<'_, '_> { +impl Write for AbsolutePathPrinter<'_> { fn write_str(&mut self, s: &str) -> std::fmt::Result { Ok(self.path.push_str(s)) } @@ -212,7 +212,7 @@ impl Write for AbsolutePathPrinter<'_, '_> { /// Produces an absolute path representation of the given type. See also the documentation on /// `std::any::type_name` -pub fn type_name<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ty: Ty<'tcx>) -> &'tcx ty::Const<'tcx> { +pub fn type_name<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ty: Ty<'tcx>) -> &'tcx ty::Const<'tcx> { let alloc = alloc_type_name(tcx, ty); tcx.mk_const(ty::Const { val: ConstValue::Slice { @@ -226,7 +226,7 @@ pub fn type_name<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ty: Ty<'tcx>) -> &'tcx t /// Directly returns an `Allocation` containing an absolute path representation of the given type. pub(super) fn alloc_type_name<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ty: Ty<'tcx> ) -> &'tcx Allocation { let path = AbsolutePathPrinter { tcx, path: String::new() }.print_type(ty).unwrap().path; diff --git a/src/librustc_mir/interpret/machine.rs b/src/librustc_mir/interpret/machine.rs index 7ee77a9a05f8b..32ab29114f2cd 100644 --- a/src/librustc_mir/interpret/machine.rs +++ b/src/librustc_mir/interpret/machine.rs @@ -58,7 +58,7 @@ pub trait AllocMap { /// Methods of this trait signifies a point where CTFE evaluation would fail /// and some use case dependent behaviour can instead be applied. -pub trait Machine<'a, 'mir, 'tcx>: Sized { +pub trait Machine<'mir, 'tcx>: Sized { /// Additional memory kinds a machine wishes to distinguish from the builtin ones type MemoryKinds: ::std::fmt::Debug + MayLeak + Eq + 'static; @@ -95,11 +95,11 @@ pub trait Machine<'a, 'mir, 'tcx>: Sized { const STATIC_KIND: Option; /// Whether to enforce the validity invariant - fn enforce_validity(ecx: &InterpretCx<'a, 'mir, 'tcx, Self>) -> bool; + fn enforce_validity(ecx: &InterpretCx<'mir, 'tcx, Self>) -> bool; /// Called before a basic block terminator is executed. /// You can use this to detect endlessly running programs. - fn before_terminator(ecx: &mut InterpretCx<'a, 'mir, 'tcx, Self>) -> InterpResult<'tcx>; + fn before_terminator(ecx: &mut InterpretCx<'mir, 'tcx, Self>) -> InterpResult<'tcx>; /// Entry point to all function calls. /// @@ -112,7 +112,7 @@ pub trait Machine<'a, 'mir, 'tcx>: Sized { /// Passing `dest`and `ret` in the same `Option` proved very annoying when only one of them /// was used. fn find_fn( - ecx: &mut InterpretCx<'a, 'mir, 'tcx, Self>, + ecx: &mut InterpretCx<'mir, 'tcx, Self>, instance: ty::Instance<'tcx>, args: &[OpTy<'tcx, Self::PointerTag>], dest: Option>, @@ -122,7 +122,7 @@ pub trait Machine<'a, 'mir, 'tcx>: Sized { /// Directly process an intrinsic without pushing a stack frame. /// If this returns successfully, the engine will take care of jumping to the next block. fn call_intrinsic( - ecx: &mut InterpretCx<'a, 'mir, 'tcx, Self>, + ecx: &mut InterpretCx<'mir, 'tcx, Self>, instance: ty::Instance<'tcx>, args: &[OpTy<'tcx, Self::PointerTag>], dest: PlaceTy<'tcx, Self::PointerTag>, @@ -137,7 +137,7 @@ pub trait Machine<'a, 'mir, 'tcx>: Sized { /// This allocation will then be fed to `tag_allocation` to initialize the "extra" state. fn find_foreign_static( def_id: DefId, - tcx: TyCtxtAt<'a, 'tcx, 'tcx>, + tcx: TyCtxtAt<'tcx, 'tcx>, ) -> InterpResult<'tcx, Cow<'tcx, Allocation>>; /// Called for all binary operations on integer(-like) types when one operand is a pointer @@ -145,7 +145,7 @@ pub trait Machine<'a, 'mir, 'tcx>: Sized { /// /// Returns a (value, overflowed) pair if the operation succeeded fn ptr_op( - ecx: &InterpretCx<'a, 'mir, 'tcx, Self>, + ecx: &InterpretCx<'mir, 'tcx, Self>, bin_op: mir::BinOp, left: ImmTy<'tcx, Self::PointerTag>, right: ImmTy<'tcx, Self::PointerTag>, @@ -153,7 +153,7 @@ pub trait Machine<'a, 'mir, 'tcx>: Sized { /// Heap allocations via the `box` keyword. fn box_alloc( - ecx: &mut InterpretCx<'a, 'mir, 'tcx, Self>, + ecx: &mut InterpretCx<'mir, 'tcx, Self>, dest: PlaceTy<'tcx, Self::PointerTag>, ) -> InterpResult<'tcx>; @@ -193,7 +193,7 @@ pub trait Machine<'a, 'mir, 'tcx>: Sized { /// Executes a retagging operation #[inline] fn retag( - _ecx: &mut InterpretCx<'a, 'mir, 'tcx, Self>, + _ecx: &mut InterpretCx<'mir, 'tcx, Self>, _kind: mir::RetagKind, _place: PlaceTy<'tcx, Self::PointerTag>, ) -> InterpResult<'tcx> { @@ -202,12 +202,12 @@ pub trait Machine<'a, 'mir, 'tcx>: Sized { /// Called immediately before a new stack frame got pushed fn stack_push( - ecx: &mut InterpretCx<'a, 'mir, 'tcx, Self>, + ecx: &mut InterpretCx<'mir, 'tcx, Self>, ) -> InterpResult<'tcx, Self::FrameExtra>; /// Called immediately after a stack frame gets popped fn stack_pop( - ecx: &mut InterpretCx<'a, 'mir, 'tcx, Self>, + ecx: &mut InterpretCx<'mir, 'tcx, Self>, extra: Self::FrameExtra, ) -> InterpResult<'tcx>; } diff --git a/src/librustc_mir/interpret/memory.rs b/src/librustc_mir/interpret/memory.rs index 7126cd86a1959..8f941ed5c6235 100644 --- a/src/librustc_mir/interpret/memory.rs +++ b/src/librustc_mir/interpret/memory.rs @@ -45,7 +45,7 @@ impl MayLeak for MemoryKind { // `Memory` has to depend on the `Machine` because some of its operations // (e.g., `get`) call a `Machine` hook. -pub struct Memory<'a, 'mir, 'tcx: 'a + 'mir, M: Machine<'a, 'mir, 'tcx>> { +pub struct Memory<'mir, 'tcx, M: Machine<'mir, 'tcx>> { /// Allocations local to this instance of the miri engine. The kind /// helps ensure that the same mechanism is used for allocation and /// deallocation. When an allocation is not found here, it is a @@ -66,11 +66,11 @@ pub struct Memory<'a, 'mir, 'tcx: 'a + 'mir, M: Machine<'a, 'mir, 'tcx>> { pub extra: M::MemoryExtra, /// Lets us implement `HasDataLayout`, which is awfully convenient. - pub(super) tcx: TyCtxtAt<'a, 'tcx, 'tcx>, + pub(super) tcx: TyCtxtAt<'tcx, 'tcx>, } -impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> HasDataLayout - for Memory<'a, 'mir, 'tcx, M> +impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> HasDataLayout + for Memory<'mir, 'tcx, M> { #[inline] fn data_layout(&self) -> &TargetDataLayout { @@ -80,12 +80,12 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> HasDataLayout // FIXME: Really we shouldn't clone memory, ever. Snapshot machinery should instead // carefully copy only the reachable parts. -impl<'a, 'mir, 'tcx, M> +impl<'mir, 'tcx, M> Clone for - Memory<'a, 'mir, 'tcx, M> + Memory<'mir, 'tcx, M> where - M: Machine<'a, 'mir, 'tcx, PointerTag=(), AllocExtra=(), MemoryExtra=()>, + M: Machine<'mir, 'tcx, PointerTag=(), AllocExtra=(), MemoryExtra=()>, M::MemoryMap: AllocMap, Allocation)>, { fn clone(&self) -> Self { @@ -98,8 +98,8 @@ where } } -impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> { - pub fn new(tcx: TyCtxtAt<'a, 'tcx, 'tcx>) -> Self { +impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> { + pub fn new(tcx: TyCtxtAt<'tcx, 'tcx>) -> Self { Memory { alloc_map: M::MemoryMap::default(), dead_alloc_map: FxHashMap::default(), @@ -312,7 +312,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> { } /// Allocation accessors -impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> { +impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> { /// Helper function to obtain the global (tcx) allocation for a static. /// This attempts to return a reference to an existing allocation if /// one can be found in `tcx`. That, however, is only possible if `tcx` and @@ -329,7 +329,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> { /// another static), those inner references only exist in "resolved" form. fn get_static_alloc( id: AllocId, - tcx: TyCtxtAt<'a, 'tcx, 'tcx>, + tcx: TyCtxtAt<'tcx, 'tcx>, memory_extra: &M::MemoryExtra, ) -> InterpResult<'tcx, Cow<'tcx, Allocation>> { let alloc = tcx.alloc_map.lock().get(id); @@ -623,7 +623,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> { } /// Byte Accessors -impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> { +impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> { pub fn read_bytes( &self, ptr: Scalar, @@ -639,9 +639,9 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> { } /// Interning (for CTFE) -impl<'a, 'mir, 'tcx, M> Memory<'a, 'mir, 'tcx, M> +impl<'mir, 'tcx, M> Memory<'mir, 'tcx, M> where - M: Machine<'a, 'mir, 'tcx, PointerTag=(), AllocExtra=(), MemoryExtra=()>, + M: Machine<'mir, 'tcx, PointerTag=(), AllocExtra=(), MemoryExtra=()>, // FIXME: Working around https://github.com/rust-lang/rust/issues/24159 M::MemoryMap: AllocMap, Allocation)>, { @@ -689,7 +689,7 @@ where } /// Reading and writing. -impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> { +impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> { pub fn copy( &mut self, src: Scalar, @@ -806,7 +806,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> { } /// Undefined bytes -impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> { +impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> { // FIXME: Add a fast version for the common, nonoverlapping case fn copy_undef_mask( &mut self, diff --git a/src/librustc_mir/interpret/operand.rs b/src/librustc_mir/interpret/operand.rs index 7c83bf1d27d94..87537ba57ae55 100644 --- a/src/librustc_mir/interpret/operand.rs +++ b/src/librustc_mir/interpret/operand.rs @@ -211,7 +211,7 @@ pub(super) fn from_known_layout<'tcx>( } } -impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> InterpretCx<'a, 'mir, 'tcx, M> { +impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpretCx<'mir, 'tcx, M> { /// Try reading an immediate in memory; this is interesting particularly for `ScalarPair`. /// Returns `None` if the layout does not permit loading this as a value. fn try_read_immediate_from_mplace( diff --git a/src/librustc_mir/interpret/operator.rs b/src/librustc_mir/interpret/operator.rs index db7da9359de7b..e8a691733791a 100644 --- a/src/librustc_mir/interpret/operator.rs +++ b/src/librustc_mir/interpret/operator.rs @@ -7,7 +7,7 @@ use rustc::mir::interpret::{InterpResult, Scalar}; use super::{InterpretCx, PlaceTy, Immediate, Machine, ImmTy}; -impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> InterpretCx<'a, 'mir, 'tcx, M> { +impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpretCx<'mir, 'tcx, M> { /// Applies the binary operation `op` to the two operands and writes a tuple of the result /// and a boolean signifying the potential overflow to the destination. pub fn binop_with_overflow( @@ -36,7 +36,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> InterpretCx<'a, 'mir, 'tcx, M> } } -impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> InterpretCx<'a, 'mir, 'tcx, M> { +impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpretCx<'mir, 'tcx, M> { fn binary_char_op( &self, bin_op: mir::BinOp, diff --git a/src/librustc_mir/interpret/place.rs b/src/librustc_mir/interpret/place.rs index 758230e2b7dcb..f5d30d2aeb351 100644 --- a/src/librustc_mir/interpret/place.rs +++ b/src/librustc_mir/interpret/place.rs @@ -290,11 +290,11 @@ impl<'tcx, Tag: ::std::fmt::Debug> PlaceTy<'tcx, Tag> { } // separating the pointer tag for `impl Trait`, see https://github.com/rust-lang/rust/issues/54385 -impl<'a, 'mir, 'tcx, Tag, M> InterpretCx<'a, 'mir, 'tcx, M> +impl<'mir, 'tcx, Tag, M> InterpretCx<'mir, 'tcx, M> where // FIXME: Working around https://github.com/rust-lang/rust/issues/54385 Tag: ::std::fmt::Debug + Copy + Eq + Hash + 'static, - M: Machine<'a, 'mir, 'tcx, PointerTag=Tag>, + M: Machine<'mir, 'tcx, PointerTag=Tag>, // FIXME: Working around https://github.com/rust-lang/rust/issues/24159 M::MemoryMap: AllocMap, Allocation)>, M::AllocExtra: AllocationExtra, @@ -397,7 +397,7 @@ where &self, base: MPlaceTy<'tcx, Tag>, ) -> - InterpResult<'tcx, impl Iterator>> + 'a> + InterpResult<'tcx, impl Iterator>> + 'tcx> { let len = base.len(self)?; // also asserts that we have a type where this makes sense let stride = match base.layout.fields { diff --git a/src/librustc_mir/interpret/snapshot.rs b/src/librustc_mir/interpret/snapshot.rs index 4e13291c787da..6e687af3119e3 100644 --- a/src/librustc_mir/interpret/snapshot.rs +++ b/src/librustc_mir/interpret/snapshot.rs @@ -28,7 +28,7 @@ use super::{Frame, Memory, Operand, MemPlace, Place, Immediate, ScalarMaybeUndef use crate::const_eval::CompileTimeInterpreter; #[derive(Default)] -pub(crate) struct InfiniteLoopDetector<'a, 'mir, 'tcx: 'a + 'mir> { +pub(crate) struct InfiniteLoopDetector<'mir, 'tcx> { /// The set of all `InterpSnapshot` *hashes* observed by this detector. /// /// When a collision occurs in this table, we store the full snapshot in @@ -40,16 +40,16 @@ pub(crate) struct InfiniteLoopDetector<'a, 'mir, 'tcx: 'a + 'mir> { /// An `InterpSnapshot` will only be fully cloned once it has caused a /// collision in `hashes`. As a result, the detector must observe at least /// *two* full cycles of an infinite loop before it triggers. - snapshots: FxHashSet>, + snapshots: FxHashSet>, } -impl<'a, 'mir, 'tcx> InfiniteLoopDetector<'a, 'mir, 'tcx> +impl<'mir, 'tcx> InfiniteLoopDetector<'mir, 'tcx> { pub fn observe_and_analyze<'b>( &mut self, - tcx: TyCtxt<'b, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, span: Span, - memory: &Memory<'a, 'mir, 'tcx, CompileTimeInterpreter<'a, 'mir, 'tcx>>, + memory: &Memory<'mir, 'tcx, CompileTimeInterpreter<'mir, 'tcx>>, stack: &[Frame<'mir, 'tcx>], ) -> InterpResult<'tcx, ()> { // Compute stack's hash before copying anything @@ -373,8 +373,8 @@ impl_stable_hash_for!(struct LocalState<'tcx> { layout -> _, }); -impl<'a, 'b, 'mir, 'tcx: 'a+'mir> SnapshotContext<'b> - for Memory<'a, 'mir, 'tcx, CompileTimeInterpreter<'a, 'mir, 'tcx>> +impl<'b, 'mir, 'tcx> SnapshotContext<'b> + for Memory<'mir, 'tcx, CompileTimeInterpreter<'mir, 'tcx>> { fn resolve(&'b self, id: &AllocId) -> Option<&'b Allocation> { self.get(*id).ok() @@ -384,15 +384,14 @@ impl<'a, 'b, 'mir, 'tcx: 'a+'mir> SnapshotContext<'b> /// The virtual machine state during const-evaluation at a given point in time. /// We assume the `CompileTimeInterpreter` has no interesting extra state that /// is worth considering here. -struct InterpSnapshot<'a, 'mir, 'tcx: 'a + 'mir> { - memory: Memory<'a, 'mir, 'tcx, CompileTimeInterpreter<'a, 'mir, 'tcx>>, +struct InterpSnapshot<'mir, 'tcx> { + memory: Memory<'mir, 'tcx, CompileTimeInterpreter<'mir, 'tcx>>, stack: Vec>, } -impl<'a, 'mir, 'tcx: 'a + 'mir> InterpSnapshot<'a, 'mir, 'tcx> -{ +impl InterpSnapshot<'mir, 'tcx> { fn new( - memory: &Memory<'a, 'mir, 'tcx, CompileTimeInterpreter<'a, 'mir, 'tcx>>, + memory: &Memory<'mir, 'tcx, CompileTimeInterpreter<'mir, 'tcx>>, stack: &[Frame<'mir, 'tcx>] ) -> Self { InterpSnapshot { @@ -411,8 +410,7 @@ impl<'a, 'mir, 'tcx: 'a + 'mir> InterpSnapshot<'a, 'mir, 'tcx> } -impl<'a, 'mir, 'tcx> Hash for InterpSnapshot<'a, 'mir, 'tcx> -{ +impl<'mir, 'tcx> Hash for InterpSnapshot<'mir, 'tcx> { fn hash(&self, state: &mut H) { // Implement in terms of hash stable, so that k1 == k2 -> hash(k1) == hash(k2) let mut hcx = self.memory.tcx.get_stable_hashing_context(); @@ -422,17 +420,15 @@ impl<'a, 'mir, 'tcx> Hash for InterpSnapshot<'a, 'mir, 'tcx> } } -impl_stable_hash_for!(impl<> for struct InterpSnapshot<'_, 'mir, 'tcx> { +impl_stable_hash_for!(impl<> for struct InterpSnapshot<'mir, 'tcx> { // Not hashing memory: Avoid hashing memory all the time during execution memory -> _, stack, }); -impl<'a, 'mir, 'tcx> Eq for InterpSnapshot<'a, 'mir, 'tcx> -{} +impl<'mir, 'tcx> Eq for InterpSnapshot<'mir, 'tcx> {} -impl<'a, 'mir, 'tcx> PartialEq for InterpSnapshot<'a, 'mir, 'tcx> -{ +impl<'mir, 'tcx> PartialEq for InterpSnapshot<'mir, 'tcx> { fn eq(&self, other: &Self) -> bool { // FIXME: This looks to be a *ridiculously expensive* comparison operation. // Doesn't this make tons of copies? Either `snapshot` is very badly named, diff --git a/src/librustc_mir/interpret/step.rs b/src/librustc_mir/interpret/step.rs index 9312d71188c97..2f99973b90d4a 100644 --- a/src/librustc_mir/interpret/step.rs +++ b/src/librustc_mir/interpret/step.rs @@ -35,7 +35,7 @@ fn binop_right_homogeneous(op: mir::BinOp) -> bool { } } -impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> InterpretCx<'a, 'mir, 'tcx, M> { +impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpretCx<'mir, 'tcx, M> { pub fn run(&mut self) -> InterpResult<'tcx> { while self.step()? {} Ok(()) diff --git a/src/librustc_mir/interpret/terminator.rs b/src/librustc_mir/interpret/terminator.rs index ff8d6804febbd..316a95e9400b4 100644 --- a/src/librustc_mir/interpret/terminator.rs +++ b/src/librustc_mir/interpret/terminator.rs @@ -11,7 +11,7 @@ use super::{ InterpretCx, Machine, Immediate, OpTy, ImmTy, PlaceTy, MPlaceTy, StackPopCleanup }; -impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> InterpretCx<'a, 'mir, 'tcx, M> { +impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpretCx<'mir, 'tcx, M> { #[inline] pub fn goto_block(&mut self, target: Option) -> InterpResult<'tcx> { if let Some(target) = target { diff --git a/src/librustc_mir/interpret/traits.rs b/src/librustc_mir/interpret/traits.rs index 220f3e8b93641..4ae0ee530553c 100644 --- a/src/librustc_mir/interpret/traits.rs +++ b/src/librustc_mir/interpret/traits.rs @@ -4,7 +4,7 @@ use rustc::mir::interpret::{Scalar, Pointer, InterpResult, PointerArithmetic}; use super::{InterpretCx, InterpError, Machine, MemoryKind}; -impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> InterpretCx<'a, 'mir, 'tcx, M> { +impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpretCx<'mir, 'tcx, M> { /// Creates a dynamic vtable for the given type and vtable origin. This is used only for /// objects. /// diff --git a/src/librustc_mir/interpret/validity.rs b/src/librustc_mir/interpret/validity.rs index 6768d9ec6bc19..ef11fce513cd5 100644 --- a/src/librustc_mir/interpret/validity.rs +++ b/src/librustc_mir/interpret/validity.rs @@ -149,17 +149,17 @@ fn wrapping_range_format(r: &RangeInclusive, max_hi: u128) -> String { } } -struct ValidityVisitor<'rt, 'a: 'rt, 'mir: 'rt, 'tcx: 'a+'rt+'mir, M: Machine<'a, 'mir, 'tcx>+'rt> { +struct ValidityVisitor<'rt, 'mir, 'tcx, M: Machine<'mir, 'tcx>> { /// The `path` may be pushed to, but the part that is present when a function /// starts must not be changed! `visit_fields` and `visit_array` rely on /// this stack discipline. path: Vec, ref_tracking: Option<&'rt mut RefTracking>>, const_mode: bool, - ecx: &'rt InterpretCx<'a, 'mir, 'tcx, M>, + ecx: &'rt InterpretCx<'mir, 'tcx, M>, } -impl<'rt, 'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> ValidityVisitor<'rt, 'a, 'mir, 'tcx, M> { +impl<'rt, 'mir, 'tcx, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, 'tcx, M> { fn aggregate_field_path_elem( &mut self, layout: TyLayout<'tcx>, @@ -235,13 +235,13 @@ impl<'rt, 'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> ValidityVisitor<'rt, 'a, ' } } -impl<'rt, 'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> - ValueVisitor<'a, 'mir, 'tcx, M> for ValidityVisitor<'rt, 'a, 'mir, 'tcx, M> +impl<'rt, 'mir, 'tcx, M: Machine<'mir, 'tcx>> + ValueVisitor<'mir, 'tcx, M> for ValidityVisitor<'rt, 'mir, 'tcx, M> { type V = OpTy<'tcx, M::PointerTag>; #[inline(always)] - fn ecx(&self) -> &InterpretCx<'a, 'mir, 'tcx, M> { + fn ecx(&self) -> &InterpretCx<'mir, 'tcx, M> { &self.ecx } @@ -607,7 +607,7 @@ impl<'rt, 'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> } } -impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> InterpretCx<'a, 'mir, 'tcx, M> { +impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpretCx<'mir, 'tcx, M> { /// This function checks the data at `op`. `op` is assumed to cover valid memory if it /// is an indirect operand. /// It will error if the bits at the destination do not match the ones described by the layout. diff --git a/src/librustc_mir/interpret/visitor.rs b/src/librustc_mir/interpret/visitor.rs index b5477c6861019..accf9914e0d0e 100644 --- a/src/librustc_mir/interpret/visitor.rs +++ b/src/librustc_mir/interpret/visitor.rs @@ -14,7 +14,7 @@ use super::{ // A thing that we can project into, and that has a layout. // This wouldn't have to depend on `Machine` but with the current type inference, // that's just more convenient to work with (avoids repeating all the `Machine` bounds). -pub trait Value<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>>: Copy +pub trait Value<'mir, 'tcx, M: Machine<'mir, 'tcx>>: Copy { /// Gets this value's layout. fn layout(&self) -> TyLayout<'tcx>; @@ -22,7 +22,7 @@ pub trait Value<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>>: Copy /// Makes this into an `OpTy`. fn to_op( self, - ecx: &InterpretCx<'a, 'mir, 'tcx, M>, + ecx: &InterpretCx<'mir, 'tcx, M>, ) -> InterpResult<'tcx, OpTy<'tcx, M::PointerTag>>; /// Creates this from an `MPlaceTy`. @@ -31,21 +31,21 @@ pub trait Value<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>>: Copy /// Projects to the given enum variant. fn project_downcast( self, - ecx: &InterpretCx<'a, 'mir, 'tcx, M>, + ecx: &InterpretCx<'mir, 'tcx, M>, variant: VariantIdx, ) -> InterpResult<'tcx, Self>; /// Projects to the n-th field. fn project_field( self, - ecx: &InterpretCx<'a, 'mir, 'tcx, M>, + ecx: &InterpretCx<'mir, 'tcx, M>, field: u64, ) -> InterpResult<'tcx, Self>; } // Operands and memory-places are both values. // Places in general are not due to `place_field` having to do `force_allocation`. -impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Value<'a, 'mir, 'tcx, M> +impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Value<'mir, 'tcx, M> for OpTy<'tcx, M::PointerTag> { #[inline(always)] @@ -56,7 +56,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Value<'a, 'mir, 'tcx, M> #[inline(always)] fn to_op( self, - _ecx: &InterpretCx<'a, 'mir, 'tcx, M>, + _ecx: &InterpretCx<'mir, 'tcx, M>, ) -> InterpResult<'tcx, OpTy<'tcx, M::PointerTag>> { Ok(self) } @@ -69,7 +69,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Value<'a, 'mir, 'tcx, M> #[inline(always)] fn project_downcast( self, - ecx: &InterpretCx<'a, 'mir, 'tcx, M>, + ecx: &InterpretCx<'mir, 'tcx, M>, variant: VariantIdx, ) -> InterpResult<'tcx, Self> { ecx.operand_downcast(self, variant) @@ -78,13 +78,13 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Value<'a, 'mir, 'tcx, M> #[inline(always)] fn project_field( self, - ecx: &InterpretCx<'a, 'mir, 'tcx, M>, + ecx: &InterpretCx<'mir, 'tcx, M>, field: u64, ) -> InterpResult<'tcx, Self> { ecx.operand_field(self, field) } } -impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Value<'a, 'mir, 'tcx, M> +impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Value<'mir, 'tcx, M> for MPlaceTy<'tcx, M::PointerTag> { #[inline(always)] @@ -95,7 +95,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Value<'a, 'mir, 'tcx, M> #[inline(always)] fn to_op( self, - _ecx: &InterpretCx<'a, 'mir, 'tcx, M>, + _ecx: &InterpretCx<'mir, 'tcx, M>, ) -> InterpResult<'tcx, OpTy<'tcx, M::PointerTag>> { Ok(self.into()) } @@ -108,7 +108,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Value<'a, 'mir, 'tcx, M> #[inline(always)] fn project_downcast( self, - ecx: &InterpretCx<'a, 'mir, 'tcx, M>, + ecx: &InterpretCx<'mir, 'tcx, M>, variant: VariantIdx, ) -> InterpResult<'tcx, Self> { ecx.mplace_downcast(self, variant) @@ -117,7 +117,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Value<'a, 'mir, 'tcx, M> #[inline(always)] fn project_field( self, - ecx: &InterpretCx<'a, 'mir, 'tcx, M>, + ecx: &InterpretCx<'mir, 'tcx, M>, field: u64, ) -> InterpResult<'tcx, Self> { ecx.mplace_field(self, field) @@ -127,12 +127,12 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Value<'a, 'mir, 'tcx, M> macro_rules! make_value_visitor { ($visitor_trait_name:ident, $($mutability:ident)?) => { // How to traverse a value and what to do when we are at the leaves. - pub trait $visitor_trait_name<'a, 'mir, 'tcx: 'mir+'a, M: Machine<'a, 'mir, 'tcx>>: Sized { - type V: Value<'a, 'mir, 'tcx, M>; + pub trait $visitor_trait_name<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>>: Sized { + type V: Value<'mir, 'tcx, M>; /// The visitor must have an `InterpretCx` in it. fn ecx(&$($mutability)? self) - -> &$($mutability)? InterpretCx<'a, 'mir, 'tcx, M>; + -> &$($mutability)? InterpretCx<'mir, 'tcx, M>; // Recursive actions, ready to be overloaded. /// Visits the given value, dispatching as appropriate to more specialized visitors. diff --git a/src/librustc_mir/lints.rs b/src/librustc_mir/lints.rs index e15c8a4b41664..7e637a4130dc1 100644 --- a/src/librustc_mir/lints.rs +++ b/src/librustc_mir/lints.rs @@ -7,7 +7,7 @@ use rustc::mir::{self, Body, TerminatorKind}; use rustc::ty::{self, AssocItem, AssocItemContainer, Instance, TyCtxt}; use rustc::ty::subst::InternalSubsts; -pub fn check(tcx: TyCtxt<'a, 'tcx, 'tcx>, +pub fn check(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, body: &Body<'tcx>, def_id: DefId) { let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); @@ -17,7 +17,7 @@ pub fn check(tcx: TyCtxt<'a, 'tcx, 'tcx>, } } -fn check_fn_for_unconditional_recursion(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn check_fn_for_unconditional_recursion(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, fn_kind: FnKind<'_>, body: &Body<'tcx>, def_id: DefId) { diff --git a/src/librustc_mir/monomorphize/collector.rs b/src/librustc_mir/monomorphize/collector.rs index 706ace0c1f1bc..87aec1a22d930 100644 --- a/src/librustc_mir/monomorphize/collector.rs +++ b/src/librustc_mir/monomorphize/collector.rs @@ -281,7 +281,7 @@ impl<'tcx> InliningMap<'tcx> { } } -pub fn collect_crate_mono_items<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +pub fn collect_crate_mono_items<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, mode: MonoItemCollectionMode) -> (FxHashSet>, InliningMap<'tcx>) { @@ -315,7 +315,7 @@ pub fn collect_crate_mono_items<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // Find all non-generic items by walking the HIR. These items serve as roots to // start monomorphizing from. -fn collect_roots<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn collect_roots<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, mode: MonoItemCollectionMode) -> Vec> { debug!("Collecting roots"); @@ -347,7 +347,7 @@ fn collect_roots<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } // Collect all monomorphized items reachable from `starting_point` -fn collect_items_rec<'a, 'tcx: 'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn collect_items_rec<'a, 'tcx: 'a>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, starting_point: MonoItem<'tcx>, visited: MTRef<'_, MTLock>>>, recursion_depths: &mut DefIdMap, @@ -413,7 +413,7 @@ fn collect_items_rec<'a, 'tcx: 'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>, debug!("END collect_items_rec({})", starting_point.to_string(tcx, true)); } -fn record_accesses<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn record_accesses<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, caller: MonoItem<'tcx>, callees: &[MonoItem<'tcx>], inlining_map: MTRef<'_, MTLock>>) { @@ -429,7 +429,7 @@ fn record_accesses<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, inlining_map.lock_mut().record_accesses(caller, accesses); } -fn check_recursion_limit<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn check_recursion_limit<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, instance: Instance<'tcx>, recursion_depths: &mut DefIdMap) -> (DefId, usize) { @@ -463,7 +463,7 @@ fn check_recursion_limit<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, (def_id, recursion_depth) } -fn check_type_length_limit<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn check_type_length_limit<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, instance: Instance<'tcx>) { let type_length = instance.substs.types().flat_map(|ty| ty.walk()).count(); @@ -515,7 +515,7 @@ fn check_type_length_limit<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } struct MirNeighborCollector<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, body: &'a mir::Body<'tcx>, output: &'a mut Vec>, param_substs: SubstsRef<'tcx>, @@ -679,7 +679,7 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> { } } -fn visit_drop_use<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn visit_drop_use<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ty: Ty<'tcx>, is_direct_call: bool, output: &mut Vec>) @@ -688,7 +688,7 @@ fn visit_drop_use<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, visit_instance_use(tcx, instance, is_direct_call, output); } -fn visit_fn_use<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn visit_fn_use<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ty: Ty<'tcx>, is_direct_call: bool, output: &mut Vec>) @@ -702,7 +702,7 @@ fn visit_fn_use<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } } -fn visit_instance_use<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn visit_instance_use<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, instance: ty::Instance<'tcx>, is_direct_call: bool, output: &mut Vec>) @@ -741,7 +741,7 @@ fn visit_instance_use<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // Returns true if we should codegen an instance in the local crate. // Returns false if we can just link to the upstream crate and therefore don't // need a mono item. -fn should_monomorphize_locally<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, instance: &Instance<'tcx>) +fn should_monomorphize_locally<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, instance: &Instance<'tcx>) -> bool { let def_id = match instance.def { ty::InstanceDef::Item(def_id) => def_id, @@ -776,7 +776,7 @@ fn should_monomorphize_locally<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, instance: } return true; - fn is_available_upstream_generic<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, + fn is_available_upstream_generic<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, substs: SubstsRef<'tcx>) -> bool { @@ -841,7 +841,7 @@ fn should_monomorphize_locally<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, instance: /// /// Finally, there is also the case of custom unsizing coercions, e.g., for /// smart pointers such as `Rc` and `Arc`. -fn find_vtable_types_for_unsizing<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn find_vtable_types_for_unsizing<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, source_ty: Ty<'tcx>, target_ty: Ty<'tcx>) -> (Ty<'tcx>, Ty<'tcx>) { @@ -914,7 +914,7 @@ fn create_fn_mono_item<'tcx>(instance: Instance<'tcx>) -> MonoItem<'tcx> { /// Creates a `MonoItem` for each method that is referenced by the vtable for /// the given trait/impl pair. -fn create_mono_items_for_vtable_methods<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn create_mono_items_for_vtable_methods<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, trait_ty: Ty<'tcx>, impl_ty: Ty<'tcx>, output: &mut Vec>) { @@ -948,14 +948,14 @@ fn create_mono_items_for_vtable_methods<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // Root Collection //=----------------------------------------------------------------------------- -struct RootCollector<'b, 'a: 'b, 'tcx: 'a + 'b> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, +struct RootCollector<'a, 'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, mode: MonoItemCollectionMode, - output: &'b mut Vec>, + output: &'a mut Vec>, entry_fn: Option<(DefId, EntryFnType)>, } -impl<'b, 'a, 'v> ItemLikeVisitor<'v> for RootCollector<'b, 'a, 'v> { +impl ItemLikeVisitor<'v> for RootCollector<'_, 'v> { fn visit_item(&mut self, item: &'v hir::Item) { match item.node { hir::ItemKind::ExternCrate(..) | @@ -1044,7 +1044,7 @@ impl<'b, 'a, 'v> ItemLikeVisitor<'v> for RootCollector<'b, 'a, 'v> { } } -impl<'b, 'a, 'v> RootCollector<'b, 'a, 'v> { +impl RootCollector<'_, 'v> { fn is_root(&self, def_id: DefId) -> bool { !item_requires_monomorphization(self.tcx, def_id) && match self.mode { MonoItemCollectionMode::Eager => { @@ -1107,12 +1107,12 @@ impl<'b, 'a, 'v> RootCollector<'b, 'a, 'v> { } } -fn item_requires_monomorphization<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> bool { +fn item_requires_monomorphization<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> bool { let generics = tcx.generics_of(def_id); generics.requires_monomorphization(tcx) } -fn create_mono_items_for_default_impls<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn create_mono_items_for_default_impls<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item: &'tcx hir::Item, output: &mut Vec>) { match item.node { @@ -1177,7 +1177,7 @@ fn create_mono_items_for_default_impls<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, /// Scan the miri alloc in order to find function calls, closures, and drop-glue fn collect_miri<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, alloc_id: AllocId, output: &mut Vec>, ) { @@ -1207,7 +1207,7 @@ fn collect_miri<'a, 'tcx>( } /// Scan the MIR in order to find function calls, closures, and drop-glue -fn collect_neighbours<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn collect_neighbours<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, instance: Instance<'tcx>, output: &mut Vec>) { @@ -1237,7 +1237,7 @@ fn collect_neighbours<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } } -fn def_id_to_string<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn def_id_to_string<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> String { let mut output = String::new(); @@ -1247,7 +1247,7 @@ fn def_id_to_string<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } fn collect_const<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, constant: &'tcx ty::Const<'tcx>, param_substs: SubstsRef<'tcx>, output: &mut Vec>, diff --git a/src/librustc_mir/monomorphize/item.rs b/src/librustc_mir/monomorphize/item.rs index d60d0fe9114d3..f23d98cfe1cd4 100644 --- a/src/librustc_mir/monomorphize/item.rs +++ b/src/librustc_mir/monomorphize/item.rs @@ -35,7 +35,7 @@ pub enum InstantiationMode { LocalCopy, } -pub trait MonoItemExt<'a, 'tcx>: fmt::Debug { +pub trait MonoItemExt<'tcx>: fmt::Debug { fn as_mono_item(&self) -> &MonoItem<'tcx>; fn is_generic_fn(&self) -> bool { @@ -48,7 +48,7 @@ pub trait MonoItemExt<'a, 'tcx>: fmt::Debug { } } - fn symbol_name(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> ty::SymbolName { + fn symbol_name(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> ty::SymbolName { match *self.as_mono_item() { MonoItem::Fn(instance) => tcx.symbol_name(instance), MonoItem::Static(def_id) => { @@ -63,7 +63,7 @@ pub trait MonoItemExt<'a, 'tcx>: fmt::Debug { } } fn instantiation_mode(&self, - tcx: TyCtxt<'a, 'tcx, 'tcx>) + tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> InstantiationMode { let inline_in_all_cgus = tcx.sess.opts.debugging_opts.inline_in_all_cgus.unwrap_or_else(|| { @@ -108,7 +108,7 @@ pub trait MonoItemExt<'a, 'tcx>: fmt::Debug { } } - fn explicit_linkage(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Option { + fn explicit_linkage(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Option { let def_id = match *self.as_mono_item() { MonoItem::Fn(ref instance) => instance.def_id(), MonoItem::Static(def_id) => def_id, @@ -144,7 +144,7 @@ pub trait MonoItemExt<'a, 'tcx>: fmt::Debug { /// 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. - fn is_instantiable(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> bool { + fn is_instantiable(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> bool { debug!("is_instantiable({:?})", self); let (def_id, substs) = match *self.as_mono_item() { MonoItem::Fn(ref instance) => (instance.def_id(), instance.substs), @@ -156,7 +156,7 @@ pub trait MonoItemExt<'a, 'tcx>: fmt::Debug { tcx.substitute_normalize_and_test_predicates((def_id, &substs)) } - fn to_string(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, debug: bool) -> String { + fn to_string(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, debug: bool) -> String { return match *self.as_mono_item() { MonoItem::Fn(instance) => { to_string_internal(tcx, "fn ", instance, debug) @@ -170,7 +170,7 @@ pub trait MonoItemExt<'a, 'tcx>: fmt::Debug { } }; - fn to_string_internal<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, + fn to_string_internal<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, prefix: &str, instance: Instance<'tcx>, debug: bool) @@ -183,7 +183,7 @@ pub trait MonoItemExt<'a, 'tcx>: fmt::Debug { } } - fn local_span(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Option { + fn local_span(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Option { match *self.as_mono_item() { MonoItem::Fn(Instance { def, .. }) => { tcx.hir().as_local_hir_id(def.def_id()) @@ -198,7 +198,7 @@ pub trait MonoItemExt<'a, 'tcx>: fmt::Debug { } } -impl<'a, 'tcx> MonoItemExt<'a, 'tcx> for MonoItem<'tcx> { +impl MonoItemExt<'tcx> for MonoItem<'tcx> { fn as_mono_item(&self) -> &MonoItem<'tcx> { self } diff --git a/src/librustc_mir/monomorphize/mod.rs b/src/librustc_mir/monomorphize/mod.rs index 51bcbff7f3236..2a349077ddb3f 100644 --- a/src/librustc_mir/monomorphize/mod.rs +++ b/src/librustc_mir/monomorphize/mod.rs @@ -5,7 +5,7 @@ use rustc::ty::{self, Ty, TyCtxt}; pub mod collector; pub mod partitioning; -pub fn custom_coerce_unsize_info<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +pub fn custom_coerce_unsize_info<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, source_ty: Ty<'tcx>, target_ty: Ty<'tcx>) -> CustomCoerceUnsized { diff --git a/src/librustc_mir/monomorphize/partitioning.rs b/src/librustc_mir/monomorphize/partitioning.rs index 2c84364216633..c6826393585ac 100644 --- a/src/librustc_mir/monomorphize/partitioning.rs +++ b/src/librustc_mir/monomorphize/partitioning.rs @@ -121,11 +121,11 @@ pub enum PartitioningStrategy { } // Anything we can't find a proper codegen unit for goes into this. -fn fallback_cgu_name(name_builder: &mut CodegenUnitNameBuilder<'_, '_, '_>) -> InternedString { +fn fallback_cgu_name(name_builder: &mut CodegenUnitNameBuilder<'_, '_>) -> InternedString { name_builder.build_cgu_name(LOCAL_CRATE, &["fallback"], Some("cgu")) } -pub fn partition<'a, 'tcx, I>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +pub fn partition<'a, 'tcx, I>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, mono_items: I, strategy: PartitioningStrategy, inlining_map: &InliningMap<'tcx>) @@ -201,7 +201,7 @@ struct PostInliningPartitioning<'tcx> { internalization_candidates: FxHashSet>, } -fn place_root_mono_items<'a, 'tcx, I>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn place_root_mono_items<'a, 'tcx, I>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, mono_items: I) -> PreInliningPartitioning<'tcx> where I: Iterator> @@ -276,7 +276,7 @@ fn place_root_mono_items<'a, 'tcx, I>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } fn mono_item_linkage_and_visibility( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, mono_item: &MonoItem<'tcx>, can_be_internalized: &mut bool, export_generics: bool, @@ -294,7 +294,7 @@ fn mono_item_linkage_and_visibility( } fn mono_item_visibility( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, mono_item: &MonoItem<'tcx>, can_be_internalized: &mut bool, export_generics: bool, @@ -463,7 +463,7 @@ fn default_visibility(tcx: TyCtxt<'_, '_, '_>, id: DefId, is_generic: bool) -> V } } -fn merge_codegen_units<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, +fn merge_codegen_units<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, initial_partitioning: &mut PreInliningPartitioning<'tcx>, target_cgu_count: usize) { assert!(target_cgu_count >= 1); @@ -585,7 +585,7 @@ fn place_inlined_mono_items<'tcx>(initial_partitioning: PreInliningPartitioning< } } -fn internalize_symbols<'a, 'tcx>(_tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn internalize_symbols<'a, 'tcx>(_tcx: TyCtxt<'tcx, 'tcx, 'tcx>, partitioning: &mut PostInliningPartitioning<'tcx>, inlining_map: &InliningMap<'tcx>) { if partitioning.codegen_units.len() == 1 { @@ -650,7 +650,7 @@ fn internalize_symbols<'a, 'tcx>(_tcx: TyCtxt<'a, 'tcx, 'tcx>, } } -fn characteristic_def_id_of_mono_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn characteristic_def_id_of_mono_item<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, mono_item: MonoItem<'tcx>) -> Option { match mono_item { @@ -699,7 +699,7 @@ fn characteristic_def_id_of_mono_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, type CguNameCache = FxHashMap<(DefId, bool), InternedString>; fn compute_codegen_unit_name(tcx: TyCtxt<'_, '_, '_>, - name_builder: &mut CodegenUnitNameBuilder<'_, '_, '_>, + name_builder: &mut CodegenUnitNameBuilder<'_, '_>, def_id: DefId, volatile: bool, cache: &mut CguNameCache) @@ -752,13 +752,13 @@ fn compute_codegen_unit_name(tcx: TyCtxt<'_, '_, '_>, }).clone() } -fn numbered_codegen_unit_name(name_builder: &mut CodegenUnitNameBuilder<'_, '_, '_>, +fn numbered_codegen_unit_name(name_builder: &mut CodegenUnitNameBuilder<'_, '_>, index: usize) -> InternedString { name_builder.build_cgu_name_no_mangle(LOCAL_CRATE, &["cgu"], Some(index)) } -fn debug_dump<'a, 'b, 'tcx, I>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn debug_dump<'a, 'b, 'tcx, I>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, label: &str, cgus: I) where I: Iterator>, @@ -787,7 +787,7 @@ fn debug_dump<'a, 'b, 'tcx, I>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } #[inline(never)] // give this a place in the profiler -fn assert_symbols_are_distinct<'a, 'tcx, I>(tcx: TyCtxt<'a, 'tcx, 'tcx>, mono_items: I) +fn assert_symbols_are_distinct<'a, 'tcx: 'a, I>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, mono_items: I) where I: Iterator> { let mut symbols: Vec<_> = mono_items.map(|mono_item| { @@ -831,7 +831,7 @@ fn assert_symbols_are_distinct<'a, 'tcx, I>(tcx: TyCtxt<'a, 'tcx, 'tcx>, mono_it } fn collect_and_partition_mono_items<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, cnum: CrateNum, ) -> (Arc, Arc>>>) { diff --git a/src/librustc_mir/shim.rs b/src/librustc_mir/shim.rs index 0f2196b5da6be..b63ddf259e805 100644 --- a/src/librustc_mir/shim.rs +++ b/src/librustc_mir/shim.rs @@ -26,7 +26,7 @@ pub fn provide(providers: &mut Providers<'_>) { providers.mir_shims = make_shim; } -fn make_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn make_shim<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, instance: ty::InstanceDef<'tcx>) -> &'tcx Body<'tcx> { @@ -166,7 +166,7 @@ fn local_decls_for_sig<'tcx>(sig: &ty::FnSig<'tcx>, span: Span) .collect() } -fn build_drop_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn build_drop_shim<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, ty: Option>) -> Body<'tcx> @@ -258,7 +258,7 @@ fn build_drop_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, pub struct DropShimElaborator<'a, 'tcx: 'a> { pub body: &'a Body<'tcx>, pub patch: MirPatch<'tcx>, - pub tcx: TyCtxt<'a, 'tcx, 'tcx>, + pub tcx: TyCtxt<'tcx, 'tcx, 'tcx>, pub param_env: ty::ParamEnv<'tcx>, } @@ -273,7 +273,7 @@ impl<'a, 'tcx> DropElaborator<'a, 'tcx> for DropShimElaborator<'a, 'tcx> { fn patch(&mut self) -> &mut MirPatch<'tcx> { &mut self.patch } fn body(&self) -> &'a Body<'tcx> { self.body } - fn tcx(&self) -> TyCtxt<'a, 'tcx, 'tcx> { self.tcx } + fn tcx(&self) -> TyCtxt<'tcx, 'tcx, 'tcx> { self.tcx } fn param_env(&self) -> ty::ParamEnv<'tcx> { self.param_env } fn drop_style(&self, _path: Self::Path, mode: DropFlagMode) -> DropStyle { @@ -306,7 +306,7 @@ impl<'a, 'tcx> DropElaborator<'a, 'tcx> for DropShimElaborator<'a, 'tcx> { } /// Builds a `Clone::clone` shim for `self_ty`. Here, `def_id` is `Clone::clone`. -fn build_clone_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn build_clone_shim<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, self_ty: Ty<'tcx>) -> Body<'tcx> @@ -340,8 +340,8 @@ fn build_clone_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, builder.into_mir() } -struct CloneShimBuilder<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, +struct CloneShimBuilder<'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, local_decls: IndexVec>, blocks: IndexVec>, @@ -349,8 +349,8 @@ struct CloneShimBuilder<'a, 'tcx: 'a> { sig: ty::FnSig<'tcx>, } -impl<'a, 'tcx> CloneShimBuilder<'a, 'tcx> { - fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>, +impl CloneShimBuilder<'tcx> { + fn new(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, self_ty: Ty<'tcx>) -> Self { // we must subst the self_ty because it's @@ -691,7 +691,7 @@ impl<'a, 'tcx> CloneShimBuilder<'a, 'tcx> { /// /// If `untuple_args` is a vec of types, the second argument of the /// function will be untupled as these types. -fn build_call_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn build_call_shim<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, rcvr_adjustment: Adjustment, call_kind: CallKind, @@ -842,7 +842,7 @@ fn build_call_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, body } -pub fn build_adt_ctor<'gcx>(tcx: TyCtxt<'_, 'gcx, 'gcx>, ctor_id: DefId) -> &'gcx Body<'gcx> { +pub fn build_adt_ctor<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ctor_id: DefId) -> &'tcx Body<'tcx> { debug_assert!(tcx.is_constructor(ctor_id)); let span = tcx.hir().span_if_local(ctor_id) diff --git a/src/librustc_mir/transform/add_call_guards.rs b/src/librustc_mir/transform/add_call_guards.rs index 40af357976636..59203fe586a63 100644 --- a/src/librustc_mir/transform/add_call_guards.rs +++ b/src/librustc_mir/transform/add_call_guards.rs @@ -32,7 +32,7 @@ pub use self::AddCallGuards::*; impl MirPass for AddCallGuards { fn run_pass<'a, 'tcx>(&self, - _tcx: TyCtxt<'a, 'tcx, 'tcx>, + _tcx: TyCtxt<'tcx, 'tcx, 'tcx>, _src: MirSource<'tcx>, body: &mut Body<'tcx>) { self.add_call_guards(body); diff --git a/src/librustc_mir/transform/add_moves_for_packed_drops.rs b/src/librustc_mir/transform/add_moves_for_packed_drops.rs index 23f5e636b7f8a..71a92f088e382 100644 --- a/src/librustc_mir/transform/add_moves_for_packed_drops.rs +++ b/src/librustc_mir/transform/add_moves_for_packed_drops.rs @@ -41,7 +41,7 @@ pub struct AddMovesForPackedDrops; impl MirPass for AddMovesForPackedDrops { fn run_pass<'a, 'tcx>(&self, - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, src: MirSource<'tcx>, body: &mut Body<'tcx>) { @@ -51,7 +51,7 @@ impl MirPass for AddMovesForPackedDrops { } pub fn add_moves_for_packed_drops<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, body: &mut Body<'tcx>, def_id: DefId) { @@ -60,7 +60,7 @@ pub fn add_moves_for_packed_drops<'a, 'tcx>( } fn add_moves_for_packed_drops_patch<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, body: &Body<'tcx>, def_id: DefId) -> MirPatch<'tcx> @@ -91,7 +91,7 @@ fn add_moves_for_packed_drops_patch<'a, 'tcx>( } fn add_move_for_packed_drop<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, body: &Body<'tcx>, patch: &mut MirPatch<'tcx>, terminator: &Terminator<'tcx>, diff --git a/src/librustc_mir/transform/add_retag.rs b/src/librustc_mir/transform/add_retag.rs index bea95bcd567ad..8918a90834020 100644 --- a/src/librustc_mir/transform/add_retag.rs +++ b/src/librustc_mir/transform/add_retag.rs @@ -48,7 +48,7 @@ fn is_stable<'tcx>( /// Determine whether this type may have a reference in it, recursing below compound types but /// not below references. -fn may_have_reference<'a, 'gcx, 'tcx>(ty: Ty<'tcx>, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> bool { +fn may_have_reference<'a, 'gcx, 'tcx>(ty: Ty<'tcx>, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> bool { match ty.sty { // Primitive types that are not references ty::Bool | ty::Char | @@ -75,7 +75,7 @@ fn may_have_reference<'a, 'gcx, 'tcx>(ty: Ty<'tcx>, tcx: TyCtxt<'a, 'gcx, 'tcx>) impl MirPass for AddRetag { fn run_pass<'a, 'tcx>(&self, - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, _src: MirSource<'tcx>, body: &mut Body<'tcx>) { diff --git a/src/librustc_mir/transform/check_unsafety.rs b/src/librustc_mir/transform/check_unsafety.rs index b8077d224e4ef..7721cae6d1009 100644 --- a/src/librustc_mir/transform/check_unsafety.rs +++ b/src/librustc_mir/transform/check_unsafety.rs @@ -25,7 +25,7 @@ pub struct UnsafetyChecker<'a, 'tcx: 'a> { source_scope_local_data: &'a IndexVec, violations: Vec, source_info: SourceInfo, - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, /// Mark an `unsafe` block as used, so we don't lint it. used_unsafe: FxHashSet, @@ -38,7 +38,7 @@ impl<'a, 'tcx> UnsafetyChecker<'a, 'tcx> { min_const_fn: bool, body: &'a Body<'tcx>, source_scope_local_data: &'a IndexVec, - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, ) -> Self { // sanity check @@ -480,7 +480,7 @@ impl<'a, 'tcx> hir::intravisit::Visitor<'tcx> for UnusedUnsafeVisitor<'a> { } } -fn check_unused_unsafe<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn check_unused_unsafe<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, used_unsafe: &FxHashSet, unsafe_blocks: &'a mut Vec<(hir::HirId, bool)>) @@ -505,7 +505,7 @@ fn check_unused_unsafe<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, hir::intravisit::Visitor::visit_body(&mut visitor, body); } -fn unsafety_check_result<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) +fn unsafety_check_result<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> UnsafetyCheckResult { debug!("unsafety_violations({:?})", def_id); @@ -546,7 +546,7 @@ fn unsafety_check_result<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) } } -fn unsafe_derive_on_repr_packed<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) { +fn unsafe_derive_on_repr_packed<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { let lint_hir_id = tcx.hir().as_local_hir_id(def_id).unwrap_or_else(|| bug!("checking unsafety for non-local def id {:?}", def_id)); @@ -603,7 +603,7 @@ fn report_unused_unsafe(tcx: TyCtxt<'_, '_, '_>, db.emit(); } -fn builtin_derive_def_id<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Option { +fn builtin_derive_def_id<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> Option { debug!("builtin_derive_def_id({:?})", def_id); if let Some(impl_def_id) = tcx.impl_of_method(def_id) { if tcx.has_attr(impl_def_id, sym::automatically_derived) { @@ -619,7 +619,7 @@ fn builtin_derive_def_id<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) - } } -pub fn check_unsafety<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) { +pub fn check_unsafety<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { debug!("check_unsafety({:?})", def_id); // closures are handled by their parent fn. diff --git a/src/librustc_mir/transform/cleanup_post_borrowck.rs b/src/librustc_mir/transform/cleanup_post_borrowck.rs index 2bbd6ff21047b..972f05c908477 100644 --- a/src/librustc_mir/transform/cleanup_post_borrowck.rs +++ b/src/librustc_mir/transform/cleanup_post_borrowck.rs @@ -28,7 +28,7 @@ pub struct DeleteNonCodegenStatements; impl MirPass for CleanupNonCodegenStatements { fn run_pass<'a, 'tcx>(&self, - _tcx: TyCtxt<'a, 'tcx, 'tcx>, + _tcx: TyCtxt<'tcx, 'tcx, 'tcx>, _source: MirSource<'tcx>, body: &mut Body<'tcx>) { let mut delete = DeleteNonCodegenStatements; diff --git a/src/librustc_mir/transform/const_prop.rs b/src/librustc_mir/transform/const_prop.rs index b112643e2cd4a..1ec3e6e52aa01 100644 --- a/src/librustc_mir/transform/const_prop.rs +++ b/src/librustc_mir/transform/const_prop.rs @@ -32,7 +32,7 @@ pub struct ConstProp; impl MirPass for ConstProp { fn run_pass<'a, 'tcx>(&self, - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, source: MirSource<'tcx>, body: &mut Body<'tcx>) { // will be evaluated by miri and produce its errors there @@ -83,9 +83,9 @@ impl MirPass for ConstProp { type Const<'tcx> = OpTy<'tcx>; /// Finds optimization opportunities on the MIR. -struct ConstPropagator<'a, 'mir, 'tcx:'a+'mir> { - ecx: InterpretCx<'a, 'mir, 'tcx, CompileTimeInterpreter<'a, 'mir, 'tcx>>, - tcx: TyCtxt<'a, 'tcx, 'tcx>, +struct ConstPropagator<'mir, 'tcx> { + ecx: InterpretCx<'mir, 'tcx, CompileTimeInterpreter<'mir, 'tcx>>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, source: MirSource<'tcx>, places: IndexVec>>, can_const_prop: IndexVec, @@ -95,7 +95,7 @@ struct ConstPropagator<'a, 'mir, 'tcx:'a+'mir> { promoted: IndexVec>, } -impl<'a, 'b, 'tcx> LayoutOf for ConstPropagator<'a, 'b, 'tcx> { +impl<'mir, 'tcx> LayoutOf for ConstPropagator<'mir, 'tcx> { type Ty = Ty<'tcx>; type TyLayout = Result, LayoutError<'tcx>>; @@ -104,26 +104,26 @@ impl<'a, 'b, 'tcx> LayoutOf for ConstPropagator<'a, 'b, 'tcx> { } } -impl<'a, 'b, 'tcx> HasDataLayout for ConstPropagator<'a, 'b, 'tcx> { +impl<'mir, 'tcx> HasDataLayout for ConstPropagator<'mir, 'tcx> { #[inline] fn data_layout(&self) -> &TargetDataLayout { &self.tcx.data_layout } } -impl<'a, 'b, 'tcx> HasTyCtxt<'tcx> for ConstPropagator<'a, 'b, 'tcx> { +impl<'mir, 'tcx> HasTyCtxt<'tcx> for ConstPropagator<'mir, 'tcx> { #[inline] - fn tcx<'c>(&'c self) -> TyCtxt<'c, 'tcx, 'tcx> { + fn tcx<'c>(&'c self) -> TyCtxt<'tcx, 'tcx, 'tcx> { self.tcx } } -impl<'a, 'mir, 'tcx> ConstPropagator<'a, 'mir, 'tcx> { +impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { fn new( body: &mut Body<'tcx>, - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, source: MirSource<'tcx>, - ) -> ConstPropagator<'a, 'mir, 'tcx> { + ) -> ConstPropagator<'mir, 'tcx> { let param_env = tcx.param_env(source.def_id()); let ecx = mk_eval_cx(tcx, tcx.def_span(source.def_id()), param_env); let can_const_prop = CanConstProp::check(body); @@ -599,7 +599,7 @@ impl<'a, 'mir, 'tcx> ConstPropagator<'a, 'mir, 'tcx> { } } -fn type_size_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn type_size_of<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, ty: Ty<'tcx>) -> Option { tcx.layout_of(param_env.and(ty)).ok().map(|layout| layout.size.bytes()) @@ -668,7 +668,7 @@ impl<'tcx> Visitor<'tcx> for CanConstProp { } } -impl<'b, 'a, 'tcx> MutVisitor<'tcx> for ConstPropagator<'b, 'a, 'tcx> { +impl<'mir, 'tcx> MutVisitor<'tcx> for ConstPropagator<'mir, 'tcx> { fn visit_constant( &mut self, constant: &mut Constant<'tcx>, diff --git a/src/librustc_mir/transform/copy_prop.rs b/src/librustc_mir/transform/copy_prop.rs index 45b3fb79dd9fa..9b1f110520570 100644 --- a/src/librustc_mir/transform/copy_prop.rs +++ b/src/librustc_mir/transform/copy_prop.rs @@ -31,7 +31,7 @@ pub struct CopyPropagation; impl MirPass for CopyPropagation { fn run_pass<'a, 'tcx>(&self, - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, _source: MirSource<'tcx>, body: &mut Body<'tcx>) { // We only run when the MIR optimization level is > 1. diff --git a/src/librustc_mir/transform/deaggregator.rs b/src/librustc_mir/transform/deaggregator.rs index 78725f7523aab..7c52361de0641 100644 --- a/src/librustc_mir/transform/deaggregator.rs +++ b/src/librustc_mir/transform/deaggregator.rs @@ -7,7 +7,7 @@ pub struct Deaggregator; impl MirPass for Deaggregator { fn run_pass<'a, 'tcx>(&self, - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, _source: MirSource<'tcx>, body: &mut Body<'tcx>) { let (basic_blocks, local_decls) = body.basic_blocks_and_local_decls_mut(); diff --git a/src/librustc_mir/transform/dump_mir.rs b/src/librustc_mir/transform/dump_mir.rs index 9d88a2c8027e3..7f971d51e2650 100644 --- a/src/librustc_mir/transform/dump_mir.rs +++ b/src/librustc_mir/transform/dump_mir.rs @@ -19,7 +19,7 @@ impl MirPass for Marker { } fn run_pass<'a, 'tcx>(&self, - _tcx: TyCtxt<'a, 'tcx, 'tcx>, + _tcx: TyCtxt<'tcx, 'tcx, 'tcx>, _source: MirSource<'tcx>, _body: &mut Body<'tcx>) { @@ -38,7 +38,7 @@ impl fmt::Display for Disambiguator { } -pub fn on_mir_pass<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +pub fn on_mir_pass<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, pass_num: &dyn fmt::Display, pass_name: &str, source: MirSource<'tcx>, @@ -56,7 +56,7 @@ pub fn on_mir_pass<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } pub fn emit_mir<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, outputs: &OutputFilenames) -> io::Result<()> { diff --git a/src/librustc_mir/transform/elaborate_drops.rs b/src/librustc_mir/transform/elaborate_drops.rs index c48b94bded651..1d23427bbe7bb 100644 --- a/src/librustc_mir/transform/elaborate_drops.rs +++ b/src/librustc_mir/transform/elaborate_drops.rs @@ -22,7 +22,7 @@ pub struct ElaborateDrops; impl MirPass for ElaborateDrops { fn run_pass<'a, 'tcx>(&self, - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, src: MirSource<'tcx>, body: &mut Body<'tcx>) { @@ -78,7 +78,7 @@ impl MirPass for ElaborateDrops { /// to not be reachable, because they are `drop` terminators /// that can't drop anything. fn find_dead_unwinds<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, body: &Body<'tcx>, def_id: hir::def_id::DefId, env: &MoveDataParamEnv<'tcx, 'tcx>) @@ -142,7 +142,7 @@ struct InitializationData { impl InitializationData { fn apply_location<'a,'tcx>(&mut self, - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, body: &Body<'tcx>, env: &MoveDataParamEnv<'tcx, 'tcx>, loc: Location) @@ -190,7 +190,7 @@ impl<'a, 'b, 'tcx> DropElaborator<'a, 'tcx> for Elaborator<'a, 'b, 'tcx> { self.ctxt.body } - fn tcx(&self) -> TyCtxt<'a, 'tcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'tcx, 'tcx, 'tcx> { self.ctxt.tcx } @@ -290,7 +290,7 @@ impl<'a, 'b, 'tcx> DropElaborator<'a, 'tcx> for Elaborator<'a, 'b, 'tcx> { } struct ElaborateDropsCtxt<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, body: &'a Body<'tcx>, env: &'a MoveDataParamEnv<'tcx, 'tcx>, flow_inits: DataflowResults<'tcx, MaybeInitializedPlaces<'a, 'tcx, 'tcx>>, diff --git a/src/librustc_mir/transform/erase_regions.rs b/src/librustc_mir/transform/erase_regions.rs index 5ed7abc88b8f1..9c7877e208adb 100644 --- a/src/librustc_mir/transform/erase_regions.rs +++ b/src/librustc_mir/transform/erase_regions.rs @@ -10,19 +10,19 @@ use rustc::mir::*; use rustc::mir::visit::{MutVisitor, TyContext}; use crate::transform::{MirPass, MirSource}; -struct EraseRegionsVisitor<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, +struct EraseRegionsVisitor<'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } -impl<'a, 'tcx> EraseRegionsVisitor<'a, 'tcx> { - pub fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Self { +impl EraseRegionsVisitor<'tcx> { + pub fn new(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Self { EraseRegionsVisitor { tcx, } } } -impl<'a, 'tcx> MutVisitor<'tcx> for EraseRegionsVisitor<'a, 'tcx> { +impl MutVisitor<'tcx> for EraseRegionsVisitor<'tcx> { fn visit_ty(&mut self, ty: &mut Ty<'tcx>, _: TyContext) { *ty = self.tcx.erase_regions(ty); self.super_ty(ty); @@ -51,7 +51,7 @@ pub struct EraseRegions; impl MirPass for EraseRegions { fn run_pass<'a, 'tcx>(&self, - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, _: MirSource<'tcx>, body: &mut Body<'tcx>) { EraseRegionsVisitor::new(tcx).visit_body(body); diff --git a/src/librustc_mir/transform/generator.rs b/src/librustc_mir/transform/generator.rs index 0665d09d756aa..8423696e64c9e 100644 --- a/src/librustc_mir/transform/generator.rs +++ b/src/librustc_mir/transform/generator.rs @@ -168,8 +168,8 @@ struct SuspensionPoint { storage_liveness: liveness::LiveVarSet, } -struct TransformVisitor<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, +struct TransformVisitor<'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, state_adt_ref: &'tcx AdtDef, state_substs: SubstsRef<'tcx>, @@ -191,7 +191,7 @@ struct TransformVisitor<'a, 'tcx: 'a> { new_ret_local: Local, } -impl<'a, 'tcx> TransformVisitor<'a, 'tcx> { +impl TransformVisitor<'tcx> { // Make a GeneratorState rvalue fn make_state(&self, idx: VariantIdx, val: Operand<'tcx>) -> Rvalue<'tcx> { let adt = AggregateKind::Adt(self.state_adt_ref, idx, self.state_substs, None, None); @@ -233,7 +233,7 @@ impl<'a, 'tcx> TransformVisitor<'a, 'tcx> { } } -impl<'a, 'tcx> MutVisitor<'tcx> for TransformVisitor<'a, 'tcx> { +impl MutVisitor<'tcx> for TransformVisitor<'tcx> { fn visit_local(&mut self, local: &mut Local, _: PlaceContext, @@ -311,7 +311,7 @@ impl<'a, 'tcx> MutVisitor<'tcx> for TransformVisitor<'a, 'tcx> { } fn make_generator_state_argument_indirect<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, body: &mut Body<'tcx>) { let gen_ty = body.local_decls.raw[1].ty; @@ -336,7 +336,7 @@ fn make_generator_state_argument_indirect<'a, 'tcx>( } fn make_generator_state_argument_pinned<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, body: &mut Body<'tcx>) { let ref_gen_ty = body.local_decls.raw[1].ty; @@ -416,7 +416,7 @@ struct LivenessInfo { } fn locals_live_across_suspend_points( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, body: &Body<'tcx>, source: MirSource<'tcx>, movable: bool, @@ -678,7 +678,7 @@ impl<'body, 'tcx: 'body, 's> StorageConflictVisitor<'body, 'tcx, 's> { } } -fn compute_layout<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn compute_layout<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, source: MirSource<'tcx>, upvars: &Vec>, interior: Ty<'tcx>, @@ -769,7 +769,7 @@ fn compute_layout<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, fn insert_switch<'a, 'tcx>(body: &mut Body<'tcx>, cases: Vec<(usize, BasicBlock)>, - transform: &TransformVisitor<'a, 'tcx>, + transform: &TransformVisitor<'tcx>, default: TerminatorKind<'tcx>) { let default_block = insert_term_block(body, default); let (assign, discr) = transform.get_discr(body); @@ -797,7 +797,7 @@ fn insert_switch<'a, 'tcx>(body: &mut Body<'tcx>, } } -fn elaborate_generator_drops<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn elaborate_generator_drops<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, body: &mut Body<'tcx>) { use crate::util::elaborate_drops::{elaborate_drop, Unwind}; @@ -849,8 +849,8 @@ fn elaborate_generator_drops<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } fn create_generator_drop_shim<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, - transform: &TransformVisitor<'a, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + transform: &TransformVisitor<'tcx>, def_id: DefId, source: MirSource<'tcx>, gen_ty: Ty<'tcx>, @@ -939,7 +939,7 @@ fn insert_term_block<'tcx>(body: &mut Body<'tcx>, kind: TerminatorKind<'tcx>) -> term_block } -fn insert_panic_block<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn insert_panic_block<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, body: &mut Body<'tcx>, message: AssertMessage<'tcx>) -> BasicBlock { let assert_block = BasicBlock::new(body.basic_blocks().len()); @@ -970,8 +970,8 @@ fn insert_panic_block<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } fn create_generator_resume_function<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, - transform: TransformVisitor<'a, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + transform: TransformVisitor<'tcx>, def_id: DefId, source: MirSource<'tcx>, body: &mut Body<'tcx>) { @@ -1043,7 +1043,7 @@ fn insert_clean_drop<'tcx>(body: &mut Body<'tcx>) -> BasicBlock { } fn create_cases<'a, 'tcx, F>(body: &mut Body<'tcx>, - transform: &TransformVisitor<'a, 'tcx>, + transform: &TransformVisitor<'tcx>, target: F) -> Vec<(usize, BasicBlock)> where F: Fn(&SuspensionPoint) -> Option { let source_info = source_info(body); @@ -1084,7 +1084,7 @@ fn create_cases<'a, 'tcx, F>(body: &mut Body<'tcx>, impl MirPass for StateTransform { fn run_pass<'a, 'tcx>(&self, - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, source: MirSource<'tcx>, body: &mut Body<'tcx>) { let yield_ty = if let Some(yield_ty) = body.yield_ty { diff --git a/src/librustc_mir/transform/inline.rs b/src/librustc_mir/transform/inline.rs index 651910c64924d..6937e23d6d3eb 100644 --- a/src/librustc_mir/transform/inline.rs +++ b/src/librustc_mir/transform/inline.rs @@ -39,7 +39,7 @@ struct CallSite<'tcx> { impl MirPass for Inline { fn run_pass<'a, 'tcx>(&self, - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, source: MirSource<'tcx>, body: &mut Body<'tcx>) { if tcx.sess.opts.debugging_opts.mir_opt_level >= 2 { @@ -48,12 +48,12 @@ impl MirPass for Inline { } } -struct Inliner<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, +struct Inliner<'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, source: MirSource<'tcx>, } -impl<'a, 'tcx> Inliner<'a, 'tcx> { +impl Inliner<'tcx> { fn run_pass(&self, caller_body: &mut Body<'tcx>) { // Keep a queue of callsites to try inlining on. We take // advantage of the fact that queries detect cycles here to @@ -631,7 +631,7 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> { } } -fn type_size_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn type_size_of<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, ty: Ty<'tcx>) -> Option { tcx.layout_of(param_env.and(ty)).ok().map(|layout| layout.size.bytes()) diff --git a/src/librustc_mir/transform/instcombine.rs b/src/librustc_mir/transform/instcombine.rs index 2899112b7b542..c2bb2da85a89c 100644 --- a/src/librustc_mir/transform/instcombine.rs +++ b/src/librustc_mir/transform/instcombine.rs @@ -13,7 +13,7 @@ pub struct InstCombine; impl MirPass for InstCombine { fn run_pass<'a, 'tcx>(&self, - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, _: MirSource<'tcx>, body: &mut Body<'tcx>) { // We only run when optimizing MIR (at any level). @@ -63,14 +63,14 @@ impl<'tcx> MutVisitor<'tcx> for InstCombineVisitor<'tcx> { } /// Finds optimization opportunities on the MIR. -struct OptimizationFinder<'b, 'a, 'tcx:'a+'b> { +struct OptimizationFinder<'b, 'tcx> { body: &'b Body<'tcx>, - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, optimizations: OptimizationList<'tcx>, } -impl<'b, 'a, 'tcx:'b> OptimizationFinder<'b, 'a, 'tcx> { - fn new(body: &'b Body<'tcx>, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> OptimizationFinder<'b, 'a, 'tcx> { +impl OptimizationFinder<'b, 'tcx> { + fn new(body: &'b Body<'tcx>, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> OptimizationFinder<'b, 'tcx> { OptimizationFinder { body, tcx, @@ -79,7 +79,7 @@ impl<'b, 'a, 'tcx:'b> OptimizationFinder<'b, 'a, 'tcx> { } } -impl<'b, 'a, 'tcx> Visitor<'tcx> for OptimizationFinder<'b, 'a, 'tcx> { +impl Visitor<'tcx> for OptimizationFinder<'b, 'tcx> { fn visit_rvalue(&mut self, rvalue: &Rvalue<'tcx>, location: Location) { if let Rvalue::Ref(_, _, Place::Projection(ref projection)) = *rvalue { if let ProjectionElem::Deref = projection.elem { diff --git a/src/librustc_mir/transform/lower_128bit.rs b/src/librustc_mir/transform/lower_128bit.rs index 189258c2e92c4..5a5c379027768 100644 --- a/src/librustc_mir/transform/lower_128bit.rs +++ b/src/librustc_mir/transform/lower_128bit.rs @@ -11,7 +11,7 @@ pub struct Lower128Bit; impl MirPass for Lower128Bit { fn run_pass<'a, 'tcx>(&self, - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, _src: MirSource<'tcx>, body: &mut Body<'tcx>) { let debugging_override = tcx.sess.opts.debugging_opts.lower_128bit_ops; @@ -25,7 +25,7 @@ impl MirPass for Lower128Bit { } impl Lower128Bit { - fn lower_128bit_ops<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, body: &mut Body<'tcx>) { + fn lower_128bit_ops<'a, 'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, body: &mut Body<'tcx>) { let mut new_blocks = Vec::new(); let cur_len = body.basic_blocks().len(); @@ -126,7 +126,7 @@ fn check_lang_item_type<'a, 'tcx, D>( lhs: &Operand<'tcx>, rhs: &Operand<'tcx>, local_decls: &D, - tcx: TyCtxt<'a, 'tcx, 'tcx>) + tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> DefId where D: HasLocalDecls<'tcx> { @@ -142,7 +142,7 @@ fn check_lang_item_type<'a, 'tcx, D>( did } -fn lower_to<'a, 'tcx, D>(statement: &Statement<'tcx>, local_decls: &D, tcx: TyCtxt<'a, 'tcx, 'tcx>) +fn lower_to<'tcx, D>(statement: &Statement<'tcx>, local_decls: &D, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Option<(LangItem, RhsKind)> where D: HasLocalDecls<'tcx> { @@ -172,7 +172,7 @@ enum RhsKind { } impl RhsKind { - fn ty<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Option> { + fn ty<'a, 'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Option> { match *self { RhsKind::Unchanged => None, RhsKind::ForceU128 => Some(tcx.types.u128), diff --git a/src/librustc_mir/transform/mod.rs b/src/librustc_mir/transform/mod.rs index b6220ac1d21ff..db0a8351119f3 100644 --- a/src/librustc_mir/transform/mod.rs +++ b/src/librustc_mir/transform/mod.rs @@ -50,13 +50,13 @@ pub(crate) fn provide(providers: &mut Providers<'_>) { }; } -fn is_mir_available<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> bool { +fn is_mir_available<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> bool { tcx.mir_keys(def_id.krate).contains(&def_id) } /// Finds the full set of `DefId`s within the current crate that have /// MIR associated with them. -fn mir_keys<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, krate: CrateNum) +fn mir_keys<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, krate: CrateNum) -> &'tcx DefIdSet { assert_eq!(krate, LOCAL_CRATE); @@ -68,7 +68,7 @@ fn mir_keys<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, krate: CrateNum) // Additionally, tuple struct/variant constructors have MIR, but // they don't have a BodyId, so we need to build them separately. struct GatherCtors<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, set: &'a mut DefIdSet, } impl<'a, 'tcx> Visitor<'tcx> for GatherCtors<'a, 'tcx> { @@ -95,7 +95,7 @@ fn mir_keys<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, krate: CrateNum) tcx.arena.alloc(set) } -fn mir_built<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx Steal> { +fn mir_built<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx Steal> { let mir = build::mir_build(tcx, def_id); tcx.alloc_steal_mir(mir) } @@ -143,13 +143,13 @@ pub trait MirPass { } fn run_pass<'a, 'tcx>(&self, - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, source: MirSource<'tcx>, body: &mut Body<'tcx>); } pub fn run_passes( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, body: &mut Body<'tcx>, instance: InstanceDef<'tcx>, mir_phase: MirPhase, @@ -196,7 +196,7 @@ pub fn run_passes( } } -fn mir_const<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx Steal> { +fn mir_const<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx Steal> { // Unsafety check uses the raw mir, so make sure it is run let _ = tcx.unsafety_check_result(def_id); @@ -210,7 +210,7 @@ fn mir_const<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx Stea tcx.alloc_steal_mir(body) } -fn mir_validated<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx Steal> { +fn mir_validated(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx Steal> { let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); if let hir::BodyOwnerKind::Const = tcx.hir().body_owner_kind_by_hir_id(hir_id) { // Ensure that we compute the `mir_const_qualif` for constants at @@ -227,7 +227,7 @@ fn mir_validated<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx tcx.alloc_steal_mir(body) } -fn optimized_mir<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx Body<'tcx> { +fn optimized_mir<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx Body<'tcx> { if tcx.is_constructor(def_id) { // There's no reason to run all of the MIR passes on constructors when // we can just output the MIR we want directly. This also saves const diff --git a/src/librustc_mir/transform/no_landing_pads.rs b/src/librustc_mir/transform/no_landing_pads.rs index a987c19c2aba0..2d3823ae089eb 100644 --- a/src/librustc_mir/transform/no_landing_pads.rs +++ b/src/librustc_mir/transform/no_landing_pads.rs @@ -10,14 +10,14 @@ pub struct NoLandingPads; impl MirPass for NoLandingPads { fn run_pass<'a, 'tcx>(&self, - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, _: MirSource<'tcx>, body: &mut Body<'tcx>) { no_landing_pads(tcx, body) } } -pub fn no_landing_pads<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, body: &mut Body<'tcx>) { +pub fn no_landing_pads<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, body: &mut Body<'tcx>) { if tcx.sess.no_landing_pads() { NoLandingPads.visit_body(body); } diff --git a/src/librustc_mir/transform/promote_consts.rs b/src/librustc_mir/transform/promote_consts.rs index 4fbb95ec4ad35..9c54f9f4cde34 100644 --- a/src/librustc_mir/transform/promote_consts.rs +++ b/src/librustc_mir/transform/promote_consts.rs @@ -148,7 +148,7 @@ pub fn collect_temps(body: &Body<'_>, } struct Promoter<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, source: &'a mut Body<'tcx>, promoted: Body<'tcx>, temps: &'a mut IndexVec, @@ -370,7 +370,7 @@ impl<'a, 'tcx> MutVisitor<'tcx> for Promoter<'a, 'tcx> { } pub fn promote_candidates<'a, 'tcx>(body: &mut Body<'tcx>, - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, mut temps: IndexVec, candidates: Vec) { // Visit candidates in reverse, in case they're nested. diff --git a/src/librustc_mir/transform/qualify_consts.rs b/src/librustc_mir/transform/qualify_consts.rs index 19bd812ec80c0..1de94ff57b90e 100644 --- a/src/librustc_mir/transform/qualify_consts.rs +++ b/src/librustc_mir/transform/qualify_consts.rs @@ -124,7 +124,7 @@ impl IndexMut for PerQualif { } struct ConstCx<'a, 'tcx> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, mode: Mode, body: &'a Body<'tcx>, @@ -652,7 +652,7 @@ impl Deref for Checker<'a, 'tcx> { } impl<'a, 'tcx> Checker<'a, 'tcx> { - fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>, + fn new(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, body: &'a Body<'tcx>, mode: Mode) @@ -1472,7 +1472,7 @@ pub fn provide(providers: &mut Providers<'_>) { }; } -fn mir_const_qualif<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn mir_const_qualif<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> (u8, &'tcx BitSet) { // N.B., this `borrow()` is guaranteed to be valid (i.e., the value @@ -1493,7 +1493,7 @@ pub struct QualifyAndPromoteConstants; impl MirPass for QualifyAndPromoteConstants { fn run_pass<'a, 'tcx>(&self, - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, src: MirSource<'tcx>, body: &mut Body<'tcx>) { // There's not really any point in promoting errorful MIR. diff --git a/src/librustc_mir/transform/qualify_min_const_fn.rs b/src/librustc_mir/transform/qualify_min_const_fn.rs index 7bafef79acd1a..952d8f1ba0832 100644 --- a/src/librustc_mir/transform/qualify_min_const_fn.rs +++ b/src/librustc_mir/transform/qualify_min_const_fn.rs @@ -9,7 +9,7 @@ use syntax_pos::Span; type McfResult = Result<(), (Span, Cow<'static, str>)>; pub fn is_min_const_fn( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, body: &'a Body<'tcx>, ) -> McfResult { @@ -80,7 +80,7 @@ pub fn is_min_const_fn( } fn check_ty( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ty: Ty<'tcx>, span: Span, fn_def_id: DefId, @@ -129,7 +129,7 @@ fn check_ty( } fn check_rvalue( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, body: &'a Body<'tcx>, rvalue: &Rvalue<'tcx>, span: Span, @@ -209,7 +209,7 @@ fn check_rvalue( } fn check_statement( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, body: &'a Body<'tcx>, statement: &Statement<'tcx>, ) -> McfResult { @@ -279,7 +279,7 @@ fn check_place( } fn check_terminator( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, body: &'a Body<'tcx>, terminator: &Terminator<'tcx>, ) -> McfResult { @@ -375,7 +375,7 @@ fn check_terminator( /// for being called from stable `const fn`s (`min_const_fn`). /// /// Adding more intrinsics requires sign-off from @rust-lang/lang. -fn is_intrinsic_whitelisted(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> bool { +fn is_intrinsic_whitelisted(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> bool { match &tcx.item_name(def_id).as_str()[..] { | "size_of" | "min_align_of" diff --git a/src/librustc_mir/transform/remove_noop_landing_pads.rs b/src/librustc_mir/transform/remove_noop_landing_pads.rs index 30edf7f14a3d3..11209a6d119c5 100644 --- a/src/librustc_mir/transform/remove_noop_landing_pads.rs +++ b/src/librustc_mir/transform/remove_noop_landing_pads.rs @@ -10,7 +10,7 @@ use crate::util::patch::MirPatch; pub struct RemoveNoopLandingPads; pub fn remove_noop_landing_pads<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, body: &mut Body<'tcx>) { if tcx.sess.no_landing_pads() { @@ -23,7 +23,7 @@ pub fn remove_noop_landing_pads<'a, 'tcx>( impl MirPass for RemoveNoopLandingPads { fn run_pass<'a, 'tcx>(&self, - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, _src: MirSource<'tcx>, body: &mut Body<'tcx>) { remove_noop_landing_pads(tcx, body); diff --git a/src/librustc_mir/transform/rustc_peek.rs b/src/librustc_mir/transform/rustc_peek.rs index a6ae03e834b5e..ad9eab9f29be5 100644 --- a/src/librustc_mir/transform/rustc_peek.rs +++ b/src/librustc_mir/transform/rustc_peek.rs @@ -25,7 +25,7 @@ use crate::dataflow::has_rustc_mir_with; pub struct SanityCheck; impl MirPass for SanityCheck { - fn run_pass<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, + fn run_pass<'a, 'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, src: MirSource<'tcx>, body: &mut Body<'tcx>) { let def_id = src.def_id(); if !tcx.has_attr(def_id, sym::rustc_mir) { @@ -84,7 +84,7 @@ impl MirPass for SanityCheck { /// (If there are any calls to `rustc_peek` that do not match the /// expression form above, then that emits an error as well, but those /// errors are not intended to be used for unit tests.) -pub fn sanity_check_via_rustc_peek<'a, 'tcx, O>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +pub fn sanity_check_via_rustc_peek<'a, 'tcx, O>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, body: &Body<'tcx>, def_id: DefId, _attributes: &[ast::Attribute], @@ -101,7 +101,7 @@ pub fn sanity_check_via_rustc_peek<'a, 'tcx, O>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } } -fn each_block<'a, 'tcx, O>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn each_block<'a, 'tcx, O>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, body: &Body<'tcx>, results: &DataflowResults<'tcx, O>, bb: mir::BasicBlock) where @@ -214,7 +214,7 @@ fn each_block<'a, 'tcx, O>(tcx: TyCtxt<'a, 'tcx, 'tcx>, form `&expr`")); } -fn is_rustc_peek<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn is_rustc_peek<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, terminator: &'a Option>) -> Option<(&'a [mir::Operand<'tcx>], Span)> { if let Some(mir::Terminator { ref kind, source_info, .. }) = *terminator { diff --git a/src/librustc_mir/transform/simplify.rs b/src/librustc_mir/transform/simplify.rs index 4d1c90bc56d9e..4968040182c6b 100644 --- a/src/librustc_mir/transform/simplify.rs +++ b/src/librustc_mir/transform/simplify.rs @@ -58,7 +58,7 @@ impl MirPass for SimplifyCfg { } fn run_pass<'a, 'tcx>(&self, - _tcx: TyCtxt<'a, 'tcx, 'tcx>, + _tcx: TyCtxt<'tcx, 'tcx, 'tcx>, _src: MirSource<'tcx>, body: &mut Body<'tcx>) { debug!("SimplifyCfg({:?}) - simplifying {:?}", self.label, body); @@ -297,7 +297,7 @@ pub struct SimplifyLocals; impl MirPass for SimplifyLocals { fn run_pass<'a, 'tcx>(&self, - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, _: MirSource<'tcx>, body: &mut Body<'tcx>) { let mut marker = DeclMarker { locals: BitSet::new_empty(body.local_decls.len()) }; diff --git a/src/librustc_mir/transform/simplify_branches.rs b/src/librustc_mir/transform/simplify_branches.rs index 938fa772e9080..0cb971fd2cd85 100644 --- a/src/librustc_mir/transform/simplify_branches.rs +++ b/src/librustc_mir/transform/simplify_branches.rs @@ -20,7 +20,7 @@ impl MirPass for SimplifyBranches { } fn run_pass<'a, 'tcx>(&self, - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, _src: MirSource<'tcx>, body: &mut Body<'tcx>) { for block in body.basic_blocks_mut() { diff --git a/src/librustc_mir/transform/uniform_array_move_out.rs b/src/librustc_mir/transform/uniform_array_move_out.rs index fbfc296cc31fa..add562723a5e8 100644 --- a/src/librustc_mir/transform/uniform_array_move_out.rs +++ b/src/librustc_mir/transform/uniform_array_move_out.rs @@ -38,7 +38,7 @@ pub struct UniformArrayMoveOut; impl MirPass for UniformArrayMoveOut { fn run_pass<'a, 'tcx>(&self, - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, _src: MirSource<'tcx>, body: &mut Body<'tcx>) { let mut patch = MirPatch::new(body); @@ -53,7 +53,7 @@ impl MirPass for UniformArrayMoveOut { struct UniformArrayMoveOutVisitor<'a, 'tcx: 'a> { body: &'a Body<'tcx>, patch: &'a mut MirPatch<'tcx>, - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } impl<'a, 'tcx> Visitor<'tcx> for UniformArrayMoveOutVisitor<'a, 'tcx> { @@ -163,7 +163,7 @@ pub struct RestoreSubsliceArrayMoveOut; impl MirPass for RestoreSubsliceArrayMoveOut { fn run_pass<'a, 'tcx>(&self, - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, _src: MirSource<'tcx>, body: &mut Body<'tcx>) { let mut patch = MirPatch::new(body); diff --git a/src/librustc_mir/util/alignment.rs b/src/librustc_mir/util/alignment.rs index 788b7fdaaf912..c0f25de79300c 100644 --- a/src/librustc_mir/util/alignment.rs +++ b/src/librustc_mir/util/alignment.rs @@ -4,7 +4,7 @@ use rustc::mir::*; /// Returns `true` if this place is allowed to be less aligned /// than its containing struct (because it is within a packed /// struct). -pub fn is_disaligned<'a, 'tcx, L>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +pub fn is_disaligned<'a, 'tcx, L>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, local_decls: &L, param_env: ty::ParamEnv<'tcx>, place: &Place<'tcx>) @@ -32,7 +32,7 @@ pub fn is_disaligned<'a, 'tcx, L>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } } -fn is_within_packed<'a, 'tcx, L>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn is_within_packed<'a, 'tcx, L>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, local_decls: &L, place: &Place<'tcx>) -> bool diff --git a/src/librustc_mir/util/borrowck_errors.rs b/src/librustc_mir/util/borrowck_errors.rs index 37df368f3b725..6740fe5ff6ebd 100644 --- a/src/librustc_mir/util/borrowck_errors.rs +++ b/src/librustc_mir/util/borrowck_errors.rs @@ -788,25 +788,25 @@ pub trait BorrowckErrors<'cx>: Sized + Copy { } } -impl<'cx, 'gcx, 'tcx> BorrowckErrors<'cx> for TyCtxt<'cx, 'gcx, 'tcx> { +impl BorrowckErrors<'tcx> for TyCtxt<'tcx, 'gcx, 'tcx> { fn struct_span_err_with_code>( self, sp: S, msg: &str, code: DiagnosticId, - ) -> DiagnosticBuilder<'cx> { + ) -> DiagnosticBuilder<'tcx> { self.sess.struct_span_err_with_code(sp, msg, code) } - fn struct_span_err>(self, sp: S, msg: &str) -> DiagnosticBuilder<'cx> { + fn struct_span_err>(self, sp: S, msg: &str) -> DiagnosticBuilder<'tcx> { self.sess.struct_span_err(sp, msg) } fn cancel_if_wrong_origin( self, - mut diag: DiagnosticBuilder<'cx>, + mut diag: DiagnosticBuilder<'tcx>, o: Origin, - ) -> DiagnosticBuilder<'cx> { + ) -> DiagnosticBuilder<'tcx> { if !o.should_emit_errors(self.borrowck_mode()) { self.sess.diagnostic().cancel(&mut diag); } diff --git a/src/librustc_mir/util/elaborate_drops.rs b/src/librustc_mir/util/elaborate_drops.rs index b8ce31d0adfdc..d18abeeeb15c4 100644 --- a/src/librustc_mir/util/elaborate_drops.rs +++ b/src/librustc_mir/util/elaborate_drops.rs @@ -75,7 +75,7 @@ pub trait DropElaborator<'a, 'tcx: 'a> : fmt::Debug { fn patch(&mut self) -> &mut MirPatch<'tcx>; fn body(&self) -> &'a Body<'tcx>; - fn tcx(&self) -> TyCtxt<'a, 'tcx, 'tcx>; + fn tcx(&self) -> TyCtxt<'tcx, 'tcx, 'tcx>; fn param_env(&self) -> ty::ParamEnv<'tcx>; fn drop_style(&self, path: Self::Path, mode: DropFlagMode) -> DropStyle; @@ -126,7 +126,7 @@ where place.ty(self.elaborator.body(), self.tcx()).ty } - fn tcx(&self) -> TyCtxt<'b, 'tcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'tcx, 'tcx, 'tcx> { self.elaborator.tcx() } diff --git a/src/librustc_mir/util/graphviz.rs b/src/librustc_mir/util/graphviz.rs index fe0a119870140..c77eac861ee68 100644 --- a/src/librustc_mir/util/graphviz.rs +++ b/src/librustc_mir/util/graphviz.rs @@ -8,7 +8,7 @@ use std::io::{self, Write}; use super::pretty::dump_mir_def_ids; /// Write a graphviz DOT graph of a list of MIRs. -pub fn write_mir_graphviz<'tcx, W>(tcx: TyCtxt<'_, '_, 'tcx>, +pub fn write_mir_graphviz<'tcx, W>(tcx: TyCtxt<'tcx, '_, 'tcx>, single: Option, w: &mut W) -> io::Result<()> @@ -32,7 +32,7 @@ pub fn graphviz_safe_def_name(def_id: DefId) -> String { } /// Write a graphviz DOT graph of the MIR. -pub fn write_mir_fn_graphviz<'tcx, W>(tcx: TyCtxt<'_, '_, 'tcx>, +pub fn write_mir_fn_graphviz<'tcx, W>(tcx: TyCtxt<'tcx, '_, 'tcx>, def_id: DefId, body: &Body<'_>, w: &mut W) -> io::Result<()> @@ -133,7 +133,7 @@ fn write_edges(source: BasicBlock, body: &Body<'_>, w: &mut W) -> io:: /// Write the graphviz DOT label for the overall graph. This is essentially a block of text that /// will appear below the graph, showing the type of the `fn` this MIR represents and the types of /// all the variables and temporaries. -fn write_graph_label<'a, 'gcx, 'tcx, W: Write>(tcx: TyCtxt<'a, 'gcx, 'tcx>, +fn write_graph_label<'a, 'gcx, 'tcx, W: Write>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, def_id: DefId, body: &Body<'_>, w: &mut W) diff --git a/src/librustc_mir/util/liveness.rs b/src/librustc_mir/util/liveness.rs index 82ec5ab5f8a6a..33aedd065c3ca 100644 --- a/src/librustc_mir/util/liveness.rs +++ b/src/librustc_mir/util/liveness.rs @@ -255,7 +255,7 @@ fn block<'tcx>( } pub fn dump_mir<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, pass_name: &str, source: MirSource<'tcx>, body: &Body<'tcx>, @@ -272,7 +272,7 @@ pub fn dump_mir<'a, 'tcx>( } fn dump_matched_mir_node<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, pass_name: &str, node_path: &str, source: MirSource<'tcx>, @@ -295,7 +295,7 @@ fn dump_matched_mir_node<'a, 'tcx>( } pub fn write_mir_fn<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, src: MirSource<'tcx>, body: &Body<'tcx>, w: &mut dyn Write, diff --git a/src/librustc_mir/util/mod.rs b/src/librustc_mir/util/mod.rs index e340029434d81..441ef683673ba 100644 --- a/src/librustc_mir/util/mod.rs +++ b/src/librustc_mir/util/mod.rs @@ -22,7 +22,7 @@ pub use self::graphviz::write_node_label as write_graphviz_node_label; /// If possible, suggest replacing `ref` with `ref mut`. pub fn suggest_ref_mut<'cx, 'gcx, 'tcx>( - tcx: TyCtxt<'cx, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, binding_span: Span, ) -> Option<(String)> { let hi_src = tcx.sess.source_map().span_to_snippet(binding_span).unwrap(); diff --git a/src/librustc_mir/util/pretty.rs b/src/librustc_mir/util/pretty.rs index 2de58d2f3d60b..4dd892ac88b7b 100644 --- a/src/librustc_mir/util/pretty.rs +++ b/src/librustc_mir/util/pretty.rs @@ -63,7 +63,7 @@ pub enum PassWhere { /// - `foo & nll | bar & typeck` == match if `foo` and `nll` both appear in the name /// or `typeck` and `bar` both appear in the name. pub fn dump_mir<'a, 'gcx, 'tcx, F>( - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, pass_num: Option<&dyn Display>, pass_name: &str, disambiguator: &dyn Display, @@ -94,7 +94,7 @@ pub fn dump_mir<'a, 'gcx, 'tcx, F>( } pub fn dump_enabled<'a, 'gcx, 'tcx>( - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, pass_name: &str, source: MirSource<'tcx>, ) -> bool { @@ -118,7 +118,7 @@ pub fn dump_enabled<'a, 'gcx, 'tcx>( // run while we are already attempting to evaluate `type_of`. fn dump_matched_mir_node<'a, 'gcx, 'tcx, F>( - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, pass_num: Option<&dyn Display>, pass_name: &str, node_path: &str, @@ -241,7 +241,7 @@ pub(crate) fn create_dump_file( /// Write out a human-readable textual representation for the given MIR. pub fn write_mir_pretty<'a, 'gcx, 'tcx>( - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, single: Option, w: &mut dyn Write, ) -> io::Result<()> { @@ -280,7 +280,7 @@ pub fn write_mir_pretty<'a, 'gcx, 'tcx>( } pub fn write_mir_fn<'a, 'gcx, 'tcx, F>( - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, src: MirSource<'tcx>, body: &Body<'tcx>, extra_data: &mut F, @@ -304,7 +304,7 @@ where /// Write out a human-readable textual representation for the given basic block. pub fn write_basic_block<'cx, 'gcx, 'tcx, F>( - tcx: TyCtxt<'cx, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, block: BasicBlock, body: &Body<'tcx>, extra_data: &mut F, @@ -371,12 +371,12 @@ where /// information. There's often a lot of little things "nuzzled up" in /// a statement. fn write_extra<'cx, 'gcx, 'tcx, F>( - tcx: TyCtxt<'cx, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, write: &mut dyn Write, mut visit_op: F, ) -> io::Result<()> where - F: FnMut(&mut ExtraComments<'cx, 'gcx, 'tcx>), + F: FnMut(&mut ExtraComments<'gcx, 'tcx>), { let mut extra_comments = ExtraComments { _tcx: tcx, @@ -389,12 +389,12 @@ where Ok(()) } -struct ExtraComments<'cx, 'gcx: 'tcx, 'tcx: 'cx> { - _tcx: TyCtxt<'cx, 'gcx, 'tcx>, // don't need it now, but bet we will soon +struct ExtraComments<'gcx, 'tcx> { + _tcx: TyCtxt<'tcx, 'gcx, 'tcx>, // don't need it now, but bet we will soon comments: Vec, } -impl<'cx, 'gcx, 'tcx> ExtraComments<'cx, 'gcx, 'tcx> { +impl ExtraComments<'gcx, 'tcx> { fn push(&mut self, lines: &str) { for line in lines.split('\n') { self.comments.push(line.to_string()); @@ -402,7 +402,7 @@ impl<'cx, 'gcx, 'tcx> ExtraComments<'cx, 'gcx, 'tcx> { } } -impl<'cx, 'gcx, 'tcx> Visitor<'tcx> for ExtraComments<'cx, 'gcx, 'tcx> { +impl Visitor<'tcx> for ExtraComments<'gcx, 'tcx> { fn visit_constant(&mut self, constant: &Constant<'tcx>, location: Location) { self.super_constant(constant, location); let Constant { span, ty, user_ty, literal } = constant; @@ -539,7 +539,7 @@ fn write_scope_tree( /// Write out a human-readable textual representation of the MIR's `fn` type and the types of its /// local variables (both user-defined bindings and compiler temporaries). pub fn write_mir_intro<'a, 'gcx, 'tcx>( - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, src: MirSource<'tcx>, body: &Body<'_>, w: &mut dyn Write, diff --git a/src/librustc_passes/layout_test.rs b/src/librustc_passes/layout_test.rs index dea5774aa6eb7..27888ca92ee8d 100644 --- a/src/librustc_passes/layout_test.rs +++ b/src/librustc_passes/layout_test.rs @@ -14,7 +14,7 @@ use rustc::ty::TyCtxt; use syntax::ast::Attribute; use syntax::symbol::sym; -pub fn test_layout<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { +pub fn test_layout<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { if tcx.features().rustc_attrs { // if the `rustc_attrs` feature is not enabled, don't bother testing layout tcx.hir() @@ -23,11 +23,11 @@ pub fn test_layout<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { } } -struct VarianceTest<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, +struct VarianceTest<'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } -impl<'a, 'tcx> ItemLikeVisitor<'tcx> for VarianceTest<'a, 'tcx> { +impl ItemLikeVisitor<'tcx> for VarianceTest<'tcx> { fn visit_item(&mut self, item: &'tcx hir::Item) { let item_def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id); @@ -44,7 +44,7 @@ impl<'a, 'tcx> ItemLikeVisitor<'tcx> for VarianceTest<'a, 'tcx> { fn visit_impl_item(&mut self, _: &'tcx hir::ImplItem) {} } -impl<'a, 'tcx> VarianceTest<'a, 'tcx> { +impl VarianceTest<'tcx> { fn dump_layout_of(&self, item_def_id: DefId, item: &hir::Item, attr: &Attribute) { let tcx = self.tcx; let param_env = self.tcx.param_env(item_def_id); @@ -104,12 +104,12 @@ impl<'a, 'tcx> VarianceTest<'a, 'tcx> { } } -struct UnwrapLayoutCx<'me, 'tcx> { - tcx: TyCtxt<'me, 'tcx, 'tcx>, +struct UnwrapLayoutCx<'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, param_env: ParamEnv<'tcx>, } -impl<'me, 'tcx> LayoutOf for UnwrapLayoutCx<'me, 'tcx> { +impl LayoutOf for UnwrapLayoutCx<'tcx> { type Ty = Ty<'tcx>; type TyLayout = TyLayout<'tcx>; @@ -118,19 +118,19 @@ impl<'me, 'tcx> LayoutOf for UnwrapLayoutCx<'me, 'tcx> { } } -impl<'me, 'tcx> HasTyCtxt<'tcx> for UnwrapLayoutCx<'me, 'tcx> { - fn tcx<'a>(&'a self) -> TyCtxt<'a, 'tcx, 'tcx> { +impl HasTyCtxt<'tcx> for UnwrapLayoutCx<'tcx> { + fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx, 'tcx> { self.tcx } } -impl<'me, 'tcx> HasParamEnv<'tcx> for UnwrapLayoutCx<'me, 'tcx> { +impl HasParamEnv<'tcx> for UnwrapLayoutCx<'tcx> { fn param_env(&self) -> ParamEnv<'tcx> { self.param_env } } -impl<'me, 'tcx> HasDataLayout for UnwrapLayoutCx<'me, 'tcx> { +impl HasDataLayout for UnwrapLayoutCx<'tcx> { fn data_layout(&self) -> &TargetDataLayout { self.tcx.data_layout() } diff --git a/src/librustc_passes/lib.rs b/src/librustc_passes/lib.rs index fbd6ddf84c33a..bf2f7634e55a1 100644 --- a/src/librustc_passes/lib.rs +++ b/src/librustc_passes/lib.rs @@ -6,6 +6,7 @@ #![doc(html_root_url = "https://doc.rust-lang.org/nightly/")] +#![feature(in_band_lifetimes)] #![feature(nll)] #![feature(rustc_diagnostic_macros)] diff --git a/src/librustc_passes/loops.rs b/src/librustc_passes/loops.rs index 97bbb0adb2d79..6bcf4365db0a4 100644 --- a/src/librustc_passes/loops.rs +++ b/src/librustc_passes/loops.rs @@ -45,7 +45,7 @@ struct CheckLoopVisitor<'a, 'hir: 'a> { cx: Context, } -fn check_mod_loops<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, module_def_id: DefId) { +fn check_mod_loops<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, module_def_id: DefId) { tcx.hir().visit_item_likes_in_module(module_def_id, &mut CheckLoopVisitor { sess: &tcx.sess, hir_map: &tcx.hir(), diff --git a/src/librustc_passes/rvalue_promotion.rs b/src/librustc_passes/rvalue_promotion.rs index 869cae3d3a8e4..d6f5ed6fc03e2 100644 --- a/src/librustc_passes/rvalue_promotion.rs +++ b/src/librustc_passes/rvalue_promotion.rs @@ -39,7 +39,7 @@ pub fn provide(providers: &mut Providers<'_>) { }; } -fn const_is_rvalue_promotable_to_static<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn const_is_rvalue_promotable_to_static<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> bool { @@ -51,7 +51,7 @@ fn const_is_rvalue_promotable_to_static<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, tcx.rvalue_promotable_map(def_id).contains(&body_id.hir_id.local_id) } -fn rvalue_promotable_map<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn rvalue_promotable_map<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ItemLocalSet { @@ -81,7 +81,7 @@ fn rvalue_promotable_map<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } struct CheckCrateVisitor<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, in_fn: bool, in_static: bool, mut_rvalue_borrows: HirIdSet, diff --git a/src/librustc_plugin/build.rs b/src/librustc_plugin/build.rs index 8259419c64aeb..31dec72c0e41b 100644 --- a/src/librustc_plugin/build.rs +++ b/src/librustc_plugin/build.rs @@ -30,12 +30,12 @@ impl<'v> ItemLikeVisitor<'v> for RegistrarFinder { } /// Finds the function marked with `#[plugin_registrar]`, if any. -pub fn find_plugin_registrar<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>) -> Option { +pub fn find_plugin_registrar<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Option { tcx.plugin_registrar_fn(LOCAL_CRATE) } fn plugin_registrar_fn<'tcx>( - tcx: TyCtxt<'_, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, cnum: CrateNum, ) -> Option { assert_eq!(cnum, LOCAL_CRATE); diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index 42b70dd181b3c..14a4e335de674 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -4,6 +4,7 @@ #![deny(internal)] #![deny(unused_lifetimes)] +#![feature(in_band_lifetimes)] #![feature(nll)] #![feature(rustc_diagnostic_macros)] @@ -47,14 +48,14 @@ mod error_codes; /// First, it doesn't have overridable `fn visit_trait_ref`, so we have to catch trait `DefId`s /// manually. Second, it doesn't visit some type components like signatures of fn types, or traits /// in `impl Trait`, see individual comments in `DefIdVisitorSkeleton::visit_ty`. -trait DefIdVisitor<'a, 'tcx: 'a> { - fn tcx(&self) -> TyCtxt<'a, 'tcx, 'tcx>; +trait DefIdVisitor<'tcx> { + fn tcx(&self) -> TyCtxt<'tcx, 'tcx, 'tcx>; fn shallow(&self) -> bool { false } fn skip_assoc_tys(&self) -> bool { false } fn visit_def_id(&mut self, def_id: DefId, kind: &str, descr: &dyn fmt::Display) -> bool; /// Not overridden, but used to actually visit types and traits. - fn skeleton(&mut self) -> DefIdVisitorSkeleton<'_, 'a, 'tcx, Self> { + fn skeleton(&mut self) -> DefIdVisitorSkeleton<'_, 'tcx, Self> { DefIdVisitorSkeleton { def_id_visitor: self, visited_opaque_tys: Default::default(), @@ -72,16 +73,16 @@ trait DefIdVisitor<'a, 'tcx: 'a> { } } -struct DefIdVisitorSkeleton<'v, 'a, 'tcx, V> - where V: DefIdVisitor<'a, 'tcx> + ?Sized +struct DefIdVisitorSkeleton<'v, 'tcx, V> + where V: DefIdVisitor<'tcx> + ?Sized { def_id_visitor: &'v mut V, visited_opaque_tys: FxHashSet, - dummy: PhantomData>, + dummy: PhantomData>, } -impl<'a, 'tcx, V> DefIdVisitorSkeleton<'_, 'a, 'tcx, V> - where V: DefIdVisitor<'a, 'tcx> + ?Sized +impl<'tcx, V> DefIdVisitorSkeleton<'_, 'tcx, V> + where V: DefIdVisitor<'tcx> + ?Sized { fn visit_trait(&mut self, trait_ref: TraitRef<'tcx>) -> bool { let TraitRef { def_id, substs } = trait_ref; @@ -123,8 +124,8 @@ impl<'a, 'tcx, V> DefIdVisitorSkeleton<'_, 'a, 'tcx, V> } } -impl<'a, 'tcx, V> TypeVisitor<'tcx> for DefIdVisitorSkeleton<'_, 'a, 'tcx, V> - where V: DefIdVisitor<'a, 'tcx> + ?Sized +impl<'tcx, V> TypeVisitor<'tcx> for DefIdVisitorSkeleton<'_, 'tcx, V> + where V: DefIdVisitor<'tcx> + ?Sized { fn visit_ty(&mut self, ty: Ty<'tcx>) -> bool { let tcx = self.def_id_visitor.tcx(); @@ -219,7 +220,7 @@ impl<'a, 'tcx, V> TypeVisitor<'tcx> for DefIdVisitorSkeleton<'_, 'a, 'tcx, V> } } -fn def_id_visibility<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) +fn def_id_visibility<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> (ty::Visibility, Span, &'static str) { match tcx.hir().as_local_hir_id(def_id) { Some(hir_id) => { @@ -322,7 +323,7 @@ fn def_id_visibility<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) // Set the correct `TypeckTables` for the given `item_id` (or an empty table if // there is no `TypeckTables` for the item). -fn item_tables<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn item_tables<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, hir_id: hir::HirId, empty_tables: &'a ty::TypeckTables<'tcx>) -> &'a ty::TypeckTables<'tcx> { @@ -330,7 +331,7 @@ fn item_tables<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, if tcx.has_typeck_tables(def_id) { tcx.typeck_tables_of(def_id) } else { empty_tables } } -fn min<'a, 'tcx>(vis1: ty::Visibility, vis2: ty::Visibility, tcx: TyCtxt<'a, 'tcx, 'tcx>) +fn min<'a, 'tcx>(vis1: ty::Visibility, vis2: ty::Visibility, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> ty::Visibility { if vis1.is_at_least(vis2, tcx) { vis2 } else { vis1 } } @@ -341,12 +342,12 @@ fn min<'a, 'tcx>(vis1: ty::Visibility, vis2: ty::Visibility, tcx: TyCtxt<'a, 'tc /// This is done so that `private_in_public` warnings can be turned into hard errors /// in crates that have been updated to use pub(restricted). //////////////////////////////////////////////////////////////////////////////// -struct PubRestrictedVisitor<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, +struct PubRestrictedVisitor<'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, has_pub_restricted: bool, } -impl<'a, 'tcx> Visitor<'tcx> for PubRestrictedVisitor<'a, 'tcx> { +impl Visitor<'tcx> for PubRestrictedVisitor<'tcx> { fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> { NestedVisitorMap::All(&self.tcx.hir()) } @@ -360,13 +361,13 @@ impl<'a, 'tcx> Visitor<'tcx> for PubRestrictedVisitor<'a, 'tcx> { //////////////////////////////////////////////////////////////////////////////// struct FindMin<'a, 'tcx, VL: VisibilityLike> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, access_levels: &'a AccessLevels, min: VL, } -impl<'a, 'tcx, VL: VisibilityLike> DefIdVisitor<'a, 'tcx> for FindMin<'a, 'tcx, VL> { - fn tcx(&self) -> TyCtxt<'a, 'tcx, 'tcx> { self.tcx } +impl<'a, 'tcx, VL: VisibilityLike> DefIdVisitor<'tcx> for FindMin<'a, 'tcx, VL> { + fn tcx(&self) -> TyCtxt<'tcx, 'tcx, 'tcx> { self.tcx } fn shallow(&self) -> bool { VL::SHALLOW } fn skip_assoc_tys(&self) -> bool { true } fn visit_def_id(&mut self, def_id: DefId, _kind: &str, _descr: &dyn fmt::Display) -> bool { @@ -382,7 +383,7 @@ trait VisibilityLike: Sized { // Returns an over-approximation (`skip_assoc_tys` = true) of visibility due to // associated types for which we can't determine visibility precisely. - fn of_impl<'a, 'tcx>(hir_id: hir::HirId, tcx: TyCtxt<'a, 'tcx, 'tcx>, + fn of_impl<'a, 'tcx>(hir_id: hir::HirId, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, access_levels: &'a AccessLevels) -> Self { let mut find = FindMin { tcx, access_levels, min: Self::MAX }; let def_id = tcx.hir().local_def_id_from_hir_id(hir_id); @@ -424,8 +425,8 @@ impl VisibilityLike for Option { /// The embargo visitor, used to determine the exports of the AST. //////////////////////////////////////////////////////////////////////////////// -struct EmbargoVisitor<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, +struct EmbargoVisitor<'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, // Accessibility levels for reachable nodes. access_levels: AccessLevels, @@ -435,13 +436,13 @@ struct EmbargoVisitor<'a, 'tcx: 'a> { changed: bool, } -struct ReachEverythingInTheInterfaceVisitor<'b, 'a: 'b, 'tcx: 'a> { +struct ReachEverythingInTheInterfaceVisitor<'a, 'tcx> { access_level: Option, item_def_id: DefId, - ev: &'b mut EmbargoVisitor<'a, 'tcx>, + ev: &'a mut EmbargoVisitor<'tcx>, } -impl<'a, 'tcx> EmbargoVisitor<'a, 'tcx> { +impl EmbargoVisitor<'tcx> { fn get(&self, id: hir::HirId) -> Option { self.access_levels.map.get(&id).cloned() } @@ -460,7 +461,7 @@ impl<'a, 'tcx> EmbargoVisitor<'a, 'tcx> { } fn reach(&mut self, item_id: hir::HirId, access_level: Option) - -> ReachEverythingInTheInterfaceVisitor<'_, 'a, 'tcx> { + -> ReachEverythingInTheInterfaceVisitor<'_, 'tcx> { ReachEverythingInTheInterfaceVisitor { access_level: cmp::min(access_level, Some(AccessLevel::Reachable)), item_def_id: self.tcx.hir().local_def_id_from_hir_id(item_id), @@ -506,7 +507,7 @@ impl<'a, 'tcx> EmbargoVisitor<'a, 'tcx> { } } -impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> { +impl Visitor<'tcx> for EmbargoVisitor<'tcx> { /// We want to visit items in the context of their containing /// module and so forth, so supply a crate for doing a deep walk. fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> { @@ -777,7 +778,7 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> { } } -impl<'a, 'tcx> ReachEverythingInTheInterfaceVisitor<'_, 'a, 'tcx> { +impl ReachEverythingInTheInterfaceVisitor<'_, 'tcx> { fn generics(&mut self) -> &mut Self { for param in &self.ev.tcx.generics_of(self.item_def_id).params { match param.kind { @@ -813,8 +814,8 @@ impl<'a, 'tcx> ReachEverythingInTheInterfaceVisitor<'_, 'a, 'tcx> { } } -impl<'a, 'tcx> DefIdVisitor<'a, 'tcx> for ReachEverythingInTheInterfaceVisitor<'_, 'a, 'tcx> { - fn tcx(&self) -> TyCtxt<'a, 'tcx, 'tcx> { self.ev.tcx } +impl DefIdVisitor<'tcx> for ReachEverythingInTheInterfaceVisitor<'_, 'tcx> { + fn tcx(&self) -> TyCtxt<'tcx, 'tcx, 'tcx> { self.ev.tcx } fn visit_def_id(&mut self, def_id: DefId, _kind: &str, _descr: &dyn fmt::Display) -> bool { if let Some(hir_id) = self.ev.tcx.hir().as_local_hir_id(def_id) { self.ev.update(hir_id, self.access_level); @@ -831,7 +832,7 @@ impl<'a, 'tcx> DefIdVisitor<'a, 'tcx> for ReachEverythingInTheInterfaceVisitor<' ////////////////////////////////////////////////////////////////////////////////////// struct NamePrivacyVisitor<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, tables: &'a ty::TypeckTables<'tcx>, current_item: hir::HirId, empty_tables: &'a ty::TypeckTables<'tcx>, @@ -958,7 +959,7 @@ impl<'a, 'tcx> Visitor<'tcx> for NamePrivacyVisitor<'a, 'tcx> { //////////////////////////////////////////////////////////////////////////////////////////// struct TypePrivacyVisitor<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, tables: &'a ty::TypeckTables<'tcx>, current_item: DefId, in_body: bool, @@ -1176,8 +1177,8 @@ impl<'a, 'tcx> Visitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> { } } -impl<'a, 'tcx> DefIdVisitor<'a, 'tcx> for TypePrivacyVisitor<'a, 'tcx> { - fn tcx(&self) -> TyCtxt<'a, 'tcx, 'tcx> { self.tcx } +impl DefIdVisitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> { + fn tcx(&self) -> TyCtxt<'tcx, 'tcx, 'tcx> { self.tcx } fn visit_def_id(&mut self, def_id: DefId, kind: &str, descr: &dyn fmt::Display) -> bool { self.check_def_id(def_id, kind, descr) } @@ -1191,7 +1192,7 @@ impl<'a, 'tcx> DefIdVisitor<'a, 'tcx> for TypePrivacyVisitor<'a, 'tcx> { /////////////////////////////////////////////////////////////////////////////// struct ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, access_levels: &'a AccessLevels, in_variant: bool, // Set of errors produced by this obsolete visitor. @@ -1534,8 +1535,8 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { /// and traits in public interfaces. /////////////////////////////////////////////////////////////////////////////// -struct SearchInterfaceForPrivateItemsVisitor<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, +struct SearchInterfaceForPrivateItemsVisitor<'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item_id: hir::HirId, item_def_id: DefId, span: Span, @@ -1546,7 +1547,7 @@ struct SearchInterfaceForPrivateItemsVisitor<'a, 'tcx: 'a> { in_assoc_ty: bool, } -impl<'a, 'tcx: 'a> SearchInterfaceForPrivateItemsVisitor<'a, 'tcx> { +impl SearchInterfaceForPrivateItemsVisitor<'tcx> { fn generics(&mut self) -> &mut Self { for param in &self.tcx.generics_of(self.item_def_id).params { match param.kind { @@ -1632,22 +1633,22 @@ impl<'a, 'tcx: 'a> SearchInterfaceForPrivateItemsVisitor<'a, 'tcx> { } } -impl<'a, 'tcx> DefIdVisitor<'a, 'tcx> for SearchInterfaceForPrivateItemsVisitor<'a, 'tcx> { - fn tcx(&self) -> TyCtxt<'a, 'tcx, 'tcx> { self.tcx } +impl DefIdVisitor<'tcx> for SearchInterfaceForPrivateItemsVisitor<'tcx> { + fn tcx(&self) -> TyCtxt<'tcx, 'tcx, 'tcx> { self.tcx } fn visit_def_id(&mut self, def_id: DefId, kind: &str, descr: &dyn fmt::Display) -> bool { self.check_def_id(def_id, kind, descr) } } struct PrivateItemsInPublicInterfacesVisitor<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, has_pub_restricted: bool, old_error_set: &'a HirIdSet, } impl<'a, 'tcx> PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> { fn check(&self, item_id: hir::HirId, required_visibility: ty::Visibility) - -> SearchInterfaceForPrivateItemsVisitor<'a, 'tcx> { + -> SearchInterfaceForPrivateItemsVisitor<'tcx> { let mut has_old_errors = false; // Slow path taken only if there any errors in the crate. @@ -1813,7 +1814,7 @@ pub fn provide(providers: &mut Providers<'_>) { }; } -fn check_mod_privacy<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, module_def_id: DefId) { +fn check_mod_privacy<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, module_def_id: DefId) { let empty_tables = ty::TypeckTables::empty(None); // Check privacy of names not checked in previous compilation stages. @@ -1841,7 +1842,7 @@ fn check_mod_privacy<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, module_def_id: DefId) { } fn privacy_access_levels<'tcx>( - tcx: TyCtxt<'_, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, krate: CrateNum, ) -> &'tcx AccessLevels { assert_eq!(krate, LOCAL_CRATE); @@ -1867,7 +1868,7 @@ fn privacy_access_levels<'tcx>( tcx.arena.alloc(visitor.access_levels) } -fn check_private_in_public<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, krate: CrateNum) { +fn check_private_in_public<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, krate: CrateNum) { assert_eq!(krate, LOCAL_CRATE); let access_levels = tcx.privacy_access_levels(LOCAL_CRATE); diff --git a/src/librustc_save_analysis/dump_visitor.rs b/src/librustc_save_analysis/dump_visitor.rs index 06758044a2166..e000679ffe36a 100644 --- a/src/librustc_save_analysis/dump_visitor.rs +++ b/src/librustc_save_analysis/dump_visitor.rs @@ -77,7 +77,7 @@ macro_rules! access_from_vis { pub struct DumpVisitor<'l, 'tcx: 'l, 'll, O: DumpOutput> { save_ctxt: SaveContext<'l, 'tcx>, - tcx: TyCtxt<'l, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, dumper: &'ll mut JsonDumper, span: SpanUtils<'l>, diff --git a/src/librustc_save_analysis/lib.rs b/src/librustc_save_analysis/lib.rs index 30b0250cec182..1e143942a791c 100644 --- a/src/librustc_save_analysis/lib.rs +++ b/src/librustc_save_analysis/lib.rs @@ -52,7 +52,7 @@ use log::{debug, error, info}; pub struct SaveContext<'l, 'tcx: 'l> { - tcx: TyCtxt<'l, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, tables: &'l ty::TypeckTables<'tcx>, access_levels: &'l AccessLevels, span_utils: SpanUtils<'tcx>, @@ -1115,7 +1115,7 @@ impl<'b> SaveHandler for CallbackHandler<'b> { } pub fn process_crate<'l, 'tcx, H: SaveHandler>( - tcx: TyCtxt<'l, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, krate: &ast::Crate, cratename: &str, input: &'l Input, diff --git a/src/librustc_traits/chalk_context/mod.rs b/src/librustc_traits/chalk_context/mod.rs index bf61a558a46f6..2cf28a9fcb4ac 100644 --- a/src/librustc_traits/chalk_context/mod.rs +++ b/src/librustc_traits/chalk_context/mod.rs @@ -50,9 +50,9 @@ crate struct ChalkArenas<'gcx> { } #[derive(Copy, Clone)] -crate struct ChalkContext<'cx, 'gcx: 'cx> { +crate struct ChalkContext<'gcx> { _arenas: ChalkArenas<'gcx>, - tcx: TyCtxt<'cx, 'gcx, 'gcx>, + tcx: TyCtxt<'gcx, 'gcx, 'gcx>, } #[derive(Copy, Clone)] @@ -126,7 +126,7 @@ impl context::Context for ChalkArenas<'tcx> { } } -impl context::AggregateOps> for ChalkContext<'cx, 'gcx> { +impl context::AggregateOps> for ChalkContext<'gcx> { fn make_solution( &self, root_goal: &Canonical<'gcx, InEnvironment<'gcx, Goal<'gcx>>>, @@ -176,7 +176,7 @@ impl context::AggregateOps> for ChalkContext<'cx, 'gcx> { } } -impl context::ContextOps> for ChalkContext<'cx, 'gcx> { +impl context::ContextOps> for ChalkContext<'gcx> { /// Returns `true` if this is a coinductive goal: basically proving that an auto trait /// is implemented or proving that a trait reference is well-formed. fn is_coinductive( @@ -508,7 +508,7 @@ type ChalkHhGoal<'tcx> = HhGoal>; type ChalkExClause<'tcx> = ExClause>; -impl Debug for ChalkContext<'cx, 'gcx> { +impl Debug for ChalkContext<'gcx> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "ChalkContext") } @@ -527,7 +527,7 @@ impl ChalkContextLift<'tcx> for ChalkArenas<'a> { fn lift_ex_clause_to_tcx( ex_clause: &ChalkExClause<'a>, - tcx: TyCtxt<'_, 'gcx, 'tcx> + tcx: TyCtxt<'tcx, 'gcx, 'tcx> ) -> Option { Some(ChalkExClause { subst: tcx.lift(&ex_clause.subst)?, @@ -539,7 +539,7 @@ impl ChalkContextLift<'tcx> for ChalkArenas<'a> { fn lift_delayed_literal_to_tcx( literal: &DelayedLiteral>, - tcx: TyCtxt<'_, 'gcx, 'tcx> + tcx: TyCtxt<'tcx, 'gcx, 'tcx> ) -> Option { Some(match literal { DelayedLiteral::CannotProve(()) => DelayedLiteral::CannotProve(()), @@ -553,7 +553,7 @@ impl ChalkContextLift<'tcx> for ChalkArenas<'a> { fn lift_literal_to_tcx( literal: &Literal>, - tcx: TyCtxt<'_, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, ) -> Option { Some(match literal { Literal::Negative(goal) => Literal::Negative(tcx.lift(goal)?), @@ -673,7 +673,7 @@ crate fn provide(p: &mut Providers<'_>) { } crate fn evaluate_goal<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, goal: ChalkCanonicalGoal<'tcx> ) -> Result< &'tcx Canonical<'tcx, QueryResponse<'tcx, ()>>, diff --git a/src/librustc_traits/chalk_context/program_clauses/builtin.rs b/src/librustc_traits/chalk_context/program_clauses/builtin.rs index bd72a049b772e..53375bd4cc9da 100644 --- a/src/librustc_traits/chalk_context/program_clauses/builtin.rs +++ b/src/librustc_traits/chalk_context/program_clauses/builtin.rs @@ -15,7 +15,7 @@ use crate::generic_types; /// `Implemented(ty: Trait) :- Implemented(nested: Trait)...` /// where `Trait` is specified by `trait_def_id`. fn builtin_impl_clause( - tcx: TyCtxt<'_, '_, 'tcx>, + tcx: TyCtxt<'tcx, '_, 'tcx>, ty: Ty<'tcx>, nested: &[Kind<'tcx>], trait_def_id: DefId @@ -43,7 +43,7 @@ fn builtin_impl_clause( } crate fn assemble_builtin_unsize_impls<'tcx>( - tcx: TyCtxt<'_, '_, 'tcx>, + tcx: TyCtxt<'tcx, '_, 'tcx>, unsize_def_id: DefId, source: Ty<'tcx>, target: Ty<'tcx>, @@ -119,7 +119,7 @@ crate fn assemble_builtin_unsize_impls<'tcx>( } crate fn assemble_builtin_sized_impls<'tcx>( - tcx: TyCtxt<'_, '_, 'tcx>, + tcx: TyCtxt<'tcx, '_, 'tcx>, sized_def_id: DefId, ty: Ty<'tcx>, clauses: &mut Vec> @@ -223,7 +223,7 @@ crate fn assemble_builtin_sized_impls<'tcx>( } crate fn assemble_builtin_copy_clone_impls<'tcx>( - tcx: TyCtxt<'_, '_, 'tcx>, + tcx: TyCtxt<'tcx, '_, 'tcx>, trait_def_id: DefId, ty: Ty<'tcx>, clauses: &mut Vec> diff --git a/src/librustc_traits/chalk_context/program_clauses/mod.rs b/src/librustc_traits/chalk_context/program_clauses/mod.rs index c1f14cd3f8ed5..2bd3902c74350 100644 --- a/src/librustc_traits/chalk_context/program_clauses/mod.rs +++ b/src/librustc_traits/chalk_context/program_clauses/mod.rs @@ -19,7 +19,7 @@ use self::primitive::*; use self::builtin::*; fn assemble_clauses_from_impls<'tcx>( - tcx: TyCtxt<'_, '_, 'tcx>, + tcx: TyCtxt<'tcx, '_, 'tcx>, trait_def_id: DefId, clauses: &mut Vec> ) { @@ -33,7 +33,7 @@ fn assemble_clauses_from_impls<'tcx>( } fn assemble_clauses_from_assoc_ty_values<'tcx>( - tcx: TyCtxt<'_, '_, 'tcx>, + tcx: TyCtxt<'tcx, '_, 'tcx>, trait_def_id: DefId, clauses: &mut Vec> ) { diff --git a/src/librustc_traits/chalk_context/program_clauses/primitive.rs b/src/librustc_traits/chalk_context/program_clauses/primitive.rs index c37c8faaacde4..a4c3b62a6b772 100644 --- a/src/librustc_traits/chalk_context/program_clauses/primitive.rs +++ b/src/librustc_traits/chalk_context/program_clauses/primitive.rs @@ -16,7 +16,7 @@ use crate::generic_types; use std::iter; crate fn wf_clause_for_raw_ptr<'tcx>( - tcx: TyCtxt<'_, '_, 'tcx>, + tcx: TyCtxt<'tcx, '_, 'tcx>, mutbl: hir::Mutability ) -> Clauses<'tcx> { let ptr_ty = generic_types::raw_ptr(tcx, mutbl); @@ -33,7 +33,7 @@ crate fn wf_clause_for_raw_ptr<'tcx>( } crate fn wf_clause_for_fn_ptr<'tcx>( - tcx: TyCtxt<'_, '_, 'tcx>, + tcx: TyCtxt<'tcx, '_, 'tcx>, arity_and_output: usize, variadic: bool, unsafety: hir::Unsafety, @@ -53,7 +53,7 @@ crate fn wf_clause_for_fn_ptr<'tcx>( tcx.mk_clauses(iter::once(wf_clause)) } -crate fn wf_clause_for_slice<'tcx>(tcx: TyCtxt<'_, '_, 'tcx>) -> Clauses<'tcx> { +crate fn wf_clause_for_slice<'tcx>(tcx: TyCtxt<'tcx, '_, 'tcx>) -> Clauses<'tcx> { let ty = generic_types::bound(tcx, 0); let slice_ty = tcx.mk_slice(ty); @@ -83,7 +83,7 @@ crate fn wf_clause_for_slice<'tcx>(tcx: TyCtxt<'_, '_, 'tcx>) -> Clauses<'tcx> { } crate fn wf_clause_for_array<'tcx>( - tcx: TyCtxt<'_, '_, 'tcx>, + tcx: TyCtxt<'tcx, '_, 'tcx>, length: &'tcx ty::Const<'tcx> ) -> Clauses<'tcx> { let ty = generic_types::bound(tcx, 0); @@ -115,7 +115,7 @@ crate fn wf_clause_for_array<'tcx>( } crate fn wf_clause_for_tuple<'tcx>( - tcx: TyCtxt<'_, '_, 'tcx>, + tcx: TyCtxt<'tcx, '_, 'tcx>, arity: usize ) -> Clauses<'tcx> { let type_list = generic_types::type_list(tcx, arity); @@ -159,7 +159,7 @@ crate fn wf_clause_for_tuple<'tcx>( } crate fn wf_clause_for_ref<'tcx>( - tcx: TyCtxt<'_, '_, 'tcx>, + tcx: TyCtxt<'tcx, '_, 'tcx>, mutbl: hir::Mutability ) -> Clauses<'tcx> { let region = tcx.mk_region( @@ -186,7 +186,7 @@ crate fn wf_clause_for_ref<'tcx>( } crate fn wf_clause_for_fn_def<'tcx>( - tcx: TyCtxt<'_, '_, 'tcx>, + tcx: TyCtxt<'tcx, '_, 'tcx>, def_id: DefId ) -> Clauses<'tcx> { let fn_def = generic_types::fn_def(tcx, def_id); diff --git a/src/librustc_traits/chalk_context/resolvent_ops.rs b/src/librustc_traits/chalk_context/resolvent_ops.rs index f1b8588790b72..d894c6c2a03e9 100644 --- a/src/librustc_traits/chalk_context/resolvent_ops.rs +++ b/src/librustc_traits/chalk_context/resolvent_ops.rs @@ -169,8 +169,8 @@ impl AnswerSubstitutor<'cx, 'gcx, 'tcx> { } } -impl TypeRelation<'cx, 'gcx, 'tcx> for AnswerSubstitutor<'cx, 'gcx, 'tcx> { - fn tcx(&self) -> TyCtxt<'cx, 'gcx, 'tcx> { +impl TypeRelation<'gcx, 'tcx> for AnswerSubstitutor<'cx, 'gcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.infcx.tcx } diff --git a/src/librustc_traits/dropck_outlives.rs b/src/librustc_traits/dropck_outlives.rs index 25ce5c8f9a6d8..e7479e7ce6209 100644 --- a/src/librustc_traits/dropck_outlives.rs +++ b/src/librustc_traits/dropck_outlives.rs @@ -18,7 +18,7 @@ crate fn provide(p: &mut Providers<'_>) { } fn dropck_outlives<'tcx>( - tcx: TyCtxt<'_, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, canonical_goal: CanonicalTyGoal<'tcx>, ) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, DropckOutlivesResult<'tcx>>>, NoSolution> { debug!("dropck_outlives(goal={:#?})", canonical_goal); @@ -147,7 +147,7 @@ fn dropck_outlives<'tcx>( /// Returns a set of constraints that needs to be satisfied in /// order for `ty` to be valid for destruction. fn dtorck_constraint_for_ty<'a, 'gcx, 'tcx>( - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, span: Span, for_ty: Ty<'tcx>, depth: usize, @@ -280,7 +280,7 @@ fn dtorck_constraint_for_ty<'a, 'gcx, 'tcx>( /// Calculates the dtorck constraint for a type. crate fn adt_dtorck_constraint<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, ) -> Result, NoSolution> { let def = tcx.adt_def(def_id); diff --git a/src/librustc_traits/evaluate_obligation.rs b/src/librustc_traits/evaluate_obligation.rs index 83aebd16e2400..789da125ba91f 100644 --- a/src/librustc_traits/evaluate_obligation.rs +++ b/src/librustc_traits/evaluate_obligation.rs @@ -14,7 +14,7 @@ crate fn provide(p: &mut Providers<'_>) { } fn evaluate_obligation<'tcx>( - tcx: TyCtxt<'_, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, canonical_goal: CanonicalPredicateGoal<'tcx>, ) -> Result { tcx.infer_ctxt().enter_with_canonical( diff --git a/src/librustc_traits/generic_types.rs b/src/librustc_traits/generic_types.rs index 6ea3626dc9d08..a9aa540acc11c 100644 --- a/src/librustc_traits/generic_types.rs +++ b/src/librustc_traits/generic_types.rs @@ -6,7 +6,7 @@ use rustc::hir; use rustc::hir::def_id::DefId; use rustc_target::spec::abi; -crate fn bound(tcx: TyCtxt<'_, '_, 'tcx>, index: u32) -> Ty<'tcx> { +crate fn bound(tcx: TyCtxt<'tcx, '_, 'tcx>, index: u32) -> Ty<'tcx> { let ty = ty::Bound( ty::INNERMOST, ty::BoundVar::from_u32(index).into() @@ -14,7 +14,7 @@ crate fn bound(tcx: TyCtxt<'_, '_, 'tcx>, index: u32) -> Ty<'tcx> { tcx.mk_ty(ty) } -crate fn raw_ptr(tcx: TyCtxt<'_, '_, 'tcx>, mutbl: hir::Mutability) -> Ty<'tcx> { +crate fn raw_ptr(tcx: TyCtxt<'tcx, '_, 'tcx>, mutbl: hir::Mutability) -> Ty<'tcx> { tcx.mk_ptr(ty::TypeAndMut { ty: bound(tcx, 0), mutbl, @@ -22,7 +22,7 @@ crate fn raw_ptr(tcx: TyCtxt<'_, '_, 'tcx>, mutbl: hir::Mutability) -> Ty<'tcx> } crate fn fn_ptr( - tcx: TyCtxt<'_, '_, 'tcx>, + tcx: TyCtxt<'tcx, '_, 'tcx>, arity_and_output: usize, c_variadic: bool, unsafety: hir::Unsafety, @@ -44,7 +44,7 @@ crate fn fn_ptr( tcx.mk_fn_ptr(fn_sig) } -crate fn type_list(tcx: TyCtxt<'_, '_, 'tcx>, arity: usize) -> SubstsRef<'tcx> { +crate fn type_list(tcx: TyCtxt<'tcx, '_, 'tcx>, arity: usize) -> SubstsRef<'tcx> { tcx.mk_substs( (0..arity).into_iter() .map(|i| ty::BoundVar::from(i)) @@ -53,7 +53,7 @@ crate fn type_list(tcx: TyCtxt<'_, '_, 'tcx>, arity: usize) -> SubstsRef<'tcx> { ) } -crate fn ref_ty(tcx: TyCtxt<'_, '_, 'tcx>, mutbl: hir::Mutability) -> Ty<'tcx> { +crate fn ref_ty(tcx: TyCtxt<'tcx, '_, 'tcx>, mutbl: hir::Mutability) -> Ty<'tcx> { let region = tcx.mk_region( ty::ReLateBound(ty::INNERMOST, ty::BoundRegion::BrAnon(0)) ); @@ -64,17 +64,17 @@ crate fn ref_ty(tcx: TyCtxt<'_, '_, 'tcx>, mutbl: hir::Mutability) -> Ty<'tcx> { }) } -crate fn fn_def(tcx: TyCtxt<'_, '_, 'tcx>, def_id: DefId) -> Ty<'tcx> { +crate fn fn_def(tcx: TyCtxt<'tcx, '_, 'tcx>, def_id: DefId) -> Ty<'tcx> { tcx.mk_ty(ty::FnDef(def_id, InternalSubsts::bound_vars_for_item(tcx, def_id))) } -crate fn closure(tcx: TyCtxt<'_, '_, 'tcx>, def_id: DefId) -> Ty<'tcx> { +crate fn closure(tcx: TyCtxt<'tcx, '_, 'tcx>, def_id: DefId) -> Ty<'tcx> { tcx.mk_closure(def_id, ty::ClosureSubsts { substs: InternalSubsts::bound_vars_for_item(tcx, def_id), }) } -crate fn generator(tcx: TyCtxt<'_, '_, 'tcx>, def_id: DefId) -> Ty<'tcx> { +crate fn generator(tcx: TyCtxt<'tcx, '_, 'tcx>, def_id: DefId) -> Ty<'tcx> { tcx.mk_generator(def_id, ty::GeneratorSubsts { substs: InternalSubsts::bound_vars_for_item(tcx, def_id), }, hir::GeneratorMovability::Movable) diff --git a/src/librustc_traits/implied_outlives_bounds.rs b/src/librustc_traits/implied_outlives_bounds.rs index 73bb3fb5b9a2d..03976ace692ea 100644 --- a/src/librustc_traits/implied_outlives_bounds.rs +++ b/src/librustc_traits/implied_outlives_bounds.rs @@ -23,7 +23,7 @@ crate fn provide(p: &mut Providers<'_>) { } fn implied_outlives_bounds<'tcx>( - tcx: TyCtxt<'_, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, goal: CanonicalTyGoal<'tcx>, ) -> Result< &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, Vec>>>, diff --git a/src/librustc_traits/lowering/environment.rs b/src/librustc_traits/lowering/environment.rs index 3570cb1024600..81d32243e17a5 100644 --- a/src/librustc_traits/lowering/environment.rs +++ b/src/librustc_traits/lowering/environment.rs @@ -11,13 +11,13 @@ use rustc::ty::{self, TyCtxt, Ty}; use rustc::hir::def_id::DefId; use rustc_data_structures::fx::FxHashSet; -struct ClauseVisitor<'set, 'a, 'tcx: 'a + 'set> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, - round: &'set mut FxHashSet>, +struct ClauseVisitor<'a, 'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + round: &'a mut FxHashSet>, } -impl ClauseVisitor<'set, 'a, 'tcx> { - fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>, round: &'set mut FxHashSet>) -> Self { +impl ClauseVisitor<'a, 'tcx> { + fn new(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, round: &'a mut FxHashSet>) -> Self { ClauseVisitor { tcx, round, @@ -128,7 +128,7 @@ impl ClauseVisitor<'set, 'a, 'tcx> { } crate fn program_clauses_for_env<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, environment: Environment<'tcx>, ) -> Clauses<'tcx> { debug!("program_clauses_for_env(environment={:?})", environment); @@ -161,7 +161,7 @@ crate fn program_clauses_for_env<'a, 'tcx>( } crate fn environment<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId ) -> Environment<'tcx> { use super::{Lower, IntoFromEnvGoal}; diff --git a/src/librustc_traits/lowering/mod.rs b/src/librustc_traits/lowering/mod.rs index 80b0868a55134..699f1de2df232 100644 --- a/src/librustc_traits/lowering/mod.rs +++ b/src/librustc_traits/lowering/mod.rs @@ -156,7 +156,7 @@ impl<'tcx> IntoWellFormedGoal for DomainGoal<'tcx> { } crate fn program_clauses_for<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, ) -> Clauses<'tcx> { // FIXME(eddyb) this should only be using `def_kind`. @@ -185,7 +185,7 @@ crate fn program_clauses_for<'a, 'tcx>( } fn program_clauses_for_trait<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, ) -> Clauses<'tcx> { // `trait Trait where WC { .. } // P0 == Self` @@ -300,7 +300,7 @@ fn program_clauses_for_trait<'a, 'tcx>( ) } -fn program_clauses_for_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Clauses<'tcx> { +fn program_clauses_for_impl(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> Clauses<'tcx> { if let ImplPolarity::Negative = tcx.impl_polarity(def_id) { return List::empty(); } @@ -344,7 +344,7 @@ fn program_clauses_for_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId } pub fn program_clauses_for_type_def<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, ) -> Clauses<'tcx> { // Rule WellFormed-Type @@ -421,7 +421,7 @@ pub fn program_clauses_for_type_def<'a, 'tcx>( } pub fn program_clauses_for_associated_type_def<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item_id: DefId, ) -> Clauses<'tcx> { // Rule ProjectionEq-Placeholder @@ -559,7 +559,7 @@ pub fn program_clauses_for_associated_type_def<'a, 'tcx>( } pub fn program_clauses_for_associated_type_value<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item_id: DefId, ) -> Clauses<'tcx> { // Rule Normalize-From-Impl (see rustc guide) @@ -620,7 +620,7 @@ pub fn program_clauses_for_associated_type_value<'a, 'tcx>( tcx.mk_clauses(iter::once(normalize_clause)) } -pub fn dump_program_clauses<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { +pub fn dump_program_clauses<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { if !tcx.features().rustc_attrs { return; } @@ -631,11 +631,11 @@ pub fn dump_program_clauses<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { .visit_all_item_likes(&mut visitor.as_deep_visitor()); } -struct ClauseDumper<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, +struct ClauseDumper<'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } -impl<'a, 'tcx> ClauseDumper<'a, 'tcx> { +impl ClauseDumper<'tcx> { fn process_attrs(&mut self, hir_id: hir::HirId, attrs: &[ast::Attribute]) { let def_id = self.tcx.hir().local_def_id_from_hir_id(hir_id); for attr in attrs { @@ -673,7 +673,7 @@ impl<'a, 'tcx> ClauseDumper<'a, 'tcx> { } } -impl<'a, 'tcx> Visitor<'tcx> for ClauseDumper<'a, 'tcx> { +impl Visitor<'tcx> for ClauseDumper<'tcx> { fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> { NestedVisitorMap::OnlyBodies(&self.tcx.hir()) } diff --git a/src/librustc_traits/normalize_erasing_regions.rs b/src/librustc_traits/normalize_erasing_regions.rs index 24fa5e97752a6..448c544afbb27 100644 --- a/src/librustc_traits/normalize_erasing_regions.rs +++ b/src/librustc_traits/normalize_erasing_regions.rs @@ -12,7 +12,7 @@ crate fn provide(p: &mut Providers<'_>) { } fn normalize_ty_after_erasing_regions<'tcx>( - tcx: TyCtxt<'_, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, goal: ParamEnvAnd<'tcx, Ty<'tcx>>, ) -> Ty<'tcx> { debug!("normalize_ty_after_erasing_regions(goal={:#?})", goal); diff --git a/src/librustc_traits/normalize_projection_ty.rs b/src/librustc_traits/normalize_projection_ty.rs index 3ff04bc285369..a080ffcb2c1a7 100644 --- a/src/librustc_traits/normalize_projection_ty.rs +++ b/src/librustc_traits/normalize_projection_ty.rs @@ -15,7 +15,7 @@ crate fn provide(p: &mut Providers<'_>) { } fn normalize_projection_ty<'tcx>( - tcx: TyCtxt<'_, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, goal: CanonicalProjectionGoal<'tcx>, ) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, NormalizationResult<'tcx>>>, NoSolution> { debug!("normalize_provider(goal={:#?})", goal); diff --git a/src/librustc_traits/type_op.rs b/src/librustc_traits/type_op.rs index ea37024b84f5b..a00e66fa56cac 100644 --- a/src/librustc_traits/type_op.rs +++ b/src/librustc_traits/type_op.rs @@ -35,7 +35,7 @@ crate fn provide(p: &mut Providers<'_>) { } fn type_op_ascribe_user_type<'tcx>( - tcx: TyCtxt<'_, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, AscribeUserType<'tcx>>>, ) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, ()>>, NoSolution> { tcx.infer_ctxt() @@ -94,7 +94,7 @@ impl AscribeUserTypeCx<'me, 'gcx, 'tcx> { ); } - fn tcx(&self) -> TyCtxt<'me, 'gcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.infcx.tcx } @@ -167,7 +167,7 @@ impl AscribeUserTypeCx<'me, 'gcx, 'tcx> { } fn type_op_eq<'tcx>( - tcx: TyCtxt<'_, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, Eq<'tcx>>>, ) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, ()>>, NoSolution> { tcx.infer_ctxt() @@ -197,7 +197,7 @@ where } fn type_op_normalize_ty( - tcx: TyCtxt<'_, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, Normalize>>>, ) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, Ty<'tcx>>>, NoSolution> { tcx.infer_ctxt() @@ -205,7 +205,7 @@ fn type_op_normalize_ty( } fn type_op_normalize_predicate( - tcx: TyCtxt<'_, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, Normalize>>>, ) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, Predicate<'tcx>>>, NoSolution> { tcx.infer_ctxt() @@ -213,7 +213,7 @@ fn type_op_normalize_predicate( } fn type_op_normalize_fn_sig( - tcx: TyCtxt<'_, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, Normalize>>>, ) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, FnSig<'tcx>>>, NoSolution> { tcx.infer_ctxt() @@ -221,7 +221,7 @@ fn type_op_normalize_fn_sig( } fn type_op_normalize_poly_fn_sig( - tcx: TyCtxt<'_, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, Normalize>>>, ) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, PolyFnSig<'tcx>>>, NoSolution> { tcx.infer_ctxt() @@ -229,7 +229,7 @@ fn type_op_normalize_poly_fn_sig( } fn type_op_subtype<'tcx>( - tcx: TyCtxt<'_, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, Subtype<'tcx>>>, ) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, ()>>, NoSolution> { tcx.infer_ctxt() @@ -243,7 +243,7 @@ fn type_op_subtype<'tcx>( } fn type_op_prove_predicate<'tcx>( - tcx: TyCtxt<'_, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, ProvePredicate<'tcx>>>, ) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, ()>>, NoSolution> { tcx.infer_ctxt() diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index 5a46c9d440b5d..e2b3e9282cddc 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -41,7 +41,7 @@ use rustc_data_structures::fx::FxHashSet; pub struct PathSeg(pub DefId, pub usize); pub trait AstConv<'gcx, 'tcx> { - fn tcx<'a>(&'a self) -> TyCtxt<'a, 'gcx, 'tcx>; + fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'gcx, 'tcx>; /// Returns the set of bounds in scope for the type parameter with /// the given id. @@ -462,7 +462,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { /// - `inferred_kind`: if no parameter was provided, and inference is enabled, then /// creates a suitable inference variable. pub fn create_substs_for_generic_args<'a, 'b>( - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, def_id: DefId, parent_substs: &[Kind<'tcx>], has_self: bool, @@ -2420,7 +2420,7 @@ impl<'a, 'gcx, 'tcx> Bounds<'tcx> { /// where-clauses). Because some of our bounds listings (e.g., /// regions) don't include the self-type, you must supply the /// self-type here (the `param_ty` parameter). - pub fn predicates(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, param_ty: Ty<'tcx>) + pub fn predicates(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, param_ty: Ty<'tcx>) -> Vec<(ty::Predicate<'tcx>, Span)> { // If it could be sized, and is, add the `Sized` predicate. diff --git a/src/librustc_typeck/check/autoderef.rs b/src/librustc_typeck/check/autoderef.rs index 38c3ee776369a..e6e6772e27eb1 100644 --- a/src/librustc_typeck/check/autoderef.rs +++ b/src/librustc_typeck/check/autoderef.rs @@ -240,7 +240,7 @@ impl<'a, 'gcx, 'tcx> Autoderef<'a, 'gcx, 'tcx> { } pub fn report_autoderef_recursion_limit_error<'a, 'gcx, 'tcx>( - tcx: TyCtxt<'a, 'gcx, 'tcx>, span: Span, ty: Ty<'tcx>) + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, span: Span, ty: Ty<'tcx>) { // We've reached the recursion limit, error gracefully. let suggested_limit = *tcx.sess.recursion_limit.get() * 2; diff --git a/src/librustc_typeck/check/compare_method.rs b/src/librustc_typeck/check/compare_method.rs index b4548ac70911e..ae9e74f37059b 100644 --- a/src/librustc_typeck/check/compare_method.rs +++ b/src/librustc_typeck/check/compare_method.rs @@ -23,7 +23,7 @@ use super::{Inherited, FnCtxt, potentially_plural_count}; /// - `trait_m`: the method in the trait /// - `impl_trait_ref`: the TraitRef corresponding to the trait implementation -pub fn compare_impl_method<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +pub fn compare_impl_method<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_m: &ty::AssocItem, impl_m_span: Span, trait_m: &ty::AssocItem, @@ -73,7 +73,7 @@ pub fn compare_impl_method<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } } -fn compare_predicate_entailment<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn compare_predicate_entailment<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_m: &ty::AssocItem, impl_m_span: Span, trait_m: &ty::AssocItem, @@ -355,7 +355,7 @@ fn compare_predicate_entailment<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, }) } -fn check_region_bounds_on_impl_method<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn check_region_bounds_on_impl_method<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, span: Span, impl_m: &ty::AssocItem, trait_m: &ty::AssocItem, @@ -495,7 +495,7 @@ fn extract_spans_for_error_reporting<'a, 'gcx, 'tcx>(infcx: &infer::InferCtxt<'a } } -fn compare_self_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn compare_self_type<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_m: &ty::AssocItem, impl_m_span: Span, trait_m: &ty::AssocItem, @@ -581,7 +581,7 @@ fn compare_self_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } fn compare_number_of_generics<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_: &ty::AssocItem, _impl_span: Span, trait_: &ty::AssocItem, @@ -695,7 +695,7 @@ fn compare_number_of_generics<'a, 'tcx>( } } -fn compare_number_of_method_arguments<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn compare_number_of_method_arguments<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_m: &ty::AssocItem, impl_m_span: Span, trait_m: &ty::AssocItem, @@ -779,7 +779,7 @@ fn compare_number_of_method_arguments<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, Ok(()) } -fn compare_synthetic_generics<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn compare_synthetic_generics<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_m: &ty::AssocItem, trait_m: &ty::AssocItem) -> Result<(), ErrorReported> { @@ -951,7 +951,7 @@ fn compare_synthetic_generics<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } } -pub fn compare_const_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +pub fn compare_const_impl<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_c: &ty::AssocItem, impl_c_span: Span, trait_c: &ty::AssocItem, diff --git a/src/librustc_typeck/check/dropck.rs b/src/librustc_typeck/check/dropck.rs index 2184555a07d34..672c474676925 100644 --- a/src/librustc_typeck/check/dropck.rs +++ b/src/librustc_typeck/check/dropck.rs @@ -30,7 +30,7 @@ use syntax_pos::Span; /// cannot do `struct S; impl Drop for S { ... }`). /// pub fn check_drop_impl<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, drop_impl_did: DefId, ) -> Result<(), ErrorReported> { let dtor_self_type = tcx.type_of(drop_impl_did); @@ -65,7 +65,7 @@ pub fn check_drop_impl<'a, 'tcx>( } fn ensure_drop_params_and_item_params_correspond<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, drop_impl_did: DefId, drop_impl_ty: Ty<'tcx>, self_type_did: DefId, @@ -141,7 +141,7 @@ fn ensure_drop_params_and_item_params_correspond<'a, 'tcx>( /// Confirms that every predicate imposed by dtor_predicates is /// implied by assuming the predicates attached to self_type_did. fn ensure_drop_predicates_are_implied_by_item_defn<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, drop_impl_did: DefId, dtor_predicates: &ty::GenericPredicates<'tcx>, self_type_did: DefId, diff --git a/src/librustc_typeck/check/intrinsic.rs b/src/librustc_typeck/check/intrinsic.rs index 11598ad4c9c02..2554ff688d507 100644 --- a/src/librustc_typeck/check/intrinsic.rs +++ b/src/librustc_typeck/check/intrinsic.rs @@ -14,7 +14,7 @@ use rustc::hir; use std::iter; fn equate_intrinsic_type<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, it: &hir::ForeignItem, n_tps: usize, abi: Abi, @@ -79,7 +79,7 @@ pub fn intrisic_operation_unsafety(intrinsic: &str) -> hir::Unsafety { /// Remember to add all intrinsics here, in librustc_codegen_llvm/intrinsic.rs, /// and in libcore/intrinsics.rs -pub fn check_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +pub fn check_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, it: &hir::ForeignItem) { let param = |n| tcx.mk_ty_param(n, InternedString::intern(&format!("P{}", n))); let name = it.ident.as_str(); @@ -400,7 +400,7 @@ pub fn check_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } /// Type-check `extern "platform-intrinsic" { ... }` functions. -pub fn check_platform_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +pub fn check_platform_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, it: &hir::ForeignItem) { let param = |n| { let name = InternedString::intern(&format!("P{}", n)); diff --git a/src/librustc_typeck/check/method/probe.rs b/src/librustc_typeck/check/method/probe.rs index e55da40a4c21c..7101d7bba2da9 100644 --- a/src/librustc_typeck/check/method/probe.rs +++ b/src/librustc_typeck/check/method/probe.rs @@ -395,7 +395,7 @@ pub fn provide(providers: &mut ty::query::Providers<'_>) { providers.method_autoderef_steps = method_autoderef_steps; } -fn method_autoderef_steps<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'gcx>, +fn method_autoderef_steps<'a, 'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'gcx, 'gcx>, goal: CanonicalTyGoal<'tcx>) -> MethodAutoderefStepsResult<'gcx> { diff --git a/src/librustc_typeck/check/method/suggest.rs b/src/librustc_typeck/check/method/suggest.rs index 82ccd3a866248..aac1c2c68324a 100644 --- a/src/librustc_typeck/check/method/suggest.rs +++ b/src/librustc_typeck/check/method/suggest.rs @@ -775,12 +775,12 @@ impl Ord for TraitInfo { } /// Retrieves all traits in this crate and any dependent crates. -pub fn all_traits<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Vec { +pub fn all_traits<'a, 'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Vec { tcx.all_traits(LOCAL_CRATE).iter().map(|&def_id| TraitInfo { def_id }).collect() } /// Computes all traits in this crate and any dependent crates. -fn compute_all_traits<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Vec { +fn compute_all_traits<'a, 'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Vec { use hir::itemlikevisit; let mut traits = vec![]; @@ -855,16 +855,16 @@ pub fn provide(providers: &mut ty::query::Providers<'_>) { } } -struct UsePlacementFinder<'a, 'tcx: 'a, 'gcx: 'tcx> { +struct UsePlacementFinder<'tcx, 'gcx> { target_module: hir::HirId, span: Option, found_use: bool, - tcx: TyCtxt<'a, 'gcx, 'tcx> + tcx: TyCtxt<'tcx, 'gcx, 'tcx> } -impl<'a, 'tcx, 'gcx> UsePlacementFinder<'a, 'tcx, 'gcx> { +impl UsePlacementFinder<'tcx, 'gcx> { fn check( - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, krate: &'tcx hir::Crate, target_module: hir::HirId, ) -> (Option, bool) { @@ -879,7 +879,7 @@ impl<'a, 'tcx, 'gcx> UsePlacementFinder<'a, 'tcx, 'gcx> { } } -impl<'a, 'tcx, 'gcx> hir::intravisit::Visitor<'tcx> for UsePlacementFinder<'a, 'tcx, 'gcx> { +impl hir::intravisit::Visitor<'tcx> for UsePlacementFinder<'tcx, 'gcx> { fn visit_mod( &mut self, module: &'tcx hir::Mod, diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 2ab8d14ed32e2..830407bffefc6 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -588,14 +588,14 @@ impl<'a, 'gcx, 'tcx> Deref for FnCtxt<'a, 'gcx, 'tcx> { /// Helper type of a temporary returned by `Inherited::build(...)`. /// Necessary because we can't write the following bound: /// `F: for<'b, 'tcx> where 'gcx: 'tcx FnOnce(Inherited<'b, 'gcx, 'tcx>)`. -pub struct InheritedBuilder<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { - infcx: infer::InferCtxtBuilder<'a, 'gcx, 'tcx>, +pub struct InheritedBuilder<'gcx, 'tcx> { + infcx: infer::InferCtxtBuilder<'gcx, 'tcx>, def_id: DefId, } -impl<'a, 'gcx, 'tcx> Inherited<'a, 'gcx, 'tcx> { - pub fn build(tcx: TyCtxt<'a, 'gcx, 'gcx>, def_id: DefId) - -> InheritedBuilder<'a, 'gcx, 'tcx> { +impl Inherited<'_, 'gcx, 'tcx> { + pub fn build(tcx: TyCtxt<'gcx, 'gcx, 'gcx>, def_id: DefId) + -> InheritedBuilder<'gcx, 'tcx> { let hir_id_root = if def_id.is_local() { let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); DefId::local(hir_id.owner) @@ -610,16 +610,16 @@ impl<'a, 'gcx, 'tcx> Inherited<'a, 'gcx, 'tcx> { } } -impl<'a, 'gcx, 'tcx> InheritedBuilder<'a, 'gcx, 'tcx> { +impl<'gcx, 'tcx> InheritedBuilder<'gcx, 'tcx> { fn enter(&'tcx mut self, f: F) -> R - where F: for<'b> FnOnce(Inherited<'b, 'gcx, 'tcx>) -> R + where F: for<'a> FnOnce(Inherited<'a, 'gcx, 'tcx>) -> R { let def_id = self.def_id; self.infcx.enter(|infcx| f(Inherited::new(infcx, def_id))) } } -impl<'a, 'gcx, 'tcx> Inherited<'a, 'gcx, 'tcx> { +impl Inherited<'a, 'gcx, 'tcx> { fn new(infcx: InferCtxt<'a, 'gcx, 'tcx>, def_id: DefId) -> Self { let tcx = infcx.tcx; let item_id = tcx.hir().as_local_hir_id(def_id); @@ -685,9 +685,9 @@ impl<'a, 'gcx, 'tcx> Inherited<'a, 'gcx, 'tcx> { } } -struct CheckItemTypesVisitor<'a, 'tcx: 'a> { tcx: TyCtxt<'a, 'tcx, 'tcx> } +struct CheckItemTypesVisitor<'tcx> { tcx: TyCtxt<'tcx, 'tcx, 'tcx> } -impl<'a, 'tcx> ItemLikeVisitor<'tcx> for CheckItemTypesVisitor<'a, 'tcx> { +impl ItemLikeVisitor<'tcx> for CheckItemTypesVisitor<'tcx> { fn visit_item(&mut self, i: &'tcx hir::Item) { check_item_type(self.tcx, i); } @@ -695,33 +695,33 @@ impl<'a, 'tcx> ItemLikeVisitor<'tcx> for CheckItemTypesVisitor<'a, 'tcx> { fn visit_impl_item(&mut self, _: &'tcx hir::ImplItem) { } } -pub fn check_wf_new<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Result<(), ErrorReported> { +pub fn check_wf_new<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Result<(), ErrorReported> { tcx.sess.track_errors(|| { let mut visit = wfcheck::CheckTypeWellFormedVisitor::new(tcx); tcx.hir().krate().par_visit_all_item_likes(&mut visit); }) } -fn check_mod_item_types<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, module_def_id: DefId) { +fn check_mod_item_types<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, module_def_id: DefId) { tcx.hir().visit_item_likes_in_module(module_def_id, &mut CheckItemTypesVisitor { tcx }); } -fn typeck_item_bodies<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, crate_num: CrateNum) { +fn typeck_item_bodies<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, crate_num: CrateNum) { debug_assert!(crate_num == LOCAL_CRATE); tcx.par_body_owners(|body_owner_def_id| { tcx.ensure().typeck_tables_of(body_owner_def_id); }); } -fn check_item_well_formed<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) { +fn check_item_well_formed<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { wfcheck::check_item_well_formed(tcx, def_id); } -fn check_trait_item_well_formed<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) { +fn check_trait_item_well_formed<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { wfcheck::check_trait_item(tcx, def_id); } -fn check_impl_item_well_formed<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) { +fn check_impl_item_well_formed<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { wfcheck::check_impl_item(tcx, def_id); } @@ -741,7 +741,7 @@ pub fn provide(providers: &mut Providers<'_>) { }; } -fn adt_destructor<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn adt_destructor<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> Option { tcx.calculate_dtor(def_id, &mut dropck::check_drop_impl) @@ -756,7 +756,7 @@ fn adt_destructor<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, /// may not succeed. In some cases where this function returns `None` /// (notably closures), `typeck_tables(def_id)` would wind up /// redirecting to the owning function. -fn primary_body_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn primary_body_of<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, id: hir::HirId) -> Option<(hir::BodyId, Option<&'tcx hir::FnDecl>)> { @@ -797,7 +797,7 @@ fn primary_body_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } } -fn has_typeck_tables<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn has_typeck_tables<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> bool { // Closures' tables come from their outermost function, @@ -811,13 +811,13 @@ fn has_typeck_tables<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, primary_body_of(tcx, id).is_some() } -fn used_trait_imports<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn used_trait_imports<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx DefIdSet { &*tcx.typeck_tables_of(def_id).used_trait_imports } -fn typeck_tables_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn typeck_tables_of<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::TypeckTables<'tcx> { // Closures' tables come from their outermost function, @@ -919,7 +919,7 @@ fn typeck_tables_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, tables } -fn check_abi<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, span: Span, abi: Abi) { +fn check_abi<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, span: Span, abi: Abi) { if !tcx.sess.target.target.is_abi_supported(abi) { struct_span_err!(tcx.sess, span, E0570, "The ABI `{}` is not supported for the current target", abi).emit() @@ -1287,7 +1287,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>, (fcx, gen_ty) } -fn check_struct<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn check_struct<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, id: hir::HirId, span: Span) { let def_id = tcx.hir().local_def_id_from_hir_id(id); @@ -1303,7 +1303,7 @@ fn check_struct<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, check_packed(tcx, span, def_id); } -fn check_union<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn check_union<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, id: hir::HirId, span: Span) { let def_id = tcx.hir().local_def_id_from_hir_id(id); @@ -1315,7 +1315,7 @@ fn check_union<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } fn check_opaque<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, substs: SubstsRef<'tcx>, span: Span, @@ -1335,7 +1335,7 @@ fn check_opaque<'a, 'tcx>( } } -pub fn check_item_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, it: &'tcx hir::Item) { +pub fn check_item_type<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, it: &'tcx hir::Item) { debug!( "check_item_type(it.hir_id={}, it.name={})", it.hir_id, @@ -1472,7 +1472,7 @@ fn maybe_check_static_with_link_section(tcx: TyCtxt<'_, '_, '_>, id: DefId, span } } -fn check_on_unimplemented<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn check_on_unimplemented<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, trait_def_id: DefId, item: &hir::Item) { let item_def_id = tcx.hir().local_def_id_from_hir_id(item.hir_id); @@ -1480,7 +1480,7 @@ fn check_on_unimplemented<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let _ = traits::OnUnimplementedDirective::of_item(tcx, trait_def_id, item_def_id); } -fn report_forbidden_specialization<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn report_forbidden_specialization<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_item: &hir::ImplItem, parent_impl: DefId) { @@ -1506,7 +1506,7 @@ fn report_forbidden_specialization<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, err.emit(); } -fn check_specialization_validity<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn check_specialization_validity<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, trait_def: &ty::TraitDef, trait_item: &ty::AssocItem, impl_id: DefId, @@ -1532,7 +1532,7 @@ fn check_specialization_validity<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } -fn check_impl_items_against_trait<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn check_impl_items_against_trait<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_span: Span, impl_id: DefId, impl_trait_ref: ty::TraitRef<'tcx>, @@ -1693,7 +1693,7 @@ fn check_impl_items_against_trait<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, /// Checks whether a type can be represented in memory. In particular, it /// identifies types that contain themselves without indirection through a /// pointer, which would mean their size is unbounded. -fn check_representable<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn check_representable<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, sp: Span, item_def_id: DefId) -> bool { @@ -1718,7 +1718,7 @@ fn check_representable<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, return true } -pub fn check_simd<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, sp: Span, def_id: DefId) { +pub fn check_simd<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, sp: Span, def_id: DefId) { let t = tcx.type_of(def_id); if let ty::Adt(def, substs) = t.sty { if def.is_struct() { @@ -1747,7 +1747,7 @@ pub fn check_simd<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, sp: Span, def_id: DefId } } -fn check_packed<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, sp: Span, def_id: DefId) { +fn check_packed<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, sp: Span, def_id: DefId) { let repr = tcx.adt_def(def_id).repr; if repr.packed() { for attr in tcx.get_attrs(def_id).iter() { @@ -1771,7 +1771,7 @@ fn check_packed<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, sp: Span, def_id: DefId) } } -fn check_packed_inner<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn check_packed_inner<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, stack: &mut Vec) -> bool { let t = tcx.type_of(def_id); @@ -1801,7 +1801,7 @@ fn check_packed_inner<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, false } -fn check_transparent<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, sp: Span, def_id: DefId) { +fn check_transparent<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, sp: Span, def_id: DefId) { let adt = tcx.adt_def(def_id); if !adt.repr.transparent() { return; @@ -1881,7 +1881,7 @@ fn check_transparent<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, sp: Span, def_id: De } #[allow(trivial_numeric_casts)] -pub fn check_enum<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +pub fn check_enum<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, sp: Span, vs: &'tcx [hir::Variant], id: hir::HirId) { @@ -1945,7 +1945,7 @@ pub fn check_enum<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, check_transparent(tcx, sp, def_id); } -fn report_unexpected_variant_res<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, +fn report_unexpected_variant_res<'a, 'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, res: Res, span: Span, qpath: &QPath) { @@ -1956,7 +1956,7 @@ fn report_unexpected_variant_res<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, } impl<'a, 'gcx, 'tcx> AstConv<'gcx, 'tcx> for FnCtxt<'a, 'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'b, 'gcx, 'tcx> { self.tcx } + fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.tcx } fn get_type_parameter_bounds(&self, _: Span, def_id: DefId) -> &'tcx ty::GenericPredicates<'tcx> @@ -5700,7 +5700,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } } -pub fn check_bounds_are_used<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +pub fn check_bounds_are_used<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, generics: &ty::Generics, ty: Ty<'tcx>) { let own_counts = generics.own_counts(); diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs index 2b627a692508e..827853c311416 100644 --- a/src/librustc_typeck/check/wfcheck.rs +++ b/src/librustc_typeck/check/wfcheck.rs @@ -25,17 +25,17 @@ use rustc::hir; /// ```rust /// F: for<'b, 'tcx> where 'gcx: 'tcx FnOnce(FnCtxt<'b, 'gcx, 'tcx>) /// ``` -struct CheckWfFcxBuilder<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { - inherited: super::InheritedBuilder<'a, 'gcx, 'tcx>, +struct CheckWfFcxBuilder<'gcx, 'tcx> { + inherited: super::InheritedBuilder<'gcx, 'tcx>, id: hir::HirId, span: Span, param_env: ty::ParamEnv<'tcx>, } -impl<'a, 'gcx, 'tcx> CheckWfFcxBuilder<'a, 'gcx, 'tcx> { +impl<'gcx, 'tcx> CheckWfFcxBuilder<'gcx, 'tcx> { fn with_fcx(&'tcx mut self, f: F) where F: for<'b> FnOnce(&FnCtxt<'b, 'gcx, 'tcx>, - TyCtxt<'b, 'gcx, 'gcx>) -> Vec> + TyCtxt<'gcx, 'gcx, 'gcx>) -> Vec> { let id = self.id; let span = self.span; @@ -68,7 +68,7 @@ impl<'a, 'gcx, 'tcx> CheckWfFcxBuilder<'a, 'gcx, 'tcx> { /// We do this check as a pre-pass before checking fn bodies because if these constraints are /// not included it frequently leads to confusing errors in fn bodies. So it's better to check /// the types first. -pub fn check_item_well_formed<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) { +pub fn check_item_well_formed<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); let item = tcx.hir().expect_item_by_hir_id(hir_id); @@ -156,7 +156,7 @@ pub fn check_item_well_formed<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: Def } } -pub fn check_trait_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) { +pub fn check_trait_item<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); let trait_item = tcx.hir().expect_trait_item(hir_id); @@ -167,7 +167,7 @@ pub fn check_trait_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) { check_associated_item(tcx, trait_item.hir_id, trait_item.span, method_sig); } -pub fn check_impl_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) { +pub fn check_impl_item<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); let impl_item = tcx.hir().expect_impl_item(hir_id); @@ -178,7 +178,7 @@ pub fn check_impl_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) { check_associated_item(tcx, impl_item.hir_id, impl_item.span, method_sig); } -fn check_associated_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn check_associated_item<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item_id: hir::HirId, span: Span, sig_if_method: Option<&hir::MethodSig>) { @@ -225,13 +225,13 @@ fn check_associated_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, }) } -fn for_item<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'gcx>, item: &hir::Item) - -> CheckWfFcxBuilder<'a, 'gcx, 'tcx> { +fn for_item<'gcx: 'tcx, 'tcx>(tcx: TyCtxt<'gcx, 'gcx, 'gcx>, item: &hir::Item) + -> CheckWfFcxBuilder<'gcx, 'tcx> { for_id(tcx, item.hir_id, item.span) } -fn for_id<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'gcx>, id: hir::HirId, span: Span) - -> CheckWfFcxBuilder<'a, 'gcx, 'tcx> { +fn for_id<'gcx: 'tcx, 'tcx>(tcx: TyCtxt<'gcx, 'gcx, 'gcx>, id: hir::HirId, span: Span) + -> CheckWfFcxBuilder<'gcx, 'tcx> { let def_id = tcx.hir().local_def_id_from_hir_id(id); CheckWfFcxBuilder { inherited: Inherited::build(tcx, def_id), @@ -242,7 +242,7 @@ fn for_id<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'gcx>, id: hir::HirId, span: Spa } /// In a type definition, we check that to ensure that the types of the fields are well-formed. -fn check_type_defn<'a, 'tcx, F>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn check_type_defn<'a, 'tcx, F>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item: &hir::Item, all_sized: bool, mut lookup_fields: F) where F: for<'fcx, 'gcx, 'tcx2> FnMut(&FnCtxt<'fcx, 'gcx, 'tcx2>) -> Vec> { @@ -312,7 +312,7 @@ fn check_type_defn<'a, 'tcx, F>(tcx: TyCtxt<'a, 'tcx, 'tcx>, }); } -fn check_trait<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item: &hir::Item) { +fn check_trait<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item: &hir::Item) { debug!("check_trait: {:?}", item.hir_id); let trait_def_id = tcx.hir().local_def_id_from_hir_id(item.hir_id); @@ -335,7 +335,7 @@ fn check_trait<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item: &hir::Item) { }); } -fn check_item_fn<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item: &hir::Item) { +fn check_item_fn<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item: &hir::Item) { for_item(tcx, item).with_fcx(|fcx, tcx| { let def_id = fcx.tcx.hir().local_def_id_from_hir_id(item.hir_id); let sig = fcx.tcx.fn_sig(def_id); @@ -348,7 +348,7 @@ fn check_item_fn<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item: &hir::Item) { } fn check_item_type<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item_id: hir::HirId, ty_span: Span, allow_foreign_ty: bool, @@ -380,7 +380,7 @@ fn check_item_type<'a, 'tcx>( }); } -fn check_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn check_impl<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item: &hir::Item, ast_self_ty: &hir::Ty, ast_trait_ref: &Option) @@ -422,7 +422,7 @@ fn check_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, /// Checks where-clauses and inline bounds that are declared on `def_id`. fn check_where_clauses<'a, 'gcx, 'fcx, 'tcx>( - tcx: TyCtxt<'a, 'gcx, 'gcx>, + tcx: TyCtxt<'gcx, 'gcx, 'gcx>, fcx: &FnCtxt<'fcx, 'gcx, 'tcx>, span: Span, def_id: DefId, @@ -574,7 +574,7 @@ fn check_where_clauses<'a, 'gcx, 'fcx, 'tcx>( } } -fn check_fn_or_method<'a, 'fcx, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'gcx>, +fn check_fn_or_method<'a, 'fcx, 'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'gcx, 'gcx>, fcx: &FnCtxt<'fcx, 'gcx, 'tcx>, span: Span, sig: ty::PolyFnSig<'tcx>, @@ -617,7 +617,7 @@ fn check_fn_or_method<'a, 'fcx, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'gcx>, /// ``` /// fn check_existential_types<'a, 'fcx, 'gcx, 'tcx>( - tcx: TyCtxt<'a, 'gcx, 'gcx>, + tcx: TyCtxt<'gcx, 'gcx, 'gcx>, fcx: &FnCtxt<'fcx, 'gcx, 'tcx>, fn_def_id: DefId, span: Span, @@ -930,7 +930,7 @@ fn receiver_is_valid<'fcx, 'tcx, 'gcx>( true } -fn check_variances_for_type_defn<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn check_variances_for_type_defn<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item: &hir::Item, hir_generics: &hir::Generics) { @@ -971,7 +971,7 @@ fn check_variances_for_type_defn<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } } -fn report_bivariance<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn report_bivariance<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, span: Span, param_name: ast::Name) { @@ -1052,20 +1052,19 @@ fn check_false_global_bounds<'a, 'gcx, 'tcx>( fcx.select_all_obligations_or_error(); } -pub struct CheckTypeWellFormedVisitor<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, +pub struct CheckTypeWellFormedVisitor<'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } -impl<'a, 'gcx> CheckTypeWellFormedVisitor<'a, 'gcx> { - pub fn new(tcx: TyCtxt<'a, 'gcx, 'gcx>) - -> CheckTypeWellFormedVisitor<'a, 'gcx> { +impl CheckTypeWellFormedVisitor<'gcx> { + pub fn new(tcx: TyCtxt<'gcx, 'gcx, 'gcx>) -> CheckTypeWellFormedVisitor<'gcx> { CheckTypeWellFormedVisitor { tcx, } } } -impl<'a, 'tcx> ParItemLikeVisitor<'tcx> for CheckTypeWellFormedVisitor<'a, 'tcx> { +impl ParItemLikeVisitor<'tcx> for CheckTypeWellFormedVisitor<'tcx> { fn visit_item(&self, i: &'tcx hir::Item) { debug!("visit_item: {:?}", i); let def_id = self.tcx.hir().local_def_id_from_hir_id(i.hir_id); @@ -1134,7 +1133,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } } -fn error_392<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, span: Span, param_name: ast::Name) +fn error_392<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, span: Span, param_name: ast::Name) -> DiagnosticBuilder<'tcx> { let mut err = struct_span_err!(tcx.sess, span, E0392, "parameter `{}` is never used", param_name); diff --git a/src/librustc_typeck/check/writeback.rs b/src/librustc_typeck/check/writeback.rs index 1bc7119b314e9..7683f8cfbc4a6 100644 --- a/src/librustc_typeck/check/writeback.rs +++ b/src/librustc_typeck/check/writeback.rs @@ -123,7 +123,7 @@ impl<'cx, 'gcx, 'tcx> WritebackCx<'cx, 'gcx, 'tcx> { } } - fn tcx(&self) -> TyCtxt<'cx, 'gcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.fcx.tcx } @@ -789,7 +789,7 @@ impl Locatable for hir::HirId { // unresolved types and so forth. struct Resolver<'cx, 'gcx: 'cx + 'tcx, 'tcx: 'cx> { - tcx: TyCtxt<'cx, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, infcx: &'cx InferCtxt<'cx, 'gcx, 'tcx>, span: &'cx dyn Locatable, body: &'gcx hir::Body, @@ -819,7 +819,7 @@ impl<'cx, 'gcx, 'tcx> Resolver<'cx, 'gcx, 'tcx> { } impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for Resolver<'cx, 'gcx, 'tcx> { - fn tcx<'a>(&'a self) -> TyCtxt<'a, 'gcx, 'tcx> { + fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.tcx } diff --git a/src/librustc_typeck/check_unused.rs b/src/librustc_typeck/check_unused.rs index 3c3509f24ce1e..aecffd4c7d5b2 100644 --- a/src/librustc_typeck/check_unused.rs +++ b/src/librustc_typeck/check_unused.rs @@ -13,7 +13,7 @@ use rustc::util::nodemap::DefIdSet; use rustc_data_structures::fx::FxHashMap; -pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { +pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { let mut used_trait_imports = DefIdSet::default(); for &body_id in tcx.hir().krate().bodies.keys() { let item_def_id = tcx.hir().body_owner_def_id(body_id); @@ -28,7 +28,7 @@ pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { unused_crates_lint(tcx); } -impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for CheckVisitor<'a, 'tcx> { +impl ItemLikeVisitor<'v> for CheckVisitor<'tcx> { fn visit_item(&mut self, item: &hir::Item) { if item.vis.node.is_pub() || item.span.is_dummy() { return; @@ -45,12 +45,12 @@ impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for CheckVisitor<'a, 'tcx> { } } -struct CheckVisitor<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, +struct CheckVisitor<'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, used_trait_imports: DefIdSet, } -impl<'a, 'tcx> CheckVisitor<'a, 'tcx> { +impl CheckVisitor<'tcx> { fn check_import(&self, id: hir::HirId, span: Span) { let def_id = self.tcx.hir().local_def_id_from_hir_id(id); if !self.tcx.maybe_unused_trait_import(def_id) { @@ -70,7 +70,7 @@ impl<'a, 'tcx> CheckVisitor<'a, 'tcx> { } } -fn unused_crates_lint<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>) { +fn unused_crates_lint<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { let lint = lint::builtin::UNUSED_EXTERN_CRATES; // Collect first the crates that are completely unused. These we @@ -195,7 +195,7 @@ fn unused_crates_lint<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>) { } struct CollectExternCrateVisitor<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, crates_to_lint: &'a mut Vec, } diff --git a/src/librustc_typeck/coherence/builtin.rs b/src/librustc_typeck/coherence/builtin.rs index 1be0248727d01..30ad1d32f2a2b 100644 --- a/src/librustc_typeck/coherence/builtin.rs +++ b/src/librustc_typeck/coherence/builtin.rs @@ -17,7 +17,7 @@ use rustc::hir::def_id::DefId; use hir::Node; use rustc::hir::{self, ItemKind}; -pub fn check_trait<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, trait_def_id: DefId) { +pub fn check_trait<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, trait_def_id: DefId) { Checker { tcx, trait_def_id } .check(tcx.lang_items().drop_trait(), visit_implementation_of_drop) .check(tcx.lang_items().copy_trait(), visit_implementation_of_copy) @@ -26,14 +26,14 @@ pub fn check_trait<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, trait_def_id: DefId) { visit_implementation_of_dispatch_from_dyn); } -struct Checker<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, +struct Checker<'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, trait_def_id: DefId } -impl<'a, 'tcx> Checker<'a, 'tcx> { +impl<'tcx> Checker<'tcx> { fn check(&self, trait_def_id: Option, mut f: F) -> &Self - where F: FnMut(TyCtxt<'a, 'tcx, 'tcx>, DefId) + where F: FnMut(TyCtxt<'tcx, 'tcx, 'tcx>, DefId) { if Some(self.trait_def_id) == trait_def_id { for &impl_id in self.tcx.hir().trait_impls(self.trait_def_id) { @@ -45,7 +45,7 @@ impl<'a, 'tcx> Checker<'a, 'tcx> { } } -fn visit_implementation_of_drop<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, impl_did: DefId) { +fn visit_implementation_of_drop<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_did: DefId) { if let ty::Adt(..) = tcx.type_of(impl_did).sty { /* do nothing */ } else { @@ -73,7 +73,7 @@ fn visit_implementation_of_drop<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, impl_did: } } -fn visit_implementation_of_copy<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, impl_did: DefId) { +fn visit_implementation_of_copy<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_did: DefId) { debug!("visit_implementation_of_copy: impl_did={:?}", impl_did); let impl_hir_id = if let Some(n) = tcx.hir().as_local_hir_id(impl_did) { @@ -140,7 +140,7 @@ fn visit_implementation_of_copy<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, impl_did: } } -fn visit_implementation_of_coerce_unsized<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, impl_did: DefId) { +fn visit_implementation_of_coerce_unsized(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_did: DefId) { debug!("visit_implementation_of_coerce_unsized: impl_did={:?}", impl_did); @@ -154,7 +154,7 @@ fn visit_implementation_of_coerce_unsized<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } fn visit_implementation_of_dispatch_from_dyn<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_did: DefId, ) { debug!("visit_implementation_of_dispatch_from_dyn: impl_did={:?}", @@ -324,7 +324,7 @@ fn visit_implementation_of_dispatch_from_dyn<'a, 'tcx>( } } -pub fn coerce_unsized_info<'a, 'gcx>(gcx: TyCtxt<'a, 'gcx, 'gcx>, +pub fn coerce_unsized_info<'a, 'gcx>(gcx: TyCtxt<'gcx, 'gcx, 'gcx>, impl_did: DefId) -> CoerceUnsizedInfo { debug!("compute_coerce_unsized_info(impl_did={:?})", impl_did); diff --git a/src/librustc_typeck/coherence/inherent_impls.rs b/src/librustc_typeck/coherence/inherent_impls.rs index 644d95963e652..5189f4a139095 100644 --- a/src/librustc_typeck/coherence/inherent_impls.rs +++ b/src/librustc_typeck/coherence/inherent_impls.rs @@ -17,7 +17,7 @@ use syntax::ast; use syntax_pos::Span; /// On-demand query: yields a map containing all types mapped to their inherent impls. -pub fn crate_inherent_impls<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +pub fn crate_inherent_impls<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, crate_num: CrateNum) -> &'tcx CrateInherentImpls { assert_eq!(crate_num, LOCAL_CRATE); @@ -32,7 +32,7 @@ pub fn crate_inherent_impls<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } /// On-demand query: yields a vector of the inherent impls for a specific type. -pub fn inherent_impls<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +pub fn inherent_impls<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ty_def_id: DefId) -> &'tcx [DefId] { assert!(ty_def_id.is_local()); @@ -68,12 +68,12 @@ pub fn inherent_impls<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, result } -struct InherentCollect<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, +struct InherentCollect<'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impls_map: CrateInherentImpls, } -impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for InherentCollect<'a, 'tcx> { +impl ItemLikeVisitor<'v> for InherentCollect<'tcx> { fn visit_item(&mut self, item: &hir::Item) { let ty = match item.node { hir::ItemKind::Impl(.., None, ref ty, _) => ty, @@ -277,7 +277,7 @@ impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for InherentCollect<'a, 'tcx> { } } -impl<'a, 'tcx> InherentCollect<'a, 'tcx> { +impl InherentCollect<'tcx> { fn check_def_id(&mut self, item: &hir::Item, def_id: DefId) { if def_id.is_local() { // Add the implementation to the mapping from implementation to base diff --git a/src/librustc_typeck/coherence/inherent_impls_overlap.rs b/src/librustc_typeck/coherence/inherent_impls_overlap.rs index a9951c7fe4479..56c03e20405fa 100644 --- a/src/librustc_typeck/coherence/inherent_impls_overlap.rs +++ b/src/librustc_typeck/coherence/inherent_impls_overlap.rs @@ -5,18 +5,18 @@ use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::traits::{self, IntercrateMode}; use rustc::ty::TyCtxt; -pub fn crate_inherent_impls_overlap_check<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +pub fn crate_inherent_impls_overlap_check<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, crate_num: CrateNum) { assert_eq!(crate_num, LOCAL_CRATE); let krate = tcx.hir().krate(); krate.visit_all_item_likes(&mut InherentOverlapChecker { tcx }); } -struct InherentOverlapChecker<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx> +struct InherentOverlapChecker<'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx> } -impl<'a, 'tcx> InherentOverlapChecker<'a, 'tcx> { +impl InherentOverlapChecker<'tcx> { fn check_for_common_items_in_impls(&self, impl1: DefId, impl2: DefId, overlap: traits::OverlapResult<'_>) { @@ -83,7 +83,7 @@ impl<'a, 'tcx> InherentOverlapChecker<'a, 'tcx> { } } -impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for InherentOverlapChecker<'a, 'tcx> { +impl ItemLikeVisitor<'v> for InherentOverlapChecker<'tcx> { fn visit_item(&mut self, item: &'v hir::Item) { match item.node { hir::ItemKind::Enum(..) | diff --git a/src/librustc_typeck/coherence/mod.rs b/src/librustc_typeck/coherence/mod.rs index 40f01ebb3c19f..e33adcbacfe12 100644 --- a/src/librustc_typeck/coherence/mod.rs +++ b/src/librustc_typeck/coherence/mod.rs @@ -18,7 +18,7 @@ mod inherent_impls_overlap; mod orphan; mod unsafety; -fn check_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, hir_id: HirId) { +fn check_impl<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, hir_id: HirId) { let impl_def_id = tcx.hir().local_def_id_from_hir_id(hir_id); // If there are no traits, then this implementation must have a @@ -132,7 +132,7 @@ pub fn provide(providers: &mut Providers<'_>) { }; } -fn coherent_trait<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) { +fn coherent_trait<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { let impls = tcx.hir().trait_impls(def_id); for &impl_id in impls { check_impl(tcx, impl_id); @@ -143,7 +143,7 @@ fn coherent_trait<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) { builtin::check_trait(tcx, def_id); } -pub fn check_coherence<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { +pub fn check_coherence<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { for &trait_def_id in tcx.hir().krate().trait_impls.keys() { tcx.ensure().coherent_trait(trait_def_id); } @@ -159,7 +159,7 @@ pub fn check_coherence<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { /// Overlap: no two impls for the same trait are implemented for the /// same type. Likewise, no two inherent impls for a given type /// constructor provide a method with the same name. -fn check_impl_overlap<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, hir_id: HirId) { +fn check_impl_overlap<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, hir_id: HirId) { let impl_def_id = tcx.hir().local_def_id_from_hir_id(hir_id); let trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap(); let trait_def_id = trait_ref.def_id; diff --git a/src/librustc_typeck/coherence/orphan.rs b/src/librustc_typeck/coherence/orphan.rs index 7e1c38e051542..144d70cec0c02 100644 --- a/src/librustc_typeck/coherence/orphan.rs +++ b/src/librustc_typeck/coherence/orphan.rs @@ -6,16 +6,16 @@ use rustc::ty::{self, TyCtxt}; use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::hir; -pub fn check<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { +pub fn check<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { let mut orphan = OrphanChecker { tcx }; tcx.hir().krate().visit_all_item_likes(&mut orphan); } -struct OrphanChecker<'cx, 'tcx: 'cx> { - tcx: TyCtxt<'cx, 'tcx, 'tcx>, +struct OrphanChecker<'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } -impl<'cx, 'tcx, 'v> ItemLikeVisitor<'v> for OrphanChecker<'cx, 'tcx> { +impl ItemLikeVisitor<'v> for OrphanChecker<'tcx> { /// Checks exactly one impl for orphan rules and other such /// restrictions. In this fn, it can happen that multiple errors /// apply to a specific impl, so just return after reporting one diff --git a/src/librustc_typeck/coherence/unsafety.rs b/src/librustc_typeck/coherence/unsafety.rs index 0b1de510aa4bd..43b513667101a 100644 --- a/src/librustc_typeck/coherence/unsafety.rs +++ b/src/librustc_typeck/coherence/unsafety.rs @@ -5,16 +5,16 @@ use rustc::ty::TyCtxt; use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::hir::{self, Unsafety}; -pub fn check<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { +pub fn check<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { let mut unsafety = UnsafetyChecker { tcx }; tcx.hir().krate().visit_all_item_likes(&mut unsafety); } -struct UnsafetyChecker<'cx, 'tcx: 'cx> { - tcx: TyCtxt<'cx, 'tcx, 'tcx>, +struct UnsafetyChecker<'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } -impl<'cx, 'tcx, 'v> UnsafetyChecker<'cx, 'tcx> { +impl UnsafetyChecker<'tcx> { fn check_unsafety_coherence(&mut self, item: &'v hir::Item, impl_generics: Option<&hir::Generics>, @@ -69,7 +69,7 @@ impl<'cx, 'tcx, 'v> UnsafetyChecker<'cx, 'tcx> { } } -impl<'cx, 'tcx, 'v> ItemLikeVisitor<'v> for UnsafetyChecker<'cx, 'tcx> { +impl ItemLikeVisitor<'v> for UnsafetyChecker<'tcx> { fn visit_item(&mut self, item: &'v hir::Item) { if let hir::ItemKind::Impl(unsafety, polarity, _, ref generics, ..) = item.node { self.check_unsafety_coherence(item, Some(generics), unsafety, polarity); diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index 5d91794506c6a..4b2217791d028 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -56,7 +56,7 @@ struct OnlySelfBounds(bool); /////////////////////////////////////////////////////////////////////////// // Main entry point -fn collect_mod_item_types<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, module_def_id: DefId) { +fn collect_mod_item_types<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, module_def_id: DefId) { tcx.hir().visit_item_likes_in_module( module_def_id, &mut CollectItemTypesVisitor { tcx }.as_deep_visitor() @@ -96,18 +96,18 @@ pub fn provide(providers: &mut Providers<'_>) { /// `ItemCtxt` is parameterized by a `DefId` that it uses to satisfy /// `get_type_parameter_bounds` requests, drawing the information from /// the AST (`hir::Generics`), recursively. -pub struct ItemCtxt<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, +pub struct ItemCtxt<'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item_def_id: DefId, } /////////////////////////////////////////////////////////////////////////// -struct CollectItemTypesVisitor<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, +struct CollectItemTypesVisitor<'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } -impl<'a, 'tcx> Visitor<'tcx> for CollectItemTypesVisitor<'a, 'tcx> { +impl Visitor<'tcx> for CollectItemTypesVisitor<'tcx> { fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> { NestedVisitorMap::OnlyBodies(&self.tcx.hir()) } @@ -160,20 +160,18 @@ impl<'a, 'tcx> Visitor<'tcx> for CollectItemTypesVisitor<'a, 'tcx> { /////////////////////////////////////////////////////////////////////////// // Utility types and common code for the above passes. -impl<'a, 'tcx> ItemCtxt<'a, 'tcx> { - pub fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>, item_def_id: DefId) -> ItemCtxt<'a, 'tcx> { +impl ItemCtxt<'tcx> { + pub fn new(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item_def_id: DefId) -> ItemCtxt<'tcx> { ItemCtxt { tcx, item_def_id } } -} -impl<'a, 'tcx> ItemCtxt<'a, 'tcx> { pub fn to_ty(&self, ast_ty: &hir::Ty) -> Ty<'tcx> { AstConv::ast_ty_to_ty(self, ast_ty) } } -impl<'a, 'tcx> AstConv<'tcx, 'tcx> for ItemCtxt<'a, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'b, 'tcx, 'tcx> { +impl AstConv<'tcx, 'tcx> for ItemCtxt<'tcx> { + fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'tcx, 'tcx> { self.tcx } @@ -256,7 +254,7 @@ impl<'a, 'tcx> AstConv<'tcx, 'tcx> for ItemCtxt<'a, 'tcx> { } fn type_param_predicates<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, (item_def_id, def_id): (DefId, DefId), ) -> &'tcx ty::GenericPredicates<'tcx> { use rustc::hir::*; @@ -333,7 +331,7 @@ fn type_param_predicates<'a, 'tcx>( tcx.arena.alloc(result) } -impl<'a, 'tcx> ItemCtxt<'a, 'tcx> { +impl ItemCtxt<'tcx> { /// Finds bounds from `hir::Generics`. This requires scanning through the /// AST. We do this to avoid having to convert *all* the bounds, which /// would create artificial cycles. Instead we can only convert the @@ -384,7 +382,7 @@ impl<'a, 'tcx> ItemCtxt<'a, 'tcx> { /// `ast_ty_to_ty`, because we want to avoid triggering an all-out /// conversion of the type to avoid inducing unnecessary cycles. fn is_param<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ast_ty: &hir::Ty, param_id: hir::HirId, ) -> bool { @@ -400,7 +398,7 @@ fn is_param<'a, 'tcx>( } } -fn convert_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item_id: hir::HirId) { +fn convert_item<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item_id: hir::HirId) { let it = tcx.hir().expect_item_by_hir_id(item_id); debug!("convert: item {} with id {}", it.ident, it.hir_id); let def_id = tcx.hir().local_def_id_from_hir_id(item_id); @@ -482,7 +480,7 @@ fn convert_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item_id: hir::HirId) { } } -fn convert_trait_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, trait_item_id: hir::HirId) { +fn convert_trait_item<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, trait_item_id: hir::HirId) { let trait_item = tcx.hir().expect_trait_item(trait_item_id); let def_id = tcx.hir().local_def_id_from_hir_id(trait_item.hir_id); tcx.generics_of(def_id); @@ -503,7 +501,7 @@ fn convert_trait_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, trait_item_id: hir: tcx.predicates_of(def_id); } -fn convert_impl_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, impl_item_id: hir::HirId) { +fn convert_impl_item<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_item_id: hir::HirId) { let def_id = tcx.hir().local_def_id_from_hir_id(impl_item_id); tcx.generics_of(def_id); tcx.type_of(def_id); @@ -513,7 +511,7 @@ fn convert_impl_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, impl_item_id: hir::H } } -fn convert_variant_ctor<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ctor_id: hir::HirId) { +fn convert_variant_ctor<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ctor_id: hir::HirId) { let def_id = tcx.hir().local_def_id_from_hir_id(ctor_id); tcx.generics_of(def_id); tcx.type_of(def_id); @@ -521,7 +519,7 @@ fn convert_variant_ctor<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ctor_id: hir::Hir } fn convert_enum_variant_types<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, variants: &[hir::Variant], ) { @@ -573,7 +571,7 @@ fn convert_enum_variant_types<'a, 'tcx>( } fn convert_variant<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, variant_did: Option, ctor_did: Option, ident: Ident, @@ -629,7 +627,7 @@ fn convert_variant<'a, 'tcx>( ) } -fn adt_def<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::AdtDef { +fn adt_def<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::AdtDef { use rustc::hir::*; let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); @@ -697,7 +695,7 @@ fn adt_def<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::Ad /// of `trait_def_id` are converted and stored. This also ensures that /// the transitive super-predicates are converted. fn super_predicates_of<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, trait_def_id: DefId, ) -> &'tcx ty::GenericPredicates<'tcx> { debug!("super_predicates(trait_def_id={:?})", trait_def_id); @@ -750,7 +748,7 @@ fn super_predicates_of<'a, 'tcx>( }) } -fn trait_def<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::TraitDef { +fn trait_def<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::TraitDef { let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); let item = tcx.hir().expect_item_by_hir_id(hir_id); @@ -782,16 +780,16 @@ fn trait_def<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty:: } fn has_late_bound_regions<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, node: Node<'tcx>, ) -> Option { - struct LateBoundRegionsDetector<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, + struct LateBoundRegionsDetector<'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, outer_index: ty::DebruijnIndex, has_late_bound_regions: Option, } - impl<'a, 'tcx> Visitor<'tcx> for LateBoundRegionsDetector<'a, 'tcx> { + impl Visitor<'tcx> for LateBoundRegionsDetector<'tcx> { fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> { NestedVisitorMap::None } @@ -843,7 +841,7 @@ fn has_late_bound_regions<'a, 'tcx>( } fn has_late_bound_regions<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, generics: &'tcx hir::Generics, decl: &'tcx hir::FnDecl, ) -> Option { @@ -892,7 +890,7 @@ fn has_late_bound_regions<'a, 'tcx>( } } -fn generics_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::Generics { +fn generics_of<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::Generics { use rustc::hir::*; let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); @@ -1135,7 +1133,7 @@ fn generics_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty }) } -fn report_assoc_ty_on_inherent_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, span: Span) { +fn report_assoc_ty_on_inherent_impl<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, span: Span) { span_err!( tcx.sess, span, @@ -1144,7 +1142,7 @@ fn report_assoc_ty_on_inherent_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, span: ); } -fn type_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> { +fn type_of<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> { checked_type_of(tcx, def_id, true).unwrap() } @@ -1153,7 +1151,7 @@ fn type_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> { /// If you want to fail anyway, you can set the `fail` parameter to true, but in this case, /// you'd better just call [`type_of`] directly. pub fn checked_type_of<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, fail: bool, ) -> Option> { @@ -1482,15 +1480,15 @@ pub fn checked_type_of<'a, 'tcx>( } fn find_existential_constraints<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, ) -> Ty<'tcx> { use rustc::hir::{ImplItem, Item, TraitItem}; debug!("find_existential_constraints({:?})", def_id); - struct ConstraintLocator<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, + struct ConstraintLocator<'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, // (first found type span, actual type, mapping from the existential type's generic // parameters to the concrete type's generic parameters) @@ -1501,7 +1499,7 @@ fn find_existential_constraints<'a, 'tcx>( found: Option<(Span, Ty<'tcx>, Vec)>, } - impl<'a, 'tcx> ConstraintLocator<'a, 'tcx> { + impl ConstraintLocator<'tcx> { fn check(&mut self, def_id: DefId) { // Don't try to check items that cannot possibly constrain the type. if !self.tcx.has_typeck_tables(def_id) { @@ -1638,7 +1636,7 @@ fn find_existential_constraints<'a, 'tcx>( } } - impl<'a, 'tcx> intravisit::Visitor<'tcx> for ConstraintLocator<'a, 'tcx> { + impl<'tcx> intravisit::Visitor<'tcx> for ConstraintLocator<'tcx> { fn nested_visit_map<'this>(&'this mut self) -> intravisit::NestedVisitorMap<'this, 'tcx> { intravisit::NestedVisitorMap::All(&self.tcx.hir()) } @@ -1702,7 +1700,7 @@ fn find_existential_constraints<'a, 'tcx>( } } -fn fn_sig<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> ty::PolyFnSig<'tcx> { +fn fn_sig<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> ty::PolyFnSig<'tcx> { use rustc::hir::*; use rustc::hir::Node::*; @@ -1779,7 +1777,7 @@ fn fn_sig<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> ty::PolyFnSig } fn impl_trait_ref<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, ) -> Option> { let icx = ItemCtxt::new(tcx, def_id); @@ -1796,7 +1794,7 @@ fn impl_trait_ref<'a, 'tcx>( } } -fn impl_polarity<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> hir::ImplPolarity { +fn impl_polarity<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> hir::ImplPolarity { let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); match tcx.hir().expect_item_by_hir_id(hir_id).node { hir::ItemKind::Impl(_, polarity, ..) => polarity, @@ -1809,8 +1807,8 @@ fn impl_polarity<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> hir::I /// the lifetimes that are declared. For fns or methods, we have to /// screen out those that do not appear in any where-clauses etc using /// `resolve_lifetime::early_bound_lifetimes`. -fn early_bound_lifetimes_from_generics<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn early_bound_lifetimes_from_generics<'a, 'tcx: 'a>( + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, generics: &'a hir::Generics, ) -> impl Iterator + Captures<'tcx> { generics @@ -1828,7 +1826,7 @@ fn early_bound_lifetimes_from_generics<'a, 'tcx>( /// lifetime constraints. This includes all predicates returned by `explicit_predicates_of`, plus /// inferred constraints concerning which regions outlive other regions. fn predicates_defined_on<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, ) -> &'tcx ty::GenericPredicates<'tcx> { debug!("predicates_defined_on({:?})", def_id); @@ -1858,7 +1856,7 @@ fn predicates_defined_on<'a, 'tcx>( /// ID `def_id`. This includes all predicates returned by `predicates_defined_on`, plus /// `Self: Trait` predicates for traits. fn predicates_of<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, ) -> &'tcx ty::GenericPredicates<'tcx> { let mut result = tcx.predicates_defined_on(def_id); @@ -1888,7 +1886,7 @@ fn predicates_of<'a, 'tcx>( /// Returns a list of user-specified type predicates for the definition with ID `def_id`. /// N.B., this does not include any implied/inferred constraints. fn explicit_predicates_of<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, ) -> &'tcx ty::GenericPredicates<'tcx> { use rustc::hir::*; @@ -2251,7 +2249,7 @@ fn predicates_from_bound<'tcx>( } fn compute_sig_of_foreign_fn_decl<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, decl: &hir::FnDecl, abi: abi::Abi, @@ -2295,7 +2293,7 @@ fn compute_sig_of_foreign_fn_decl<'a, 'tcx>( fty } -fn is_foreign_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> bool { +fn is_foreign_item<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> bool { match tcx.hir().get_if_local(def_id) { Some(Node::ForeignItem(..)) => true, Some(_) => false, @@ -2304,7 +2302,7 @@ fn is_foreign_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> bool } fn static_mutability<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, ) -> Option { match tcx.hir().get_if_local(def_id) { @@ -2414,7 +2412,7 @@ fn from_target_feature( } } -fn linkage_by_name<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId, name: &str) -> Linkage { +fn linkage_by_name<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, name: &str) -> Linkage { use rustc::mir::mono::Linkage::*; // Use the names from src/llvm/docs/LangRef.rst here. Most types are only @@ -2449,7 +2447,7 @@ fn linkage_by_name<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId, name: & } } -fn codegen_fn_attrs<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, id: DefId) -> CodegenFnAttrs { +fn codegen_fn_attrs<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, id: DefId) -> CodegenFnAttrs { let attrs = tcx.get_attrs(id); let mut codegen_fn_attrs = CodegenFnAttrs::new(); diff --git a/src/librustc_typeck/constrained_generic_params.rs b/src/librustc_typeck/constrained_generic_params.rs index 49910e39fed20..a0f592586b43f 100644 --- a/src/librustc_typeck/constrained_generic_params.rs +++ b/src/librustc_typeck/constrained_generic_params.rs @@ -86,7 +86,7 @@ impl<'tcx> TypeVisitor<'tcx> for ParameterCollector { } } -pub fn identify_constrained_generic_params<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, +pub fn identify_constrained_generic_params<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, predicates: &ty::GenericPredicates<'tcx>, impl_trait_ref: Option>, input_parameters: &mut FxHashSet) diff --git a/src/librustc_typeck/impl_wf_check.rs b/src/librustc_typeck/impl_wf_check.rs index 87476d37b35e7..5ffaa1eff2c19 100644 --- a/src/librustc_typeck/impl_wf_check.rs +++ b/src/librustc_typeck/impl_wf_check.rs @@ -49,7 +49,7 @@ use syntax_pos::Span; /// impl<'a> Trait for Bar { type X = &'a i32; } /// // ^ 'a is unused and appears in assoc type, error /// ``` -pub fn impl_wf_check<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { +pub fn impl_wf_check<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { // We will tag this as part of the WF check -- logically, it is, // but it's one that we must perform earlier than the rest of // WfCheck. @@ -58,7 +58,7 @@ pub fn impl_wf_check<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { } } -fn check_mod_impl_wf<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, module_def_id: DefId) { +fn check_mod_impl_wf<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, module_def_id: DefId) { tcx.hir().visit_item_likes_in_module( module_def_id, &mut ImplWfCheck { tcx } @@ -72,11 +72,11 @@ pub fn provide(providers: &mut Providers<'_>) { }; } -struct ImplWfCheck<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, +struct ImplWfCheck<'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } -impl<'a, 'tcx> ItemLikeVisitor<'tcx> for ImplWfCheck<'a, 'tcx> { +impl ItemLikeVisitor<'tcx> for ImplWfCheck<'tcx> { fn visit_item(&mut self, item: &'tcx hir::Item) { if let hir::ItemKind::Impl(.., ref impl_item_refs) = item.node { let impl_def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id); @@ -92,7 +92,7 @@ impl<'a, 'tcx> ItemLikeVisitor<'tcx> for ImplWfCheck<'a, 'tcx> { fn visit_impl_item(&mut self, _impl_item: &'tcx hir::ImplItem) { } } -fn enforce_impl_params_are_constrained<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn enforce_impl_params_are_constrained<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_def_id: DefId, impl_item_refs: &[hir::ImplItemRef]) { @@ -186,7 +186,7 @@ fn report_unused_parameter(tcx: TyCtxt<'_, '_, '_>, } /// Enforce that we do not have two items in an impl with the same name. -fn enforce_impl_items_are_distinct<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn enforce_impl_items_are_distinct<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_item_refs: &[hir::ImplItemRef]) { let mut seen_type_items = FxHashMap::default(); diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index 14dec423c57a9..b77c5eea49477 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -63,6 +63,7 @@ This API is completely unstable and subject to change. #![feature(box_syntax)] #![feature(crate_visibility_modifier)] #![feature(exhaustive_patterns)] +#![feature(in_band_lifetimes)] #![feature(nll)] #![feature(rustc_diagnostic_macros)] #![feature(slice_patterns)] @@ -123,7 +124,7 @@ pub struct TypeAndSubsts<'tcx> { ty: Ty<'tcx>, } -fn check_type_alias_enum_variants_enabled<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, +fn check_type_alias_enum_variants_enabled<'a, 'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, span: Span) { if !tcx.features().type_alias_enum_variants { let mut err = tcx.sess.struct_span_err( @@ -150,7 +151,7 @@ fn require_c_abi_if_c_variadic(tcx: TyCtxt<'_, '_, '_>, } } -fn require_same_types<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn require_same_types<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, cause: &ObligationCause<'tcx>, expected: Ty<'tcx>, actual: Ty<'tcx>) @@ -178,7 +179,7 @@ fn require_same_types<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, }) } -fn check_main_fn_ty<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, main_def_id: DefId) { +fn check_main_fn_ty<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, main_def_id: DefId) { let main_id = tcx.hir().as_local_hir_id(main_def_id).unwrap(); let main_span = tcx.def_span(main_def_id); let main_t = tcx.type_of(main_def_id); @@ -243,7 +244,7 @@ fn check_main_fn_ty<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, main_def_id: DefId) { } } -fn check_start_fn_ty<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, start_def_id: DefId) { +fn check_start_fn_ty<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, start_def_id: DefId) { let start_id = tcx.hir().as_local_hir_id(start_def_id).unwrap(); let start_span = tcx.def_span(start_def_id); let start_t = tcx.type_of(start_def_id); @@ -300,7 +301,7 @@ fn check_start_fn_ty<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, start_def_id: DefId) } } -fn check_for_entry_fn<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { +fn check_for_entry_fn<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { match tcx.entry_fn(LOCAL_CRATE) { Some((def_id, EntryFnType::Main)) => check_main_fn_ty(tcx, def_id), Some((def_id, EntryFnType::Start)) => check_start_fn_ty(tcx, def_id), @@ -317,7 +318,7 @@ pub fn provide(providers: &mut Providers<'_>) { impl_wf_check::provide(providers); } -pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) +pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Result<(), ErrorReported> { tcx.sess.profiler(|p| p.start_activity("type-check crate")); @@ -380,7 +381,7 @@ pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) /// A quasi-deprecated helper used in rustdoc and clippy to get /// the type from a HIR node. -pub fn hir_ty_to_ty<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, hir_ty: &hir::Ty) -> Ty<'tcx> { +pub fn hir_ty_to_ty<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, hir_ty: &hir::Ty) -> Ty<'tcx> { // In case there are any projections, etc., find the "environment" // def-ID that will be used to determine the traits/predicates in // scope. This is derived from the enclosing item-like thing. @@ -391,7 +392,7 @@ pub fn hir_ty_to_ty<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, hir_ty: &hir::Ty) -> astconv::AstConv::ast_ty_to_ty(&item_cx, hir_ty) } -pub fn hir_trait_to_predicates<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, hir_trait: &hir::TraitRef) +pub fn hir_trait_to_predicates<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, hir_trait: &hir::TraitRef) -> (ty::PolyTraitRef<'tcx>, Bounds<'tcx>) { // In case there are any projections, etc., find the "environment" // def-ID that will be used to determine the traits/predicates in diff --git a/src/librustc_typeck/outlives/explicit.rs b/src/librustc_typeck/outlives/explicit.rs index 574086f780a9d..87ba9a466a82d 100644 --- a/src/librustc_typeck/outlives/explicit.rs +++ b/src/librustc_typeck/outlives/explicit.rs @@ -18,7 +18,7 @@ impl<'tcx> ExplicitPredicatesMap<'tcx> { pub fn explicit_predicates_of( &mut self, - tcx: TyCtxt<'_, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, ) -> &RequiredPredicates<'tcx> { self.map.entry(def_id).or_insert_with(|| { diff --git a/src/librustc_typeck/outlives/implicit_infer.rs b/src/librustc_typeck/outlives/implicit_infer.rs index b560f3b497920..354be95c05007 100644 --- a/src/librustc_typeck/outlives/implicit_infer.rs +++ b/src/librustc_typeck/outlives/implicit_infer.rs @@ -15,7 +15,7 @@ use super::utils::*; /// was generated by walking the items in the crate. This will /// now be filled with inferred predicates. pub fn infer_predicates<'tcx>( - tcx: TyCtxt<'_, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, explicit_map: &mut ExplicitPredicatesMap<'tcx>, ) -> FxHashMap> { debug!("infer_predicates"); @@ -44,7 +44,7 @@ pub fn infer_predicates<'tcx>( } pub struct InferVisitor<'cx, 'tcx: 'cx> { - tcx: TyCtxt<'cx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, global_inferred_outlives: &'cx mut FxHashMap>, predicates_added: &'cx mut bool, explicit_map: &'cx mut ExplicitPredicatesMap<'tcx>, @@ -117,7 +117,7 @@ impl<'cx, 'tcx> ItemLikeVisitor<'tcx> for InferVisitor<'cx, 'tcx> { } fn insert_required_predicates_to_be_wf<'tcx>( - tcx: TyCtxt<'_, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, field_ty: Ty<'tcx>, global_inferred_outlives: &FxHashMap>, required_predicates: &mut RequiredPredicates<'tcx>, @@ -255,7 +255,7 @@ pub struct IgnoreSelfTy(bool); /// can ignore, but we will want to process `U: 'static`, /// applying the substitution as above. pub fn check_explicit_predicates<'tcx>( - tcx: TyCtxt<'_, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: &DefId, substs: &[Kind<'tcx>], required_predicates: &mut RequiredPredicates<'tcx>, diff --git a/src/librustc_typeck/outlives/mod.rs b/src/librustc_typeck/outlives/mod.rs index 57787a75e4aef..da4b9c686195d 100644 --- a/src/librustc_typeck/outlives/mod.rs +++ b/src/librustc_typeck/outlives/mod.rs @@ -21,7 +21,7 @@ pub fn provide(providers: &mut Providers<'_>) { } fn inferred_outlives_of<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item_def_id: DefId, ) -> &'tcx [ty::Predicate<'tcx>] { let id = tcx @@ -71,7 +71,7 @@ fn inferred_outlives_of<'a, 'tcx>( } fn inferred_outlives_crate<'tcx>( - tcx: TyCtxt<'_, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, crate_num: CrateNum, ) -> &'tcx CratePredicatesMap<'tcx> { assert_eq!(crate_num, LOCAL_CRATE); diff --git a/src/librustc_typeck/outlives/test.rs b/src/librustc_typeck/outlives/test.rs index 54fd4fad1d195..06097349fd6a4 100644 --- a/src/librustc_typeck/outlives/test.rs +++ b/src/librustc_typeck/outlives/test.rs @@ -3,17 +3,17 @@ use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::ty::TyCtxt; use syntax::symbol::sym; -pub fn test_inferred_outlives<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { +pub fn test_inferred_outlives<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { tcx.hir() .krate() .visit_all_item_likes(&mut OutlivesTest { tcx }); } -struct OutlivesTest<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, +struct OutlivesTest<'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } -impl<'a, 'tcx> ItemLikeVisitor<'tcx> for OutlivesTest<'a, 'tcx> { +impl ItemLikeVisitor<'tcx> for OutlivesTest<'tcx> { fn visit_item(&mut self, item: &'tcx hir::Item) { let item_def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id); diff --git a/src/librustc_typeck/outlives/utils.rs b/src/librustc_typeck/outlives/utils.rs index ee552ca9cbb25..26243c765ed13 100644 --- a/src/librustc_typeck/outlives/utils.rs +++ b/src/librustc_typeck/outlives/utils.rs @@ -11,7 +11,7 @@ pub type RequiredPredicates<'tcx> = BTreeSet, t /// Given a requirement `T: 'a` or `'b: 'a`, deduce the /// outlives_component and add it to `required_predicates` pub fn insert_outlives_predicate<'tcx>( - tcx: TyCtxt<'_, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, kind: Kind<'tcx>, outlived_region: Region<'tcx>, required_predicates: &mut RequiredPredicates<'tcx>, @@ -125,7 +125,7 @@ pub fn insert_outlives_predicate<'tcx>( } } -fn is_free_region<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, region: Region<'_>) -> bool { +fn is_free_region<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, region: Region<'_>) -> bool { // First, screen for regions that might appear in a type header. match region { // These correspond to `T: 'a` relationships: diff --git a/src/librustc_typeck/variance/constraints.rs b/src/librustc_typeck/variance/constraints.rs index 4f82978f01a5d..325f632ad6dee 100644 --- a/src/librustc_typeck/variance/constraints.rs +++ b/src/librustc_typeck/variance/constraints.rs @@ -124,7 +124,7 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> { self.build_constraints_for_item(def_id); } - fn tcx(&self) -> TyCtxt<'a, 'tcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'tcx, 'tcx, 'tcx> { self.terms_cx.tcx } diff --git a/src/librustc_typeck/variance/mod.rs b/src/librustc_typeck/variance/mod.rs index 47c4a9b39c865..d850e48914539 100644 --- a/src/librustc_typeck/variance/mod.rs +++ b/src/librustc_typeck/variance/mod.rs @@ -34,7 +34,7 @@ pub fn provide(providers: &mut Providers<'_>) { }; } -fn crate_variances<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, crate_num: CrateNum) +fn crate_variances<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, crate_num: CrateNum) -> &'tcx CrateVariancesMap<'tcx> { assert_eq!(crate_num, LOCAL_CRATE); let mut arena = arena::TypedArena::default(); @@ -43,7 +43,7 @@ fn crate_variances<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, crate_num: CrateNum) tcx.arena.alloc(solve::solve_constraints(constraints_cx)) } -fn variances_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item_def_id: DefId) +fn variances_of<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item_def_id: DefId) -> &'tcx [ty::Variance] { let id = tcx.hir().as_local_hir_id(item_def_id).expect("expected local def-id"); let unsupported = || { diff --git a/src/librustc_typeck/variance/terms.rs b/src/librustc_typeck/variance/terms.rs index efb221b92324e..2faae2b2a97b2 100644 --- a/src/librustc_typeck/variance/terms.rs +++ b/src/librustc_typeck/variance/terms.rs @@ -48,7 +48,7 @@ impl<'a> fmt::Debug for VarianceTerm<'a> { // The first pass over the crate simply builds up the set of inferreds. pub struct TermsContext<'a, 'tcx: 'a> { - pub tcx: TyCtxt<'a, 'tcx, 'tcx>, + pub tcx: TyCtxt<'tcx, 'tcx, 'tcx>, pub arena: &'a TypedArena>, // For marker types, UnsafeCell, and other lang items where @@ -64,7 +64,7 @@ pub struct TermsContext<'a, 'tcx: 'a> { pub inferred_terms: Vec>, } -pub fn determine_parameters_to_be_inferred<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +pub fn determine_parameters_to_be_inferred<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, arena: &'a mut TypedArena>) -> TermsContext<'a, 'tcx> { let mut terms_cx = TermsContext { diff --git a/src/librustc_typeck/variance/test.rs b/src/librustc_typeck/variance/test.rs index b5195826b8631..bd4e8d3fd5d7f 100644 --- a/src/librustc_typeck/variance/test.rs +++ b/src/librustc_typeck/variance/test.rs @@ -3,15 +3,15 @@ use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::ty::TyCtxt; use syntax::symbol::sym; -pub fn test_variance<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { +pub fn test_variance<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { tcx.hir().krate().visit_all_item_likes(&mut VarianceTest { tcx }); } -struct VarianceTest<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx> +struct VarianceTest<'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx> } -impl<'a, 'tcx> ItemLikeVisitor<'tcx> for VarianceTest<'a, 'tcx> { +impl ItemLikeVisitor<'tcx> for VarianceTest<'tcx> { fn visit_item(&mut self, item: &'tcx hir::Item) { let item_def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id); diff --git a/src/librustdoc/clean/auto_trait.rs b/src/librustdoc/clean/auto_trait.rs index 7b58312a5edef..f40cb09bde84f 100644 --- a/src/librustdoc/clean/auto_trait.rs +++ b/src/librustdoc/clean/auto_trait.rs @@ -7,7 +7,7 @@ use super::*; pub struct AutoTraitFinder<'a, 'tcx> { pub cx: &'a core::DocContext<'tcx>, - pub f: auto_trait::AutoTraitFinder<'a, 'tcx>, + pub f: auto_trait::AutoTraitFinder<'tcx>, } impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { @@ -315,7 +315,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { fn extract_for_generics<'b, 'c, 'd>( &self, - tcx: TyCtxt<'b, 'c, 'd>, + tcx: TyCtxt<'d, 'c, 'd>, pred: ty::Predicate<'d>, ) -> FxHashSet { pred.walk_tys() @@ -450,7 +450,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { // * We explcitly add a '?Sized' bound if we didn't find any 'Sized' predicates for a type fn param_env_to_generics<'b, 'c, 'cx>( &self, - tcx: TyCtxt<'b, 'c, 'cx>, + tcx: TyCtxt<'cx, 'c, 'cx>, param_env_def_id: DefId, param_env: ty::ParamEnv<'cx>, mut existing_predicates: Vec, @@ -791,11 +791,11 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { // Replaces all ReVars in a type with ty::Region's, using the provided map struct RegionReplacer<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { vid_to_region: &'a FxHashMap>, - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, } impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for RegionReplacer<'a, 'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'b, 'gcx, 'tcx> { + fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.tcx } diff --git a/src/test/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs b/src/test/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs index 1bab3f01aba04..7e9f004684d38 100644 --- a/src/test/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs +++ b/src/test/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs @@ -60,7 +60,7 @@ impl CodegenBackend for TheBackend { fn codegen_crate<'a, 'tcx>( &self, - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, _metadata: EncodedMetadata, _need_metadata_module: bool, _rx: mpsc::Receiver> From 244125350880ca2f905928cae4115867eedd301a Mon Sep 17 00:00:00 2001 From: Eduard-Mihai Burtescu Date: Tue, 11 Jun 2019 23:35:39 +0300 Subject: [PATCH 2/7] Fix fallout from `deny(unused_lifetimes)`. --- src/librustc/cfg/construct.rs | 2 +- src/librustc/cfg/mod.rs | 2 +- src/librustc/dep_graph/graph.rs | 2 +- src/librustc/dep_graph/safe.rs | 2 +- src/librustc/infer/canonical/mod.rs | 2 +- src/librustc/infer/error_reporting/mod.rs | 2 +- src/librustc/infer/mod.rs | 2 +- .../infer/outlives/free_region_map.rs | 4 +- src/librustc/infer/region_constraints/mod.rs | 2 +- src/librustc/infer/unify_key.rs | 6 +- src/librustc/lint/mod.rs | 2 +- src/librustc/macros.rs | 4 +- src/librustc/middle/cstore.rs | 2 +- src/librustc/middle/dead.rs | 8 +-- src/librustc/middle/dependency_format.rs | 8 +-- src/librustc/middle/intrinsicck.rs | 2 +- src/librustc/middle/lang_items.rs | 4 +- src/librustc/middle/lib_features.rs | 2 +- src/librustc/middle/liveness.rs | 10 +-- src/librustc/middle/reachable.rs | 4 +- src/librustc/middle/region.rs | 26 ++++---- src/librustc/middle/stability.rs | 10 +-- src/librustc/middle/weak_lang_items.rs | 6 +- src/librustc/mir/interpret/error.rs | 4 +- src/librustc/mir/interpret/mod.rs | 7 +- src/librustc/mir/mod.rs | 4 +- src/librustc/mir/mono.rs | 10 +-- src/librustc/mir/tcx.rs | 10 +-- src/librustc/traits/codegen/mod.rs | 4 +- src/librustc/traits/coherence.rs | 6 +- src/librustc/traits/error_reporting.rs | 4 +- src/librustc/traits/mod.rs | 20 +++--- src/librustc/traits/object_safety.rs | 4 +- src/librustc/traits/on_unimplemented.rs | 4 +- src/librustc/traits/project.rs | 2 +- .../traits/query/normalize_erasing_regions.rs | 2 +- src/librustc/traits/select.rs | 2 +- src/librustc/traits/specialize/mod.rs | 6 +- .../traits/specialize/specialization_graph.rs | 6 +- src/librustc/traits/structural_impls.rs | 20 +++--- src/librustc/traits/util.rs | 22 +++---- src/librustc/ty/adjustment.rs | 2 +- src/librustc/ty/constness.rs | 8 +-- src/librustc/ty/context.rs | 18 +++--- src/librustc/ty/erase_regions.rs | 4 +- src/librustc/ty/error.rs | 4 +- src/librustc/ty/fast_reject.rs | 2 +- src/librustc/ty/fold.rs | 10 +-- .../ty/inhabitedness/def_id_forest.rs | 2 +- src/librustc/ty/inhabitedness/mod.rs | 10 +-- src/librustc/ty/instance.rs | 12 ++-- src/librustc/ty/layout.rs | 30 ++++----- src/librustc/ty/mod.rs | 38 +++++------ src/librustc/ty/outlives.rs | 2 +- src/librustc/ty/query/config.rs | 2 +- src/librustc/ty/query/on_disk_cache.rs | 4 +- src/librustc/ty/query/plumbing.rs | 2 +- src/librustc/ty/query/values.rs | 8 +-- src/librustc/ty/structural_impls.rs | 64 +++++++++---------- src/librustc/ty/sty.rs | 18 +++--- src/librustc/ty/subst.rs | 8 +-- src/librustc/ty/trait_def.rs | 6 +- src/librustc/ty/util.rs | 38 +++++------ src/librustc/ty/wf.rs | 2 +- src/librustc_borrowck/borrowck/check_loans.rs | 2 +- .../borrowck/gather_loans/gather_moves.rs | 2 +- src/librustc_borrowck/borrowck/mod.rs | 4 +- src/librustc_borrowck/dataflow.rs | 8 +-- .../back/symbol_export.rs | 12 ++-- src/librustc_codegen_ssa/base.rs | 4 +- .../debuginfo/type_names.rs | 6 +- src/librustc_codegen_ssa/traits/backend.rs | 4 +- src/librustc_codegen_utils/codegen_backend.rs | 2 +- .../symbol_names/legacy.rs | 2 +- .../symbol_names_test.rs | 2 +- src/librustc_driver/pretty.rs | 2 +- src/librustc_incremental/assert_dep_graph.rs | 4 +- .../assert_module_sources.rs | 2 +- .../persist/dirty_clean.rs | 2 +- src/librustc_incremental/persist/load.rs | 2 +- src/librustc_incremental/persist/save.rs | 2 +- src/librustc_lint/types.rs | 6 +- src/librustc_metadata/cstore_impl.rs | 2 +- src/librustc_metadata/encoder.rs | 2 +- src/librustc_metadata/foreign_modules.rs | 2 +- src/librustc_metadata/link_args.rs | 2 +- src/librustc_metadata/native_libs.rs | 2 +- src/librustc_mir/borrow_check/mod.rs | 2 +- .../borrow_check/mutability_errors.rs | 4 +- .../borrow_check/nll/explain_borrow/mod.rs | 2 +- .../borrow_check/nll/invalidation.rs | 2 +- src/librustc_mir/borrow_check/path_utils.rs | 2 +- .../borrow_check/places_conflict.rs | 4 +- src/librustc_mir/build/mod.rs | 6 +- .../dataflow/drop_flag_effects.rs | 18 +++--- .../dataflow/move_paths/builder.rs | 2 +- src/librustc_mir/dataflow/move_paths/mod.rs | 2 +- src/librustc_mir/hair/constant.rs | 2 +- src/librustc_mir/hair/pattern/_match.rs | 2 +- src/librustc_mir/hair/pattern/check_match.rs | 2 +- src/librustc_mir/hair/pattern/mod.rs | 2 +- .../interpret/intrinsics/type_name.rs | 4 +- src/librustc_mir/interpret/snapshot.rs | 2 +- src/librustc_mir/monomorphize/collector.rs | 36 +++++------ src/librustc_mir/monomorphize/mod.rs | 2 +- src/librustc_mir/monomorphize/partitioning.rs | 10 +-- src/librustc_mir/shim.rs | 8 +-- src/librustc_mir/transform/add_call_guards.rs | 2 +- .../transform/add_moves_for_packed_drops.rs | 8 +-- src/librustc_mir/transform/add_retag.rs | 4 +- src/librustc_mir/transform/check_unsafety.rs | 8 +-- .../transform/cleanup_post_borrowck.rs | 2 +- src/librustc_mir/transform/const_prop.rs | 4 +- src/librustc_mir/transform/copy_prop.rs | 2 +- src/librustc_mir/transform/deaggregator.rs | 2 +- src/librustc_mir/transform/dump_mir.rs | 6 +- src/librustc_mir/transform/elaborate_drops.rs | 6 +- src/librustc_mir/transform/erase_regions.rs | 2 +- src/librustc_mir/transform/generator.rs | 20 +++--- src/librustc_mir/transform/inline.rs | 4 +- src/librustc_mir/transform/instcombine.rs | 2 +- src/librustc_mir/transform/lower_128bit.rs | 8 +-- src/librustc_mir/transform/mod.rs | 12 ++-- src/librustc_mir/transform/no_landing_pads.rs | 4 +- src/librustc_mir/transform/promote_consts.rs | 2 +- src/librustc_mir/transform/qualify_consts.rs | 4 +- .../transform/remove_noop_landing_pads.rs | 4 +- src/librustc_mir/transform/rustc_peek.rs | 6 +- src/librustc_mir/transform/simplify.rs | 4 +- .../transform/simplify_branches.rs | 2 +- .../transform/uniform_array_move_out.rs | 4 +- src/librustc_mir/util/alignment.rs | 4 +- src/librustc_mir/util/graphviz.rs | 2 +- src/librustc_mir/util/liveness.rs | 6 +- src/librustc_mir/util/mod.rs | 2 +- src/librustc_mir/util/pretty.rs | 16 ++--- src/librustc_passes/layout_test.rs | 2 +- src/librustc_passes/rvalue_promotion.rs | 4 +- src/librustc_privacy/lib.rs | 4 +- src/librustc_traits/chalk_context/mod.rs | 2 +- src/librustc_traits/dropck_outlives.rs | 4 +- src/librustc_traits/lowering/environment.rs | 4 +- src/librustc_traits/lowering/mod.rs | 12 ++-- src/librustc_typeck/astconv.rs | 4 +- src/librustc_typeck/check/autoderef.rs | 2 +- src/librustc_typeck/check/compare_method.rs | 16 ++--- src/librustc_typeck/check/dropck.rs | 6 +- src/librustc_typeck/check/intrinsic.rs | 6 +- src/librustc_typeck/check/method/probe.rs | 2 +- src/librustc_typeck/check/method/suggest.rs | 4 +- src/librustc_typeck/check/mod.rs | 54 ++++++++-------- src/librustc_typeck/check/wfcheck.rs | 30 ++++----- src/librustc_typeck/check_unused.rs | 2 +- src/librustc_typeck/coherence/builtin.rs | 10 +-- .../coherence/inherent_impls.rs | 4 +- .../coherence/inherent_impls_overlap.rs | 2 +- src/librustc_typeck/coherence/mod.rs | 8 +-- src/librustc_typeck/coherence/orphan.rs | 2 +- src/librustc_typeck/coherence/unsafety.rs | 2 +- src/librustc_typeck/collect.rs | 58 ++++++++--------- src/librustc_typeck/impl_wf_check.rs | 6 +- src/librustc_typeck/lib.rs | 16 ++--- src/librustc_typeck/outlives/mod.rs | 2 +- src/librustc_typeck/outlives/test.rs | 2 +- src/librustc_typeck/variance/mod.rs | 4 +- src/librustc_typeck/variance/test.rs | 2 +- src/librustdoc/clean/auto_trait.rs | 4 +- 167 files changed, 583 insertions(+), 586 deletions(-) diff --git a/src/librustc/cfg/construct.rs b/src/librustc/cfg/construct.rs index 0bff16334db09..a6a688460dd6f 100644 --- a/src/librustc/cfg/construct.rs +++ b/src/librustc/cfg/construct.rs @@ -30,7 +30,7 @@ struct LoopScope { break_index: CFGIndex, // where to go on a `break` } -pub fn construct<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn construct<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, body: &hir::Body) -> CFG { let mut graph = graph::Graph::new(); let entry = graph.add_node(CFGNodeData::Entry); diff --git a/src/librustc/cfg/mod.rs b/src/librustc/cfg/mod.rs index e2144c20e9290..887f550f351b6 100644 --- a/src/librustc/cfg/mod.rs +++ b/src/librustc/cfg/mod.rs @@ -49,7 +49,7 @@ pub type CFGNode = graph::Node; pub type CFGEdge = graph::Edge; impl CFG { - pub fn new<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + pub fn new<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, body: &hir::Body) -> CFG { construct::construct(tcx, body) } diff --git a/src/librustc/dep_graph/graph.rs b/src/librustc/dep_graph/graph.rs index a9598e9d4342a..6789912a03e2f 100644 --- a/src/librustc/dep_graph/graph.rs +++ b/src/librustc/dep_graph/graph.rs @@ -842,7 +842,7 @@ impl DepGraph { // // This method will only load queries that will end up in the disk cache. // Other queries will not be executed. - pub fn exec_cache_promotions<'a, 'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { + pub fn exec_cache_promotions<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { let green_nodes: Vec = { let data = self.data.as_ref().unwrap(); data.colors.values.indices().filter_map(|prev_index| { diff --git a/src/librustc/dep_graph/safe.rs b/src/librustc/dep_graph/safe.rs index eb77e4ce4350a..e03d18950a690 100644 --- a/src/librustc/dep_graph/safe.rs +++ b/src/librustc/dep_graph/safe.rs @@ -33,7 +33,7 @@ impl DepGraphSafe for DefId { /// The type context itself can be used to access all kinds of tracked /// state, but those accesses should always generate read events. -impl<'a, 'gcx, 'tcx> DepGraphSafe for TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> DepGraphSafe for TyCtxt<'tcx, 'gcx, 'tcx> { } /// Tuples make it easy to build up state. diff --git a/src/librustc/infer/canonical/mod.rs b/src/librustc/infer/canonical/mod.rs index 1d630d10a3cb8..c1d070f53af03 100644 --- a/src/librustc/infer/canonical/mod.rs +++ b/src/librustc/infer/canonical/mod.rs @@ -478,7 +478,7 @@ impl<'tcx> CanonicalVarValues<'tcx> { /// `self.var_values == [Type(u32), Lifetime('a), Type(u64)]` /// we'll return a substitution `subst` with: /// `subst.var_values == [Type(^0), Lifetime(^1), Type(^2)]`. - pub fn make_identity<'a>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Self { + pub fn make_identity(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Self { use crate::ty::subst::UnpackedKind; CanonicalVarValues { diff --git a/src/librustc/infer/error_reporting/mod.rs b/src/librustc/infer/error_reporting/mod.rs index 415490488510a..137cae149d6e5 100644 --- a/src/librustc/infer/error_reporting/mod.rs +++ b/src/librustc/infer/error_reporting/mod.rs @@ -67,7 +67,7 @@ mod need_type_info; pub mod nice_region_error; -impl<'a, 'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { pub fn note_and_explain_region( self, region_scope_tree: ®ion::ScopeTree, diff --git a/src/librustc/infer/mod.rs b/src/librustc/infer/mod.rs index 8c2ca633497ed..5b04e6d1f0a84 100644 --- a/src/librustc/infer/mod.rs +++ b/src/librustc/infer/mod.rs @@ -1624,7 +1624,7 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for ShallowResolver<'a, 'gcx, 'tcx> } } -impl<'a, 'gcx, 'tcx> TypeTrace<'tcx> { +impl<'gcx, 'tcx> TypeTrace<'tcx> { pub fn span(&self) -> Span { self.cause.span } diff --git a/src/librustc/infer/outlives/free_region_map.rs b/src/librustc/infer/outlives/free_region_map.rs index 308c510d0eabb..cf7765c8f12f9 100644 --- a/src/librustc/infer/outlives/free_region_map.rs +++ b/src/librustc/infer/outlives/free_region_map.rs @@ -28,7 +28,7 @@ impl<'tcx> FreeRegionMap<'tcx> { /// cases, this is more conservative than necessary, in order to /// avoid making arbitrary choices. See /// `TransitiveRelation::postdom_upper_bound` for more details. - pub fn lub_free_regions<'a, 'gcx>(&self, + pub fn lub_free_regions<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, r_a: Region<'tcx>, r_b: Region<'tcx>) @@ -90,7 +90,7 @@ impl_stable_hash_for!(struct FreeRegionMap<'tcx> { impl<'a, 'tcx> Lift<'tcx> for FreeRegionMap<'a> { type Lifted = FreeRegionMap<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option> { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option> { self.relation.maybe_map(|&fr| tcx.lift(&fr)) .map(|relation| FreeRegionMap { relation }) } diff --git a/src/librustc/infer/region_constraints/mod.rs b/src/librustc/infer/region_constraints/mod.rs index f63860f539014..ff186718f99b7 100644 --- a/src/librustc/infer/region_constraints/mod.rs +++ b/src/librustc/infer/region_constraints/mod.rs @@ -849,7 +849,7 @@ impl<'tcx> fmt::Display for GenericKind<'tcx> { } } -impl<'a, 'gcx, 'tcx> GenericKind<'tcx> { +impl<'gcx, 'tcx> GenericKind<'tcx> { pub fn to_ty(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx> { match *self { GenericKind::Param(ref p) => p.to_ty(tcx), diff --git a/src/librustc/infer/unify_key.rs b/src/librustc/infer/unify_key.rs index 4d9c236598acc..6a46ed50679ef 100644 --- a/src/librustc/infer/unify_key.rs +++ b/src/librustc/infer/unify_key.rs @@ -10,7 +10,7 @@ use std::marker::PhantomData; use std::cell::RefMut; pub trait ToType { - fn to_type<'a, 'gcx, 'tcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx>; + fn to_type<'gcx, 'tcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx>; } impl UnifyKey for ty::IntVid { @@ -52,7 +52,7 @@ impl UnifyKey for ty::RegionVid { } impl ToType for IntVarValue { - fn to_type<'a, 'gcx, 'tcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx> { + fn to_type<'gcx, 'tcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx> { match *self { ty::IntType(i) => tcx.mk_mach_int(i), ty::UintType(i) => tcx.mk_mach_uint(i), @@ -72,7 +72,7 @@ impl UnifyKey for ty::FloatVid { impl EqUnifyValue for FloatVarValue {} impl ToType for FloatVarValue { - fn to_type<'a, 'gcx, 'tcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx> { + fn to_type<'gcx, 'tcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx> { tcx.mk_mach_float(self.0) } } diff --git a/src/librustc/lint/mod.rs b/src/librustc/lint/mod.rs index 676b9d81162a0..6311639d67765 100644 --- a/src/librustc/lint/mod.rs +++ b/src/librustc/lint/mod.rs @@ -766,7 +766,7 @@ pub fn maybe_lint_level_root(tcx: TyCtxt<'_, '_, '_>, id: hir::HirId) -> bool { attrs.iter().any(|attr| Level::from_symbol(attr.name_or_empty()).is_some()) } -fn lint_levels<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, cnum: CrateNum) +fn lint_levels<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, cnum: CrateNum) -> &'tcx LintLevelMap { assert_eq!(cnum, LOCAL_CRATE); diff --git a/src/librustc/macros.rs b/src/librustc/macros.rs index d2ea26c9686fe..38e453191a363 100644 --- a/src/librustc/macros.rs +++ b/src/librustc/macros.rs @@ -264,7 +264,7 @@ macro_rules! BraceStructLiftImpl { { type Lifted = $lifted; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option<$lifted> { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option<$lifted> { $(let $field = tcx.lift(&self.$field)?;)* Some(Self::Lifted { $($field),* }) } @@ -283,7 +283,7 @@ macro_rules! EnumLiftImpl { { type Lifted = $lifted; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option<$lifted> { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option<$lifted> { EnumLiftImpl!(@Variants(self, tcx) input($($variants)*) output()) } } diff --git a/src/librustc/middle/cstore.rs b/src/librustc/middle/cstore.rs index b83bc2365ec96..16fed08e0d0e6 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; // utility functions - fn encode_metadata<'a, 'tcx>(&self, + fn encode_metadata<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> EncodedMetadata; fn metadata_encoding_version(&self) -> &[u8]; diff --git a/src/librustc/middle/dead.rs b/src/librustc/middle/dead.rs index 3343aa9169147..ca23722da320e 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<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn should_explore<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, hir_id: hir::HirId) -> bool { match tcx.hir().find_by_hir_id(hir_id) { Some(Node::Item(..)) | @@ -423,7 +423,7 @@ impl<'v, 'k, 'tcx> ItemLikeVisitor<'v> for LifeSeeder<'k, 'tcx> { } } -fn create_and_seed_worklist<'a, 'tcx>( +fn create_and_seed_worklist<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, access_levels: &privacy::AccessLevels, krate: &hir::Crate, @@ -451,7 +451,7 @@ fn create_and_seed_worklist<'a, 'tcx>( (life_seeder.worklist, life_seeder.struct_constructors) } -fn find_live<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn find_live<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, access_levels: &privacy::AccessLevels, krate: &hir::Crate) -> FxHashSet { @@ -660,7 +660,7 @@ impl Visitor<'tcx> for DeadVisitor<'tcx> { } } -pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn check_crate<'tcx>(tcx: TyCtxt<'tcx, 'tcx, '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 684bbe443a743..c5ab8f79baa58 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<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn calculate<'tcx>(tcx: TyCtxt<'tcx, 'tcx, '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<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { sess.dependency_formats.set(fmts); } -fn calculate_type<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn calculate_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ty: config::CrateType) -> DependencyList { let sess = &tcx.sess; @@ -267,7 +267,7 @@ fn add_library(tcx: TyCtxt<'_, '_, '_>, } } -fn attempt_static<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Option { +fn attempt_static<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Option { 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, // 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<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, list: &[Linkage]) { +fn verify_ok<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, list: &[Linkage]) { let sess = &tcx.sess; if list.len() == 0 { return diff --git a/src/librustc/middle/intrinsicck.rs b/src/librustc/middle/intrinsicck.rs index 1fc1f889f5b14..ba890e6277089 100644 --- a/src/librustc/middle/intrinsicck.rs +++ b/src/librustc/middle/intrinsicck.rs @@ -36,7 +36,7 @@ struct ExprVisitor<'tcx> { /// If the type is `Option`, it will return `T`, otherwise /// the type itself. Works on most `Option`-like types. -fn unpack_option_like<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn unpack_option_like<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ty: Ty<'tcx>) -> Ty<'tcx> { let (def, substs) = match ty.sty { diff --git a/src/librustc/middle/lang_items.rs b/src/librustc/middle/lang_items.rs index b8b1a8443027c..c70179b5818c6 100644 --- a/src/librustc/middle/lang_items.rs +++ b/src/librustc/middle/lang_items.rs @@ -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<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> LanguageItems { +pub fn collect<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> LanguageItems { // Initialize the collector. let mut collector = LanguageItemCollector::new(tcx); @@ -402,7 +402,7 @@ language_item_table! { Rc, "rc", rc, Target::Struct; } -impl<'a, 'tcx, 'gcx> TyCtxt<'gcx, 'tcx, 'gcx> { +impl<'tcx, 'gcx> TyCtxt<'gcx, 'tcx, 'gcx> { /// 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 4066fe001ffb4..a6f305d73898f 100644 --- a/src/librustc/middle/lib_features.rs +++ b/src/librustc/middle/lib_features.rs @@ -142,7 +142,7 @@ impl Visitor<'tcx> for LibFeatureCollector<'tcx> { } } -pub fn collect<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> LibFeatures { +pub fn collect<'tcx>(tcx: TyCtxt<'tcx, 'tcx, '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 8d82e2fbca59d..3a8afed724c1b 100644 --- a/src/librustc/middle/liveness.rs +++ b/src/librustc/middle/liveness.rs @@ -166,7 +166,7 @@ fn live_node_kind_to_string(lnk: LiveNodeKind, tcx: TyCtxt<'_, '_, '_>) -> Strin } } -impl<'a, 'tcx> Visitor<'tcx> for IrMaps<'tcx> { +impl<'tcx> Visitor<'tcx> for IrMaps<'tcx> { fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> { NestedVisitorMap::OnlyBodies(&self.tcx.hir()) } @@ -411,7 +411,7 @@ fn visit_fn<'a, 'tcx: 'a>(ir: &mut IrMaps<'tcx>, lsets.warn_about_unused_args(body, entry_ln); } -fn add_from_pat<'a, 'tcx>(ir: &mut IrMaps<'tcx>, pat: &P) { +fn add_from_pat<'tcx>(ir: &mut IrMaps<'tcx>, pat: &P) { // For struct patterns, take note of which fields used shorthand // (`x` rather than `x: x`). let mut shorthand_field_ids = HirIdSet::default(); @@ -457,19 +457,19 @@ fn add_from_pat<'a, 'tcx>(ir: &mut IrMaps<'tcx>, pat: &P) { }); } -fn visit_local<'a, 'tcx>(ir: &mut IrMaps<'tcx>, local: &'tcx hir::Local) { +fn visit_local<'tcx>(ir: &mut IrMaps<'tcx>, local: &'tcx hir::Local) { add_from_pat(ir, &local.pat); intravisit::walk_local(ir, local); } -fn visit_arm<'a, 'tcx>(ir: &mut IrMaps<'tcx>, arm: &'tcx hir::Arm) { +fn visit_arm<'tcx>(ir: &mut IrMaps<'tcx>, arm: &'tcx hir::Arm) { for pat in &arm.pats { add_from_pat(ir, pat); } intravisit::walk_arm(ir, arm); } -fn visit_expr<'a, 'tcx>(ir: &mut IrMaps<'tcx>, expr: &'tcx Expr) { +fn visit_expr<'tcx>(ir: &mut IrMaps<'tcx>, expr: &'tcx Expr) { match expr.node { // live nodes required for uses or definitions of variables: hir::ExprKind::Path(hir::QPath::Resolved(_, ref path)) => { diff --git a/src/librustc/middle/reachable.rs b/src/librustc/middle/reachable.rs index 4be7b699932ab..1488b61dddc08 100644 --- a/src/librustc/middle/reachable.rs +++ b/src/librustc/middle/reachable.rs @@ -44,7 +44,7 @@ fn item_might_be_inlined(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } } -fn method_might_be_inlined<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn method_might_be_inlined<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_item: &hir::ImplItem, impl_src: DefId) -> bool { let codegen_fn_attrs = tcx.codegen_fn_attrs(impl_item.hir_id.owner_def_id()); @@ -391,7 +391,7 @@ impl<'a, 'tcx: 'a> ItemLikeVisitor<'tcx> for CollectPrivateImplItemsVisitor<'a, #[derive(Clone, HashStable)] pub struct ReachableSet(pub Lrc); -fn reachable_set<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, crate_num: CrateNum) -> ReachableSet { +fn reachable_set<'tcx>(tcx: TyCtxt<'tcx, 'tcx, '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 3c2bb07ae12c7..c7c838e431556 100644 --- a/src/librustc/middle/region.rs +++ b/src/librustc/middle/region.rs @@ -646,7 +646,7 @@ 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<'a, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + pub fn early_free_scope<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, br: &ty::EarlyBoundRegion) -> Scope { let param_owner = tcx.parent(br.def_id).unwrap(); @@ -677,7 +677,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<'a, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, fr: &ty::FreeRegion) + pub fn free_scope<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, fr: &ty::FreeRegion) -> Scope { let param_owner = match fr.bound_region { ty::BoundRegion::BrNamed(def_id, _) => { @@ -748,7 +748,7 @@ fn record_var_lifetime(visitor: &mut RegionResolutionVisitor<'_>, } } -fn resolve_block<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, blk: &'tcx hir::Block) { +fn resolve_block<'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, blk: &'tcx hir::Block) { debug!("resolve_block(blk.hir_id={:?})", blk.hir_id); let prev_cx = visitor.cx; @@ -816,7 +816,7 @@ fn resolve_block<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, blk: &'t visitor.cx = prev_cx; } -fn resolve_arm<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, arm: &'tcx hir::Arm) { +fn resolve_arm<'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, arm: &'tcx hir::Arm) { let prev_cx = visitor.cx; visitor.enter_scope( @@ -838,7 +838,7 @@ fn resolve_arm<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, arm: &'tcx visitor.cx = prev_cx; } -fn resolve_pat<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, pat: &'tcx hir::Pat) { +fn resolve_pat<'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, pat: &'tcx hir::Pat) { visitor.record_child_scope(Scope { id: pat.hir_id.local_id, data: ScopeData::Node }); // If this is a binding then record the lifetime of that binding. @@ -855,7 +855,7 @@ fn resolve_pat<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, pat: &'tcx debug!("resolve_pat - post-increment {} pat = {:?}", visitor.expr_and_pat_count, pat); } -fn resolve_stmt<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, stmt: &'tcx hir::Stmt) { +fn resolve_stmt<'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, stmt: &'tcx hir::Stmt) { let stmt_id = stmt.hir_id.local_id; debug!("resolve_stmt(stmt.id={:?})", stmt_id); @@ -874,7 +874,7 @@ fn resolve_stmt<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, stmt: &'t visitor.cx.parent = prev_parent; } -fn resolve_expr<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, expr: &'tcx hir::Expr) { +fn resolve_expr<'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, expr: &'tcx hir::Expr) { debug!("resolve_expr - pre-increment {} expr = {:?}", visitor.expr_and_pat_count, expr); let prev_cx = visitor.cx; @@ -977,7 +977,7 @@ fn resolve_expr<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, expr: &'t visitor.cx = prev_cx; } -fn resolve_local<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, +fn resolve_local<'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, pat: Option<&'tcx hir::Pat>, init: Option<&'tcx hir::Expr>) { debug!("resolve_local(pat={:?}, init={:?})", pat, init); @@ -1127,7 +1127,7 @@ fn resolve_local<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, /// | box E& /// | E& as ... /// | ( E& ) - fn record_rvalue_scope_if_borrow_expr<'a, 'tcx>( + fn record_rvalue_scope_if_borrow_expr<'tcx>( visitor: &mut RegionResolutionVisitor<'tcx>, expr: &hir::Expr, blk_id: Option) @@ -1178,7 +1178,7 @@ fn resolve_local<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, /// | /// /// Note: ET is intended to match "rvalues or places based on rvalues". - fn record_rvalue_scope<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, + fn record_rvalue_scope<'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, expr: &hir::Expr, blk_scope: Option) { let mut expr = expr; @@ -1205,7 +1205,7 @@ fn resolve_local<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, } } -impl<'a, 'tcx> RegionResolutionVisitor<'tcx> { +impl<'tcx> RegionResolutionVisitor<'tcx> { /// Records the current parent (if any) as the parent of `child_scope`. /// Returns the depth of `child_scope`. fn record_child_scope(&mut self, child_scope: Scope) -> ScopeDepth { @@ -1235,7 +1235,7 @@ impl<'a, 'tcx> RegionResolutionVisitor<'tcx> { } } -impl<'a, 'tcx> Visitor<'tcx> for RegionResolutionVisitor<'tcx> { +impl<'tcx> Visitor<'tcx> for RegionResolutionVisitor<'tcx> { fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> { NestedVisitorMap::None } @@ -1327,7 +1327,7 @@ impl<'a, 'tcx> Visitor<'tcx> for RegionResolutionVisitor<'tcx> { } } -fn region_scope_tree<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) +fn region_scope_tree<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ScopeTree { let closure_base_def_id = tcx.closure_base_def_id(def_id); diff --git a/src/librustc/middle/stability.rs b/src/librustc/middle/stability.rs index 45be13a756ba8..b812ef504eeac 100644 --- a/src/librustc/middle/stability.rs +++ b/src/librustc/middle/stability.rs @@ -389,7 +389,7 @@ impl<'a, 'tcx> Visitor<'tcx> for MissingStabilityAnnotations<'a, 'tcx> { } } -impl<'a, 'tcx> Index<'tcx> { +impl<'tcx> Index<'tcx> { pub fn new(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Index<'tcx> { let is_staged_api = tcx.sess.opts.debugging_opts.force_unstable_if_unmarked || @@ -521,7 +521,7 @@ pub enum EvalResult { Unmarked, } -impl<'a, 'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, '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<'a, 'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { pub fn lookup_deprecation(self, id: DefId) -> Option { self.lookup_deprecation_entry(id).map(|depr| depr.attr) } @@ -836,7 +836,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'tcx, '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<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn check_unused_or_stable_features<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { let access_levels = &tcx.privacy_access_levels(LOCAL_CRATE); if tcx.stability().staged_api[&LOCAL_CRATE] { @@ -920,7 +920,7 @@ pub fn check_unused_or_stable_features<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) // don't lint about unused features. We should reenable this one day! } -fn unnecessary_stable_feature_lint<'a, 'tcx>( +fn unnecessary_stable_feature_lint<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, span: Span, feature: Symbol, diff --git a/src/librustc/middle/weak_lang_items.rs b/src/librustc/middle/weak_lang_items.rs index 2d2213672b64b..d7c340c4040ac 100644 --- a/src/librustc/middle/weak_lang_items.rs +++ b/src/librustc/middle/weak_lang_items.rs @@ -24,7 +24,7 @@ struct Context<'a, 'tcx: 'a> { /// 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<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn check_crate<'tcx>(tcx: TyCtxt<'tcx, 'tcx, '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 @@ -72,7 +72,7 @@ pub fn whitelisted(tcx: TyCtxt<'_, '_, '_>, lang_item: lang_items::LangItem) -> false } -fn verify<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn verify<'tcx>(tcx: TyCtxt<'tcx, 'tcx, '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<'a, 'tcx, 'gcx> TyCtxt<'gcx, 'tcx, 'gcx> { +impl<'tcx, 'gcx> TyCtxt<'gcx, 'tcx, 'gcx> { pub fn is_weak_lang_item(&self, item_def_id: DefId) -> bool { let lang_items = self.lang_items(); let did = Some(item_def_id); diff --git a/src/librustc/mir/interpret/error.rs b/src/librustc/mir/interpret/error.rs index 7024129c9d6f0..35ac2ccb28922 100644 --- a/src/librustc/mir/interpret/error.rs +++ b/src/librustc/mir/interpret/error.rs @@ -74,7 +74,7 @@ impl<'tcx> fmt::Display for FrameInfo<'tcx> { } } -impl<'a, 'gcx, 'tcx> ConstEvalErr<'tcx> { +impl<'gcx, 'tcx> ConstEvalErr<'tcx> { pub fn struct_error(&self, tcx: TyCtxtAt<'gcx, 'tcx>, message: &str) @@ -172,7 +172,7 @@ impl<'a, 'gcx, 'tcx> ConstEvalErr<'tcx> { } } -pub fn struct_error<'a, 'gcx, 'tcx>( +pub fn struct_error<'gcx, 'tcx>( tcx: TyCtxtAt<'gcx, 'tcx>, msg: &str, ) -> DiagnosticBuilder<'tcx> { diff --git a/src/librustc/mir/interpret/mod.rs b/src/librustc/mir/interpret/mod.rs index 3e8bbbcb5c2f0..48d5f0d0f4931 100644 --- a/src/librustc/mir/interpret/mod.rs +++ b/src/librustc/mir/interpret/mod.rs @@ -64,10 +64,7 @@ enum AllocDiscriminant { Static, } -pub fn specialized_encode_alloc_id< - 'a, 'tcx, - E: Encoder, ->( +pub fn specialized_encode_alloc_id<'tcx, E: Encoder>( encoder: &mut E, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, alloc_id: AllocId, @@ -147,7 +144,7 @@ pub struct AllocDecodingSession<'s> { impl<'s> AllocDecodingSession<'s> { // Decodes an AllocId in a thread-safe way. - pub fn decode_alloc_id<'a, 'tcx, D>(&self, + pub fn decode_alloc_id<'tcx, D>(&self, decoder: &mut D) -> Result where D: TyDecoder<'tcx>, diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs index 7753c64d7e338..46e8468847e96 100644 --- a/src/librustc/mir/mod.rs +++ b/src/librustc/mir/mod.rs @@ -1240,7 +1240,7 @@ impl<'tcx> Terminator<'tcx> { } impl<'tcx> TerminatorKind<'tcx> { - pub fn if_<'a, 'gcx>( + pub fn if_<'gcx>( tcx: TyCtxt<'tcx, 'gcx, 'tcx>, cond: Operand<'tcx>, t: BasicBlock, @@ -2323,7 +2323,7 @@ impl<'tcx> Operand<'tcx> { /// Convenience helper to make a constant that refers to the fn /// with given `DefId` and substs. Since this is used to synthesize /// MIR, assumes `user_ty` is None. - pub fn function_handle<'a>( + pub fn function_handle( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, substs: SubstsRef<'tcx>, diff --git a/src/librustc/mir/mono.rs b/src/librustc/mir/mono.rs index 60598d1e7673a..cc169aa30ccf8 100644 --- a/src/librustc/mir/mono.rs +++ b/src/librustc/mir/mono.rs @@ -48,7 +48,7 @@ pub enum MonoItem<'tcx> { } impl<'tcx> MonoItem<'tcx> { - pub fn size_estimate<'a>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> usize { + pub fn size_estimate(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> usize { match *self { MonoItem::Fn(instance) => { // Estimate the size of a function based on how many statements @@ -195,7 +195,7 @@ impl<'tcx> MonoItem<'tcx> { } }; - fn to_string_internal<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + fn to_string_internal<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, prefix: &str, instance: Instance<'tcx>, debug: bool) @@ -334,7 +334,7 @@ impl<'tcx> CodegenUnit<'tcx> { base_n::encode(hash, base_n::CASE_INSENSITIVE) } - pub fn estimate_size<'a>(&mut self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { + pub fn estimate_size(&mut self, tcx: TyCtxt<'tcx, '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()); @@ -369,7 +369,7 @@ impl<'tcx> CodegenUnit<'tcx> { }) } - pub fn items_in_deterministic_order<'a>(&self, + pub fn items_in_deterministic_order(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Vec<(MonoItem<'tcx>, (Linkage, Visibility))> { @@ -378,7 +378,7 @@ impl<'tcx> CodegenUnit<'tcx> { #[derive(PartialEq, Eq, PartialOrd, Ord)] pub struct ItemSortKey(Option, SymbolName); - fn item_sort_key<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + fn item_sort_key<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item: MonoItem<'tcx>) -> ItemSortKey { ItemSortKey(match item { MonoItem::Fn(ref instance) => { diff --git a/src/librustc/mir/tcx.rs b/src/librustc/mir/tcx.rs index 30676bb6044f1..696bec3e0a2ba 100644 --- a/src/librustc/mir/tcx.rs +++ b/src/librustc/mir/tcx.rs @@ -21,7 +21,7 @@ pub struct PlaceTy<'tcx> { #[cfg(target_arch = "x86_64")] static_assert_size!(PlaceTy<'_>, 16); -impl<'a, 'gcx, 'tcx> PlaceTy<'tcx> { +impl<'gcx, 'tcx> PlaceTy<'tcx> { pub fn from_ty(ty: Ty<'tcx>) -> PlaceTy<'tcx> { PlaceTy { ty, variant_index: None } } @@ -121,7 +121,7 @@ BraceStructTypeFoldableImpl! { } impl<'tcx> Place<'tcx> { - pub fn ty<'a, 'gcx, D>(&self, local_decls: &D, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> PlaceTy<'tcx> + pub fn ty<'gcx, D>(&self, local_decls: &D, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> PlaceTy<'tcx> where D: HasLocalDecls<'tcx> { match *self { @@ -141,7 +141,7 @@ pub enum RvalueInitializationState { } impl<'tcx> Rvalue<'tcx> { - pub fn ty<'a, 'gcx, D>(&self, local_decls: &D, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx> + pub fn ty<'gcx, D>(&self, local_decls: &D, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx> where D: HasLocalDecls<'tcx> { match *self { @@ -222,7 +222,7 @@ impl<'tcx> Rvalue<'tcx> { } impl<'tcx> Operand<'tcx> { - pub fn ty<'a, 'gcx, D>(&self, local_decls: &D, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx> + pub fn ty<'gcx, D>(&self, local_decls: &D, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx> where D: HasLocalDecls<'tcx> { match self { @@ -234,7 +234,7 @@ impl<'tcx> Operand<'tcx> { } impl<'tcx> BinOp { - pub fn ty<'a, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + pub fn ty<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, lhs_ty: Ty<'tcx>, rhs_ty: Ty<'tcx>) -> Ty<'tcx> { diff --git a/src/librustc/traits/codegen/mod.rs b/src/librustc/traits/codegen/mod.rs index d576c13844d1e..cc10107f682d5 100644 --- a/src/librustc/traits/codegen/mod.rs +++ b/src/librustc/traits/codegen/mod.rs @@ -18,7 +18,7 @@ use crate::ty::fold::TypeFoldable; /// that type check should guarantee to us that all nested /// obligations *could be* resolved if we wanted to. /// Assumes that this is run after the entire crate has been successfully type-checked. -pub fn codegen_fulfill_obligation<'a, 'tcx>(ty: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn codegen_fulfill_obligation<'tcx>(ty: TyCtxt<'tcx, 'tcx, 'tcx>, (param_env, trait_ref): (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>)) -> Vtable<'tcx, ()> @@ -74,7 +74,7 @@ pub fn codegen_fulfill_obligation<'a, 'tcx>(ty: TyCtxt<'tcx, 'tcx, 'tcx>, }) } -impl<'a, 'tcx> TyCtxt<'tcx, 'tcx, 'tcx> { +impl<'tcx> TyCtxt<'tcx, 'tcx, 'tcx> { /// Monomorphizes a type from the AST by first applying the /// in-scope substitutions and then normalizing any associated /// types. diff --git a/src/librustc/traits/coherence.rs b/src/librustc/traits/coherence.rs index db9e7fc4b6d9b..763c752ab301f 100644 --- a/src/librustc/traits/coherence.rs +++ b/src/librustc/traits/coherence.rs @@ -183,7 +183,7 @@ fn overlap_within_probe( Some(OverlapResult { impl_header, intercrate_ambiguity_causes, involves_placeholder }) } -pub fn trait_ref_is_knowable<'a, 'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, +pub fn trait_ref_is_knowable<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, trait_ref: ty::TraitRef<'tcx>) -> Option { @@ -229,7 +229,7 @@ pub fn trait_ref_is_knowable<'a, 'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, } } -pub fn trait_ref_is_local_or_fundamental<'a, 'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, +pub fn trait_ref_is_local_or_fundamental<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, trait_ref: ty::TraitRef<'tcx>) -> bool { trait_ref.def_id.krate == LOCAL_CRATE || tcx.has_attr(trait_ref.def_id, sym::fundamental) @@ -246,7 +246,7 @@ pub enum OrphanCheckErr<'tcx> { /// /// 1. All type parameters in `Self` must be "covered" by some local type constructor. /// 2. Some local type must appear in `Self`. -pub fn orphan_check<'a, 'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, +pub fn orphan_check<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, impl_def_id: DefId) -> Result<(), OrphanCheckErr<'tcx>> { diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs index 5b3e0dde0cc72..5ed627ccee4bd 100644 --- a/src/librustc/traits/error_reporting.rs +++ b/src/librustc/traits/error_reporting.rs @@ -1249,7 +1249,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { found: ty::PolyTraitRef<'tcx>) -> DiagnosticBuilder<'tcx> { - fn build_fn_sig_string<'a, 'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + fn build_fn_sig_string<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, trait_ref: &ty::TraitRef<'tcx>) -> String { let inputs = trait_ref.substs.type_at(1); let sig = if let ty::Tuple(inputs) = inputs.sty { @@ -1294,7 +1294,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { } } -impl<'a, 'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { pub fn recursive_type_with_infinite_size_error(self, type_def_id: DefId) -> DiagnosticBuilder<'tcx> diff --git a/src/librustc/traits/mod.rs b/src/librustc/traits/mod.rs index 774150ce7ad33..e6bab57584f43 100644 --- a/src/librustc/traits/mod.rs +++ b/src/librustc/traits/mod.rs @@ -140,7 +140,7 @@ pub struct ObligationCause<'tcx> { } impl<'tcx> ObligationCause<'tcx> { - pub fn span<'a, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Span { + pub fn span<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Span { match self.code { ObligationCauseCode::CompareImplMethodObligation { .. } | ObligationCauseCode::MainFunctionType | @@ -363,7 +363,7 @@ impl<'tcx> DomainGoal<'tcx> { } impl<'tcx> GoalKind<'tcx> { - pub fn from_poly_domain_goal<'a, 'gcx>( + pub fn from_poly_domain_goal<'gcx>( domain_goal: PolyDomainGoal<'tcx>, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, ) -> GoalKind<'tcx> { @@ -710,7 +710,7 @@ pub fn type_known_to_meet_bound_modulo_regions<'a, 'gcx, 'tcx>( } } -fn do_normalize_predicates<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn do_normalize_predicates<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, region_context: DefId, cause: ObligationCause<'tcx>, elaborated_env: ty::ParamEnv<'tcx>, @@ -795,7 +795,7 @@ fn do_normalize_predicates<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, // FIXME: this is gonna need to be removed ... /// Normalizes the parameter environment, reporting errors if they occur. -pub fn normalize_param_env_or_error<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn normalize_param_env_or_error<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, region_context: DefId, unnormalized_env: ty::ParamEnv<'tcx>, cause: ObligationCause<'tcx>) @@ -936,7 +936,7 @@ pub fn fully_normalize<'a, 'gcx, 'tcx, T>( /// environment. If this returns false, then either normalize /// encountered an error or one of the predicates did not hold. Used /// when creating vtables to check for unsatisfiable methods. -fn normalize_and_test_predicates<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn normalize_and_test_predicates<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, predicates: Vec>) -> bool { @@ -965,7 +965,7 @@ fn normalize_and_test_predicates<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, result } -fn substitute_normalize_and_test_predicates<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn substitute_normalize_and_test_predicates<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, key: (DefId, SubstsRef<'tcx>)) -> bool { @@ -983,7 +983,7 @@ fn substitute_normalize_and_test_predicates<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 't /// Given a trait `trait_ref`, iterates the vtable entries /// that come from `trait_ref`, including its supertraits. #[inline] // FIXME(#35870): avoid closures being unexported due to `impl Trait`. -fn vtable_methods<'a, 'tcx>( +fn vtable_methods<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, trait_ref: ty::PolyTraitRef<'tcx>) -> &'tcx [Option<(DefId, SubstsRef<'tcx>)>] @@ -1205,17 +1205,17 @@ where type LiftedDelayedLiteral: Debug + 'tcx; type LiftedLiteral: Debug + 'tcx; - fn lift_ex_clause_to_tcx<'a, 'gcx>( + fn lift_ex_clause_to_tcx<'gcx>( ex_clause: &chalk_engine::ExClause, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, ) -> Option; - fn lift_delayed_literal_to_tcx<'a, 'gcx>( + fn lift_delayed_literal_to_tcx<'gcx>( ex_clause: &chalk_engine::DelayedLiteral, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, ) -> Option; - fn lift_literal_to_tcx<'a, 'gcx>( + fn lift_literal_to_tcx<'gcx>( ex_clause: &chalk_engine::Literal, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, ) -> Option; diff --git a/src/librustc/traits/object_safety.rs b/src/librustc/traits/object_safety.rs index 9e8cb58e6ea77..6923d1c0230d7 100644 --- a/src/librustc/traits/object_safety.rs +++ b/src/librustc/traits/object_safety.rs @@ -83,7 +83,7 @@ pub enum MethodViolationCode { UndispatchableReceiver, } -impl<'a, 'tcx> TyCtxt<'tcx, 'tcx, 'tcx> { +impl<'tcx> TyCtxt<'tcx, 'tcx, 'tcx> { /// Returns the object safety violations that affect /// astconv -- currently, `Self` in supertraits. This is needed @@ -703,7 +703,7 @@ impl<'a, 'tcx> TyCtxt<'tcx, 'tcx, 'tcx> { } } -pub(super) fn is_object_safe_provider<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub(super) fn is_object_safe_provider<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, trait_def_id: DefId) -> bool { tcx.object_safety_violations(trait_def_id).is_empty() } diff --git a/src/librustc/traits/on_unimplemented.rs b/src/librustc/traits/on_unimplemented.rs index 5ddc3e8fe5103..e01e5b8b0b903 100644 --- a/src/librustc/traits/on_unimplemented.rs +++ b/src/librustc/traits/on_unimplemented.rs @@ -51,7 +51,7 @@ fn parse_error(tcx: TyCtxt<'_, '_, '_>, span: Span, ErrorReported } -impl<'a, 'gcx, 'tcx> OnUnimplementedDirective { +impl<'gcx, 'tcx> OnUnimplementedDirective { fn parse(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, trait_def_id: DefId, items: &[NestedMetaItem], @@ -214,7 +214,7 @@ impl<'a, 'gcx, 'tcx> OnUnimplementedDirective { } } -impl<'a, 'gcx, 'tcx> OnUnimplementedFormatString { +impl<'gcx, 'tcx> OnUnimplementedFormatString { fn try_parse(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, trait_def_id: DefId, from: LocalInternedString, diff --git a/src/librustc/traits/project.rs b/src/librustc/traits/project.rs index 6f52aaa020532..45cc8b255aa43 100644 --- a/src/librustc/traits/project.rs +++ b/src/librustc/traits/project.rs @@ -836,7 +836,7 @@ struct Progress<'tcx> { } impl<'tcx> Progress<'tcx> { - fn error<'a,'gcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Self { + fn error<'gcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Self { Progress { ty: tcx.types.err, obligations: vec![], diff --git a/src/librustc/traits/query/normalize_erasing_regions.rs b/src/librustc/traits/query/normalize_erasing_regions.rs index 6c8f0d779290d..bab6fd542deb0 100644 --- a/src/librustc/traits/query/normalize_erasing_regions.rs +++ b/src/librustc/traits/query/normalize_erasing_regions.rs @@ -10,7 +10,7 @@ use crate::ty::{self, Ty, TyCtxt}; use crate::ty::fold::{TypeFoldable, TypeFolder}; -impl<'cx, 'tcx> TyCtxt<'tcx, 'tcx, 'tcx> { +impl<'tcx> TyCtxt<'tcx, 'tcx, 'tcx> { /// Erase the regions in `value` and then fully normalize all the /// types found within. The result will also have regions erased. /// diff --git a/src/librustc/traits/select.rs b/src/librustc/traits/select.rs index 4643e2498fc99..30270c72d1bd6 100644 --- a/src/librustc/traits/select.rs +++ b/src/librustc/traits/select.rs @@ -300,7 +300,7 @@ enum SelectionCandidate<'tcx> { impl<'a, 'tcx> ty::Lift<'tcx> for SelectionCandidate<'a> { type Lifted = SelectionCandidate<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { Some(match *self { BuiltinCandidate { has_nested } => BuiltinCandidate { has_nested }, ImplCandidate(def_id) => ImplCandidate(def_id), diff --git a/src/librustc/traits/specialize/mod.rs b/src/librustc/traits/specialize/mod.rs index 8043bca8e09a3..6acee698c8e76 100644 --- a/src/librustc/traits/specialize/mod.rs +++ b/src/librustc/traits/specialize/mod.rs @@ -109,7 +109,7 @@ pub fn translate_substs<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>, /// the kind `kind`, and trait method substitutions `substs`, in /// that impl, a less specialized impl, or the trait default, /// whichever applies. -pub fn find_associated_item<'a, 'tcx>( +pub fn find_associated_item<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, item: &ty::AssocItem, @@ -149,7 +149,7 @@ pub fn find_associated_item<'a, 'tcx>( /// Specialization is determined by the sets of types to which the impls apply; /// `impl1` specializes `impl2` if it applies to a subset of the types `impl2` applies /// to. -pub(super) fn specializes<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub(super) fn specializes<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, (impl1_def_id, impl2_def_id): (DefId, DefId)) -> bool { @@ -285,7 +285,7 @@ fn fulfill_implication<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>, } // Query provider for `specialization_graph_of`. -pub(super) fn specialization_graph_provider<'a, 'tcx>( +pub(super) fn specialization_graph_provider<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, trait_id: DefId, ) -> &'tcx specialization_graph::Graph { diff --git a/src/librustc/traits/specialize/specialization_graph.rs b/src/librustc/traits/specialize/specialization_graph.rs index 8b386f3c0a0f5..6650cda435d5a 100644 --- a/src/librustc/traits/specialize/specialization_graph.rs +++ b/src/librustc/traits/specialize/specialization_graph.rs @@ -81,7 +81,7 @@ enum Inserted { ShouldRecurseOn(DefId), } -impl<'a, 'gcx, 'tcx> Children { +impl<'gcx, 'tcx> Children { /// Insert an impl into this set of children without comparing to any existing impls. fn insert_blindly(&mut self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, @@ -282,7 +282,7 @@ impl Iterator for PotentialSiblings } } -impl<'a, 'gcx, 'tcx> Graph { +impl<'gcx, 'tcx> Graph { pub fn new() -> Graph { Graph { parent: Default::default(), @@ -414,7 +414,7 @@ pub enum Node { Trait(DefId), } -impl<'a, 'gcx, 'tcx> Node { +impl<'gcx, 'tcx> Node { pub fn is_from_trait(&self) -> bool { match *self { Node::Trait(..) => true, diff --git a/src/librustc/traits/structural_impls.rs b/src/librustc/traits/structural_impls.rs index 1591cad9ae51a..f5853b69e8b7b 100644 --- a/src/librustc/traits/structural_impls.rs +++ b/src/librustc/traits/structural_impls.rs @@ -446,7 +446,7 @@ impl<'tcx> fmt::Display for traits::Clause<'tcx> { impl<'a, 'tcx> Lift<'tcx> for traits::SelectionError<'a> { type Lifted = traits::SelectionError<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { match *self { super::Unimplemented => Some(super::Unimplemented), super::OutputTypeParameterMismatch(a, b, ref err) => { @@ -464,7 +464,7 @@ impl<'a, 'tcx> Lift<'tcx> for traits::SelectionError<'a> { impl<'a, 'tcx> Lift<'tcx> for traits::ObligationCauseCode<'a> { type Lifted = traits::ObligationCauseCode<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { match *self { super::ReturnNoExpression => Some(super::ReturnNoExpression), super::MiscObligation => Some(super::MiscObligation), @@ -546,7 +546,7 @@ impl<'a, 'tcx> Lift<'tcx> for traits::ObligationCauseCode<'a> { impl<'a, 'tcx> Lift<'tcx> for traits::DerivedObligationCause<'a> { type Lifted = traits::DerivedObligationCause<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { tcx.lift(&self.parent_trait_ref).and_then(|trait_ref| tcx.lift(&*self.parent_code) .map(|code| traits::DerivedObligationCause { @@ -559,7 +559,7 @@ impl<'a, 'tcx> Lift<'tcx> for traits::DerivedObligationCause<'a> { impl<'a, 'tcx> Lift<'tcx> for traits::ObligationCause<'a> { type Lifted = traits::ObligationCause<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { tcx.lift(&self.code).map(|code| traits::ObligationCause { span: self.span, body_id: self.body_id, @@ -571,7 +571,7 @@ impl<'a, 'tcx> Lift<'tcx> for traits::ObligationCause<'a> { // For codegen only. impl<'a, 'tcx> Lift<'tcx> for traits::Vtable<'a, ()> { type Lifted = traits::Vtable<'tcx, ()>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { match self.clone() { traits::VtableImpl(traits::VtableImplData { impl_def_id, @@ -691,7 +691,7 @@ EnumLiftImpl! { impl<'a, 'tcx> Lift<'tcx> for traits::Environment<'a> { type Lifted = traits::Environment<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { tcx.lift(&self.clauses).map(|clauses| { traits::Environment { clauses, @@ -702,7 +702,7 @@ impl<'a, 'tcx> Lift<'tcx> for traits::Environment<'a> { impl<'a, 'tcx, G: Lift<'tcx>> Lift<'tcx> for traits::InEnvironment<'a, G> { type Lifted = traits::InEnvironment<'tcx, G::Lifted>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { tcx.lift(&self.environment).and_then(|environment| { tcx.lift(&self.goal).map(|goal| { traits::InEnvironment { @@ -721,7 +721,7 @@ where { type Lifted = C::LiftedExClause; - fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { ::lift_ex_clause_to_tcx(self, tcx) } } @@ -733,7 +733,7 @@ where { type Lifted = C::LiftedDelayedLiteral; - fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { ::lift_delayed_literal_to_tcx(self, tcx) } } @@ -745,7 +745,7 @@ where { type Lifted = C::LiftedLiteral; - fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { ::lift_literal_to_tcx(self, tcx) } } diff --git a/src/librustc/traits/util.rs b/src/librustc/traits/util.rs index 3f0ac9036f8ba..e77ac75279e33 100644 --- a/src/librustc/traits/util.rs +++ b/src/librustc/traits/util.rs @@ -12,7 +12,7 @@ use crate::util::nodemap::FxHashSet; use super::{Obligation, ObligationCause, PredicateObligation, SelectionContext, Normalized}; -fn anonymize_predicate<'a, 'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, +fn anonymize_predicate<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, pred: &ty::Predicate<'tcx>) -> ty::Predicate<'tcx> { match *pred { @@ -93,7 +93,7 @@ pub struct Elaborator<'gcx, 'tcx> { visited: PredicateSet<'gcx, 'tcx>, } -pub fn elaborate_trait_ref<'cx, 'gcx, 'tcx>( +pub fn elaborate_trait_ref<'gcx, 'tcx>( tcx: TyCtxt<'tcx, 'gcx, 'tcx>, trait_ref: ty::PolyTraitRef<'tcx>) -> Elaborator<'gcx, 'tcx> @@ -101,7 +101,7 @@ pub fn elaborate_trait_ref<'cx, 'gcx, 'tcx>( elaborate_predicates(tcx, vec![trait_ref.to_predicate()]) } -pub fn elaborate_trait_refs<'cx, 'gcx, 'tcx>( +pub fn elaborate_trait_refs<'gcx, 'tcx>( tcx: TyCtxt<'tcx, 'gcx, 'tcx>, trait_refs: impl Iterator>) -> Elaborator<'gcx, 'tcx> @@ -110,7 +110,7 @@ pub fn elaborate_trait_refs<'cx, 'gcx, 'tcx>( elaborate_predicates(tcx, predicates) } -pub fn elaborate_predicates<'cx, 'gcx, 'tcx>( +pub fn elaborate_predicates<'gcx, 'tcx>( tcx: TyCtxt<'tcx, 'gcx, 'tcx>, mut predicates: Vec>) -> Elaborator<'gcx, 'tcx> @@ -256,13 +256,13 @@ impl Iterator for Elaborator<'gcx, 'tcx> { pub type Supertraits<'gcx, 'tcx> = FilterToTraits>; -pub fn supertraits<'cx, 'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, +pub fn supertraits<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, trait_ref: ty::PolyTraitRef<'tcx>) -> Supertraits<'gcx, 'tcx> { elaborate_trait_ref(tcx, trait_ref).filter_to_traits() } -pub fn transitive_bounds<'cx, 'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, +pub fn transitive_bounds<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, bounds: impl Iterator>) -> Supertraits<'gcx, 'tcx> { elaborate_trait_refs(tcx, bounds).filter_to_traits() @@ -337,7 +337,7 @@ impl<'tcx> TraitAliasExpansionInfo<'tcx> { } } -pub fn expand_trait_aliases<'cx, 'gcx, 'tcx>( +pub fn expand_trait_aliases<'gcx, 'tcx>( tcx: TyCtxt<'tcx, 'gcx, 'tcx>, trait_refs: impl IntoIterator, Span)> ) -> TraitAliasExpander<'gcx, 'tcx> { @@ -348,7 +348,7 @@ pub fn expand_trait_aliases<'cx, 'gcx, 'tcx>( TraitAliasExpander { tcx, stack: items } } -impl<'cx, 'gcx, 'tcx> TraitAliasExpander<'gcx, 'tcx> { +impl<'gcx, 'tcx> TraitAliasExpander<'gcx, 'tcx> { /// If `item` is a trait alias and its predicate has not yet been visited, then expands `item` /// to the definition, pushes the resulting expansion onto `self.stack`, and returns `false`. /// Otherwise, immediately returns `true` if `item` is a regular trait, or `false` if it is a @@ -393,7 +393,7 @@ impl<'cx, 'gcx, 'tcx> TraitAliasExpander<'gcx, 'tcx> { } } -impl<'cx, 'gcx, 'tcx> Iterator for TraitAliasExpander<'gcx, 'tcx> { +impl<'gcx, 'tcx> Iterator for TraitAliasExpander<'gcx, 'tcx> { type Item = TraitAliasExpansionInfo<'tcx>; fn size_hint(&self) -> (usize, Option) { @@ -420,7 +420,7 @@ pub struct SupertraitDefIds<'gcx, 'tcx> { visited: FxHashSet, } -pub fn supertrait_def_ids<'cx, 'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, +pub fn supertrait_def_ids<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, trait_def_id: DefId) -> SupertraitDefIds<'gcx, 'tcx> { @@ -552,7 +552,7 @@ pub fn predicate_for_trait_ref<'tcx>( } } -impl<'a, 'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { pub fn predicate_for_trait_def(self, param_env: ty::ParamEnv<'tcx>, cause: ObligationCause<'tcx>, diff --git a/src/librustc/ty/adjustment.rs b/src/librustc/ty/adjustment.rs index 191a584dd64a6..bdc5cd3fb330a 100644 --- a/src/librustc/ty/adjustment.rs +++ b/src/librustc/ty/adjustment.rs @@ -103,7 +103,7 @@ pub struct OverloadedDeref<'tcx> { pub mutbl: hir::Mutability, } -impl<'a, 'gcx, 'tcx> OverloadedDeref<'tcx> { +impl<'gcx, 'tcx> OverloadedDeref<'tcx> { pub fn method_call(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, source: Ty<'tcx>) -> (DefId, SubstsRef<'tcx>) { let trait_def_id = match self.mutbl { diff --git a/src/librustc/ty/constness.rs b/src/librustc/ty/constness.rs index 8cb2a9f33fba9..fed7caef0d4d2 100644 --- a/src/librustc/ty/constness.rs +++ b/src/librustc/ty/constness.rs @@ -6,7 +6,7 @@ use syntax_pos::symbol::{sym, Symbol}; use crate::hir::map::blocks::FnLikeNode; use syntax::attr; -impl<'a, 'tcx> TyCtxt<'tcx, 'tcx, 'tcx> { +impl<'tcx> TyCtxt<'tcx, 'tcx, 'tcx> { /// Whether the `def_id` counts as const fn in your current crate, considering all active /// feature gates pub fn is_const_fn(self, def_id: DefId) -> bool { @@ -69,7 +69,7 @@ impl<'a, 'tcx> TyCtxt<'tcx, 'tcx, 'tcx> { pub fn provide<'tcx>(providers: &mut Providers<'tcx>) { /// only checks whether the function has a `const` modifier - fn is_const_fn_raw<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> bool { + fn is_const_fn_raw<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> bool { let hir_id = tcx.hir().as_local_hir_id(def_id) .expect("Non-local call to local provider is_const_fn"); @@ -83,7 +83,7 @@ pub fn provide<'tcx>(providers: &mut Providers<'tcx>) { } } - fn is_promotable_const_fn<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> bool { + fn is_promotable_const_fn<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> bool { tcx.is_const_fn(def_id) && match tcx.lookup_stability(def_id) { Some(stab) => { if cfg!(debug_assertions) && stab.promotable { @@ -101,7 +101,7 @@ pub fn provide<'tcx>(providers: &mut Providers<'tcx>) { } } - fn const_fn_is_allowed_fn_ptr<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> bool { + fn const_fn_is_allowed_fn_ptr<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> bool { tcx.is_const_fn(def_id) && tcx.lookup_stability(def_id) .map(|stab| stab.allow_const_fn_ptr).unwrap_or(false) diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index 9e6c63026ddeb..8212822ba82c7 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -1666,7 +1666,7 @@ impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { } } -impl<'a, 'tcx> TyCtxt<'tcx, 'tcx, 'tcx> { +impl<'tcx> TyCtxt<'tcx, 'tcx, 'tcx> { pub fn encode_metadata(self) -> EncodedMetadata { @@ -1725,7 +1725,7 @@ impl<'gcx> GlobalCtxt<'gcx> { /// e.g., `()` or `u8`, was interned in a different context. pub trait Lift<'tcx>: fmt::Debug { type Lifted: fmt::Debug + 'tcx; - fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option; + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option; } @@ -1733,7 +1733,7 @@ macro_rules! nop_lift { ($ty:ty => $lifted:ty) => { impl<'a, 'tcx> Lift<'tcx> for $ty { type Lifted = $lifted; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { if tcx.interners.arena.in_arena(*self as *const _) { return Some(unsafe { mem::transmute(*self) }); } @@ -1752,7 +1752,7 @@ macro_rules! nop_list_lift { ($ty:ty => $lifted:ty) => { impl<'a, 'tcx> Lift<'tcx> for &'a List<$ty> { type Lifted = &'tcx List<$lifted>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { if self.is_empty() { return Some(List::empty()); } @@ -1978,7 +1978,7 @@ pub mod tls { /// Creates a TyCtxt and ImplicitCtxt based on the GCX_PTR thread local. /// This is used in the deadlock handler. pub unsafe fn with_global(f: F) -> R - where F: for<'a, 'gcx, 'tcx> FnOnce(TyCtxt<'tcx, 'gcx, 'tcx>) -> R + where F: for<'gcx, 'tcx> FnOnce(TyCtxt<'tcx, 'gcx, 'tcx>) -> R { let gcx = GCX_PTR.with(|lock| *lock.lock()); assert!(gcx != 0); @@ -2065,7 +2065,7 @@ pub mod tls { /// Panics if there is no ImplicitCtxt available #[inline] pub fn with(f: F) -> R - where F: for<'a, 'gcx, 'tcx> FnOnce(TyCtxt<'tcx, 'gcx, 'tcx>) -> R + where F: for<'gcx, 'tcx> FnOnce(TyCtxt<'tcx, 'gcx, 'tcx>) -> R { with_context(|context| f(context.tcx)) } @@ -2074,7 +2074,7 @@ pub mod tls { /// The closure is passed None if there is no ImplicitCtxt available #[inline] pub fn with_opt(f: F) -> R - where F: for<'a, 'gcx, 'tcx> FnOnce(Option>) -> R + where F: for<'gcx, 'tcx> FnOnce(Option>) -> R { with_context_opt(|opt_context| f(opt_context.map(|context| context.tcx))) } @@ -2151,7 +2151,7 @@ macro_rules! sty_debug_print { }} } -impl<'a, 'tcx> TyCtxt<'tcx, 'tcx, 'tcx> { +impl<'tcx> TyCtxt<'tcx, 'tcx, 'tcx> { pub fn print_debug_stats(self) { sty_debug_print!( self, @@ -2400,7 +2400,7 @@ intern_method! { ) -> List } -impl<'a, 'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { /// Given a `fn` type, returns an equivalent `unsafe fn` type; /// that is, a `fn` type that is equivalent in every way for being /// unsafe. diff --git a/src/librustc/ty/erase_regions.rs b/src/librustc/ty/erase_regions.rs index 5f41aa9fac937..df189d01a629a 100644 --- a/src/librustc/ty/erase_regions.rs +++ b/src/librustc/ty/erase_regions.rs @@ -8,13 +8,13 @@ pub(super) fn provide(providers: &mut ty::query::Providers<'_>) { }; } -fn erase_regions_ty<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ty: Ty<'tcx>) -> Ty<'tcx> { +fn erase_regions_ty<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ty: Ty<'tcx>) -> Ty<'tcx> { // N.B., use `super_fold_with` here. If we used `fold_with`, it // could invoke the `erase_regions_ty` query recursively. ty.super_fold_with(&mut RegionEraserVisitor { tcx }) } -impl<'a, 'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { /// Returns an equivalent value with all free regions removed (note /// that late-bound regions remain, because they are important for /// subtyping, but they are anonymized and normalized as well).. diff --git a/src/librustc/ty/error.rs b/src/librustc/ty/error.rs index 3855b856562de..632bbe229de32 100644 --- a/src/librustc/ty/error.rs +++ b/src/librustc/ty/error.rs @@ -183,7 +183,7 @@ impl<'tcx> fmt::Display for TypeError<'tcx> { } } -impl<'a, 'gcx, 'lcx, 'tcx> ty::TyS<'tcx> { +impl<'gcx, 'lcx, 'tcx> ty::TyS<'tcx> { pub fn sort_string(&self, tcx: TyCtxt<'lcx, 'gcx, 'lcx>) -> Cow<'static, str> { match self.sty { ty::Bool | ty::Char | ty::Int(_) | @@ -249,7 +249,7 @@ impl<'a, 'gcx, 'lcx, 'tcx> ty::TyS<'tcx> { } } -impl<'a, 'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { pub fn note_and_explain_type_err(self, db: &mut DiagnosticBuilder<'_>, err: &TypeError<'tcx>, diff --git a/src/librustc/ty/fast_reject.rs b/src/librustc/ty/fast_reject.rs index de148018b8383..f858c92ff0d0f 100644 --- a/src/librustc/ty/fast_reject.rs +++ b/src/librustc/ty/fast_reject.rs @@ -55,7 +55,7 @@ pub enum SimplifiedTypeGen /// then we can't say much about whether two types would unify. Put another way, /// `can_simplify_params` should be true if type parameters appear free in `ty` and `false` if they /// are to be considered bound. -pub fn simplify_type<'a, 'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, +pub fn simplify_type<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, ty: Ty<'_>, can_simplify_params: bool) -> Option diff --git a/src/librustc/ty/fold.rs b/src/librustc/ty/fold.rs index 0a0ac3f2861aa..1698d8d3cdd64 100644 --- a/src/librustc/ty/fold.rs +++ b/src/librustc/ty/fold.rs @@ -235,7 +235,7 @@ impl<'gcx, 'tcx, F, G, H> TypeFolder<'gcx, 'tcx> for BottomUpFolder<'gcx, 'tcx, /////////////////////////////////////////////////////////////////////////// // Region folder -impl<'a, 'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { /// Collects the free and escaping regions in `value` into `region_set`. Returns /// whether any late-bound regions were skipped pub fn collect_regions(self, @@ -542,7 +542,7 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for BoundVarReplacer<'a, 'gcx, 'tcx> } } -impl<'a, 'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { /// Replaces all regions bound by the given `Binder` with the /// results returned by the closure; the closure is expected to /// return a free region (relative to this binder), and hence the @@ -817,7 +817,7 @@ impl TypeFolder<'gcx, 'tcx> for Shifter<'gcx, 'tcx> { } } -pub fn shift_region<'a, 'gcx, 'tcx>( +pub fn shift_region<'gcx, 'tcx>( tcx: TyCtxt<'tcx, 'gcx, 'tcx>, region: ty::Region<'tcx>, amount: u32 @@ -832,7 +832,7 @@ pub fn shift_region<'a, 'gcx, 'tcx>( } } -pub fn shift_vars<'a, 'gcx, 'tcx, T>( +pub fn shift_vars<'gcx, 'tcx, T>( tcx: TyCtxt<'tcx, 'gcx, 'tcx>, value: &T, amount: u32 @@ -843,7 +843,7 @@ pub fn shift_vars<'a, 'gcx, 'tcx, T>( value.fold_with(&mut Shifter::new(tcx, amount, Direction::In)) } -pub fn shift_out_vars<'a, 'gcx, 'tcx, T>( +pub fn shift_out_vars<'gcx, 'tcx, T>( tcx: TyCtxt<'tcx, 'gcx, 'tcx>, value: &T, amount: u32 diff --git a/src/librustc/ty/inhabitedness/def_id_forest.rs b/src/librustc/ty/inhabitedness/def_id_forest.rs index a0be4b3e7d838..ebe23b27117f2 100644 --- a/src/librustc/ty/inhabitedness/def_id_forest.rs +++ b/src/librustc/ty/inhabitedness/def_id_forest.rs @@ -21,7 +21,7 @@ pub struct DefIdForest { root_ids: SmallVec<[DefId; 1]>, } -impl<'a, 'gcx, 'tcx> DefIdForest { +impl<'gcx, 'tcx> DefIdForest { /// Creates an empty forest. pub fn empty() -> DefIdForest { DefIdForest { diff --git a/src/librustc/ty/inhabitedness/mod.rs b/src/librustc/ty/inhabitedness/mod.rs index fe05a86377671..1c9b06cb6b475 100644 --- a/src/librustc/ty/inhabitedness/mod.rs +++ b/src/librustc/ty/inhabitedness/mod.rs @@ -51,7 +51,7 @@ mod def_id_forest; // This code should only compile in modules where the uninhabitedness of Foo is // visible. -impl<'a, 'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { /// Checks whether a type is visibly uninhabited from a particular module. /// # Example /// ```rust @@ -106,7 +106,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { } } -impl<'a, 'gcx, 'tcx> AdtDef { +impl<'gcx, 'tcx> AdtDef { /// Calculate the forest of DefIds from which this adt is visibly uninhabited. fn uninhabited_from( &self, @@ -124,7 +124,7 @@ impl<'a, 'gcx, 'tcx> AdtDef { } } -impl<'a, 'gcx, 'tcx> VariantDef { +impl<'gcx, 'tcx> VariantDef { /// Calculate the forest of DefIds from which this variant is visibly uninhabited. pub fn uninhabited_from( &self, @@ -150,7 +150,7 @@ impl<'a, 'gcx, 'tcx> VariantDef { } } -impl<'a, 'gcx, 'tcx> FieldDef { +impl<'gcx, 'tcx> FieldDef { /// Calculate the forest of DefIds from which this field is visibly uninhabited. fn uninhabited_from( &self, @@ -180,7 +180,7 @@ impl<'a, 'gcx, 'tcx> FieldDef { } } -impl<'a, 'gcx, 'tcx> TyS<'tcx> { +impl<'gcx, 'tcx> TyS<'tcx> { /// Calculate the forest of DefIds from which this type is visibly uninhabited. fn uninhabited_from(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> DefIdForest { diff --git a/src/librustc/ty/instance.rs b/src/librustc/ty/instance.rs index e35b7226f4941..92c64e8614e9a 100644 --- a/src/librustc/ty/instance.rs +++ b/src/librustc/ty/instance.rs @@ -42,7 +42,7 @@ pub enum InstanceDef<'tcx> { CloneShim(DefId, Ty<'tcx>), } -impl<'a, 'tcx> Instance<'tcx> { +impl<'tcx> Instance<'tcx> { pub fn ty(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Ty<'tcx> @@ -136,11 +136,11 @@ impl<'tcx> InstanceDef<'tcx> { } #[inline] - pub fn attrs<'a>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> ty::Attributes<'tcx> { + pub fn attrs(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> ty::Attributes<'tcx> { tcx.get_attrs(self.def_id()) } - pub fn is_inline<'a>( + pub fn is_inline( &self, tcx: TyCtxt<'tcx, 'tcx, 'tcx> ) -> bool { @@ -156,7 +156,7 @@ impl<'tcx> InstanceDef<'tcx> { } } - pub fn requires_local<'a>( + pub fn requires_local( &self, tcx: TyCtxt<'tcx, 'tcx, 'tcx> ) -> bool { @@ -209,7 +209,7 @@ impl<'tcx> fmt::Display for Instance<'tcx> { } } -impl<'a, 'b, 'tcx> Instance<'tcx> { +impl<'b, 'tcx> Instance<'tcx> { pub fn new(def_id: DefId, substs: SubstsRef<'tcx>) -> Instance<'tcx> { assert!(!substs.has_escaping_bound_vars(), @@ -376,7 +376,7 @@ impl<'a, 'b, 'tcx> Instance<'tcx> { } } -fn resolve_associated_item<'a, 'tcx>( +fn resolve_associated_item<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, trait_item: &ty::AssocItem, param_env: ty::ParamEnv<'tcx>, diff --git a/src/librustc/ty/layout.rs b/src/librustc/ty/layout.rs index d433c3920bff2..4c76d36f11c7b 100644 --- a/src/librustc/ty/layout.rs +++ b/src/librustc/ty/layout.rs @@ -31,9 +31,9 @@ use rustc_target::abi::call::{ pub trait IntegerExt { - fn to_ty<'a, 'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, signed: bool) -> Ty<'tcx>; + fn to_ty<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, signed: bool) -> Ty<'tcx>; fn from_attr(cx: &C, ity: attr::IntType) -> Integer; - fn repr_discr<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + fn repr_discr<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ty: Ty<'tcx>, repr: &ReprOptions, min: i128, @@ -42,7 +42,7 @@ pub trait IntegerExt { } impl IntegerExt for Integer { - fn to_ty<'a, 'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, signed: bool) -> Ty<'tcx> { + fn to_ty<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, signed: bool) -> Ty<'tcx> { match (*self, signed) { (I8, false) => tcx.types.u8, (I16, false) => tcx.types.u16, @@ -77,7 +77,7 @@ impl IntegerExt for Integer { /// signed discriminant range and #[repr] attribute. /// N.B.: u128 values above i128::MAX will be treated as signed, but /// that shouldn't affect anything, other than maybe debuginfo. - fn repr_discr<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + fn repr_discr<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ty: Ty<'tcx>, repr: &ReprOptions, min: i128, @@ -126,11 +126,11 @@ impl IntegerExt for Integer { } pub trait PrimitiveExt { - fn to_ty<'a, 'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Ty<'tcx>; + fn to_ty<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Ty<'tcx>; } impl PrimitiveExt for Primitive { - fn to_ty<'a, 'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Ty<'tcx> { + fn to_ty<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Ty<'tcx> { match *self { Int(i, signed) => i.to_ty(tcx, signed), Float(FloatTy::F32) => tcx.types.f32, @@ -171,7 +171,7 @@ impl<'tcx> fmt::Display for LayoutError<'tcx> { } } -fn layout_raw<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn layout_raw<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, query: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> Result<&'tcx LayoutDetails, LayoutError<'tcx>> { @@ -226,7 +226,7 @@ enum StructKind { Prefixed(Size, Align), } -impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'tcx, 'tcx, 'tcx>> { +impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx, 'tcx, 'tcx>> { fn scalar_pair(&self, a: Scalar, b: Scalar) -> LayoutDetails { let dl = self.data_layout(); let b_align = b.value.align(dl); @@ -1221,7 +1221,7 @@ enum SavedLocalEligibility { // Also included in the layout are the upvars and the discriminant. // These are included as fields on the "outer" layout; they are not part // of any variant. -impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'tcx, 'tcx, 'tcx>> { +impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx, 'tcx, 'tcx>> { /// Compute the eligibility and assignment of each local. fn generator_saved_local_eligibility(&self, info: &GeneratorLayout<'tcx>) -> (BitSet, IndexVec) { @@ -1603,7 +1603,7 @@ pub enum SizeSkeleton<'tcx> { } } -impl<'a, 'tcx> SizeSkeleton<'tcx> { +impl<'tcx> SizeSkeleton<'tcx> { pub fn compute(ty: Ty<'tcx>, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>) @@ -1734,13 +1734,13 @@ pub trait HasParamEnv<'tcx> { fn param_env(&self) -> ty::ParamEnv<'tcx>; } -impl<'a, 'gcx, 'tcx> HasDataLayout for TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> HasDataLayout for TyCtxt<'tcx, 'gcx, 'tcx> { fn data_layout(&self) -> &TargetDataLayout { &self.data_layout } } -impl<'a, 'gcx, 'tcx> HasTyCtxt<'gcx> for TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> HasTyCtxt<'gcx> for TyCtxt<'tcx, 'gcx, 'tcx> { fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'gcx, 'gcx> { self.global_tcx() } @@ -1796,7 +1796,7 @@ impl MaybeResult for Result { pub type TyLayout<'tcx> = ::rustc_target::abi::TyLayout<'tcx, Ty<'tcx>>; -impl<'a, 'tcx> LayoutOf for LayoutCx<'tcx, TyCtxt<'tcx, 'tcx, 'tcx>> { +impl<'tcx> LayoutOf for LayoutCx<'tcx, TyCtxt<'tcx, 'tcx, 'tcx>> { type Ty = Ty<'tcx>; type TyLayout = Result, LayoutError<'tcx>>; @@ -2187,7 +2187,7 @@ struct Niche { } impl Niche { - fn reserve<'a, 'tcx>( + fn reserve<'tcx>( &self, cx: &LayoutCx<'tcx, TyCtxt<'tcx, 'tcx, 'tcx>>, count: u128, @@ -2205,7 +2205,7 @@ impl Niche { } } -impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'tcx, 'tcx, 'tcx>> { +impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx, 'tcx, 'tcx>> { /// Find the offset of a niche leaf field, starting from /// the given type and recursing through aggregates. // FIXME(eddyb) traverse already optimized enums. diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index 687de97f4ceaf..be19b2d945cbf 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -213,7 +213,7 @@ impl AssocItem { } } - pub fn signature<'a, 'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> String { + pub fn signature<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> String { match self.kind { ty::AssocKind::Method => { // We skip the binder here because the binder would deanonymize all @@ -259,7 +259,7 @@ pub trait DefIdTree: Copy { } } -impl<'a, 'gcx, 'tcx> DefIdTree for TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> DefIdTree for TyCtxt<'tcx, 'gcx, 'tcx> { fn parent(self, id: DefId) -> Option { self.def_key(id).parent.map(|index| DefId { index: index, ..id }) } @@ -912,7 +912,7 @@ pub struct Generics { pub has_late_bound_regions: Option, } -impl<'a, 'gcx, 'tcx> Generics { +impl<'gcx, 'tcx> Generics { pub fn count(&self) -> usize { self.parent_count + self.params.len() } @@ -1019,7 +1019,7 @@ pub struct GenericPredicates<'tcx> { impl<'tcx> serialize::UseSpecializedEncodable for GenericPredicates<'tcx> {} impl<'tcx> serialize::UseSpecializedDecodable for GenericPredicates<'tcx> {} -impl<'a, 'gcx, 'tcx> GenericPredicates<'tcx> { +impl<'gcx, 'tcx> GenericPredicates<'tcx> { pub fn instantiate(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, substs: SubstsRef<'tcx>) -> InstantiatedPredicates<'tcx> { let mut instantiated = InstantiatedPredicates::empty(); @@ -1128,7 +1128,7 @@ impl<'tcx> AsRef> for Predicate<'tcx> { } } -impl<'a, 'gcx, 'tcx> Predicate<'tcx> { +impl<'gcx, 'tcx> Predicate<'tcx> { /// Performs a substitution suitable for going from a /// poly-trait-ref to supertraits that must hold if that /// poly-trait-ref holds. This is slightly different from a normal @@ -1838,7 +1838,7 @@ pub struct VariantDef { pub recovered: bool, } -impl<'a, 'gcx, 'tcx> VariantDef { +impl<'gcx, 'tcx> VariantDef { /// Creates a new `VariantDef`. /// /// `variant_did` is the `DefId` that identifies the enum variant (if this `VariantDef` @@ -2563,7 +2563,7 @@ impl<'gcx, 'tcx> AdtDef { } } -impl<'a, 'gcx, 'tcx> FieldDef { +impl<'gcx, 'tcx> FieldDef { pub fn ty(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, subst: SubstsRef<'tcx>) -> Ty<'tcx> { tcx.type_of(self.did).subst(tcx, subst) } @@ -2586,7 +2586,7 @@ pub enum ClosureKind { FnOnce, } -impl<'a, 'tcx> ClosureKind { +impl<'tcx> ClosureKind { // This is the initial value used when doing upvar inference. pub const LATTICE_BOTTOM: ClosureKind = ClosureKind::Fn; @@ -3131,7 +3131,7 @@ impl Iterator for AssocItemsIterator<'_, '_> { } } -fn associated_item<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> AssocItem { +fn associated_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> AssocItem { let id = tcx.hir().as_local_hir_id(def_id).unwrap(); let parent_id = tcx.hir().get_parent_item(id); let parent_def_id = tcx.hir().local_def_id_from_hir_id(parent_id); @@ -3176,7 +3176,7 @@ pub struct AdtSizedConstraint<'tcx>(pub &'tcx [Ty<'tcx>]); /// such. /// - a Error, if a type contained itself. The representability /// check should catch this case. -fn adt_sized_constraint<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn adt_sized_constraint<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> AdtSizedConstraint<'tcx> { let def = tcx.adt_def(def_id); @@ -3192,7 +3192,7 @@ fn adt_sized_constraint<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, AdtSizedConstraint(result) } -fn associated_item_def_ids<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn associated_item_def_ids<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx [DefId] { let id = tcx.hir().as_local_hir_id(def_id).unwrap(); @@ -3217,14 +3217,14 @@ fn associated_item_def_ids<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } } -fn def_span<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> Span { +fn def_span<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> Span { tcx.hir().span_if_local(def_id).unwrap() } /// If the given `DefId` describes an item belonging to a trait, /// returns the `DefId` of the trait that the trait item belongs to; /// otherwise, returns `None`. -fn trait_of_item<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> Option { +fn trait_of_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> Option { tcx.opt_associated_item(def_id) .and_then(|associated_item| { match associated_item.container { @@ -3247,7 +3247,7 @@ pub fn is_impl_trait_defn(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> Option(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn param_env<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> ParamEnv<'tcx> { @@ -3285,26 +3285,26 @@ fn param_env<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, traits::normalize_param_env_or_error(tcx, def_id, unnormalized_env, cause) } -fn crate_disambiguator<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn crate_disambiguator<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, crate_num: CrateNum) -> CrateDisambiguator { assert_eq!(crate_num, LOCAL_CRATE); tcx.sess.local_crate_disambiguator() } -fn original_crate_name<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn original_crate_name<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, crate_num: CrateNum) -> Symbol { assert_eq!(crate_num, LOCAL_CRATE); tcx.crate_name.clone() } -fn crate_hash<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn crate_hash<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, crate_num: CrateNum) -> Svh { assert_eq!(crate_num, LOCAL_CRATE); tcx.hir().crate_hash } -fn instance_def_size_estimate<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn instance_def_size_estimate<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, instance_def: InstanceDef<'tcx>) -> usize { match instance_def { @@ -3321,7 +3321,7 @@ fn instance_def_size_estimate<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, /// If `def_id` is an issue 33140 hack impl, returns its self type; otherwise, returns `None`. /// /// See [`ImplOverlapKind::Issue33140`] for more details. -fn issue33140_self_ty<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn issue33140_self_ty<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> Option> { diff --git a/src/librustc/ty/outlives.rs b/src/librustc/ty/outlives.rs index 772886ea21cdc..1d80d86e7a82a 100644 --- a/src/librustc/ty/outlives.rs +++ b/src/librustc/ty/outlives.rs @@ -45,7 +45,7 @@ pub enum Component<'tcx> { EscapingProjection(Vec>), } -impl<'a, 'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { /// Push onto `out` all the things that must outlive `'a` for the condition /// `ty0: 'a` to hold. Note that `ty0` must be a **fully resolved type**. pub fn push_outlives_components(&self, ty0: Ty<'tcx>, diff --git a/src/librustc/ty/query/config.rs b/src/librustc/ty/query/config.rs index 3e2bc7308ffbf..d6b0951fd0311 100644 --- a/src/librustc/ty/query/config.rs +++ b/src/librustc/ty/query/config.rs @@ -87,7 +87,7 @@ macro_rules! impl_disk_cacheable_query( } #[inline] - fn try_load_from_disk<'a>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + fn try_load_from_disk(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, id: SerializedDepNodeIndex) -> Option { tcx.queries.on_disk_cache.try_load_query_result(tcx, id) diff --git a/src/librustc/ty/query/on_disk_cache.rs b/src/librustc/ty/query/on_disk_cache.rs index 088e2bc33cf4d..7f8ba215cea2c 100644 --- a/src/librustc/ty/query/on_disk_cache.rs +++ b/src/librustc/ty/query/on_disk_cache.rs @@ -156,7 +156,7 @@ impl<'sess> OnDiskCache<'sess> { } } - pub fn serialize<'a, 'tcx, E>(&self, + pub fn serialize<'tcx, E>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, encoder: &mut E) -> Result<(), E::Error> @@ -326,7 +326,7 @@ impl<'sess> OnDiskCache<'sess> { } /// Loads a diagnostic emitted during the previous compilation session. - pub fn load_diagnostics<'a, 'tcx>(&self, + pub fn load_diagnostics<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, dep_node_index: SerializedDepNodeIndex) -> Vec { diff --git a/src/librustc/ty/query/plumbing.rs b/src/librustc/ty/query/plumbing.rs index d2ad8861def17..e151f9d111cf7 100644 --- a/src/librustc/ty/query/plumbing.rs +++ b/src/librustc/ty/query/plumbing.rs @@ -259,7 +259,7 @@ impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { compute: F) -> R where - F: for<'b, 'lcx> FnOnce(TyCtxt<'lcx, 'gcx, 'lcx>) -> R + F: for<'lcx> FnOnce(TyCtxt<'lcx, 'gcx, 'lcx>) -> R { // The TyCtxt stored in TLS has the same global interner lifetime // as `self`, so we use `with_related_context` to relate the 'gcx lifetimes diff --git a/src/librustc/ty/query/values.rs b/src/librustc/ty/query/values.rs index 66a6c52da3816..016d4792e11ce 100644 --- a/src/librustc/ty/query/values.rs +++ b/src/librustc/ty/query/values.rs @@ -4,24 +4,24 @@ use crate::ty::util::NeedsDrop; use syntax::symbol::InternedString; pub(super) trait Value<'tcx>: Sized { - fn from_cycle_error<'a>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Self; + fn from_cycle_error(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Self; } impl<'tcx, T> Value<'tcx> for T { - default fn from_cycle_error<'a>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> T { + default fn from_cycle_error(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> T { tcx.sess.abort_if_errors(); bug!("Value::from_cycle_error called without errors"); } } impl<'tcx> Value<'tcx> for Ty<'tcx> { - fn from_cycle_error<'a>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Ty<'tcx> { + fn from_cycle_error(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Ty<'tcx> { tcx.types.err } } impl<'tcx> Value<'tcx> for ty::SymbolName { - fn from_cycle_error<'a>(_: TyCtxt<'tcx, 'tcx, 'tcx>) -> Self { + fn from_cycle_error(_: TyCtxt<'tcx, 'tcx, 'tcx>) -> Self { ty::SymbolName { name: InternedString::intern("") } } } diff --git a/src/librustc/ty/structural_impls.rs b/src/librustc/ty/structural_impls.rs index ab090558167c3..8b98bf22cf91a 100644 --- a/src/librustc/ty/structural_impls.rs +++ b/src/librustc/ty/structural_impls.rs @@ -337,14 +337,14 @@ CloneTypeFoldableAndLiftImpls! { // FIXME(eddyb) replace all the uses of `Option::map` with `?`. impl<'tcx, A: Lift<'tcx>, B: Lift<'tcx>> Lift<'tcx> for (A, B) { type Lifted = (A::Lifted, B::Lifted); - fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { tcx.lift(&self.0).and_then(|a| tcx.lift(&self.1).map(|b| (a, b))) } } impl<'tcx, A: Lift<'tcx>, B: Lift<'tcx>, C: Lift<'tcx>> Lift<'tcx> for (A, B, C) { type Lifted = (A::Lifted, B::Lifted, C::Lifted); - fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { tcx.lift(&self.0).and_then(|a| { tcx.lift(&self.1).and_then(|b| tcx.lift(&self.2).map(|c| (a, b, c))) }) @@ -353,7 +353,7 @@ impl<'tcx, A: Lift<'tcx>, B: Lift<'tcx>, C: Lift<'tcx>> Lift<'tcx> for (A, B, C) impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for Option { type Lifted = Option; - fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { match *self { Some(ref x) => tcx.lift(x).map(Some), None => Some(None) @@ -363,7 +363,7 @@ impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for Option { impl<'tcx, T: Lift<'tcx>, E: Lift<'tcx>> Lift<'tcx> for Result { type Lifted = Result; - fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { match *self { Ok(ref x) => tcx.lift(x).map(Ok), Err(ref e) => tcx.lift(e).map(Err) @@ -373,14 +373,14 @@ impl<'tcx, T: Lift<'tcx>, E: Lift<'tcx>> Lift<'tcx> for Result { impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for Box { type Lifted = Box; - fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { tcx.lift(&**self).map(Box::new) } } impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for [T] { type Lifted = Vec; - fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { // type annotation needed to inform `projection_must_outlive` let mut result : Vec<>::Lifted> = Vec::with_capacity(self.len()); @@ -397,14 +397,14 @@ impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for [T] { impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for Vec { type Lifted = Vec; - fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { tcx.lift(&self[..]) } } impl<'tcx, I: Idx, T: Lift<'tcx>> Lift<'tcx> for IndexVec { type Lifted = IndexVec; - fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { self.iter() .map(|e| tcx.lift(e)) .collect() @@ -413,7 +413,7 @@ impl<'tcx, I: Idx, T: Lift<'tcx>> Lift<'tcx> for IndexVec { impl<'a, 'tcx> Lift<'tcx> for ty::TraitRef<'a> { type Lifted = ty::TraitRef<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { tcx.lift(&self.substs).map(|substs| ty::TraitRef { def_id: self.def_id, substs, @@ -423,7 +423,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::TraitRef<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::ExistentialTraitRef<'a> { type Lifted = ty::ExistentialTraitRef<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { tcx.lift(&self.substs).map(|substs| ty::ExistentialTraitRef { def_id: self.def_id, substs, @@ -433,7 +433,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::ExistentialTraitRef<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::ExistentialPredicate<'a> { type Lifted = ty::ExistentialPredicate<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { match self { ty::ExistentialPredicate::Trait(x) => { tcx.lift(x).map(ty::ExistentialPredicate::Trait) @@ -450,7 +450,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::ExistentialPredicate<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::TraitPredicate<'a> { type Lifted = ty::TraitPredicate<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option> { tcx.lift(&self.trait_ref).map(|trait_ref| ty::TraitPredicate { trait_ref, @@ -460,7 +460,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::TraitPredicate<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::SubtypePredicate<'a> { type Lifted = ty::SubtypePredicate<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option> { tcx.lift(&(self.a, self.b)).map(|(a, b)| ty::SubtypePredicate { a_is_expected: self.a_is_expected, @@ -472,14 +472,14 @@ impl<'a, 'tcx> Lift<'tcx> for ty::SubtypePredicate<'a> { impl<'tcx, A: Copy+Lift<'tcx>, B: Copy+Lift<'tcx>> Lift<'tcx> for ty::OutlivesPredicate { type Lifted = ty::OutlivesPredicate; - fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { tcx.lift(&(self.0, self.1)).map(|(a, b)| ty::OutlivesPredicate(a, b)) } } impl<'a, 'tcx> Lift<'tcx> for ty::ProjectionTy<'a> { type Lifted = ty::ProjectionTy<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option> { tcx.lift(&self.substs).map(|substs| { ty::ProjectionTy { @@ -492,7 +492,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::ProjectionTy<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::ProjectionPredicate<'a> { type Lifted = ty::ProjectionPredicate<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option> { tcx.lift(&(self.projection_ty, self.ty)).map(|(projection_ty, ty)| { ty::ProjectionPredicate { @@ -505,7 +505,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::ProjectionPredicate<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::ExistentialProjection<'a> { type Lifted = ty::ExistentialProjection<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { tcx.lift(&self.substs).map(|substs| { ty::ExistentialProjection { substs, @@ -518,7 +518,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::ExistentialProjection<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::Predicate<'a> { type Lifted = ty::Predicate<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { match *self { ty::Predicate::Trait(ref binder) => { tcx.lift(binder).map(ty::Predicate::Trait) @@ -558,14 +558,14 @@ impl<'a, 'tcx> Lift<'tcx> for ty::Predicate<'a> { impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for ty::Binder { type Lifted = ty::Binder; - fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { tcx.lift(self.skip_binder()).map(ty::Binder::bind) } } impl<'a, 'tcx> Lift<'tcx> for ty::ParamEnv<'a> { type Lifted = ty::ParamEnv<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { tcx.lift(&self.caller_bounds).map(|caller_bounds| { ty::ParamEnv { reveal: self.reveal, @@ -578,7 +578,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::ParamEnv<'a> { impl<'a, 'tcx, T: Lift<'tcx>> Lift<'tcx> for ty::ParamEnvAnd<'a, T> { type Lifted = ty::ParamEnvAnd<'tcx, T::Lifted>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { tcx.lift(&self.param_env).and_then(|param_env| { tcx.lift(&self.value).map(|value| { ty::ParamEnvAnd { @@ -592,7 +592,7 @@ impl<'a, 'tcx, T: Lift<'tcx>> Lift<'tcx> for ty::ParamEnvAnd<'a, T> { impl<'a, 'tcx> Lift<'tcx> for ty::ClosureSubsts<'a> { type Lifted = ty::ClosureSubsts<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { tcx.lift(&self.substs).map(|substs| { ty::ClosureSubsts { substs } }) @@ -601,7 +601,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::ClosureSubsts<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::GeneratorSubsts<'a> { type Lifted = ty::GeneratorSubsts<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { tcx.lift(&self.substs).map(|substs| { ty::GeneratorSubsts { substs } }) @@ -610,7 +610,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::GeneratorSubsts<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::adjustment::Adjustment<'a> { type Lifted = ty::adjustment::Adjustment<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { tcx.lift(&self.kind).and_then(|kind| { tcx.lift(&self.target).map(|target| { ty::adjustment::Adjustment { kind, target } @@ -621,7 +621,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::adjustment::Adjustment<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::adjustment::Adjust<'a> { type Lifted = ty::adjustment::Adjust<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { match *self { ty::adjustment::Adjust::NeverToAny => Some(ty::adjustment::Adjust::NeverToAny), @@ -639,7 +639,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::adjustment::Adjust<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::adjustment::OverloadedDeref<'a> { type Lifted = ty::adjustment::OverloadedDeref<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { tcx.lift(&self.region).map(|region| { ty::adjustment::OverloadedDeref { region, @@ -651,7 +651,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::adjustment::OverloadedDeref<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::adjustment::AutoBorrow<'a> { type Lifted = ty::adjustment::AutoBorrow<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { match *self { ty::adjustment::AutoBorrow::Ref(r, m) => { tcx.lift(&r).map(|r| ty::adjustment::AutoBorrow::Ref(r, m)) @@ -665,7 +665,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::adjustment::AutoBorrow<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::GenSig<'a> { type Lifted = ty::GenSig<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { tcx.lift(&(self.yield_ty, self.return_ty)) .map(|(yield_ty, return_ty)| { ty::GenSig { @@ -678,7 +678,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::GenSig<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::FnSig<'a> { type Lifted = ty::FnSig<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { tcx.lift(&self.inputs_and_output).map(|x| { ty::FnSig { inputs_and_output: x, @@ -692,7 +692,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::FnSig<'a> { impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for ty::error::ExpectedFound { type Lifted = ty::error::ExpectedFound; - fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { tcx.lift(&self.expected).and_then(|expected| { tcx.lift(&self.found).map(|found| { ty::error::ExpectedFound { @@ -706,7 +706,7 @@ impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for ty::error::ExpectedFound { impl<'a, 'tcx> Lift<'tcx> for ty::error::TypeError<'a> { type Lifted = ty::error::TypeError<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { use crate::ty::error::TypeError::*; Some(match *self { @@ -743,7 +743,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::error::TypeError<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::InstanceDef<'a> { type Lifted = ty::InstanceDef<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { match *self { ty::InstanceDef::Item(def_id) => Some(ty::InstanceDef::Item(def_id)), diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs index 959031c7c9fbf..248d037fa5edc 100644 --- a/src/librustc/ty/sty.rs +++ b/src/librustc/ty/sty.rs @@ -590,7 +590,7 @@ pub enum ExistentialPredicate<'tcx> { AutoTrait(DefId), } -impl<'a, 'gcx, 'tcx> ExistentialPredicate<'tcx> { +impl<'gcx, 'tcx> ExistentialPredicate<'tcx> { /// Compares via an ordering that will not change if modules are reordered or other changes are /// made to the tree. In particular, this ordering is preserved across incremental compilations. pub fn stable_cmp(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, other: &Self) -> Ordering { @@ -610,7 +610,7 @@ impl<'a, 'gcx, 'tcx> ExistentialPredicate<'tcx> { } -impl<'a, 'gcx, 'tcx> Binder> { +impl<'gcx, 'tcx> Binder> { pub fn with_self_ty(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, self_ty: Ty<'tcx>) -> ty::Predicate<'tcx> { use crate::ty::ToPredicate; @@ -744,7 +744,7 @@ impl<'tcx> TraitRef<'tcx> { /// Returns a `TraitRef` of the form `P0: Foo` where `Pi` /// are the parameters defined on trait. - pub fn identity<'a, 'gcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, def_id: DefId) -> TraitRef<'tcx> { + pub fn identity<'gcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, def_id: DefId) -> TraitRef<'tcx> { TraitRef { def_id, substs: InternalSubsts::identity_for_item(tcx, def_id), @@ -808,7 +808,7 @@ pub struct ExistentialTraitRef<'tcx> { pub substs: SubstsRef<'tcx>, } -impl<'a, 'gcx, 'tcx> ExistentialTraitRef<'tcx> { +impl<'gcx, 'tcx> ExistentialTraitRef<'tcx> { pub fn input_types<'b>(&'b self) -> impl DoubleEndedIterator> + 'b { // Select only the "input types" from a trait-reference. For // now this is all the types that appear in the @@ -1112,7 +1112,7 @@ pub struct ParamTy { pub name: InternedString, } -impl<'a, 'gcx, 'tcx> ParamTy { +impl<'gcx, 'tcx> ParamTy { pub fn new(index: u32, name: InternedString) -> ParamTy { ParamTy { index, name: name } } @@ -1144,7 +1144,7 @@ pub struct ParamConst { pub name: InternedString, } -impl<'a, 'gcx, 'tcx> ParamConst { +impl<'gcx, 'tcx> ParamConst { pub fn new(index: u32, name: InternedString) -> ParamConst { ParamConst { index, name } } @@ -1408,7 +1408,7 @@ pub struct ExistentialProjection<'tcx> { pub type PolyExistentialProjection<'tcx> = Binder>; -impl<'a, 'tcx, 'gcx> ExistentialProjection<'tcx> { +impl<'tcx, 'gcx> ExistentialProjection<'tcx> { /// Extracts the underlying existential trait reference from this projection. /// For example, if this is a projection of `exists T. ::Item == X`, /// then this function would return a `exists T. T: Iterator` existential trait @@ -1438,7 +1438,7 @@ impl<'a, 'tcx, 'gcx> ExistentialProjection<'tcx> { } } -impl<'a, 'tcx, 'gcx> PolyExistentialProjection<'tcx> { +impl<'tcx, 'gcx> PolyExistentialProjection<'tcx> { pub fn with_self_ty(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, self_ty: Ty<'tcx>) -> ty::PolyProjectionPredicate<'tcx> { self.map_bound(|p| p.with_self_ty(tcx, self_ty)) @@ -1664,7 +1664,7 @@ impl RegionKind { } /// Type utilities -impl<'a, 'gcx, 'tcx> TyS<'tcx> { +impl<'gcx, 'tcx> TyS<'tcx> { #[inline] pub fn is_unit(&self) -> bool { match self.sty { diff --git a/src/librustc/ty/subst.rs b/src/librustc/ty/subst.rs index 23b04cb41f9d4..276a2592ac7af 100644 --- a/src/librustc/ty/subst.rs +++ b/src/librustc/ty/subst.rs @@ -138,7 +138,7 @@ impl<'tcx> Kind<'tcx> { impl<'a, 'tcx> Lift<'tcx> for Kind<'a> { type Lifted = Kind<'tcx>; - fn lift_to_tcx<'cx, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { match self.unpack() { UnpackedKind::Lifetime(lt) => tcx.lift(<).map(|lt| lt.into()), UnpackedKind::Type(ty) => tcx.lift(&ty).map(|ty| ty.into()), @@ -414,19 +414,19 @@ impl<'tcx> serialize::UseSpecializedDecodable for SubstsRef<'tcx> {} // there is more information available (for better errors). pub trait Subst<'tcx>: Sized { - fn subst<'a, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + fn subst<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, substs: &[Kind<'tcx>]) -> Self { self.subst_spanned(tcx, substs, None) } - fn subst_spanned<'a, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + fn subst_spanned<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, substs: &[Kind<'tcx>], span: Option) -> Self; } impl<'tcx, T:TypeFoldable<'tcx>> Subst<'tcx> for T { - fn subst_spanned<'a, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + fn subst_spanned<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, substs: &[Kind<'tcx>], span: Option) -> T diff --git a/src/librustc/ty/trait_def.rs b/src/librustc/ty/trait_def.rs index fc08fc46b001e..b7a4199067224 100644 --- a/src/librustc/ty/trait_def.rs +++ b/src/librustc/ty/trait_def.rs @@ -46,7 +46,7 @@ pub struct TraitImpls { non_blanket_impls: FxHashMap>, } -impl<'a, 'gcx, 'tcx> TraitDef { +impl<'gcx, 'tcx> TraitDef { pub fn new(def_id: DefId, unsafety: hir::Unsafety, paren_sugar: bool, @@ -71,7 +71,7 @@ impl<'a, 'gcx, 'tcx> TraitDef { } } -impl<'a, 'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { pub fn for_each_impl(self, def_id: DefId, mut f: F) { let impls = self.trait_impls_of(def_id); @@ -148,7 +148,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { } // Query provider for `trait_impls_of`. -pub(super) fn trait_impls_of_provider<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub(super) fn trait_impls_of_provider<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, trait_id: DefId) -> &'tcx TraitImpls { let mut impls = TraitImpls::default(); diff --git a/src/librustc/ty/util.rs b/src/librustc/ty/util.rs index 7eb57466bbdcd..a9b2dbe1d95b0 100644 --- a/src/librustc/ty/util.rs +++ b/src/librustc/ty/util.rs @@ -51,10 +51,10 @@ impl<'tcx> fmt::Display for Discr<'tcx> { impl<'tcx> Discr<'tcx> { /// Adds `1` to the value and wraps around if the maximum for the type is reached. - pub fn wrap_incr<'a, 'gcx>(self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Self { + pub fn wrap_incr<'gcx>(self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Self { self.checked_add(tcx, 1).0 } - pub fn checked_add<'a, 'gcx>(self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, n: u128) -> (Self, bool) { + pub fn checked_add<'gcx>(self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, n: u128) -> (Self, bool) { let (int, signed) = match self.ty.sty { Int(ity) => (Integer::from_attr(&tcx, SignedInt(ity)), true), Uint(uty) => (Integer::from_attr(&tcx, UnsignedInt(uty)), false), @@ -104,14 +104,14 @@ impl<'tcx> Discr<'tcx> { } pub trait IntTypeExt { - fn to_ty<'a, 'gcx, 'tcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx>; - fn disr_incr<'a, 'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, val: Option>) + fn to_ty<'gcx, 'tcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx>; + fn disr_incr<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, val: Option>) -> Option>; - fn initial_discriminant<'a, 'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Discr<'tcx>; + fn initial_discriminant<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Discr<'tcx>; } impl IntTypeExt for attr::IntType { - fn to_ty<'a, 'gcx, 'tcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx> { + fn to_ty<'gcx, 'tcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx> { match *self { SignedInt(ast::IntTy::I8) => tcx.types.i8, SignedInt(ast::IntTy::I16) => tcx.types.i16, @@ -128,14 +128,14 @@ impl IntTypeExt for attr::IntType { } } - fn initial_discriminant<'a, 'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Discr<'tcx> { + fn initial_discriminant<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Discr<'tcx> { Discr { val: 0, ty: self.to_ty(tcx) } } - fn disr_incr<'a, 'tcx>( + fn disr_incr<'tcx>( &self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, val: Option>, @@ -178,7 +178,7 @@ pub enum Representability { } impl<'tcx> ty::ParamEnv<'tcx> { - pub fn can_type_implement_copy<'a>(self, + pub fn can_type_implement_copy(self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, self_type: Ty<'tcx>) -> Result<(), CopyImplementationError<'tcx>> { @@ -228,7 +228,7 @@ impl<'tcx> ty::ParamEnv<'tcx> { } } -impl<'a, 'tcx> TyCtxt<'tcx, 'tcx, 'tcx> { +impl<'tcx> TyCtxt<'tcx, 'tcx, 'tcx> { /// Creates a hash of the type `Ty` which will be the same no matter what crate /// context it's calculated within. This is used by the `type_id` intrinsic. pub fn type_id_hash(self, ty: Ty<'tcx>) -> u64 { @@ -249,7 +249,7 @@ impl<'a, 'tcx> TyCtxt<'tcx, 'tcx, 'tcx> { } } -impl<'a, 'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { pub fn has_error_field(self, ty: Ty<'tcx>) -> bool { if let ty::Adt(def, substs) = ty.sty { for field in def.all_fields() { @@ -687,7 +687,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { } } -impl<'a, 'tcx> ty::TyS<'tcx> { +impl<'tcx> ty::TyS<'tcx> { /// Checks whether values of this type `T` are *moved* or *copied* /// when referenced -- this amounts to a check for whether `T: /// Copy`, but note that we **don't** consider lifetimes when @@ -778,7 +778,7 @@ impl<'a, 'tcx> ty::TyS<'tcx> { }) } - fn are_inner_types_recursive<'a, 'tcx>( + fn are_inner_types_recursive<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, sp: Span, seen: &mut Vec>, representable_cache: &mut FxHashMap, Representability>, @@ -838,7 +838,7 @@ impl<'a, 'tcx> ty::TyS<'tcx> { // Does the type `ty` directly (without indirection through a pointer) // contain any types on stack `seen`? - fn is_type_structurally_recursive<'a, 'tcx>( + fn is_type_structurally_recursive<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, sp: Span, seen: &mut Vec>, @@ -859,7 +859,7 @@ impl<'a, 'tcx> ty::TyS<'tcx> { representability } - fn is_type_structurally_recursive_inner<'a, 'tcx>( + fn is_type_structurally_recursive_inner<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, sp: Span, seen: &mut Vec>, @@ -937,7 +937,7 @@ impl<'a, 'tcx> ty::TyS<'tcx> { } } -fn is_copy_raw<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn is_copy_raw<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, query: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool { @@ -953,7 +953,7 @@ fn is_copy_raw<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, )) } -fn is_sized_raw<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn is_sized_raw<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, query: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool { @@ -969,7 +969,7 @@ fn is_sized_raw<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, )) } -fn is_freeze_raw<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn is_freeze_raw<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, query: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool { @@ -988,7 +988,7 @@ fn is_freeze_raw<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, #[derive(Clone, HashStable)] pub struct NeedsDrop(pub bool); -fn needs_drop_raw<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn needs_drop_raw<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, query: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> NeedsDrop { diff --git a/src/librustc/ty/wf.rs b/src/librustc/ty/wf.rs index c6cc5030212dd..3bd0ddce5d271 100644 --- a/src/librustc/ty/wf.rs +++ b/src/librustc/ty/wf.rs @@ -508,7 +508,7 @@ impl<'a, 'gcx, 'tcx> WfPredicates<'a, 'gcx, 'tcx> { /// they declare `trait SomeTrait : 'static`, for example, then /// `'static` would appear in the list. The hard work is done by /// `ty::required_region_bounds`, see that for more information. -pub fn object_region_bounds<'a, 'gcx, 'tcx>( +pub fn object_region_bounds<'gcx, 'tcx>( tcx: TyCtxt<'tcx, 'gcx, 'tcx>, existential_predicates: ty::Binder<&'tcx ty::List>>) -> Vec> diff --git a/src/librustc_borrowck/borrowck/check_loans.rs b/src/librustc_borrowck/borrowck/check_loans.rs index ef46445952ab1..d76178d7eac68 100644 --- a/src/librustc_borrowck/borrowck/check_loans.rs +++ b/src/librustc_borrowck/borrowck/check_loans.rs @@ -179,7 +179,7 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for CheckLoanCtxt<'a, 'tcx> { fn decl_without_init(&mut self, _id: hir::HirId, _span: Span) { } } -pub fn check_loans<'a, 'b, 'c, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, +pub fn check_loans<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, dfcx_loans: &LoanDataFlow<'tcx>, move_data: &move_data::FlowedMoveData<'tcx>, all_loans: &[Loan<'tcx>], diff --git a/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs b/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs index 8654c3704326e..6d79a08608928 100644 --- a/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs +++ b/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs @@ -45,7 +45,7 @@ pub enum PatternSource<'tcx> { /// /// In this latter case, this function will return `PatternSource::LetDecl` /// with a reference to the let -fn get_pattern_source<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, pat: &Pat) -> PatternSource<'tcx> { +fn get_pattern_source<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, pat: &Pat) -> PatternSource<'tcx> { let parent = tcx.hir().get_parent_node_by_hir_id(pat.hir_id); diff --git a/src/librustc_borrowck/borrowck/mod.rs b/src/librustc_borrowck/borrowck/mod.rs index 623217f37adf6..00626c2f2b91c 100644 --- a/src/librustc_borrowck/borrowck/mod.rs +++ b/src/librustc_borrowck/borrowck/mod.rs @@ -53,7 +53,7 @@ pub struct LoanDataFlowOperator; pub type LoanDataFlow<'tcx> = DataFlowContext<'tcx, LoanDataFlowOperator>; -pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn check_crate<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { tcx.par_body_owners(|body_owner_def_id| { tcx.ensure().borrowck(body_owner_def_id); }); @@ -73,7 +73,7 @@ pub struct AnalysisData<'tcx> { pub move_data: move_data::FlowedMoveData<'tcx>, } -fn borrowck<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, owner_def_id: DefId) +fn borrowck<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, owner_def_id: DefId) -> &'tcx BorrowCheckResult { assert!(tcx.use_ast_borrowck() || tcx.migrate_borrowck()); diff --git a/src/librustc_borrowck/dataflow.rs b/src/librustc_borrowck/dataflow.rs index ba91676ec648c..037f1120d96b4 100644 --- a/src/librustc_borrowck/dataflow.rs +++ b/src/librustc_borrowck/dataflow.rs @@ -91,14 +91,14 @@ fn get_cfg_indices<'a>(id: hir::ItemLocalId, index.get(&id).map_or(&[], |v| &v[..]) } -impl<'a, 'tcx, O: DataFlowOperator> DataFlowContext<'tcx, O> { +impl<'tcx, O: DataFlowOperator> DataFlowContext<'tcx, O> { fn has_bitset_for_local_id(&self, n: hir::ItemLocalId) -> bool { assert!(n != hir::DUMMY_ITEM_LOCAL_ID); self.local_id_to_index.contains_key(&n) } } -impl<'a, 'tcx, O:DataFlowOperator> pprust::PpAnn for DataFlowContext<'tcx, O> { +impl<'tcx, O:DataFlowOperator> pprust::PpAnn for DataFlowContext<'tcx, O> { fn nested(&self, state: &mut pprust::State<'_>, nested: pprust::Nested) -> io::Result<()> { pprust::PpAnn::nested(self.tcx.hir(), state, nested) } @@ -224,7 +224,7 @@ pub enum KillFrom { Execution, } -impl<'a, 'tcx, O: DataFlowOperator> DataFlowContext<'tcx, O> { +impl<'tcx, O: DataFlowOperator> DataFlowContext<'tcx, O> { pub fn new(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, analysis_name: &'static str, body: Option<&hir::Body>, @@ -500,7 +500,7 @@ impl<'a, 'tcx, O: DataFlowOperator> DataFlowContext<'tcx, O> { } // N.B. `Clone + 'static` only needed for pretty printing. -impl<'a, 'tcx, O: DataFlowOperator + Clone + 'static> DataFlowContext<'tcx, O> { +impl<'tcx, O: DataFlowOperator + Clone + 'static> DataFlowContext<'tcx, O> { pub fn propagate(&mut self, cfg: &cfg::CFG, body: &hir::Body) { //! Performs the data flow analysis. diff --git a/src/librustc_codegen_ssa/back/symbol_export.rs b/src/librustc_codegen_ssa/back/symbol_export.rs index 845adf0a268b1..8d6652d05df5f 100644 --- a/src/librustc_codegen_ssa/back/symbol_export.rs +++ b/src/librustc_codegen_ssa/back/symbol_export.rs @@ -46,7 +46,7 @@ pub fn crates_export_threshold(crate_types: &[config::CrateType]) -> SymbolExpor } } -fn reachable_non_generics_provider<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn reachable_non_generics_provider<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, cnum: CrateNum) -> &'tcx DefIdMap { @@ -157,7 +157,7 @@ fn reachable_non_generics_provider<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, tcx.arena.alloc(reachable_non_generics) } -fn is_reachable_non_generic_provider_local<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn is_reachable_non_generic_provider_local<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> bool { let export_threshold = threshold(tcx); @@ -169,13 +169,13 @@ fn is_reachable_non_generic_provider_local<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tc } } -fn is_reachable_non_generic_provider_extern<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn is_reachable_non_generic_provider_extern<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> bool { tcx.reachable_non_generics(def_id.krate).contains_key(&def_id) } -fn exported_symbols_provider_local<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn exported_symbols_provider_local<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, cnum: CrateNum) -> Arc, SymbolExportLevel)>> @@ -278,7 +278,7 @@ fn exported_symbols_provider_local<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, Arc::new(symbols) } -fn upstream_monomorphizations_provider<'a, 'tcx>( +fn upstream_monomorphizations_provider<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, cnum: CrateNum) -> &'tcx DefIdMap, CrateNum>> @@ -328,7 +328,7 @@ fn upstream_monomorphizations_provider<'a, 'tcx>( tcx.arena.alloc(instances) } -fn upstream_monomorphizations_for_provider<'a, 'tcx>( +fn upstream_monomorphizations_for_provider<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> Option<&'tcx FxHashMap, CrateNum>> diff --git a/src/librustc_codegen_ssa/base.rs b/src/librustc_codegen_ssa/base.rs index 4eff29f502257..b80f01467af0b 100644 --- a/src/librustc_codegen_ssa/base.rs +++ b/src/librustc_codegen_ssa/base.rs @@ -703,7 +703,7 @@ impl Drop for AbortCodegenOnDrop { } } -fn assert_and_save_dep_graph<'ll, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +fn assert_and_save_dep_graph<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { time(tcx.sess, "assert dep graph", || ::rustc_incremental::assert_dep_graph(tcx)); @@ -850,7 +850,7 @@ pub fn provide_both(providers: &mut Providers<'_>) { }; } -fn determine_cgu_reuse<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn determine_cgu_reuse<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, cgu: &CodegenUnit<'tcx>) -> CguReuse { if !tcx.dep_graph.is_fully_enabled() { diff --git a/src/librustc_codegen_ssa/debuginfo/type_names.rs b/src/librustc_codegen_ssa/debuginfo/type_names.rs index df7c33fb2dee0..695a1c1cbcf88 100644 --- a/src/librustc_codegen_ssa/debuginfo/type_names.rs +++ b/src/librustc_codegen_ssa/debuginfo/type_names.rs @@ -8,7 +8,7 @@ use rustc_data_structures::fx::FxHashSet; // any caching, i.e., calling the function twice with the same type will also do // the work twice. The `qualified` parameter only affects the first level of the // type name, further levels (i.e., type parameters) are always fully qualified. -pub fn compute_debuginfo_type_name<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn compute_debuginfo_type_name<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, t: Ty<'tcx>, qualified: bool) -> String { @@ -20,7 +20,7 @@ pub fn compute_debuginfo_type_name<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, // Pushes the name of the type as it should be stored in debuginfo on the // `output` String. See also compute_debuginfo_type_name(). -pub fn push_debuginfo_type_name<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn push_debuginfo_type_name<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, t: Ty<'tcx>, qualified: bool, output: &mut String, @@ -228,7 +228,7 @@ pub fn push_debuginfo_type_name<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, // reconstructed for items from non-local crates. For local crates, this // would be possible but with inlining and LTO we have to use the least // common denominator - otherwise we would run into conflicts. - fn push_type_params<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + fn push_type_params<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, substs: SubstsRef<'tcx>, output: &mut String, visited: &mut FxHashSet>) { diff --git a/src/librustc_codegen_ssa/traits/backend.rs b/src/librustc_codegen_ssa/traits/backend.rs index 64a4c922500ec..40333874c0007 100644 --- a/src/librustc_codegen_ssa/traits/backend.rs +++ b/src/librustc_codegen_ssa/traits/backend.rs @@ -32,13 +32,13 @@ impl<'tcx, T> Backend<'tcx> for T where pub trait ExtraBackendMethods: CodegenBackend + WriteBackendMethods + Sized + Send { fn new_metadata(&self, sess: TyCtxt<'_, '_, '_>, mod_name: &str) -> Self::Module; - fn write_compressed_metadata<'b, 'gcx>( + fn write_compressed_metadata<'gcx>( &self, tcx: TyCtxt<'gcx, 'gcx, 'gcx>, metadata: &EncodedMetadata, llvm_module: &mut Self::Module, ); - fn codegen_allocator<'b, 'gcx>( + fn codegen_allocator<'gcx>( &self, tcx: TyCtxt<'gcx, 'gcx, 'gcx>, mods: &mut Self::Module, diff --git a/src/librustc_codegen_utils/codegen_backend.rs b/src/librustc_codegen_utils/codegen_backend.rs index 472b88b5b6686..e29bb751b9a09 100644 --- a/src/librustc_codegen_utils/codegen_backend.rs +++ b/src/librustc_codegen_utils/codegen_backend.rs @@ -34,7 +34,7 @@ pub trait CodegenBackend { fn metadata_loader(&self) -> Box; fn provide(&self, _providers: &mut Providers<'_>); fn provide_extern(&self, _providers: &mut Providers<'_>); - fn codegen_crate<'a, 'tcx>( + fn codegen_crate<'tcx>( &self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, metadata: EncodedMetadata, diff --git a/src/librustc_codegen_utils/symbol_names/legacy.rs b/src/librustc_codegen_utils/symbol_names/legacy.rs index c7729f28beb60..41e972f869f7d 100644 --- a/src/librustc_codegen_utils/symbol_names/legacy.rs +++ b/src/librustc_codegen_utils/symbol_names/legacy.rs @@ -68,7 +68,7 @@ pub(super) fn mangle( printer.path.finish(hash) } -fn get_symbol_hash<'a, 'tcx>( +fn get_symbol_hash<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, // instance this name will be for diff --git a/src/librustc_codegen_utils/symbol_names_test.rs b/src/librustc_codegen_utils/symbol_names_test.rs index b2d77e21200c0..3d82557d4c5b1 100644 --- a/src/librustc_codegen_utils/symbol_names_test.rs +++ b/src/librustc_codegen_utils/symbol_names_test.rs @@ -11,7 +11,7 @@ use syntax::symbol::{Symbol, sym}; const SYMBOL_NAME: Symbol = sym::rustc_symbol_name; const DEF_PATH: Symbol = sym::rustc_def_path; -pub fn report_symbol_names<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn report_symbol_names<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { // if the `rustc_attrs` feature is not enabled, then the // attributes we are interested in cannot be present anyway, so // skip the walk. diff --git a/src/librustc_driver/pretty.rs b/src/librustc_driver/pretty.rs index e185fa36fb4cb..64d405721807f 100644 --- a/src/librustc_driver/pretty.rs +++ b/src/librustc_driver/pretty.rs @@ -617,7 +617,7 @@ impl UserIdentifiedItem { } } -fn print_flowgraph<'a, 'tcx, W: Write>(variants: Vec, +fn print_flowgraph<'tcx, W: Write>(variants: Vec, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, code: blocks::Code<'tcx>, mode: PpFlowGraphMode, diff --git a/src/librustc_incremental/assert_dep_graph.rs b/src/librustc_incremental/assert_dep_graph.rs index 78dfef1d4c6ba..a43a508ba96e7 100644 --- a/src/librustc_incremental/assert_dep_graph.rs +++ b/src/librustc_incremental/assert_dep_graph.rs @@ -51,7 +51,7 @@ use std::io::Write; use syntax::ast; use syntax_pos::Span; -pub fn assert_dep_graph<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn assert_dep_graph<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { tcx.dep_graph.with_ignore(|| { if tcx.sess.opts.debugging_opts.dump_dep_graph { dump_graph(tcx); @@ -184,7 +184,7 @@ impl Visitor<'tcx> for IfThisChanged<'tcx> { } } -fn check_paths<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn check_paths<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, if_this_changed: &Sources, then_this_would_need: &Targets) { diff --git a/src/librustc_incremental/assert_module_sources.rs b/src/librustc_incremental/assert_module_sources.rs index 8cffa4b8284f9..7f1a9f8b88e53 100644 --- a/src/librustc_incremental/assert_module_sources.rs +++ b/src/librustc_incremental/assert_module_sources.rs @@ -35,7 +35,7 @@ const MODULE: Symbol = sym::module; const CFG: Symbol = sym::cfg; const KIND: Symbol = sym::kind; -pub fn assert_module_sources<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn assert_module_sources<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { tcx.dep_graph.with_ignore(|| { if tcx.sess.opts.incremental.is_none() { return; diff --git a/src/librustc_incremental/persist/dirty_clean.rs b/src/librustc_incremental/persist/dirty_clean.rs index 06fe5750f9d82..e28ee041bff36 100644 --- a/src/librustc_incremental/persist/dirty_clean.rs +++ b/src/librustc_incremental/persist/dirty_clean.rs @@ -206,7 +206,7 @@ impl Assertion { } } -pub fn check_dirty_clean_annotations<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn check_dirty_clean_annotations<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { // can't add `#[rustc_dirty]` etc without opting in to this feature if !tcx.features().rustc_attrs { return; diff --git a/src/librustc_incremental/persist/load.rs b/src/librustc_incremental/persist/load.rs index 5146453c74665..afcd4c01dbd09 100644 --- a/src/librustc_incremental/persist/load.rs +++ b/src/librustc_incremental/persist/load.rs @@ -15,7 +15,7 @@ use super::fs::*; use super::file_format; use super::work_product; -pub fn dep_graph_tcx_init<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn dep_graph_tcx_init<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { if !tcx.dep_graph.is_fully_enabled() { return } diff --git a/src/librustc_incremental/persist/save.rs b/src/librustc_incremental/persist/save.rs index 8e4c0133b4279..27133b87d32a1 100644 --- a/src/librustc_incremental/persist/save.rs +++ b/src/librustc_incremental/persist/save.rs @@ -15,7 +15,7 @@ use super::dirty_clean; use super::file_format; use super::work_product; -pub fn save_dep_graph<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn save_dep_graph<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { debug!("save_dep_graph()"); tcx.dep_graph.with_ignore(|| { let sess = tcx.sess; diff --git a/src/librustc_lint/types.rs b/src/librustc_lint/types.rs index 13e620b6b01f3..0bb5457d32860 100644 --- a/src/librustc_lint/types.rs +++ b/src/librustc_lint/types.rs @@ -519,11 +519,11 @@ enum FfiResult<'tcx> { }, } -fn is_zst<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, did: DefId, ty: Ty<'tcx>) -> bool { +fn is_zst<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, did: DefId, ty: Ty<'tcx>) -> bool { tcx.layout_of(tcx.param_env(did).and(ty)).map(|layout| layout.is_zst()).unwrap_or(false) } -fn ty_is_known_nonnull<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ty: Ty<'tcx>) -> bool { +fn ty_is_known_nonnull<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ty: Ty<'tcx>) -> bool { match ty.sty { ty::FnPtr(_) => true, ty::Ref(..) => true, @@ -555,7 +555,7 @@ fn ty_is_known_nonnull<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ty: Ty<'tcx>) -> /// to function pointers, references, core::num::NonZero*, /// core::ptr::NonNull, and #[repr(transparent)] newtypes. /// FIXME: This duplicates code in codegen. -fn is_repr_nullable_ptr<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn is_repr_nullable_ptr<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ty: Ty<'tcx>, ty_def: &'tcx ty::AdtDef, substs: SubstsRef<'tcx>) diff --git a/src/librustc_metadata/cstore_impl.rs b/src/librustc_metadata/cstore_impl.rs index 9ab482895d9a7..87ca766bbaa93 100644 --- a/src/librustc_metadata/cstore_impl.rs +++ b/src/librustc_metadata/cstore_impl.rs @@ -550,7 +550,7 @@ impl CrateStore for cstore::CStore { self.do_postorder_cnums_untracked() } - fn encode_metadata<'a, 'tcx>(&self, + fn encode_metadata<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> EncodedMetadata { diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs index 7fbf50e6b5322..b7b9a739371e1 100644 --- a/src/librustc_metadata/encoder.rs +++ b/src/librustc_metadata/encoder.rs @@ -65,7 +65,7 @@ macro_rules! encoder_methods { } } -impl<'a, 'tcx> Encoder for EncodeContext<'tcx> { +impl<'tcx> Encoder for EncodeContext<'tcx> { type Error = ::Error; fn emit_unit(&mut self) -> Result<(), Self::Error> { diff --git a/src/librustc_metadata/foreign_modules.rs b/src/librustc_metadata/foreign_modules.rs index eb5a6485d2565..f3e1e3ad80d89 100644 --- a/src/librustc_metadata/foreign_modules.rs +++ b/src/librustc_metadata/foreign_modules.rs @@ -3,7 +3,7 @@ use rustc::hir; use rustc::middle::cstore::ForeignModule; use rustc::ty::TyCtxt; -pub fn collect<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Vec { +pub fn collect<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Vec { let mut collector = Collector { tcx, modules: Vec::new(), diff --git a/src/librustc_metadata/link_args.rs b/src/librustc_metadata/link_args.rs index 851c2d3ea1218..7e99e3d8a4c3c 100644 --- a/src/librustc_metadata/link_args.rs +++ b/src/librustc_metadata/link_args.rs @@ -4,7 +4,7 @@ use rustc::ty::TyCtxt; use rustc_target::spec::abi::Abi; use syntax::symbol::sym; -pub fn collect<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Vec { +pub fn collect<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Vec { let mut collector = Collector { args: Vec::new(), }; diff --git a/src/librustc_metadata/native_libs.rs b/src/librustc_metadata/native_libs.rs index 0817cce90dfea..801acbfd34699 100644 --- a/src/librustc_metadata/native_libs.rs +++ b/src/librustc_metadata/native_libs.rs @@ -11,7 +11,7 @@ use syntax::feature_gate::{self, GateIssue}; use syntax::symbol::{Symbol, sym}; use syntax::{span_err, struct_span_err}; -pub fn collect<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Vec { +pub fn collect<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Vec { let mut collector = Collector { tcx, libs: Vec::new(), diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs index aa298659d72f2..1bcdf22672093 100644 --- a/src/librustc_mir/borrow_check/mod.rs +++ b/src/librustc_mir/borrow_check/mod.rs @@ -87,7 +87,7 @@ pub fn provide(providers: &mut Providers<'_>) { }; } -fn mir_borrowck<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> BorrowCheckResult<'tcx> { +fn mir_borrowck<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> BorrowCheckResult<'tcx> { let input_body = tcx.mir_validated(def_id); debug!("run query mir_borrowck: {}", tcx.def_path_str(def_id)); diff --git a/src/librustc_mir/borrow_check/mutability_errors.rs b/src/librustc_mir/borrow_check/mutability_errors.rs index 8452d1654d8a1..38e6e55e40a97 100644 --- a/src/librustc_mir/borrow_check/mutability_errors.rs +++ b/src/librustc_mir/borrow_check/mutability_errors.rs @@ -522,7 +522,7 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> { } } -fn suggest_ampmut_self<'cx, 'gcx, 'tcx>( +fn suggest_ampmut_self<'gcx, 'tcx>( tcx: TyCtxt<'tcx, 'gcx, 'tcx>, local_decl: &mir::LocalDecl<'tcx>, ) -> (Span, String) { @@ -555,7 +555,7 @@ fn suggest_ampmut_self<'cx, 'gcx, 'tcx>( // // This implementation attempts to emulate AST-borrowck prioritization // by trying (3.), then (2.) and finally falling back on (1.). -fn suggest_ampmut<'cx, 'gcx, 'tcx>( +fn suggest_ampmut<'gcx, 'tcx>( tcx: TyCtxt<'tcx, 'gcx, 'tcx>, body: &Body<'tcx>, local: Local, diff --git a/src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs b/src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs index 143bdeb6f61e8..534a91d39a0ce 100644 --- a/src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs +++ b/src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs @@ -51,7 +51,7 @@ impl BorrowExplanation { _ => true, } } - pub(in crate::borrow_check) fn add_explanation_to_diagnostic<'cx, 'gcx, 'tcx>( + pub(in crate::borrow_check) fn add_explanation_to_diagnostic<'gcx, 'tcx>( &self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, body: &Body<'tcx>, diff --git a/src/librustc_mir/borrow_check/nll/invalidation.rs b/src/librustc_mir/borrow_check/nll/invalidation.rs index a870227c762d1..5a8de5c9dbdda 100644 --- a/src/librustc_mir/borrow_check/nll/invalidation.rs +++ b/src/librustc_mir/borrow_check/nll/invalidation.rs @@ -17,7 +17,7 @@ use rustc::mir::TerminatorKind; use rustc::mir::{Operand, BorrowKind}; use rustc_data_structures::graph::dominators::Dominators; -pub(super) fn generate_invalidates<'cx, 'gcx, 'tcx>( +pub(super) fn generate_invalidates<'gcx, 'tcx>( tcx: TyCtxt<'tcx, 'gcx, 'tcx>, all_facts: &mut Option, location_table: &LocationTable, diff --git a/src/librustc_mir/borrow_check/path_utils.rs b/src/librustc_mir/borrow_check/path_utils.rs index 8377a0910a99c..44d2916daa584 100644 --- a/src/librustc_mir/borrow_check/path_utils.rs +++ b/src/librustc_mir/borrow_check/path_utils.rs @@ -22,7 +22,7 @@ pub(super) enum Control { } /// Encapsulates the idea of iterating over every borrow that involves a particular path -pub(super) fn each_borrow_involving_path<'a, 'tcx, 'gcx: 'tcx, F, I, S> ( +pub(super) fn each_borrow_involving_path<'tcx, 'gcx: 'tcx, F, I, S> ( s: &mut S, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, body: &Body<'tcx>, diff --git a/src/librustc_mir/borrow_check/places_conflict.rs b/src/librustc_mir/borrow_check/places_conflict.rs index cc9bcdc7f6202..858ca958ca186 100644 --- a/src/librustc_mir/borrow_check/places_conflict.rs +++ b/src/librustc_mir/borrow_check/places_conflict.rs @@ -298,7 +298,7 @@ fn place_components_conflict<'gcx, 'tcx>( // Given that the bases of `elem1` and `elem2` are always either equal // or disjoint (and have the same type!), return the overlap situation // between `elem1` and `elem2`. -fn place_base_conflict<'a, 'gcx: 'tcx, 'tcx>( +fn place_base_conflict<'gcx: 'tcx, 'tcx>( tcx: TyCtxt<'tcx, 'gcx, 'tcx>, elem1: &PlaceBase<'tcx>, elem2: &PlaceBase<'tcx>, @@ -365,7 +365,7 @@ fn place_base_conflict<'a, 'gcx: 'tcx, 'tcx>( // Given that the bases of `elem1` and `elem2` are always either equal // or disjoint (and have the same type!), return the overlap situation // between `elem1` and `elem2`. -fn place_projection_conflict<'a, 'gcx: 'tcx, 'tcx>( +fn place_projection_conflict<'gcx: 'tcx, 'tcx>( tcx: TyCtxt<'tcx, 'gcx, 'tcx>, body: &Body<'tcx>, pi1: &Projection<'tcx>, diff --git a/src/librustc_mir/build/mod.rs b/src/librustc_mir/build/mod.rs index aa43d161b6c18..564e2ddc64b3f 100644 --- a/src/librustc_mir/build/mod.rs +++ b/src/librustc_mir/build/mod.rs @@ -25,7 +25,7 @@ use syntax_pos::Span; use super::lints; /// Construct the MIR for a given `DefId`. -pub fn mir_build<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> Body<'tcx> { +pub fn mir_build<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> Body<'tcx> { let id = tcx.hir().as_local_hir_id(def_id).unwrap(); // Figure out what primary body this item has. @@ -234,7 +234,7 @@ impl<'gcx: 'tcx, 'tcx> MutVisitor<'tcx> for GlobalizeMir<'gcx> { /////////////////////////////////////////////////////////////////////////// // BuildMir -- walks a crate, looking for fn items and methods to build MIR from -fn liberated_closure_env_ty<'a, 'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, +fn liberated_closure_env_ty<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, closure_expr_id: hir::HirId, body_id: hir::BodyId) -> Ty<'tcx> { @@ -551,7 +551,7 @@ macro_rules! unpack { }; } -fn should_abort_on_panic<'a, 'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, +fn should_abort_on_panic<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, fn_def_id: DefId, abi: Abi) -> bool { diff --git a/src/librustc_mir/dataflow/drop_flag_effects.rs b/src/librustc_mir/dataflow/drop_flag_effects.rs index dbe5ab902d799..f7cc8c22b0451 100644 --- a/src/librustc_mir/dataflow/drop_flag_effects.rs +++ b/src/librustc_mir/dataflow/drop_flag_effects.rs @@ -46,7 +46,7 @@ pub fn move_path_children_matching<'tcx, F>(move_data: &MoveData<'tcx>, /// is no need to maintain separate drop flags to track such state. // // FIXME: we have to do something for moving slice patterns. -fn place_contents_drop_state_cannot_differ<'a, 'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, +fn place_contents_drop_state_cannot_differ<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, body: &Body<'tcx>, place: &mir::Place<'tcx>) -> bool { let ty = place.ty(body, tcx).ty; @@ -72,7 +72,7 @@ fn place_contents_drop_state_cannot_differ<'a, 'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gc } } -pub(crate) fn on_lookup_result_bits<'a, 'gcx, 'tcx, F>( +pub(crate) fn on_lookup_result_bits<'gcx, 'tcx, F>( tcx: TyCtxt<'tcx, 'gcx, 'tcx>, body: &Body<'tcx>, move_data: &MoveData<'tcx>, @@ -90,7 +90,7 @@ pub(crate) fn on_lookup_result_bits<'a, 'gcx, 'tcx, F>( } } -pub(crate) fn on_all_children_bits<'a, 'gcx, 'tcx, F>( +pub(crate) fn on_all_children_bits<'gcx, 'tcx, F>( tcx: TyCtxt<'tcx, 'gcx, 'tcx>, body: &Body<'tcx>, move_data: &MoveData<'tcx>, @@ -98,7 +98,7 @@ pub(crate) fn on_all_children_bits<'a, 'gcx, 'tcx, F>( mut each_child: F) where F: FnMut(MovePathIndex) { - fn is_terminal_path<'a, 'gcx, 'tcx>( + fn is_terminal_path<'gcx, 'tcx>( tcx: TyCtxt<'tcx, 'gcx, 'tcx>, body: &Body<'tcx>, move_data: &MoveData<'tcx>, @@ -108,7 +108,7 @@ pub(crate) fn on_all_children_bits<'a, 'gcx, 'tcx, F>( tcx, body, &move_data.move_paths[path].place) } - fn on_all_children_bits<'a, 'gcx, 'tcx, F>( + fn on_all_children_bits<'gcx, 'tcx, F>( tcx: TyCtxt<'tcx, 'gcx, 'tcx>, body: &Body<'tcx>, move_data: &MoveData<'tcx>, @@ -131,7 +131,7 @@ pub(crate) fn on_all_children_bits<'a, 'gcx, 'tcx, F>( on_all_children_bits(tcx, body, move_data, move_path_index, &mut each_child); } -pub(crate) fn on_all_drop_children_bits<'a, 'gcx, 'tcx, F>( +pub(crate) fn on_all_drop_children_bits<'gcx, 'tcx, F>( tcx: TyCtxt<'tcx, 'gcx, 'tcx>, body: &Body<'tcx>, ctxt: &MoveDataParamEnv<'gcx, 'tcx>, @@ -154,7 +154,7 @@ pub(crate) fn on_all_drop_children_bits<'a, 'gcx, 'tcx, F>( }) } -pub(crate) fn drop_flag_effects_for_function_entry<'a, 'gcx, 'tcx, F>( +pub(crate) fn drop_flag_effects_for_function_entry<'gcx, 'tcx, F>( tcx: TyCtxt<'tcx, 'gcx, 'tcx>, body: &Body<'tcx>, ctxt: &MoveDataParamEnv<'gcx, 'tcx>, @@ -171,7 +171,7 @@ pub(crate) fn drop_flag_effects_for_function_entry<'a, 'gcx, 'tcx, F>( } } -pub(crate) fn drop_flag_effects_for_location<'a, 'gcx, 'tcx, F>( +pub(crate) fn drop_flag_effects_for_location<'gcx, 'tcx, F>( tcx: TyCtxt<'tcx, 'gcx, 'tcx>, body: &Body<'tcx>, ctxt: &MoveDataParamEnv<'gcx, 'tcx>, @@ -203,7 +203,7 @@ pub(crate) fn drop_flag_effects_for_location<'a, 'gcx, 'tcx, F>( ); } -pub(crate) fn for_location_inits<'a, 'gcx, 'tcx, F>( +pub(crate) fn for_location_inits<'gcx, 'tcx, F>( tcx: TyCtxt<'tcx, 'gcx, 'tcx>, body: &Body<'tcx>, move_data: &MoveData<'tcx>, diff --git a/src/librustc_mir/dataflow/move_paths/builder.rs b/src/librustc_mir/dataflow/move_paths/builder.rs index 76926fbd6c476..ecc252adb6dc0 100644 --- a/src/librustc_mir/dataflow/move_paths/builder.rs +++ b/src/librustc_mir/dataflow/move_paths/builder.rs @@ -202,7 +202,7 @@ impl<'a, 'gcx, 'tcx> MoveDataBuilder<'a, 'gcx, 'tcx> { } } -pub(super) fn gather_moves<'a, 'gcx, 'tcx>( +pub(super) fn gather_moves<'gcx, 'tcx>( body: &Body<'tcx>, tcx: TyCtxt<'tcx, 'gcx, 'tcx> ) -> Result, (MoveData<'tcx>, Vec<(Place<'tcx>, MoveError<'tcx>)>)> { diff --git a/src/librustc_mir/dataflow/move_paths/mod.rs b/src/librustc_mir/dataflow/move_paths/mod.rs index 315f68b3a5132..2d8d3a28fd6f1 100644 --- a/src/librustc_mir/dataflow/move_paths/mod.rs +++ b/src/librustc_mir/dataflow/move_paths/mod.rs @@ -305,7 +305,7 @@ impl<'tcx> MoveError<'tcx> { } } -impl<'a, 'gcx, 'tcx> MoveData<'tcx> { +impl<'gcx, 'tcx> MoveData<'tcx> { pub fn gather_moves(body: &Body<'tcx>, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Result, MoveError<'tcx>)>)> { builder::gather_moves(body, tcx) diff --git a/src/librustc_mir/hair/constant.rs b/src/librustc_mir/hair/constant.rs index e8c274177e6d0..04eeb6333fd93 100644 --- a/src/librustc_mir/hair/constant.rs +++ b/src/librustc_mir/hair/constant.rs @@ -9,7 +9,7 @@ crate enum LitToConstError { Reported, } -crate fn lit_to_const<'a, 'gcx, 'tcx>( +crate fn lit_to_const<'gcx, 'tcx>( lit: &'tcx ast::LitKind, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, ty: Ty<'tcx>, diff --git a/src/librustc_mir/hair/pattern/_match.rs b/src/librustc_mir/hair/pattern/_match.rs index a13a6aaaf9194..7a1fd7843a6ee 100644 --- a/src/librustc_mir/hair/pattern/_match.rs +++ b/src/librustc_mir/hair/pattern/_match.rs @@ -1630,7 +1630,7 @@ fn constructor_intersects_pattern<'p, 'a: 'p, 'tcx: 'a>( } } -fn constructor_covered_by_range<'a, 'tcx>( +fn constructor_covered_by_range<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ctor: &Constructor<'tcx>, pat: &Pattern<'tcx>, diff --git a/src/librustc_mir/hair/pattern/check_match.rs b/src/librustc_mir/hair/pattern/check_match.rs index fa71611e230bf..9b85ea53fa3ec 100644 --- a/src/librustc_mir/hair/pattern/check_match.rs +++ b/src/librustc_mir/hair/pattern/check_match.rs @@ -26,7 +26,7 @@ use std::slice; use syntax::ptr::P; use syntax_pos::{Span, DUMMY_SP, MultiSpan}; -pub(crate) fn check_match<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { +pub(crate) fn check_match<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { let body_id = if let Some(id) = tcx.hir().as_local_hir_id(def_id) { tcx.hir().body_owned_by(id) } else { diff --git a/src/librustc_mir/hair/pattern/mod.rs b/src/librustc_mir/hair/pattern/mod.rs index 00c1568ebe914..1a69f37ac2ded 100644 --- a/src/librustc_mir/hair/pattern/mod.rs +++ b/src/librustc_mir/hair/pattern/mod.rs @@ -1242,7 +1242,7 @@ impl<'tcx> PatternFoldable<'tcx> for PatternKind<'tcx> { } } -pub fn compare_const_vals<'a, 'gcx, 'tcx>( +pub fn compare_const_vals<'gcx, 'tcx>( tcx: TyCtxt<'tcx, 'gcx, 'tcx>, a: &'tcx ty::Const<'tcx>, b: &'tcx ty::Const<'tcx>, diff --git a/src/librustc_mir/interpret/intrinsics/type_name.rs b/src/librustc_mir/interpret/intrinsics/type_name.rs index 5ef5899e60eef..2ce3fef38f54f 100644 --- a/src/librustc_mir/interpret/intrinsics/type_name.rs +++ b/src/librustc_mir/interpret/intrinsics/type_name.rs @@ -212,7 +212,7 @@ impl Write for AbsolutePathPrinter<'_> { /// Produces an absolute path representation of the given type. See also the documentation on /// `std::any::type_name` -pub fn type_name<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ty: Ty<'tcx>) -> &'tcx ty::Const<'tcx> { +pub fn type_name<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ty: Ty<'tcx>) -> &'tcx ty::Const<'tcx> { let alloc = alloc_type_name(tcx, ty); tcx.mk_const(ty::Const { val: ConstValue::Slice { @@ -225,7 +225,7 @@ pub fn type_name<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ty: Ty<'tcx>) -> &'tcx } /// Directly returns an `Allocation` containing an absolute path representation of the given type. -pub(super) fn alloc_type_name<'a, 'tcx>( +pub(super) fn alloc_type_name<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ty: Ty<'tcx> ) -> &'tcx Allocation { diff --git a/src/librustc_mir/interpret/snapshot.rs b/src/librustc_mir/interpret/snapshot.rs index 6e687af3119e3..15ef05ca8cea4 100644 --- a/src/librustc_mir/interpret/snapshot.rs +++ b/src/librustc_mir/interpret/snapshot.rs @@ -45,7 +45,7 @@ pub(crate) struct InfiniteLoopDetector<'mir, 'tcx> { impl<'mir, 'tcx> InfiniteLoopDetector<'mir, 'tcx> { - pub fn observe_and_analyze<'b>( + pub fn observe_and_analyze( &mut self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, span: Span, diff --git a/src/librustc_mir/monomorphize/collector.rs b/src/librustc_mir/monomorphize/collector.rs index 87aec1a22d930..641f1f47ea407 100644 --- a/src/librustc_mir/monomorphize/collector.rs +++ b/src/librustc_mir/monomorphize/collector.rs @@ -281,7 +281,7 @@ impl<'tcx> InliningMap<'tcx> { } } -pub fn collect_crate_mono_items<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn collect_crate_mono_items<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, mode: MonoItemCollectionMode) -> (FxHashSet>, InliningMap<'tcx>) { @@ -315,7 +315,7 @@ pub fn collect_crate_mono_items<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, // Find all non-generic items by walking the HIR. These items serve as roots to // start monomorphizing from. -fn collect_roots<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn collect_roots<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, mode: MonoItemCollectionMode) -> Vec> { debug!("Collecting roots"); @@ -413,7 +413,7 @@ fn collect_items_rec<'a, 'tcx: 'a>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, debug!("END collect_items_rec({})", starting_point.to_string(tcx, true)); } -fn record_accesses<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn record_accesses<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, caller: MonoItem<'tcx>, callees: &[MonoItem<'tcx>], inlining_map: MTRef<'_, MTLock>>) { @@ -429,7 +429,7 @@ fn record_accesses<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, inlining_map.lock_mut().record_accesses(caller, accesses); } -fn check_recursion_limit<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn check_recursion_limit<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, instance: Instance<'tcx>, recursion_depths: &mut DefIdMap) -> (DefId, usize) { @@ -463,7 +463,7 @@ fn check_recursion_limit<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, (def_id, recursion_depth) } -fn check_type_length_limit<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn check_type_length_limit<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, instance: Instance<'tcx>) { let type_length = instance.substs.types().flat_map(|ty| ty.walk()).count(); @@ -679,7 +679,7 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> { } } -fn visit_drop_use<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn visit_drop_use<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ty: Ty<'tcx>, is_direct_call: bool, output: &mut Vec>) @@ -688,7 +688,7 @@ fn visit_drop_use<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, visit_instance_use(tcx, instance, is_direct_call, output); } -fn visit_fn_use<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn visit_fn_use<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ty: Ty<'tcx>, is_direct_call: bool, output: &mut Vec>) @@ -702,7 +702,7 @@ fn visit_fn_use<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } } -fn visit_instance_use<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn visit_instance_use<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, instance: ty::Instance<'tcx>, is_direct_call: bool, output: &mut Vec>) @@ -741,7 +741,7 @@ fn visit_instance_use<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, // Returns true if we should codegen an instance in the local crate. // Returns false if we can just link to the upstream crate and therefore don't // need a mono item. -fn should_monomorphize_locally<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, instance: &Instance<'tcx>) +fn should_monomorphize_locally<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, instance: &Instance<'tcx>) -> bool { let def_id = match instance.def { ty::InstanceDef::Item(def_id) => def_id, @@ -776,7 +776,7 @@ fn should_monomorphize_locally<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, instance } return true; - fn is_available_upstream_generic<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + fn is_available_upstream_generic<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, substs: SubstsRef<'tcx>) -> bool { @@ -841,7 +841,7 @@ fn should_monomorphize_locally<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, instance /// /// Finally, there is also the case of custom unsizing coercions, e.g., for /// smart pointers such as `Rc` and `Arc`. -fn find_vtable_types_for_unsizing<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn find_vtable_types_for_unsizing<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, source_ty: Ty<'tcx>, target_ty: Ty<'tcx>) -> (Ty<'tcx>, Ty<'tcx>) { @@ -914,7 +914,7 @@ fn create_fn_mono_item<'tcx>(instance: Instance<'tcx>) -> MonoItem<'tcx> { /// Creates a `MonoItem` for each method that is referenced by the vtable for /// the given trait/impl pair. -fn create_mono_items_for_vtable_methods<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn create_mono_items_for_vtable_methods<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, trait_ty: Ty<'tcx>, impl_ty: Ty<'tcx>, output: &mut Vec>) { @@ -1107,12 +1107,12 @@ impl RootCollector<'_, 'v> { } } -fn item_requires_monomorphization<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> bool { +fn item_requires_monomorphization<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> bool { let generics = tcx.generics_of(def_id); generics.requires_monomorphization(tcx) } -fn create_mono_items_for_default_impls<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn create_mono_items_for_default_impls<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item: &'tcx hir::Item, output: &mut Vec>) { match item.node { @@ -1176,7 +1176,7 @@ fn create_mono_items_for_default_impls<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } /// Scan the miri alloc in order to find function calls, closures, and drop-glue -fn collect_miri<'a, 'tcx>( +fn collect_miri<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, alloc_id: AllocId, output: &mut Vec>, @@ -1207,7 +1207,7 @@ fn collect_miri<'a, 'tcx>( } /// Scan the MIR in order to find function calls, closures, and drop-glue -fn collect_neighbours<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn collect_neighbours<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, instance: Instance<'tcx>, output: &mut Vec>) { @@ -1237,7 +1237,7 @@ fn collect_neighbours<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } } -fn def_id_to_string<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn def_id_to_string<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> String { let mut output = String::new(); @@ -1246,7 +1246,7 @@ fn def_id_to_string<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, output } -fn collect_const<'a, 'tcx>( +fn collect_const<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, constant: &'tcx ty::Const<'tcx>, param_substs: SubstsRef<'tcx>, diff --git a/src/librustc_mir/monomorphize/mod.rs b/src/librustc_mir/monomorphize/mod.rs index 2a349077ddb3f..1e9b13cc60c21 100644 --- a/src/librustc_mir/monomorphize/mod.rs +++ b/src/librustc_mir/monomorphize/mod.rs @@ -5,7 +5,7 @@ use rustc::ty::{self, Ty, TyCtxt}; pub mod collector; pub mod partitioning; -pub fn custom_coerce_unsize_info<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn custom_coerce_unsize_info<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, source_ty: Ty<'tcx>, target_ty: Ty<'tcx>) -> CustomCoerceUnsized { diff --git a/src/librustc_mir/monomorphize/partitioning.rs b/src/librustc_mir/monomorphize/partitioning.rs index c6826393585ac..db786b5320bb7 100644 --- a/src/librustc_mir/monomorphize/partitioning.rs +++ b/src/librustc_mir/monomorphize/partitioning.rs @@ -125,7 +125,7 @@ fn fallback_cgu_name(name_builder: &mut CodegenUnitNameBuilder<'_, '_>) -> Inter name_builder.build_cgu_name(LOCAL_CRATE, &["fallback"], Some("cgu")) } -pub fn partition<'a, 'tcx, I>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn partition<'tcx, I>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, mono_items: I, strategy: PartitioningStrategy, inlining_map: &InliningMap<'tcx>) @@ -201,7 +201,7 @@ struct PostInliningPartitioning<'tcx> { internalization_candidates: FxHashSet>, } -fn place_root_mono_items<'a, 'tcx, I>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn place_root_mono_items<'tcx, I>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, mono_items: I) -> PreInliningPartitioning<'tcx> where I: Iterator> @@ -585,7 +585,7 @@ fn place_inlined_mono_items<'tcx>(initial_partitioning: PreInliningPartitioning< } } -fn internalize_symbols<'a, 'tcx>(_tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn internalize_symbols<'tcx>(_tcx: TyCtxt<'tcx, 'tcx, 'tcx>, partitioning: &mut PostInliningPartitioning<'tcx>, inlining_map: &InliningMap<'tcx>) { if partitioning.codegen_units.len() == 1 { @@ -650,7 +650,7 @@ fn internalize_symbols<'a, 'tcx>(_tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } } -fn characteristic_def_id_of_mono_item<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn characteristic_def_id_of_mono_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, mono_item: MonoItem<'tcx>) -> Option { match mono_item { @@ -830,7 +830,7 @@ fn assert_symbols_are_distinct<'a, 'tcx: 'a, I>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, m } } -fn collect_and_partition_mono_items<'a, 'tcx>( +fn collect_and_partition_mono_items<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, cnum: CrateNum, ) -> (Arc, Arc>>>) diff --git a/src/librustc_mir/shim.rs b/src/librustc_mir/shim.rs index b63ddf259e805..cde7e685a0e83 100644 --- a/src/librustc_mir/shim.rs +++ b/src/librustc_mir/shim.rs @@ -26,7 +26,7 @@ pub fn provide(providers: &mut Providers<'_>) { providers.mir_shims = make_shim; } -fn make_shim<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn make_shim<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, instance: ty::InstanceDef<'tcx>) -> &'tcx Body<'tcx> { @@ -166,7 +166,7 @@ fn local_decls_for_sig<'tcx>(sig: &ty::FnSig<'tcx>, span: Span) .collect() } -fn build_drop_shim<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn build_drop_shim<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, ty: Option>) -> Body<'tcx> @@ -306,7 +306,7 @@ impl<'a, 'tcx> DropElaborator<'a, 'tcx> for DropShimElaborator<'a, 'tcx> { } /// Builds a `Clone::clone` shim for `self_ty`. Here, `def_id` is `Clone::clone`. -fn build_clone_shim<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn build_clone_shim<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, self_ty: Ty<'tcx>) -> Body<'tcx> @@ -691,7 +691,7 @@ impl CloneShimBuilder<'tcx> { /// /// If `untuple_args` is a vec of types, the second argument of the /// function will be untupled as these types. -fn build_call_shim<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn build_call_shim<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, rcvr_adjustment: Adjustment, call_kind: CallKind, diff --git a/src/librustc_mir/transform/add_call_guards.rs b/src/librustc_mir/transform/add_call_guards.rs index 59203fe586a63..18b219422d1a5 100644 --- a/src/librustc_mir/transform/add_call_guards.rs +++ b/src/librustc_mir/transform/add_call_guards.rs @@ -31,7 +31,7 @@ pub use self::AddCallGuards::*; */ impl MirPass for AddCallGuards { - fn run_pass<'a, 'tcx>(&self, + fn run_pass<'tcx>(&self, _tcx: TyCtxt<'tcx, 'tcx, 'tcx>, _src: MirSource<'tcx>, body: &mut Body<'tcx>) { diff --git a/src/librustc_mir/transform/add_moves_for_packed_drops.rs b/src/librustc_mir/transform/add_moves_for_packed_drops.rs index 71a92f088e382..1b9f2093ac120 100644 --- a/src/librustc_mir/transform/add_moves_for_packed_drops.rs +++ b/src/librustc_mir/transform/add_moves_for_packed_drops.rs @@ -40,7 +40,7 @@ use crate::util; pub struct AddMovesForPackedDrops; impl MirPass for AddMovesForPackedDrops { - fn run_pass<'a, 'tcx>(&self, + fn run_pass<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, src: MirSource<'tcx>, body: &mut Body<'tcx>) @@ -50,7 +50,7 @@ impl MirPass for AddMovesForPackedDrops { } } -pub fn add_moves_for_packed_drops<'a, 'tcx>( +pub fn add_moves_for_packed_drops<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, body: &mut Body<'tcx>, def_id: DefId) @@ -59,7 +59,7 @@ pub fn add_moves_for_packed_drops<'a, 'tcx>( patch.apply(body); } -fn add_moves_for_packed_drops_patch<'a, 'tcx>( +fn add_moves_for_packed_drops_patch<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, body: &Body<'tcx>, def_id: DefId) @@ -90,7 +90,7 @@ fn add_moves_for_packed_drops_patch<'a, 'tcx>( patch } -fn add_move_for_packed_drop<'a, 'tcx>( +fn add_move_for_packed_drop<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, body: &Body<'tcx>, patch: &mut MirPatch<'tcx>, diff --git a/src/librustc_mir/transform/add_retag.rs b/src/librustc_mir/transform/add_retag.rs index 8918a90834020..43ff3619bf168 100644 --- a/src/librustc_mir/transform/add_retag.rs +++ b/src/librustc_mir/transform/add_retag.rs @@ -48,7 +48,7 @@ fn is_stable<'tcx>( /// Determine whether this type may have a reference in it, recursing below compound types but /// not below references. -fn may_have_reference<'a, 'gcx, 'tcx>(ty: Ty<'tcx>, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> bool { +fn may_have_reference<'gcx, 'tcx>(ty: Ty<'tcx>, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> bool { match ty.sty { // Primitive types that are not references ty::Bool | ty::Char | @@ -74,7 +74,7 @@ fn may_have_reference<'a, 'gcx, 'tcx>(ty: Ty<'tcx>, tcx: TyCtxt<'tcx, 'gcx, 'tcx } impl MirPass for AddRetag { - fn run_pass<'a, 'tcx>(&self, + fn run_pass<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, _src: MirSource<'tcx>, body: &mut Body<'tcx>) diff --git a/src/librustc_mir/transform/check_unsafety.rs b/src/librustc_mir/transform/check_unsafety.rs index 7721cae6d1009..e418ac7a7c7df 100644 --- a/src/librustc_mir/transform/check_unsafety.rs +++ b/src/librustc_mir/transform/check_unsafety.rs @@ -505,7 +505,7 @@ fn check_unused_unsafe<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, hir::intravisit::Visitor::visit_body(&mut visitor, body); } -fn unsafety_check_result<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) +fn unsafety_check_result<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> UnsafetyCheckResult { debug!("unsafety_violations({:?})", def_id); @@ -546,7 +546,7 @@ fn unsafety_check_result<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) } } -fn unsafe_derive_on_repr_packed<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { +fn unsafe_derive_on_repr_packed<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { let lint_hir_id = tcx.hir().as_local_hir_id(def_id).unwrap_or_else(|| bug!("checking unsafety for non-local def id {:?}", def_id)); @@ -603,7 +603,7 @@ fn report_unused_unsafe(tcx: TyCtxt<'_, '_, '_>, db.emit(); } -fn builtin_derive_def_id<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> Option { +fn builtin_derive_def_id<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> Option { debug!("builtin_derive_def_id({:?})", def_id); if let Some(impl_def_id) = tcx.impl_of_method(def_id) { if tcx.has_attr(impl_def_id, sym::automatically_derived) { @@ -619,7 +619,7 @@ fn builtin_derive_def_id<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) } } -pub fn check_unsafety<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { +pub fn check_unsafety<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { debug!("check_unsafety({:?})", def_id); // closures are handled by their parent fn. diff --git a/src/librustc_mir/transform/cleanup_post_borrowck.rs b/src/librustc_mir/transform/cleanup_post_borrowck.rs index 972f05c908477..0484f5c8b389c 100644 --- a/src/librustc_mir/transform/cleanup_post_borrowck.rs +++ b/src/librustc_mir/transform/cleanup_post_borrowck.rs @@ -27,7 +27,7 @@ pub struct CleanupNonCodegenStatements; pub struct DeleteNonCodegenStatements; impl MirPass for CleanupNonCodegenStatements { - fn run_pass<'a, 'tcx>(&self, + fn run_pass<'tcx>(&self, _tcx: TyCtxt<'tcx, 'tcx, 'tcx>, _source: MirSource<'tcx>, body: &mut Body<'tcx>) { diff --git a/src/librustc_mir/transform/const_prop.rs b/src/librustc_mir/transform/const_prop.rs index 1ec3e6e52aa01..1a42b01f452c2 100644 --- a/src/librustc_mir/transform/const_prop.rs +++ b/src/librustc_mir/transform/const_prop.rs @@ -31,7 +31,7 @@ use crate::transform::{MirPass, MirSource}; pub struct ConstProp; impl MirPass for ConstProp { - fn run_pass<'a, 'tcx>(&self, + fn run_pass<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, source: MirSource<'tcx>, body: &mut Body<'tcx>) { @@ -599,7 +599,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { } } -fn type_size_of<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn type_size_of<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, ty: Ty<'tcx>) -> Option { tcx.layout_of(param_env.and(ty)).ok().map(|layout| layout.size.bytes()) diff --git a/src/librustc_mir/transform/copy_prop.rs b/src/librustc_mir/transform/copy_prop.rs index 9b1f110520570..64e139bfe9152 100644 --- a/src/librustc_mir/transform/copy_prop.rs +++ b/src/librustc_mir/transform/copy_prop.rs @@ -30,7 +30,7 @@ use crate::util::def_use::DefUseAnalysis; pub struct CopyPropagation; impl MirPass for CopyPropagation { - fn run_pass<'a, 'tcx>(&self, + fn run_pass<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, _source: MirSource<'tcx>, body: &mut Body<'tcx>) { diff --git a/src/librustc_mir/transform/deaggregator.rs b/src/librustc_mir/transform/deaggregator.rs index 7c52361de0641..e43f1f6f58066 100644 --- a/src/librustc_mir/transform/deaggregator.rs +++ b/src/librustc_mir/transform/deaggregator.rs @@ -6,7 +6,7 @@ use crate::util::expand_aggregate; pub struct Deaggregator; impl MirPass for Deaggregator { - fn run_pass<'a, 'tcx>(&self, + fn run_pass<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, _source: MirSource<'tcx>, body: &mut Body<'tcx>) { diff --git a/src/librustc_mir/transform/dump_mir.rs b/src/librustc_mir/transform/dump_mir.rs index 7f971d51e2650..77ba0ceb7c362 100644 --- a/src/librustc_mir/transform/dump_mir.rs +++ b/src/librustc_mir/transform/dump_mir.rs @@ -18,7 +18,7 @@ impl MirPass for Marker { Cow::Borrowed(self.0) } - fn run_pass<'a, 'tcx>(&self, + fn run_pass<'tcx>(&self, _tcx: TyCtxt<'tcx, 'tcx, 'tcx>, _source: MirSource<'tcx>, _body: &mut Body<'tcx>) @@ -38,7 +38,7 @@ impl fmt::Display for Disambiguator { } -pub fn on_mir_pass<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn on_mir_pass<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, pass_num: &dyn fmt::Display, pass_name: &str, source: MirSource<'tcx>, @@ -55,7 +55,7 @@ pub fn on_mir_pass<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } } -pub fn emit_mir<'a, 'tcx>( +pub fn emit_mir<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, outputs: &OutputFilenames) -> io::Result<()> diff --git a/src/librustc_mir/transform/elaborate_drops.rs b/src/librustc_mir/transform/elaborate_drops.rs index 1d23427bbe7bb..66977bfabf408 100644 --- a/src/librustc_mir/transform/elaborate_drops.rs +++ b/src/librustc_mir/transform/elaborate_drops.rs @@ -21,7 +21,7 @@ use syntax_pos::Span; pub struct ElaborateDrops; impl MirPass for ElaborateDrops { - fn run_pass<'a, 'tcx>(&self, + fn run_pass<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, src: MirSource<'tcx>, body: &mut Body<'tcx>) @@ -77,7 +77,7 @@ impl MirPass for ElaborateDrops { /// Returns the set of basic blocks whose unwind edges are known /// to not be reachable, because they are `drop` terminators /// that can't drop anything. -fn find_dead_unwinds<'a, 'tcx>( +fn find_dead_unwinds< 'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, body: &Body<'tcx>, def_id: hir::def_id::DefId, @@ -141,7 +141,7 @@ struct InitializationData { } impl InitializationData { - fn apply_location<'a,'tcx>(&mut self, + fn apply_location<'tcx>(&mut self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, body: &Body<'tcx>, env: &MoveDataParamEnv<'tcx, 'tcx>, diff --git a/src/librustc_mir/transform/erase_regions.rs b/src/librustc_mir/transform/erase_regions.rs index 9c7877e208adb..8a5a5fea393df 100644 --- a/src/librustc_mir/transform/erase_regions.rs +++ b/src/librustc_mir/transform/erase_regions.rs @@ -50,7 +50,7 @@ impl MutVisitor<'tcx> for EraseRegionsVisitor<'tcx> { pub struct EraseRegions; impl MirPass for EraseRegions { - fn run_pass<'a, 'tcx>(&self, + fn run_pass<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, _: MirSource<'tcx>, body: &mut Body<'tcx>) { diff --git a/src/librustc_mir/transform/generator.rs b/src/librustc_mir/transform/generator.rs index 8423696e64c9e..0ded39e21a091 100644 --- a/src/librustc_mir/transform/generator.rs +++ b/src/librustc_mir/transform/generator.rs @@ -310,7 +310,7 @@ impl MutVisitor<'tcx> for TransformVisitor<'tcx> { } } -fn make_generator_state_argument_indirect<'a, 'tcx>( +fn make_generator_state_argument_indirect<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, body: &mut Body<'tcx>) { @@ -335,7 +335,7 @@ fn make_generator_state_argument_indirect<'a, 'tcx>( DerefArgVisitor.visit_body(body); } -fn make_generator_state_argument_pinned<'a, 'tcx>( +fn make_generator_state_argument_pinned<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, body: &mut Body<'tcx>) { let ref_gen_ty = body.local_decls.raw[1].ty; @@ -678,7 +678,7 @@ impl<'body, 'tcx: 'body, 's> StorageConflictVisitor<'body, 'tcx, 's> { } } -fn compute_layout<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn compute_layout<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, source: MirSource<'tcx>, upvars: &Vec>, interior: Ty<'tcx>, @@ -767,7 +767,7 @@ fn compute_layout<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, (remap, layout, storage_liveness) } -fn insert_switch<'a, 'tcx>(body: &mut Body<'tcx>, +fn insert_switch<'tcx>(body: &mut Body<'tcx>, cases: Vec<(usize, BasicBlock)>, transform: &TransformVisitor<'tcx>, default: TerminatorKind<'tcx>) { @@ -797,7 +797,7 @@ fn insert_switch<'a, 'tcx>(body: &mut Body<'tcx>, } } -fn elaborate_generator_drops<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn elaborate_generator_drops<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, body: &mut Body<'tcx>) { use crate::util::elaborate_drops::{elaborate_drop, Unwind}; @@ -848,7 +848,7 @@ fn elaborate_generator_drops<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, elaborator.patch.apply(body); } -fn create_generator_drop_shim<'a, 'tcx>( +fn create_generator_drop_shim<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, transform: &TransformVisitor<'tcx>, def_id: DefId, @@ -939,7 +939,7 @@ fn insert_term_block<'tcx>(body: &mut Body<'tcx>, kind: TerminatorKind<'tcx>) -> term_block } -fn insert_panic_block<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn insert_panic_block<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, body: &mut Body<'tcx>, message: AssertMessage<'tcx>) -> BasicBlock { let assert_block = BasicBlock::new(body.basic_blocks().len()); @@ -969,7 +969,7 @@ fn insert_panic_block<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, assert_block } -fn create_generator_resume_function<'a, 'tcx>( +fn create_generator_resume_function<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, transform: TransformVisitor<'tcx>, def_id: DefId, @@ -1042,7 +1042,7 @@ fn insert_clean_drop<'tcx>(body: &mut Body<'tcx>) -> BasicBlock { drop_clean } -fn create_cases<'a, 'tcx, F>(body: &mut Body<'tcx>, +fn create_cases<'tcx, F>(body: &mut Body<'tcx>, transform: &TransformVisitor<'tcx>, target: F) -> Vec<(usize, BasicBlock)> where F: Fn(&SuspensionPoint) -> Option { @@ -1083,7 +1083,7 @@ fn create_cases<'a, 'tcx, F>(body: &mut Body<'tcx>, } impl MirPass for StateTransform { - fn run_pass<'a, 'tcx>(&self, + fn run_pass<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, source: MirSource<'tcx>, body: &mut Body<'tcx>) { diff --git a/src/librustc_mir/transform/inline.rs b/src/librustc_mir/transform/inline.rs index 6937e23d6d3eb..fdbf4ea8d9f1c 100644 --- a/src/librustc_mir/transform/inline.rs +++ b/src/librustc_mir/transform/inline.rs @@ -38,7 +38,7 @@ struct CallSite<'tcx> { } impl MirPass for Inline { - fn run_pass<'a, 'tcx>(&self, + fn run_pass<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, source: MirSource<'tcx>, body: &mut Body<'tcx>) { @@ -631,7 +631,7 @@ impl Inliner<'tcx> { } } -fn type_size_of<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn type_size_of<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, ty: Ty<'tcx>) -> Option { tcx.layout_of(param_env.and(ty)).ok().map(|layout| layout.size.bytes()) diff --git a/src/librustc_mir/transform/instcombine.rs b/src/librustc_mir/transform/instcombine.rs index c2bb2da85a89c..784e3ed5187f1 100644 --- a/src/librustc_mir/transform/instcombine.rs +++ b/src/librustc_mir/transform/instcombine.rs @@ -12,7 +12,7 @@ use crate::transform::{MirPass, MirSource}; pub struct InstCombine; impl MirPass for InstCombine { - fn run_pass<'a, 'tcx>(&self, + fn run_pass<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, _: MirSource<'tcx>, body: &mut Body<'tcx>) { diff --git a/src/librustc_mir/transform/lower_128bit.rs b/src/librustc_mir/transform/lower_128bit.rs index 5a5c379027768..47ac87ad795fa 100644 --- a/src/librustc_mir/transform/lower_128bit.rs +++ b/src/librustc_mir/transform/lower_128bit.rs @@ -10,7 +10,7 @@ use crate::transform::{MirPass, MirSource}; pub struct Lower128Bit; impl MirPass for Lower128Bit { - fn run_pass<'a, 'tcx>(&self, + fn run_pass<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, _src: MirSource<'tcx>, body: &mut Body<'tcx>) { @@ -25,7 +25,7 @@ impl MirPass for Lower128Bit { } impl Lower128Bit { - fn lower_128bit_ops<'a, 'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, body: &mut Body<'tcx>) { + fn lower_128bit_ops<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, body: &mut Body<'tcx>) { let mut new_blocks = Vec::new(); let cur_len = body.basic_blocks().len(); @@ -120,7 +120,7 @@ impl Lower128Bit { } } -fn check_lang_item_type<'a, 'tcx, D>( +fn check_lang_item_type<'tcx, D>( lang_item: LangItem, place: &Place<'tcx>, lhs: &Operand<'tcx>, @@ -172,7 +172,7 @@ enum RhsKind { } impl RhsKind { - fn ty<'a, 'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Option> { + fn ty<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Option> { match *self { RhsKind::Unchanged => None, RhsKind::ForceU128 => Some(tcx.types.u128), diff --git a/src/librustc_mir/transform/mod.rs b/src/librustc_mir/transform/mod.rs index db0a8351119f3..c569f8d65f6c5 100644 --- a/src/librustc_mir/transform/mod.rs +++ b/src/librustc_mir/transform/mod.rs @@ -50,13 +50,13 @@ pub(crate) fn provide(providers: &mut Providers<'_>) { }; } -fn is_mir_available<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> bool { +fn is_mir_available<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> bool { tcx.mir_keys(def_id.krate).contains(&def_id) } /// Finds the full set of `DefId`s within the current crate that have /// MIR associated with them. -fn mir_keys<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, krate: CrateNum) +fn mir_keys<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, krate: CrateNum) -> &'tcx DefIdSet { assert_eq!(krate, LOCAL_CRATE); @@ -95,7 +95,7 @@ fn mir_keys<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, krate: CrateNum) tcx.arena.alloc(set) } -fn mir_built<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx Steal> { +fn mir_built<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx Steal> { let mir = build::mir_build(tcx, def_id); tcx.alloc_steal_mir(mir) } @@ -142,7 +142,7 @@ pub trait MirPass { default_name::() } - fn run_pass<'a, 'tcx>(&self, + fn run_pass<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, source: MirSource<'tcx>, body: &mut Body<'tcx>); @@ -196,7 +196,7 @@ pub fn run_passes( } } -fn mir_const<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx Steal> { +fn mir_const<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx Steal> { // Unsafety check uses the raw mir, so make sure it is run let _ = tcx.unsafety_check_result(def_id); @@ -227,7 +227,7 @@ fn mir_validated(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx Steal(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx Body<'tcx> { +fn optimized_mir<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx Body<'tcx> { if tcx.is_constructor(def_id) { // There's no reason to run all of the MIR passes on constructors when // we can just output the MIR we want directly. This also saves const diff --git a/src/librustc_mir/transform/no_landing_pads.rs b/src/librustc_mir/transform/no_landing_pads.rs index 2d3823ae089eb..38a5fc4c2398d 100644 --- a/src/librustc_mir/transform/no_landing_pads.rs +++ b/src/librustc_mir/transform/no_landing_pads.rs @@ -9,7 +9,7 @@ use crate::transform::{MirPass, MirSource}; pub struct NoLandingPads; impl MirPass for NoLandingPads { - fn run_pass<'a, 'tcx>(&self, + fn run_pass<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, _: MirSource<'tcx>, body: &mut Body<'tcx>) { @@ -17,7 +17,7 @@ impl MirPass for NoLandingPads { } } -pub fn no_landing_pads<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, body: &mut Body<'tcx>) { +pub fn no_landing_pads<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, body: &mut Body<'tcx>) { if tcx.sess.no_landing_pads() { NoLandingPads.visit_body(body); } diff --git a/src/librustc_mir/transform/promote_consts.rs b/src/librustc_mir/transform/promote_consts.rs index 9c54f9f4cde34..63cd10f8e26fc 100644 --- a/src/librustc_mir/transform/promote_consts.rs +++ b/src/librustc_mir/transform/promote_consts.rs @@ -369,7 +369,7 @@ impl<'a, 'tcx> MutVisitor<'tcx> for Promoter<'a, 'tcx> { } } -pub fn promote_candidates<'a, 'tcx>(body: &mut Body<'tcx>, +pub fn promote_candidates<'tcx>(body: &mut Body<'tcx>, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, mut temps: IndexVec, candidates: Vec) { diff --git a/src/librustc_mir/transform/qualify_consts.rs b/src/librustc_mir/transform/qualify_consts.rs index 1de94ff57b90e..c0ff2d00a3979 100644 --- a/src/librustc_mir/transform/qualify_consts.rs +++ b/src/librustc_mir/transform/qualify_consts.rs @@ -1472,7 +1472,7 @@ pub fn provide(providers: &mut Providers<'_>) { }; } -fn mir_const_qualif<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn mir_const_qualif<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> (u8, &'tcx BitSet) { // N.B., this `borrow()` is guaranteed to be valid (i.e., the value @@ -1492,7 +1492,7 @@ fn mir_const_qualif<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, pub struct QualifyAndPromoteConstants; impl MirPass for QualifyAndPromoteConstants { - fn run_pass<'a, 'tcx>(&self, + fn run_pass<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, src: MirSource<'tcx>, body: &mut Body<'tcx>) { diff --git a/src/librustc_mir/transform/remove_noop_landing_pads.rs b/src/librustc_mir/transform/remove_noop_landing_pads.rs index 11209a6d119c5..5a9b30d32de3c 100644 --- a/src/librustc_mir/transform/remove_noop_landing_pads.rs +++ b/src/librustc_mir/transform/remove_noop_landing_pads.rs @@ -9,7 +9,7 @@ use crate::util::patch::MirPatch; /// code for these. pub struct RemoveNoopLandingPads; -pub fn remove_noop_landing_pads<'a, 'tcx>( +pub fn remove_noop_landing_pads<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, body: &mut Body<'tcx>) { @@ -22,7 +22,7 @@ pub fn remove_noop_landing_pads<'a, 'tcx>( } impl MirPass for RemoveNoopLandingPads { - fn run_pass<'a, 'tcx>(&self, + fn run_pass<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, _src: MirSource<'tcx>, body: &mut Body<'tcx>) { diff --git a/src/librustc_mir/transform/rustc_peek.rs b/src/librustc_mir/transform/rustc_peek.rs index ad9eab9f29be5..adaea15a17a10 100644 --- a/src/librustc_mir/transform/rustc_peek.rs +++ b/src/librustc_mir/transform/rustc_peek.rs @@ -25,7 +25,7 @@ use crate::dataflow::has_rustc_mir_with; pub struct SanityCheck; impl MirPass for SanityCheck { - fn run_pass<'a, 'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + fn run_pass<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, src: MirSource<'tcx>, body: &mut Body<'tcx>) { let def_id = src.def_id(); if !tcx.has_attr(def_id, sym::rustc_mir) { @@ -84,7 +84,7 @@ impl MirPass for SanityCheck { /// (If there are any calls to `rustc_peek` that do not match the /// expression form above, then that emits an error as well, but those /// errors are not intended to be used for unit tests.) -pub fn sanity_check_via_rustc_peek<'a, 'tcx, O>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn sanity_check_via_rustc_peek<'tcx, O>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, body: &Body<'tcx>, def_id: DefId, _attributes: &[ast::Attribute], @@ -101,7 +101,7 @@ pub fn sanity_check_via_rustc_peek<'a, 'tcx, O>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } } -fn each_block<'a, 'tcx, O>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn each_block<'tcx, O>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, body: &Body<'tcx>, results: &DataflowResults<'tcx, O>, bb: mir::BasicBlock) where diff --git a/src/librustc_mir/transform/simplify.rs b/src/librustc_mir/transform/simplify.rs index 4968040182c6b..92b7a76c5fa37 100644 --- a/src/librustc_mir/transform/simplify.rs +++ b/src/librustc_mir/transform/simplify.rs @@ -57,7 +57,7 @@ impl MirPass for SimplifyCfg { Cow::Borrowed(&self.label) } - fn run_pass<'a, 'tcx>(&self, + fn run_pass<'tcx>(&self, _tcx: TyCtxt<'tcx, 'tcx, 'tcx>, _src: MirSource<'tcx>, body: &mut Body<'tcx>) { @@ -296,7 +296,7 @@ pub fn remove_dead_blocks(body: &mut Body<'_>) { pub struct SimplifyLocals; impl MirPass for SimplifyLocals { - fn run_pass<'a, 'tcx>(&self, + fn run_pass<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, _: MirSource<'tcx>, body: &mut Body<'tcx>) { diff --git a/src/librustc_mir/transform/simplify_branches.rs b/src/librustc_mir/transform/simplify_branches.rs index 0cb971fd2cd85..41f2572c2f562 100644 --- a/src/librustc_mir/transform/simplify_branches.rs +++ b/src/librustc_mir/transform/simplify_branches.rs @@ -19,7 +19,7 @@ impl MirPass for SimplifyBranches { Cow::Borrowed(&self.label) } - fn run_pass<'a, 'tcx>(&self, + fn run_pass<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, _src: MirSource<'tcx>, body: &mut Body<'tcx>) { diff --git a/src/librustc_mir/transform/uniform_array_move_out.rs b/src/librustc_mir/transform/uniform_array_move_out.rs index add562723a5e8..7eae82c019c88 100644 --- a/src/librustc_mir/transform/uniform_array_move_out.rs +++ b/src/librustc_mir/transform/uniform_array_move_out.rs @@ -37,7 +37,7 @@ use crate::util::patch::MirPatch; pub struct UniformArrayMoveOut; impl MirPass for UniformArrayMoveOut { - fn run_pass<'a, 'tcx>(&self, + fn run_pass<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, _src: MirSource<'tcx>, body: &mut Body<'tcx>) { @@ -162,7 +162,7 @@ impl<'a, 'tcx> UniformArrayMoveOutVisitor<'a, 'tcx> { pub struct RestoreSubsliceArrayMoveOut; impl MirPass for RestoreSubsliceArrayMoveOut { - fn run_pass<'a, 'tcx>(&self, + fn run_pass<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, _src: MirSource<'tcx>, body: &mut Body<'tcx>) { diff --git a/src/librustc_mir/util/alignment.rs b/src/librustc_mir/util/alignment.rs index c0f25de79300c..5ca867d796e99 100644 --- a/src/librustc_mir/util/alignment.rs +++ b/src/librustc_mir/util/alignment.rs @@ -4,7 +4,7 @@ use rustc::mir::*; /// Returns `true` if this place is allowed to be less aligned /// than its containing struct (because it is within a packed /// struct). -pub fn is_disaligned<'a, 'tcx, L>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn is_disaligned<'tcx, L>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, local_decls: &L, param_env: ty::ParamEnv<'tcx>, place: &Place<'tcx>) @@ -32,7 +32,7 @@ pub fn is_disaligned<'a, 'tcx, L>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } } -fn is_within_packed<'a, 'tcx, L>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn is_within_packed<'tcx, L>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, local_decls: &L, place: &Place<'tcx>) -> bool diff --git a/src/librustc_mir/util/graphviz.rs b/src/librustc_mir/util/graphviz.rs index c77eac861ee68..ba00fab7b8d57 100644 --- a/src/librustc_mir/util/graphviz.rs +++ b/src/librustc_mir/util/graphviz.rs @@ -133,7 +133,7 @@ fn write_edges(source: BasicBlock, body: &Body<'_>, w: &mut W) -> io:: /// Write the graphviz DOT label for the overall graph. This is essentially a block of text that /// will appear below the graph, showing the type of the `fn` this MIR represents and the types of /// all the variables and temporaries. -fn write_graph_label<'a, 'gcx, 'tcx, W: Write>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, +fn write_graph_label<'gcx, 'tcx, W: Write>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, def_id: DefId, body: &Body<'_>, w: &mut W) diff --git a/src/librustc_mir/util/liveness.rs b/src/librustc_mir/util/liveness.rs index 33aedd065c3ca..900e3d19670bf 100644 --- a/src/librustc_mir/util/liveness.rs +++ b/src/librustc_mir/util/liveness.rs @@ -254,7 +254,7 @@ fn block<'tcx>( visitor.defs_uses } -pub fn dump_mir<'a, 'tcx>( +pub fn dump_mir<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, pass_name: &str, source: MirSource<'tcx>, @@ -271,7 +271,7 @@ pub fn dump_mir<'a, 'tcx>( dump_matched_mir_node(tcx, pass_name, &node_path, source, body, result); } -fn dump_matched_mir_node<'a, 'tcx>( +fn dump_matched_mir_node<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, pass_name: &str, node_path: &str, @@ -294,7 +294,7 @@ fn dump_matched_mir_node<'a, 'tcx>( }); } -pub fn write_mir_fn<'a, 'tcx>( +pub fn write_mir_fn<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, src: MirSource<'tcx>, body: &Body<'tcx>, diff --git a/src/librustc_mir/util/mod.rs b/src/librustc_mir/util/mod.rs index 441ef683673ba..da3735e87f6b4 100644 --- a/src/librustc_mir/util/mod.rs +++ b/src/librustc_mir/util/mod.rs @@ -21,7 +21,7 @@ pub use self::graphviz::{graphviz_safe_def_name, write_mir_graphviz}; pub use self::graphviz::write_node_label as write_graphviz_node_label; /// If possible, suggest replacing `ref` with `ref mut`. -pub fn suggest_ref_mut<'cx, 'gcx, 'tcx>( +pub fn suggest_ref_mut<'gcx, 'tcx>( tcx: TyCtxt<'tcx, 'gcx, 'tcx>, binding_span: Span, ) -> Option<(String)> { diff --git a/src/librustc_mir/util/pretty.rs b/src/librustc_mir/util/pretty.rs index 4dd892ac88b7b..d5c13610e2f7a 100644 --- a/src/librustc_mir/util/pretty.rs +++ b/src/librustc_mir/util/pretty.rs @@ -62,7 +62,7 @@ pub enum PassWhere { /// or `typeck` appears in the name. /// - `foo & nll | bar & typeck` == match if `foo` and `nll` both appear in the name /// or `typeck` and `bar` both appear in the name. -pub fn dump_mir<'a, 'gcx, 'tcx, F>( +pub fn dump_mir<'gcx, 'tcx, F>( tcx: TyCtxt<'tcx, 'gcx, 'tcx>, pass_num: Option<&dyn Display>, pass_name: &str, @@ -93,7 +93,7 @@ pub fn dump_mir<'a, 'gcx, 'tcx, F>( ); } -pub fn dump_enabled<'a, 'gcx, 'tcx>( +pub fn dump_enabled<'gcx, 'tcx>( tcx: TyCtxt<'tcx, 'gcx, 'tcx>, pass_name: &str, source: MirSource<'tcx>, @@ -117,7 +117,7 @@ pub fn dump_enabled<'a, 'gcx, 'tcx>( // `def_path_str()` would otherwise trigger `type_of`, and this can // run while we are already attempting to evaluate `type_of`. -fn dump_matched_mir_node<'a, 'gcx, 'tcx, F>( +fn dump_matched_mir_node<'gcx, 'tcx, F>( tcx: TyCtxt<'tcx, 'gcx, 'tcx>, pass_num: Option<&dyn Display>, pass_name: &str, @@ -240,7 +240,7 @@ pub(crate) fn create_dump_file( } /// Write out a human-readable textual representation for the given MIR. -pub fn write_mir_pretty<'a, 'gcx, 'tcx>( +pub fn write_mir_pretty<'gcx, 'tcx>( tcx: TyCtxt<'tcx, 'gcx, 'tcx>, single: Option, w: &mut dyn Write, @@ -279,7 +279,7 @@ pub fn write_mir_pretty<'a, 'gcx, 'tcx>( Ok(()) } -pub fn write_mir_fn<'a, 'gcx, 'tcx, F>( +pub fn write_mir_fn<'gcx, 'tcx, F>( tcx: TyCtxt<'tcx, 'gcx, 'tcx>, src: MirSource<'tcx>, body: &Body<'tcx>, @@ -303,7 +303,7 @@ where } /// Write out a human-readable textual representation for the given basic block. -pub fn write_basic_block<'cx, 'gcx, 'tcx, F>( +pub fn write_basic_block<'gcx, 'tcx, F>( tcx: TyCtxt<'tcx, 'gcx, 'tcx>, block: BasicBlock, body: &Body<'tcx>, @@ -370,7 +370,7 @@ where /// After we print the main statement, we sometimes dump extra /// information. There's often a lot of little things "nuzzled up" in /// a statement. -fn write_extra<'cx, 'gcx, 'tcx, F>( +fn write_extra<'gcx, 'tcx, F>( tcx: TyCtxt<'tcx, 'gcx, 'tcx>, write: &mut dyn Write, mut visit_op: F, @@ -538,7 +538,7 @@ fn write_scope_tree( /// Write out a human-readable textual representation of the MIR's `fn` type and the types of its /// local variables (both user-defined bindings and compiler temporaries). -pub fn write_mir_intro<'a, 'gcx, 'tcx>( +pub fn write_mir_intro<'gcx, 'tcx>( tcx: TyCtxt<'tcx, 'gcx, 'tcx>, src: MirSource<'tcx>, body: &Body<'_>, diff --git a/src/librustc_passes/layout_test.rs b/src/librustc_passes/layout_test.rs index 27888ca92ee8d..b256ff487401e 100644 --- a/src/librustc_passes/layout_test.rs +++ b/src/librustc_passes/layout_test.rs @@ -14,7 +14,7 @@ use rustc::ty::TyCtxt; use syntax::ast::Attribute; use syntax::symbol::sym; -pub fn test_layout<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn test_layout<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { if tcx.features().rustc_attrs { // if the `rustc_attrs` feature is not enabled, don't bother testing layout tcx.hir() diff --git a/src/librustc_passes/rvalue_promotion.rs b/src/librustc_passes/rvalue_promotion.rs index d6f5ed6fc03e2..29d6bd3002785 100644 --- a/src/librustc_passes/rvalue_promotion.rs +++ b/src/librustc_passes/rvalue_promotion.rs @@ -39,7 +39,7 @@ pub fn provide(providers: &mut Providers<'_>) { }; } -fn const_is_rvalue_promotable_to_static<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn const_is_rvalue_promotable_to_static<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> bool { @@ -51,7 +51,7 @@ fn const_is_rvalue_promotable_to_static<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, tcx.rvalue_promotable_map(def_id).contains(&body_id.hir_id.local_id) } -fn rvalue_promotable_map<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn rvalue_promotable_map<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ItemLocalSet { diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index 14a4e335de674..9cf433abc6e68 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -220,7 +220,7 @@ impl<'tcx, V> TypeVisitor<'tcx> for DefIdVisitorSkeleton<'_, 'tcx, V> } } -fn def_id_visibility<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) +fn def_id_visibility<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> (ty::Visibility, Span, &'static str) { match tcx.hir().as_local_hir_id(def_id) { Some(hir_id) => { @@ -331,7 +331,7 @@ fn item_tables<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, if tcx.has_typeck_tables(def_id) { tcx.typeck_tables_of(def_id) } else { empty_tables } } -fn min<'a, 'tcx>(vis1: ty::Visibility, vis2: ty::Visibility, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) +fn min<'tcx>(vis1: ty::Visibility, vis2: ty::Visibility, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> ty::Visibility { if vis1.is_at_least(vis2, tcx) { vis2 } else { vis1 } } diff --git a/src/librustc_traits/chalk_context/mod.rs b/src/librustc_traits/chalk_context/mod.rs index 2cf28a9fcb4ac..fede04fdce23e 100644 --- a/src/librustc_traits/chalk_context/mod.rs +++ b/src/librustc_traits/chalk_context/mod.rs @@ -672,7 +672,7 @@ crate fn provide(p: &mut Providers<'_>) { }; } -crate fn evaluate_goal<'a, 'tcx>( +crate fn evaluate_goal<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, goal: ChalkCanonicalGoal<'tcx> ) -> Result< diff --git a/src/librustc_traits/dropck_outlives.rs b/src/librustc_traits/dropck_outlives.rs index e7479e7ce6209..3de64f4f4c43e 100644 --- a/src/librustc_traits/dropck_outlives.rs +++ b/src/librustc_traits/dropck_outlives.rs @@ -146,7 +146,7 @@ fn dropck_outlives<'tcx>( /// Returns a set of constraints that needs to be satisfied in /// order for `ty` to be valid for destruction. -fn dtorck_constraint_for_ty<'a, 'gcx, 'tcx>( +fn dtorck_constraint_for_ty<'gcx, 'tcx>( tcx: TyCtxt<'tcx, 'gcx, 'tcx>, span: Span, for_ty: Ty<'tcx>, @@ -279,7 +279,7 @@ fn dtorck_constraint_for_ty<'a, 'gcx, 'tcx>( } /// Calculates the dtorck constraint for a type. -crate fn adt_dtorck_constraint<'a, 'tcx>( +crate fn adt_dtorck_constraint<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, ) -> Result, NoSolution> { diff --git a/src/librustc_traits/lowering/environment.rs b/src/librustc_traits/lowering/environment.rs index 81d32243e17a5..569836680b5fe 100644 --- a/src/librustc_traits/lowering/environment.rs +++ b/src/librustc_traits/lowering/environment.rs @@ -127,7 +127,7 @@ impl ClauseVisitor<'a, 'tcx> { } } -crate fn program_clauses_for_env<'a, 'tcx>( +crate fn program_clauses_for_env<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, environment: Environment<'tcx>, ) -> Clauses<'tcx> { @@ -160,7 +160,7 @@ crate fn program_clauses_for_env<'a, 'tcx>( ); } -crate fn environment<'a, 'tcx>( +crate fn environment<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId ) -> Environment<'tcx> { diff --git a/src/librustc_traits/lowering/mod.rs b/src/librustc_traits/lowering/mod.rs index 699f1de2df232..59b61abee8f52 100644 --- a/src/librustc_traits/lowering/mod.rs +++ b/src/librustc_traits/lowering/mod.rs @@ -155,7 +155,7 @@ impl<'tcx> IntoWellFormedGoal for DomainGoal<'tcx> { } } -crate fn program_clauses_for<'a, 'tcx>( +crate fn program_clauses_for<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, ) -> Clauses<'tcx> { @@ -184,7 +184,7 @@ crate fn program_clauses_for<'a, 'tcx>( } } -fn program_clauses_for_trait<'a, 'tcx>( +fn program_clauses_for_trait<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, ) -> Clauses<'tcx> { @@ -343,7 +343,7 @@ fn program_clauses_for_impl(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> Cla tcx.mk_clauses(iter::once(Clause::ForAll(ty::Binder::bind(clause)))) } -pub fn program_clauses_for_type_def<'a, 'tcx>( +pub fn program_clauses_for_type_def<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, ) -> Clauses<'tcx> { @@ -420,7 +420,7 @@ pub fn program_clauses_for_type_def<'a, 'tcx>( tcx.mk_clauses(iter::once(well_formed_clause).chain(from_env_clauses)) } -pub fn program_clauses_for_associated_type_def<'a, 'tcx>( +pub fn program_clauses_for_associated_type_def<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item_id: DefId, ) -> Clauses<'tcx> { @@ -558,7 +558,7 @@ pub fn program_clauses_for_associated_type_def<'a, 'tcx>( tcx.mk_clauses(clauses) } -pub fn program_clauses_for_associated_type_value<'a, 'tcx>( +pub fn program_clauses_for_associated_type_value<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item_id: DefId, ) -> Clauses<'tcx> { @@ -620,7 +620,7 @@ pub fn program_clauses_for_associated_type_value<'a, 'tcx>( tcx.mk_clauses(iter::once(normalize_clause)) } -pub fn dump_program_clauses<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn dump_program_clauses<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { if !tcx.features().rustc_attrs { return; } diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index e2b3e9282cddc..92a28defa5553 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -461,7 +461,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { /// instantiate a `Kind`. /// - `inferred_kind`: if no parameter was provided, and inference is enabled, then /// creates a suitable inference variable. - pub fn create_substs_for_generic_args<'a, 'b>( + pub fn create_substs_for_generic_args<'b>( tcx: TyCtxt<'tcx, 'gcx, 'tcx>, def_id: DefId, parent_substs: &[Kind<'tcx>], @@ -2415,7 +2415,7 @@ pub struct Bounds<'tcx> { pub implicitly_sized: Option, } -impl<'a, 'gcx, 'tcx> Bounds<'tcx> { +impl<'gcx, 'tcx> Bounds<'tcx> { /// Converts a bounds list into a flat set of predicates (like /// where-clauses). Because some of our bounds listings (e.g., /// regions) don't include the self-type, you must supply the diff --git a/src/librustc_typeck/check/autoderef.rs b/src/librustc_typeck/check/autoderef.rs index e6e6772e27eb1..6281b20f24af2 100644 --- a/src/librustc_typeck/check/autoderef.rs +++ b/src/librustc_typeck/check/autoderef.rs @@ -239,7 +239,7 @@ impl<'a, 'gcx, 'tcx> Autoderef<'a, 'gcx, 'tcx> { } } -pub fn report_autoderef_recursion_limit_error<'a, 'gcx, 'tcx>( +pub fn report_autoderef_recursion_limit_error<'gcx, 'tcx>( tcx: TyCtxt<'tcx, 'gcx, 'tcx>, span: Span, ty: Ty<'tcx>) { // We've reached the recursion limit, error gracefully. diff --git a/src/librustc_typeck/check/compare_method.rs b/src/librustc_typeck/check/compare_method.rs index ae9e74f37059b..920dbff7b8cc6 100644 --- a/src/librustc_typeck/check/compare_method.rs +++ b/src/librustc_typeck/check/compare_method.rs @@ -23,7 +23,7 @@ use super::{Inherited, FnCtxt, potentially_plural_count}; /// - `trait_m`: the method in the trait /// - `impl_trait_ref`: the TraitRef corresponding to the trait implementation -pub fn compare_impl_method<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn compare_impl_method<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_m: &ty::AssocItem, impl_m_span: Span, trait_m: &ty::AssocItem, @@ -73,7 +73,7 @@ pub fn compare_impl_method<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } } -fn compare_predicate_entailment<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn compare_predicate_entailment<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_m: &ty::AssocItem, impl_m_span: Span, trait_m: &ty::AssocItem, @@ -355,7 +355,7 @@ fn compare_predicate_entailment<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, }) } -fn check_region_bounds_on_impl_method<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn check_region_bounds_on_impl_method<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, span: Span, impl_m: &ty::AssocItem, trait_m: &ty::AssocItem, @@ -495,7 +495,7 @@ fn extract_spans_for_error_reporting<'a, 'gcx, 'tcx>(infcx: &infer::InferCtxt<'a } } -fn compare_self_type<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn compare_self_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_m: &ty::AssocItem, impl_m_span: Span, trait_m: &ty::AssocItem, @@ -580,7 +580,7 @@ fn compare_self_type<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, Ok(()) } -fn compare_number_of_generics<'a, 'tcx>( +fn compare_number_of_generics<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_: &ty::AssocItem, _impl_span: Span, @@ -695,7 +695,7 @@ fn compare_number_of_generics<'a, 'tcx>( } } -fn compare_number_of_method_arguments<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn compare_number_of_method_arguments<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_m: &ty::AssocItem, impl_m_span: Span, trait_m: &ty::AssocItem, @@ -779,7 +779,7 @@ fn compare_number_of_method_arguments<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, Ok(()) } -fn compare_synthetic_generics<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn compare_synthetic_generics<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_m: &ty::AssocItem, trait_m: &ty::AssocItem) -> Result<(), ErrorReported> { @@ -951,7 +951,7 @@ fn compare_synthetic_generics<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } } -pub fn compare_const_impl<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn compare_const_impl<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_c: &ty::AssocItem, impl_c_span: Span, trait_c: &ty::AssocItem, diff --git a/src/librustc_typeck/check/dropck.rs b/src/librustc_typeck/check/dropck.rs index 672c474676925..6094fd1f5f2fc 100644 --- a/src/librustc_typeck/check/dropck.rs +++ b/src/librustc_typeck/check/dropck.rs @@ -29,7 +29,7 @@ use syntax_pos::Span; /// struct/enum definition for the nominal type itself (i.e. /// cannot do `struct S; impl Drop for S { ... }`). /// -pub fn check_drop_impl<'a, 'tcx>( +pub fn check_drop_impl<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, drop_impl_did: DefId, ) -> Result<(), ErrorReported> { @@ -64,7 +64,7 @@ pub fn check_drop_impl<'a, 'tcx>( } } -fn ensure_drop_params_and_item_params_correspond<'a, 'tcx>( +fn ensure_drop_params_and_item_params_correspond<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, drop_impl_did: DefId, drop_impl_ty: Ty<'tcx>, @@ -140,7 +140,7 @@ fn ensure_drop_params_and_item_params_correspond<'a, 'tcx>( /// Confirms that every predicate imposed by dtor_predicates is /// implied by assuming the predicates attached to self_type_did. -fn ensure_drop_predicates_are_implied_by_item_defn<'a, 'tcx>( +fn ensure_drop_predicates_are_implied_by_item_defn<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, drop_impl_did: DefId, dtor_predicates: &ty::GenericPredicates<'tcx>, diff --git a/src/librustc_typeck/check/intrinsic.rs b/src/librustc_typeck/check/intrinsic.rs index 2554ff688d507..21f4660b08e5c 100644 --- a/src/librustc_typeck/check/intrinsic.rs +++ b/src/librustc_typeck/check/intrinsic.rs @@ -13,7 +13,7 @@ use rustc::hir; use std::iter; -fn equate_intrinsic_type<'a, 'tcx>( +fn equate_intrinsic_type<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, it: &hir::ForeignItem, n_tps: usize, @@ -79,7 +79,7 @@ pub fn intrisic_operation_unsafety(intrinsic: &str) -> hir::Unsafety { /// Remember to add all intrinsics here, in librustc_codegen_llvm/intrinsic.rs, /// and in libcore/intrinsics.rs -pub fn check_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn check_intrinsic_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, it: &hir::ForeignItem) { let param = |n| tcx.mk_ty_param(n, InternedString::intern(&format!("P{}", n))); let name = it.ident.as_str(); @@ -400,7 +400,7 @@ pub fn check_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } /// Type-check `extern "platform-intrinsic" { ... }` functions. -pub fn check_platform_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn check_platform_intrinsic_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, it: &hir::ForeignItem) { let param = |n| { let name = InternedString::intern(&format!("P{}", n)); diff --git a/src/librustc_typeck/check/method/probe.rs b/src/librustc_typeck/check/method/probe.rs index 7101d7bba2da9..96ee140bcfecb 100644 --- a/src/librustc_typeck/check/method/probe.rs +++ b/src/librustc_typeck/check/method/probe.rs @@ -395,7 +395,7 @@ pub fn provide(providers: &mut ty::query::Providers<'_>) { providers.method_autoderef_steps = method_autoderef_steps; } -fn method_autoderef_steps<'a, 'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'gcx, 'gcx>, +fn method_autoderef_steps<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'gcx, 'gcx>, goal: CanonicalTyGoal<'tcx>) -> MethodAutoderefStepsResult<'gcx> { diff --git a/src/librustc_typeck/check/method/suggest.rs b/src/librustc_typeck/check/method/suggest.rs index aac1c2c68324a..05da24bb62c99 100644 --- a/src/librustc_typeck/check/method/suggest.rs +++ b/src/librustc_typeck/check/method/suggest.rs @@ -775,12 +775,12 @@ impl Ord for TraitInfo { } /// Retrieves all traits in this crate and any dependent crates. -pub fn all_traits<'a, 'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Vec { +pub fn all_traits<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Vec { tcx.all_traits(LOCAL_CRATE).iter().map(|&def_id| TraitInfo { def_id }).collect() } /// Computes all traits in this crate and any dependent crates. -fn compute_all_traits<'a, 'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Vec { +fn compute_all_traits<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Vec { use hir::itemlikevisit; let mut traits = vec![]; diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 830407bffefc6..c1111e3ae4695 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -695,7 +695,7 @@ impl ItemLikeVisitor<'tcx> for CheckItemTypesVisitor<'tcx> { fn visit_impl_item(&mut self, _: &'tcx hir::ImplItem) { } } -pub fn check_wf_new<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Result<(), ErrorReported> { +pub fn check_wf_new<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Result<(), ErrorReported> { tcx.sess.track_errors(|| { let mut visit = wfcheck::CheckTypeWellFormedVisitor::new(tcx); tcx.hir().krate().par_visit_all_item_likes(&mut visit); @@ -706,22 +706,22 @@ fn check_mod_item_types<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, module_def_id: DefI tcx.hir().visit_item_likes_in_module(module_def_id, &mut CheckItemTypesVisitor { tcx }); } -fn typeck_item_bodies<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, crate_num: CrateNum) { +fn typeck_item_bodies<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, crate_num: CrateNum) { debug_assert!(crate_num == LOCAL_CRATE); tcx.par_body_owners(|body_owner_def_id| { tcx.ensure().typeck_tables_of(body_owner_def_id); }); } -fn check_item_well_formed<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { +fn check_item_well_formed<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { wfcheck::check_item_well_formed(tcx, def_id); } -fn check_trait_item_well_formed<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { +fn check_trait_item_well_formed<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { wfcheck::check_trait_item(tcx, def_id); } -fn check_impl_item_well_formed<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { +fn check_impl_item_well_formed<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { wfcheck::check_impl_item(tcx, def_id); } @@ -741,7 +741,7 @@ pub fn provide(providers: &mut Providers<'_>) { }; } -fn adt_destructor<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn adt_destructor<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> Option { tcx.calculate_dtor(def_id, &mut dropck::check_drop_impl) @@ -756,7 +756,7 @@ fn adt_destructor<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, /// may not succeed. In some cases where this function returns `None` /// (notably closures), `typeck_tables(def_id)` would wind up /// redirecting to the owning function. -fn primary_body_of<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn primary_body_of<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, id: hir::HirId) -> Option<(hir::BodyId, Option<&'tcx hir::FnDecl>)> { @@ -797,7 +797,7 @@ fn primary_body_of<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } } -fn has_typeck_tables<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn has_typeck_tables<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> bool { // Closures' tables come from their outermost function, @@ -811,13 +811,13 @@ fn has_typeck_tables<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, primary_body_of(tcx, id).is_some() } -fn used_trait_imports<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn used_trait_imports<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx DefIdSet { &*tcx.typeck_tables_of(def_id).used_trait_imports } -fn typeck_tables_of<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn typeck_tables_of<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::TypeckTables<'tcx> { // Closures' tables come from their outermost function, @@ -919,7 +919,7 @@ fn typeck_tables_of<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, tables } -fn check_abi<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, span: Span, abi: Abi) { +fn check_abi<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, span: Span, abi: Abi) { if !tcx.sess.target.target.is_abi_supported(abi) { struct_span_err!(tcx.sess, span, E0570, "The ABI `{}` is not supported for the current target", abi).emit() @@ -1287,7 +1287,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>, (fcx, gen_ty) } -fn check_struct<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn check_struct<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, id: hir::HirId, span: Span) { let def_id = tcx.hir().local_def_id_from_hir_id(id); @@ -1303,7 +1303,7 @@ fn check_struct<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, check_packed(tcx, span, def_id); } -fn check_union<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn check_union<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, id: hir::HirId, span: Span) { let def_id = tcx.hir().local_def_id_from_hir_id(id); @@ -1314,7 +1314,7 @@ fn check_union<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, check_packed(tcx, span, def_id); } -fn check_opaque<'a, 'tcx>( +fn check_opaque<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, substs: SubstsRef<'tcx>, @@ -1335,7 +1335,7 @@ fn check_opaque<'a, 'tcx>( } } -pub fn check_item_type<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, it: &'tcx hir::Item) { +pub fn check_item_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, it: &'tcx hir::Item) { debug!( "check_item_type(it.hir_id={}, it.name={})", it.hir_id, @@ -1472,7 +1472,7 @@ fn maybe_check_static_with_link_section(tcx: TyCtxt<'_, '_, '_>, id: DefId, span } } -fn check_on_unimplemented<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn check_on_unimplemented<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, trait_def_id: DefId, item: &hir::Item) { let item_def_id = tcx.hir().local_def_id_from_hir_id(item.hir_id); @@ -1480,7 +1480,7 @@ fn check_on_unimplemented<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, let _ = traits::OnUnimplementedDirective::of_item(tcx, trait_def_id, item_def_id); } -fn report_forbidden_specialization<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn report_forbidden_specialization<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_item: &hir::ImplItem, parent_impl: DefId) { @@ -1506,7 +1506,7 @@ fn report_forbidden_specialization<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, err.emit(); } -fn check_specialization_validity<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn check_specialization_validity<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, trait_def: &ty::TraitDef, trait_item: &ty::AssocItem, impl_id: DefId, @@ -1532,7 +1532,7 @@ fn check_specialization_validity<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } -fn check_impl_items_against_trait<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn check_impl_items_against_trait<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_span: Span, impl_id: DefId, impl_trait_ref: ty::TraitRef<'tcx>, @@ -1693,7 +1693,7 @@ fn check_impl_items_against_trait<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, /// Checks whether a type can be represented in memory. In particular, it /// identifies types that contain themselves without indirection through a /// pointer, which would mean their size is unbounded. -fn check_representable<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn check_representable<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, sp: Span, item_def_id: DefId) -> bool { @@ -1718,7 +1718,7 @@ fn check_representable<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, return true } -pub fn check_simd<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, sp: Span, def_id: DefId) { +pub fn check_simd<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, sp: Span, def_id: DefId) { let t = tcx.type_of(def_id); if let ty::Adt(def, substs) = t.sty { if def.is_struct() { @@ -1747,7 +1747,7 @@ pub fn check_simd<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, sp: Span, def_id: Def } } -fn check_packed<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, sp: Span, def_id: DefId) { +fn check_packed<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, sp: Span, def_id: DefId) { let repr = tcx.adt_def(def_id).repr; if repr.packed() { for attr in tcx.get_attrs(def_id).iter() { @@ -1771,7 +1771,7 @@ fn check_packed<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, sp: Span, def_id: DefId } } -fn check_packed_inner<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn check_packed_inner<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, stack: &mut Vec) -> bool { let t = tcx.type_of(def_id); @@ -1801,7 +1801,7 @@ fn check_packed_inner<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, false } -fn check_transparent<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, sp: Span, def_id: DefId) { +fn check_transparent<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, sp: Span, def_id: DefId) { let adt = tcx.adt_def(def_id); if !adt.repr.transparent() { return; @@ -1881,7 +1881,7 @@ fn check_transparent<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, sp: Span, def_id: } #[allow(trivial_numeric_casts)] -pub fn check_enum<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn check_enum<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, sp: Span, vs: &'tcx [hir::Variant], id: hir::HirId) { @@ -1945,7 +1945,7 @@ pub fn check_enum<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, check_transparent(tcx, sp, def_id); } -fn report_unexpected_variant_res<'a, 'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, +fn report_unexpected_variant_res<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, res: Res, span: Span, qpath: &QPath) { @@ -5700,7 +5700,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } } -pub fn check_bounds_are_used<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn check_bounds_are_used<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, generics: &ty::Generics, ty: Ty<'tcx>) { let own_counts = generics.own_counts(); diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs index 827853c311416..34d6892c18f57 100644 --- a/src/librustc_typeck/check/wfcheck.rs +++ b/src/librustc_typeck/check/wfcheck.rs @@ -68,7 +68,7 @@ impl<'gcx, 'tcx> CheckWfFcxBuilder<'gcx, 'tcx> { /// We do this check as a pre-pass before checking fn bodies because if these constraints are /// not included it frequently leads to confusing errors in fn bodies. So it's better to check /// the types first. -pub fn check_item_well_formed<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { +pub fn check_item_well_formed<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); let item = tcx.hir().expect_item_by_hir_id(hir_id); @@ -156,7 +156,7 @@ pub fn check_item_well_formed<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: D } } -pub fn check_trait_item<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { +pub fn check_trait_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); let trait_item = tcx.hir().expect_trait_item(hir_id); @@ -167,7 +167,7 @@ pub fn check_trait_item<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) check_associated_item(tcx, trait_item.hir_id, trait_item.span, method_sig); } -pub fn check_impl_item<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { +pub fn check_impl_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); let impl_item = tcx.hir().expect_impl_item(hir_id); @@ -178,7 +178,7 @@ pub fn check_impl_item<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { check_associated_item(tcx, impl_item.hir_id, impl_item.span, method_sig); } -fn check_associated_item<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn check_associated_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item_id: hir::HirId, span: Span, sig_if_method: Option<&hir::MethodSig>) { @@ -242,7 +242,7 @@ fn for_id<'gcx: 'tcx, 'tcx>(tcx: TyCtxt<'gcx, 'gcx, 'gcx>, id: hir::HirId, span: } /// In a type definition, we check that to ensure that the types of the fields are well-formed. -fn check_type_defn<'a, 'tcx, F>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn check_type_defn<'tcx, F>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item: &hir::Item, all_sized: bool, mut lookup_fields: F) where F: for<'fcx, 'gcx, 'tcx2> FnMut(&FnCtxt<'fcx, 'gcx, 'tcx2>) -> Vec> { @@ -312,7 +312,7 @@ fn check_type_defn<'a, 'tcx, F>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, }); } -fn check_trait<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item: &hir::Item) { +fn check_trait<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item: &hir::Item) { debug!("check_trait: {:?}", item.hir_id); let trait_def_id = tcx.hir().local_def_id_from_hir_id(item.hir_id); @@ -335,7 +335,7 @@ fn check_trait<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item: &hir::Item) { }); } -fn check_item_fn<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item: &hir::Item) { +fn check_item_fn<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item: &hir::Item) { for_item(tcx, item).with_fcx(|fcx, tcx| { let def_id = fcx.tcx.hir().local_def_id_from_hir_id(item.hir_id); let sig = fcx.tcx.fn_sig(def_id); @@ -347,7 +347,7 @@ fn check_item_fn<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item: &hir::Item) { }) } -fn check_item_type<'a, 'tcx>( +fn check_item_type<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item_id: hir::HirId, ty_span: Span, @@ -380,7 +380,7 @@ fn check_item_type<'a, 'tcx>( }); } -fn check_impl<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn check_impl<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item: &hir::Item, ast_self_ty: &hir::Ty, ast_trait_ref: &Option) @@ -421,7 +421,7 @@ fn check_impl<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } /// Checks where-clauses and inline bounds that are declared on `def_id`. -fn check_where_clauses<'a, 'gcx, 'fcx, 'tcx>( +fn check_where_clauses<'gcx, 'fcx, 'tcx>( tcx: TyCtxt<'gcx, 'gcx, 'gcx>, fcx: &FnCtxt<'fcx, 'gcx, 'tcx>, span: Span, @@ -574,7 +574,7 @@ fn check_where_clauses<'a, 'gcx, 'fcx, 'tcx>( } } -fn check_fn_or_method<'a, 'fcx, 'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'gcx, 'gcx>, +fn check_fn_or_method<'fcx, 'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'gcx, 'gcx>, fcx: &FnCtxt<'fcx, 'gcx, 'tcx>, span: Span, sig: ty::PolyFnSig<'tcx>, @@ -616,7 +616,7 @@ fn check_fn_or_method<'a, 'fcx, 'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'gcx, 'gcx>, /// fn b() -> Foo { .. } /// ``` /// -fn check_existential_types<'a, 'fcx, 'gcx, 'tcx>( +fn check_existential_types<'fcx, 'gcx, 'tcx>( tcx: TyCtxt<'gcx, 'gcx, 'gcx>, fcx: &FnCtxt<'fcx, 'gcx, 'tcx>, fn_def_id: DefId, @@ -930,7 +930,7 @@ fn receiver_is_valid<'fcx, 'tcx, 'gcx>( true } -fn check_variances_for_type_defn<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn check_variances_for_type_defn<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item: &hir::Item, hir_generics: &hir::Generics) { @@ -971,7 +971,7 @@ fn check_variances_for_type_defn<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } } -fn report_bivariance<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn report_bivariance<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, span: Span, param_name: ast::Name) { @@ -1133,7 +1133,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } } -fn error_392<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, span: Span, param_name: ast::Name) +fn error_392<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, span: Span, param_name: ast::Name) -> DiagnosticBuilder<'tcx> { let mut err = struct_span_err!(tcx.sess, span, E0392, "parameter `{}` is never used", param_name); diff --git a/src/librustc_typeck/check_unused.rs b/src/librustc_typeck/check_unused.rs index aecffd4c7d5b2..bb587da9314f8 100644 --- a/src/librustc_typeck/check_unused.rs +++ b/src/librustc_typeck/check_unused.rs @@ -13,7 +13,7 @@ use rustc::util::nodemap::DefIdSet; use rustc_data_structures::fx::FxHashMap; -pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn check_crate<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { let mut used_trait_imports = DefIdSet::default(); for &body_id in tcx.hir().krate().bodies.keys() { let item_def_id = tcx.hir().body_owner_def_id(body_id); diff --git a/src/librustc_typeck/coherence/builtin.rs b/src/librustc_typeck/coherence/builtin.rs index 30ad1d32f2a2b..497392e7661f4 100644 --- a/src/librustc_typeck/coherence/builtin.rs +++ b/src/librustc_typeck/coherence/builtin.rs @@ -17,7 +17,7 @@ use rustc::hir::def_id::DefId; use hir::Node; use rustc::hir::{self, ItemKind}; -pub fn check_trait<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, trait_def_id: DefId) { +pub fn check_trait<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, trait_def_id: DefId) { Checker { tcx, trait_def_id } .check(tcx.lang_items().drop_trait(), visit_implementation_of_drop) .check(tcx.lang_items().copy_trait(), visit_implementation_of_copy) @@ -45,7 +45,7 @@ impl<'tcx> Checker<'tcx> { } } -fn visit_implementation_of_drop<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_did: DefId) { +fn visit_implementation_of_drop<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_did: DefId) { if let ty::Adt(..) = tcx.type_of(impl_did).sty { /* do nothing */ } else { @@ -73,7 +73,7 @@ fn visit_implementation_of_drop<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_di } } -fn visit_implementation_of_copy<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_did: DefId) { +fn visit_implementation_of_copy<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_did: DefId) { debug!("visit_implementation_of_copy: impl_did={:?}", impl_did); let impl_hir_id = if let Some(n) = tcx.hir().as_local_hir_id(impl_did) { @@ -153,7 +153,7 @@ fn visit_implementation_of_coerce_unsized(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_di } } -fn visit_implementation_of_dispatch_from_dyn<'a, 'tcx>( +fn visit_implementation_of_dispatch_from_dyn<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_did: DefId, ) { @@ -324,7 +324,7 @@ fn visit_implementation_of_dispatch_from_dyn<'a, 'tcx>( } } -pub fn coerce_unsized_info<'a, 'gcx>(gcx: TyCtxt<'gcx, 'gcx, 'gcx>, +pub fn coerce_unsized_info<'gcx>(gcx: TyCtxt<'gcx, 'gcx, 'gcx>, impl_did: DefId) -> CoerceUnsizedInfo { debug!("compute_coerce_unsized_info(impl_did={:?})", impl_did); diff --git a/src/librustc_typeck/coherence/inherent_impls.rs b/src/librustc_typeck/coherence/inherent_impls.rs index 5189f4a139095..edef389726112 100644 --- a/src/librustc_typeck/coherence/inherent_impls.rs +++ b/src/librustc_typeck/coherence/inherent_impls.rs @@ -17,7 +17,7 @@ use syntax::ast; use syntax_pos::Span; /// On-demand query: yields a map containing all types mapped to their inherent impls. -pub fn crate_inherent_impls<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn crate_inherent_impls<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, crate_num: CrateNum) -> &'tcx CrateInherentImpls { assert_eq!(crate_num, LOCAL_CRATE); @@ -32,7 +32,7 @@ pub fn crate_inherent_impls<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } /// On-demand query: yields a vector of the inherent impls for a specific type. -pub fn inherent_impls<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn inherent_impls<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ty_def_id: DefId) -> &'tcx [DefId] { assert!(ty_def_id.is_local()); diff --git a/src/librustc_typeck/coherence/inherent_impls_overlap.rs b/src/librustc_typeck/coherence/inherent_impls_overlap.rs index 56c03e20405fa..e1b8169e0c90c 100644 --- a/src/librustc_typeck/coherence/inherent_impls_overlap.rs +++ b/src/librustc_typeck/coherence/inherent_impls_overlap.rs @@ -5,7 +5,7 @@ use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::traits::{self, IntercrateMode}; use rustc::ty::TyCtxt; -pub fn crate_inherent_impls_overlap_check<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn crate_inherent_impls_overlap_check<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, crate_num: CrateNum) { assert_eq!(crate_num, LOCAL_CRATE); let krate = tcx.hir().krate(); diff --git a/src/librustc_typeck/coherence/mod.rs b/src/librustc_typeck/coherence/mod.rs index e33adcbacfe12..3ec88cbbd29dd 100644 --- a/src/librustc_typeck/coherence/mod.rs +++ b/src/librustc_typeck/coherence/mod.rs @@ -18,7 +18,7 @@ mod inherent_impls_overlap; mod orphan; mod unsafety; -fn check_impl<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, hir_id: HirId) { +fn check_impl<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, hir_id: HirId) { let impl_def_id = tcx.hir().local_def_id_from_hir_id(hir_id); // If there are no traits, then this implementation must have a @@ -132,7 +132,7 @@ pub fn provide(providers: &mut Providers<'_>) { }; } -fn coherent_trait<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { +fn coherent_trait<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { let impls = tcx.hir().trait_impls(def_id); for &impl_id in impls { check_impl(tcx, impl_id); @@ -143,7 +143,7 @@ fn coherent_trait<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { builtin::check_trait(tcx, def_id); } -pub fn check_coherence<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn check_coherence<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { for &trait_def_id in tcx.hir().krate().trait_impls.keys() { tcx.ensure().coherent_trait(trait_def_id); } @@ -159,7 +159,7 @@ pub fn check_coherence<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { /// Overlap: no two impls for the same trait are implemented for the /// same type. Likewise, no two inherent impls for a given type /// constructor provide a method with the same name. -fn check_impl_overlap<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, hir_id: HirId) { +fn check_impl_overlap<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, hir_id: HirId) { let impl_def_id = tcx.hir().local_def_id_from_hir_id(hir_id); let trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap(); let trait_def_id = trait_ref.def_id; diff --git a/src/librustc_typeck/coherence/orphan.rs b/src/librustc_typeck/coherence/orphan.rs index 144d70cec0c02..a9307f2669553 100644 --- a/src/librustc_typeck/coherence/orphan.rs +++ b/src/librustc_typeck/coherence/orphan.rs @@ -6,7 +6,7 @@ use rustc::ty::{self, TyCtxt}; use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::hir; -pub fn check<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn check<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { let mut orphan = OrphanChecker { tcx }; tcx.hir().krate().visit_all_item_likes(&mut orphan); } diff --git a/src/librustc_typeck/coherence/unsafety.rs b/src/librustc_typeck/coherence/unsafety.rs index 43b513667101a..b5369a8777d22 100644 --- a/src/librustc_typeck/coherence/unsafety.rs +++ b/src/librustc_typeck/coherence/unsafety.rs @@ -5,7 +5,7 @@ use rustc::ty::TyCtxt; use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::hir::{self, Unsafety}; -pub fn check<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn check<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { let mut unsafety = UnsafetyChecker { tcx }; tcx.hir().krate().visit_all_item_likes(&mut unsafety); } diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index 4b2217791d028..b012468f50966 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -253,7 +253,7 @@ impl AstConv<'tcx, 'tcx> for ItemCtxt<'tcx> { } } -fn type_param_predicates<'a, 'tcx>( +fn type_param_predicates<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, (item_def_id, def_id): (DefId, DefId), ) -> &'tcx ty::GenericPredicates<'tcx> { @@ -381,7 +381,7 @@ impl ItemCtxt<'tcx> { /// parameter with ID `param_id`. We use this so as to avoid running /// `ast_ty_to_ty`, because we want to avoid triggering an all-out /// conversion of the type to avoid inducing unnecessary cycles. -fn is_param<'a, 'tcx>( +fn is_param<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ast_ty: &hir::Ty, param_id: hir::HirId, @@ -398,7 +398,7 @@ fn is_param<'a, 'tcx>( } } -fn convert_item<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item_id: hir::HirId) { +fn convert_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item_id: hir::HirId) { let it = tcx.hir().expect_item_by_hir_id(item_id); debug!("convert: item {} with id {}", it.ident, it.hir_id); let def_id = tcx.hir().local_def_id_from_hir_id(item_id); @@ -480,7 +480,7 @@ fn convert_item<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item_id: hir::HirId) { } } -fn convert_trait_item<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, trait_item_id: hir::HirId) { +fn convert_trait_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, trait_item_id: hir::HirId) { let trait_item = tcx.hir().expect_trait_item(trait_item_id); let def_id = tcx.hir().local_def_id_from_hir_id(trait_item.hir_id); tcx.generics_of(def_id); @@ -501,7 +501,7 @@ fn convert_trait_item<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, trait_item_id: hi tcx.predicates_of(def_id); } -fn convert_impl_item<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_item_id: hir::HirId) { +fn convert_impl_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_item_id: hir::HirId) { let def_id = tcx.hir().local_def_id_from_hir_id(impl_item_id); tcx.generics_of(def_id); tcx.type_of(def_id); @@ -511,14 +511,14 @@ fn convert_impl_item<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_item_id: hir: } } -fn convert_variant_ctor<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ctor_id: hir::HirId) { +fn convert_variant_ctor<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ctor_id: hir::HirId) { let def_id = tcx.hir().local_def_id_from_hir_id(ctor_id); tcx.generics_of(def_id); tcx.type_of(def_id); tcx.predicates_of(def_id); } -fn convert_enum_variant_types<'a, 'tcx>( +fn convert_enum_variant_types<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, variants: &[hir::Variant], @@ -570,7 +570,7 @@ fn convert_enum_variant_types<'a, 'tcx>( } } -fn convert_variant<'a, 'tcx>( +fn convert_variant<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, variant_did: Option, ctor_did: Option, @@ -627,7 +627,7 @@ fn convert_variant<'a, 'tcx>( ) } -fn adt_def<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::AdtDef { +fn adt_def<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::AdtDef { use rustc::hir::*; let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); @@ -694,7 +694,7 @@ fn adt_def<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty:: /// Ensures that the super-predicates of the trait with a `DefId` /// of `trait_def_id` are converted and stored. This also ensures that /// the transitive super-predicates are converted. -fn super_predicates_of<'a, 'tcx>( +fn super_predicates_of<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, trait_def_id: DefId, ) -> &'tcx ty::GenericPredicates<'tcx> { @@ -748,7 +748,7 @@ fn super_predicates_of<'a, 'tcx>( }) } -fn trait_def<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::TraitDef { +fn trait_def<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::TraitDef { let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); let item = tcx.hir().expect_item_by_hir_id(hir_id); @@ -779,7 +779,7 @@ fn trait_def<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty tcx.arena.alloc(def) } -fn has_late_bound_regions<'a, 'tcx>( +fn has_late_bound_regions<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, node: Node<'tcx>, ) -> Option { @@ -840,7 +840,7 @@ fn has_late_bound_regions<'a, 'tcx>( } } - fn has_late_bound_regions<'a, 'tcx>( + fn has_late_bound_regions<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, generics: &'tcx hir::Generics, decl: &'tcx hir::FnDecl, @@ -890,7 +890,7 @@ fn has_late_bound_regions<'a, 'tcx>( } } -fn generics_of<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::Generics { +fn generics_of<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::Generics { use rustc::hir::*; let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); @@ -1133,7 +1133,7 @@ fn generics_of<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx }) } -fn report_assoc_ty_on_inherent_impl<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, span: Span) { +fn report_assoc_ty_on_inherent_impl<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, span: Span) { span_err!( tcx.sess, span, @@ -1142,7 +1142,7 @@ fn report_assoc_ty_on_inherent_impl<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, spa ); } -fn type_of<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> { +fn type_of<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> { checked_type_of(tcx, def_id, true).unwrap() } @@ -1150,7 +1150,7 @@ fn type_of<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> { /// /// If you want to fail anyway, you can set the `fail` parameter to true, but in this case, /// you'd better just call [`type_of`] directly. -pub fn checked_type_of<'a, 'tcx>( +pub fn checked_type_of<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, fail: bool, @@ -1479,7 +1479,7 @@ pub fn checked_type_of<'a, 'tcx>( }) } -fn find_existential_constraints<'a, 'tcx>( +fn find_existential_constraints<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, ) -> Ty<'tcx> { @@ -1700,7 +1700,7 @@ fn find_existential_constraints<'a, 'tcx>( } } -fn fn_sig<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> ty::PolyFnSig<'tcx> { +fn fn_sig<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> ty::PolyFnSig<'tcx> { use rustc::hir::*; use rustc::hir::Node::*; @@ -1776,7 +1776,7 @@ fn fn_sig<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> ty::PolyFnS } } -fn impl_trait_ref<'a, 'tcx>( +fn impl_trait_ref<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, ) -> Option> { @@ -1794,7 +1794,7 @@ fn impl_trait_ref<'a, 'tcx>( } } -fn impl_polarity<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> hir::ImplPolarity { +fn impl_polarity<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> hir::ImplPolarity { let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); match tcx.hir().expect_item_by_hir_id(hir_id).node { hir::ItemKind::Impl(_, polarity, ..) => polarity, @@ -1825,7 +1825,7 @@ fn early_bound_lifetimes_from_generics<'a, 'tcx: 'a>( /// Returns a list of type predicates for the definition with ID `def_id`, including inferred /// lifetime constraints. This includes all predicates returned by `explicit_predicates_of`, plus /// inferred constraints concerning which regions outlive other regions. -fn predicates_defined_on<'a, 'tcx>( +fn predicates_defined_on<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, ) -> &'tcx ty::GenericPredicates<'tcx> { @@ -1855,7 +1855,7 @@ fn predicates_defined_on<'a, 'tcx>( /// Returns a list of all type predicates (explicit and implicit) for the definition with /// ID `def_id`. This includes all predicates returned by `predicates_defined_on`, plus /// `Self: Trait` predicates for traits. -fn predicates_of<'a, 'tcx>( +fn predicates_of<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, ) -> &'tcx ty::GenericPredicates<'tcx> { @@ -1885,7 +1885,7 @@ fn predicates_of<'a, 'tcx>( /// Returns a list of user-specified type predicates for the definition with ID `def_id`. /// N.B., this does not include any implied/inferred constraints. -fn explicit_predicates_of<'a, 'tcx>( +fn explicit_predicates_of<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, ) -> &'tcx ty::GenericPredicates<'tcx> { @@ -2248,7 +2248,7 @@ fn predicates_from_bound<'tcx>( } } -fn compute_sig_of_foreign_fn_decl<'a, 'tcx>( +fn compute_sig_of_foreign_fn_decl<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, decl: &hir::FnDecl, @@ -2293,7 +2293,7 @@ fn compute_sig_of_foreign_fn_decl<'a, 'tcx>( fty } -fn is_foreign_item<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> bool { +fn is_foreign_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> bool { match tcx.hir().get_if_local(def_id) { Some(Node::ForeignItem(..)) => true, Some(_) => false, @@ -2301,7 +2301,7 @@ fn is_foreign_item<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> bo } } -fn static_mutability<'a, 'tcx>( +fn static_mutability<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, ) -> Option { @@ -2412,7 +2412,7 @@ fn from_target_feature( } } -fn linkage_by_name<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, name: &str) -> Linkage { +fn linkage_by_name<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, name: &str) -> Linkage { use rustc::mir::mono::Linkage::*; // Use the names from src/llvm/docs/LangRef.rst here. Most types are only @@ -2447,7 +2447,7 @@ fn linkage_by_name<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, name: } } -fn codegen_fn_attrs<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, id: DefId) -> CodegenFnAttrs { +fn codegen_fn_attrs<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, id: DefId) -> CodegenFnAttrs { let attrs = tcx.get_attrs(id); let mut codegen_fn_attrs = CodegenFnAttrs::new(); diff --git a/src/librustc_typeck/impl_wf_check.rs b/src/librustc_typeck/impl_wf_check.rs index 5ffaa1eff2c19..834e939f40f77 100644 --- a/src/librustc_typeck/impl_wf_check.rs +++ b/src/librustc_typeck/impl_wf_check.rs @@ -49,7 +49,7 @@ use syntax_pos::Span; /// impl<'a> Trait for Bar { type X = &'a i32; } /// // ^ 'a is unused and appears in assoc type, error /// ``` -pub fn impl_wf_check<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn impl_wf_check<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { // We will tag this as part of the WF check -- logically, it is, // but it's one that we must perform earlier than the rest of // WfCheck. @@ -92,7 +92,7 @@ impl ItemLikeVisitor<'tcx> for ImplWfCheck<'tcx> { fn visit_impl_item(&mut self, _impl_item: &'tcx hir::ImplItem) { } } -fn enforce_impl_params_are_constrained<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn enforce_impl_params_are_constrained<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_def_id: DefId, impl_item_refs: &[hir::ImplItemRef]) { @@ -186,7 +186,7 @@ fn report_unused_parameter(tcx: TyCtxt<'_, '_, '_>, } /// Enforce that we do not have two items in an impl with the same name. -fn enforce_impl_items_are_distinct<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn enforce_impl_items_are_distinct<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_item_refs: &[hir::ImplItemRef]) { let mut seen_type_items = FxHashMap::default(); diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index b77c5eea49477..74ff8ad0f1753 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -124,7 +124,7 @@ pub struct TypeAndSubsts<'tcx> { ty: Ty<'tcx>, } -fn check_type_alias_enum_variants_enabled<'a, 'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, +fn check_type_alias_enum_variants_enabled<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, span: Span) { if !tcx.features().type_alias_enum_variants { let mut err = tcx.sess.struct_span_err( @@ -151,7 +151,7 @@ fn require_c_abi_if_c_variadic(tcx: TyCtxt<'_, '_, '_>, } } -fn require_same_types<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn require_same_types<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, cause: &ObligationCause<'tcx>, expected: Ty<'tcx>, actual: Ty<'tcx>) @@ -179,7 +179,7 @@ fn require_same_types<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, }) } -fn check_main_fn_ty<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, main_def_id: DefId) { +fn check_main_fn_ty<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, main_def_id: DefId) { let main_id = tcx.hir().as_local_hir_id(main_def_id).unwrap(); let main_span = tcx.def_span(main_def_id); let main_t = tcx.type_of(main_def_id); @@ -244,7 +244,7 @@ fn check_main_fn_ty<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, main_def_id: DefId) } } -fn check_start_fn_ty<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, start_def_id: DefId) { +fn check_start_fn_ty<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, start_def_id: DefId) { let start_id = tcx.hir().as_local_hir_id(start_def_id).unwrap(); let start_span = tcx.def_span(start_def_id); let start_t = tcx.type_of(start_def_id); @@ -301,7 +301,7 @@ fn check_start_fn_ty<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, start_def_id: DefI } } -fn check_for_entry_fn<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +fn check_for_entry_fn<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { match tcx.entry_fn(LOCAL_CRATE) { Some((def_id, EntryFnType::Main)) => check_main_fn_ty(tcx, def_id), Some((def_id, EntryFnType::Start)) => check_start_fn_ty(tcx, def_id), @@ -318,7 +318,7 @@ pub fn provide(providers: &mut Providers<'_>) { impl_wf_check::provide(providers); } -pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) +pub fn check_crate<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Result<(), ErrorReported> { tcx.sess.profiler(|p| p.start_activity("type-check crate")); @@ -381,7 +381,7 @@ pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) /// A quasi-deprecated helper used in rustdoc and clippy to get /// the type from a HIR node. -pub fn hir_ty_to_ty<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, hir_ty: &hir::Ty) -> Ty<'tcx> { +pub fn hir_ty_to_ty<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, hir_ty: &hir::Ty) -> Ty<'tcx> { // In case there are any projections, etc., find the "environment" // def-ID that will be used to determine the traits/predicates in // scope. This is derived from the enclosing item-like thing. @@ -392,7 +392,7 @@ pub fn hir_ty_to_ty<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, hir_ty: &hir::Ty) - astconv::AstConv::ast_ty_to_ty(&item_cx, hir_ty) } -pub fn hir_trait_to_predicates<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, hir_trait: &hir::TraitRef) +pub fn hir_trait_to_predicates<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, hir_trait: &hir::TraitRef) -> (ty::PolyTraitRef<'tcx>, Bounds<'tcx>) { // In case there are any projections, etc., find the "environment" // def-ID that will be used to determine the traits/predicates in diff --git a/src/librustc_typeck/outlives/mod.rs b/src/librustc_typeck/outlives/mod.rs index da4b9c686195d..3966a7c1776a1 100644 --- a/src/librustc_typeck/outlives/mod.rs +++ b/src/librustc_typeck/outlives/mod.rs @@ -20,7 +20,7 @@ pub fn provide(providers: &mut Providers<'_>) { }; } -fn inferred_outlives_of<'a, 'tcx>( +fn inferred_outlives_of<'tcx>( tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item_def_id: DefId, ) -> &'tcx [ty::Predicate<'tcx>] { diff --git a/src/librustc_typeck/outlives/test.rs b/src/librustc_typeck/outlives/test.rs index 06097349fd6a4..2b0ab90693685 100644 --- a/src/librustc_typeck/outlives/test.rs +++ b/src/librustc_typeck/outlives/test.rs @@ -3,7 +3,7 @@ use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::ty::TyCtxt; use syntax::symbol::sym; -pub fn test_inferred_outlives<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn test_inferred_outlives<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { tcx.hir() .krate() .visit_all_item_likes(&mut OutlivesTest { tcx }); diff --git a/src/librustc_typeck/variance/mod.rs b/src/librustc_typeck/variance/mod.rs index d850e48914539..a9d12a0b291b4 100644 --- a/src/librustc_typeck/variance/mod.rs +++ b/src/librustc_typeck/variance/mod.rs @@ -34,7 +34,7 @@ pub fn provide(providers: &mut Providers<'_>) { }; } -fn crate_variances<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, crate_num: CrateNum) +fn crate_variances<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, crate_num: CrateNum) -> &'tcx CrateVariancesMap<'tcx> { assert_eq!(crate_num, LOCAL_CRATE); let mut arena = arena::TypedArena::default(); @@ -43,7 +43,7 @@ fn crate_variances<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, crate_num: CrateNum) tcx.arena.alloc(solve::solve_constraints(constraints_cx)) } -fn variances_of<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item_def_id: DefId) +fn variances_of<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item_def_id: DefId) -> &'tcx [ty::Variance] { let id = tcx.hir().as_local_hir_id(item_def_id).expect("expected local def-id"); let unsupported = || { diff --git a/src/librustc_typeck/variance/test.rs b/src/librustc_typeck/variance/test.rs index bd4e8d3fd5d7f..0ff86f5a8cfde 100644 --- a/src/librustc_typeck/variance/test.rs +++ b/src/librustc_typeck/variance/test.rs @@ -3,7 +3,7 @@ use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::ty::TyCtxt; use syntax::symbol::sym; -pub fn test_variance<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn test_variance<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { tcx.hir().krate().visit_all_item_likes(&mut VarianceTest { tcx }); } diff --git a/src/librustdoc/clean/auto_trait.rs b/src/librustdoc/clean/auto_trait.rs index f40cb09bde84f..2bf80198381da 100644 --- a/src/librustdoc/clean/auto_trait.rs +++ b/src/librustdoc/clean/auto_trait.rs @@ -313,7 +313,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { lifetime_predicates } - fn extract_for_generics<'b, 'c, 'd>( + fn extract_for_generics<'c, 'd>( &self, tcx: TyCtxt<'d, 'c, 'd>, pred: ty::Predicate<'d>, @@ -448,7 +448,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { // * Fn bounds are handled specially - instead of leaving it as 'T: Fn(), = // K', we use the dedicated syntax 'T: Fn() -> K' // * We explcitly add a '?Sized' bound if we didn't find any 'Sized' predicates for a type - fn param_env_to_generics<'b, 'c, 'cx>( + fn param_env_to_generics<'c, 'cx>( &self, tcx: TyCtxt<'cx, 'c, 'cx>, param_env_def_id: DefId, From 17cdd356da598eb46515352277d3664f05c888ee Mon Sep 17 00:00:00 2001 From: Eduard-Mihai Burtescu Date: Tue, 11 Jun 2019 23:47:08 +0300 Subject: [PATCH 3/7] rustc: replace `TyCtxt<'tcx, 'gcx, 'tcx>` with `TyCtxt<'gcx, 'tcx>`. --- src/librustc/cfg/construct.rs | 4 +- src/librustc/cfg/graphviz.rs | 2 +- src/librustc/cfg/mod.rs | 2 +- src/librustc/dep_graph/dep_node.rs | 40 +++---- src/librustc/dep_graph/graph.rs | 10 +- src/librustc/dep_graph/safe.rs | 2 +- src/librustc/hir/check_attr.rs | 4 +- src/librustc/hir/def_id.rs | 2 +- src/librustc/hir/upvars.rs | 2 +- src/librustc/ich/hcx.rs | 2 +- src/librustc/infer/canonical/canonicalizer.rs | 6 +- src/librustc/infer/canonical/mod.rs | 2 +- .../infer/canonical/query_response.rs | 2 +- src/librustc/infer/canonical/substitute.rs | 6 +- src/librustc/infer/combine.rs | 4 +- src/librustc/infer/equate.rs | 2 +- src/librustc/infer/error_reporting/mod.rs | 6 +- .../nice_region_error/find_anon_type.rs | 4 +- .../error_reporting/nice_region_error/mod.rs | 2 +- .../nice_region_error/placeholder_error.rs | 2 +- src/librustc/infer/freshen.rs | 2 +- src/librustc/infer/fudge.rs | 2 +- src/librustc/infer/glb.rs | 2 +- .../infer/lexical_region_resolve/mod.rs | 6 +- src/librustc/infer/lub.rs | 2 +- src/librustc/infer/mod.rs | 12 +- src/librustc/infer/nll_relate/mod.rs | 4 +- src/librustc/infer/opaque_types/mod.rs | 8 +- .../infer/outlives/free_region_map.rs | 4 +- src/librustc/infer/outlives/obligations.rs | 4 +- src/librustc/infer/outlives/verify.rs | 4 +- .../infer/region_constraints/leak_check.rs | 4 +- src/librustc/infer/region_constraints/mod.rs | 10 +- src/librustc/infer/resolve.rs | 6 +- src/librustc/infer/sub.rs | 2 +- src/librustc/infer/unify_key.rs | 6 +- src/librustc/lint/context.rs | 16 +-- src/librustc/lint/mod.rs | 6 +- src/librustc/macros.rs | 6 +- src/librustc/middle/cstore.rs | 4 +- src/librustc/middle/dead.rs | 16 +-- src/librustc/middle/dependency_format.rs | 10 +- src/librustc/middle/entry.rs | 6 +- src/librustc/middle/exported_symbols.rs | 6 +- src/librustc/middle/expr_use_visitor.rs | 8 +- src/librustc/middle/free_region.rs | 4 +- src/librustc/middle/intrinsicck.rs | 8 +- src/librustc/middle/lang_items.rs | 8 +- src/librustc/middle/lib_features.rs | 6 +- src/librustc/middle/liveness.rs | 8 +- src/librustc/middle/mem_categorization.rs | 8 +- src/librustc/middle/reachable.rs | 10 +- src/librustc/middle/region.rs | 12 +- src/librustc/middle/resolve_lifetime.rs | 18 +-- src/librustc/middle/stability.rs | 18 +-- src/librustc/middle/weak_lang_items.rs | 10 +- src/librustc/mir/interpret/mod.rs | 2 +- src/librustc/mir/mod.rs | 4 +- src/librustc/mir/mono.rs | 30 ++--- src/librustc/mir/tcx.rs | 14 +-- src/librustc/traits/auto_trait.rs | 8 +- src/librustc/traits/codegen/mod.rs | 4 +- src/librustc/traits/coherence.rs | 14 +-- src/librustc/traits/engine.rs | 2 +- src/librustc/traits/error_reporting.rs | 6 +- src/librustc/traits/mod.rs | 20 ++-- src/librustc/traits/object_safety.rs | 4 +- src/librustc/traits/on_unimplemented.rs | 14 +-- src/librustc/traits/project.rs | 4 +- src/librustc/traits/query/dropck_outlives.rs | 6 +- src/librustc/traits/query/normalize.rs | 2 +- .../traits/query/normalize_erasing_regions.rs | 6 +- .../traits/query/type_op/ascribe_user_type.rs | 4 +- src/librustc/traits/query/type_op/eq.rs | 4 +- .../query/type_op/implied_outlives_bounds.rs | 4 +- src/librustc/traits/query/type_op/mod.rs | 4 +- .../traits/query/type_op/normalize.rs | 14 +-- src/librustc/traits/query/type_op/outlives.rs | 4 +- .../traits/query/type_op/prove_predicate.rs | 4 +- src/librustc/traits/query/type_op/subtype.rs | 4 +- src/librustc/traits/select.rs | 6 +- src/librustc/traits/specialize/mod.rs | 8 +- .../traits/specialize/specialization_graph.rs | 16 +-- src/librustc/traits/structural_impls.rs | 20 ++-- src/librustc/traits/util.rs | 26 ++--- src/librustc/ty/_match.rs | 6 +- src/librustc/ty/adjustment.rs | 2 +- src/librustc/ty/codec.rs | 2 +- src/librustc/ty/constness.rs | 8 +- src/librustc/ty/context.rs | 42 +++---- src/librustc/ty/erase_regions.rs | 8 +- src/librustc/ty/error.rs | 4 +- src/librustc/ty/fast_reject.rs | 2 +- src/librustc/ty/fold.rs | 34 +++--- .../ty/inhabitedness/def_id_forest.rs | 8 +- src/librustc/ty/inhabitedness/mod.rs | 10 +- src/librustc/ty/instance.rs | 26 ++--- src/librustc/ty/layout.rs | 38 +++--- src/librustc/ty/mod.rs | 86 +++++++------- src/librustc/ty/outlives.rs | 2 +- src/librustc/ty/print/mod.rs | 2 +- src/librustc/ty/print/obsolete.rs | 4 +- src/librustc/ty/print/pretty.rs | 8 +- src/librustc/ty/query/config.rs | 22 ++-- src/librustc/ty/query/job.rs | 10 +- src/librustc/ty/query/keys.rs | 42 +++---- src/librustc/ty/query/on_disk_cache.rs | 20 ++-- src/librustc/ty/query/plumbing.rs | 36 +++--- src/librustc/ty/query/values.rs | 12 +- src/librustc/ty/relate.rs | 2 +- src/librustc/ty/structural_impls.rs | 64 +++++------ src/librustc/ty/sty.rs | 108 +++++++++--------- src/librustc/ty/subst.rs | 26 ++--- src/librustc/ty/trait_def.rs | 6 +- src/librustc/ty/util.rs | 48 ++++---- src/librustc/ty/wf.rs | 2 +- src/librustc_borrowck/borrowck/check_loans.rs | 2 +- .../borrowck/gather_loans/gather_moves.rs | 2 +- .../borrowck/gather_loans/mod.rs | 2 +- src/librustc_borrowck/borrowck/mod.rs | 10 +- src/librustc_borrowck/borrowck/move_data.rs | 10 +- src/librustc_borrowck/dataflow.rs | 4 +- src/librustc_codegen_llvm/allocator.rs | 2 +- src/librustc_codegen_llvm/attributes.rs | 2 +- src/librustc_codegen_llvm/back/write.rs | 2 +- src/librustc_codegen_llvm/base.rs | 6 +- src/librustc_codegen_llvm/builder.rs | 2 +- src/librustc_codegen_llvm/context.rs | 8 +- .../debuginfo/metadata.rs | 2 +- src/librustc_codegen_llvm/lib.rs | 14 +-- src/librustc_codegen_ssa/back/linker.rs | 4 +- .../back/symbol_export.rs | 18 +-- src/librustc_codegen_ssa/back/write.rs | 16 +-- src/librustc_codegen_ssa/base.rs | 10 +- src/librustc_codegen_ssa/common.rs | 2 +- .../debuginfo/type_names.rs | 8 +- src/librustc_codegen_ssa/traits/backend.rs | 8 +- src/librustc_codegen_utils/codegen_backend.rs | 2 +- src/librustc_codegen_utils/lib.rs | 2 +- src/librustc_codegen_utils/symbol_names.rs | 2 +- .../symbol_names/legacy.rs | 8 +- src/librustc_codegen_utils/symbol_names/v0.rs | 6 +- .../symbol_names_test.rs | 4 +- src/librustc_driver/pretty.rs | 16 +-- src/librustc_incremental/assert_dep_graph.rs | 8 +- .../assert_module_sources.rs | 4 +- .../persist/dirty_clean.rs | 10 +- src/librustc_incremental/persist/load.rs | 2 +- src/librustc_incremental/persist/save.rs | 6 +- src/librustc_interface/passes.rs | 8 +- src/librustc_interface/proc_macro_decls.rs | 4 +- src/librustc_lint/lib.rs | 2 +- src/librustc_lint/types.rs | 6 +- src/librustc_macros/src/query.rs | 8 +- src/librustc_metadata/cstore_impl.rs | 4 +- src/librustc_metadata/decoder.rs | 46 ++++---- src/librustc_metadata/encoder.rs | 8 +- src/librustc_metadata/foreign_modules.rs | 4 +- src/librustc_metadata/link_args.rs | 2 +- src/librustc_metadata/native_libs.rs | 4 +- src/librustc_mir/borrow_check/borrow_set.rs | 4 +- src/librustc_mir/borrow_check/mod.rs | 2 +- src/librustc_mir/borrow_check/move_errors.rs | 2 +- .../borrow_check/mutability_errors.rs | 6 +- .../nll/explain_borrow/find_use.rs | 6 +- .../borrow_check/nll/explain_borrow/mod.rs | 2 +- src/librustc_mir/borrow_check/nll/facts.rs | 4 +- .../borrow_check/nll/invalidation.rs | 4 +- .../error_reporting/region_name.rs | 8 +- .../region_infer/error_reporting/var_name.rs | 8 +- .../borrow_check/nll/region_infer/mod.rs | 16 +-- .../nll/type_check/constraint_conversion.rs | 2 +- .../nll/type_check/liveness/mod.rs | 2 +- .../borrow_check/nll/type_check/mod.rs | 8 +- .../borrow_check/nll/universal_regions.rs | 10 +- src/librustc_mir/borrow_check/path_utils.rs | 2 +- src/librustc_mir/borrow_check/place_ext.rs | 4 +- .../borrow_check/places_conflict.rs | 10 +- src/librustc_mir/borrow_check/prefixes.rs | 2 +- src/librustc_mir/build/mod.rs | 8 +- src/librustc_mir/const_eval.rs | 14 +-- .../dataflow/drop_flag_effects.rs | 18 +-- src/librustc_mir/dataflow/impls/borrows.rs | 4 +- src/librustc_mir/dataflow/impls/mod.rs | 16 +-- src/librustc_mir/dataflow/mod.rs | 4 +- .../dataflow/move_paths/builder.rs | 6 +- src/librustc_mir/dataflow/move_paths/mod.rs | 2 +- src/librustc_mir/hair/constant.rs | 2 +- src/librustc_mir/hair/cx/mod.rs | 6 +- src/librustc_mir/hair/pattern/_match.rs | 28 ++--- src/librustc_mir/hair/pattern/check_match.rs | 4 +- src/librustc_mir/hair/pattern/mod.rs | 10 +- src/librustc_mir/hair/util.rs | 2 +- src/librustc_mir/interpret/eval_context.rs | 2 +- .../interpret/intrinsics/type_name.rs | 8 +- src/librustc_mir/interpret/snapshot.rs | 2 +- src/librustc_mir/lints.rs | 4 +- src/librustc_mir/monomorphize/collector.rs | 42 +++---- src/librustc_mir/monomorphize/item.rs | 14 +-- src/librustc_mir/monomorphize/mod.rs | 2 +- src/librustc_mir/monomorphize/partitioning.rs | 24 ++-- src/librustc_mir/shim.rs | 18 +-- src/librustc_mir/transform/add_call_guards.rs | 2 +- .../transform/add_moves_for_packed_drops.rs | 8 +- src/librustc_mir/transform/add_retag.rs | 4 +- src/librustc_mir/transform/check_unsafety.rs | 18 +-- .../transform/cleanup_post_borrowck.rs | 2 +- src/librustc_mir/transform/const_prop.rs | 10 +- src/librustc_mir/transform/copy_prop.rs | 2 +- src/librustc_mir/transform/deaggregator.rs | 2 +- src/librustc_mir/transform/dump_mir.rs | 6 +- src/librustc_mir/transform/elaborate_drops.rs | 10 +- src/librustc_mir/transform/erase_regions.rs | 6 +- src/librustc_mir/transform/generator.rs | 20 ++-- src/librustc_mir/transform/inline.rs | 6 +- src/librustc_mir/transform/instcombine.rs | 6 +- src/librustc_mir/transform/lower_128bit.rs | 10 +- src/librustc_mir/transform/mod.rs | 18 +-- src/librustc_mir/transform/no_landing_pads.rs | 4 +- src/librustc_mir/transform/promote_consts.rs | 4 +- src/librustc_mir/transform/qualify_consts.rs | 10 +- .../transform/qualify_min_const_fn.rs | 12 +- .../transform/remove_noop_landing_pads.rs | 4 +- src/librustc_mir/transform/rustc_peek.rs | 8 +- src/librustc_mir/transform/simplify.rs | 4 +- .../transform/simplify_branches.rs | 2 +- .../transform/uniform_array_move_out.rs | 6 +- src/librustc_mir/util/alignment.rs | 4 +- src/librustc_mir/util/borrowck_errors.rs | 2 +- src/librustc_mir/util/elaborate_drops.rs | 4 +- src/librustc_mir/util/graphviz.rs | 6 +- src/librustc_mir/util/liveness.rs | 6 +- src/librustc_mir/util/mod.rs | 2 +- src/librustc_mir/util/pretty.rs | 30 ++--- src/librustc_passes/layout_test.rs | 8 +- src/librustc_passes/loops.rs | 2 +- src/librustc_passes/rvalue_promotion.rs | 6 +- src/librustc_plugin/build.rs | 4 +- src/librustc_privacy/lib.rs | 42 +++---- src/librustc_save_analysis/dump_visitor.rs | 2 +- src/librustc_save_analysis/lib.rs | 4 +- src/librustc_traits/chalk_context/mod.rs | 10 +- .../chalk_context/program_clauses/builtin.rs | 8 +- .../chalk_context/program_clauses/mod.rs | 4 +- .../program_clauses/primitive.rs | 14 +-- .../chalk_context/resolvent_ops.rs | 2 +- src/librustc_traits/dropck_outlives.rs | 6 +- src/librustc_traits/evaluate_obligation.rs | 2 +- src/librustc_traits/generic_types.rs | 16 +-- .../implied_outlives_bounds.rs | 2 +- src/librustc_traits/lowering/environment.rs | 8 +- src/librustc_traits/lowering/mod.rs | 16 +-- .../normalize_erasing_regions.rs | 2 +- .../normalize_projection_ty.rs | 2 +- src/librustc_traits/type_op.rs | 18 +-- src/librustc_typeck/astconv.rs | 14 +-- src/librustc_typeck/check/autoderef.rs | 2 +- src/librustc_typeck/check/callee.rs | 2 +- src/librustc_typeck/check/compare_method.rs | 16 +-- src/librustc_typeck/check/dropck.rs | 6 +- src/librustc_typeck/check/intrinsic.rs | 6 +- src/librustc_typeck/check/method/probe.rs | 2 +- src/librustc_typeck/check/method/suggest.rs | 10 +- src/librustc_typeck/check/mod.rs | 64 +++++------ src/librustc_typeck/check/upvar.rs | 2 +- src/librustc_typeck/check/wfcheck.rs | 44 +++---- src/librustc_typeck/check/writeback.rs | 14 +-- src/librustc_typeck/check_unused.rs | 8 +- src/librustc_typeck/coherence/builtin.rs | 16 +-- .../coherence/inherent_impls.rs | 6 +- .../coherence/inherent_impls_overlap.rs | 4 +- src/librustc_typeck/coherence/mod.rs | 12 +- src/librustc_typeck/coherence/orphan.rs | 4 +- src/librustc_typeck/coherence/unsafety.rs | 4 +- src/librustc_typeck/collect.rs | 76 ++++++------ .../constrained_generic_params.rs | 4 +- src/librustc_typeck/impl_wf_check.rs | 12 +- src/librustc_typeck/lib.rs | 18 +-- src/librustc_typeck/outlives/explicit.rs | 2 +- .../outlives/implicit_infer.rs | 8 +- src/librustc_typeck/outlives/mod.rs | 4 +- src/librustc_typeck/outlives/test.rs | 4 +- src/librustc_typeck/outlives/utils.rs | 4 +- src/librustc_typeck/variance/constraints.rs | 2 +- src/librustc_typeck/variance/mod.rs | 4 +- src/librustc_typeck/variance/terms.rs | 6 +- src/librustc_typeck/variance/test.rs | 4 +- src/librustdoc/clean/auto_trait.rs | 10 +- src/librustdoc/clean/mod.rs | 4 +- src/librustdoc/core.rs | 2 +- .../hotplug_codegen_backend/the_backend.rs | 2 +- .../internal-lints/pass_ty_by_ref.rs | 30 ++--- .../internal-lints/pass_ty_by_ref.stderr | 42 +++---- .../internal-lints/qualified_ty_ty_ctxt.rs | 8 +- .../qualified_ty_ty_ctxt.stderr | 6 +- 295 files changed, 1433 insertions(+), 1433 deletions(-) diff --git a/src/librustc/cfg/construct.rs b/src/librustc/cfg/construct.rs index a6a688460dd6f..a7411c9667929 100644 --- a/src/librustc/cfg/construct.rs +++ b/src/librustc/cfg/construct.rs @@ -8,7 +8,7 @@ use crate::hir::{self, PatKind}; use crate::hir::def_id::DefId; struct CFGBuilder<'a, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, owner_def_id: DefId, tables: &'a ty::TypeckTables<'tcx>, graph: CFGGraph, @@ -30,7 +30,7 @@ struct LoopScope { break_index: CFGIndex, // where to go on a `break` } -pub fn construct<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn construct<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, body: &hir::Body) -> CFG { let mut graph = graph::Graph::new(); let entry = graph.add_node(CFGNodeData::Entry); diff --git a/src/librustc/cfg/graphviz.rs b/src/librustc/cfg/graphviz.rs index 57a63f3bd7348..481b5c72e9304 100644 --- a/src/librustc/cfg/graphviz.rs +++ b/src/librustc/cfg/graphviz.rs @@ -12,7 +12,7 @@ pub type Node<'a> = (cfg::CFGIndex, &'a cfg::CFGNode); pub type Edge<'a> = &'a cfg::CFGEdge; pub struct LabelledCFG<'a, 'tcx: 'a> { - pub tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + pub tcx: TyCtxt<'tcx, 'tcx>, pub cfg: &'a cfg::CFG, pub name: String, /// `labelled_edges` controls whether we emit labels on the edges diff --git a/src/librustc/cfg/mod.rs b/src/librustc/cfg/mod.rs index 887f550f351b6..deb76e057c538 100644 --- a/src/librustc/cfg/mod.rs +++ b/src/librustc/cfg/mod.rs @@ -49,7 +49,7 @@ pub type CFGNode = graph::Node; pub type CFGEdge = graph::Edge; impl CFG { - pub fn new<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + pub fn new<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, body: &hir::Body) -> CFG { construct::construct(tcx, body) } diff --git a/src/librustc/dep_graph/dep_node.rs b/src/librustc/dep_graph/dep_node.rs index 01dcdbf0ce545..acff8f621ac0a 100644 --- a/src/librustc/dep_graph/dep_node.rs +++ b/src/librustc/dep_graph/dep_node.rs @@ -204,7 +204,7 @@ macro_rules! define_dep_nodes { impl DepNode { #[allow(unreachable_code, non_snake_case)] #[inline(always)] - pub fn new<'a, 'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + pub fn new<'a, 'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, dep: DepConstructor<'gcx>) -> DepNode where 'gcx: 'a + 'tcx, @@ -307,7 +307,7 @@ macro_rules! define_dep_nodes { /// refers to something from the previous compilation session that /// has been removed. #[inline] - pub fn extract_def_id(&self, tcx: TyCtxt<'_, '_, '_>) -> Option { + pub fn extract_def_id(&self, tcx: TyCtxt<'_, '_>) -> Option { if self.kind.can_reconstruct_query_key() { let def_path_hash = DefPathHash(self.hash); tcx.def_path_hash_to_def_id.as_ref()? @@ -400,7 +400,7 @@ impl DefPathHash { impl DefId { #[inline(always)] - pub fn to_dep_node(self, tcx: TyCtxt<'_, '_, '_>, kind: DepKind) -> DepNode { + pub fn to_dep_node(self, tcx: TyCtxt<'_, '_>, kind: DepKind) -> DepNode { DepNode::from_def_path_hash(kind, tcx.def_path_hash(self)) } } @@ -442,23 +442,23 @@ rustc_dep_node_append!([define_dep_nodes!][ <'tcx> ]); pub trait RecoverKey<'tcx>: Sized { - fn recover(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, dep_node: &DepNode) -> Option; + fn recover(tcx: TyCtxt<'tcx, 'tcx>, dep_node: &DepNode) -> Option; } impl RecoverKey<'tcx> for CrateNum { - fn recover(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, dep_node: &DepNode) -> Option { + fn recover(tcx: TyCtxt<'tcx, 'tcx>, dep_node: &DepNode) -> Option { dep_node.extract_def_id(tcx).map(|id| id.krate) } } impl RecoverKey<'tcx> for DefId { - fn recover(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, dep_node: &DepNode) -> Option { + fn recover(tcx: TyCtxt<'tcx, 'tcx>, dep_node: &DepNode) -> Option { dep_node.extract_def_id(tcx) } } impl RecoverKey<'tcx> for DefIndex { - fn recover(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, dep_node: &DepNode) -> Option { + fn recover(tcx: TyCtxt<'tcx, 'tcx>, dep_node: &DepNode) -> Option { dep_node.extract_def_id(tcx).map(|id| id.index) } } @@ -470,11 +470,11 @@ trait DepNodeParams<'gcx: 'tcx, 'tcx>: fmt::Debug { /// Fingerprint to be used in DepNode. /// Not all DepNodeParams support being turned into a Fingerprint (they /// don't need to if the corresponding DepNode is anonymous). - fn to_fingerprint(&self, _: TyCtxt<'tcx, 'gcx, 'tcx>) -> Fingerprint { + fn to_fingerprint(&self, _: TyCtxt<'gcx, 'tcx>) -> Fingerprint { panic!("Not implemented. Accidentally called on anonymous node?") } - fn to_debug_str(&self, _: TyCtxt<'tcx, 'gcx, 'tcx>) -> String { + fn to_debug_str(&self, _: TyCtxt<'gcx, 'tcx>) -> String { format!("{:?}", self) } } @@ -484,7 +484,7 @@ impl<'gcx: 'tcx, 'tcx, T> DepNodeParams<'gcx, 'tcx> for T { default const CAN_RECONSTRUCT_QUERY_KEY: bool = false; - default fn to_fingerprint(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Fingerprint { + default fn to_fingerprint(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Fingerprint { let mut hcx = tcx.create_stable_hashing_context(); let mut hasher = StableHasher::new(); @@ -493,7 +493,7 @@ impl<'gcx: 'tcx, 'tcx, T> DepNodeParams<'gcx, 'tcx> for T hasher.finish() } - default fn to_debug_str(&self, _: TyCtxt<'tcx, 'gcx, 'tcx>) -> String { + default fn to_debug_str(&self, _: TyCtxt<'gcx, 'tcx>) -> String { format!("{:?}", *self) } } @@ -501,11 +501,11 @@ impl<'gcx: 'tcx, 'tcx, T> DepNodeParams<'gcx, 'tcx> for T impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for DefId { const CAN_RECONSTRUCT_QUERY_KEY: bool = true; - fn to_fingerprint(&self, tcx: TyCtxt<'_, '_, '_>) -> Fingerprint { + fn to_fingerprint(&self, tcx: TyCtxt<'_, '_>) -> Fingerprint { tcx.def_path_hash(*self).0 } - fn to_debug_str(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> String { + fn to_debug_str(&self, tcx: TyCtxt<'gcx, 'tcx>) -> String { tcx.def_path_str(*self) } } @@ -513,11 +513,11 @@ impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for DefId { impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for DefIndex { const CAN_RECONSTRUCT_QUERY_KEY: bool = true; - fn to_fingerprint(&self, tcx: TyCtxt<'_, '_, '_>) -> Fingerprint { + fn to_fingerprint(&self, tcx: TyCtxt<'_, '_>) -> Fingerprint { tcx.hir().definitions().def_path_hash(*self).0 } - fn to_debug_str(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> String { + fn to_debug_str(&self, tcx: TyCtxt<'gcx, 'tcx>) -> String { tcx.def_path_str(DefId::local(*self)) } } @@ -525,7 +525,7 @@ impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for DefIndex { impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for CrateNum { const CAN_RECONSTRUCT_QUERY_KEY: bool = true; - fn to_fingerprint(&self, tcx: TyCtxt<'_, '_, '_>) -> Fingerprint { + fn to_fingerprint(&self, tcx: TyCtxt<'_, '_>) -> Fingerprint { let def_id = DefId { krate: *self, index: CRATE_DEF_INDEX, @@ -533,7 +533,7 @@ impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for CrateNum { tcx.def_path_hash(def_id).0 } - fn to_debug_str(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> String { + fn to_debug_str(&self, tcx: TyCtxt<'gcx, 'tcx>) -> String { tcx.crate_name(*self).as_str().to_string() } } @@ -544,7 +544,7 @@ impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for (DefId, DefId) { // We actually would not need to specialize the implementation of this // method but it's faster to combine the hashes than to instantiate a full // hashing context and stable-hashing state. - fn to_fingerprint(&self, tcx: TyCtxt<'_, '_, '_>) -> Fingerprint { + fn to_fingerprint(&self, tcx: TyCtxt<'_, '_>) -> Fingerprint { let (def_id_0, def_id_1) = *self; let def_path_hash_0 = tcx.def_path_hash(def_id_0); @@ -553,7 +553,7 @@ impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for (DefId, DefId) { def_path_hash_0.0.combine(def_path_hash_1.0) } - fn to_debug_str(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> String { + fn to_debug_str(&self, tcx: TyCtxt<'gcx, 'tcx>) -> String { let (def_id_0, def_id_1) = *self; format!("({}, {})", @@ -568,7 +568,7 @@ impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for HirId { // We actually would not need to specialize the implementation of this // method but it's faster to combine the hashes than to instantiate a full // hashing context and stable-hashing state. - fn to_fingerprint(&self, tcx: TyCtxt<'_, '_, '_>) -> Fingerprint { + fn to_fingerprint(&self, tcx: TyCtxt<'_, '_>) -> Fingerprint { let HirId { owner, local_id, diff --git a/src/librustc/dep_graph/graph.rs b/src/librustc/dep_graph/graph.rs index 6789912a03e2f..d15980dcbe6d6 100644 --- a/src/librustc/dep_graph/graph.rs +++ b/src/librustc/dep_graph/graph.rs @@ -558,7 +558,7 @@ impl DepGraph { /// a node index can be found for that node. pub fn try_mark_green_and_read( &self, - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, dep_node: &DepNode ) -> Option<(SerializedDepNodeIndex, DepNodeIndex)> { self.try_mark_green(tcx, dep_node).map(|(prev_index, dep_node_index)| { @@ -570,7 +570,7 @@ impl DepGraph { pub fn try_mark_green( &self, - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, dep_node: &DepNode ) -> Option<(SerializedDepNodeIndex, DepNodeIndex)> { debug_assert!(!dep_node.kind.is_eval_always()); @@ -604,7 +604,7 @@ impl DepGraph { /// Try to mark a dep-node which existed in the previous compilation session as green. fn try_mark_previous_green<'tcx>( &self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, data: &DepGraphData, prev_dep_node_index: SerializedDepNodeIndex, dep_node: &DepNode @@ -791,7 +791,7 @@ impl DepGraph { #[inline(never)] fn emit_diagnostics<'tcx>( &self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, data: &DepGraphData, dep_node_index: DepNodeIndex, did_allocation: bool, @@ -842,7 +842,7 @@ impl DepGraph { // // This method will only load queries that will end up in the disk cache. // Other queries will not be executed. - pub fn exec_cache_promotions<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { + pub fn exec_cache_promotions<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx>) { let green_nodes: Vec = { let data = self.data.as_ref().unwrap(); data.colors.values.indices().filter_map(|prev_index| { diff --git a/src/librustc/dep_graph/safe.rs b/src/librustc/dep_graph/safe.rs index e03d18950a690..86cba3a4580ba 100644 --- a/src/librustc/dep_graph/safe.rs +++ b/src/librustc/dep_graph/safe.rs @@ -33,7 +33,7 @@ impl DepGraphSafe for DefId { /// The type context itself can be used to access all kinds of tracked /// state, but those accesses should always generate read events. -impl<'gcx, 'tcx> DepGraphSafe for TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> DepGraphSafe for TyCtxt<'gcx, 'tcx> { } /// Tuples make it easy to build up state. diff --git a/src/librustc/hir/check_attr.rs b/src/librustc/hir/check_attr.rs index 5b517677a43f0..4d13d91c8f27d 100644 --- a/src/librustc/hir/check_attr.rs +++ b/src/librustc/hir/check_attr.rs @@ -88,7 +88,7 @@ impl Target { } struct CheckAttrVisitor<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, } impl CheckAttrVisitor<'tcx> { @@ -347,7 +347,7 @@ fn is_c_like_enum(item: &hir::Item) -> bool { } } -fn check_mod_attrs<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, module_def_id: DefId) { +fn check_mod_attrs<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, module_def_id: DefId) { tcx.hir().visit_item_likes_in_module( module_def_id, &mut CheckAttrVisitor { tcx }.as_deep_visitor() diff --git a/src/librustc/hir/def_id.rs b/src/librustc/hir/def_id.rs index 0c4f5fb3fc167..b3abe50a5952f 100644 --- a/src/librustc/hir/def_id.rs +++ b/src/librustc/hir/def_id.rs @@ -177,7 +177,7 @@ impl DefId { LocalDefId::from_def_id(self) } - pub fn describe_as_module(&self, tcx: TyCtxt<'_, '_, '_>) -> String { + pub fn describe_as_module(&self, tcx: TyCtxt<'_, '_>) -> String { if self.is_local() && self.index == CRATE_DEF_INDEX { format!("top-level module") } else { diff --git a/src/librustc/hir/upvars.rs b/src/librustc/hir/upvars.rs index 8c92a0f5d7713..332d15c319379 100644 --- a/src/librustc/hir/upvars.rs +++ b/src/librustc/hir/upvars.rs @@ -55,7 +55,7 @@ impl Visitor<'tcx> for LocalCollector { } struct CaptureCollector<'a, 'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, locals: &'a FxHashSet, upvars: FxIndexMap, } diff --git a/src/librustc/ich/hcx.rs b/src/librustc/ich/hcx.rs index 535c61df1c527..4b5b458b2afb7 100644 --- a/src/librustc/ich/hcx.rs +++ b/src/librustc/ich/hcx.rs @@ -205,7 +205,7 @@ for &'b mut T { } } -impl StableHashingContextProvider<'lcx> for TyCtxt<'lcx, 'gcx, 'lcx> { +impl StableHashingContextProvider<'lcx> for TyCtxt<'gcx, 'lcx> { fn get_stable_hashing_context(&self) -> StableHashingContext<'lcx> { (*self).create_stable_hashing_context() } diff --git a/src/librustc/infer/canonical/canonicalizer.rs b/src/librustc/infer/canonical/canonicalizer.rs index f24f7f05a1fa6..dadac4b1e6b8f 100644 --- a/src/librustc/infer/canonical/canonicalizer.rs +++ b/src/librustc/infer/canonical/canonicalizer.rs @@ -277,7 +277,7 @@ impl CanonicalizeRegionMode for CanonicalizeFreeRegionsOtherThanStatic { struct Canonicalizer<'cx, 'gcx: 'tcx, 'tcx: 'cx> { infcx: Option<&'cx InferCtxt<'cx, 'gcx, 'tcx>>, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, variables: SmallVec<[CanonicalVarInfo; 8]>, query_state: &'cx mut OriginalQueryValues<'tcx>, // Note that indices is only used once `var_values` is big enough to be @@ -290,7 +290,7 @@ struct Canonicalizer<'cx, 'gcx: 'tcx, 'tcx: 'cx> { } impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for Canonicalizer<'cx, 'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> { self.tcx } @@ -501,7 +501,7 @@ impl<'cx, 'gcx, 'tcx> Canonicalizer<'cx, 'gcx, 'tcx> { fn canonicalize( value: &V, infcx: Option<&InferCtxt<'_, 'gcx, 'tcx>>, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, canonicalize_region_mode: &dyn CanonicalizeRegionMode, query_state: &mut OriginalQueryValues<'tcx>, ) -> Canonicalized<'gcx, V> diff --git a/src/librustc/infer/canonical/mod.rs b/src/librustc/infer/canonical/mod.rs index c1d070f53af03..85e784d0ca5fb 100644 --- a/src/librustc/infer/canonical/mod.rs +++ b/src/librustc/infer/canonical/mod.rs @@ -478,7 +478,7 @@ impl<'tcx> CanonicalVarValues<'tcx> { /// `self.var_values == [Type(u32), Lifetime('a), Type(u64)]` /// we'll return a substitution `subst` with: /// `subst.var_values == [Type(^0), Lifetime(^1), Type(^2)]`. - pub fn make_identity(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Self { + pub fn make_identity(&self, tcx: TyCtxt<'tcx, 'tcx>) -> Self { use crate::ty::subst::UnpackedKind; CanonicalVarValues { diff --git a/src/librustc/infer/canonical/query_response.rs b/src/librustc/infer/canonical/query_response.rs index 7defbac7e545b..345889ca44174 100644 --- a/src/librustc/infer/canonical/query_response.rs +++ b/src/librustc/infer/canonical/query_response.rs @@ -647,7 +647,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> { /// Given the region obligations and constraints scraped from the infcx, /// creates query region constraints. pub fn make_query_outlives<'tcx>( - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, outlives_obligations: impl Iterator, ty::Region<'tcx>)>, region_constraints: &RegionConstraintData<'tcx>, ) -> Vec> { diff --git a/src/librustc/infer/canonical/substitute.rs b/src/librustc/infer/canonical/substitute.rs index 43f6f62bc4880..0dace4132b808 100644 --- a/src/librustc/infer/canonical/substitute.rs +++ b/src/librustc/infer/canonical/substitute.rs @@ -16,7 +16,7 @@ impl<'tcx, V> Canonical<'tcx, V> { /// with the value given in `var_values`. pub fn substitute( &self, - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, var_values: &CanonicalVarValues<'tcx>, ) -> V where @@ -33,7 +33,7 @@ impl<'tcx, V> Canonical<'tcx, V> { /// V, replacing each of the canonical variables. pub fn substitute_projected( &self, - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, var_values: &CanonicalVarValues<'tcx>, projection_fn: impl FnOnce(&V) -> &T, ) -> T @@ -50,7 +50,7 @@ impl<'tcx, V> Canonical<'tcx, V> { /// must be values for the set of canonical variables that appear in /// `value`. pub(super) fn substitute_value<'a, 'tcx, T>( - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, var_values: &CanonicalVarValues<'tcx>, value: &'a T, ) -> T diff --git a/src/librustc/infer/combine.rs b/src/librustc/infer/combine.rs index 10a53767f5370..21d4f3bf51197 100644 --- a/src/librustc/infer/combine.rs +++ b/src/librustc/infer/combine.rs @@ -207,7 +207,7 @@ impl<'infcx, 'gcx, 'tcx> InferCtxt<'infcx, 'gcx, 'tcx> { } impl<'infcx, 'gcx, 'tcx> CombineFields<'infcx, 'gcx, 'tcx> { - pub fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + pub fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.infcx.tcx } @@ -414,7 +414,7 @@ struct Generalization<'tcx> { } impl TypeRelation<'gcx, 'tcx> for Generalizer<'_, 'gcx, 'tcx> { - fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.infcx.tcx } diff --git a/src/librustc/infer/equate.rs b/src/librustc/infer/equate.rs index d74a05fddbcf8..a9e0e3376a54d 100644 --- a/src/librustc/infer/equate.rs +++ b/src/librustc/infer/equate.rs @@ -27,7 +27,7 @@ impl<'combine, 'infcx, 'gcx, 'tcx> Equate<'combine, 'infcx, 'gcx, 'tcx> { impl TypeRelation<'gcx, 'tcx> for Equate<'combine, 'infcx, 'gcx, 'tcx> { fn tag(&self) -> &'static str { "Equate" } - fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.fields.tcx() } + fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.fields.tcx() } fn a_is_expected(&self) -> bool { self.a_is_expected } diff --git a/src/librustc/infer/error_reporting/mod.rs b/src/librustc/infer/error_reporting/mod.rs index 137cae149d6e5..d50cb8e61a60b 100644 --- a/src/librustc/infer/error_reporting/mod.rs +++ b/src/librustc/infer/error_reporting/mod.rs @@ -67,7 +67,7 @@ mod need_type_info; pub mod nice_region_error; -impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> { pub fn note_and_explain_region( self, region_scope_tree: ®ion::ScopeTree, @@ -446,7 +446,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { use ty::subst::Kind; struct AbsolutePathPrinter<'gcx, 'tcx> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, } struct NonTrivialPath; @@ -460,7 +460,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { type DynExistential = !; type Const = !; - fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx<'a>(&'a self) -> TyCtxt<'gcx, 'tcx> { self.tcx } diff --git a/src/librustc/infer/error_reporting/nice_region_error/find_anon_type.rs b/src/librustc/infer/error_reporting/nice_region_error/find_anon_type.rs index b384a97f38d79..8dd415ec9af4c 100644 --- a/src/librustc/infer/error_reporting/nice_region_error/find_anon_type.rs +++ b/src/librustc/infer/error_reporting/nice_region_error/find_anon_type.rs @@ -82,7 +82,7 @@ impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> { // where that lifetime appears. This allows us to highlight the // specific part of the type in the error message. struct FindNestedTypeVisitor<'gcx, 'tcx> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, // The bound_region corresponding to the Refree(freeregion) // associated with the anonymous region we are looking for. bound_region: ty::BoundRegion, @@ -209,7 +209,7 @@ impl Visitor<'gcx> for FindNestedTypeVisitor<'gcx, 'tcx> { // where that lifetime appears. This allows us to highlight the // specific part of the type in the error message. struct TyPathVisitor<'gcx, 'tcx> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, found_it: bool, bound_region: ty::BoundRegion, current_index: ty::DebruijnIndex, diff --git a/src/librustc/infer/error_reporting/nice_region_error/mod.rs b/src/librustc/infer/error_reporting/nice_region_error/mod.rs index bd7fc9554e8d5..dc9ec15cb2492 100644 --- a/src/librustc/infer/error_reporting/nice_region_error/mod.rs +++ b/src/librustc/infer/error_reporting/nice_region_error/mod.rs @@ -56,7 +56,7 @@ impl<'cx, 'gcx, 'tcx> NiceRegionError<'cx, 'gcx, 'tcx> { Self { infcx, error: None, regions: Some((span, sub, sup)), tables } } - fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.infcx.tcx } diff --git a/src/librustc/infer/error_reporting/nice_region_error/placeholder_error.rs b/src/librustc/infer/error_reporting/nice_region_error/placeholder_error.rs index c9bda63aa75cc..43a5e4a0d0e77 100644 --- a/src/librustc/infer/error_reporting/nice_region_error/placeholder_error.rs +++ b/src/librustc/infer/error_reporting/nice_region_error/placeholder_error.rs @@ -322,7 +322,7 @@ impl NiceRegionError<'me, 'gcx, 'tcx> { // HACK(eddyb) maybe move this in a more central location. #[derive(Copy, Clone)] struct Highlighted<'gcx, 'tcx, T> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, highlight: RegionHighlightMode, value: T, } diff --git a/src/librustc/infer/freshen.rs b/src/librustc/infer/freshen.rs index ed8b0ff54c8d8..641e5b127e8d0 100644 --- a/src/librustc/infer/freshen.rs +++ b/src/librustc/infer/freshen.rs @@ -114,7 +114,7 @@ impl<'a, 'gcx, 'tcx> TypeFreshener<'a, 'gcx, 'tcx> { } impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for TypeFreshener<'a, 'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> { self.infcx.tcx } diff --git a/src/librustc/infer/fudge.rs b/src/librustc/infer/fudge.rs index ebab1f8f2f6d9..ef6ea20c6dfba 100644 --- a/src/librustc/infer/fudge.rs +++ b/src/librustc/infer/fudge.rs @@ -143,7 +143,7 @@ pub struct InferenceFudger<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { } impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for InferenceFudger<'a, 'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> { self.infcx.tcx } diff --git a/src/librustc/infer/glb.rs b/src/librustc/infer/glb.rs index f84ab59fdae60..0b3c0904d1777 100644 --- a/src/librustc/infer/glb.rs +++ b/src/librustc/infer/glb.rs @@ -24,7 +24,7 @@ impl<'combine, 'infcx, 'gcx, 'tcx> Glb<'combine, 'infcx, 'gcx, 'tcx> { impl TypeRelation<'gcx, 'tcx> for Glb<'combine, 'infcx, 'gcx, 'tcx> { fn tag(&self) -> &'static str { "Glb" } - fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.fields.tcx() } + fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.fields.tcx() } fn a_is_expected(&self) -> bool { self.a_is_expected } diff --git a/src/librustc/infer/lexical_region_resolve/mod.rs b/src/librustc/infer/lexical_region_resolve/mod.rs index 5d83cdcb176de..1612a2a54d10c 100644 --- a/src/librustc/infer/lexical_region_resolve/mod.rs +++ b/src/librustc/infer/lexical_region_resolve/mod.rs @@ -103,7 +103,7 @@ struct LexicalResolver<'cx, 'gcx: 'tcx, 'tcx: 'cx> { } impl<'cx, 'gcx, 'tcx> LexicalResolver<'cx, 'gcx, 'tcx> { - fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.region_rels.tcx } @@ -136,7 +136,7 @@ impl<'cx, 'gcx, 'tcx> LexicalResolver<'cx, 'gcx, 'tcx> { /// Initially, the value for all variables is set to `'empty`, the /// empty region. The `expansion` phase will grow this larger. - fn construct_var_data(&self, tcx: TyCtxt<'tcx, '_, 'tcx>) -> LexicalRegionResolutions<'tcx> { + fn construct_var_data(&self, tcx: TyCtxt<'_, 'tcx>) -> LexicalRegionResolutions<'tcx> { LexicalRegionResolutions { error_region: tcx.lifetimes.re_static, values: IndexVec::from_elem_n(VarValue::Value(tcx.lifetimes.re_empty), self.num_vars()) @@ -785,7 +785,7 @@ impl<'tcx> fmt::Debug for RegionAndOrigin<'tcx> { } impl<'tcx> LexicalRegionResolutions<'tcx> { - fn normalize(&self, tcx: TyCtxt<'tcx, '_, 'tcx>, value: T) -> T + fn normalize(&self, tcx: TyCtxt<'_, 'tcx>, value: T) -> T where T: TypeFoldable<'tcx>, { diff --git a/src/librustc/infer/lub.rs b/src/librustc/infer/lub.rs index f123690ada4d9..ab49968ce24db 100644 --- a/src/librustc/infer/lub.rs +++ b/src/librustc/infer/lub.rs @@ -24,7 +24,7 @@ impl<'combine, 'infcx, 'gcx, 'tcx> Lub<'combine, 'infcx, 'gcx, 'tcx> { impl TypeRelation<'gcx, 'tcx> for Lub<'combine, 'infcx, 'gcx, 'tcx> { fn tag(&self) -> &'static str { "Lub" } - fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.fields.tcx() } + fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.fields.tcx() } fn a_is_expected(&self) -> bool { self.a_is_expected } diff --git a/src/librustc/infer/mod.rs b/src/librustc/infer/mod.rs index 5b04e6d1f0a84..11918eccfd076 100644 --- a/src/librustc/infer/mod.rs +++ b/src/librustc/infer/mod.rs @@ -91,7 +91,7 @@ impl SuppressRegionErrors { /// Indicates that the MIR borrowck will repeat these region /// checks, so we should ignore errors if NLL is (unconditionally) /// enabled. - pub fn when_nll_is_enabled(tcx: TyCtxt<'_, '_, '_>) -> Self { + pub fn when_nll_is_enabled(tcx: TyCtxt<'_, '_>) -> Self { match tcx.borrowck_mode() { // If we're on Migrate mode, report AST region errors BorrowckMode::Migrate => SuppressRegionErrors { suppressed: false }, @@ -103,7 +103,7 @@ impl SuppressRegionErrors { } pub struct InferCtxt<'a, 'gcx, 'tcx> { - pub tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + pub tcx: TyCtxt<'gcx, 'tcx>, /// During type-checking/inference of a body, `in_progress_tables` /// contains a reference to the tables being built up, which are @@ -466,11 +466,11 @@ impl<'tcx> fmt::Display for FixupError<'tcx> { /// Necessary because we can't write the following bound: /// `F: for<'b, 'tcx> where 'gcx: 'tcx FnOnce(InferCtxt<'b, 'gcx, 'tcx>)`. pub struct InferCtxtBuilder<'gcx, 'tcx> { - global_tcx: TyCtxt<'gcx, 'gcx, 'gcx>, + global_tcx: TyCtxt<'gcx, 'gcx>, fresh_tables: Option>>, } -impl TyCtxt<'gcx, 'gcx, 'gcx> { +impl TyCtxt<'gcx, 'gcx> { pub fn infer_ctxt<'tcx>(self) -> InferCtxtBuilder<'gcx, 'tcx> { InferCtxtBuilder { global_tcx: self, @@ -1600,7 +1600,7 @@ impl<'a, 'gcx, 'tcx> ShallowResolver<'a, 'gcx, 'tcx> { } impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for ShallowResolver<'a, 'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> { self.infcx.tcx } @@ -1641,7 +1641,7 @@ impl<'gcx, 'tcx> TypeTrace<'tcx> { } } - pub fn dummy(tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> TypeTrace<'tcx> { + pub fn dummy(tcx: TyCtxt<'gcx, 'tcx>) -> TypeTrace<'tcx> { TypeTrace { cause: ObligationCause::dummy(), values: Types(ExpectedFound { diff --git a/src/librustc/infer/nll_relate/mod.rs b/src/librustc/infer/nll_relate/mod.rs index 6ac087027ac6e..f6ba13d2aa8f8 100644 --- a/src/librustc/infer/nll_relate/mod.rs +++ b/src/librustc/infer/nll_relate/mod.rs @@ -498,7 +498,7 @@ impl TypeRelation<'gcx, 'tcx> for TypeRelating<'me, 'gcx, 'tcx, D> where D: TypeRelatingDelegate<'tcx>, { - fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.infcx.tcx } @@ -827,7 +827,7 @@ impl TypeRelation<'gcx, 'tcx> for TypeGeneralizer<'me, 'gcx, 'tcx, D> where D: TypeRelatingDelegate<'tcx>, { - fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.infcx.tcx } diff --git a/src/librustc/infer/opaque_types/mod.rs b/src/librustc/infer/opaque_types/mod.rs index a054869874af9..355d527e8efb8 100644 --- a/src/librustc/infer/opaque_types/mod.rs +++ b/src/librustc/infer/opaque_types/mod.rs @@ -553,7 +553,7 @@ impl<'tcx> TypeVisitor<'tcx> for OpaqueTypeOutlivesVisitor<'_, '_, 'tcx> } struct ReverseMapper<'gcx, 'tcx> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, /// If errors have already been reported in this fn, we suppress /// our own errors because they are sometimes derivative. @@ -569,7 +569,7 @@ struct ReverseMapper<'gcx, 'tcx> { impl ReverseMapper<'gcx, 'tcx> { fn new( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, tainted_by_errors: bool, opaque_type_def_id: DefId, map: FxHashMap, Kind<'gcx>>, @@ -600,7 +600,7 @@ impl ReverseMapper<'gcx, 'tcx> { } impl TypeFolder<'gcx, 'tcx> for ReverseMapper<'gcx, 'tcx> { - fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.tcx } @@ -944,7 +944,7 @@ impl<'a, 'gcx, 'tcx> Instantiator<'a, 'gcx, 'tcx> { /// and `opaque_hir_id` is the `HirId` of the definition of the existential type `Baz`. /// For the above example, this function returns `true` for `f1` and `false` for `f2`. pub fn may_define_existential_type( - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, def_id: DefId, opaque_hir_id: hir::HirId, ) -> bool { diff --git a/src/librustc/infer/outlives/free_region_map.rs b/src/librustc/infer/outlives/free_region_map.rs index cf7765c8f12f9..2a5558a4a66fd 100644 --- a/src/librustc/infer/outlives/free_region_map.rs +++ b/src/librustc/infer/outlives/free_region_map.rs @@ -29,7 +29,7 @@ impl<'tcx> FreeRegionMap<'tcx> { /// avoid making arbitrary choices. See /// `TransitiveRelation::postdom_upper_bound` for more details. pub fn lub_free_regions<'gcx>(&self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, r_a: Region<'tcx>, r_b: Region<'tcx>) -> Region<'tcx> { @@ -90,7 +90,7 @@ impl_stable_hash_for!(struct FreeRegionMap<'tcx> { impl<'a, 'tcx> Lift<'tcx> for FreeRegionMap<'a> { type Lifted = FreeRegionMap<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option> { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option> { self.relation.maybe_map(|&fr| tcx.lift(&fr)) .map(|relation| FreeRegionMap { relation }) } diff --git a/src/librustc/infer/outlives/obligations.rs b/src/librustc/infer/outlives/obligations.rs index 86384f511c682..ddc1cd0ff3ffa 100644 --- a/src/librustc/infer/outlives/obligations.rs +++ b/src/librustc/infer/outlives/obligations.rs @@ -233,7 +233,7 @@ where // See the comments on `process_registered_region_obligations` for the meaning // of these fields. delegate: D, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, verify_bound: VerifyBoundCx<'cx, 'gcx, 'tcx>, } @@ -260,7 +260,7 @@ where { pub fn new( delegate: D, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, region_bound_pairs: &'cx RegionBoundPairs<'tcx>, implicit_region_bound: Option>, param_env: ty::ParamEnv<'tcx>, diff --git a/src/librustc/infer/outlives/verify.rs b/src/librustc/infer/outlives/verify.rs index 154d0612d7d11..72079a6adc9fb 100644 --- a/src/librustc/infer/outlives/verify.rs +++ b/src/librustc/infer/outlives/verify.rs @@ -13,7 +13,7 @@ use crate::util::captures::Captures; /// accrues them into the `region_obligations` code, but for NLL we /// use something else. pub struct VerifyBoundCx<'cx, 'gcx: 'tcx, 'tcx: 'cx> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, region_bound_pairs: &'cx RegionBoundPairs<'tcx>, implicit_region_bound: Option>, param_env: ty::ParamEnv<'tcx>, @@ -21,7 +21,7 @@ pub struct VerifyBoundCx<'cx, 'gcx: 'tcx, 'tcx: 'cx> { impl<'cx, 'gcx, 'tcx> VerifyBoundCx<'cx, 'gcx, 'tcx> { pub fn new( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, region_bound_pairs: &'cx RegionBoundPairs<'tcx>, implicit_region_bound: Option>, param_env: ty::ParamEnv<'tcx>, diff --git a/src/librustc/infer/region_constraints/leak_check.rs b/src/librustc/infer/region_constraints/leak_check.rs index fa6bbdbbbe724..5fc6523feba55 100644 --- a/src/librustc/infer/region_constraints/leak_check.rs +++ b/src/librustc/infer/region_constraints/leak_check.rs @@ -22,7 +22,7 @@ impl<'tcx> RegionConstraintCollector<'tcx> { /// refactor the constraint set. pub fn leak_check( &mut self, - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, overly_polymorphic: bool, placeholder_map: &PlaceholderMap<'tcx>, _snapshot: &CombinedSnapshot<'_, 'tcx>, @@ -109,7 +109,7 @@ impl<'tcx> TaintSet<'tcx> { fn fixed_point( &mut self, - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, undo_log: &[UndoLog<'tcx>], verifys: &[Verify<'tcx>], ) { diff --git a/src/librustc/infer/region_constraints/mod.rs b/src/librustc/infer/region_constraints/mod.rs index ff186718f99b7..cab102907f603 100644 --- a/src/librustc/infer/region_constraints/mod.rs +++ b/src/librustc/infer/region_constraints/mod.rs @@ -700,7 +700,7 @@ impl<'tcx> RegionConstraintCollector<'tcx> { pub fn lub_regions( &mut self, - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, origin: SubregionOrigin<'tcx>, a: Region<'tcx>, b: Region<'tcx>, @@ -722,7 +722,7 @@ impl<'tcx> RegionConstraintCollector<'tcx> { pub fn glb_regions( &mut self, - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, origin: SubregionOrigin<'tcx>, a: Region<'tcx>, b: Region<'tcx>, @@ -744,7 +744,7 @@ impl<'tcx> RegionConstraintCollector<'tcx> { pub fn opportunistic_resolve_var( &mut self, - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, rid: RegionVid, ) -> ty::Region<'tcx> { let vid = self.unification_table.probe_value(rid).min_vid; @@ -760,7 +760,7 @@ impl<'tcx> RegionConstraintCollector<'tcx> { fn combine_vars( &mut self, - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, t: CombineMapType, a: Region<'tcx>, b: Region<'tcx>, @@ -850,7 +850,7 @@ impl<'tcx> fmt::Display for GenericKind<'tcx> { } impl<'gcx, 'tcx> GenericKind<'tcx> { - pub fn to_ty(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx> { + pub fn to_ty(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Ty<'tcx> { match *self { GenericKind::Param(ref p) => p.to_ty(tcx), GenericKind::Projection(ref p) => tcx.mk_projection(p.item_def_id, p.substs), diff --git a/src/librustc/infer/resolve.rs b/src/librustc/infer/resolve.rs index ea9d8dbbb1e89..774ebdcdd2502 100644 --- a/src/librustc/infer/resolve.rs +++ b/src/librustc/infer/resolve.rs @@ -24,7 +24,7 @@ impl<'a, 'gcx, 'tcx> OpportunisticVarResolver<'a, 'gcx, 'tcx> { } impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for OpportunisticVarResolver<'a, 'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> { self.infcx.tcx } @@ -61,7 +61,7 @@ impl<'a, 'gcx, 'tcx> OpportunisticTypeAndRegionResolver<'a, 'gcx, 'tcx> { } impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for OpportunisticTypeAndRegionResolver<'a, 'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> { self.infcx.tcx } @@ -177,7 +177,7 @@ struct FullTypeResolver<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { } impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for FullTypeResolver<'a, 'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> { self.infcx.tcx } diff --git a/src/librustc/infer/sub.rs b/src/librustc/infer/sub.rs index 4f73f229423c3..e17da50d7be8c 100644 --- a/src/librustc/infer/sub.rs +++ b/src/librustc/infer/sub.rs @@ -33,7 +33,7 @@ impl<'combine, 'infcx, 'gcx, 'tcx> Sub<'combine, 'infcx, 'gcx, 'tcx> { impl TypeRelation<'gcx, 'tcx> for Sub<'combine, 'infcx, 'gcx, 'tcx> { fn tag(&self) -> &'static str { "Sub" } - fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.fields.infcx.tcx } + fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.fields.infcx.tcx } fn a_is_expected(&self) -> bool { self.a_is_expected } fn with_cause(&mut self, cause: Cause, f: F) -> R diff --git a/src/librustc/infer/unify_key.rs b/src/librustc/infer/unify_key.rs index 6a46ed50679ef..7f9880031f3f0 100644 --- a/src/librustc/infer/unify_key.rs +++ b/src/librustc/infer/unify_key.rs @@ -10,7 +10,7 @@ use std::marker::PhantomData; use std::cell::RefMut; pub trait ToType { - fn to_type<'gcx, 'tcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx>; + fn to_type<'gcx, 'tcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Ty<'tcx>; } impl UnifyKey for ty::IntVid { @@ -52,7 +52,7 @@ impl UnifyKey for ty::RegionVid { } impl ToType for IntVarValue { - fn to_type<'gcx, 'tcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx> { + fn to_type<'gcx, 'tcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Ty<'tcx> { match *self { ty::IntType(i) => tcx.mk_mach_int(i), ty::UintType(i) => tcx.mk_mach_uint(i), @@ -72,7 +72,7 @@ impl UnifyKey for ty::FloatVid { impl EqUnifyValue for FloatVarValue {} impl ToType for FloatVarValue { - fn to_type<'gcx, 'tcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx> { + fn to_type<'gcx, 'tcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Ty<'tcx> { tcx.mk_mach_float(self.0) } } diff --git a/src/librustc/lint/context.rs b/src/librustc/lint/context.rs index 3ddf57faa709b..11047f45343af 100644 --- a/src/librustc/lint/context.rs +++ b/src/librustc/lint/context.rs @@ -509,7 +509,7 @@ impl LintStore { /// Context for lint checking after type checking. pub struct LateContext<'a, 'tcx: 'a> { /// Type context we're checking in. - pub tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + pub tcx: TyCtxt<'tcx, 'tcx>, /// Side-tables for the body we are in. // FIXME: Make this lazy to avoid running the TypeckTables query? @@ -781,7 +781,7 @@ impl<'a, 'tcx> LateContext<'a, 'tcx> { /// ``` pub fn get_def_path(&self, def_id: DefId) -> Vec { pub struct AbsolutePathPrinter<'tcx> { - pub tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + pub tcx: TyCtxt<'tcx, 'tcx>, } impl<'tcx> Printer<'tcx, 'tcx> for AbsolutePathPrinter<'tcx> { @@ -793,7 +793,7 @@ impl<'a, 'tcx> LateContext<'a, 'tcx> { type DynExistential = (); type Const = (); - fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx, 'tcx> { + fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx> { self.tcx } @@ -1372,7 +1372,7 @@ macro_rules! late_lint_pass_impl { late_lint_methods!(late_lint_pass_impl, [], ['tcx]); fn late_lint_mod_pass<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, module_def_id: DefId, pass: T, ) { @@ -1404,7 +1404,7 @@ fn late_lint_mod_pass<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>( } pub fn late_lint_mod<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, module_def_id: DefId, builtin_lints: T, ) { @@ -1424,7 +1424,7 @@ pub fn late_lint_mod<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>( } fn late_lint_pass_crate<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, pass: T ) { let access_levels = &tcx.privacy_access_levels(LOCAL_CRATE); @@ -1460,7 +1460,7 @@ fn late_lint_pass_crate<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>( } fn late_lint_crate<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, builtin_lints: T ) { let mut passes = tcx.sess.lint_store.borrow().late_passes.lock().take().unwrap(); @@ -1494,7 +1494,7 @@ fn late_lint_crate<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>( /// Performs lint checking on a crate. pub fn check_crate<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, builtin_lints: impl FnOnce() -> T + Send, ) { join(|| { diff --git a/src/librustc/lint/mod.rs b/src/librustc/lint/mod.rs index 6311639d67765..d8f21ced2559d 100644 --- a/src/librustc/lint/mod.rs +++ b/src/librustc/lint/mod.rs @@ -761,12 +761,12 @@ pub fn struct_lint_level<'a>(sess: &'a Session, return err } -pub fn maybe_lint_level_root(tcx: TyCtxt<'_, '_, '_>, id: hir::HirId) -> bool { +pub fn maybe_lint_level_root(tcx: TyCtxt<'_, '_>, id: hir::HirId) -> bool { let attrs = tcx.hir().attrs_by_hir_id(id); attrs.iter().any(|attr| Level::from_symbol(attr.name_or_empty()).is_some()) } -fn lint_levels<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, cnum: CrateNum) +fn lint_levels<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, cnum: CrateNum) -> &'tcx LintLevelMap { assert_eq!(cnum, LOCAL_CRATE); @@ -789,7 +789,7 @@ fn lint_levels<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, cnum: CrateNum) struct LintLevelMapBuilder<'tcx> { levels: levels::LintLevelsBuilder<'tcx>, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, } impl LintLevelMapBuilder<'tcx> { diff --git a/src/librustc/macros.rs b/src/librustc/macros.rs index 38e453191a363..aeacd3722b438 100644 --- a/src/librustc/macros.rs +++ b/src/librustc/macros.rs @@ -195,7 +195,7 @@ macro_rules! CloneLiftImpls { $( impl<$tcx> $crate::ty::Lift<$tcx> for $ty { type Lifted = Self; - fn lift_to_tcx<'a, 'gcx>(&self, _: $crate::ty::TyCtxt<'a, 'gcx, $tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, _: $crate::ty::TyCtxt<'gcx, $tcx>) -> Option { Some(Clone::clone(self)) } } @@ -264,7 +264,7 @@ macro_rules! BraceStructLiftImpl { { type Lifted = $lifted; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option<$lifted> { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option<$lifted> { $(let $field = tcx.lift(&self.$field)?;)* Some(Self::Lifted { $($field),* }) } @@ -283,7 +283,7 @@ macro_rules! EnumLiftImpl { { type Lifted = $lifted; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option<$lifted> { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option<$lifted> { EnumLiftImpl!(@Variants(self, tcx) input($($variants)*) output()) } } diff --git a/src/librustc/middle/cstore.rs b/src/librustc/middle/cstore.rs index 16fed08e0d0e6..2e490931525a3 100644 --- a/src/librustc/middle/cstore.rs +++ b/src/librustc/middle/cstore.rs @@ -212,7 +212,7 @@ pub trait CrateStore { // utility functions fn encode_metadata<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>) + tcx: TyCtxt<'tcx, 'tcx>) -> EncodedMetadata; fn metadata_encoding_version(&self) -> &[u8]; } @@ -228,7 +228,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) +pub fn used_crates(tcx: TyCtxt<'_, '_>, prefer: LinkagePreference) -> Vec<(CrateNum, LibSource)> { let mut libs = tcx.crates() diff --git a/src/librustc/middle/dead.rs b/src/librustc/middle/dead.rs index ca23722da320e..9bd80bf3f8b87 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, 'tcx>, +fn should_explore<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, hir_id: hir::HirId) -> bool { match tcx.hir().find_by_hir_id(hir_id) { Some(Node::Item(..)) | @@ -41,7 +41,7 @@ fn should_explore<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, struct MarkSymbolVisitor<'a, 'tcx: 'a> { worklist: Vec, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, tables: &'a ty::TypeckTables<'tcx>, live_symbols: FxHashSet, 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<'_, '_, '_>, +fn has_allow_dead_code_or_lang_attr(tcx: TyCtxt<'_, '_>, id: hir::HirId, attrs: &[ast::Attribute]) -> bool { if attr::contains_name(attrs, sym::lang) { @@ -353,7 +353,7 @@ fn has_allow_dead_code_or_lang_attr(tcx: TyCtxt<'_, '_, '_>, struct LifeSeeder<'k, 'tcx: 'k> { worklist: Vec, krate: &'k hir::Crate, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, // see `MarkSymbolVisitor::struct_constructors` struct_constructors: FxHashMap, } @@ -424,7 +424,7 @@ impl<'v, 'k, 'tcx> ItemLikeVisitor<'v> for LifeSeeder<'k, 'tcx> { } fn create_and_seed_worklist<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, access_levels: &privacy::AccessLevels, krate: &hir::Crate, ) -> (Vec, FxHashMap) { @@ -451,7 +451,7 @@ fn create_and_seed_worklist<'tcx>( (life_seeder.worklist, life_seeder.struct_constructors) } -fn find_live<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn find_live<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, access_levels: &privacy::AccessLevels, krate: &hir::Crate) -> FxHashSet { @@ -472,7 +472,7 @@ fn find_live<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } struct DeadVisitor<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, live_symbols: FxHashSet, } @@ -660,7 +660,7 @@ impl Visitor<'tcx> for DeadVisitor<'tcx> { } } -pub fn check_crate<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn check_crate<'tcx>(tcx: TyCtxt<'tcx, '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 c5ab8f79baa58..faa3ea27d13ff 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, 'tcx>) { +pub fn calculate<'tcx>(tcx: TyCtxt<'tcx, '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, 'tcx>) { sess.dependency_formats.set(fmts); } -fn calculate_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn calculate_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, ty: config::CrateType) -> DependencyList { let sess = &tcx.sess; @@ -242,7 +242,7 @@ fn calculate_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ret } -fn add_library(tcx: TyCtxt<'_, '_, '_>, +fn add_library(tcx: TyCtxt<'_, '_>, cnum: CrateNum, link: LinkagePreference, m: &mut FxHashMap) { @@ -267,7 +267,7 @@ fn add_library(tcx: TyCtxt<'_, '_, '_>, } } -fn attempt_static<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Option { +fn attempt_static<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) -> Option { 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, // 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, 'tcx>, list: &[Linkage]) { +fn verify_ok<'tcx>(tcx: TyCtxt<'tcx, '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 67db2ec248156..024196e35647c 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 4eb3a2bd10b44..bebfb4b768703 100644 --- a/src/librustc/middle/exported_symbols.rs +++ b/src/librustc/middle/exported_symbols.rs @@ -39,7 +39,7 @@ pub enum ExportedSymbol<'tcx> { impl<'tcx> ExportedSymbol<'tcx> { pub fn symbol_name(&self, - tcx: TyCtxt<'_, 'tcx, '_>) + tcx: TyCtxt<'tcx, '_>) -> ty::SymbolName { match *self { ExportedSymbol::NonGeneric(def_id) => { @@ -55,7 +55,7 @@ impl<'tcx> ExportedSymbol<'tcx> { } pub fn compare_stable(&self, - tcx: TyCtxt<'_, 'tcx, '_>, + tcx: TyCtxt<'tcx, '_>, other: &ExportedSymbol<'tcx>) -> cmp::Ordering { match *self { @@ -92,7 +92,7 @@ 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()) diff --git a/src/librustc/middle/expr_use_visitor.rs b/src/librustc/middle/expr_use_visitor.rs index 0565e05b95019..e9f435f8991f5 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()) } @@ -267,7 +267,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>, + tcx: TyCtxt<'tcx, '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<'tcx, 'gcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.mc.tcx } diff --git a/src/librustc/middle/free_region.rs b/src/librustc/middle/free_region.rs index 31fb097e54705..74c50cabab0c4 100644 --- a/src/librustc/middle/free_region.rs +++ b/src/librustc/middle/free_region.rs @@ -16,7 +16,7 @@ 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<'tcx, 'gcx, 'tcx>, + pub tcx: TyCtxt<'gcx, 'tcx>, /// The context used to fetch the region maps. pub context: DefId, @@ -30,7 +30,7 @@ pub struct RegionRelations<'a, 'gcx: 'tcx, 'tcx: 'a> { impl<'a, 'gcx, 'tcx> RegionRelations<'a, 'gcx, 'tcx> { pub fn new( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, '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 ba890e6277089..9746c7ce05c11 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, 'tcx>, module_def_id: DefId) { +fn check_mod_intrinsics<'tcx>(tcx: TyCtxt<'tcx, '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> + tcx: TyCtxt<'tcx, 'tcx> } struct ExprVisitor<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, tables: &'tcx ty::TypeckTables<'tcx>, param_env: ty::ParamEnv<'tcx>, } /// If the type is `Option`, it will return `T`, otherwise /// the type itself. Works on most `Option`-like types. -fn unpack_option_like<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn unpack_option_like<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, ty: Ty<'tcx>) -> Ty<'tcx> { let (def, substs) = match ty.sty { diff --git a/src/librustc/middle/lang_items.rs b/src/librustc/middle/lang_items.rs index c70179b5818c6..02163409b3271 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>, + tcx: TyCtxt<'tcx, '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, 'tcx>) -> LanguageItemCollector<'tcx> { + fn new(tcx: TyCtxt<'tcx, '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, 'tcx>) -> LanguageItems { +pub fn collect<'tcx>(tcx: TyCtxt<'tcx, '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<'gcx, 'tcx, 'gcx> { +impl<'tcx, 'gcx> TyCtxt<'tcx, 'gcx> { /// 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 a6f305d73898f..b05ede53d1cfd 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>, + tcx: TyCtxt<'tcx, 'tcx>, lib_features: LibFeatures, } impl LibFeatureCollector<'tcx> { - fn new(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> LibFeatureCollector<'tcx> { + fn new(tcx: TyCtxt<'tcx, '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, 'tcx>) -> LibFeatures { +pub fn collect<'tcx>(tcx: TyCtxt<'tcx, '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 3a8afed724c1b..43b0c64df7837 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, 'tcx>, module_def_id: DefId) { +fn check_mod_liveness<'tcx>(tcx: TyCtxt<'tcx, '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>, + tcx: TyCtxt<'tcx, '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, 'tcx>, body_owner: DefId) -> IrMaps<'tcx> { + fn new(tcx: TyCtxt<'tcx, '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 d1814b5fe77d2..d7e8f1fb71404 100644 --- a/src/librustc/middle/mem_categorization.rs +++ b/src/librustc/middle/mem_categorization.rs @@ -288,7 +288,7 @@ impl HirNode for hir::Pat { #[derive(Clone)] pub struct MemCategorizationContext<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { - pub tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + pub tcx: TyCtxt<'gcx, 'tcx>, pub body_owner: DefId, pub upvars: Option<&'tcx FxIndexMap>, pub region_scope_tree: &'a region::ScopeTree, @@ -339,7 +339,7 @@ impl MutabilityCategory { ret } - fn from_local(tcx: TyCtxt<'_, '_, '_>, tables: &ty::TypeckTables<'_>, + fn from_local(tcx: TyCtxt<'_, '_>, tables: &ty::TypeckTables<'_>, id: ast::NodeId) -> MutabilityCategory { let ret = match tcx.hir().get(id) { Node::Binding(p) => match p.node { @@ -400,7 +400,7 @@ impl MutabilityCategory { } impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx, 'tcx> { - pub fn new(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + pub fn new(tcx: TyCtxt<'tcx, 'tcx>, body_owner: DefId, region_scope_tree: &'a region::ScopeTree, tables: &'a ty::TypeckTables<'tcx>, @@ -1514,7 +1514,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 1488b61dddc08..116ce7525dab5 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, 'tcx>, +fn item_might_be_inlined(tcx: TyCtxt<'tcx, 'tcx>, item: &hir::Item, attrs: CodegenFnAttrs) -> bool { if attrs.requests_inline() { @@ -44,7 +44,7 @@ fn item_might_be_inlined(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } } -fn method_might_be_inlined<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn method_might_be_inlined<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, impl_item: &hir::ImplItem, impl_src: DefId) -> bool { let codegen_fn_attrs = tcx.codegen_fn_attrs(impl_item.hir_id.owner_def_id()); @@ -67,7 +67,7 @@ fn method_might_be_inlined<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, // Information needed while computing reachability. struct ReachableContext<'a, 'tcx: 'a> { // The type context. - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, '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>, + tcx: TyCtxt<'tcx, 'tcx>, access_levels: &'a privacy::AccessLevels, worklist: &'a mut Vec, } @@ -391,7 +391,7 @@ impl<'a, 'tcx: 'a> ItemLikeVisitor<'tcx> for CollectPrivateImplItemsVisitor<'a, #[derive(Clone, HashStable)] pub struct ReachableSet(pub Lrc); -fn reachable_set<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, crate_num: CrateNum) -> ReachableSet { +fn reachable_set<'tcx>(tcx: TyCtxt<'tcx, '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 c7c838e431556..3c99ec391533c 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>, + tcx: TyCtxt<'tcx, 'tcx>, // The number of expressions and patterns visited in the current body expr_and_pat_count: usize, @@ -646,7 +646,7 @@ 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>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + pub fn early_free_scope<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>, br: &ty::EarlyBoundRegion) -> Scope { let param_owner = tcx.parent(br.def_id).unwrap(); @@ -677,7 +677,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<'tcx, 'gcx, 'tcx>, fr: &ty::FreeRegion) + pub fn free_scope<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>, fr: &ty::FreeRegion) -> Scope { let param_owner = match fr.bound_region { ty::BoundRegion::BrNamed(def_id, _) => { @@ -1327,7 +1327,7 @@ impl<'tcx> Visitor<'tcx> for RegionResolutionVisitor<'tcx> { } } -fn region_scope_tree<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) +fn region_scope_tree<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> &'tcx ScopeTree { let closure_base_def_id = tcx.closure_base_def_id(def_id); diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs index 83c2cab74e435..32577e019e0c2 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>, + tcx: TyCtxt<'tcx, 'tcx>, map: &'a mut NamedRegionMap, scope: ScopeRef<'a>, @@ -369,7 +369,7 @@ pub fn provide(providers: &mut ty::query::Providers<'_>) { /// directly, but rather use `named_region_map`, `is_late_bound_map`, /// etc. fn resolve_lifetimes<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, for_krate: CrateNum, ) -> &'tcx ResolveLifetimes { assert_eq!(for_krate, LOCAL_CRATE); @@ -398,7 +398,7 @@ fn resolve_lifetimes<'tcx>( tcx.arena.alloc(rl) } -fn krate<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> NamedRegionMap { +fn krate<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) -> NamedRegionMap { let krate = tcx.hir().krate(); let mut map = NamedRegionMap { defs: Default::default(), @@ -1101,7 +1101,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 { @@ -1129,7 +1129,7 @@ fn check_mixed_explicit_and_in_band_defs(tcx: TyCtxt<'_, '_, '_>, params: &P<[hi } fn signal_shadowing_problem( - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, name: ast::Name, orig: Original, shadower: Shadower, @@ -1169,7 +1169,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>, + tcx: TyCtxt<'tcx, 'tcx>, scope: ScopeRef<'a>, labels_in_fn: &'a mut Vec, } @@ -1218,7 +1218,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, ) { @@ -1257,7 +1257,7 @@ fn extract_labels(ctxt: &mut LifetimeContext<'_, '_>, body: &hir::Body) { } fn compute_object_lifetime_defaults( - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, ) -> HirIdMap> { let mut map = HirIdMap::default(); for item in tcx.hir().krate().items.values() { @@ -1315,7 +1315,7 @@ fn compute_object_lifetime_defaults( /// 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 { fn add_bounds(set: &mut Set1, bounds: &[hir::GenericBound]) { diff --git a/src/librustc/middle/stability.rs b/src/librustc/middle/stability.rs index b812ef504eeac..30c4a46271c21 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>, + tcx: TyCtxt<'tcx, 'tcx>, index: &'a mut Index<'tcx>, parent_stab: Option<&'tcx Stability>, parent_depr: Option, @@ -317,7 +317,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> { } struct MissingStabilityAnnotations<'a, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, '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, 'tcx>) -> Index<'tcx> { + pub fn new(tcx: TyCtxt<'tcx, '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, 'tcx>, module_def_id: DefId) { +fn check_mod_unstable_api_usage<'tcx>(tcx: TyCtxt<'tcx, '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>, + tcx: TyCtxt<'tcx, 'tcx>, } /// Result of `TyCtxt::eval_stability`. @@ -521,7 +521,7 @@ pub enum EvalResult { Unmarked, } -impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> TyCtxt<'gcx, '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<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> { pub fn lookup_deprecation(self, id: DefId) -> Option { self.lookup_deprecation_entry(id).map(|depr| depr.attr) } @@ -836,7 +836,7 @@ impl<'gcx, 'tcx> TyCtxt<'tcx, '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, 'tcx>) { +pub fn check_unused_or_stable_features<'tcx>(tcx: TyCtxt<'tcx, '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, 'tcx>) { } fn unnecessary_stable_feature_lint<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, '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 d7c340c4040ac..45d405df950e9 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>, + tcx: TyCtxt<'tcx, '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, 'tcx>, +pub fn check_crate<'tcx>(tcx: TyCtxt<'tcx, '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 { /// 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) -> false } -fn verify<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn verify<'tcx>(tcx: TyCtxt<'tcx, '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<'gcx, 'tcx, 'gcx> { +impl<'tcx, 'gcx> TyCtxt<'tcx, 'gcx> { pub fn is_weak_lang_item(&self, item_def_id: DefId) -> bool { let lang_items = self.lang_items(); let did = Some(item_def_id); diff --git a/src/librustc/mir/interpret/mod.rs b/src/librustc/mir/interpret/mod.rs index 48d5f0d0f4931..09d7f77ac9d5b 100644 --- a/src/librustc/mir/interpret/mod.rs +++ b/src/librustc/mir/interpret/mod.rs @@ -66,7 +66,7 @@ enum AllocDiscriminant { pub fn specialized_encode_alloc_id<'tcx, E: Encoder>( encoder: &mut E, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, alloc_id: AllocId, ) -> Result<(), E::Error> { let alloc: GlobalAlloc<'tcx> = diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs index 46e8468847e96..90a683b733362 100644 --- a/src/librustc/mir/mod.rs +++ b/src/librustc/mir/mod.rs @@ -1241,7 +1241,7 @@ impl<'tcx> Terminator<'tcx> { impl<'tcx> TerminatorKind<'tcx> { pub fn if_<'gcx>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, cond: Operand<'tcx>, t: BasicBlock, f: BasicBlock, @@ -2324,7 +2324,7 @@ impl<'tcx> Operand<'tcx> { /// with given `DefId` and substs. Since this is used to synthesize /// MIR, assumes `user_ty` is None. pub fn function_handle( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, substs: SubstsRef<'tcx>, span: Span, diff --git a/src/librustc/mir/mono.rs b/src/librustc/mir/mono.rs index cc169aa30ccf8..0b095c2f0de56 100644 --- a/src/librustc/mir/mono.rs +++ b/src/librustc/mir/mono.rs @@ -48,7 +48,7 @@ pub enum MonoItem<'tcx> { } impl<'tcx> MonoItem<'tcx> { - pub fn size_estimate(&self, tcx: TyCtxt<'tcx, '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 @@ impl<'tcx> MonoItem<'tcx> { } } - pub fn symbol_name(&self, tcx: TyCtxt<'tcx, '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) => { @@ -88,7 +88,7 @@ impl<'tcx> MonoItem<'tcx> { } pub fn instantiation_mode(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>) + tcx: TyCtxt<'tcx, 'tcx>) -> InstantiationMode { let inline_in_all_cgus = tcx.sess.opts.debugging_opts.inline_in_all_cgus.unwrap_or_else(|| { @@ -133,7 +133,7 @@ impl<'tcx> MonoItem<'tcx> { } } - pub fn explicit_linkage(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Option { + pub fn explicit_linkage(&self, tcx: TyCtxt<'tcx, 'tcx>) -> Option { let def_id = match *self { MonoItem::Fn(ref instance) => instance.def_id(), MonoItem::Static(def_id) => def_id, @@ -169,7 +169,7 @@ impl<'tcx> MonoItem<'tcx> { /// 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<'tcx, '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 +181,7 @@ impl<'tcx> MonoItem<'tcx> { tcx.substitute_normalize_and_test_predicates((def_id, &substs)) } - pub fn to_string(&self, tcx: TyCtxt<'tcx, '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,7 +195,7 @@ impl<'tcx> MonoItem<'tcx> { } }; - fn to_string_internal<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + fn to_string_internal<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, prefix: &str, instance: Instance<'tcx>, debug: bool) @@ -208,7 +208,7 @@ impl<'tcx> MonoItem<'tcx> { } } - pub fn local_span(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Option { + pub fn local_span(&self, tcx: TyCtxt<'tcx, 'tcx>) -> Option { match *self { MonoItem::Fn(Instance { def, .. }) => { tcx.hir().as_local_hir_id(def.def_id()) @@ -334,7 +334,7 @@ impl<'tcx> CodegenUnit<'tcx> { base_n::encode(hash, base_n::CASE_INSENSITIVE) } - pub fn estimate_size(&mut self, tcx: TyCtxt<'tcx, '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 +360,7 @@ impl<'tcx> CodegenUnit<'tcx> { 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) @@ -370,7 +370,7 @@ impl<'tcx> CodegenUnit<'tcx> { } pub fn items_in_deterministic_order(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>) + tcx: TyCtxt<'tcx, 'tcx>) -> Vec<(MonoItem<'tcx>, (Linkage, Visibility))> { // The codegen tests rely on items being process in the same order as @@ -378,7 +378,7 @@ impl<'tcx> CodegenUnit<'tcx> { #[derive(PartialEq, Eq, PartialOrd, Ord)] pub struct ItemSortKey(Option, SymbolName); - fn item_sort_key<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + fn item_sort_key<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, item: MonoItem<'tcx>) -> ItemSortKey { ItemSortKey(match item { MonoItem::Fn(ref instance) => { @@ -415,7 +415,7 @@ impl<'tcx> CodegenUnit<'tcx> { items } - pub fn codegen_dep_node(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> DepNode { + pub fn codegen_dep_node(&self, tcx: TyCtxt<'tcx, 'tcx>) -> DepNode { DepNode::new(tcx, DepConstructor::CompileCodegenUnit(self.name().clone())) } } @@ -446,12 +446,12 @@ impl<'a, 'tcx> HashStable> for CodegenUnit<'tcx> { } pub struct CodegenUnitNameBuilder<'gcx, 'tcx> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, cache: FxHashMap, } impl CodegenUnitNameBuilder<'gcx, 'tcx> { - pub fn new(tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Self { + pub fn new(tcx: TyCtxt<'gcx, 'tcx>) -> Self { CodegenUnitNameBuilder { tcx, cache: Default::default(), diff --git a/src/librustc/mir/tcx.rs b/src/librustc/mir/tcx.rs index 696bec3e0a2ba..1d5f726567314 100644 --- a/src/librustc/mir/tcx.rs +++ b/src/librustc/mir/tcx.rs @@ -33,7 +33,7 @@ impl<'gcx, 'tcx> PlaceTy<'tcx> { /// not carry a `Ty` for `T`.) /// /// Note that the resulting type has not been normalized. - pub fn field_ty(self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, f: &Field) -> Ty<'tcx> + pub fn field_ty(self, tcx: TyCtxt<'gcx, 'tcx>, f: &Field) -> Ty<'tcx> { let answer = match self.ty.sty { ty::Adt(adt_def, substs) => { @@ -57,7 +57,7 @@ impl<'gcx, 'tcx> PlaceTy<'tcx> { /// Convenience wrapper around `projection_ty_core` for /// `PlaceElem`, where we can just use the `Ty` that is already /// stored inline on field projection elems. - pub fn projection_ty(self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + pub fn projection_ty(self, tcx: TyCtxt<'gcx, 'tcx>, elem: &PlaceElem<'tcx>) -> PlaceTy<'tcx> { @@ -71,7 +71,7 @@ impl<'gcx, 'tcx> PlaceTy<'tcx> { /// (which should be trivial when `T` = `Ty`). pub fn projection_ty_core( self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, elem: &ProjectionElem, mut handle_field: impl FnMut(&Self, &Field, &T) -> Ty<'tcx>) -> PlaceTy<'tcx> @@ -121,7 +121,7 @@ BraceStructTypeFoldableImpl! { } impl<'tcx> Place<'tcx> { - pub fn ty<'gcx, D>(&self, local_decls: &D, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> PlaceTy<'tcx> + pub fn ty<'gcx, D>(&self, local_decls: &D, tcx: TyCtxt<'gcx, 'tcx>) -> PlaceTy<'tcx> where D: HasLocalDecls<'tcx> { match *self { @@ -141,7 +141,7 @@ pub enum RvalueInitializationState { } impl<'tcx> Rvalue<'tcx> { - pub fn ty<'gcx, D>(&self, local_decls: &D, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx> + pub fn ty<'gcx, D>(&self, local_decls: &D, tcx: TyCtxt<'gcx, 'tcx>) -> Ty<'tcx> where D: HasLocalDecls<'tcx> { match *self { @@ -222,7 +222,7 @@ impl<'tcx> Rvalue<'tcx> { } impl<'tcx> Operand<'tcx> { - pub fn ty<'gcx, D>(&self, local_decls: &D, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx> + pub fn ty<'gcx, D>(&self, local_decls: &D, tcx: TyCtxt<'gcx, 'tcx>) -> Ty<'tcx> where D: HasLocalDecls<'tcx> { match self { @@ -234,7 +234,7 @@ impl<'tcx> Operand<'tcx> { } impl<'tcx> BinOp { - pub fn ty<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + pub fn ty<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>, lhs_ty: Ty<'tcx>, rhs_ty: Ty<'tcx>) -> Ty<'tcx> { diff --git a/src/librustc/traits/auto_trait.rs b/src/librustc/traits/auto_trait.rs index 480d76b308dee..00a162a31fa56 100644 --- a/src/librustc/traits/auto_trait.rs +++ b/src/librustc/traits/auto_trait.rs @@ -48,11 +48,11 @@ pub struct AutoTraitInfo<'cx> { } pub struct AutoTraitFinder<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, } impl<'tcx> AutoTraitFinder<'tcx> { - pub fn new(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Self { + pub fn new(tcx: TyCtxt<'tcx, 'tcx>) -> Self { AutoTraitFinder { tcx } } @@ -834,11 +834,11 @@ impl AutoTraitFinder<'tcx> { // Replaces all ReVars in a type with ty::Region's, using the provided map pub struct RegionReplacer<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { vid_to_region: &'a FxHashMap>, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, } impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for RegionReplacer<'a, 'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> { self.tcx } diff --git a/src/librustc/traits/codegen/mod.rs b/src/librustc/traits/codegen/mod.rs index cc10107f682d5..469fd6f97666a 100644 --- a/src/librustc/traits/codegen/mod.rs +++ b/src/librustc/traits/codegen/mod.rs @@ -18,7 +18,7 @@ use crate::ty::fold::TypeFoldable; /// that type check should guarantee to us that all nested /// obligations *could be* resolved if we wanted to. /// Assumes that this is run after the entire crate has been successfully type-checked. -pub fn codegen_fulfill_obligation<'tcx>(ty: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn codegen_fulfill_obligation<'tcx>(ty: TyCtxt<'tcx, 'tcx>, (param_env, trait_ref): (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>)) -> Vtable<'tcx, ()> @@ -74,7 +74,7 @@ pub fn codegen_fulfill_obligation<'tcx>(ty: TyCtxt<'tcx, 'tcx, 'tcx>, }) } -impl<'tcx> TyCtxt<'tcx, 'tcx, 'tcx> { +impl<'tcx> TyCtxt<'tcx, 'tcx> { /// Monomorphizes a type from the AST by first applying the /// in-scope substitutions and then normalizing any associated /// types. diff --git a/src/librustc/traits/coherence.rs b/src/librustc/traits/coherence.rs index 763c752ab301f..95e96036b4992 100644 --- a/src/librustc/traits/coherence.rs +++ b/src/librustc/traits/coherence.rs @@ -49,7 +49,7 @@ pub fn add_placeholder_note(err: &mut errors::DiagnosticBuilder<'_>) { /// with a suitably-freshened `ImplHeader` with those types /// substituted. Otherwise, invokes `no_overlap`. pub fn overlapping_impls<'gcx, F1, F2, R>( - tcx: TyCtxt<'gcx, 'gcx, 'gcx>, + tcx: TyCtxt<'gcx, 'gcx>, impl1_def_id: DefId, impl2_def_id: DefId, intercrate_mode: IntercrateMode, @@ -183,7 +183,7 @@ fn overlap_within_probe( Some(OverlapResult { impl_header, intercrate_ambiguity_causes, involves_placeholder }) } -pub fn trait_ref_is_knowable<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, +pub fn trait_ref_is_knowable<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, trait_ref: ty::TraitRef<'tcx>) -> Option { @@ -229,7 +229,7 @@ pub fn trait_ref_is_knowable<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, } } -pub fn trait_ref_is_local_or_fundamental<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, +pub fn trait_ref_is_local_or_fundamental<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, trait_ref: ty::TraitRef<'tcx>) -> bool { trait_ref.def_id.krate == LOCAL_CRATE || tcx.has_attr(trait_ref.def_id, sym::fundamental) @@ -246,7 +246,7 @@ pub enum OrphanCheckErr<'tcx> { /// /// 1. All type parameters in `Self` must be "covered" by some local type constructor. /// 2. Some local type must appear in `Self`. -pub fn orphan_check<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, +pub fn orphan_check<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, impl_def_id: DefId) -> Result<(), OrphanCheckErr<'tcx>> { @@ -353,7 +353,7 @@ pub fn orphan_check<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, /// /// Note that this function is never called for types that have both type /// parameters and inference variables. -fn orphan_check_trait_ref<'tcx>(tcx: TyCtxt<'_, '_, '_>, +fn orphan_check_trait_ref<'tcx>(tcx: TyCtxt<'_, '_>, trait_ref: ty::TraitRef<'tcx>, in_crate: InCrate) -> Result<(), OrphanCheckErr<'tcx>> @@ -430,7 +430,7 @@ fn orphan_check_trait_ref<'tcx>(tcx: TyCtxt<'_, '_, '_>, } } -fn uncovered_tys<'tcx>(tcx: TyCtxt<'_, '_, '_>, ty: Ty<'tcx>, in_crate: InCrate) +fn uncovered_tys<'tcx>(tcx: TyCtxt<'_, '_>, ty: Ty<'tcx>, in_crate: InCrate) -> Vec> { if ty_is_local_constructor(ty, in_crate) { vec![] @@ -450,7 +450,7 @@ fn is_possibly_remote_type(ty: Ty<'_>, _in_crate: InCrate) -> bool { } } -fn ty_is_local(tcx: TyCtxt<'_, '_, '_>, ty: Ty<'_>, in_crate: InCrate) -> bool { +fn ty_is_local(tcx: TyCtxt<'_, '_>, ty: Ty<'_>, in_crate: InCrate) -> bool { ty_is_local_constructor(ty, in_crate) || fundamental_ty(ty) && ty.walk_shallow().any(|t| ty_is_local(tcx, t, in_crate)) } diff --git a/src/librustc/traits/engine.rs b/src/librustc/traits/engine.rs index 23bbd9192b1cc..e43ca8e7e0acf 100644 --- a/src/librustc/traits/engine.rs +++ b/src/librustc/traits/engine.rs @@ -78,7 +78,7 @@ impl> TraitEngineExt<'tcx> for T { } impl dyn TraitEngine<'tcx> { - pub fn new(tcx: TyCtxt<'tcx, '_, 'tcx>) -> Box { + pub fn new(tcx: TyCtxt<'_, 'tcx>) -> Box { if tcx.sess.opts.debugging_opts.chalk { Box::new(ChalkFulfillmentContext::new()) } else { diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs index 5ed627ccee4bd..50eac8f069058 100644 --- a/src/librustc/traits/error_reporting.rs +++ b/src/librustc/traits/error_reporting.rs @@ -1249,7 +1249,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { found: ty::PolyTraitRef<'tcx>) -> DiagnosticBuilder<'tcx> { - fn build_fn_sig_string<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + fn build_fn_sig_string<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, trait_ref: &ty::TraitRef<'tcx>) -> String { let inputs = trait_ref.substs.type_at(1); let sig = if let ty::Tuple(inputs) = inputs.sty { @@ -1294,7 +1294,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { } } -impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> { pub fn recursive_type_with_infinite_size_error(self, type_def_id: DefId) -> DiagnosticBuilder<'tcx> @@ -1457,7 +1457,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { } impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for ParamToVarFolder<'a, 'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.infcx.tcx } + fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> { self.infcx.tcx } fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> { if let ty::Param(ty::ParamTy {name, .. }) = ty.sty { diff --git a/src/librustc/traits/mod.rs b/src/librustc/traits/mod.rs index e6bab57584f43..b478824129909 100644 --- a/src/librustc/traits/mod.rs +++ b/src/librustc/traits/mod.rs @@ -140,7 +140,7 @@ pub struct ObligationCause<'tcx> { } impl<'tcx> ObligationCause<'tcx> { - pub fn span<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Span { + pub fn span<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Span { match self.code { ObligationCauseCode::CompareImplMethodObligation { .. } | ObligationCauseCode::MainFunctionType | @@ -365,7 +365,7 @@ impl<'tcx> DomainGoal<'tcx> { impl<'tcx> GoalKind<'tcx> { pub fn from_poly_domain_goal<'gcx>( domain_goal: PolyDomainGoal<'tcx>, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, ) -> GoalKind<'tcx> { match domain_goal.no_bound_vars() { Some(p) => p.into_goal(), @@ -710,7 +710,7 @@ pub fn type_known_to_meet_bound_modulo_regions<'a, 'gcx, 'tcx>( } } -fn do_normalize_predicates<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn do_normalize_predicates<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, region_context: DefId, cause: ObligationCause<'tcx>, elaborated_env: ty::ParamEnv<'tcx>, @@ -795,7 +795,7 @@ fn do_normalize_predicates<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, // FIXME: this is gonna need to be removed ... /// Normalizes the parameter environment, reporting errors if they occur. -pub fn normalize_param_env_or_error<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn normalize_param_env_or_error<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, region_context: DefId, unnormalized_env: ty::ParamEnv<'tcx>, cause: ObligationCause<'tcx>) @@ -936,7 +936,7 @@ pub fn fully_normalize<'a, 'gcx, 'tcx, T>( /// environment. If this returns false, then either normalize /// encountered an error or one of the predicates did not hold. Used /// when creating vtables to check for unsatisfiable methods. -fn normalize_and_test_predicates<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn normalize_and_test_predicates<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, predicates: Vec>) -> bool { @@ -965,7 +965,7 @@ fn normalize_and_test_predicates<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, result } -fn substitute_normalize_and_test_predicates<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn substitute_normalize_and_test_predicates<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, key: (DefId, SubstsRef<'tcx>)) -> bool { @@ -984,7 +984,7 @@ fn substitute_normalize_and_test_predicates<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, /// that come from `trait_ref`, including its supertraits. #[inline] // FIXME(#35870): avoid closures being unexported due to `impl Trait`. fn vtable_methods<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, trait_ref: ty::PolyTraitRef<'tcx>) -> &'tcx [Option<(DefId, SubstsRef<'tcx>)>] { @@ -1207,16 +1207,16 @@ where fn lift_ex_clause_to_tcx<'gcx>( ex_clause: &chalk_engine::ExClause, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, ) -> Option; fn lift_delayed_literal_to_tcx<'gcx>( ex_clause: &chalk_engine::DelayedLiteral, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, ) -> Option; fn lift_literal_to_tcx<'gcx>( ex_clause: &chalk_engine::Literal, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, ) -> Option; } diff --git a/src/librustc/traits/object_safety.rs b/src/librustc/traits/object_safety.rs index 6923d1c0230d7..88961c1dc81f1 100644 --- a/src/librustc/traits/object_safety.rs +++ b/src/librustc/traits/object_safety.rs @@ -83,7 +83,7 @@ pub enum MethodViolationCode { UndispatchableReceiver, } -impl<'tcx> TyCtxt<'tcx, 'tcx, 'tcx> { +impl<'tcx> TyCtxt<'tcx, 'tcx> { /// Returns the object safety violations that affect /// astconv -- currently, `Self` in supertraits. This is needed @@ -703,7 +703,7 @@ impl<'tcx> TyCtxt<'tcx, 'tcx, 'tcx> { } } -pub(super) fn is_object_safe_provider<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub(super) fn is_object_safe_provider<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, trait_def_id: DefId) -> bool { tcx.object_safety_violations(trait_def_id).is_empty() } diff --git a/src/librustc/traits/on_unimplemented.rs b/src/librustc/traits/on_unimplemented.rs index e01e5b8b0b903..85af5efb42413 100644 --- a/src/librustc/traits/on_unimplemented.rs +++ b/src/librustc/traits/on_unimplemented.rs @@ -35,7 +35,7 @@ impl OnUnimplementedNote { } } -fn parse_error(tcx: TyCtxt<'_, '_, '_>, span: Span, +fn parse_error(tcx: TyCtxt<'_, '_>, span: Span, message: &str, label: &str, note: Option<&str>) @@ -52,7 +52,7 @@ fn parse_error(tcx: TyCtxt<'_, '_, '_>, span: Span, } impl<'gcx, 'tcx> OnUnimplementedDirective { - fn parse(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + fn parse(tcx: TyCtxt<'gcx, 'tcx>, trait_def_id: DefId, items: &[NestedMetaItem], span: Span, @@ -133,7 +133,7 @@ impl<'gcx, 'tcx> OnUnimplementedDirective { } - pub fn of_item(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + pub fn of_item(tcx: TyCtxt<'gcx, 'tcx>, trait_def_id: DefId, impl_def_id: DefId) -> Result, ErrorReported> @@ -165,7 +165,7 @@ impl<'gcx, 'tcx> OnUnimplementedDirective { } pub fn evaluate(&self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, trait_ref: ty::TraitRef<'tcx>, options: &[(Symbol, Option)]) -> OnUnimplementedNote @@ -215,7 +215,7 @@ impl<'gcx, 'tcx> OnUnimplementedDirective { } impl<'gcx, 'tcx> OnUnimplementedFormatString { - fn try_parse(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + fn try_parse(tcx: TyCtxt<'gcx, 'tcx>, trait_def_id: DefId, from: LocalInternedString, err_sp: Span) @@ -228,7 +228,7 @@ impl<'gcx, 'tcx> OnUnimplementedFormatString { fn verify( &self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, trait_def_id: DefId, span: Span, ) -> Result<(), ErrorReported> { @@ -274,7 +274,7 @@ impl<'gcx, 'tcx> OnUnimplementedFormatString { pub fn format( &self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, trait_ref: ty::TraitRef<'tcx>, options: &FxHashMap, ) -> String { diff --git a/src/librustc/traits/project.rs b/src/librustc/traits/project.rs index 45cc8b255aa43..e997e4d9c3183 100644 --- a/src/librustc/traits/project.rs +++ b/src/librustc/traits/project.rs @@ -323,7 +323,7 @@ impl<'a, 'b, 'gcx, 'tcx> AssocTypeNormalizer<'a, 'b, 'gcx, 'tcx> { } impl<'a, 'b, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for AssocTypeNormalizer<'a, 'b, 'gcx, 'tcx> { - fn tcx<'c>(&'c self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx<'c>(&'c self) -> TyCtxt<'gcx, 'tcx> { self.selcx.tcx() } @@ -836,7 +836,7 @@ struct Progress<'tcx> { } impl<'tcx> Progress<'tcx> { - fn error<'gcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Self { + fn error<'gcx>(tcx: TyCtxt<'gcx, 'tcx>) -> Self { Progress { ty: tcx.types.err, obligations: vec![], diff --git a/src/librustc/traits/query/dropck_outlives.rs b/src/librustc/traits/query/dropck_outlives.rs index 7fdf3ddceb55b..e2cb5cb89d98a 100644 --- a/src/librustc/traits/query/dropck_outlives.rs +++ b/src/librustc/traits/query/dropck_outlives.rs @@ -87,7 +87,7 @@ pub struct DropckOutlivesResult<'tcx> { impl<'tcx> DropckOutlivesResult<'tcx> { pub fn report_overflows( &self, - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, span: Span, ty: Ty<'tcx>, ) { @@ -106,7 +106,7 @@ impl<'tcx> DropckOutlivesResult<'tcx> { pub fn into_kinds_reporting_overflows( self, - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, span: Span, ty: Ty<'tcx>, ) -> Vec> { @@ -190,7 +190,7 @@ impl_stable_hash_for!(struct DtorckConstraint<'tcx> { /// /// Note also that `needs_drop` requires a "global" type (i.e., one /// with erased regions), but this function does not. -pub fn trivial_dropck_outlives<'tcx>(tcx: TyCtxt<'tcx, '_, 'tcx>, ty: Ty<'tcx>) -> bool { +pub fn trivial_dropck_outlives<'tcx>(tcx: TyCtxt<'_, 'tcx>, ty: Ty<'tcx>) -> bool { match ty.sty { // None of these types have a destructor and hence they do not // require anything in particular to outlive the dtor's diff --git a/src/librustc/traits/query/normalize.rs b/src/librustc/traits/query/normalize.rs index 8ee5447ab292a..86067a7c1d801 100644 --- a/src/librustc/traits/query/normalize.rs +++ b/src/librustc/traits/query/normalize.rs @@ -83,7 +83,7 @@ struct QueryNormalizer<'cx, 'gcx: 'tcx, 'tcx: 'cx> { } impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for QueryNormalizer<'cx, 'gcx, 'tcx> { - fn tcx<'c>(&'c self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx<'c>(&'c self) -> TyCtxt<'gcx, 'tcx> { self.infcx.tcx } diff --git a/src/librustc/traits/query/normalize_erasing_regions.rs b/src/librustc/traits/query/normalize_erasing_regions.rs index bab6fd542deb0..b9ca0363fc689 100644 --- a/src/librustc/traits/query/normalize_erasing_regions.rs +++ b/src/librustc/traits/query/normalize_erasing_regions.rs @@ -10,7 +10,7 @@ use crate::ty::{self, Ty, TyCtxt}; use crate::ty::fold::{TypeFoldable, TypeFolder}; -impl<'tcx> TyCtxt<'tcx, 'tcx, 'tcx> { +impl<'tcx> TyCtxt<'tcx, 'tcx> { /// Erase the regions in `value` and then fully normalize all the /// types found within. The result will also have regions erased. /// @@ -63,12 +63,12 @@ impl<'tcx> TyCtxt<'tcx, 'tcx, 'tcx> { } struct NormalizeAfterErasingRegionsFolder<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, } impl TypeFolder<'tcx, 'tcx> for NormalizeAfterErasingRegionsFolder<'tcx> { - fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx, 'tcx> { + fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx> { self.tcx } diff --git a/src/librustc/traits/query/type_op/ascribe_user_type.rs b/src/librustc/traits/query/type_op/ascribe_user_type.rs index bb6b2272c783d..c663a65659c55 100644 --- a/src/librustc/traits/query/type_op/ascribe_user_type.rs +++ b/src/librustc/traits/query/type_op/ascribe_user_type.rs @@ -25,14 +25,14 @@ impl<'gcx: 'tcx, 'tcx> super::QueryTypeOp<'gcx, 'tcx> for AscribeUserType<'tcx> type QueryResponse = (); fn try_fast_path( - _tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + _tcx: TyCtxt<'gcx, 'tcx>, _key: &ParamEnvAnd<'tcx, Self>, ) -> Option { None } fn perform_query( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Self>>, ) -> Fallible> { tcx.type_op_ascribe_user_type(canonicalized) diff --git a/src/librustc/traits/query/type_op/eq.rs b/src/librustc/traits/query/type_op/eq.rs index a8e786809467d..c431178bb2a29 100644 --- a/src/librustc/traits/query/type_op/eq.rs +++ b/src/librustc/traits/query/type_op/eq.rs @@ -18,7 +18,7 @@ impl<'gcx: 'tcx, 'tcx> super::QueryTypeOp<'gcx, 'tcx> for Eq<'tcx> { type QueryResponse = (); fn try_fast_path( - _tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + _tcx: TyCtxt<'gcx, 'tcx>, key: &ParamEnvAnd<'tcx, Eq<'tcx>>, ) -> Option { if key.value.a == key.value.b { @@ -29,7 +29,7 @@ impl<'gcx: 'tcx, 'tcx> super::QueryTypeOp<'gcx, 'tcx> for Eq<'tcx> { } fn perform_query( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Self>>, ) -> Fallible> { tcx.type_op_eq(canonicalized) diff --git a/src/librustc/traits/query/type_op/implied_outlives_bounds.rs b/src/librustc/traits/query/type_op/implied_outlives_bounds.rs index 537f6ccee62b7..762e09b03acad 100644 --- a/src/librustc/traits/query/type_op/implied_outlives_bounds.rs +++ b/src/librustc/traits/query/type_op/implied_outlives_bounds.rs @@ -18,14 +18,14 @@ impl<'gcx: 'tcx, 'tcx> super::QueryTypeOp<'gcx, 'tcx> for ImpliedOutlivesBounds< type QueryResponse = Vec>; fn try_fast_path( - _tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + _tcx: TyCtxt<'gcx, 'tcx>, _key: &ParamEnvAnd<'tcx, Self>, ) -> Option { None } fn perform_query( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Self>>, ) -> Fallible> { // FIXME this `unchecked_map` is only necessary because the diff --git a/src/librustc/traits/query/type_op/mod.rs b/src/librustc/traits/query/type_op/mod.rs index c1f76eb2f2f28..1553d17e684fa 100644 --- a/src/librustc/traits/query/type_op/mod.rs +++ b/src/librustc/traits/query/type_op/mod.rs @@ -53,7 +53,7 @@ pub trait QueryTypeOp<'gcx: 'tcx, 'tcx>: /// actually hits the tcx cache lookup etc. Return `Some(r)` with /// a final result or `None` to do the full path. fn try_fast_path( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, key: &ParamEnvAnd<'tcx, Self>, ) -> Option; @@ -64,7 +64,7 @@ pub trait QueryTypeOp<'gcx: 'tcx, 'tcx>: /// bad, because it would create subregion relationships that are /// not captured in the return value. fn perform_query( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Self>>, ) -> Fallible>; diff --git a/src/librustc/traits/query/type_op/normalize.rs b/src/librustc/traits/query/type_op/normalize.rs index 3fc3d9607e777..52a0c6042baf5 100644 --- a/src/librustc/traits/query/type_op/normalize.rs +++ b/src/librustc/traits/query/type_op/normalize.rs @@ -24,7 +24,7 @@ where { type QueryResponse = T; - fn try_fast_path(_tcx: TyCtxt<'tcx, 'gcx, 'tcx>, key: &ParamEnvAnd<'tcx, Self>) -> Option { + fn try_fast_path(_tcx: TyCtxt<'gcx, 'tcx>, key: &ParamEnvAnd<'tcx, Self>) -> Option { if !key.value.value.has_projections() { Some(key.value.value) } else { @@ -33,7 +33,7 @@ where } fn perform_query( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Self>>, ) -> Fallible> { T::type_op_method(tcx, canonicalized) @@ -48,7 +48,7 @@ where pub trait Normalizable<'gcx, 'tcx>: fmt::Debug + TypeFoldable<'tcx> + Lift<'gcx> + Copy { fn type_op_method( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Normalize>>, ) -> Fallible>; @@ -64,7 +64,7 @@ where 'gcx: 'tcx, { fn type_op_method( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Normalize>>, ) -> Fallible> { tcx.type_op_normalize_ty(canonicalized) @@ -82,7 +82,7 @@ where 'gcx: 'tcx, { fn type_op_method( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Normalize>>, ) -> Fallible> { tcx.type_op_normalize_predicate(canonicalized) @@ -100,7 +100,7 @@ where 'gcx: 'tcx, { fn type_op_method( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Normalize>>, ) -> Fallible> { tcx.type_op_normalize_poly_fn_sig(canonicalized) @@ -118,7 +118,7 @@ where 'gcx: 'tcx, { fn type_op_method( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Normalize>>, ) -> Fallible> { tcx.type_op_normalize_fn_sig(canonicalized) diff --git a/src/librustc/traits/query/type_op/outlives.rs b/src/librustc/traits/query/type_op/outlives.rs index ee5cd30bde841..56a051e08e716 100644 --- a/src/librustc/traits/query/type_op/outlives.rs +++ b/src/librustc/traits/query/type_op/outlives.rs @@ -22,7 +22,7 @@ where type QueryResponse = DropckOutlivesResult<'tcx>; fn try_fast_path( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, key: &ParamEnvAnd<'tcx, Self>, ) -> Option { if trivial_dropck_outlives(tcx, key.value.dropped_ty) { @@ -33,7 +33,7 @@ where } fn perform_query( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Self>>, ) -> Fallible> { // Subtle: note that we are not invoking diff --git a/src/librustc/traits/query/type_op/prove_predicate.rs b/src/librustc/traits/query/type_op/prove_predicate.rs index 6a46ea4057562..64fcc73187cf0 100644 --- a/src/librustc/traits/query/type_op/prove_predicate.rs +++ b/src/librustc/traits/query/type_op/prove_predicate.rs @@ -17,7 +17,7 @@ impl<'gcx: 'tcx, 'tcx> super::QueryTypeOp<'gcx, 'tcx> for ProvePredicate<'tcx> { type QueryResponse = (); fn try_fast_path( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, key: &ParamEnvAnd<'tcx, Self>, ) -> Option { // Proving Sized, very often on "obviously sized" types like @@ -38,7 +38,7 @@ impl<'gcx: 'tcx, 'tcx> super::QueryTypeOp<'gcx, 'tcx> for ProvePredicate<'tcx> { } fn perform_query( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Self>>, ) -> Fallible> { tcx.type_op_prove_predicate(canonicalized) diff --git a/src/librustc/traits/query/type_op/subtype.rs b/src/librustc/traits/query/type_op/subtype.rs index 346af0dd9df07..a2f47211f4828 100644 --- a/src/librustc/traits/query/type_op/subtype.rs +++ b/src/librustc/traits/query/type_op/subtype.rs @@ -20,7 +20,7 @@ impl<'tcx> Subtype<'tcx> { impl<'gcx: 'tcx, 'tcx> super::QueryTypeOp<'gcx, 'tcx> for Subtype<'tcx> { type QueryResponse = (); - fn try_fast_path(_tcx: TyCtxt<'tcx, 'gcx, 'tcx>, key: &ParamEnvAnd<'tcx, Self>) -> Option<()> { + fn try_fast_path(_tcx: TyCtxt<'gcx, 'tcx>, key: &ParamEnvAnd<'tcx, Self>) -> Option<()> { if key.value.sub == key.value.sup { Some(()) } else { @@ -29,7 +29,7 @@ impl<'gcx: 'tcx, 'tcx> super::QueryTypeOp<'gcx, 'tcx> for Subtype<'tcx> { } fn perform_query( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Self>>, ) -> Fallible> { tcx.type_op_subtype(canonicalized) diff --git a/src/librustc/traits/select.rs b/src/librustc/traits/select.rs index 30270c72d1bd6..57a361d469eff 100644 --- a/src/librustc/traits/select.rs +++ b/src/librustc/traits/select.rs @@ -300,7 +300,7 @@ enum SelectionCandidate<'tcx> { impl<'a, 'tcx> ty::Lift<'tcx> for SelectionCandidate<'a> { type Lifted = SelectionCandidate<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { Some(match *self { BuiltinCandidate { has_nested } => BuiltinCandidate { has_nested }, ImplCandidate(def_id) => ImplCandidate(def_id), @@ -568,7 +568,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { self.infcx } - pub fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + pub fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.infcx.tcx } @@ -3989,7 +3989,7 @@ impl WithDepNode { } } - pub fn get(&self, tcx: TyCtxt<'_, '_, '_>) -> T { + pub fn get(&self, tcx: TyCtxt<'_, '_>) -> T { tcx.dep_graph.read_index(self.dep_node); self.cached_value.clone() } diff --git a/src/librustc/traits/specialize/mod.rs b/src/librustc/traits/specialize/mod.rs index 6acee698c8e76..d395f7199fb2c 100644 --- a/src/librustc/traits/specialize/mod.rs +++ b/src/librustc/traits/specialize/mod.rs @@ -110,7 +110,7 @@ pub fn translate_substs<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>, /// that impl, a less specialized impl, or the trait default, /// whichever applies. pub fn find_associated_item<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, item: &ty::AssocItem, substs: SubstsRef<'tcx>, @@ -149,7 +149,7 @@ pub fn find_associated_item<'tcx>( /// Specialization is determined by the sets of types to which the impls apply; /// `impl1` specializes `impl2` if it applies to a subset of the types `impl2` applies /// to. -pub(super) fn specializes<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub(super) fn specializes<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, (impl1_def_id, impl2_def_id): (DefId, DefId)) -> bool { @@ -286,7 +286,7 @@ fn fulfill_implication<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>, // Query provider for `specialization_graph_of`. pub(super) fn specialization_graph_provider<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, trait_id: DefId, ) -> &'tcx specialization_graph::Graph { let mut sg = specialization_graph::Graph::new(); @@ -390,7 +390,7 @@ pub(super) fn specialization_graph_provider<'tcx>( /// Recovers the "impl X for Y" signature from `impl_def_id` and returns it as a /// string. -fn to_pretty_impl_header(tcx: TyCtxt<'_, '_, '_>, impl_def_id: DefId) -> Option { +fn to_pretty_impl_header(tcx: TyCtxt<'_, '_>, impl_def_id: DefId) -> Option { use std::fmt::Write; let trait_ref = if let Some(tr) = tcx.impl_trait_ref(impl_def_id) { diff --git a/src/librustc/traits/specialize/specialization_graph.rs b/src/librustc/traits/specialize/specialization_graph.rs index 6650cda435d5a..89116fac7303b 100644 --- a/src/librustc/traits/specialize/specialization_graph.rs +++ b/src/librustc/traits/specialize/specialization_graph.rs @@ -84,7 +84,7 @@ enum Inserted { impl<'gcx, 'tcx> Children { /// Insert an impl into this set of children without comparing to any existing impls. fn insert_blindly(&mut self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, impl_def_id: DefId) { let trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap(); if let Some(sty) = fast_reject::simplify_type(tcx, trait_ref.self_ty(), false) { @@ -100,7 +100,7 @@ impl<'gcx, 'tcx> Children { /// an impl with a parent. The impl must be present in the list of /// children already. fn remove_existing(&mut self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, impl_def_id: DefId) { let trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap(); let vec: &mut Vec; @@ -119,7 +119,7 @@ impl<'gcx, 'tcx> Children { /// Attempt to insert an impl into this set of children, while comparing for /// specialization relationships. fn insert(&mut self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, impl_def_id: DefId, simplified_self: Option) -> Result @@ -294,7 +294,7 @@ impl<'gcx, 'tcx> Graph { /// conflicts with it (has overlap, but neither specializes the other), /// information about the area of overlap is returned in the `Err`. pub fn insert(&mut self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, impl_def_id: DefId) -> Result, OverlapError> { assert!(impl_def_id.is_local()); @@ -387,7 +387,7 @@ impl<'gcx, 'tcx> Graph { /// Insert cached metadata mapping from a child impl back to its parent. pub fn record_impl_from_cstore(&mut self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, parent: DefId, child: DefId) { if self.parent.insert(child, parent).is_some() { @@ -425,7 +425,7 @@ impl<'gcx, 'tcx> Node { /// Iterate over the items defined directly by the given (impl or trait) node. pub fn items( &self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, ) -> ty::AssocItemsIterator<'gcx, 'tcx> { tcx.associated_items(self.def_id()) } @@ -482,7 +482,7 @@ impl<'gcx, 'tcx> Ancestors<'gcx> { #[inline] pub fn defs( self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, trait_item_name: Ident, trait_item_kind: ty::AssocKind, trait_def_id: DefId, @@ -508,7 +508,7 @@ impl<'gcx, 'tcx> Ancestors<'gcx> { /// Walk up the specialization ancestors of a given impl, starting with that /// impl itself. -pub fn ancestors(tcx: TyCtxt<'_, 'tcx, '_>, +pub fn ancestors(tcx: TyCtxt<'tcx, '_>, trait_def_id: DefId, start_from_impl: DefId) -> Ancestors<'tcx> { diff --git a/src/librustc/traits/structural_impls.rs b/src/librustc/traits/structural_impls.rs index f5853b69e8b7b..e919f0ed2b4d6 100644 --- a/src/librustc/traits/structural_impls.rs +++ b/src/librustc/traits/structural_impls.rs @@ -446,7 +446,7 @@ impl<'tcx> fmt::Display for traits::Clause<'tcx> { impl<'a, 'tcx> Lift<'tcx> for traits::SelectionError<'a> { type Lifted = traits::SelectionError<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { match *self { super::Unimplemented => Some(super::Unimplemented), super::OutputTypeParameterMismatch(a, b, ref err) => { @@ -464,7 +464,7 @@ impl<'a, 'tcx> Lift<'tcx> for traits::SelectionError<'a> { impl<'a, 'tcx> Lift<'tcx> for traits::ObligationCauseCode<'a> { type Lifted = traits::ObligationCauseCode<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { match *self { super::ReturnNoExpression => Some(super::ReturnNoExpression), super::MiscObligation => Some(super::MiscObligation), @@ -546,7 +546,7 @@ impl<'a, 'tcx> Lift<'tcx> for traits::ObligationCauseCode<'a> { impl<'a, 'tcx> Lift<'tcx> for traits::DerivedObligationCause<'a> { type Lifted = traits::DerivedObligationCause<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { tcx.lift(&self.parent_trait_ref).and_then(|trait_ref| tcx.lift(&*self.parent_code) .map(|code| traits::DerivedObligationCause { @@ -559,7 +559,7 @@ impl<'a, 'tcx> Lift<'tcx> for traits::DerivedObligationCause<'a> { impl<'a, 'tcx> Lift<'tcx> for traits::ObligationCause<'a> { type Lifted = traits::ObligationCause<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { tcx.lift(&self.code).map(|code| traits::ObligationCause { span: self.span, body_id: self.body_id, @@ -571,7 +571,7 @@ impl<'a, 'tcx> Lift<'tcx> for traits::ObligationCause<'a> { // For codegen only. impl<'a, 'tcx> Lift<'tcx> for traits::Vtable<'a, ()> { type Lifted = traits::Vtable<'tcx, ()>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { match self.clone() { traits::VtableImpl(traits::VtableImplData { impl_def_id, @@ -691,7 +691,7 @@ EnumLiftImpl! { impl<'a, 'tcx> Lift<'tcx> for traits::Environment<'a> { type Lifted = traits::Environment<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { tcx.lift(&self.clauses).map(|clauses| { traits::Environment { clauses, @@ -702,7 +702,7 @@ impl<'a, 'tcx> Lift<'tcx> for traits::Environment<'a> { impl<'a, 'tcx, G: Lift<'tcx>> Lift<'tcx> for traits::InEnvironment<'a, G> { type Lifted = traits::InEnvironment<'tcx, G::Lifted>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { tcx.lift(&self.environment).and_then(|environment| { tcx.lift(&self.goal).map(|goal| { traits::InEnvironment { @@ -721,7 +721,7 @@ where { type Lifted = C::LiftedExClause; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { ::lift_ex_clause_to_tcx(self, tcx) } } @@ -733,7 +733,7 @@ where { type Lifted = C::LiftedDelayedLiteral; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { ::lift_delayed_literal_to_tcx(self, tcx) } } @@ -745,7 +745,7 @@ where { type Lifted = C::LiftedLiteral; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { ::lift_literal_to_tcx(self, tcx) } } diff --git a/src/librustc/traits/util.rs b/src/librustc/traits/util.rs index e77ac75279e33..ef4f6472c87ec 100644 --- a/src/librustc/traits/util.rs +++ b/src/librustc/traits/util.rs @@ -12,7 +12,7 @@ use crate::util::nodemap::FxHashSet; use super::{Obligation, ObligationCause, PredicateObligation, SelectionContext, Normalized}; -fn anonymize_predicate<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, +fn anonymize_predicate<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, pred: &ty::Predicate<'tcx>) -> ty::Predicate<'tcx> { match *pred { @@ -46,12 +46,12 @@ fn anonymize_predicate<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, } struct PredicateSet<'gcx, 'tcx> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, set: FxHashSet>, } impl PredicateSet<'gcx, 'tcx> { - fn new(tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Self { + fn new(tcx: TyCtxt<'gcx, 'tcx>) -> Self { Self { tcx: tcx, set: Default::default() } } @@ -94,7 +94,7 @@ pub struct Elaborator<'gcx, 'tcx> { } pub fn elaborate_trait_ref<'gcx, 'tcx>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, trait_ref: ty::PolyTraitRef<'tcx>) -> Elaborator<'gcx, 'tcx> { @@ -102,7 +102,7 @@ pub fn elaborate_trait_ref<'gcx, 'tcx>( } pub fn elaborate_trait_refs<'gcx, 'tcx>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, trait_refs: impl Iterator>) -> Elaborator<'gcx, 'tcx> { @@ -111,7 +111,7 @@ pub fn elaborate_trait_refs<'gcx, 'tcx>( } pub fn elaborate_predicates<'gcx, 'tcx>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, mut predicates: Vec>) -> Elaborator<'gcx, 'tcx> { @@ -256,13 +256,13 @@ impl Iterator for Elaborator<'gcx, 'tcx> { pub type Supertraits<'gcx, 'tcx> = FilterToTraits>; -pub fn supertraits<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, +pub fn supertraits<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, trait_ref: ty::PolyTraitRef<'tcx>) -> Supertraits<'gcx, 'tcx> { elaborate_trait_ref(tcx, trait_ref).filter_to_traits() } -pub fn transitive_bounds<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, +pub fn transitive_bounds<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, bounds: impl Iterator>) -> Supertraits<'gcx, 'tcx> { elaborate_trait_refs(tcx, bounds).filter_to_traits() @@ -281,7 +281,7 @@ pub fn transitive_bounds<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, /// Expansion is done via a DFS (depth-first search), and the `visited` field /// is used to avoid cycles. pub struct TraitAliasExpander<'gcx, 'tcx> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, stack: Vec>, } @@ -338,7 +338,7 @@ impl<'tcx> TraitAliasExpansionInfo<'tcx> { } pub fn expand_trait_aliases<'gcx, 'tcx>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, trait_refs: impl IntoIterator, Span)> ) -> TraitAliasExpander<'gcx, 'tcx> { let items: Vec<_> = trait_refs @@ -415,12 +415,12 @@ impl<'gcx, 'tcx> Iterator for TraitAliasExpander<'gcx, 'tcx> { /////////////////////////////////////////////////////////////////////////// pub struct SupertraitDefIds<'gcx, 'tcx> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, stack: Vec, visited: FxHashSet, } -pub fn supertrait_def_ids<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, +pub fn supertrait_def_ids<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, trait_def_id: DefId) -> SupertraitDefIds<'gcx, 'tcx> { @@ -552,7 +552,7 @@ pub fn predicate_for_trait_ref<'tcx>( } } -impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> { pub fn predicate_for_trait_def(self, param_env: ty::ParamEnv<'tcx>, cause: ObligationCause<'tcx>, diff --git a/src/librustc/ty/_match.rs b/src/librustc/ty/_match.rs index aca22baf7d1a7..38a85c21963ce 100644 --- a/src/librustc/ty/_match.rs +++ b/src/librustc/ty/_match.rs @@ -20,18 +20,18 @@ use crate::mir::interpret::ConstValue; /// important thing about the result is Ok/Err. Also, matching never /// affects any type variables or unification state. pub struct Match<'gcx, 'tcx> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx> + tcx: TyCtxt<'gcx, 'tcx> } impl Match<'gcx, 'tcx> { - pub fn new(tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Match<'gcx, 'tcx> { + pub fn new(tcx: TyCtxt<'gcx, 'tcx>) -> Match<'gcx, 'tcx> { Match { tcx } } } impl TypeRelation<'gcx, 'tcx> for Match<'gcx, 'tcx> { fn tag(&self) -> &'static str { "Match" } - fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.tcx } + fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.tcx } fn a_is_expected(&self) -> bool { true } // irrelevant fn relate_with_variance>(&mut self, diff --git a/src/librustc/ty/adjustment.rs b/src/librustc/ty/adjustment.rs index bdc5cd3fb330a..d5fe106085160 100644 --- a/src/librustc/ty/adjustment.rs +++ b/src/librustc/ty/adjustment.rs @@ -104,7 +104,7 @@ pub struct OverloadedDeref<'tcx> { } impl<'gcx, 'tcx> OverloadedDeref<'tcx> { - pub fn method_call(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, source: Ty<'tcx>) + pub fn method_call(&self, tcx: TyCtxt<'gcx, 'tcx>, source: Ty<'tcx>) -> (DefId, SubstsRef<'tcx>) { let trait_def_id = match self.mutbl { hir::MutImmutable => tcx.lang_items().deref_trait(), diff --git a/src/librustc/ty/codec.rs b/src/librustc/ty/codec.rs index ade084a2135bf..3561a647d5e54 100644 --- a/src/librustc/ty/codec.rs +++ b/src/librustc/ty/codec.rs @@ -108,7 +108,7 @@ pub fn encode_predicates<'tcx, E, C>(encoder: &mut E, } pub trait TyDecoder<'tcx>: Decoder { - fn tcx(&self) -> TyCtxt<'tcx, 'tcx, 'tcx>; + fn tcx(&self) -> TyCtxt<'tcx, 'tcx>; fn peek_byte(&self) -> u8; diff --git a/src/librustc/ty/constness.rs b/src/librustc/ty/constness.rs index fed7caef0d4d2..466cb353c85e4 100644 --- a/src/librustc/ty/constness.rs +++ b/src/librustc/ty/constness.rs @@ -6,7 +6,7 @@ use syntax_pos::symbol::{sym, Symbol}; use crate::hir::map::blocks::FnLikeNode; use syntax::attr; -impl<'tcx> TyCtxt<'tcx, 'tcx, 'tcx> { +impl<'tcx> TyCtxt<'tcx, 'tcx> { /// Whether the `def_id` counts as const fn in your current crate, considering all active /// feature gates pub fn is_const_fn(self, def_id: DefId) -> bool { @@ -69,7 +69,7 @@ impl<'tcx> TyCtxt<'tcx, 'tcx, 'tcx> { pub fn provide<'tcx>(providers: &mut Providers<'tcx>) { /// only checks whether the function has a `const` modifier - fn is_const_fn_raw<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> bool { + fn is_const_fn_raw<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> bool { let hir_id = tcx.hir().as_local_hir_id(def_id) .expect("Non-local call to local provider is_const_fn"); @@ -83,7 +83,7 @@ pub fn provide<'tcx>(providers: &mut Providers<'tcx>) { } } - fn is_promotable_const_fn<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> bool { + fn is_promotable_const_fn<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> bool { tcx.is_const_fn(def_id) && match tcx.lookup_stability(def_id) { Some(stab) => { if cfg!(debug_assertions) && stab.promotable { @@ -101,7 +101,7 @@ pub fn provide<'tcx>(providers: &mut Providers<'tcx>) { } } - fn const_fn_is_allowed_fn_ptr<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> bool { + fn const_fn_is_allowed_fn_ptr<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> bool { tcx.is_const_fn(def_id) && tcx.lookup_stability(def_id) .map(|stab| stab.allow_const_fn_ptr).unwrap_or(false) diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index 8212822ba82c7..106637a5b2041 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -1016,13 +1016,13 @@ pub struct FreeRegionInfo { /// /// [rustc guide]: https://rust-lang.github.io/rustc-guide/ty.html #[derive(Copy, Clone)] -pub struct TyCtxt<'a, 'gcx: 'tcx, 'tcx: 'a> { +pub struct TyCtxt<'gcx: 'tcx, 'tcx> { gcx: &'gcx GlobalCtxt<'gcx>, interners: &'gcx CtxtInterners<'gcx>, - dummy: PhantomData<(&'a (), &'tcx ())>, + dummy: PhantomData<&'tcx ()>, } -impl<'gcx> Deref for TyCtxt<'_, 'gcx, '_> { +impl<'gcx> Deref for TyCtxt<'gcx, '_> { type Target = &'gcx GlobalCtxt<'gcx>; #[inline(always)] fn deref(&self) -> &Self::Target { @@ -1119,10 +1119,10 @@ pub struct GlobalCtxt<'tcx> { output_filenames: Arc, } -impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> { /// Gets the global `TyCtxt`. #[inline] - pub fn global_tcx(self) -> TyCtxt<'gcx, 'gcx, 'gcx> { + pub fn global_tcx(self) -> TyCtxt<'gcx, 'gcx> { TyCtxt { gcx: self.gcx, interners: &self.gcx.global_interners, @@ -1666,7 +1666,7 @@ impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { } } -impl<'tcx> TyCtxt<'tcx, 'tcx, 'tcx> { +impl<'tcx> TyCtxt<'tcx, 'tcx> { pub fn encode_metadata(self) -> EncodedMetadata { @@ -1683,7 +1683,7 @@ impl<'gcx> GlobalCtxt<'gcx> { f: F ) -> R where - F: FnOnce(TyCtxt<'tcx, 'gcx, 'tcx>) -> R, + F: FnOnce(TyCtxt<'gcx, 'tcx>) -> R, 'gcx: 'tcx, { let tcx = TyCtxt { @@ -1725,7 +1725,7 @@ impl<'gcx> GlobalCtxt<'gcx> { /// e.g., `()` or `u8`, was interned in a different context. pub trait Lift<'tcx>: fmt::Debug { type Lifted: fmt::Debug + 'tcx; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option; + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option; } @@ -1733,7 +1733,7 @@ macro_rules! nop_lift { ($ty:ty => $lifted:ty) => { impl<'a, 'tcx> Lift<'tcx> for $ty { type Lifted = $lifted; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { if tcx.interners.arena.in_arena(*self as *const _) { return Some(unsafe { mem::transmute(*self) }); } @@ -1752,7 +1752,7 @@ macro_rules! nop_list_lift { ($ty:ty => $lifted:ty) => { impl<'a, 'tcx> Lift<'tcx> for &'a List<$ty> { type Lifted = &'tcx List<$lifted>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { if self.is_empty() { return Some(List::empty()); } @@ -1815,7 +1815,7 @@ pub mod tls { pub struct ImplicitCtxt<'a, 'gcx: 'tcx, 'tcx> { /// The current TyCtxt. Initially created by `enter_global` and updated /// by `enter_local` with a new local interner - pub tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + pub tcx: TyCtxt<'gcx, 'tcx>, /// The current query job, if any. This is updated by JobOwner::start in /// ty::query::plumbing when executing a query @@ -1941,7 +1941,7 @@ pub mod tls { /// This happens once per rustc session and TyCtxts only exists /// inside the `f` function. pub fn enter_global<'gcx, F, R>(gcx: &'gcx GlobalCtxt<'gcx>, f: F) -> R - where F: FnOnce(TyCtxt<'gcx, 'gcx, 'gcx>) -> R + where F: FnOnce(TyCtxt<'gcx, 'gcx>) -> R { // Update GCX_PTR to indicate there's a GlobalCtxt available GCX_PTR.with(|lock| { @@ -1978,7 +1978,7 @@ pub mod tls { /// Creates a TyCtxt and ImplicitCtxt based on the GCX_PTR thread local. /// This is used in the deadlock handler. pub unsafe fn with_global(f: F) -> R - where F: for<'gcx, 'tcx> FnOnce(TyCtxt<'tcx, 'gcx, 'tcx>) -> R + where F: for<'gcx, 'tcx> FnOnce(TyCtxt<'gcx, 'tcx>) -> R { let gcx = GCX_PTR.with(|lock| *lock.lock()); assert!(gcx != 0); @@ -2030,7 +2030,7 @@ pub mod tls { /// This will panic if you pass it a TyCtxt which has a different global interner from /// the current ImplicitCtxt's tcx field. #[inline] - pub fn with_related_context<'gcx, 'tcx1, F, R>(tcx: TyCtxt<'tcx1, 'gcx, 'tcx1>, f: F) -> R + pub fn with_related_context<'gcx, 'tcx1, F, R>(tcx: TyCtxt<'gcx, 'tcx1>, f: F) -> R where F: for<'b, 'tcx2> FnOnce(&ImplicitCtxt<'b, 'gcx, 'tcx2>) -> R { with_context(|context| { @@ -2048,7 +2048,7 @@ pub mod tls { /// This will panic if you pass it a TyCtxt which has a different global interner or /// a different local interner from the current ImplicitCtxt's tcx field. #[inline] - pub fn with_fully_related_context<'gcx, 'tcx, F, R>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, f: F) -> R + pub fn with_fully_related_context<'gcx, 'tcx, F, R>(tcx: TyCtxt<'gcx, 'tcx>, f: F) -> R where F: for<'b> FnOnce(&ImplicitCtxt<'b, 'gcx, 'tcx>) -> R { with_context(|context| { @@ -2065,7 +2065,7 @@ pub mod tls { /// Panics if there is no ImplicitCtxt available #[inline] pub fn with(f: F) -> R - where F: for<'gcx, 'tcx> FnOnce(TyCtxt<'tcx, 'gcx, 'tcx>) -> R + where F: for<'gcx, 'tcx> FnOnce(TyCtxt<'gcx, 'tcx>) -> R { with_context(|context| f(context.tcx)) } @@ -2074,7 +2074,7 @@ pub mod tls { /// The closure is passed None if there is no ImplicitCtxt available #[inline] pub fn with_opt(f: F) -> R - where F: for<'gcx, 'tcx> FnOnce(Option>) -> R + where F: for<'gcx, 'tcx> FnOnce(Option>) -> R { with_context_opt(|opt_context| f(opt_context.map(|context| context.tcx))) } @@ -2098,7 +2098,7 @@ macro_rules! sty_debug_print { all_infer: usize, } - pub fn go(tcx: TyCtxt<'_, '_, '_>) { + pub fn go(tcx: TyCtxt<'_, '_>) { let mut total = DebugStat { total: 0, lt_infer: 0, @@ -2151,7 +2151,7 @@ macro_rules! sty_debug_print { }} } -impl<'tcx> TyCtxt<'tcx, 'tcx, 'tcx> { +impl<'tcx> TyCtxt<'tcx, 'tcx> { pub fn print_debug_stats(self) { sty_debug_print!( self, @@ -2290,7 +2290,7 @@ macro_rules! intern_method { $alloc_method:expr, $alloc_to_key:expr, $keep_in_local_tcx:expr) -> $ty:ty) => { - impl<'a, 'gcx, $lt_tcx> TyCtxt<'a, 'gcx, $lt_tcx> { + impl<'gcx, $lt_tcx> TyCtxt<'gcx, $lt_tcx> { pub fn $method(self, v: $alloc) -> &$lt_tcx $ty { let key = ($alloc_to_key)(&v); @@ -2400,7 +2400,7 @@ intern_method! { ) -> List } -impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> { /// Given a `fn` type, returns an equivalent `unsafe fn` type; /// that is, a `fn` type that is equivalent in every way for being /// unsafe. diff --git a/src/librustc/ty/erase_regions.rs b/src/librustc/ty/erase_regions.rs index df189d01a629a..330343c250c66 100644 --- a/src/librustc/ty/erase_regions.rs +++ b/src/librustc/ty/erase_regions.rs @@ -8,13 +8,13 @@ pub(super) fn provide(providers: &mut ty::query::Providers<'_>) { }; } -fn erase_regions_ty<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ty: Ty<'tcx>) -> Ty<'tcx> { +fn erase_regions_ty<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, ty: Ty<'tcx>) -> Ty<'tcx> { // N.B., use `super_fold_with` here. If we used `fold_with`, it // could invoke the `erase_regions_ty` query recursively. ty.super_fold_with(&mut RegionEraserVisitor { tcx }) } -impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> { /// Returns an equivalent value with all free regions removed (note /// that late-bound regions remain, because they are important for /// subtyping, but they are anonymized and normalized as well).. @@ -33,11 +33,11 @@ impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { } struct RegionEraserVisitor<'gcx, 'tcx> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, } impl TypeFolder<'gcx, 'tcx> for RegionEraserVisitor<'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> { self.tcx } diff --git a/src/librustc/ty/error.rs b/src/librustc/ty/error.rs index 632bbe229de32..000e0854f4e97 100644 --- a/src/librustc/ty/error.rs +++ b/src/librustc/ty/error.rs @@ -184,7 +184,7 @@ impl<'tcx> fmt::Display for TypeError<'tcx> { } impl<'gcx, 'lcx, 'tcx> ty::TyS<'tcx> { - pub fn sort_string(&self, tcx: TyCtxt<'lcx, 'gcx, 'lcx>) -> Cow<'static, str> { + pub fn sort_string(&self, tcx: TyCtxt<'gcx, 'lcx>) -> Cow<'static, str> { match self.sty { ty::Bool | ty::Char | ty::Int(_) | ty::Uint(_) | ty::Float(_) | ty::Str | ty::Never => self.to_string().into(), @@ -249,7 +249,7 @@ impl<'gcx, 'lcx, 'tcx> ty::TyS<'tcx> { } } -impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> { pub fn note_and_explain_type_err(self, db: &mut DiagnosticBuilder<'_>, err: &TypeError<'tcx>, diff --git a/src/librustc/ty/fast_reject.rs b/src/librustc/ty/fast_reject.rs index f858c92ff0d0f..238865c866e50 100644 --- a/src/librustc/ty/fast_reject.rs +++ b/src/librustc/ty/fast_reject.rs @@ -55,7 +55,7 @@ pub enum SimplifiedTypeGen /// then we can't say much about whether two types would unify. Put another way, /// `can_simplify_params` should be true if type parameters appear free in `ty` and `false` if they /// are to be considered bound. -pub fn simplify_type<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, +pub fn simplify_type<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, ty: Ty<'_>, can_simplify_params: bool) -> Option diff --git a/src/librustc/ty/fold.rs b/src/librustc/ty/fold.rs index 1698d8d3cdd64..00ef9446fb194 100644 --- a/src/librustc/ty/fold.rs +++ b/src/librustc/ty/fold.rs @@ -156,7 +156,7 @@ pub trait TypeFoldable<'tcx>: fmt::Debug + Clone { /// identity fold, it should invoke `foo.fold_with(self)` to fold each /// sub-item. pub trait TypeFolder<'gcx: 'tcx, 'tcx> : Sized { - fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'gcx, 'tcx>; + fn tcx<'a>(&'a self) -> TyCtxt<'gcx, 'tcx>; fn fold_binder(&mut self, t: &Binder) -> Binder where T : TypeFoldable<'tcx> @@ -203,7 +203,7 @@ pub struct BottomUpFolder<'gcx, 'tcx, F, G, H> G: FnMut(ty::Region<'tcx>) -> ty::Region<'tcx>, H: FnMut(&'tcx ty::Const<'tcx>) -> &'tcx ty::Const<'tcx>, { - pub tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + pub tcx: TyCtxt<'gcx, 'tcx>, pub ty_op: F, pub lt_op: G, pub ct_op: H, @@ -214,7 +214,7 @@ impl<'gcx, 'tcx, F, G, H> TypeFolder<'gcx, 'tcx> for BottomUpFolder<'gcx, 'tcx, G: FnMut(ty::Region<'tcx>) -> ty::Region<'tcx>, H: FnMut(&'tcx ty::Const<'tcx>) -> &'tcx ty::Const<'tcx>, { - fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.tcx } + fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> { self.tcx } fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> { let t = ty.super_fold_with(self); @@ -235,7 +235,7 @@ impl<'gcx, 'tcx, F, G, H> TypeFolder<'gcx, 'tcx> for BottomUpFolder<'gcx, 'tcx, /////////////////////////////////////////////////////////////////////////// // Region folder -impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> { /// Collects the free and escaping regions in `value` into `region_set`. Returns /// whether any late-bound regions were skipped pub fn collect_regions(self, @@ -362,7 +362,7 @@ impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { /// visited by `fld_r`. pub struct RegionFolder<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, skipped_regions: &'a mut bool, /// Stores the index of a binder *just outside* the stuff we have @@ -382,7 +382,7 @@ pub struct RegionFolder<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { impl<'a, 'gcx, 'tcx> RegionFolder<'a, 'gcx, 'tcx> { #[inline] pub fn new( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, skipped_regions: &'a mut bool, fold_region_fn: &'a mut dyn FnMut(ty::Region<'tcx>, ty::DebruijnIndex) -> ty::Region<'tcx>, ) -> RegionFolder<'a, 'gcx, 'tcx> { @@ -396,7 +396,7 @@ impl<'a, 'gcx, 'tcx> RegionFolder<'a, 'gcx, 'tcx> { } impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for RegionFolder<'a, 'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.tcx } + fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> { self.tcx } fn fold_binder>(&mut self, t: &ty::Binder) -> ty::Binder { self.current_index.shift_in(1); @@ -427,7 +427,7 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for RegionFolder<'a, 'gcx, 'tcx> { /// Replaces the escaping bound vars (late bound regions or bound types) in a type. struct BoundVarReplacer<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, /// As with `RegionFolder`, represents the index of a binder *just outside* /// the ones we have visited. @@ -440,7 +440,7 @@ struct BoundVarReplacer<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { impl<'a, 'gcx, 'tcx> BoundVarReplacer<'a, 'gcx, 'tcx> { fn new( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, fld_r: &'a mut F, fld_t: &'a mut G, fld_c: &'a mut H, @@ -460,7 +460,7 @@ impl<'a, 'gcx, 'tcx> BoundVarReplacer<'a, 'gcx, 'tcx> { } impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for BoundVarReplacer<'a, 'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.tcx } + fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> { self.tcx } fn fold_binder>(&mut self, t: &ty::Binder) -> ty::Binder { self.current_index.shift_in(1); @@ -542,7 +542,7 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for BoundVarReplacer<'a, 'gcx, 'tcx> } } -impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> { /// Replaces all regions bound by the given `Binder` with the /// results returned by the closure; the closure is expected to /// return a free region (relative to this binder), and hence the @@ -723,14 +723,14 @@ enum Direction { } struct Shifter<'gcx, 'tcx> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, current_index: ty::DebruijnIndex, amount: u32, direction: Direction, } impl Shifter<'gcx, 'tcx> { - pub fn new(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, amount: u32, direction: Direction) -> Self { + pub fn new(tcx: TyCtxt<'gcx, 'tcx>, amount: u32, direction: Direction) -> Self { Shifter { tcx, current_index: ty::INNERMOST, @@ -741,7 +741,7 @@ impl Shifter<'gcx, 'tcx> { } impl TypeFolder<'gcx, 'tcx> for Shifter<'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.tcx } + fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> { self.tcx } fn fold_binder>(&mut self, t: &ty::Binder) -> ty::Binder { self.current_index.shift_in(1); @@ -818,7 +818,7 @@ impl TypeFolder<'gcx, 'tcx> for Shifter<'gcx, 'tcx> { } pub fn shift_region<'gcx, 'tcx>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, region: ty::Region<'tcx>, amount: u32 ) -> ty::Region<'tcx> { @@ -833,7 +833,7 @@ pub fn shift_region<'gcx, 'tcx>( } pub fn shift_vars<'gcx, 'tcx, T>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, value: &T, amount: u32 ) -> T where T: TypeFoldable<'tcx> { @@ -844,7 +844,7 @@ pub fn shift_vars<'gcx, 'tcx, T>( } pub fn shift_out_vars<'gcx, 'tcx, T>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, value: &T, amount: u32 ) -> T where T: TypeFoldable<'tcx> { diff --git a/src/librustc/ty/inhabitedness/def_id_forest.rs b/src/librustc/ty/inhabitedness/def_id_forest.rs index ebe23b27117f2..0573249e57c9a 100644 --- a/src/librustc/ty/inhabitedness/def_id_forest.rs +++ b/src/librustc/ty/inhabitedness/def_id_forest.rs @@ -32,7 +32,7 @@ impl<'gcx, 'tcx> DefIdForest { /// Creates a forest consisting of a single tree representing the entire /// crate. #[inline] - pub fn full(tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> DefIdForest { + pub fn full(tcx: TyCtxt<'gcx, 'tcx>) -> DefIdForest { let crate_id = tcx.hir().local_def_id(CRATE_NODE_ID); DefIdForest::from_id(crate_id) } @@ -53,14 +53,14 @@ impl<'gcx, 'tcx> DefIdForest { /// Tests whether the forest contains a given DefId. pub fn contains(&self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, id: DefId) -> bool { self.root_ids.iter().any(|root_id| tcx.is_descendant_of(id, *root_id)) } /// Calculate the intersection of a collection of forests. - pub fn intersection(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + pub fn intersection(tcx: TyCtxt<'gcx, 'tcx>, iter: I) -> DefIdForest where I: IntoIterator { @@ -97,7 +97,7 @@ impl<'gcx, 'tcx> DefIdForest { } /// Calculate the union of a collection of forests. - pub fn union(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + pub fn union(tcx: TyCtxt<'gcx, 'tcx>, iter: I) -> DefIdForest where I: IntoIterator { diff --git a/src/librustc/ty/inhabitedness/mod.rs b/src/librustc/ty/inhabitedness/mod.rs index 1c9b06cb6b475..54558fd6561ac 100644 --- a/src/librustc/ty/inhabitedness/mod.rs +++ b/src/librustc/ty/inhabitedness/mod.rs @@ -51,7 +51,7 @@ mod def_id_forest; // This code should only compile in modules where the uninhabitedness of Foo is // visible. -impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> { /// Checks whether a type is visibly uninhabited from a particular module. /// # Example /// ```rust @@ -110,7 +110,7 @@ impl<'gcx, 'tcx> AdtDef { /// Calculate the forest of DefIds from which this adt is visibly uninhabited. fn uninhabited_from( &self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, substs: SubstsRef<'tcx>) -> DefIdForest { // Non-exhaustive ADTs from other crates are always considered inhabited. @@ -128,7 +128,7 @@ impl<'gcx, 'tcx> VariantDef { /// Calculate the forest of DefIds from which this variant is visibly uninhabited. pub fn uninhabited_from( &self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, substs: SubstsRef<'tcx>, adt_kind: AdtKind) -> DefIdForest { @@ -154,7 +154,7 @@ impl<'gcx, 'tcx> FieldDef { /// Calculate the forest of DefIds from which this field is visibly uninhabited. fn uninhabited_from( &self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, substs: SubstsRef<'tcx>, is_enum: bool, ) -> DefIdForest { @@ -182,7 +182,7 @@ impl<'gcx, 'tcx> FieldDef { impl<'gcx, 'tcx> TyS<'tcx> { /// Calculate the forest of DefIds from which this type is visibly uninhabited. - fn uninhabited_from(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> DefIdForest + fn uninhabited_from(&self, tcx: TyCtxt<'gcx, 'tcx>) -> DefIdForest { match self.sty { Adt(def, substs) => def.uninhabited_from(tcx, substs), diff --git a/src/librustc/ty/instance.rs b/src/librustc/ty/instance.rs index 92c64e8614e9a..a48f88220f417 100644 --- a/src/librustc/ty/instance.rs +++ b/src/librustc/ty/instance.rs @@ -44,7 +44,7 @@ pub enum InstanceDef<'tcx> { impl<'tcx> Instance<'tcx> { pub fn ty(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>) + tcx: TyCtxt<'tcx, 'tcx>) -> Ty<'tcx> { let ty = tcx.type_of(self.def.def_id()); @@ -55,7 +55,7 @@ impl<'tcx> Instance<'tcx> { ) } - fn fn_sig_noadjust(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> PolyFnSig<'tcx> { + fn fn_sig_noadjust(&self, tcx: TyCtxt<'tcx, 'tcx>) -> PolyFnSig<'tcx> { let ty = self.ty(tcx); match ty.sty { ty::FnDef(..) | @@ -105,7 +105,7 @@ impl<'tcx> Instance<'tcx> { } } - pub fn fn_sig(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> ty::PolyFnSig<'tcx> { + pub fn fn_sig(&self, tcx: TyCtxt<'tcx, 'tcx>) -> ty::PolyFnSig<'tcx> { let mut fn_sig = self.fn_sig_noadjust(tcx); if let InstanceDef::VtableShim(..) = self.def { // Modify fn(self, ...) to fn(self: *mut Self, ...) @@ -136,13 +136,13 @@ impl<'tcx> InstanceDef<'tcx> { } #[inline] - pub fn attrs(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> ty::Attributes<'tcx> { + pub fn attrs(&self, tcx: TyCtxt<'tcx, 'tcx>) -> ty::Attributes<'tcx> { tcx.get_attrs(self.def_id()) } pub fn is_inline( &self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx> + tcx: TyCtxt<'tcx, 'tcx> ) -> bool { use crate::hir::map::DefPathData; let def_id = match *self { @@ -158,7 +158,7 @@ impl<'tcx> InstanceDef<'tcx> { pub fn requires_local( &self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx> + tcx: TyCtxt<'tcx, 'tcx> ) -> bool { if self.is_inline(tcx) { return true @@ -218,7 +218,7 @@ impl<'b, 'tcx> Instance<'tcx> { Instance { def: InstanceDef::Item(def_id), substs: substs } } - pub fn mono(tcx: TyCtxt<'b, 'tcx, 'b>, def_id: DefId) -> Instance<'tcx> { + pub fn mono(tcx: TyCtxt<'tcx, 'b>, def_id: DefId) -> Instance<'tcx> { Instance::new(def_id, tcx.global_tcx().empty_substs_for_def_id(def_id)) } @@ -245,7 +245,7 @@ impl<'b, 'tcx> Instance<'tcx> { /// Presuming that coherence and type-check have succeeded, if this method is invoked /// in a monomorphic context (i.e., like during codegen), then it is guaranteed to return /// `Some`. - pub fn resolve(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + pub fn resolve(tcx: TyCtxt<'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, def_id: DefId, substs: SubstsRef<'tcx>) -> Option> { @@ -297,7 +297,7 @@ impl<'b, 'tcx> Instance<'tcx> { result } - pub fn resolve_for_vtable(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + pub fn resolve_for_vtable(tcx: TyCtxt<'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, def_id: DefId, substs: SubstsRef<'tcx>) -> Option> { @@ -317,7 +317,7 @@ impl<'b, 'tcx> Instance<'tcx> { } pub fn resolve_closure( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, substs: ty::ClosureSubsts<'tcx>, requested_kind: ty::ClosureKind) @@ -332,7 +332,7 @@ impl<'b, 'tcx> Instance<'tcx> { } pub fn resolve_drop_in_place( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, ty: Ty<'tcx>) -> ty::Instance<'tcx> { @@ -342,7 +342,7 @@ impl<'b, 'tcx> Instance<'tcx> { } pub fn fn_once_adapter_instance( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, closure_did: DefId, substs: ty::ClosureSubsts<'tcx>) -> Instance<'tcx> @@ -377,7 +377,7 @@ impl<'b, 'tcx> Instance<'tcx> { } fn resolve_associated_item<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, trait_item: &ty::AssocItem, param_env: ty::ParamEnv<'tcx>, trait_id: DefId, diff --git a/src/librustc/ty/layout.rs b/src/librustc/ty/layout.rs index 4c76d36f11c7b..327c430cd396f 100644 --- a/src/librustc/ty/layout.rs +++ b/src/librustc/ty/layout.rs @@ -31,9 +31,9 @@ use rustc_target::abi::call::{ pub trait IntegerExt { - fn to_ty<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, signed: bool) -> Ty<'tcx>; + fn to_ty<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx>, signed: bool) -> Ty<'tcx>; fn from_attr(cx: &C, ity: attr::IntType) -> Integer; - fn repr_discr<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + fn repr_discr<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, ty: Ty<'tcx>, repr: &ReprOptions, min: i128, @@ -42,7 +42,7 @@ pub trait IntegerExt { } impl IntegerExt for Integer { - fn to_ty<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, signed: bool) -> Ty<'tcx> { + fn to_ty<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx>, signed: bool) -> Ty<'tcx> { match (*self, signed) { (I8, false) => tcx.types.u8, (I16, false) => tcx.types.u16, @@ -77,7 +77,7 @@ impl IntegerExt for Integer { /// signed discriminant range and #[repr] attribute. /// N.B.: u128 values above i128::MAX will be treated as signed, but /// that shouldn't affect anything, other than maybe debuginfo. - fn repr_discr<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + fn repr_discr<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, ty: Ty<'tcx>, repr: &ReprOptions, min: i128, @@ -126,11 +126,11 @@ impl IntegerExt for Integer { } pub trait PrimitiveExt { - fn to_ty<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Ty<'tcx>; + fn to_ty<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx>) -> Ty<'tcx>; } impl PrimitiveExt for Primitive { - fn to_ty<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Ty<'tcx> { + fn to_ty<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx>) -> Ty<'tcx> { match *self { Int(i, signed) => i.to_ty(tcx, signed), Float(FloatTy::F32) => tcx.types.f32, @@ -171,7 +171,7 @@ impl<'tcx> fmt::Display for LayoutError<'tcx> { } } -fn layout_raw<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn layout_raw<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, query: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> Result<&'tcx LayoutDetails, LayoutError<'tcx>> { @@ -226,7 +226,7 @@ enum StructKind { Prefixed(Size, Align), } -impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx, 'tcx, 'tcx>> { +impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx, 'tcx>> { fn scalar_pair(&self, a: Scalar, b: Scalar) -> LayoutDetails { let dl = self.data_layout(); let b_align = b.value.align(dl); @@ -1221,7 +1221,7 @@ enum SavedLocalEligibility { // Also included in the layout are the upvars and the discriminant. // These are included as fields on the "outer" layout; they are not part // of any variant. -impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx, 'tcx, 'tcx>> { +impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx, 'tcx>> { /// Compute the eligibility and assignment of each local. fn generator_saved_local_eligibility(&self, info: &GeneratorLayout<'tcx>) -> (BitSet, IndexVec) { @@ -1605,7 +1605,7 @@ pub enum SizeSkeleton<'tcx> { impl<'tcx> SizeSkeleton<'tcx> { pub fn compute(ty: Ty<'tcx>, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>) -> Result, LayoutError<'tcx>> { debug_assert!(!ty.has_infer_types()); @@ -1727,21 +1727,21 @@ impl<'tcx> SizeSkeleton<'tcx> { } pub trait HasTyCtxt<'tcx>: HasDataLayout { - fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx, 'tcx>; + fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx>; } pub trait HasParamEnv<'tcx> { fn param_env(&self) -> ty::ParamEnv<'tcx>; } -impl<'gcx, 'tcx> HasDataLayout for TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> HasDataLayout for TyCtxt<'gcx, 'tcx> { fn data_layout(&self) -> &TargetDataLayout { &self.data_layout } } -impl<'gcx, 'tcx> HasTyCtxt<'gcx> for TyCtxt<'tcx, 'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'gcx, 'gcx> { +impl<'gcx, 'tcx> HasTyCtxt<'gcx> for TyCtxt<'gcx, 'tcx> { + fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'gcx> { self.global_tcx() } } @@ -1759,7 +1759,7 @@ impl<'tcx, T: HasDataLayout> HasDataLayout for LayoutCx<'tcx, T> { } impl<'gcx, 'tcx, T: HasTyCtxt<'gcx>> HasTyCtxt<'gcx> for LayoutCx<'tcx, T> { - fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'gcx, 'gcx> { + fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'gcx> { self.tcx.tcx() } } @@ -1796,7 +1796,7 @@ impl MaybeResult for Result { pub type TyLayout<'tcx> = ::rustc_target::abi::TyLayout<'tcx, Ty<'tcx>>; -impl<'tcx> LayoutOf for LayoutCx<'tcx, TyCtxt<'tcx, 'tcx, 'tcx>> { +impl<'tcx> LayoutOf for LayoutCx<'tcx, TyCtxt<'tcx, 'tcx>> { type Ty = Ty<'tcx>; type TyLayout = Result, LayoutError<'tcx>>; @@ -1855,7 +1855,7 @@ impl LayoutOf for LayoutCx<'tcx, ty::query::TyCtxtAt<'tcx, 'tcx>> { } // Helper (inherent) `layout_of` methods to avoid pushing `LayoutCx` to users. -impl TyCtxt<'_, 'tcx, '_> { +impl TyCtxt<'tcx, '_> { /// Computes the layout of a type. Note that this implicitly /// executes in "reveal all" mode. #[inline] @@ -2189,7 +2189,7 @@ struct Niche { impl Niche { fn reserve<'tcx>( &self, - cx: &LayoutCx<'tcx, TyCtxt<'tcx, 'tcx, 'tcx>>, + cx: &LayoutCx<'tcx, TyCtxt<'tcx, 'tcx>>, count: u128, ) -> Option<(u128, Scalar)> { if count > self.available { @@ -2205,7 +2205,7 @@ impl Niche { } } -impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx, 'tcx, 'tcx>> { +impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx, 'tcx>> { /// Find the offset of a niche leaf field, starting from /// the given type and recursing through aggregates. // FIXME(eddyb) traverse already optimized enums. diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index be19b2d945cbf..76681fe2e8cf4 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -213,7 +213,7 @@ impl AssocItem { } } - pub fn signature<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> String { + pub fn signature<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx>) -> String { match self.kind { ty::AssocKind::Method => { // We skip the binder here because the binder would deanonymize all @@ -259,14 +259,14 @@ pub trait DefIdTree: Copy { } } -impl<'gcx, 'tcx> DefIdTree for TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> DefIdTree for TyCtxt<'gcx, 'tcx> { fn parent(self, id: DefId) -> Option { self.def_key(id).parent.map(|index| DefId { index: index, ..id }) } } impl Visibility { - pub fn from_hir(visibility: &hir::Visibility, id: hir::HirId, tcx: TyCtxt<'_, '_, '_>) -> Self { + pub fn from_hir(visibility: &hir::Visibility, id: hir::HirId, tcx: TyCtxt<'_, '_>) -> Self { match visibility.node { hir::VisibilityKind::Public => Visibility::Public, hir::VisibilityKind::Crate(_) => Visibility::Restricted(DefId::local(CRATE_DEF_INDEX)), @@ -934,7 +934,7 @@ impl<'gcx, 'tcx> Generics { own_counts } - pub fn requires_monomorphization(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> bool { + pub fn requires_monomorphization(&self, tcx: TyCtxt<'gcx, 'tcx>) -> bool { if self.own_requires_monomorphization() { return true; } @@ -959,7 +959,7 @@ impl<'gcx, 'tcx> Generics { pub fn region_param(&'tcx self, param: &EarlyBoundRegion, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>) + tcx: TyCtxt<'gcx, 'tcx>) -> &'tcx GenericParamDef { if let Some(index) = param.index.checked_sub(self.parent_count as u32) { @@ -977,7 +977,7 @@ impl<'gcx, 'tcx> Generics { /// Returns the `GenericParamDef` associated with this `ParamTy`. pub fn type_param(&'tcx self, param: &ParamTy, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>) + tcx: TyCtxt<'gcx, 'tcx>) -> &'tcx GenericParamDef { if let Some(index) = param.index.checked_sub(self.parent_count as u32) { let param = &self.params[index as usize]; @@ -994,7 +994,7 @@ impl<'gcx, 'tcx> Generics { /// Returns the `ConstParameterDef` associated with this `ParamConst`. pub fn const_param(&'tcx self, param: &ParamConst, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>) + tcx: TyCtxt<'gcx, 'tcx>) -> &GenericParamDef { if let Some(index) = param.index.checked_sub(self.parent_count as u32) { let param = &self.params[index as usize]; @@ -1020,21 +1020,21 @@ impl<'tcx> serialize::UseSpecializedEncodable for GenericPredicates<'tcx> {} impl<'tcx> serialize::UseSpecializedDecodable for GenericPredicates<'tcx> {} impl<'gcx, 'tcx> GenericPredicates<'tcx> { - pub fn instantiate(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, substs: SubstsRef<'tcx>) + pub fn instantiate(&self, tcx: TyCtxt<'gcx, 'tcx>, substs: SubstsRef<'tcx>) -> InstantiatedPredicates<'tcx> { let mut instantiated = InstantiatedPredicates::empty(); self.instantiate_into(tcx, &mut instantiated, substs); instantiated } - pub fn instantiate_own(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, substs: SubstsRef<'tcx>) + pub fn instantiate_own(&self, tcx: TyCtxt<'gcx, 'tcx>, substs: SubstsRef<'tcx>) -> InstantiatedPredicates<'tcx> { InstantiatedPredicates { predicates: self.predicates.iter().map(|(p, _)| p.subst(tcx, substs)).collect(), } } - fn instantiate_into(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + fn instantiate_into(&self, tcx: TyCtxt<'gcx, 'tcx>, instantiated: &mut InstantiatedPredicates<'tcx>, substs: SubstsRef<'tcx>) { if let Some(def_id) = self.parent { @@ -1045,14 +1045,14 @@ impl<'gcx, 'tcx> GenericPredicates<'tcx> { ); } - pub fn instantiate_identity(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) + pub fn instantiate_identity(&self, tcx: TyCtxt<'gcx, 'tcx>) -> InstantiatedPredicates<'tcx> { let mut instantiated = InstantiatedPredicates::empty(); self.instantiate_identity_into(tcx, &mut instantiated); instantiated } - fn instantiate_identity_into(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + fn instantiate_identity_into(&self, tcx: TyCtxt<'gcx, 'tcx>, instantiated: &mut InstantiatedPredicates<'tcx>) { if let Some(def_id) = self.parent { tcx.predicates_of(def_id).instantiate_identity_into(tcx, instantiated); @@ -1060,7 +1060,7 @@ impl<'gcx, 'tcx> GenericPredicates<'tcx> { instantiated.predicates.extend(self.predicates.iter().map(|&(p, _)| p)) } - pub fn instantiate_supertrait(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + pub fn instantiate_supertrait(&self, tcx: TyCtxt<'gcx, 'tcx>, poly_trait_ref: &ty::PolyTraitRef<'tcx>) -> InstantiatedPredicates<'tcx> { @@ -1134,7 +1134,7 @@ impl<'gcx, 'tcx> Predicate<'tcx> { /// poly-trait-ref holds. This is slightly different from a normal /// substitution in terms of what happens with bound regions. See /// lengthy comment below for details. - pub fn subst_supertrait(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + pub fn subst_supertrait(&self, tcx: TyCtxt<'gcx, 'tcx>, trait_ref: &ty::PolyTraitRef<'tcx>) -> ty::Predicate<'tcx> { @@ -1294,7 +1294,7 @@ impl<'tcx> PolyProjectionPredicate<'tcx> { } #[inline] - pub fn to_poly_trait_ref(&self, tcx: TyCtxt<'_, '_, '_>) -> PolyTraitRef<'tcx> { + pub fn to_poly_trait_ref(&self, tcx: TyCtxt<'_, '_>) -> PolyTraitRef<'tcx> { // Note: unlike with `TraitRef::to_poly_trait_ref()`, // `self.0.trait_ref` is permitted to have escaping regions. // This is because here `self` has a `Binder` and so does our @@ -1856,7 +1856,7 @@ impl<'gcx, 'tcx> VariantDef { /// If someone speeds up attribute loading to not be a performance concern, they can /// remove this hack and use the constructor `DefId` everywhere. pub fn new( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, ident: Ident, variant_did: Option, ctor_def_id: Option, @@ -2069,7 +2069,7 @@ impl_stable_hash_for!(struct ReprOptions { }); impl ReprOptions { - pub fn new(tcx: TyCtxt<'_, '_, '_>, did: DefId) -> ReprOptions { + pub fn new(tcx: TyCtxt<'_, '_>, did: DefId) -> ReprOptions { let mut flags = ReprFlags::empty(); let mut size = None; let mut max_align = 0; @@ -2146,7 +2146,7 @@ impl ReprOptions { impl<'gcx, 'tcx> AdtDef { /// Creates a new `AdtDef`. fn new( - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, did: DefId, kind: AdtKind, variants: IndexVec, @@ -2286,7 +2286,7 @@ impl<'gcx, 'tcx> AdtDef { } /// Returns `true` if this type has a destructor. - pub fn has_dtor(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> bool { + pub fn has_dtor(&self, tcx: TyCtxt<'gcx, 'tcx>) -> bool { self.destructor(tcx).is_some() } @@ -2297,7 +2297,7 @@ impl<'gcx, 'tcx> AdtDef { } #[inline] - pub fn predicates(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> &'tcx GenericPredicates<'gcx> { + pub fn predicates(&self, tcx: TyCtxt<'gcx, 'tcx>) -> &'tcx GenericPredicates<'gcx> { tcx.predicates_of(self.did) } @@ -2351,7 +2351,7 @@ impl<'gcx, 'tcx> AdtDef { #[inline] pub fn eval_explicit_discr( &self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, expr_did: DefId, ) -> Option> { let param_env = ParamEnv::empty(); @@ -2398,7 +2398,7 @@ impl<'gcx, 'tcx> AdtDef { #[inline] pub fn discriminants( &'tcx self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, ) -> impl Iterator)> + Captures<'gcx> { let repr_type = self.repr.discr_type(); let initial = repr_type.initial_discriminant(tcx.global_tcx()); @@ -2428,7 +2428,7 @@ impl<'gcx, 'tcx> AdtDef { /// assuming there are no constant-evaluation errors there. #[inline] pub fn discriminant_for_variant(&self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, variant_index: VariantIdx) -> Discr<'tcx> { let (val, offset) = self.discriminant_def_for_variant(variant_index); @@ -2465,7 +2465,7 @@ impl<'gcx, 'tcx> AdtDef { (expr_did, variant_index.as_u32() - explicit_index) } - pub fn destructor(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + pub fn destructor(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { tcx.adt_destructor(self.did) } @@ -2479,12 +2479,12 @@ impl<'gcx, 'tcx> AdtDef { /// /// Due to normalization being eager, this applies even if /// the associated type is behind a pointer (e.g., issue #31299). - pub fn sized_constraint(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> &'tcx [Ty<'tcx>] { + pub fn sized_constraint(&self, tcx: TyCtxt<'gcx, 'tcx>) -> &'tcx [Ty<'tcx>] { tcx.adt_sized_constraint(self.did).0 } fn sized_constraint_for_ty(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, ty: Ty<'tcx>) -> Vec> { let result = match ty.sty { @@ -2564,7 +2564,7 @@ impl<'gcx, 'tcx> AdtDef { } impl<'gcx, 'tcx> FieldDef { - pub fn ty(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, subst: SubstsRef<'tcx>) -> Ty<'tcx> { + pub fn ty(&self, tcx: TyCtxt<'gcx, 'tcx>, subst: SubstsRef<'tcx>) -> Ty<'tcx> { tcx.type_of(self.did).subst(tcx, subst) } } @@ -2590,7 +2590,7 @@ impl<'tcx> ClosureKind { // This is the initial value used when doing upvar inference. pub const LATTICE_BOTTOM: ClosureKind = ClosureKind::Fn; - pub fn trait_did(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> DefId { + pub fn trait_did(&self, tcx: TyCtxt<'tcx, 'tcx>) -> DefId { match *self { ClosureKind::Fn => tcx.require_lang_item(FnTraitLangItem), ClosureKind::FnMut => { @@ -2618,7 +2618,7 @@ impl<'tcx> ClosureKind { /// Returns the representative scalar type for this closure kind. /// See `TyS::to_opt_closure_kind` for more details. - pub fn to_ty(self, tcx: TyCtxt<'tcx, '_, 'tcx>) -> Ty<'tcx> { + pub fn to_ty(self, tcx: TyCtxt<'_, 'tcx>) -> Ty<'tcx> { match self { ty::ClosureKind::Fn => tcx.types.i8, ty::ClosureKind::FnMut => tcx.types.i16, @@ -2755,7 +2755,7 @@ pub enum ImplOverlapKind { Issue33140 } -impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> { pub fn body_tables(self, body: hir::BodyId) -> &'gcx TypeckTables<'gcx> { self.typeck_tables_of(self.hir().body_owner_def_id(body)) } @@ -3116,7 +3116,7 @@ impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { } pub struct AssocItemsIterator<'gcx, 'tcx> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, def_ids: &'gcx [DefId], next_index: usize, } @@ -3131,7 +3131,7 @@ impl Iterator for AssocItemsIterator<'_, '_> { } } -fn associated_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> AssocItem { +fn associated_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> AssocItem { let id = tcx.hir().as_local_hir_id(def_id).unwrap(); let parent_id = tcx.hir().get_parent_item(id); let parent_def_id = tcx.hir().local_def_id_from_hir_id(parent_id); @@ -3176,7 +3176,7 @@ pub struct AdtSizedConstraint<'tcx>(pub &'tcx [Ty<'tcx>]); /// such. /// - a Error, if a type contained itself. The representability /// check should catch this case. -fn adt_sized_constraint<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn adt_sized_constraint<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> AdtSizedConstraint<'tcx> { let def = tcx.adt_def(def_id); @@ -3192,7 +3192,7 @@ fn adt_sized_constraint<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, AdtSizedConstraint(result) } -fn associated_item_def_ids<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn associated_item_def_ids<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> &'tcx [DefId] { let id = tcx.hir().as_local_hir_id(def_id).unwrap(); @@ -3217,14 +3217,14 @@ fn associated_item_def_ids<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } } -fn def_span<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> Span { +fn def_span<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> Span { tcx.hir().span_if_local(def_id).unwrap() } /// If the given `DefId` describes an item belonging to a trait, /// returns the `DefId` of the trait that the trait item belongs to; /// otherwise, returns `None`. -fn trait_of_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> Option { +fn trait_of_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> Option { tcx.opt_associated_item(def_id) .and_then(|associated_item| { match associated_item.container { @@ -3235,7 +3235,7 @@ fn trait_of_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> Option, def_id: DefId) -> Option { +pub fn is_impl_trait_defn(tcx: TyCtxt<'_, '_>, def_id: DefId) -> Option { if let Some(hir_id) = tcx.hir().as_local_hir_id(def_id) { if let Node::Item(item) = tcx.hir().get_by_hir_id(hir_id) { if let hir::ItemKind::Existential(ref exist_ty) = item.node { @@ -3247,7 +3247,7 @@ pub fn is_impl_trait_defn(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> Option(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn param_env<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> ParamEnv<'tcx> { @@ -3285,26 +3285,26 @@ fn param_env<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, traits::normalize_param_env_or_error(tcx, def_id, unnormalized_env, cause) } -fn crate_disambiguator<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn crate_disambiguator<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, crate_num: CrateNum) -> CrateDisambiguator { assert_eq!(crate_num, LOCAL_CRATE); tcx.sess.local_crate_disambiguator() } -fn original_crate_name<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn original_crate_name<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, crate_num: CrateNum) -> Symbol { assert_eq!(crate_num, LOCAL_CRATE); tcx.crate_name.clone() } -fn crate_hash<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn crate_hash<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, crate_num: CrateNum) -> Svh { assert_eq!(crate_num, LOCAL_CRATE); tcx.hir().crate_hash } -fn instance_def_size_estimate<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn instance_def_size_estimate<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, instance_def: InstanceDef<'tcx>) -> usize { match instance_def { @@ -3321,7 +3321,7 @@ fn instance_def_size_estimate<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, /// If `def_id` is an issue 33140 hack impl, returns its self type; otherwise, returns `None`. /// /// See [`ImplOverlapKind::Issue33140`] for more details. -fn issue33140_self_ty<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn issue33140_self_ty<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> Option> { diff --git a/src/librustc/ty/outlives.rs b/src/librustc/ty/outlives.rs index 1d80d86e7a82a..c24c0541ad71f 100644 --- a/src/librustc/ty/outlives.rs +++ b/src/librustc/ty/outlives.rs @@ -45,7 +45,7 @@ pub enum Component<'tcx> { EscapingProjection(Vec>), } -impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> { /// Push onto `out` all the things that must outlive `'a` for the condition /// `ty0: 'a` to hold. Note that `ty0` must be a **fully resolved type**. pub fn push_outlives_components(&self, ty0: Ty<'tcx>, diff --git a/src/librustc/ty/print/mod.rs b/src/librustc/ty/print/mod.rs index 9954160396c73..d5bca55c2f1b1 100644 --- a/src/librustc/ty/print/mod.rs +++ b/src/librustc/ty/print/mod.rs @@ -37,7 +37,7 @@ pub trait Printer<'gcx: 'tcx, 'tcx>: Sized { type DynExistential; type Const; - fn tcx(&'a self) -> TyCtxt<'tcx, 'gcx, 'tcx>; + fn tcx(&'a self) -> TyCtxt<'gcx, 'tcx>; fn print_def_path( self, diff --git a/src/librustc/ty/print/obsolete.rs b/src/librustc/ty/print/obsolete.rs index b429539658ff2..a320eb47e6c1c 100644 --- a/src/librustc/ty/print/obsolete.rs +++ b/src/librustc/ty/print/obsolete.rs @@ -17,14 +17,14 @@ use syntax::ast; /// Same as `unique_type_name()` but with the result pushed onto the given /// `output` parameter. pub struct DefPathBasedNames<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, omit_disambiguators: bool, omit_local_crate_name: bool, } impl DefPathBasedNames<'tcx> { pub fn new( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, omit_disambiguators: bool, omit_local_crate_name: bool, ) -> Self { diff --git a/src/librustc/ty/print/pretty.rs b/src/librustc/ty/print/pretty.rs index d688202381a5d..d55f1c8983610 100644 --- a/src/librustc/ty/print/pretty.rs +++ b/src/librustc/ty/print/pretty.rs @@ -934,7 +934,7 @@ pub trait PrettyPrinter<'gcx: 'tcx, 'tcx>: pub struct FmtPrinter<'a, 'gcx, 'tcx, F>(Box>); pub struct FmtPrinterData<'a, 'gcx, 'tcx, F> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, fmt: F, empty_path: bool, @@ -963,7 +963,7 @@ impl DerefMut for FmtPrinter<'_, '_, '_, F> { } impl FmtPrinter<'a, 'gcx, 'tcx, F> { - pub fn new(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, fmt: F, ns: Namespace) -> Self { + pub fn new(tcx: TyCtxt<'gcx, 'tcx>, fmt: F, ns: Namespace) -> Self { FmtPrinter(Box::new(FmtPrinterData { tcx, fmt, @@ -978,7 +978,7 @@ impl FmtPrinter<'a, 'gcx, 'tcx, F> { } } -impl TyCtxt<'_, '_, '_> { +impl TyCtxt<'_, '_> { // HACK(eddyb) get rid of `def_path_str` and/or pass `Namespace` explicitly always // (but also some things just print a `DefId` generally so maybe we need this?) fn guess_def_namespace(self, def_id: DefId) -> Namespace { @@ -1025,7 +1025,7 @@ impl Printer<'gcx, 'tcx> for FmtPrinter<'_, 'gcx, 'tcx, F> { type DynExistential = Self; type Const = Self; - fn tcx(&'a self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx(&'a self) -> TyCtxt<'gcx, 'tcx> { self.tcx } diff --git a/src/librustc/ty/query/config.rs b/src/librustc/ty/query/config.rs index d6b0951fd0311..c595d37989cb1 100644 --- a/src/librustc/ty/query/config.rs +++ b/src/librustc/ty/query/config.rs @@ -31,30 +31,30 @@ pub(crate) trait QueryAccessors<'tcx>: QueryConfig<'tcx> { fn query(key: Self::Key) -> Query<'tcx>; // Don't use this method to access query results, instead use the methods on TyCtxt - fn query_cache<'a>(tcx: TyCtxt<'a, 'tcx, '_>) -> &'a Lock>; + fn query_cache<'a>(tcx: TyCtxt<'tcx, '_>) -> &'a Lock>; - fn to_dep_node(tcx: TyCtxt<'_, 'tcx, '_>, key: &Self::Key) -> DepNode; + fn to_dep_node(tcx: TyCtxt<'tcx, '_>, key: &Self::Key) -> DepNode; // Don't use this method to compute query results, instead use the methods on TyCtxt - fn compute(tcx: TyCtxt<'_, 'tcx, '_>, key: Self::Key) -> Self::Value; + fn compute(tcx: TyCtxt<'tcx, '_>, key: Self::Key) -> Self::Value; fn hash_result( hcx: &mut StableHashingContext<'_>, result: &Self::Value ) -> Option; - fn handle_cycle_error(tcx: TyCtxt<'_, 'tcx, '_>, error: CycleError<'tcx>) -> Self::Value; + fn handle_cycle_error(tcx: TyCtxt<'tcx, '_>, error: CycleError<'tcx>) -> Self::Value; } pub(crate) trait QueryDescription<'tcx>: QueryAccessors<'tcx> { - fn describe(tcx: TyCtxt<'_, '_, '_>, key: Self::Key) -> Cow<'static, str>; + fn describe(tcx: TyCtxt<'_, '_>, key: Self::Key) -> Cow<'static, str>; #[inline] - fn cache_on_disk(_: TyCtxt<'tcx, 'tcx, 'tcx>, _: Self::Key) -> bool { + fn cache_on_disk(_: TyCtxt<'tcx, 'tcx>, _: Self::Key) -> bool { false } - fn try_load_from_disk(_: TyCtxt<'tcx, 'tcx, 'tcx>, + fn try_load_from_disk(_: TyCtxt<'tcx, 'tcx>, _: SerializedDepNodeIndex) -> Option { bug!("QueryDescription::load_from_disk() called for an unsupported query.") @@ -62,7 +62,7 @@ pub(crate) trait QueryDescription<'tcx>: QueryAccessors<'tcx> { } impl<'tcx, M: QueryAccessors<'tcx, Key=DefId>> QueryDescription<'tcx> for M { - default fn describe(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> Cow<'static, str> { + default fn describe(tcx: TyCtxt<'_, '_>, def_id: DefId) -> Cow<'static, str> { if !tcx.sess.verbose() { format!("processing `{}`", tcx.def_path_str(def_id)).into() } else { @@ -73,7 +73,7 @@ impl<'tcx, M: QueryAccessors<'tcx, Key=DefId>> QueryDescription<'tcx> for M { } impl<'tcx> QueryDescription<'tcx> for queries::analysis<'tcx> { - fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> { + fn describe(_tcx: TyCtxt<'_, '_>, _: CrateNum) -> Cow<'static, str> { "running analysis passes on this crate".into() } } @@ -82,12 +82,12 @@ macro_rules! impl_disk_cacheable_query( ($query_name:ident, |$tcx:tt, $key:tt| $cond:expr) => { impl<'tcx> QueryDescription<'tcx> for queries::$query_name<'tcx> { #[inline] - fn cache_on_disk($tcx: TyCtxt<'tcx, 'tcx, 'tcx>, $key: Self::Key) -> bool { + fn cache_on_disk($tcx: TyCtxt<'tcx, 'tcx>, $key: Self::Key) -> bool { $cond } #[inline] - fn try_load_from_disk(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + fn try_load_from_disk(tcx: TyCtxt<'tcx, 'tcx>, id: SerializedDepNodeIndex) -> Option { tcx.queries.on_disk_cache.try_load_query_result(tcx, id) diff --git a/src/librustc/ty/query/job.rs b/src/librustc/ty/query/job.rs index a595f22bfb323..f8fc2c1012586 100644 --- a/src/librustc/ty/query/job.rs +++ b/src/librustc/ty/query/job.rs @@ -77,7 +77,7 @@ impl<'tcx> QueryJob<'tcx> { #[cfg(parallel_compiler)] pub(super) fn r#await<'lcx>( &self, - tcx: TyCtxt<'lcx, 'tcx, 'lcx>, + tcx: TyCtxt<'tcx, 'lcx>, span: Span, ) -> Result<(), CycleError<'tcx>> { tls::with_related_context(tcx, move |icx| { @@ -102,7 +102,7 @@ impl<'tcx> QueryJob<'tcx> { #[cfg(not(parallel_compiler))] pub(super) fn find_cycle_in_stack<'lcx>( &self, - tcx: TyCtxt<'lcx, 'tcx, 'lcx>, + tcx: TyCtxt<'tcx, 'lcx>, span: Span, ) -> CycleError<'tcx> { // Get the current executing query (waiter) and find the waitee amongst its parents @@ -338,7 +338,7 @@ fn connected_to_root<'tcx>( // Deterministically pick an query from a list #[cfg(parallel_compiler)] fn pick_query<'a, 'tcx, T, F: Fn(&T) -> (Span, Lrc>)>( - tcx: TyCtxt<'_, 'tcx, '_>, + tcx: TyCtxt<'tcx, '_>, queries: &'a [T], f: F ) -> &'a T { @@ -366,7 +366,7 @@ fn pick_query<'a, 'tcx, T, F: Fn(&T) -> (Span, Lrc>)>( fn remove_cycle<'tcx>( jobs: &mut Vec>>, wakelist: &mut Vec>>, - tcx: TyCtxt<'_, 'tcx, '_> + tcx: TyCtxt<'tcx, '_> ) -> bool { let mut visited = FxHashSet::default(); let mut stack = Vec::new(); @@ -505,7 +505,7 @@ pub unsafe fn handle_deadlock() { /// There may be multiple cycles involved in a deadlock, so this searches /// all active queries for cycles before finally resuming all the waiters at once. #[cfg(parallel_compiler)] -fn deadlock(tcx: TyCtxt<'_, '_, '_>, registry: &rayon_core::Registry) { +fn deadlock(tcx: TyCtxt<'_, '_>, registry: &rayon_core::Registry) { let on_panic = OnDrop(|| { eprintln!("deadlock handler panicked, aborting process"); process::abort(); diff --git a/src/librustc/ty/query/keys.rs b/src/librustc/ty/query/keys.rs index 27b0e8e881df9..96a98b45f1f69 100644 --- a/src/librustc/ty/query/keys.rs +++ b/src/librustc/ty/query/keys.rs @@ -22,7 +22,7 @@ pub(super) trait Key: Clone + Hash + Eq + Debug { /// In the event that a cycle occurs, if no explicit span has been /// given for a query with key `self`, what span should we use? - fn default_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span; + fn default_span(&self, tcx: TyCtxt<'_, '_>) -> Span; } impl<'tcx> Key for ty::InstanceDef<'tcx> { @@ -30,7 +30,7 @@ impl<'tcx> Key for ty::InstanceDef<'tcx> { LOCAL_CRATE } - fn default_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span { + fn default_span(&self, tcx: TyCtxt<'_, '_>) -> Span { tcx.def_span(self.def_id()) } } @@ -40,7 +40,7 @@ impl<'tcx> Key for ty::Instance<'tcx> { LOCAL_CRATE } - fn default_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span { + fn default_span(&self, tcx: TyCtxt<'_, '_>) -> Span { tcx.def_span(self.def_id()) } } @@ -50,7 +50,7 @@ impl<'tcx> Key for mir::interpret::GlobalId<'tcx> { self.instance.query_crate() } - fn default_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span { + fn default_span(&self, tcx: TyCtxt<'_, '_>) -> Span { self.instance.default_span(tcx) } } @@ -59,7 +59,7 @@ impl Key for CrateNum { fn query_crate(&self) -> CrateNum { *self } - fn default_span(&self, _: TyCtxt<'_, '_, '_>) -> Span { + fn default_span(&self, _: TyCtxt<'_, '_>) -> Span { DUMMY_SP } } @@ -68,7 +68,7 @@ impl Key for DefIndex { fn query_crate(&self) -> CrateNum { LOCAL_CRATE } - fn default_span(&self, _tcx: TyCtxt<'_, '_, '_>) -> Span { + fn default_span(&self, _tcx: TyCtxt<'_, '_>) -> Span { DUMMY_SP } } @@ -77,7 +77,7 @@ impl Key for DefId { fn query_crate(&self) -> CrateNum { self.krate } - fn default_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span { + fn default_span(&self, tcx: TyCtxt<'_, '_>) -> Span { tcx.def_span(*self) } } @@ -86,7 +86,7 @@ impl Key for (DefId, DefId) { fn query_crate(&self) -> CrateNum { self.0.krate } - fn default_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span { + fn default_span(&self, tcx: TyCtxt<'_, '_>) -> Span { self.1.default_span(tcx) } } @@ -95,7 +95,7 @@ impl Key for (CrateNum, DefId) { fn query_crate(&self) -> CrateNum { self.0 } - fn default_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span { + fn default_span(&self, tcx: TyCtxt<'_, '_>) -> Span { self.1.default_span(tcx) } } @@ -104,7 +104,7 @@ impl Key for (DefId, SimplifiedType) { fn query_crate(&self) -> CrateNum { self.0.krate } - fn default_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span { + fn default_span(&self, tcx: TyCtxt<'_, '_>) -> Span { self.0.default_span(tcx) } } @@ -113,7 +113,7 @@ impl<'tcx> Key for (DefId, SubstsRef<'tcx>) { fn query_crate(&self) -> CrateNum { self.0.krate } - fn default_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span { + fn default_span(&self, tcx: TyCtxt<'_, '_>) -> Span { self.0.default_span(tcx) } } @@ -122,7 +122,7 @@ impl<'tcx> Key for (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>) { fn query_crate(&self) -> CrateNum { self.1.def_id().krate } - fn default_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span { + fn default_span(&self, tcx: TyCtxt<'_, '_>) -> Span { tcx.def_span(self.1.def_id()) } } @@ -131,7 +131,7 @@ impl<'tcx> Key for (&'tcx ty::Const<'tcx>, mir::Field) { fn query_crate(&self) -> CrateNum { LOCAL_CRATE } - fn default_span(&self, _: TyCtxt<'_, '_, '_>) -> Span { + fn default_span(&self, _: TyCtxt<'_, '_>) -> Span { DUMMY_SP } } @@ -140,7 +140,7 @@ impl<'tcx> Key for ty::PolyTraitRef<'tcx>{ fn query_crate(&self) -> CrateNum { self.def_id().krate } - fn default_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span { + fn default_span(&self, tcx: TyCtxt<'_, '_>) -> Span { tcx.def_span(self.def_id()) } } @@ -149,7 +149,7 @@ impl<'tcx> Key for ty::Const<'tcx> { fn query_crate(&self) -> CrateNum { LOCAL_CRATE } - fn default_span(&self, _: TyCtxt<'_, '_, '_>) -> Span { + fn default_span(&self, _: TyCtxt<'_, '_>) -> Span { DUMMY_SP } } @@ -158,7 +158,7 @@ impl<'tcx> Key for Ty<'tcx> { fn query_crate(&self) -> CrateNum { LOCAL_CRATE } - fn default_span(&self, _: TyCtxt<'_, '_, '_>) -> Span { + fn default_span(&self, _: TyCtxt<'_, '_>) -> Span { DUMMY_SP } } @@ -167,7 +167,7 @@ impl<'tcx> Key for ty::ParamEnv<'tcx> { fn query_crate(&self) -> CrateNum { LOCAL_CRATE } - fn default_span(&self, _: TyCtxt<'_, '_, '_>) -> Span { + fn default_span(&self, _: TyCtxt<'_, '_>) -> Span { DUMMY_SP } } @@ -176,7 +176,7 @@ impl<'tcx, T: Key> Key for ty::ParamEnvAnd<'tcx, T> { fn query_crate(&self) -> CrateNum { self.value.query_crate() } - fn default_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span { + fn default_span(&self, tcx: TyCtxt<'_, '_>) -> Span { self.value.default_span(tcx) } } @@ -185,7 +185,7 @@ impl<'tcx> Key for traits::Environment<'tcx> { fn query_crate(&self) -> CrateNum { LOCAL_CRATE } - fn default_span(&self, _: TyCtxt<'_, '_, '_>) -> Span { + fn default_span(&self, _: TyCtxt<'_, '_>) -> Span { DUMMY_SP } } @@ -194,7 +194,7 @@ impl Key for InternedString { fn query_crate(&self) -> CrateNum { LOCAL_CRATE } - fn default_span(&self, _tcx: TyCtxt<'_, '_, '_>) -> Span { + fn default_span(&self, _tcx: TyCtxt<'_, '_>) -> Span { DUMMY_SP } } @@ -209,7 +209,7 @@ where LOCAL_CRATE } - fn default_span(&self, _tcx: TyCtxt<'_, '_, '_>) -> Span { + fn default_span(&self, _tcx: TyCtxt<'_, '_>) -> Span { DUMMY_SP } } diff --git a/src/librustc/ty/query/on_disk_cache.rs b/src/librustc/ty/query/on_disk_cache.rs index 7f8ba215cea2c..71ea4ac772c31 100644 --- a/src/librustc/ty/query/on_disk_cache.rs +++ b/src/librustc/ty/query/on_disk_cache.rs @@ -157,7 +157,7 @@ impl<'sess> OnDiskCache<'sess> { } pub fn serialize<'tcx, E>(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, encoder: &mut E) -> Result<(), E::Error> where E: ty_codec::TyEncoder @@ -314,7 +314,7 @@ impl<'sess> OnDiskCache<'sess> { return Ok(()); - fn sorted_cnums_including_local_crate(tcx: TyCtxt<'_, '_, '_>) -> Vec { + fn sorted_cnums_including_local_crate(tcx: TyCtxt<'_, '_>) -> Vec { let mut cnums = vec![LOCAL_CRATE]; cnums.extend_from_slice(&tcx.crates()[..]); cnums.sort_unstable(); @@ -327,7 +327,7 @@ impl<'sess> OnDiskCache<'sess> { /// Loads a diagnostic emitted during the previous compilation session. pub fn load_diagnostics<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, dep_node_index: SerializedDepNodeIndex) -> Vec { let diagnostics: Option = self.load_indexed( @@ -355,7 +355,7 @@ impl<'sess> OnDiskCache<'sess> { /// Returns the cached query result if there is something in the cache for /// the given `SerializedDepNodeIndex`; otherwise returns `None`. pub fn try_load_query_result<'tcx, T>(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, dep_node_index: SerializedDepNodeIndex) -> Option where T: Decodable @@ -383,7 +383,7 @@ impl<'sess> OnDiskCache<'sess> { } fn load_indexed<'tcx, T>(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, dep_node_index: SerializedDepNodeIndex, index: &FxHashMap, @@ -423,7 +423,7 @@ impl<'sess> OnDiskCache<'sess> { // current-session-CrateNum. There might be CrateNums from the previous // Session that don't occur in the current one. For these, the mapping // maps to None. - fn compute_cnum_map(tcx: TyCtxt<'_, '_, '_>, + fn compute_cnum_map(tcx: TyCtxt<'_, '_>, prev_cnums: &[(u32, String, CrateDisambiguator)]) -> IndexVec> { @@ -458,7 +458,7 @@ impl<'sess> OnDiskCache<'sess> { /// we use for crate metadata decoding in that it can rebase spans and /// eventually will also handle things that contain `Ty` instances. struct CacheDecoder<'a, 'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, opaque: opaque::Decoder<'a>, source_map: &'a SourceMap, cnum_map: &'a IndexVec>, @@ -527,7 +527,7 @@ fn decode_tagged<'a, 'tcx, D, T, V>(decoder: &mut D, impl<'a, 'tcx> ty_codec::TyDecoder<'tcx> for CacheDecoder<'a, 'tcx> { #[inline] - fn tcx(&self) -> TyCtxt<'tcx, 'tcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'tcx, 'tcx> { self.tcx } @@ -745,7 +745,7 @@ for CacheDecoder<'a, 'tcx> { //- ENCODING ------------------------------------------------------------------- struct CacheEncoder<'a, 'tcx, E: ty_codec::TyEncoder> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, encoder: &'a mut E, type_shorthands: FxHashMap, usize>, predicate_shorthands: FxHashMap, usize>, @@ -1064,7 +1064,7 @@ impl<'a> SpecializedDecoder for opaque::Decoder<'a> { } } -fn encode_query_results<'a, 'tcx, Q, E>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn encode_query_results<'a, 'tcx, Q, E>(tcx: TyCtxt<'tcx, 'tcx>, encoder: &mut CacheEncoder<'a, 'tcx, E>, query_result_index: &mut EncodedQueryResultIndex) -> Result<(), E::Error> diff --git a/src/librustc/ty/query/plumbing.rs b/src/librustc/ty/query/plumbing.rs index e151f9d111cf7..639aa8e2c34b8 100644 --- a/src/librustc/ty/query/plumbing.rs +++ b/src/librustc/ty/query/plumbing.rs @@ -105,7 +105,7 @@ impl<'a, 'tcx, Q: QueryDescription<'tcx>> JobOwner<'a, 'tcx, Q> { /// for some compile-time benchmarks. #[inline(always)] pub(super) fn try_get( - tcx: TyCtxt<'a, 'tcx, '_>, + tcx: TyCtxt<'tcx, '_>, span: Span, key: &Q::Key, ) -> TryGetJob<'a, 'tcx, Q> { @@ -247,7 +247,7 @@ pub(super) enum TryGetJob<'a, 'tcx: 'a, D: QueryDescription<'tcx> + 'a> { Cycle(D::Value), } -impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> { /// Executes a job by changing the ImplicitCtxt to point to the /// new query job while it executes. It returns the diagnostics /// captured during execution and the actual result. @@ -259,7 +259,7 @@ impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { compute: F) -> R where - F: for<'lcx> FnOnce(TyCtxt<'lcx, 'gcx, 'lcx>) -> R + F: for<'lcx> FnOnce(TyCtxt<'gcx, 'lcx>) -> R { // The TyCtxt stored in TLS has the same global interner lifetime // as `self`, so we use `with_related_context` to relate the 'gcx lifetimes @@ -874,7 +874,7 @@ macro_rules! define_queries_inner { } } - pub fn describe(&self, tcx: TyCtxt<'_, '_, '_>) -> Cow<'static, str> { + pub fn describe(&self, tcx: TyCtxt<'_, '_>) -> Cow<'static, str> { let (r, name) = match *self { $(Query::$name(key) => { (queries::$name::describe(tcx, key), stringify!($name)) @@ -888,7 +888,7 @@ macro_rules! define_queries_inner { } // FIXME(eddyb) Get more valid Span's on queries. - pub fn default_span(&self, tcx: TyCtxt<'_, $tcx, '_>, span: Span) -> Span { + pub fn default_span(&self, tcx: TyCtxt<$tcx, '_>, span: Span) -> Span { if !span.is_dummy() { return span; } @@ -954,20 +954,20 @@ macro_rules! define_queries_inner { } #[inline(always)] - fn query_cache<'a>(tcx: TyCtxt<'a, $tcx, '_>) -> &'a Lock> { + fn query_cache<'a>(tcx: TyCtxt<$tcx, '_>) -> &'a Lock> { &tcx.queries.$name } #[allow(unused)] #[inline(always)] - fn to_dep_node(tcx: TyCtxt<'_, $tcx, '_>, key: &Self::Key) -> DepNode { + fn to_dep_node(tcx: TyCtxt<$tcx, '_>, key: &Self::Key) -> DepNode { use crate::dep_graph::DepConstructor::*; DepNode::new(tcx, $node(*key)) } #[inline] - fn compute(tcx: TyCtxt<'_, 'tcx, '_>, key: Self::Key) -> Self::Value { + fn compute(tcx: TyCtxt<'tcx, '_>, key: Self::Key) -> Self::Value { __query_compute::$name(move || { let provider = tcx.queries.providers.get(key.query_crate()) // HACK(eddyb) it's possible crates may be loaded after @@ -988,7 +988,7 @@ macro_rules! define_queries_inner { } fn handle_cycle_error( - tcx: TyCtxt<'_, 'tcx, '_>, + tcx: TyCtxt<'tcx, '_>, error: CycleError<'tcx> ) -> Self::Value { handle_cycle_error!([$($modifiers)*][tcx, error]) @@ -997,7 +997,7 @@ macro_rules! define_queries_inner { #[derive(Copy, Clone)] pub struct TyCtxtEnsure<'gcx, 'tcx> { - pub tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + pub tcx: TyCtxt<'gcx, 'tcx>, } impl TyCtxtEnsure<$tcx, 'lcx> { @@ -1010,19 +1010,19 @@ macro_rules! define_queries_inner { #[derive(Copy, Clone)] pub struct TyCtxtAt<'gcx, 'tcx> { - pub tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + pub tcx: TyCtxt<'gcx, 'tcx>, pub span: Span, } impl Deref for TyCtxtAt<'gcx, 'tcx> { - type Target = TyCtxt<'tcx, 'gcx, 'tcx>; + type Target = TyCtxt<'gcx, 'tcx>; #[inline(always)] fn deref(&self) -> &Self::Target { &self.tcx } } - impl TyCtxt<'lcx, $tcx, 'lcx> { + impl TyCtxt<$tcx, 'lcx> { /// Returns a transparent wrapper for `TyCtxt`, which ensures queries /// are executed instead of just returing their results. #[inline(always)] @@ -1090,12 +1090,12 @@ macro_rules! define_provider_struct { (tcx: $tcx:tt, input: ($(([$($modifiers:tt)*] [$name:ident] [$K:ty] [$R:ty]))*)) => { pub struct Providers<$tcx> { - $(pub $name: fn(TyCtxt<$tcx, $tcx, $tcx>, $K) -> $R,)* + $(pub $name: fn(TyCtxt<$tcx, $tcx>, $K) -> $R,)* } impl<$tcx> Default for Providers<$tcx> { fn default() -> Self { - $(fn $name<$tcx>(_: TyCtxt<$tcx, $tcx, $tcx>, key: $K) -> $R { + $(fn $name<$tcx>(_: TyCtxt<$tcx, $tcx>, key: $K) -> $R { bug!("tcx.{}({:?}) unsupported by its crate", stringify!($name), key); })* @@ -1149,7 +1149,7 @@ macro_rules! define_provider_struct { /// add it to the "We don't have enough information to reconstruct..." group in /// the match below. pub fn force_from_dep_node<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, dep_node: &DepNode ) -> bool { use crate::dep_graph::RecoverKey; @@ -1237,7 +1237,7 @@ macro_rules! impl_load_from_cache { impl DepNode { // Check whether the query invocation corresponding to the given // DepNode is eligible for on-disk-caching. - pub fn cache_on_disk(&self, tcx: TyCtxt<'_, '_, '_>) -> bool { + pub fn cache_on_disk(&self, tcx: TyCtxt<'_, '_>) -> bool { use crate::ty::query::queries; use crate::ty::query::QueryDescription; @@ -1255,7 +1255,7 @@ macro_rules! impl_load_from_cache { // above `cache_on_disk` methods returns true. // Also, as a sanity check, it expects that the corresponding query // invocation has been marked as green already. - pub fn load_from_on_disk_cache(&self, tcx: TyCtxt<'_, '_, '_>) { + pub fn load_from_on_disk_cache(&self, tcx: TyCtxt<'_, '_>) { match self.kind { $(DepKind::$dep_kind => { debug_assert!(tcx.dep_graph diff --git a/src/librustc/ty/query/values.rs b/src/librustc/ty/query/values.rs index 016d4792e11ce..5c6b2e172d3c3 100644 --- a/src/librustc/ty/query/values.rs +++ b/src/librustc/ty/query/values.rs @@ -4,36 +4,36 @@ use crate::ty::util::NeedsDrop; use syntax::symbol::InternedString; pub(super) trait Value<'tcx>: Sized { - fn from_cycle_error(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Self; + fn from_cycle_error(tcx: TyCtxt<'tcx, 'tcx>) -> Self; } impl<'tcx, T> Value<'tcx> for T { - default fn from_cycle_error(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> T { + default fn from_cycle_error(tcx: TyCtxt<'tcx, 'tcx>) -> T { tcx.sess.abort_if_errors(); bug!("Value::from_cycle_error called without errors"); } } impl<'tcx> Value<'tcx> for Ty<'tcx> { - fn from_cycle_error(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Ty<'tcx> { + fn from_cycle_error(tcx: TyCtxt<'tcx, 'tcx>) -> Ty<'tcx> { tcx.types.err } } impl<'tcx> Value<'tcx> for ty::SymbolName { - fn from_cycle_error(_: TyCtxt<'tcx, 'tcx, 'tcx>) -> Self { + fn from_cycle_error(_: TyCtxt<'tcx, 'tcx>) -> Self { ty::SymbolName { name: InternedString::intern("") } } } impl<'tcx> Value<'tcx> for NeedsDrop { - fn from_cycle_error(_: TyCtxt<'tcx, 'tcx, 'tcx>) -> Self { + fn from_cycle_error(_: TyCtxt<'tcx, 'tcx>) -> Self { NeedsDrop(false) } } impl<'tcx> Value<'tcx> for AdtSizedConstraint<'tcx> { - fn from_cycle_error(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Self { + fn from_cycle_error(tcx: TyCtxt<'tcx, 'tcx>) -> Self { AdtSizedConstraint(tcx.intern_type_list(&[tcx.types.err])) } } diff --git a/src/librustc/ty/relate.rs b/src/librustc/ty/relate.rs index 288e203902a14..247f3fea89d15 100644 --- a/src/librustc/ty/relate.rs +++ b/src/librustc/ty/relate.rs @@ -23,7 +23,7 @@ pub enum Cause { } pub trait TypeRelation<'gcx: 'tcx, 'tcx> : Sized { - fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx>; + fn tcx(&self) -> TyCtxt<'gcx, 'tcx>; /// Returns a static string we can use for printouts. fn tag(&self) -> &'static str; diff --git a/src/librustc/ty/structural_impls.rs b/src/librustc/ty/structural_impls.rs index 8b98bf22cf91a..a6584173fd280 100644 --- a/src/librustc/ty/structural_impls.rs +++ b/src/librustc/ty/structural_impls.rs @@ -337,14 +337,14 @@ CloneTypeFoldableAndLiftImpls! { // FIXME(eddyb) replace all the uses of `Option::map` with `?`. impl<'tcx, A: Lift<'tcx>, B: Lift<'tcx>> Lift<'tcx> for (A, B) { type Lifted = (A::Lifted, B::Lifted); - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { tcx.lift(&self.0).and_then(|a| tcx.lift(&self.1).map(|b| (a, b))) } } impl<'tcx, A: Lift<'tcx>, B: Lift<'tcx>, C: Lift<'tcx>> Lift<'tcx> for (A, B, C) { type Lifted = (A::Lifted, B::Lifted, C::Lifted); - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { tcx.lift(&self.0).and_then(|a| { tcx.lift(&self.1).and_then(|b| tcx.lift(&self.2).map(|c| (a, b, c))) }) @@ -353,7 +353,7 @@ impl<'tcx, A: Lift<'tcx>, B: Lift<'tcx>, C: Lift<'tcx>> Lift<'tcx> for (A, B, C) impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for Option { type Lifted = Option; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { match *self { Some(ref x) => tcx.lift(x).map(Some), None => Some(None) @@ -363,7 +363,7 @@ impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for Option { impl<'tcx, T: Lift<'tcx>, E: Lift<'tcx>> Lift<'tcx> for Result { type Lifted = Result; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { match *self { Ok(ref x) => tcx.lift(x).map(Ok), Err(ref e) => tcx.lift(e).map(Err) @@ -373,14 +373,14 @@ impl<'tcx, T: Lift<'tcx>, E: Lift<'tcx>> Lift<'tcx> for Result { impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for Box { type Lifted = Box; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { tcx.lift(&**self).map(Box::new) } } impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for [T] { type Lifted = Vec; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { // type annotation needed to inform `projection_must_outlive` let mut result : Vec<>::Lifted> = Vec::with_capacity(self.len()); @@ -397,14 +397,14 @@ impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for [T] { impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for Vec { type Lifted = Vec; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { tcx.lift(&self[..]) } } impl<'tcx, I: Idx, T: Lift<'tcx>> Lift<'tcx> for IndexVec { type Lifted = IndexVec; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { self.iter() .map(|e| tcx.lift(e)) .collect() @@ -413,7 +413,7 @@ impl<'tcx, I: Idx, T: Lift<'tcx>> Lift<'tcx> for IndexVec { impl<'a, 'tcx> Lift<'tcx> for ty::TraitRef<'a> { type Lifted = ty::TraitRef<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { tcx.lift(&self.substs).map(|substs| ty::TraitRef { def_id: self.def_id, substs, @@ -423,7 +423,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::TraitRef<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::ExistentialTraitRef<'a> { type Lifted = ty::ExistentialTraitRef<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { tcx.lift(&self.substs).map(|substs| ty::ExistentialTraitRef { def_id: self.def_id, substs, @@ -433,7 +433,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::ExistentialTraitRef<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::ExistentialPredicate<'a> { type Lifted = ty::ExistentialPredicate<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { match self { ty::ExistentialPredicate::Trait(x) => { tcx.lift(x).map(ty::ExistentialPredicate::Trait) @@ -450,7 +450,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::ExistentialPredicate<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::TraitPredicate<'a> { type Lifted = ty::TraitPredicate<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option> { tcx.lift(&self.trait_ref).map(|trait_ref| ty::TraitPredicate { trait_ref, @@ -460,7 +460,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::TraitPredicate<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::SubtypePredicate<'a> { type Lifted = ty::SubtypePredicate<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option> { tcx.lift(&(self.a, self.b)).map(|(a, b)| ty::SubtypePredicate { a_is_expected: self.a_is_expected, @@ -472,14 +472,14 @@ impl<'a, 'tcx> Lift<'tcx> for ty::SubtypePredicate<'a> { impl<'tcx, A: Copy+Lift<'tcx>, B: Copy+Lift<'tcx>> Lift<'tcx> for ty::OutlivesPredicate { type Lifted = ty::OutlivesPredicate; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { tcx.lift(&(self.0, self.1)).map(|(a, b)| ty::OutlivesPredicate(a, b)) } } impl<'a, 'tcx> Lift<'tcx> for ty::ProjectionTy<'a> { type Lifted = ty::ProjectionTy<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option> { tcx.lift(&self.substs).map(|substs| { ty::ProjectionTy { @@ -492,7 +492,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::ProjectionTy<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::ProjectionPredicate<'a> { type Lifted = ty::ProjectionPredicate<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option> { tcx.lift(&(self.projection_ty, self.ty)).map(|(projection_ty, ty)| { ty::ProjectionPredicate { @@ -505,7 +505,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::ProjectionPredicate<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::ExistentialProjection<'a> { type Lifted = ty::ExistentialProjection<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { tcx.lift(&self.substs).map(|substs| { ty::ExistentialProjection { substs, @@ -518,7 +518,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::ExistentialProjection<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::Predicate<'a> { type Lifted = ty::Predicate<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { match *self { ty::Predicate::Trait(ref binder) => { tcx.lift(binder).map(ty::Predicate::Trait) @@ -558,14 +558,14 @@ impl<'a, 'tcx> Lift<'tcx> for ty::Predicate<'a> { impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for ty::Binder { type Lifted = ty::Binder; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { tcx.lift(self.skip_binder()).map(ty::Binder::bind) } } impl<'a, 'tcx> Lift<'tcx> for ty::ParamEnv<'a> { type Lifted = ty::ParamEnv<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { tcx.lift(&self.caller_bounds).map(|caller_bounds| { ty::ParamEnv { reveal: self.reveal, @@ -578,7 +578,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::ParamEnv<'a> { impl<'a, 'tcx, T: Lift<'tcx>> Lift<'tcx> for ty::ParamEnvAnd<'a, T> { type Lifted = ty::ParamEnvAnd<'tcx, T::Lifted>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { tcx.lift(&self.param_env).and_then(|param_env| { tcx.lift(&self.value).map(|value| { ty::ParamEnvAnd { @@ -592,7 +592,7 @@ impl<'a, 'tcx, T: Lift<'tcx>> Lift<'tcx> for ty::ParamEnvAnd<'a, T> { impl<'a, 'tcx> Lift<'tcx> for ty::ClosureSubsts<'a> { type Lifted = ty::ClosureSubsts<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { tcx.lift(&self.substs).map(|substs| { ty::ClosureSubsts { substs } }) @@ -601,7 +601,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::ClosureSubsts<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::GeneratorSubsts<'a> { type Lifted = ty::GeneratorSubsts<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { tcx.lift(&self.substs).map(|substs| { ty::GeneratorSubsts { substs } }) @@ -610,7 +610,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::GeneratorSubsts<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::adjustment::Adjustment<'a> { type Lifted = ty::adjustment::Adjustment<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { tcx.lift(&self.kind).and_then(|kind| { tcx.lift(&self.target).map(|target| { ty::adjustment::Adjustment { kind, target } @@ -621,7 +621,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::adjustment::Adjustment<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::adjustment::Adjust<'a> { type Lifted = ty::adjustment::Adjust<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { match *self { ty::adjustment::Adjust::NeverToAny => Some(ty::adjustment::Adjust::NeverToAny), @@ -639,7 +639,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::adjustment::Adjust<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::adjustment::OverloadedDeref<'a> { type Lifted = ty::adjustment::OverloadedDeref<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { tcx.lift(&self.region).map(|region| { ty::adjustment::OverloadedDeref { region, @@ -651,7 +651,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::adjustment::OverloadedDeref<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::adjustment::AutoBorrow<'a> { type Lifted = ty::adjustment::AutoBorrow<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { match *self { ty::adjustment::AutoBorrow::Ref(r, m) => { tcx.lift(&r).map(|r| ty::adjustment::AutoBorrow::Ref(r, m)) @@ -665,7 +665,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::adjustment::AutoBorrow<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::GenSig<'a> { type Lifted = ty::GenSig<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { tcx.lift(&(self.yield_ty, self.return_ty)) .map(|(yield_ty, return_ty)| { ty::GenSig { @@ -678,7 +678,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::GenSig<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::FnSig<'a> { type Lifted = ty::FnSig<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { tcx.lift(&self.inputs_and_output).map(|x| { ty::FnSig { inputs_and_output: x, @@ -692,7 +692,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::FnSig<'a> { impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for ty::error::ExpectedFound { type Lifted = ty::error::ExpectedFound; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { tcx.lift(&self.expected).and_then(|expected| { tcx.lift(&self.found).map(|found| { ty::error::ExpectedFound { @@ -706,7 +706,7 @@ impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for ty::error::ExpectedFound { impl<'a, 'tcx> Lift<'tcx> for ty::error::TypeError<'a> { type Lifted = ty::error::TypeError<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { use crate::ty::error::TypeError::*; Some(match *self { @@ -743,7 +743,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::error::TypeError<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::InstanceDef<'a> { type Lifted = ty::InstanceDef<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { match *self { ty::InstanceDef::Item(def_id) => Some(ty::InstanceDef::Item(def_id)), diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs index 248d037fa5edc..5036408af39cc 100644 --- a/src/librustc/ty/sty.rs +++ b/src/librustc/ty/sty.rs @@ -324,7 +324,7 @@ impl<'tcx> ClosureSubsts<'tcx> { /// Divides the closure substs into their respective /// components. Single source of truth with respect to the /// ordering. - fn split(self, def_id: DefId, tcx: TyCtxt<'_, '_, '_>) -> SplitClosureSubsts<'tcx> { + fn split(self, def_id: DefId, tcx: TyCtxt<'_, '_>) -> SplitClosureSubsts<'tcx> { let generics = tcx.generics_of(def_id); let parent_len = generics.parent_count; SplitClosureSubsts { @@ -335,7 +335,7 @@ impl<'tcx> ClosureSubsts<'tcx> { } #[inline] - pub fn upvar_tys(self, def_id: DefId, tcx: TyCtxt<'_, '_, '_>) -> + pub fn upvar_tys(self, def_id: DefId, tcx: TyCtxt<'_, '_>) -> impl Iterator> + 'tcx { let SplitClosureSubsts { upvar_kinds, .. } = self.split(def_id, tcx); @@ -351,7 +351,7 @@ impl<'tcx> ClosureSubsts<'tcx> { /// Returns the closure kind for this closure; may return a type /// variable during inference. To get the closure kind during /// inference, use `infcx.closure_kind(def_id, substs)`. - pub fn closure_kind_ty(self, def_id: DefId, tcx: TyCtxt<'_, '_, '_>) -> Ty<'tcx> { + pub fn closure_kind_ty(self, def_id: DefId, tcx: TyCtxt<'_, '_>) -> Ty<'tcx> { self.split(def_id, tcx).closure_kind_ty } @@ -359,7 +359,7 @@ impl<'tcx> ClosureSubsts<'tcx> { /// closure; may contain type variables during inference. To get /// the closure signature during inference, use /// `infcx.fn_sig(def_id)`. - pub fn closure_sig_ty(self, def_id: DefId, tcx: TyCtxt<'_, '_, '_>) -> Ty<'tcx> { + pub fn closure_sig_ty(self, def_id: DefId, tcx: TyCtxt<'_, '_>) -> Ty<'tcx> { self.split(def_id, tcx).closure_sig_ty } @@ -368,7 +368,7 @@ impl<'tcx> ClosureSubsts<'tcx> { /// there are no type variables. /// /// If you have an inference context, use `infcx.closure_kind()`. - pub fn closure_kind(self, def_id: DefId, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> ty::ClosureKind { + pub fn closure_kind(self, def_id: DefId, tcx: TyCtxt<'tcx, 'tcx>) -> ty::ClosureKind { self.split(def_id, tcx).closure_kind_ty.to_opt_closure_kind().unwrap() } @@ -377,7 +377,7 @@ impl<'tcx> ClosureSubsts<'tcx> { /// there are no type variables. /// /// If you have an inference context, use `infcx.closure_sig()`. - pub fn closure_sig(self, def_id: DefId, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> ty::PolyFnSig<'tcx> { + pub fn closure_sig(self, def_id: DefId, tcx: TyCtxt<'tcx, 'tcx>) -> ty::PolyFnSig<'tcx> { let ty = self.closure_sig_ty(def_id, tcx); match ty.sty { ty::FnPtr(sig) => sig, @@ -401,7 +401,7 @@ struct SplitGeneratorSubsts<'tcx> { } impl<'tcx> GeneratorSubsts<'tcx> { - fn split(self, def_id: DefId, tcx: TyCtxt<'_, '_, '_>) -> SplitGeneratorSubsts<'tcx> { + fn split(self, def_id: DefId, tcx: TyCtxt<'_, '_>) -> SplitGeneratorSubsts<'tcx> { let generics = tcx.generics_of(def_id); let parent_len = generics.parent_count; SplitGeneratorSubsts { @@ -417,12 +417,12 @@ impl<'tcx> GeneratorSubsts<'tcx> { /// It contains a tuple of all the types that could end up on a generator frame. /// The state transformation MIR pass may only produce layouts which mention types /// in this tuple. Upvars are not counted here. - pub fn witness(self, def_id: DefId, tcx: TyCtxt<'_, '_, '_>) -> Ty<'tcx> { + pub fn witness(self, def_id: DefId, tcx: TyCtxt<'_, '_>) -> Ty<'tcx> { self.split(def_id, tcx).witness } #[inline] - pub fn upvar_tys(self, def_id: DefId, tcx: TyCtxt<'_, '_, '_>) -> + pub fn upvar_tys(self, def_id: DefId, tcx: TyCtxt<'_, '_>) -> impl Iterator> + 'tcx { let SplitGeneratorSubsts { upvar_kinds, .. } = self.split(def_id, tcx); @@ -436,12 +436,12 @@ impl<'tcx> GeneratorSubsts<'tcx> { } /// Returns the type representing the yield type of the generator. - pub fn yield_ty(self, def_id: DefId, tcx: TyCtxt<'_, '_, '_>) -> Ty<'tcx> { + pub fn yield_ty(self, def_id: DefId, tcx: TyCtxt<'_, '_>) -> Ty<'tcx> { self.split(def_id, tcx).yield_ty } /// Returns the type representing the return type of the generator. - pub fn return_ty(self, def_id: DefId, tcx: TyCtxt<'_, '_, '_>) -> Ty<'tcx> { + pub fn return_ty(self, def_id: DefId, tcx: TyCtxt<'_, '_>) -> Ty<'tcx> { self.split(def_id, tcx).return_ty } @@ -451,13 +451,13 @@ impl<'tcx> GeneratorSubsts<'tcx> { /// N.B., some bits of the code prefers to see this wrapped in a /// binder, but it never contains bound regions. Probably this /// function should be removed. - pub fn poly_sig(self, def_id: DefId, tcx: TyCtxt<'_, '_, '_>) -> PolyGenSig<'tcx> { + pub fn poly_sig(self, def_id: DefId, tcx: TyCtxt<'_, '_>) -> PolyGenSig<'tcx> { ty::Binder::dummy(self.sig(def_id, tcx)) } /// Returns the "generator signature", which consists of its yield /// and return types. - pub fn sig(self, def_id: DefId, tcx: TyCtxt<'_, '_, '_>) -> GenSig<'tcx> { + pub fn sig(self, def_id: DefId, tcx: TyCtxt<'_, '_>) -> GenSig<'tcx> { ty::GenSig { yield_ty: self.yield_ty(def_id, tcx), return_ty: self.return_ty(def_id, tcx), @@ -479,7 +479,7 @@ impl<'gcx, 'tcx> GeneratorSubsts<'tcx> { /// The valid variant indices of this Generator. #[inline] - pub fn variant_range(&self, def_id: DefId, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Range { + pub fn variant_range(&self, def_id: DefId, tcx: TyCtxt<'gcx, 'tcx>) -> Range { // FIXME requires optimized MIR let num_variants = tcx.generator_layout(def_id).variant_fields.len(); (VariantIdx::new(0)..VariantIdx::new(num_variants)) @@ -489,7 +489,7 @@ impl<'gcx, 'tcx> GeneratorSubsts<'tcx> { /// out of range. #[inline] pub fn discriminant_for_variant( - &self, def_id: DefId, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, variant_index: VariantIdx + &self, def_id: DefId, tcx: TyCtxt<'gcx, 'tcx>, variant_index: VariantIdx ) -> Discr<'tcx> { // Generators don't support explicit discriminant values, so they are // the same as the variant index. @@ -501,7 +501,7 @@ impl<'gcx, 'tcx> GeneratorSubsts<'tcx> { /// variant indices. #[inline] pub fn discriminants( - &'tcx self, def_id: DefId, tcx: TyCtxt<'tcx, 'gcx, 'tcx> + &'tcx self, def_id: DefId, tcx: TyCtxt<'gcx, 'tcx> ) -> impl Iterator)> + Captures<'gcx> { self.variant_range(def_id, tcx).map(move |index| { (index, Discr { val: index.as_usize() as u128, ty: self.discr_ty(tcx) }) @@ -522,7 +522,7 @@ impl<'gcx, 'tcx> GeneratorSubsts<'tcx> { /// The type of the state discriminant used in the generator type. #[inline] - pub fn discr_ty(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx> { + pub fn discr_ty(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Ty<'tcx> { tcx.types.u32 } @@ -533,7 +533,7 @@ impl<'gcx, 'tcx> GeneratorSubsts<'tcx> { /// The locals are grouped by their variant number. Note that some locals may /// be repeated in multiple variants. #[inline] - pub fn state_tys(self, def_id: DefId, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> + pub fn state_tys(self, def_id: DefId, tcx: TyCtxt<'gcx, 'tcx>) -> impl Iterator> + Captures<'gcx>> { let layout = tcx.generator_layout(def_id); @@ -547,7 +547,7 @@ impl<'gcx, 'tcx> GeneratorSubsts<'tcx> { /// This is the types of the fields of a generator which are not stored in a /// variant. #[inline] - pub fn prefix_tys(self, def_id: DefId, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> + pub fn prefix_tys(self, def_id: DefId, tcx: TyCtxt<'gcx, 'tcx>) -> impl Iterator> { self.upvar_tys(def_id, tcx) @@ -562,7 +562,7 @@ pub enum UpvarSubsts<'tcx> { impl<'tcx> UpvarSubsts<'tcx> { #[inline] - pub fn upvar_tys(self, def_id: DefId, tcx: TyCtxt<'_, '_, '_>) -> + pub fn upvar_tys(self, def_id: DefId, tcx: TyCtxt<'_, '_>) -> impl Iterator> + 'tcx { let upvar_kinds = match self { @@ -593,7 +593,7 @@ pub enum ExistentialPredicate<'tcx> { impl<'gcx, 'tcx> ExistentialPredicate<'tcx> { /// Compares via an ordering that will not change if modules are reordered or other changes are /// made to the tree. In particular, this ordering is preserved across incremental compilations. - pub fn stable_cmp(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, other: &Self) -> Ordering { + pub fn stable_cmp(&self, tcx: TyCtxt<'gcx, 'tcx>, other: &Self) -> Ordering { use self::ExistentialPredicate::*; match (*self, *other) { (Trait(_), Trait(_)) => Ordering::Equal, @@ -611,7 +611,7 @@ impl<'gcx, 'tcx> ExistentialPredicate<'tcx> { } impl<'gcx, 'tcx> Binder> { - pub fn with_self_ty(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, self_ty: Ty<'tcx>) + pub fn with_self_ty(&self, tcx: TyCtxt<'gcx, 'tcx>, self_ty: Ty<'tcx>) -> ty::Predicate<'tcx> { use crate::ty::ToPredicate; match *self.skip_binder() { @@ -744,7 +744,7 @@ impl<'tcx> TraitRef<'tcx> { /// Returns a `TraitRef` of the form `P0: Foo` where `Pi` /// are the parameters defined on trait. - pub fn identity<'gcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, def_id: DefId) -> TraitRef<'tcx> { + pub fn identity<'gcx>(tcx: TyCtxt<'gcx, 'tcx>, def_id: DefId) -> TraitRef<'tcx> { TraitRef { def_id, substs: InternalSubsts::identity_for_item(tcx, def_id), @@ -764,7 +764,7 @@ impl<'tcx> TraitRef<'tcx> { self.substs.types() } - pub fn from_method(tcx: TyCtxt<'tcx, '_, 'tcx>, + pub fn from_method(tcx: TyCtxt<'_, 'tcx>, trait_id: DefId, substs: SubstsRef<'tcx>) -> ty::TraitRef<'tcx> { @@ -817,7 +817,7 @@ impl<'gcx, 'tcx> ExistentialTraitRef<'tcx> { self.substs.types() } - pub fn erase_self_ty(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + pub fn erase_self_ty(tcx: TyCtxt<'gcx, 'tcx>, trait_ref: ty::TraitRef<'tcx>) -> ty::ExistentialTraitRef<'tcx> { // Assert there is a Self. @@ -833,7 +833,7 @@ impl<'gcx, 'tcx> ExistentialTraitRef<'tcx> { /// we convert the principal trait-ref into a normal trait-ref, /// you must give *some* self type. A common choice is `mk_err()` /// or some placeholder type. - pub fn with_self_ty(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, self_ty: Ty<'tcx>) + pub fn with_self_ty(&self, tcx: TyCtxt<'gcx, 'tcx>, self_ty: Ty<'tcx>) -> ty::TraitRef<'tcx> { // otherwise the escaping vars would be captured by the binder // debug_assert!(!self_ty.has_escaping_bound_vars()); @@ -856,7 +856,7 @@ impl<'tcx> PolyExistentialTraitRef<'tcx> { /// we convert the principal trait-ref into a normal trait-ref, /// you must give *some* self type. A common choice is `mk_err()` /// or some placeholder type. - pub fn with_self_ty(&self, tcx: TyCtxt<'tcx, '_, 'tcx>, + pub fn with_self_ty(&self, tcx: TyCtxt<'_, 'tcx>, self_ty: Ty<'tcx>) -> ty::PolyTraitRef<'tcx> { self.map_bound(|trait_ref| trait_ref.with_self_ty(tcx, self_ty)) @@ -992,7 +992,7 @@ impl<'tcx> ProjectionTy<'tcx> { /// Construct a `ProjectionTy` by searching the trait from `trait_ref` for the /// associated item named `item_name`. pub fn from_ref_and_name( - tcx: TyCtxt<'_, '_, '_>, trait_ref: ty::TraitRef<'tcx>, item_name: Ident + tcx: TyCtxt<'_, '_>, trait_ref: ty::TraitRef<'tcx>, item_name: Ident ) -> ProjectionTy<'tcx> { let item_def_id = tcx.associated_items(trait_ref.def_id).find(|item| { item.kind == ty::AssocKind::Type && @@ -1008,7 +1008,7 @@ impl<'tcx> ProjectionTy<'tcx> { /// Extracts the underlying trait reference from this projection. /// For example, if this is a projection of `::Item`, /// then this function would return a `T: Iterator` trait reference. - pub fn trait_ref(&self, tcx: TyCtxt<'_, '_, '_>) -> ty::TraitRef<'tcx> { + pub fn trait_ref(&self, tcx: TyCtxt<'_, '_>) -> ty::TraitRef<'tcx> { let def_id = tcx.associated_item(self.item_def_id).container.id(); ty::TraitRef { def_id, @@ -1125,7 +1125,7 @@ impl<'gcx, 'tcx> ParamTy { ParamTy::new(def.index, def.name) } - pub fn to_ty(self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx> { + pub fn to_ty(self, tcx: TyCtxt<'gcx, 'tcx>) -> Ty<'tcx> { tcx.mk_ty_param(self.index, self.name) } @@ -1153,7 +1153,7 @@ impl<'gcx, 'tcx> ParamConst { ParamConst::new(def.index, def.name) } - pub fn to_const(self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, ty: Ty<'tcx>) -> &'tcx Const<'tcx> { + pub fn to_const(self, tcx: TyCtxt<'gcx, 'tcx>, ty: Ty<'tcx>) -> &'tcx Const<'tcx> { tcx.mk_const_param(self.index, self.name, ty) } } @@ -1413,7 +1413,7 @@ impl<'tcx, 'gcx> ExistentialProjection<'tcx> { /// For example, if this is a projection of `exists T. ::Item == X`, /// then this function would return a `exists T. T: Iterator` existential trait /// reference. - pub fn trait_ref(&self, tcx: TyCtxt<'_, '_, '_>) -> ty::ExistentialTraitRef<'tcx> { + pub fn trait_ref(&self, tcx: TyCtxt<'_, '_>) -> ty::ExistentialTraitRef<'tcx> { let def_id = tcx.associated_item(self.item_def_id).container.id(); ty::ExistentialTraitRef{ def_id, @@ -1421,7 +1421,7 @@ impl<'tcx, 'gcx> ExistentialProjection<'tcx> { } } - pub fn with_self_ty(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + pub fn with_self_ty(&self, tcx: TyCtxt<'gcx, 'tcx>, self_ty: Ty<'tcx>) -> ty::ProjectionPredicate<'tcx> { @@ -1439,7 +1439,7 @@ impl<'tcx, 'gcx> ExistentialProjection<'tcx> { } impl<'tcx, 'gcx> PolyExistentialProjection<'tcx> { - pub fn with_self_ty(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, self_ty: Ty<'tcx>) + pub fn with_self_ty(&self, tcx: TyCtxt<'gcx, 'tcx>, self_ty: Ty<'tcx>) -> ty::PolyProjectionPredicate<'tcx> { self.map_bound(|p| p.with_self_ty(tcx, self_ty)) } @@ -1652,7 +1652,7 @@ impl RegionKind { /// of the impl, and for all the other highlighted regions, it /// would return the `DefId` of the function. In other cases (not shown), this /// function might return the `DefId` of a closure. - pub fn free_region_binding_scope(&self, tcx: TyCtxt<'_, '_, '_>) -> DefId { + pub fn free_region_binding_scope(&self, tcx: TyCtxt<'_, '_>) -> DefId { match self { ty::ReEarlyBound(br) => { tcx.parent(br.def_id).unwrap() @@ -1687,7 +1687,7 @@ impl<'gcx, 'tcx> TyS<'tcx> { /// `ty.conservative_is_privately_uninhabited` implies that any value of type `ty` /// will be `Abi::Uninhabited`. (Note that uninhabited types may have nonzero /// size, to account for partial initialisation. See #49298 for details.) - pub fn conservative_is_privately_uninhabited(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> bool { + pub fn conservative_is_privately_uninhabited(&self, tcx: TyCtxt<'gcx, 'tcx>) -> bool { // FIXME(varkor): we can make this less conversative by substituting concrete // type arguments. match self.sty { @@ -1799,7 +1799,7 @@ impl<'gcx, 'tcx> TyS<'tcx> { } } - pub fn sequence_element_type(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx> { + pub fn sequence_element_type(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Ty<'tcx> { match self.sty { Array(ty, _) | Slice(ty) => ty, Str => tcx.mk_mach_uint(ast::UintTy::U8), @@ -1807,7 +1807,7 @@ impl<'gcx, 'tcx> TyS<'tcx> { } } - pub fn simd_type(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx> { + pub fn simd_type(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Ty<'tcx> { match self.sty { Adt(def, substs) => { def.non_enum_variant().fields[0].ty(tcx, substs) @@ -1816,7 +1816,7 @@ impl<'gcx, 'tcx> TyS<'tcx> { } } - pub fn simd_size(&self, _cx: TyCtxt<'_, '_, '_>) -> usize { + pub fn simd_size(&self, _cx: TyCtxt<'_, '_>) -> usize { match self.sty { Adt(def, _) => def.non_enum_variant().fields.len(), _ => bug!("simd_size called on invalid type") @@ -2036,7 +2036,7 @@ impl<'gcx, 'tcx> TyS<'tcx> { } } - pub fn fn_sig(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> PolyFnSig<'tcx> { + pub fn fn_sig(&self, tcx: TyCtxt<'gcx, 'tcx>) -> PolyFnSig<'tcx> { match self.sty { FnDef(def_id, substs) => { tcx.fn_sig(def_id).subst(tcx, substs) @@ -2084,7 +2084,7 @@ impl<'gcx, 'tcx> TyS<'tcx> { /// If the type contains variants, returns the valid range of variant indices. /// FIXME This requires the optimized MIR in the case of generators. #[inline] - pub fn variant_range(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option> { + pub fn variant_range(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option> { match self.sty { TyKind::Adt(adt, _) => Some(adt.variant_range()), TyKind::Generator(def_id, substs, _) => Some(substs.variant_range(def_id, tcx)), @@ -2098,7 +2098,7 @@ impl<'gcx, 'tcx> TyS<'tcx> { #[inline] pub fn discriminant_for_variant( &self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, variant_index: VariantIdx ) -> Option> { match self.sty { @@ -2189,7 +2189,7 @@ impl<'gcx, 'tcx> TyS<'tcx> { /// /// Returning true means the type is known to be sized. Returning /// `false` means nothing -- could be sized, might not be. - pub fn is_trivially_sized(&self, tcx: TyCtxt<'tcx, '_, 'tcx>) -> bool { + pub fn is_trivially_sized(&self, tcx: TyCtxt<'_, 'tcx>) -> bool { match self.sty { ty::Infer(ty::IntVar(_)) | ty::Infer(ty::FloatVar(_)) | ty::Uint(_) | ty::Int(_) | ty::Bool | ty::Float(_) | @@ -2240,7 +2240,7 @@ static_assert_size!(Const<'_>, 40); impl<'tcx> Const<'tcx> { #[inline] pub fn from_scalar( - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, val: Scalar, ty: Ty<'tcx>, ) -> &'tcx Self { @@ -2252,7 +2252,7 @@ impl<'tcx> Const<'tcx> { #[inline] pub fn from_bits( - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, bits: u128, ty: ParamEnvAnd<'tcx, Ty<'tcx>>, ) -> &'tcx Self { @@ -2264,24 +2264,24 @@ impl<'tcx> Const<'tcx> { } #[inline] - pub fn zero_sized(tcx: TyCtxt<'tcx, '_, 'tcx>, ty: Ty<'tcx>) -> &'tcx Self { + pub fn zero_sized(tcx: TyCtxt<'_, 'tcx>, ty: Ty<'tcx>) -> &'tcx Self { Self::from_scalar(tcx, Scalar::zst(), ty) } #[inline] - pub fn from_bool(tcx: TyCtxt<'tcx, '_, 'tcx>, v: bool) -> &'tcx Self { + pub fn from_bool(tcx: TyCtxt<'_, 'tcx>, v: bool) -> &'tcx Self { Self::from_bits(tcx, v as u128, ParamEnv::empty().and(tcx.types.bool)) } #[inline] - pub fn from_usize(tcx: TyCtxt<'tcx, '_, 'tcx>, n: u64) -> &'tcx Self { + pub fn from_usize(tcx: TyCtxt<'_, 'tcx>, n: u64) -> &'tcx Self { Self::from_bits(tcx, n as u128, ParamEnv::empty().and(tcx.types.usize)) } #[inline] pub fn to_bits( &self, - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, ty: ParamEnvAnd<'tcx, Ty<'tcx>>, ) -> Option { if self.ty != ty.value { @@ -2300,7 +2300,7 @@ impl<'tcx> Const<'tcx> { #[inline] pub fn assert_bits( &self, - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, ty: ParamEnvAnd<'tcx, Ty<'tcx>>, ) -> Option { assert_eq!(self.ty, ty.value); @@ -2310,7 +2310,7 @@ impl<'tcx> Const<'tcx> { } #[inline] - pub fn assert_bool(&self, tcx: TyCtxt<'_, '_, '_>) -> Option { + pub fn assert_bool(&self, tcx: TyCtxt<'_, '_>) -> Option { self.assert_bits(tcx, ParamEnv::empty().and(tcx.types.bool)).and_then(|v| match v { 0 => Some(false), 1 => Some(true), @@ -2319,14 +2319,14 @@ impl<'tcx> Const<'tcx> { } #[inline] - pub fn assert_usize(&self, tcx: TyCtxt<'_, '_, '_>) -> Option { + pub fn assert_usize(&self, tcx: TyCtxt<'_, '_>) -> Option { self.assert_bits(tcx, ParamEnv::empty().and(tcx.types.usize)).map(|v| v as u64) } #[inline] pub fn unwrap_bits( &self, - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, ty: ParamEnvAnd<'tcx, Ty<'tcx>>, ) -> u128 { self.assert_bits(tcx, ty).unwrap_or_else(|| @@ -2334,7 +2334,7 @@ impl<'tcx> Const<'tcx> { } #[inline] - pub fn unwrap_usize(&self, tcx: TyCtxt<'_, '_, '_>) -> u64 { + pub fn unwrap_usize(&self, tcx: TyCtxt<'_, '_>) -> u64 { self.assert_usize(tcx).unwrap_or_else(|| bug!("expected constant usize, got {:#?}", self)) } diff --git a/src/librustc/ty/subst.rs b/src/librustc/ty/subst.rs index 276a2592ac7af..60579bcf3a5b4 100644 --- a/src/librustc/ty/subst.rs +++ b/src/librustc/ty/subst.rs @@ -138,7 +138,7 @@ impl<'tcx> Kind<'tcx> { impl<'a, 'tcx> Lift<'tcx> for Kind<'a> { type Lifted = Kind<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { match self.unpack() { UnpackedKind::Lifetime(lt) => tcx.lift(<).map(|lt| lt.into()), UnpackedKind::Type(ty) => tcx.lift(&ty).map(|ty| ty.into()), @@ -184,7 +184,7 @@ pub type SubstsRef<'tcx> = &'tcx InternalSubsts<'tcx>; impl<'a, 'gcx, 'tcx> InternalSubsts<'tcx> { /// Creates a `InternalSubsts` that maps each generic parameter to itself. - pub fn identity_for_item(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, def_id: DefId) -> SubstsRef<'tcx> { + pub fn identity_for_item(tcx: TyCtxt<'gcx, 'tcx>, def_id: DefId) -> SubstsRef<'tcx> { Self::for_item(tcx, def_id, |param, _| { tcx.mk_param_from_def(param) }) @@ -195,7 +195,7 @@ impl<'a, 'gcx, 'tcx> InternalSubsts<'tcx> { /// the type parameter index. For regions, we use the `BoundRegion::BrNamed` /// variant (which has a `DefId`). pub fn bound_vars_for_item( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, def_id: DefId ) -> SubstsRef<'tcx> { Self::for_item(tcx, def_id, |param, _| { @@ -233,7 +233,7 @@ impl<'a, 'gcx, 'tcx> InternalSubsts<'tcx> { /// The closures get to observe the `InternalSubsts` as they're /// being built, which can be used to correctly /// substitute defaults of generic parameters. - pub fn for_item(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + pub fn for_item(tcx: TyCtxt<'gcx, 'tcx>, def_id: DefId, mut mk_kind: F) -> SubstsRef<'tcx> @@ -247,7 +247,7 @@ impl<'a, 'gcx, 'tcx> InternalSubsts<'tcx> { } pub fn extend_to(&self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, def_id: DefId, mut mk_kind: F) -> SubstsRef<'tcx> @@ -261,7 +261,7 @@ impl<'a, 'gcx, 'tcx> InternalSubsts<'tcx> { } fn fill_item(substs: &mut SmallVec<[Kind<'tcx>; 8]>, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, defs: &ty::Generics, mk_kind: &mut F) where F: FnMut(&ty::GenericParamDef, &[Kind<'tcx>]) -> Kind<'tcx> @@ -372,7 +372,7 @@ impl<'a, 'gcx, 'tcx> InternalSubsts<'tcx> { /// in a different item, with `target_substs` as the base for /// the target impl/trait, with the source child-specific /// parameters (e.g., method parameters) on top of that base. - pub fn rebase_onto(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + pub fn rebase_onto(&self, tcx: TyCtxt<'gcx, 'tcx>, source_ancestor: DefId, target_substs: SubstsRef<'tcx>) -> SubstsRef<'tcx> { @@ -380,7 +380,7 @@ impl<'a, 'gcx, 'tcx> InternalSubsts<'tcx> { tcx.mk_substs(target_substs.iter().chain(&self[defs.params.len()..]).cloned()) } - pub fn truncate_to(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, generics: &ty::Generics) + pub fn truncate_to(&self, tcx: TyCtxt<'gcx, 'tcx>, generics: &ty::Generics) -> SubstsRef<'tcx> { tcx.mk_substs(self.iter().take(generics.count()).cloned()) } @@ -414,19 +414,19 @@ impl<'tcx> serialize::UseSpecializedDecodable for SubstsRef<'tcx> {} // there is more information available (for better errors). pub trait Subst<'tcx>: Sized { - fn subst<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + fn subst<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>, substs: &[Kind<'tcx>]) -> Self { self.subst_spanned(tcx, substs, None) } - fn subst_spanned<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + fn subst_spanned<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>, substs: &[Kind<'tcx>], span: Option) -> Self; } impl<'tcx, T:TypeFoldable<'tcx>> Subst<'tcx> for T { - fn subst_spanned<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + fn subst_spanned<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>, substs: &[Kind<'tcx>], span: Option) -> T @@ -445,7 +445,7 @@ impl<'tcx, T:TypeFoldable<'tcx>> Subst<'tcx> for T { // The actual substitution engine itself is a type folder. struct SubstFolder<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, substs: &'a [Kind<'tcx>], /// The location for which the substitution is performed, if available. @@ -462,7 +462,7 @@ struct SubstFolder<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { } impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for SubstFolder<'a, 'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.tcx } + fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> { self.tcx } fn fold_binder>(&mut self, t: &ty::Binder) -> ty::Binder { self.binders_passed += 1; diff --git a/src/librustc/ty/trait_def.rs b/src/librustc/ty/trait_def.rs index b7a4199067224..9c82082f8f5c7 100644 --- a/src/librustc/ty/trait_def.rs +++ b/src/librustc/ty/trait_def.rs @@ -64,14 +64,14 @@ impl<'gcx, 'tcx> TraitDef { } } - pub fn ancestors(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + pub fn ancestors(&self, tcx: TyCtxt<'gcx, 'tcx>, of_impl: DefId) -> specialization_graph::Ancestors<'gcx> { specialization_graph::ancestors(tcx, self.def_id, of_impl) } } -impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> { pub fn for_each_impl(self, def_id: DefId, mut f: F) { let impls = self.trait_impls_of(def_id); @@ -148,7 +148,7 @@ impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { } // Query provider for `trait_impls_of`. -pub(super) fn trait_impls_of_provider<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub(super) fn trait_impls_of_provider<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, trait_id: DefId) -> &'tcx TraitImpls { let mut impls = TraitImpls::default(); diff --git a/src/librustc/ty/util.rs b/src/librustc/ty/util.rs index a9b2dbe1d95b0..a88b3eaa586a3 100644 --- a/src/librustc/ty/util.rs +++ b/src/librustc/ty/util.rs @@ -51,10 +51,10 @@ impl<'tcx> fmt::Display for Discr<'tcx> { impl<'tcx> Discr<'tcx> { /// Adds `1` to the value and wraps around if the maximum for the type is reached. - pub fn wrap_incr<'gcx>(self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Self { + pub fn wrap_incr<'gcx>(self, tcx: TyCtxt<'gcx, 'tcx>) -> Self { self.checked_add(tcx, 1).0 } - pub fn checked_add<'gcx>(self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, n: u128) -> (Self, bool) { + pub fn checked_add<'gcx>(self, tcx: TyCtxt<'gcx, 'tcx>, n: u128) -> (Self, bool) { let (int, signed) = match self.ty.sty { Int(ity) => (Integer::from_attr(&tcx, SignedInt(ity)), true), Uint(uty) => (Integer::from_attr(&tcx, UnsignedInt(uty)), false), @@ -104,14 +104,14 @@ impl<'tcx> Discr<'tcx> { } pub trait IntTypeExt { - fn to_ty<'gcx, 'tcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx>; - fn disr_incr<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, val: Option>) + fn to_ty<'gcx, 'tcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Ty<'tcx>; + fn disr_incr<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx>, val: Option>) -> Option>; - fn initial_discriminant<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Discr<'tcx>; + fn initial_discriminant<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx>) -> Discr<'tcx>; } impl IntTypeExt for attr::IntType { - fn to_ty<'gcx, 'tcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx> { + fn to_ty<'gcx, 'tcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Ty<'tcx> { match *self { SignedInt(ast::IntTy::I8) => tcx.types.i8, SignedInt(ast::IntTy::I16) => tcx.types.i16, @@ -128,7 +128,7 @@ impl IntTypeExt for attr::IntType { } } - fn initial_discriminant<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Discr<'tcx> { + fn initial_discriminant<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx>) -> Discr<'tcx> { Discr { val: 0, ty: self.to_ty(tcx) @@ -137,7 +137,7 @@ impl IntTypeExt for attr::IntType { fn disr_incr<'tcx>( &self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, val: Option>, ) -> Option> { if let Some(val) = val { @@ -179,7 +179,7 @@ pub enum Representability { impl<'tcx> ty::ParamEnv<'tcx> { pub fn can_type_implement_copy(self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, self_type: Ty<'tcx>) -> Result<(), CopyImplementationError<'tcx>> { // FIXME: (@jroesch) float this code up @@ -228,7 +228,7 @@ impl<'tcx> ty::ParamEnv<'tcx> { } } -impl<'tcx> TyCtxt<'tcx, 'tcx, 'tcx> { +impl<'tcx> TyCtxt<'tcx, 'tcx> { /// Creates a hash of the type `Ty` which will be the same no matter what crate /// context it's calculated within. This is used by the `type_id` intrinsic. pub fn type_id_hash(self, ty: Ty<'tcx>) -> u64 { @@ -249,7 +249,7 @@ impl<'tcx> TyCtxt<'tcx, 'tcx, 'tcx> { } } -impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> { pub fn has_error_field(self, ty: Ty<'tcx>) -> bool { if let ty::Adt(def, substs) = ty.sty { for field in def.all_fields() { @@ -632,7 +632,7 @@ impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { seen_opaque_tys: FxHashSet, primary_def_id: DefId, found_recursion: bool, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, } impl<'gcx, 'tcx> OpaqueTypeExpander<'gcx, 'tcx> { @@ -659,7 +659,7 @@ impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { } impl<'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for OpaqueTypeExpander<'gcx, 'tcx> { - fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.tcx } @@ -696,7 +696,7 @@ impl<'tcx> ty::TyS<'tcx> { /// full requirements for the `Copy` trait (cc #29149) -- this /// winds up being reported as an error during NLL borrow check. pub fn is_copy_modulo_regions(&'tcx self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, span: Span) -> bool { @@ -724,7 +724,7 @@ impl<'tcx> ty::TyS<'tcx> { /// that the `Freeze` trait is not exposed to end users and is /// effectively an implementation detail. pub fn is_freeze(&'tcx self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, span: Span)-> bool { @@ -739,7 +739,7 @@ impl<'tcx> ty::TyS<'tcx> { /// then `needs_drop` will definitely return `true` for `ty`.) #[inline] pub fn needs_drop(&'tcx self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>) -> bool { tcx.needs_drop_raw(param_env.and(self)).0 @@ -761,7 +761,7 @@ impl<'tcx> ty::TyS<'tcx> { /// Check whether a type is representable. This means it cannot contain unboxed /// structural recursion. This check is needed for structs and enums. pub fn is_representable(&'tcx self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, sp: Span) -> Representability { @@ -779,7 +779,7 @@ impl<'tcx> ty::TyS<'tcx> { } fn are_inner_types_recursive<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, sp: Span, + tcx: TyCtxt<'tcx, 'tcx>, sp: Span, seen: &mut Vec>, representable_cache: &mut FxHashMap, Representability>, ty: Ty<'tcx>) @@ -839,7 +839,7 @@ impl<'tcx> ty::TyS<'tcx> { // Does the type `ty` directly (without indirection through a pointer) // contain any types on stack `seen`? fn is_type_structurally_recursive<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, sp: Span, seen: &mut Vec>, representable_cache: &mut FxHashMap, Representability>, @@ -860,7 +860,7 @@ impl<'tcx> ty::TyS<'tcx> { } fn is_type_structurally_recursive_inner<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, sp: Span, seen: &mut Vec>, representable_cache: &mut FxHashMap, Representability>, @@ -937,7 +937,7 @@ impl<'tcx> ty::TyS<'tcx> { } } -fn is_copy_raw<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn is_copy_raw<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, query: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool { @@ -953,7 +953,7 @@ fn is_copy_raw<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, )) } -fn is_sized_raw<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn is_sized_raw<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, query: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool { @@ -969,7 +969,7 @@ fn is_sized_raw<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, )) } -fn is_freeze_raw<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn is_freeze_raw<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, query: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool { @@ -988,7 +988,7 @@ fn is_freeze_raw<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, #[derive(Clone, HashStable)] pub struct NeedsDrop(pub bool); -fn needs_drop_raw<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn needs_drop_raw<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, query: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> NeedsDrop { diff --git a/src/librustc/ty/wf.rs b/src/librustc/ty/wf.rs index 3bd0ddce5d271..f0378b2e084df 100644 --- a/src/librustc/ty/wf.rs +++ b/src/librustc/ty/wf.rs @@ -509,7 +509,7 @@ impl<'a, 'gcx, 'tcx> WfPredicates<'a, 'gcx, 'tcx> { /// `'static` would appear in the list. The hard work is done by /// `ty::required_region_bounds`, see that for more information. pub fn object_region_bounds<'gcx, 'tcx>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, existential_predicates: ty::Binder<&'tcx ty::List>>) -> Vec> { diff --git a/src/librustc_borrowck/borrowck/check_loans.rs b/src/librustc_borrowck/borrowck/check_loans.rs index d76178d7eac68..94219650a8e82 100644 --- a/src/librustc_borrowck/borrowck/check_loans.rs +++ b/src/librustc_borrowck/borrowck/check_loans.rs @@ -229,7 +229,7 @@ fn compatible_borrow_kinds(borrow_kind1: ty::BorrowKind, } impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> { - pub fn tcx(&self) -> TyCtxt<'tcx, 'tcx, 'tcx> { self.bccx.tcx } + pub fn tcx(&self) -> TyCtxt<'tcx, 'tcx> { self.bccx.tcx } pub fn each_issued_loan(&self, node: hir::ItemLocalId, mut op: F) -> bool where F: FnMut(&Loan<'tcx>) -> bool, diff --git a/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs b/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs index 6d79a08608928..7a8a62edea1a3 100644 --- a/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs +++ b/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs @@ -45,7 +45,7 @@ pub enum PatternSource<'tcx> { /// /// In this latter case, this function will return `PatternSource::LetDecl` /// with a reference to the let -fn get_pattern_source<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, pat: &Pat) -> PatternSource<'tcx> { +fn get_pattern_source<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, pat: &Pat) -> PatternSource<'tcx> { let parent = tcx.hir().get_parent_node_by_hir_id(pat.hir_id); diff --git a/src/librustc_borrowck/borrowck/gather_loans/mod.rs b/src/librustc_borrowck/borrowck/gather_loans/mod.rs index 08b8894ac89e4..8bdfa1352cbe0 100644 --- a/src/librustc_borrowck/borrowck/gather_loans/mod.rs +++ b/src/librustc_borrowck/borrowck/gather_loans/mod.rs @@ -251,7 +251,7 @@ fn check_mutability<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, } impl<'a, 'tcx> GatherLoanCtxt<'a, 'tcx> { - pub fn tcx(&self) -> TyCtxt<'tcx, 'tcx, 'tcx> { self.bccx.tcx } + pub fn tcx(&self) -> TyCtxt<'tcx, 'tcx> { self.bccx.tcx } /// Guarantees that `cmt` is assignable, or reports an error. fn guarantee_assignment_valid(&mut self, diff --git a/src/librustc_borrowck/borrowck/mod.rs b/src/librustc_borrowck/borrowck/mod.rs index 00626c2f2b91c..aa94e100f334f 100644 --- a/src/librustc_borrowck/borrowck/mod.rs +++ b/src/librustc_borrowck/borrowck/mod.rs @@ -53,7 +53,7 @@ pub struct LoanDataFlowOperator; pub type LoanDataFlow<'tcx> = DataFlowContext<'tcx, LoanDataFlowOperator>; -pub fn check_crate<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn check_crate<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) { tcx.par_body_owners(|body_owner_def_id| { tcx.ensure().borrowck(body_owner_def_id); }); @@ -73,7 +73,7 @@ pub struct AnalysisData<'tcx> { pub move_data: move_data::FlowedMoveData<'tcx>, } -fn borrowck<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, owner_def_id: DefId) +fn borrowck<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, owner_def_id: DefId) -> &'tcx BorrowCheckResult { assert!(tcx.use_ast_borrowck() || tcx.migrate_borrowck()); @@ -193,7 +193,7 @@ fn build_borrowck_dataflow_data<'a, 'c, 'tcx, F>(this: &mut BorrowckCtxt<'a, 'tc /// Accessor for introspective clients inspecting `AnalysisData` and /// the `BorrowckCtxt` itself , e.g., the flowgraph visualizer. pub fn build_borrowck_dataflow_data_for_fn<'a, 'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, body_id: hir::BodyId, cfg: &cfg::CFG) -> (BorrowckCtxt<'a, 'tcx>, AnalysisData<'tcx>) @@ -221,7 +221,7 @@ pub fn build_borrowck_dataflow_data_for_fn<'a, 'tcx>( // Type definitions pub struct BorrowckCtxt<'a, 'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, // tables for the current thing we are checking; set to // Some in `borrowck_fn` and cleared later @@ -391,7 +391,7 @@ pub enum LoanPathElem<'tcx> { } fn closure_to_block(closure_id: LocalDefId, - tcx: TyCtxt<'_, '_, '_>) -> HirId { + tcx: TyCtxt<'_, '_>) -> HirId { let closure_id = tcx.hir().local_def_id_to_node_id(closure_id); match tcx.hir().get(closure_id) { Node::Expr(expr) => match expr.node { diff --git a/src/librustc_borrowck/borrowck/move_data.rs b/src/librustc_borrowck/borrowck/move_data.rs index 2dbc02253992c..81d5a49a805c9 100644 --- a/src/librustc_borrowck/borrowck/move_data.rs +++ b/src/librustc_borrowck/borrowck/move_data.rs @@ -223,7 +223,7 @@ impl MoveData<'tcx> { /// Returns the existing move path index for `lp`, if any, and otherwise adds a new index for /// `lp` and any of its base paths that do not yet have an index. - pub fn move_path(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + pub fn move_path(&self, tcx: TyCtxt<'tcx, 'tcx>, lp: Rc>) -> MovePathIndex { if let Some(&index) = self.path_map.borrow().get(&lp) { return index; @@ -311,7 +311,7 @@ impl MoveData<'tcx> { } /// Adds a new move entry for a move of `lp` that occurs at location `id` with kind `kind`. - pub fn add_move(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + pub fn add_move(&self, tcx: TyCtxt<'tcx, 'tcx>, orig_lp: Rc>, id: hir::ItemLocalId, kind: MoveKind) { @@ -340,7 +340,7 @@ impl MoveData<'tcx> { self.add_move_helper(tcx, orig_lp, id, kind); } - fn add_move_helper(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + fn add_move_helper(&self, tcx: TyCtxt<'tcx, 'tcx>, lp: Rc>, id: hir::ItemLocalId, kind: MoveKind) { @@ -365,7 +365,7 @@ impl MoveData<'tcx> { /// Adds a new record for an assignment to `lp` that occurs at location `id` with the given /// `span`. - pub fn add_assignment(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + pub fn add_assignment(&self, tcx: TyCtxt<'tcx, 'tcx>, lp: Rc>, assign_id: hir::ItemLocalId, span: Span) { @@ -395,7 +395,7 @@ impl MoveData<'tcx> { self.add_assignment_helper(tcx, lp, assign_id, span); } - fn add_assignment_helper(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + fn add_assignment_helper(&self, tcx: TyCtxt<'tcx, 'tcx>, lp: Rc>, assign_id: hir::ItemLocalId, span: Span) { diff --git a/src/librustc_borrowck/dataflow.rs b/src/librustc_borrowck/dataflow.rs index 037f1120d96b4..4e49fa57cb99c 100644 --- a/src/librustc_borrowck/dataflow.rs +++ b/src/librustc_borrowck/dataflow.rs @@ -27,7 +27,7 @@ pub enum EntryOrExit { #[derive(Clone)] pub struct DataFlowContext<'tcx, O> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, /// a name for the analysis using this dataflow instance analysis_name: &'static str, @@ -225,7 +225,7 @@ pub enum KillFrom { } impl<'tcx, O: DataFlowOperator> DataFlowContext<'tcx, O> { - pub fn new(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + pub fn new(tcx: TyCtxt<'tcx, 'tcx>, analysis_name: &'static str, body: Option<&hir::Body>, cfg: &cfg::CFG, diff --git a/src/librustc_codegen_llvm/allocator.rs b/src/librustc_codegen_llvm/allocator.rs index 1fe020561dde1..27ec939dd2933 100644 --- a/src/librustc_codegen_llvm/allocator.rs +++ b/src/librustc_codegen_llvm/allocator.rs @@ -9,7 +9,7 @@ use rustc_allocator::{ALLOCATOR_METHODS, AllocatorTy}; use crate::ModuleLlvm; use crate::llvm::{self, False, True}; -pub(crate) unsafe fn codegen(tcx: TyCtxt<'_, '_, '_>, mods: &mut ModuleLlvm, kind: AllocatorKind) { +pub(crate) unsafe fn codegen(tcx: TyCtxt<'_, '_>, mods: &mut ModuleLlvm, kind: AllocatorKind) { let llcx = &*mods.llcx; let llmod = mods.llmod(); let usize = match &tcx.sess.target.target.target_pointer_width[..] { diff --git a/src/librustc_codegen_llvm/attributes.rs b/src/librustc_codegen_llvm/attributes.rs index 9d0e7dde34d13..f68f3de118574 100644 --- a/src/librustc_codegen_llvm/attributes.rs +++ b/src/librustc_codegen_llvm/attributes.rs @@ -367,7 +367,7 @@ pub fn provide_extern(providers: &mut Providers<'_>) { }; } -fn wasm_import_module(tcx: TyCtxt<'_, '_, '_>, id: DefId) -> Option { +fn wasm_import_module(tcx: TyCtxt<'_, '_>, id: DefId) -> Option { tcx.wasm_import_module_map(id.krate) .get(&id) .map(|s| CString::new(&s[..]).unwrap()) diff --git a/src/librustc_codegen_llvm/back/write.rs b/src/librustc_codegen_llvm/back/write.rs index d8a9f681639a0..6f3f9d4cb8b55 100644 --- a/src/librustc_codegen_llvm/back/write.rs +++ b/src/librustc_codegen_llvm/back/write.rs @@ -89,7 +89,7 @@ pub fn create_informational_target_machine( } pub fn create_target_machine( - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, find_features: bool, ) -> &'static mut llvm::TargetMachine { target_machine_factory(&tcx.sess, tcx.backend_optimization_level(LOCAL_CRATE), find_features)() diff --git a/src/librustc_codegen_llvm/base.rs b/src/librustc_codegen_llvm/base.rs index fd8ef55c77f3c..60c141ab566da 100644 --- a/src/librustc_codegen_llvm/base.rs +++ b/src/librustc_codegen_llvm/base.rs @@ -42,7 +42,7 @@ use rustc::hir::CodegenFnAttrs; use crate::value::Value; pub fn write_compressed_metadata<'a, 'gcx>( - tcx: TyCtxt<'gcx, 'gcx, 'gcx>, + tcx: TyCtxt<'gcx, 'gcx>, metadata: &EncodedMetadata, llvm_module: &mut ModuleLlvm ) { @@ -103,7 +103,7 @@ pub fn iter_globals(llmod: &'ll llvm::Module) -> ValueIter<'ll> { } } -pub fn compile_codegen_unit(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, cgu_name: InternedString) { +pub fn compile_codegen_unit(tcx: TyCtxt<'tcx, 'tcx>, cgu_name: InternedString) { let start_time = Instant::now(); let dep_node = tcx.codegen_unit(cgu_name).codegen_dep_node(tcx); @@ -124,7 +124,7 @@ pub fn compile_codegen_unit(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, cgu_name: InternedStr submit_codegened_module_to_llvm(&LlvmCodegenBackend(()), tcx, module, cost); fn module_codegen<'ll, 'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, cgu_name: InternedString, ) -> ModuleCodegen { let cgu = tcx.codegen_unit(cgu_name); diff --git a/src/librustc_codegen_llvm/builder.rs b/src/librustc_codegen_llvm/builder.rs index af28f43a74f26..28e27535a39ad 100644 --- a/src/librustc_codegen_llvm/builder.rs +++ b/src/librustc_codegen_llvm/builder.rs @@ -66,7 +66,7 @@ impl ty::layout::HasDataLayout for Builder<'_, '_, '_> { } impl ty::layout::HasTyCtxt<'tcx> for Builder<'_, '_, 'tcx> { - fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx, 'tcx> { + fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx> { self.cx.tcx } } diff --git a/src/librustc_codegen_llvm/context.rs b/src/librustc_codegen_llvm/context.rs index ca91814c45bf8..e3126d0e25d5a 100644 --- a/src/librustc_codegen_llvm/context.rs +++ b/src/librustc_codegen_llvm/context.rs @@ -35,7 +35,7 @@ use crate::abi::Abi; /// `llvm::Context` so that several compilation units may be optimized in parallel. /// All other LLVM data structures in the `CodegenCx` are tied to that `llvm::Context`. pub struct CodegenCx<'ll, 'tcx: 'll> { - pub tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + pub tcx: TyCtxt<'tcx, 'tcx>, pub check_overflow: bool, pub use_dll_storage_attrs: bool, pub tls_model: llvm::ThreadLocalMode, @@ -141,7 +141,7 @@ pub fn is_pie_binary(sess: &Session) -> bool { } pub unsafe fn create_module( - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, llcx: &'ll llvm::Context, mod_name: &str, ) -> &'ll llvm::Module { @@ -207,7 +207,7 @@ pub unsafe fn create_module( } impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> { - crate fn new(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + crate fn new(tcx: TyCtxt<'tcx, 'tcx>, codegen_unit: Arc>, llvm_module: &'ll crate::ModuleLlvm) -> Self { @@ -838,7 +838,7 @@ impl HasTargetSpec for CodegenCx<'ll, 'tcx> { } impl ty::layout::HasTyCtxt<'tcx> for CodegenCx<'ll, 'tcx> { - fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx, 'tcx> { + fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx> { self.tcx } } diff --git a/src/librustc_codegen_llvm/debuginfo/metadata.rs b/src/librustc_codegen_llvm/debuginfo/metadata.rs index 42bd790ca2e9c..4fad236c32dd3 100644 --- a/src/librustc_codegen_llvm/debuginfo/metadata.rs +++ b/src/librustc_codegen_llvm/debuginfo/metadata.rs @@ -894,7 +894,7 @@ fn pointer_type_metadata( } } -pub fn compile_unit_metadata(tcx: TyCtxt<'_, '_, '_>, +pub fn compile_unit_metadata(tcx: TyCtxt<'_, '_>, codegen_unit_name: &str, debug_context: &CrateDebugContext<'ll, '_>) -> &'ll DIDescriptor { diff --git a/src/librustc_codegen_llvm/lib.rs b/src/librustc_codegen_llvm/lib.rs index 89c24c624a249..17a6fe090b905 100644 --- a/src/librustc_codegen_llvm/lib.rs +++ b/src/librustc_codegen_llvm/lib.rs @@ -103,13 +103,13 @@ mod va_arg; pub struct LlvmCodegenBackend(()); impl ExtraBackendMethods for LlvmCodegenBackend { - fn new_metadata(&self, tcx: TyCtxt<'_, '_, '_>, mod_name: &str) -> ModuleLlvm { + fn new_metadata(&self, tcx: TyCtxt<'_, '_>, mod_name: &str) -> ModuleLlvm { ModuleLlvm::new_metadata(tcx, mod_name) } fn write_compressed_metadata<'b, 'gcx>( &self, - tcx: TyCtxt<'gcx, 'gcx, 'gcx>, + tcx: TyCtxt<'gcx, 'gcx>, metadata: &EncodedMetadata, llvm_module: &mut ModuleLlvm ) { @@ -117,7 +117,7 @@ impl ExtraBackendMethods for LlvmCodegenBackend { } fn codegen_allocator<'b, 'gcx>( &self, - tcx: TyCtxt<'gcx, 'gcx, 'gcx>, + tcx: TyCtxt<'gcx, 'gcx>, mods: &mut ModuleLlvm, kind: AllocatorKind ) { @@ -125,7 +125,7 @@ impl ExtraBackendMethods for LlvmCodegenBackend { } fn compile_codegen_unit<'a, 'tcx: 'a>( &self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, cgu_name: InternedString, ) { base::compile_codegen_unit(tcx, cgu_name); @@ -286,7 +286,7 @@ impl CodegenBackend for LlvmCodegenBackend { fn codegen_crate<'b, 'tcx>( &self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, metadata: EncodedMetadata, need_metadata_module: bool, rx: mpsc::Receiver> @@ -365,7 +365,7 @@ unsafe impl Send for ModuleLlvm { } unsafe impl Sync for ModuleLlvm { } impl ModuleLlvm { - fn new(tcx: TyCtxt<'_, '_, '_>, mod_name: &str) -> Self { + fn new(tcx: TyCtxt<'_, '_>, mod_name: &str) -> Self { unsafe { let llcx = llvm::LLVMRustContextCreate(tcx.sess.fewer_names()); let llmod_raw = context::create_module(tcx, llcx, mod_name) as *const _; @@ -377,7 +377,7 @@ impl ModuleLlvm { } } - fn new_metadata(tcx: TyCtxt<'_, '_, '_>, mod_name: &str) -> Self { + fn new_metadata(tcx: TyCtxt<'_, '_>, mod_name: &str) -> Self { unsafe { let llcx = llvm::LLVMRustContextCreate(tcx.sess.fewer_names()); let llmod_raw = context::create_module(tcx, llcx, mod_name) as *const _; diff --git a/src/librustc_codegen_ssa/back/linker.rs b/src/librustc_codegen_ssa/back/linker.rs index 926f4febe7bae..260c07a7b6287 100644 --- a/src/librustc_codegen_ssa/back/linker.rs +++ b/src/librustc_codegen_ssa/back/linker.rs @@ -25,7 +25,7 @@ pub struct LinkerInfo { } impl LinkerInfo { - pub fn new(tcx: TyCtxt<'_, '_, '_>) -> LinkerInfo { + pub fn new(tcx: TyCtxt<'_, '_>) -> LinkerInfo { LinkerInfo { exports: tcx.sess.crate_types.borrow().iter().map(|&c| { (c, exported_symbols(tcx, c)) @@ -1012,7 +1012,7 @@ impl<'a> Linker for WasmLd<'a> { } } -fn exported_symbols(tcx: TyCtxt<'_, '_, '_>, crate_type: CrateType) -> Vec { +fn exported_symbols(tcx: TyCtxt<'_, '_>, crate_type: CrateType) -> Vec { if let Some(ref exports) = tcx.sess.target.target.options.override_export_symbols { return exports.clone() } diff --git a/src/librustc_codegen_ssa/back/symbol_export.rs b/src/librustc_codegen_ssa/back/symbol_export.rs index 8d6652d05df5f..e805cb0003f05 100644 --- a/src/librustc_codegen_ssa/back/symbol_export.rs +++ b/src/librustc_codegen_ssa/back/symbol_export.rs @@ -21,7 +21,7 @@ pub type ExportedSymbols = FxHashMap< Arc>, >; -pub fn threshold(tcx: TyCtxt<'_, '_, '_>) -> SymbolExportLevel { +pub fn threshold(tcx: TyCtxt<'_, '_>) -> SymbolExportLevel { crates_export_threshold(&tcx.sess.crate_types.borrow()) } @@ -46,7 +46,7 @@ pub fn crates_export_threshold(crate_types: &[config::CrateType]) -> SymbolExpor } } -fn reachable_non_generics_provider<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn reachable_non_generics_provider<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, cnum: CrateNum) -> &'tcx DefIdMap { @@ -157,7 +157,7 @@ fn reachable_non_generics_provider<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, tcx.arena.alloc(reachable_non_generics) } -fn is_reachable_non_generic_provider_local<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn is_reachable_non_generic_provider_local<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> bool { let export_threshold = threshold(tcx); @@ -169,13 +169,13 @@ fn is_reachable_non_generic_provider_local<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } } -fn is_reachable_non_generic_provider_extern<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn is_reachable_non_generic_provider_extern<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> bool { tcx.reachable_non_generics(def_id.krate).contains_key(&def_id) } -fn exported_symbols_provider_local<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn exported_symbols_provider_local<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, cnum: CrateNum) -> Arc, SymbolExportLevel)>> @@ -279,7 +279,7 @@ fn exported_symbols_provider_local<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } fn upstream_monomorphizations_provider<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, cnum: CrateNum) -> &'tcx DefIdMap, CrateNum>> { @@ -329,7 +329,7 @@ fn upstream_monomorphizations_provider<'tcx>( } fn upstream_monomorphizations_for_provider<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> Option<&'tcx FxHashMap, CrateNum>> { @@ -337,7 +337,7 @@ fn upstream_monomorphizations_for_provider<'tcx>( tcx.upstream_monomorphizations(LOCAL_CRATE).get(&def_id) } -fn is_unreachable_local_definition_provider(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> bool { +fn is_unreachable_local_definition_provider(tcx: TyCtxt<'_, '_>, def_id: DefId) -> bool { if let Some(hir_id) = tcx.hir().as_local_hir_id(def_id) { !tcx.reachable_set(LOCAL_CRATE).0.contains(&hir_id) } else { @@ -359,7 +359,7 @@ pub fn provide_extern(providers: &mut Providers<'_>) { providers.upstream_monomorphizations_for = upstream_monomorphizations_for_provider; } -fn symbol_export_level(tcx: TyCtxt<'_, '_, '_>, sym_def_id: DefId) -> SymbolExportLevel { +fn symbol_export_level(tcx: TyCtxt<'_, '_>, sym_def_id: DefId) -> SymbolExportLevel { // We export anything that's not mangled at the "C" layer as it probably has // to do with ABI concerns. We do not, however, apply such treatment to // special symbols in the standard library for various plumbing between diff --git a/src/librustc_codegen_ssa/back/write.rs b/src/librustc_codegen_ssa/back/write.rs index 5abff2d8ec350..894884e19c3fd 100644 --- a/src/librustc_codegen_ssa/back/write.rs +++ b/src/librustc_codegen_ssa/back/write.rs @@ -375,7 +375,7 @@ fn need_pre_lto_bitcode_for_incr_comp(sess: &Session) -> bool { pub fn start_async_codegen( backend: B, - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, metadata: EncodedMetadata, coordinator_receive: Receiver>, total_cgus: usize @@ -996,7 +996,7 @@ enum MainThreadWorkerState { fn start_executing_work( backend: B, - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, crate_info: &CrateInfo, shared_emitter: SharedEmitter, codegen_worker_send: Sender>, @@ -1862,7 +1862,7 @@ impl OngoingCodegen { } pub fn submit_pre_codegened_module_to_llvm(&self, - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, module: ModuleCodegen) { self.wait_for_signal_to_codegen_item(); self.check_for_errors(tcx.sess); @@ -1872,7 +1872,7 @@ impl OngoingCodegen { submit_codegened_module_to_llvm(&self.backend, tcx, module, cost); } - pub fn codegen_finished(&self, tcx: TyCtxt<'_, '_, '_>) { + pub fn codegen_finished(&self, tcx: TyCtxt<'_, '_>) { self.wait_for_signal_to_codegen_item(); self.check_for_errors(tcx.sess); drop(self.coordinator_send.send(Box::new(Message::CodegenComplete::))); @@ -1911,7 +1911,7 @@ impl OngoingCodegen { pub fn submit_codegened_module_to_llvm( _backend: &B, - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, module: ModuleCodegen, cost: u64 ) { @@ -1924,7 +1924,7 @@ pub fn submit_codegened_module_to_llvm( pub fn submit_post_lto_module_to_llvm( _backend: &B, - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, module: CachedModuleCodegen ) { let llvm_work_item = WorkItem::CopyPostLtoArtifacts(module); @@ -1936,7 +1936,7 @@ pub fn submit_post_lto_module_to_llvm( pub fn submit_pre_lto_module_to_llvm( _backend: &B, - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, module: CachedModuleCodegen ) { let filename = pre_lto_bitcode_filename(&module.name); @@ -1961,7 +1961,7 @@ pub fn pre_lto_bitcode_filename(module_name: &str) -> String { format!("{}.{}", module_name, PRE_LTO_BC_EXT) } -fn msvc_imps_needed(tcx: TyCtxt<'_, '_, '_>) -> bool { +fn msvc_imps_needed(tcx: TyCtxt<'_, '_>) -> bool { // This should never be true (because it's not supported). If it is true, // something is wrong with commandline arg validation. assert!(!(tcx.sess.opts.cg.linker_plugin_lto.enabled() && diff --git a/src/librustc_codegen_ssa/base.rs b/src/librustc_codegen_ssa/base.rs index b80f01467af0b..517d19c56a565 100644 --- a/src/librustc_codegen_ssa/base.rs +++ b/src/librustc_codegen_ssa/base.rs @@ -480,7 +480,7 @@ pub const CODEGEN_WORKER_ID: usize = ::std::usize::MAX; pub fn codegen_crate( backend: B, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, metadata: EncodedMetadata, need_metadata_module: bool, rx: mpsc::Receiver> @@ -703,7 +703,7 @@ impl Drop for AbortCodegenOnDrop { } } -fn assert_and_save_dep_graph<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +fn assert_and_save_dep_graph<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) { time(tcx.sess, "assert dep graph", || ::rustc_incremental::assert_dep_graph(tcx)); @@ -714,7 +714,7 @@ fn assert_and_save_dep_graph<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { } impl CrateInfo { - pub fn new(tcx: TyCtxt<'_, '_, '_>) -> CrateInfo { + pub fn new(tcx: TyCtxt<'_, '_>) -> CrateInfo { let mut info = CrateInfo { panic_runtime: None, compiler_builtins: None, @@ -780,7 +780,7 @@ impl CrateInfo { } } -fn is_codegened_item(tcx: TyCtxt<'_, '_, '_>, id: DefId) -> bool { +fn is_codegened_item(tcx: TyCtxt<'_, '_>, id: DefId) -> bool { let (all_mono_items, _) = tcx.collect_and_partition_mono_items(LOCAL_CRATE); all_mono_items.contains(&id) @@ -850,7 +850,7 @@ pub fn provide_both(providers: &mut Providers<'_>) { }; } -fn determine_cgu_reuse<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn determine_cgu_reuse<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, cgu: &CodegenUnit<'tcx>) -> CguReuse { if !tcx.dep_graph.is_fully_enabled() { diff --git a/src/librustc_codegen_ssa/common.rs b/src/librustc_codegen_ssa/common.rs index 0e1885fe29ba6..82af0049affc9 100644 --- a/src/librustc_codegen_ssa/common.rs +++ b/src/librustc_codegen_ssa/common.rs @@ -122,7 +122,7 @@ mod temp_stable_hash_impls { } } -pub fn langcall(tcx: TyCtxt<'_, '_, '_>, +pub fn langcall(tcx: TyCtxt<'_, '_>, span: Option, msg: &str, li: LangItem) diff --git a/src/librustc_codegen_ssa/debuginfo/type_names.rs b/src/librustc_codegen_ssa/debuginfo/type_names.rs index 695a1c1cbcf88..50847b09805e9 100644 --- a/src/librustc_codegen_ssa/debuginfo/type_names.rs +++ b/src/librustc_codegen_ssa/debuginfo/type_names.rs @@ -8,7 +8,7 @@ use rustc_data_structures::fx::FxHashSet; // any caching, i.e., calling the function twice with the same type will also do // the work twice. The `qualified` parameter only affects the first level of the // type name, further levels (i.e., type parameters) are always fully qualified. -pub fn compute_debuginfo_type_name<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn compute_debuginfo_type_name<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, t: Ty<'tcx>, qualified: bool) -> String { @@ -20,7 +20,7 @@ pub fn compute_debuginfo_type_name<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, // Pushes the name of the type as it should be stored in debuginfo on the // `output` String. See also compute_debuginfo_type_name(). -pub fn push_debuginfo_type_name<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn push_debuginfo_type_name<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, t: Ty<'tcx>, qualified: bool, output: &mut String, @@ -208,7 +208,7 @@ pub fn push_debuginfo_type_name<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } } - fn push_item_name(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + fn push_item_name(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, qualified: bool, output: &mut String) { @@ -228,7 +228,7 @@ pub fn push_debuginfo_type_name<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, // reconstructed for items from non-local crates. For local crates, this // would be possible but with inlining and LTO we have to use the least // common denominator - otherwise we would run into conflicts. - fn push_type_params<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + fn push_type_params<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, substs: SubstsRef<'tcx>, output: &mut String, visited: &mut FxHashSet>) { diff --git a/src/librustc_codegen_ssa/traits/backend.rs b/src/librustc_codegen_ssa/traits/backend.rs index 40333874c0007..e6532f47bc86f 100644 --- a/src/librustc_codegen_ssa/traits/backend.rs +++ b/src/librustc_codegen_ssa/traits/backend.rs @@ -31,22 +31,22 @@ impl<'tcx, T> Backend<'tcx> for T where } pub trait ExtraBackendMethods: CodegenBackend + WriteBackendMethods + Sized + Send { - fn new_metadata(&self, sess: TyCtxt<'_, '_, '_>, mod_name: &str) -> Self::Module; + fn new_metadata(&self, sess: TyCtxt<'_, '_>, mod_name: &str) -> Self::Module; fn write_compressed_metadata<'gcx>( &self, - tcx: TyCtxt<'gcx, 'gcx, 'gcx>, + tcx: TyCtxt<'gcx, 'gcx>, metadata: &EncodedMetadata, llvm_module: &mut Self::Module, ); fn codegen_allocator<'gcx>( &self, - tcx: TyCtxt<'gcx, 'gcx, 'gcx>, + tcx: TyCtxt<'gcx, 'gcx>, mods: &mut Self::Module, kind: AllocatorKind ); fn compile_codegen_unit<'a, 'tcx: 'a>( &self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, cgu_name: InternedString, ); // If find_features is true this won't access `sess.crate_types` by assuming diff --git a/src/librustc_codegen_utils/codegen_backend.rs b/src/librustc_codegen_utils/codegen_backend.rs index e29bb751b9a09..521ef23b825fd 100644 --- a/src/librustc_codegen_utils/codegen_backend.rs +++ b/src/librustc_codegen_utils/codegen_backend.rs @@ -36,7 +36,7 @@ pub trait CodegenBackend { fn provide_extern(&self, _providers: &mut Providers<'_>); fn codegen_crate<'tcx>( &self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, metadata: EncodedMetadata, need_metadata_module: bool, rx: mpsc::Receiver> diff --git a/src/librustc_codegen_utils/lib.rs b/src/librustc_codegen_utils/lib.rs index 3726e4f47b96b..cc6e368f11b3b 100644 --- a/src/librustc_codegen_utils/lib.rs +++ b/src/librustc_codegen_utils/lib.rs @@ -36,7 +36,7 @@ pub mod symbol_names_test; /// error in codegen. This is used to write compile-fail tests /// that actually test that compilation succeeds without /// reporting an error. -pub fn check_for_rustc_errors_attr(tcx: TyCtxt<'_, '_, '_>) { +pub fn check_for_rustc_errors_attr(tcx: TyCtxt<'_, '_>) { if let Some((def_id, _)) = tcx.entry_fn(LOCAL_CRATE) { if tcx.has_attr(def_id, sym::rustc_error) { tcx.sess.span_fatal(tcx.def_span(def_id), "compilation successful"); diff --git a/src/librustc_codegen_utils/symbol_names.rs b/src/librustc_codegen_utils/symbol_names.rs index 4df96a95e53a1..89b35b4cc6114 100644 --- a/src/librustc_codegen_utils/symbol_names.rs +++ b/src/librustc_codegen_utils/symbol_names.rs @@ -112,7 +112,7 @@ pub fn provide(providers: &mut Providers<'_>) { }; } -fn symbol_name(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, instance: Instance<'tcx>) -> InternedString { +fn symbol_name(tcx: TyCtxt<'tcx, 'tcx>, instance: Instance<'tcx>) -> InternedString { let def_id = instance.def_id(); let substs = instance.substs; diff --git a/src/librustc_codegen_utils/symbol_names/legacy.rs b/src/librustc_codegen_utils/symbol_names/legacy.rs index 41e972f869f7d..5e7b29d13a166 100644 --- a/src/librustc_codegen_utils/symbol_names/legacy.rs +++ b/src/librustc_codegen_utils/symbol_names/legacy.rs @@ -14,7 +14,7 @@ use std::fmt::{self, Write}; use std::mem::{self, discriminant}; pub(super) fn mangle( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, instance: Instance<'tcx>, instantiating_crate: Option, ) -> String { @@ -69,7 +69,7 @@ pub(super) fn mangle( } fn get_symbol_hash<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, // instance this name will be for instance: Instance<'tcx>, @@ -180,7 +180,7 @@ impl SymbolPath { } struct SymbolPrinter<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, path: SymbolPath, // When `true`, `finalize_pending_component` isn't used. @@ -203,7 +203,7 @@ impl Printer<'tcx, 'tcx> for SymbolPrinter<'tcx> { type DynExistential = Self; type Const = Self; - fn tcx(&'a self) -> TyCtxt<'tcx, 'tcx, 'tcx> { + fn tcx(&'a self) -> TyCtxt<'tcx, 'tcx> { self.tcx } diff --git a/src/librustc_codegen_utils/symbol_names/v0.rs b/src/librustc_codegen_utils/symbol_names/v0.rs index e3b12fb7f415c..6a155ba1b2a3b 100644 --- a/src/librustc_codegen_utils/symbol_names/v0.rs +++ b/src/librustc_codegen_utils/symbol_names/v0.rs @@ -13,7 +13,7 @@ use std::fmt::Write; use std::ops::Range; pub(super) fn mangle( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, instance: Instance<'tcx>, instantiating_crate: Option, ) -> String { @@ -76,7 +76,7 @@ struct BinderLevel { } struct SymbolMangler<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, compress: Option>>, binders: Vec, out: String, @@ -223,7 +223,7 @@ impl Printer<'tcx, 'tcx> for SymbolMangler<'tcx> { type DynExistential = Self; type Const = Self; - fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx, 'tcx> { + fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx> { self.tcx } diff --git a/src/librustc_codegen_utils/symbol_names_test.rs b/src/librustc_codegen_utils/symbol_names_test.rs index 3d82557d4c5b1..93b8a969d0b60 100644 --- a/src/librustc_codegen_utils/symbol_names_test.rs +++ b/src/librustc_codegen_utils/symbol_names_test.rs @@ -11,7 +11,7 @@ use syntax::symbol::{Symbol, sym}; const SYMBOL_NAME: Symbol = sym::rustc_symbol_name; const DEF_PATH: Symbol = sym::rustc_def_path; -pub fn report_symbol_names<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn report_symbol_names<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) { // if the `rustc_attrs` feature is not enabled, then the // attributes we are interested in cannot be present anyway, so // skip the walk. @@ -26,7 +26,7 @@ pub fn report_symbol_names<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { } struct SymbolNamesTest<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, } impl SymbolNamesTest<'tcx> { diff --git a/src/librustc_driver/pretty.rs b/src/librustc_driver/pretty.rs index 64d405721807f..a447baa7f41a8 100644 --- a/src/librustc_driver/pretty.rs +++ b/src/librustc_driver/pretty.rs @@ -156,7 +156,7 @@ impl PpSourceMode { /// Constructs a `PrinterSupport` object and passes it to `f`. fn call_with_pp_support<'tcx, A, F>(&self, sess: &'tcx Session, - tcx: Option>, + tcx: Option>, f: F) -> A where F: FnOnce(&dyn PrinterSupport) -> A @@ -188,7 +188,7 @@ impl PpSourceMode { } fn call_with_pp_support_hir<'tcx, A, F>( &self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, f: F ) -> A where F: FnOnce(&dyn HirPrinterSupport<'_>, &hir::Crate) -> A @@ -270,7 +270,7 @@ trait HirPrinterSupport<'hir>: pprust_hir::PpAnn { struct NoAnn<'hir> { sess: &'hir Session, - tcx: Option>, + tcx: Option>, } impl<'hir> PrinterSupport for NoAnn<'hir> { @@ -311,7 +311,7 @@ impl<'hir> pprust_hir::PpAnn for NoAnn<'hir> { struct IdentifiedAnnotation<'hir> { sess: &'hir Session, - tcx: Option>, + tcx: Option>, } impl<'hir> PrinterSupport for IdentifiedAnnotation<'hir> { @@ -456,7 +456,7 @@ impl<'a> pprust::PpAnn for HygieneAnnotation<'a> { struct TypedAnnotation<'a, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, tables: Cell<&'a ty::TypeckTables<'tcx>>, } @@ -618,7 +618,7 @@ impl UserIdentifiedItem { } fn print_flowgraph<'tcx, W: Write>(variants: Vec, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, code: blocks::Code<'tcx>, mode: PpFlowGraphMode, mut out: W) @@ -755,7 +755,7 @@ pub fn print_after_parsing(sess: &Session, } pub fn print_after_hir_lowering<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, input: &Input, krate: &ast::Crate, ppm: PpMode, @@ -866,7 +866,7 @@ pub fn print_after_hir_lowering<'tcx>( // with a different callback than the standard driver, so that isn't easy. // Instead, we call that function ourselves. fn print_with_analysis<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, ppm: PpMode, uii: Option, ofile: Option<&Path> diff --git a/src/librustc_incremental/assert_dep_graph.rs b/src/librustc_incremental/assert_dep_graph.rs index a43a508ba96e7..5e41b8c9efda2 100644 --- a/src/librustc_incremental/assert_dep_graph.rs +++ b/src/librustc_incremental/assert_dep_graph.rs @@ -51,7 +51,7 @@ use std::io::Write; use syntax::ast; use syntax_pos::Span; -pub fn assert_dep_graph<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn assert_dep_graph<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) { tcx.dep_graph.with_ignore(|| { if tcx.sess.opts.debugging_opts.dump_dep_graph { dump_graph(tcx); @@ -90,7 +90,7 @@ type Sources = Vec<(Span, DefId, DepNode)>; type Targets = Vec<(Span, ast::Name, hir::HirId, DepNode)>; struct IfThisChanged<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, if_this_changed: Sources, then_this_would_need: Targets, } @@ -184,7 +184,7 @@ impl Visitor<'tcx> for IfThisChanged<'tcx> { } } -fn check_paths<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn check_paths<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, if_this_changed: &Sources, then_this_would_need: &Targets) { @@ -217,7 +217,7 @@ fn check_paths<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } } -fn dump_graph(tcx: TyCtxt<'_, '_, '_>) { +fn dump_graph(tcx: TyCtxt<'_, '_>) { let path: String = env::var("RUST_DEP_GRAPH").unwrap_or_else(|_| "dep_graph".to_string()); let query = tcx.dep_graph.query(); diff --git a/src/librustc_incremental/assert_module_sources.rs b/src/librustc_incremental/assert_module_sources.rs index 7f1a9f8b88e53..12f81f337d356 100644 --- a/src/librustc_incremental/assert_module_sources.rs +++ b/src/librustc_incremental/assert_module_sources.rs @@ -35,7 +35,7 @@ const MODULE: Symbol = sym::module; const CFG: Symbol = sym::cfg; const KIND: Symbol = sym::kind; -pub fn assert_module_sources<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn assert_module_sources<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) { tcx.dep_graph.with_ignore(|| { if tcx.sess.opts.incremental.is_none() { return; @@ -60,7 +60,7 @@ pub fn assert_module_sources<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { } struct AssertModuleSource<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, available_cgus: BTreeSet, } diff --git a/src/librustc_incremental/persist/dirty_clean.rs b/src/librustc_incremental/persist/dirty_clean.rs index e28ee041bff36..e281636e9a1ce 100644 --- a/src/librustc_incremental/persist/dirty_clean.rs +++ b/src/librustc_incremental/persist/dirty_clean.rs @@ -206,7 +206,7 @@ impl Assertion { } } -pub fn check_dirty_clean_annotations<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn check_dirty_clean_annotations<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) { // can't add `#[rustc_dirty]` etc without opting in to this feature if !tcx.features().rustc_attrs { return; @@ -235,7 +235,7 @@ pub fn check_dirty_clean_annotations<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { } pub struct DirtyCleanVisitor<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, checked_attrs: FxHashSet, } @@ -537,7 +537,7 @@ impl ItemLikeVisitor<'tcx> for DirtyCleanVisitor<'tcx> { /// /// Also make sure that the `label` and `except` fields do not /// both exist. -fn check_config(tcx: TyCtxt<'_, '_, '_>, attr: &Attribute) -> bool { +fn check_config(tcx: TyCtxt<'_, '_>, attr: &Attribute) -> bool { debug!("check_config(attr={:?})", attr); let config = &tcx.sess.parse_sess.config; debug!("check_config: config={:?}", config); @@ -572,7 +572,7 @@ fn check_config(tcx: TyCtxt<'_, '_, '_>, attr: &Attribute) -> bool { } } -fn expect_associated_value(tcx: TyCtxt<'_, '_, '_>, item: &NestedMetaItem) -> ast::Name { +fn expect_associated_value(tcx: TyCtxt<'_, '_>, item: &NestedMetaItem) -> ast::Name { if let Some(value) = item.value_str() { value } else { @@ -590,7 +590,7 @@ fn expect_associated_value(tcx: TyCtxt<'_, '_, '_>, item: &NestedMetaItem) -> as // the HIR. It is used to verfiy that we really ran checks for all annotated // nodes. pub struct FindAllAttrs<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, attr_names: Vec, found_attrs: Vec<&'tcx Attribute>, } diff --git a/src/librustc_incremental/persist/load.rs b/src/librustc_incremental/persist/load.rs index afcd4c01dbd09..adcd06d719cd9 100644 --- a/src/librustc_incremental/persist/load.rs +++ b/src/librustc_incremental/persist/load.rs @@ -15,7 +15,7 @@ use super::fs::*; use super::file_format; use super::work_product; -pub fn dep_graph_tcx_init<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn dep_graph_tcx_init<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) { if !tcx.dep_graph.is_fully_enabled() { return } diff --git a/src/librustc_incremental/persist/save.rs b/src/librustc_incremental/persist/save.rs index 27133b87d32a1..6f175acebf95d 100644 --- a/src/librustc_incremental/persist/save.rs +++ b/src/librustc_incremental/persist/save.rs @@ -15,7 +15,7 @@ use super::dirty_clean; use super::file_format; use super::work_product; -pub fn save_dep_graph<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn save_dep_graph<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) { debug!("save_dep_graph()"); tcx.dep_graph.with_ignore(|| { let sess = tcx.sess; @@ -129,7 +129,7 @@ fn save_in(sess: &Session, path_buf: PathBuf, encode: F) } } -fn encode_dep_graph(tcx: TyCtxt<'_, '_, '_>, +fn encode_dep_graph(tcx: TyCtxt<'_, '_>, encoder: &mut Encoder) { // First encode the commandline arguments hash tcx.sess.opts.dep_tracking_hash().encode(encoder).unwrap(); @@ -234,7 +234,7 @@ fn encode_work_product_index(work_products: &FxHashMap, +fn encode_query_cache(tcx: TyCtxt<'_, '_>, encoder: &mut Encoder) { time(tcx.sess, "serialize query result cache", || { tcx.serialize_query_result_cache(encoder).unwrap(); diff --git a/src/librustc_interface/passes.rs b/src/librustc_interface/passes.rs index 66a4ee8bfc35d..2fc78dcddd040 100644 --- a/src/librustc_interface/passes.rs +++ b/src/librustc_interface/passes.rs @@ -798,7 +798,7 @@ declare_box_region_type!( impl BoxedGlobalCtxt { pub fn enter(&mut self, f: F) -> R where - F: for<'tcx> FnOnce(TyCtxt<'tcx, 'tcx, 'tcx>) -> R + F: for<'tcx> FnOnce(TyCtxt<'tcx, 'tcx>) -> R { self.access(|gcx| ty::tls::enter_global(gcx, |tcx| f(tcx))) } @@ -879,7 +879,7 @@ pub fn create_global_ctxt( /// Runs the resolution, type-checking, region checking and other /// miscellaneous analysis passes on the crate. fn analysis<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, cnum: CrateNum, ) -> Result<()> { assert_eq!(cnum, LOCAL_CRATE); @@ -999,7 +999,7 @@ fn analysis<'tcx>( } fn encode_and_write_metadata<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, outputs: &OutputFilenames, ) -> (middle::cstore::EncodedMetadata, bool) { #[derive(PartialEq, Eq, PartialOrd, Ord)] @@ -1062,7 +1062,7 @@ fn encode_and_write_metadata<'tcx>( /// be discarded. pub fn start_codegen<'tcx>( codegen_backend: &dyn CodegenBackend, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, rx: mpsc::Receiver>, outputs: &OutputFilenames, ) -> Box { diff --git a/src/librustc_interface/proc_macro_decls.rs b/src/librustc_interface/proc_macro_decls.rs index 82eb2014728d4..864b59d8a84c4 100644 --- a/src/librustc_interface/proc_macro_decls.rs +++ b/src/librustc_interface/proc_macro_decls.rs @@ -6,12 +6,12 @@ use rustc::ty::query::Providers; use syntax::attr; use syntax::symbol::sym; -pub fn find<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Option { +pub fn find<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) -> Option { tcx.proc_macro_decls_static(LOCAL_CRATE) } fn proc_macro_decls_static<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, cnum: CrateNum, ) -> Option { assert_eq!(cnum, LOCAL_CRATE); diff --git a/src/librustc_lint/lib.rs b/src/librustc_lint/lib.rs index 59498799f19d0..5eff28b194b98 100644 --- a/src/librustc_lint/lib.rs +++ b/src/librustc_lint/lib.rs @@ -75,7 +75,7 @@ pub fn provide(providers: &mut Providers<'_>) { }; } -fn lint_mod<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, module_def_id: DefId) { +fn lint_mod<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, module_def_id: DefId) { lint::late_lint_mod(tcx, module_def_id, BuiltinCombinedModuleLateLintPass::new()); } diff --git a/src/librustc_lint/types.rs b/src/librustc_lint/types.rs index 0bb5457d32860..494f0b6676052 100644 --- a/src/librustc_lint/types.rs +++ b/src/librustc_lint/types.rs @@ -519,11 +519,11 @@ enum FfiResult<'tcx> { }, } -fn is_zst<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, did: DefId, ty: Ty<'tcx>) -> bool { +fn is_zst<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, did: DefId, ty: Ty<'tcx>) -> bool { tcx.layout_of(tcx.param_env(did).and(ty)).map(|layout| layout.is_zst()).unwrap_or(false) } -fn ty_is_known_nonnull<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ty: Ty<'tcx>) -> bool { +fn ty_is_known_nonnull<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, ty: Ty<'tcx>) -> bool { match ty.sty { ty::FnPtr(_) => true, ty::Ref(..) => true, @@ -555,7 +555,7 @@ fn ty_is_known_nonnull<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ty: Ty<'tcx>) -> boo /// to function pointers, references, core::num::NonZero*, /// core::ptr::NonNull, and #[repr(transparent)] newtypes. /// FIXME: This duplicates code in codegen. -fn is_repr_nullable_ptr<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn is_repr_nullable_ptr<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, ty: Ty<'tcx>, ty_def: &'tcx ty::AdtDef, substs: SubstsRef<'tcx>) diff --git a/src/librustc_macros/src/query.rs b/src/librustc_macros/src/query.rs index 14f46fef874db..bb6595b5a8036 100644 --- a/src/librustc_macros/src/query.rs +++ b/src/librustc_macros/src/query.rs @@ -327,7 +327,7 @@ fn add_query_description_impl( quote! { #[inline] fn try_load_from_disk( - #tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + #tcx: TyCtxt<'tcx, 'tcx>, #id: SerializedDepNodeIndex ) -> Option { #block @@ -338,7 +338,7 @@ fn add_query_description_impl( quote! { #[inline] fn try_load_from_disk( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, id: SerializedDepNodeIndex ) -> Option { tcx.queries.on_disk_cache.try_load_query_result(tcx, id) @@ -350,7 +350,7 @@ fn add_query_description_impl( quote! { #[inline] #[allow(unused_variables)] - fn cache_on_disk(#tcx: TyCtxt<'tcx, 'tcx, 'tcx>, #key: Self::Key) -> bool { + fn cache_on_disk(#tcx: TyCtxt<'tcx, 'tcx>, #key: Self::Key) -> bool { #expr } @@ -367,7 +367,7 @@ fn add_query_description_impl( quote! { #[allow(unused_variables)] fn describe( - #tcx: TyCtxt<'_, '_, '_>, + #tcx: TyCtxt<'_, '_>, #key: #arg, ) -> Cow<'static, str> { format!(#desc).into() diff --git a/src/librustc_metadata/cstore_impl.rs b/src/librustc_metadata/cstore_impl.rs index 87ca766bbaa93..75020693461a4 100644 --- a/src/librustc_metadata/cstore_impl.rs +++ b/src/librustc_metadata/cstore_impl.rs @@ -40,7 +40,7 @@ macro_rules! provide { (<$lt:tt> $tcx:ident, $def_id:ident, $other:ident, $cdata:ident, $($name:ident => $compute:block)*) => { pub fn provide_extern<$lt>(providers: &mut Providers<$lt>) { - $(fn $name<$lt:$lt, T>($tcx: TyCtxt<$lt, $lt, $lt>, def_id_arg: T) + $(fn $name<$lt:$lt, T>($tcx: TyCtxt<$lt, $lt>, def_id_arg: T) -> as QueryConfig<$lt>>::Value where T: IntoArgs, @@ -551,7 +551,7 @@ impl CrateStore for cstore::CStore { } fn encode_metadata<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>) + tcx: TyCtxt<'tcx, 'tcx>) -> EncodedMetadata { encoder::encode_metadata(tcx) diff --git a/src/librustc_metadata/decoder.rs b/src/librustc_metadata/decoder.rs index bcce834c282e0..017c38e0f9d50 100644 --- a/src/librustc_metadata/decoder.rs +++ b/src/librustc_metadata/decoder.rs @@ -39,7 +39,7 @@ pub struct DecodeContext<'a, 'tcx: 'a> { opaque: opaque::Decoder<'a>, cdata: Option<&'a CrateMetadata>, sess: Option<&'a Session>, - tcx: Option>, + tcx: Option>, // Cache the last used source_file for translating spans as an optimization. last_source_file_index: usize, @@ -55,7 +55,7 @@ pub trait Metadata<'a, 'tcx>: Copy { fn raw_bytes(self) -> &'a [u8]; fn cdata(self) -> Option<&'a CrateMetadata> { None } fn sess(self) -> Option<&'a Session> { None } - fn tcx(self) -> Option> { None } + fn tcx(self) -> Option> { None } fn decoder(self, pos: usize) -> DecodeContext<'a, 'tcx> { let tcx = self.tcx(); @@ -114,14 +114,14 @@ impl<'a, 'tcx> Metadata<'a, 'tcx> for (&'a CrateMetadata, &'a Session) { } } -impl<'a, 'tcx> Metadata<'a, 'tcx> for (&'a CrateMetadata, TyCtxt<'tcx, 'tcx, 'tcx>) { +impl<'a, 'tcx> Metadata<'a, 'tcx> for (&'a CrateMetadata, TyCtxt<'tcx, 'tcx>) { fn raw_bytes(self) -> &'a [u8] { self.0.raw_bytes() } fn cdata(self) -> Option<&'a CrateMetadata> { Some(self.0) } - fn tcx(self) -> Option> { + fn tcx(self) -> Option> { Some(self.1) } } @@ -146,7 +146,7 @@ impl<'a, 'tcx: 'a, T: Decodable> LazySeq { } impl<'a, 'tcx> DecodeContext<'a, 'tcx> { - pub fn tcx(&self) -> TyCtxt<'tcx, 'tcx, 'tcx> { + pub fn tcx(&self) -> TyCtxt<'tcx, 'tcx> { self.tcx.expect("missing TyCtxt in DecodeContext") } @@ -172,7 +172,7 @@ impl<'a, 'tcx> DecodeContext<'a, 'tcx> { impl<'a, 'tcx> TyDecoder<'tcx> for DecodeContext<'a, 'tcx> { #[inline] - fn tcx(&self) -> TyCtxt<'tcx, 'tcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'tcx, 'tcx> { self.tcx.expect("missing TyCtxt in DecodeContext") } @@ -547,7 +547,7 @@ impl<'a, 'tcx> CrateMetadata { fn get_variant( &self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, item: &Entry<'_>, index: DefIndex, parent_did: DefId, @@ -590,7 +590,7 @@ impl<'a, 'tcx> CrateMetadata { pub fn get_adt_def(&self, item_id: DefIndex, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>) + tcx: TyCtxt<'tcx, 'tcx>) -> &'tcx ty::AdtDef { let item = self.entry(item_id); let did = self.local_def_id(item_id); @@ -618,21 +618,21 @@ impl<'a, 'tcx> CrateMetadata { pub fn get_predicates(&self, item_id: DefIndex, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>) + tcx: TyCtxt<'tcx, 'tcx>) -> ty::GenericPredicates<'tcx> { self.entry(item_id).predicates.unwrap().decode((self, tcx)) } pub fn get_predicates_defined_on(&self, item_id: DefIndex, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>) + tcx: TyCtxt<'tcx, 'tcx>) -> ty::GenericPredicates<'tcx> { self.entry(item_id).predicates_defined_on.unwrap().decode((self, tcx)) } pub fn get_super_predicates(&self, item_id: DefIndex, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>) + tcx: TyCtxt<'tcx, 'tcx>) -> ty::GenericPredicates<'tcx> { let super_predicates = match self.entry(item_id).kind { EntryKind::Trait(data) => data.decode(self).super_predicates, @@ -650,7 +650,7 @@ impl<'a, 'tcx> CrateMetadata { self.entry(item_id).generics.unwrap().decode((self, sess)) } - pub fn get_type(&self, id: DefIndex, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Ty<'tcx> { + pub fn get_type(&self, id: DefIndex, tcx: TyCtxt<'tcx, 'tcx>) -> Ty<'tcx> { self.entry(id).ty.unwrap().decode((self, tcx)) } @@ -702,7 +702,7 @@ impl<'a, 'tcx> CrateMetadata { pub fn get_impl_trait(&self, id: DefIndex, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>) + tcx: TyCtxt<'tcx, 'tcx>) -> Option> { self.get_impl_data(id).trait_ref.map(|tr| tr.decode((self, tcx))) } @@ -710,7 +710,7 @@ impl<'a, 'tcx> CrateMetadata { /// Iterates over all the stability attributes in the given crate. pub fn get_lib_features( &self, - tcx: TyCtxt<'_, 'tcx, '_>, + tcx: TyCtxt<'tcx, '_>, ) -> &'tcx [(ast::Name, Option)] { // FIXME: For a proc macro crate, not sure whether we should return the "host" // features or an empty Vec. Both don't cause ICEs. @@ -722,7 +722,7 @@ impl<'a, 'tcx> CrateMetadata { /// Iterates over the language items in the given crate. pub fn get_lang_items( &self, - tcx: TyCtxt<'_, 'tcx, '_>, + tcx: TyCtxt<'tcx, '_>, ) -> &'tcx [(DefId, usize)] { if self.proc_macros.is_some() { // Proc macro crates do not export any lang-items to the target. @@ -885,7 +885,7 @@ impl<'a, 'tcx> CrateMetadata { } pub fn maybe_get_optimized_mir(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, id: DefIndex) -> Option> { match self.is_proc_macro(id) { @@ -1019,7 +1019,7 @@ impl<'a, 'tcx> CrateMetadata { pub fn get_inherent_implementations_for_type( &self, - tcx: TyCtxt<'_, 'tcx, '_>, + tcx: TyCtxt<'tcx, '_>, id: DefIndex ) -> &'tcx [DefId] { tcx.arena.alloc_from_iter(self.entry(id) @@ -1030,7 +1030,7 @@ impl<'a, 'tcx> CrateMetadata { pub fn get_implementations_for_trait( &self, - tcx: TyCtxt<'_, 'tcx, '_>, + tcx: TyCtxt<'tcx, '_>, filter: Option, ) -> &'tcx [DefId] { if self.proc_macros.is_some() { @@ -1087,7 +1087,7 @@ impl<'a, 'tcx> CrateMetadata { pub fn get_foreign_modules( &self, - tcx: TyCtxt<'_, 'tcx, '_>, + tcx: TyCtxt<'tcx, '_>, ) -> &'tcx [ForeignModule] { if self.proc_macros.is_some() { // Proc macro crates do not have any *target* foreign modules. @@ -1099,7 +1099,7 @@ impl<'a, 'tcx> CrateMetadata { pub fn get_dylib_dependency_formats( &self, - tcx: TyCtxt<'_, 'tcx, '_>, + tcx: TyCtxt<'tcx, '_>, ) -> &'tcx [(CrateNum, LinkagePreference)] { tcx.arena.alloc_from_iter(self.root .dylib_dependency_formats @@ -1113,7 +1113,7 @@ impl<'a, 'tcx> CrateMetadata { pub fn get_missing_lang_items( &self, - tcx: TyCtxt<'_, 'tcx, '_>, + tcx: TyCtxt<'tcx, '_>, ) -> &'tcx [lang_items::LangItem] { if self.proc_macros.is_some() { // Proc macro crates do not depend on any target weak lang-items. @@ -1136,7 +1136,7 @@ impl<'a, 'tcx> CrateMetadata { } pub fn exported_symbols(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>) + tcx: TyCtxt<'tcx, 'tcx>) -> Vec<(ExportedSymbol<'tcx>, SymbolExportLevel)> { if self.proc_macros.is_some() { // If this crate is a custom derive crate, then we're not even going to @@ -1194,7 +1194,7 @@ impl<'a, 'tcx> CrateMetadata { pub fn fn_sig(&self, id: DefIndex, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>) + tcx: TyCtxt<'tcx, 'tcx>) -> ty::PolyFnSig<'tcx> { let sig = match self.entry(id).kind { EntryKind::Fn(data) | diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs index b7b9a739371e1..ee7ffa1b06628 100644 --- a/src/librustc_metadata/encoder.rs +++ b/src/librustc_metadata/encoder.rs @@ -42,7 +42,7 @@ use rustc::hir::intravisit; pub struct EncodeContext<'tcx> { opaque: opaque::Encoder, - pub tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + pub tcx: TyCtxt<'tcx, 'tcx>, entries_index: Index<'tcx>, @@ -1818,7 +1818,7 @@ impl EncodeContext<'tcx> { } struct ImplVisitor<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, impls: FxHashMap>, } @@ -1865,7 +1865,7 @@ impl<'tcx, 'v> ItemLikeVisitor<'v> for ImplVisitor<'tcx> { // will allow us to slice the metadata to the precise length that we just // generated regardless of trailing bytes that end up in it. -pub fn encode_metadata<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) +pub fn encode_metadata<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) -> EncodedMetadata { let mut encoder = opaque::Encoder::new(vec![]); @@ -1909,7 +1909,7 @@ pub fn encode_metadata<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) EncodedMetadata { raw_data: result } } -pub fn get_repr_options<'tcx, 'gcx>(tcx: TyCtxt<'gcx, 'tcx, 'gcx>, did: DefId) -> ReprOptions { +pub fn get_repr_options<'tcx, 'gcx>(tcx: TyCtxt<'tcx, 'gcx>, did: DefId) -> ReprOptions { let ty = tcx.type_of(did); match ty.sty { ty::Adt(ref def, _) => return def.repr, diff --git a/src/librustc_metadata/foreign_modules.rs b/src/librustc_metadata/foreign_modules.rs index f3e1e3ad80d89..7520fb607c5fa 100644 --- a/src/librustc_metadata/foreign_modules.rs +++ b/src/librustc_metadata/foreign_modules.rs @@ -3,7 +3,7 @@ use rustc::hir; use rustc::middle::cstore::ForeignModule; use rustc::ty::TyCtxt; -pub fn collect<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Vec { +pub fn collect<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) -> Vec { let mut collector = Collector { tcx, modules: Vec::new(), @@ -13,7 +13,7 @@ pub fn collect<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Vec { } struct Collector<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, modules: Vec, } diff --git a/src/librustc_metadata/link_args.rs b/src/librustc_metadata/link_args.rs index 7e99e3d8a4c3c..1c50b0f293a62 100644 --- a/src/librustc_metadata/link_args.rs +++ b/src/librustc_metadata/link_args.rs @@ -4,7 +4,7 @@ use rustc::ty::TyCtxt; use rustc_target::spec::abi::Abi; use syntax::symbol::sym; -pub fn collect<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Vec { +pub fn collect<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) -> Vec { let mut collector = Collector { args: Vec::new(), }; diff --git a/src/librustc_metadata/native_libs.rs b/src/librustc_metadata/native_libs.rs index 801acbfd34699..bcd91eb22cf1f 100644 --- a/src/librustc_metadata/native_libs.rs +++ b/src/librustc_metadata/native_libs.rs @@ -11,7 +11,7 @@ use syntax::feature_gate::{self, GateIssue}; use syntax::symbol::{Symbol, sym}; use syntax::{span_err, struct_span_err}; -pub fn collect<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Vec { +pub fn collect<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) -> Vec { let mut collector = Collector { tcx, libs: Vec::new(), @@ -29,7 +29,7 @@ pub fn relevant_lib(sess: &Session, lib: &NativeLibrary) -> bool { } struct Collector<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, libs: Vec, } diff --git a/src/librustc_mir/borrow_check/borrow_set.rs b/src/librustc_mir/borrow_check/borrow_set.rs index e1425ed24300d..85a5669dfe142 100644 --- a/src/librustc_mir/borrow_check/borrow_set.rs +++ b/src/librustc_mir/borrow_check/borrow_set.rs @@ -122,7 +122,7 @@ impl LocalsStateAtExit { impl<'tcx> BorrowSet<'tcx> { pub fn build( - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, body: &Body<'tcx>, locals_are_invalidated_at_exit: bool, move_data: &MoveData<'tcx> @@ -162,7 +162,7 @@ impl<'tcx> BorrowSet<'tcx> { } struct GatherBorrows<'a, 'gcx: 'tcx, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, body: &'a Body<'tcx>, idx_vec: IndexVec>, location_map: FxHashMap, diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs index 1bcdf22672093..60ad8921c0b3d 100644 --- a/src/librustc_mir/borrow_check/mod.rs +++ b/src/librustc_mir/borrow_check/mod.rs @@ -87,7 +87,7 @@ pub fn provide(providers: &mut Providers<'_>) { }; } -fn mir_borrowck<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> BorrowCheckResult<'tcx> { +fn mir_borrowck<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> BorrowCheckResult<'tcx> { let input_body = tcx.mir_validated(def_id); debug!("run query mir_borrowck: {}", tcx.def_path_str(def_id)); diff --git a/src/librustc_mir/borrow_check/move_errors.rs b/src/librustc_mir/borrow_check/move_errors.rs index a7f3022019c1a..a010338a08d12 100644 --- a/src/librustc_mir/borrow_check/move_errors.rs +++ b/src/librustc_mir/borrow_check/move_errors.rs @@ -96,7 +96,7 @@ impl BorrowedContentSource<'tcx> { } } - fn from_call(func: Ty<'tcx>, tcx: TyCtxt<'tcx, '_, 'tcx>) -> Option { + fn from_call(func: Ty<'tcx>, tcx: TyCtxt<'_, 'tcx>) -> Option { match func.sty { ty::FnDef(def_id, substs) => { let trait_id = tcx.trait_of_item(def_id)?; diff --git a/src/librustc_mir/borrow_check/mutability_errors.rs b/src/librustc_mir/borrow_check/mutability_errors.rs index 38e6e55e40a97..ccdde320df06e 100644 --- a/src/librustc_mir/borrow_check/mutability_errors.rs +++ b/src/librustc_mir/borrow_check/mutability_errors.rs @@ -523,7 +523,7 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> { } fn suggest_ampmut_self<'gcx, 'tcx>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, local_decl: &mir::LocalDecl<'tcx>, ) -> (Span, String) { let sp = local_decl.source_info.span; @@ -556,7 +556,7 @@ fn suggest_ampmut_self<'gcx, 'tcx>( // This implementation attempts to emulate AST-borrowck prioritization // by trying (3.), then (2.) and finally falling back on (1.). fn suggest_ampmut<'gcx, 'tcx>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, body: &Body<'tcx>, local: Local, local_decl: &mir::LocalDecl<'tcx>, @@ -623,7 +623,7 @@ fn is_closure_or_generator(ty: Ty<'_>) -> bool { /// | ---------- use `&'a mut String` here to make mutable /// ``` fn annotate_struct_field( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, ty: Ty<'tcx>, field: &mir::Field, ) -> Option<(Span, String)> { diff --git a/src/librustc_mir/borrow_check/nll/explain_borrow/find_use.rs b/src/librustc_mir/borrow_check/nll/explain_borrow/find_use.rs index c0848f2afe633..5563bdcaebf27 100644 --- a/src/librustc_mir/borrow_check/nll/explain_borrow/find_use.rs +++ b/src/librustc_mir/borrow_check/nll/explain_borrow/find_use.rs @@ -12,7 +12,7 @@ use rustc_data_structures::fx::FxHashSet; crate fn find<'tcx>( body: &Body<'tcx>, regioncx: &Rc>, - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, region_vid: RegionVid, start_point: Location, ) -> Option { @@ -30,7 +30,7 @@ crate fn find<'tcx>( struct UseFinder<'cx, 'gcx: 'tcx, 'tcx: 'cx> { body: &'cx Body<'tcx>, regioncx: &'cx Rc>, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, region_vid: RegionVid, start_point: Location, } @@ -101,7 +101,7 @@ impl<'cx, 'gcx, 'tcx> UseFinder<'cx, 'gcx, 'tcx> { struct DefUseVisitor<'cx, 'gcx: 'tcx, 'tcx: 'cx> { body: &'cx Body<'tcx>, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, region_vid: RegionVid, def_use_result: Option, } diff --git a/src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs b/src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs index 534a91d39a0ce..a8b197135b0a0 100644 --- a/src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs +++ b/src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs @@ -53,7 +53,7 @@ impl BorrowExplanation { } pub(in crate::borrow_check) fn add_explanation_to_diagnostic<'gcx, 'tcx>( &self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, body: &Body<'tcx>, err: &mut DiagnosticBuilder<'_>, borrow_desc: &str, diff --git a/src/librustc_mir/borrow_check/nll/facts.rs b/src/librustc_mir/borrow_check/nll/facts.rs index 926f52b7cfce8..fdeec036ad043 100644 --- a/src/librustc_mir/borrow_check/nll/facts.rs +++ b/src/librustc_mir/borrow_check/nll/facts.rs @@ -15,7 +15,7 @@ crate type AllFacts = PoloniusAllFacts; crate trait AllFactsExt { /// Returns `true` if there is a need to gather `AllFacts` given the /// current `-Z` flags. - fn enabled(tcx: TyCtxt<'_, '_, '_>) -> bool; + fn enabled(tcx: TyCtxt<'_, '_>) -> bool; fn write_to_dir( &self, @@ -26,7 +26,7 @@ crate trait AllFactsExt { impl AllFactsExt for AllFacts { /// Return - fn enabled(tcx: TyCtxt<'_, '_, '_>) -> bool { + fn enabled(tcx: TyCtxt<'_, '_>) -> bool { tcx.sess.opts.debugging_opts.nll_facts || tcx.sess.opts.debugging_opts.polonius } diff --git a/src/librustc_mir/borrow_check/nll/invalidation.rs b/src/librustc_mir/borrow_check/nll/invalidation.rs index 5a8de5c9dbdda..12433ca365d68 100644 --- a/src/librustc_mir/borrow_check/nll/invalidation.rs +++ b/src/librustc_mir/borrow_check/nll/invalidation.rs @@ -18,7 +18,7 @@ use rustc::mir::{Operand, BorrowKind}; use rustc_data_structures::graph::dominators::Dominators; pub(super) fn generate_invalidates<'gcx, 'tcx>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, all_facts: &mut Option, location_table: &LocationTable, body: &Body<'tcx>, @@ -44,7 +44,7 @@ pub(super) fn generate_invalidates<'gcx, 'tcx>( } struct InvalidationGenerator<'cx, 'tcx: 'cx, 'gcx: 'tcx> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, all_facts: &'cx mut AllFacts, location_table: &'cx LocationTable, body: &'cx Body<'tcx>, diff --git a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs index 2338d6a846674..a263d3be3a547 100644 --- a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs +++ b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs @@ -194,7 +194,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { /// named variants. fn give_name_from_error_region( &self, - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, mir_def_id: DefId, fr: RegionVid, counter: &mut usize, @@ -303,7 +303,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { /// ``` fn get_named_span( &self, - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, error_region: &RegionKind, name: InternedString, ) -> Span { @@ -461,7 +461,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { /// to highlighting that closest type instead. fn give_name_if_we_can_match_hir_ty( &self, - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, needle_fr: RegionVid, argument_ty: Ty<'tcx>, argument_hir_ty: &hir::Ty, @@ -653,7 +653,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { /// ``` fn give_name_if_anonymous_region_appears_in_upvars( &self, - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, upvars: &[Upvar], fr: RegionVid, counter: &mut usize, diff --git a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/var_name.rs b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/var_name.rs index 77aeb401445a0..882a52a0c4565 100644 --- a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/var_name.rs +++ b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/var_name.rs @@ -10,7 +10,7 @@ use syntax_pos::symbol::Symbol; impl<'tcx> RegionInferenceContext<'tcx> { crate fn get_var_name_and_span_for_region( &self, - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, body: &Body<'tcx>, upvars: &[Upvar], fr: RegionVid, @@ -35,7 +35,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { /// Search the upvars (if any) to find one that references fr. Return its index. crate fn get_upvar_index_for_region( &self, - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, fr: RegionVid, ) -> Option { let upvar_index = self @@ -69,7 +69,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { /// declared. crate fn get_upvar_name_and_span_for_region( &self, - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, upvars: &[Upvar], upvar_index: usize, ) -> (Symbol, Span) { @@ -91,7 +91,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { /// user - in particular, index 0 is not the implicit self parameter. crate fn get_argument_index_for_region( &self, - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, fr: RegionVid, ) -> Option { let implicit_inputs = self.universal_regions.defining_ty.implicit_inputs(); diff --git a/src/librustc_mir/borrow_check/nll/region_infer/mod.rs b/src/librustc_mir/borrow_check/nll/region_infer/mod.rs index a2213f0c7eb58..13606f61a689c 100644 --- a/src/librustc_mir/borrow_check/nll/region_infer/mod.rs +++ b/src/librustc_mir/borrow_check/nll/region_infer/mod.rs @@ -370,7 +370,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { } /// Adds annotations for `#[rustc_regions]`; see `UniversalRegions::annotate`. - crate fn annotate(&self, tcx: TyCtxt<'tcx, '_, 'tcx>, err: &mut DiagnosticBuilder<'_>) { + crate fn annotate(&self, tcx: TyCtxt<'_, 'tcx>, err: &mut DiagnosticBuilder<'_>) { self.universal_regions.annotate(tcx, err) } @@ -943,7 +943,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { /// `point`. fn eval_verify_bound( &self, - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, body: &Body<'tcx>, generic_ty: Ty<'tcx>, lower_bound: RegionVid, @@ -976,7 +976,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { fn eval_if_eq( &self, - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, body: &Body<'tcx>, generic_ty: Ty<'tcx>, lower_bound: RegionVid, @@ -1022,7 +1022,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { /// higher-ranked things and so forth, and right now the inference /// context is not permitted to make more inference variables. So /// we use this kind of hacky solution. - fn normalize_to_scc_representatives(&self, tcx: TyCtxt<'tcx, '_, 'tcx>, value: T) -> T + fn normalize_to_scc_representatives(&self, tcx: TyCtxt<'_, 'tcx>, value: T) -> T where T: TypeFoldable<'tcx>, { @@ -1368,14 +1368,14 @@ impl<'tcx> RegionDefinition<'tcx> { pub trait ClosureRegionRequirementsExt<'gcx, 'tcx> { fn apply_requirements( &self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, closure_def_id: DefId, closure_substs: SubstsRef<'tcx>, ) -> Vec>; fn subst_closure_mapping( &self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, closure_mapping: &IndexVec>, value: &T, ) -> T @@ -1398,7 +1398,7 @@ impl<'gcx, 'tcx> ClosureRegionRequirementsExt<'gcx, 'tcx> for ClosureRegionRequi /// requirements. fn apply_requirements( &self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, closure_def_id: DefId, closure_substs: SubstsRef<'tcx>, ) -> Vec> { @@ -1453,7 +1453,7 @@ impl<'gcx, 'tcx> ClosureRegionRequirementsExt<'gcx, 'tcx> for ClosureRegionRequi fn subst_closure_mapping( &self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, closure_mapping: &IndexVec>, value: &T, ) -> T diff --git a/src/librustc_mir/borrow_check/nll/type_check/constraint_conversion.rs b/src/librustc_mir/borrow_check/nll/type_check/constraint_conversion.rs index 381e18f60a2e0..01dd60cc4891c 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/constraint_conversion.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/constraint_conversion.rs @@ -15,7 +15,7 @@ use syntax_pos::DUMMY_SP; crate struct ConstraintConversion<'a, 'gcx: 'tcx, 'tcx: 'a> { infcx: &'a InferCtxt<'a, 'gcx, 'tcx>, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, universal_regions: &'a UniversalRegions<'tcx>, region_bound_pairs: &'a RegionBoundPairs<'tcx>, implicit_region_bound: Option>, diff --git a/src/librustc_mir/borrow_check/nll/type_check/liveness/mod.rs b/src/librustc_mir/borrow_check/nll/type_check/liveness/mod.rs index f4ceb36858e07..240588b1c88d3 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/liveness/mod.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/liveness/mod.rs @@ -75,7 +75,7 @@ pub(super) fn generate<'gcx, 'tcx>( // some region `R` in its type where `R` is not known to outlive a free // region (i.e., where `R` may be valid for just a subset of the fn body). fn compute_live_locals( - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, free_regions: &FxHashSet, body: &Body<'tcx>, ) -> Vec { diff --git a/src/librustc_mir/borrow_check/nll/type_check/mod.rs b/src/librustc_mir/borrow_check/nll/type_check/mod.rs index 75d5987af0bc1..bbfffc68b9692 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/mod.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/mod.rs @@ -235,7 +235,7 @@ fn translate_outlives_facts(cx: &mut BorrowCheckContext<'_, '_>) { } } -fn mirbug(tcx: TyCtxt<'_, '_, '_>, span: Span, msg: &str) { +fn mirbug(tcx: TyCtxt<'_, '_>, span: Span, msg: &str) { // We sometimes see MIR failures (notably predicate failures) due to // the fact that we check rvalue sized predicates here. So use `delay_span_bug` // to avoid reporting bugs in those cases. @@ -391,7 +391,7 @@ impl<'a, 'b, 'gcx, 'tcx> TypeVerifier<'a, 'b, 'gcx, 'tcx> { } } - fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.cx.infcx.tcx } @@ -1313,7 +1313,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { Ok(()) } - fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.infcx.tcx } @@ -2504,7 +2504,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { fn prove_closure_bounds( &mut self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, def_id: DefId, substs: SubstsRef<'tcx>, location: Location, diff --git a/src/librustc_mir/borrow_check/nll/universal_regions.rs b/src/librustc_mir/borrow_check/nll/universal_regions.rs index 76b1acc52ba31..6e64a6fae58d6 100644 --- a/src/librustc_mir/borrow_check/nll/universal_regions.rs +++ b/src/librustc_mir/borrow_check/nll/universal_regions.rs @@ -106,7 +106,7 @@ impl<'tcx> DefiningTy<'tcx> { /// not a closure or generator, there are no upvars, and hence it /// will be an empty list. The order of types in this list will /// match up with the upvar order in the HIR, typesystem, and MIR. - pub fn upvar_tys(self, tcx: TyCtxt<'tcx, '_, 'tcx>) -> impl Iterator> + 'tcx { + pub fn upvar_tys(self, tcx: TyCtxt<'_, 'tcx>) -> impl Iterator> + 'tcx { match self { DefiningTy::Closure(def_id, substs) => Either::Left(substs.upvar_tys(def_id, tcx)), DefiningTy::Generator(def_id, substs, _) => { @@ -218,7 +218,7 @@ impl<'tcx> UniversalRegions<'tcx> { /// `'1: '2`, then the caller would impose the constraint that /// `V[1]: V[2]`. pub fn closure_mapping( - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, closure_substs: SubstsRef<'tcx>, expected_num_vars: usize, closure_base_def_id: DefId, @@ -305,7 +305,7 @@ impl<'tcx> UniversalRegions<'tcx> { /// that this region imposes on others. The methods in this file /// handle the part about dumping the inference context internal /// state. - crate fn annotate(&self, tcx: TyCtxt<'tcx, '_, 'tcx>, err: &mut DiagnosticBuilder<'_>) { + crate fn annotate(&self, tcx: TyCtxt<'_, 'tcx>, err: &mut DiagnosticBuilder<'_>) { match self.defining_ty { DefiningTy::Closure(def_id, substs) => { err.note(&format!( @@ -744,7 +744,7 @@ impl<'tcx> UniversalRegionIndices<'tcx> { /// Replaces all free regions in `value` with region vids, as /// returned by `to_region_vid`. - pub fn fold_to_region_vids(&self, tcx: TyCtxt<'tcx, '_, 'tcx>, value: &T) -> T + pub fn fold_to_region_vids(&self, tcx: TyCtxt<'_, 'tcx>, value: &T) -> T where T: TypeFoldable<'tcx>, { @@ -757,7 +757,7 @@ impl<'tcx> UniversalRegionIndices<'tcx> { /// Iterates over the late-bound regions defined on fn_def_id and /// invokes `f` with the liberated form of each one. fn for_each_late_bound_region_defined_on<'tcx>( - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, fn_def_id: DefId, mut f: impl FnMut(ty::Region<'tcx>), ) { diff --git a/src/librustc_mir/borrow_check/path_utils.rs b/src/librustc_mir/borrow_check/path_utils.rs index 44d2916daa584..10a92253f9f64 100644 --- a/src/librustc_mir/borrow_check/path_utils.rs +++ b/src/librustc_mir/borrow_check/path_utils.rs @@ -24,7 +24,7 @@ pub(super) enum Control { /// Encapsulates the idea of iterating over every borrow that involves a particular path pub(super) fn each_borrow_involving_path<'tcx, 'gcx: 'tcx, F, I, S> ( s: &mut S, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, body: &Body<'tcx>, _location: Location, access_place: (AccessDepth, &Place<'tcx>), diff --git a/src/librustc_mir/borrow_check/place_ext.rs b/src/librustc_mir/borrow_check/place_ext.rs index d0c05318d90f3..b969f0fd3c7aa 100644 --- a/src/librustc_mir/borrow_check/place_ext.rs +++ b/src/librustc_mir/borrow_check/place_ext.rs @@ -12,7 +12,7 @@ crate trait PlaceExt<'tcx> { /// for borrows of raw pointer dereferents as well as shared references. fn ignore_borrow( &self, - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, body: &Body<'tcx>, locals_state_at_exit: &LocalsStateAtExit, ) -> bool; @@ -21,7 +21,7 @@ crate trait PlaceExt<'tcx> { impl<'tcx> PlaceExt<'tcx> for Place<'tcx> { fn ignore_borrow( &self, - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, body: &Body<'tcx>, locals_state_at_exit: &LocalsStateAtExit, ) -> bool { diff --git a/src/librustc_mir/borrow_check/places_conflict.rs b/src/librustc_mir/borrow_check/places_conflict.rs index 858ca958ca186..c1cbfd9e3c0ba 100644 --- a/src/librustc_mir/borrow_check/places_conflict.rs +++ b/src/librustc_mir/borrow_check/places_conflict.rs @@ -25,7 +25,7 @@ crate enum PlaceConflictBias { /// This is used to check for places conflicting outside of the borrow checking code (such as in /// dataflow). crate fn places_conflict<'gcx, 'tcx>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, body: &Body<'tcx>, borrow_place: &Place<'tcx>, access_place: &Place<'tcx>, @@ -47,7 +47,7 @@ crate fn places_conflict<'gcx, 'tcx>( /// array indices, for example) should be interpreted - this depends on what the caller wants in /// order to make the conservative choice and preserve soundness. pub(super) fn borrow_conflicts_with_place<'gcx, 'tcx>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, body: &Body<'tcx>, borrow_place: &Place<'tcx>, borrow_kind: BorrowKind, @@ -84,7 +84,7 @@ pub(super) fn borrow_conflicts_with_place<'gcx, 'tcx>( } fn place_components_conflict<'gcx, 'tcx>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, body: &Body<'tcx>, borrow_projections: (&PlaceBase<'tcx>, ProjectionsIter<'_, 'tcx>), borrow_kind: BorrowKind, @@ -299,7 +299,7 @@ fn place_components_conflict<'gcx, 'tcx>( // or disjoint (and have the same type!), return the overlap situation // between `elem1` and `elem2`. fn place_base_conflict<'gcx: 'tcx, 'tcx>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, elem1: &PlaceBase<'tcx>, elem2: &PlaceBase<'tcx>, ) -> Overlap { @@ -366,7 +366,7 @@ fn place_base_conflict<'gcx: 'tcx, 'tcx>( // or disjoint (and have the same type!), return the overlap situation // between `elem1` and `elem2`. fn place_projection_conflict<'gcx: 'tcx, 'tcx>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, body: &Body<'tcx>, pi1: &Projection<'tcx>, pi2: &Projection<'tcx>, diff --git a/src/librustc_mir/borrow_check/prefixes.rs b/src/librustc_mir/borrow_check/prefixes.rs index b7af985ad494c..dd4aac0330c1e 100644 --- a/src/librustc_mir/borrow_check/prefixes.rs +++ b/src/librustc_mir/borrow_check/prefixes.rs @@ -39,7 +39,7 @@ impl<'tcx> IsPrefixOf<'tcx> for Place<'tcx> { pub(super) struct Prefixes<'cx, 'gcx: 'tcx, 'tcx: 'cx> { body: &'cx Body<'tcx>, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, kind: PrefixSet, next: Option<&'cx Place<'tcx>>, } diff --git a/src/librustc_mir/build/mod.rs b/src/librustc_mir/build/mod.rs index 564e2ddc64b3f..f4b6f438163f9 100644 --- a/src/librustc_mir/build/mod.rs +++ b/src/librustc_mir/build/mod.rs @@ -25,7 +25,7 @@ use syntax_pos::Span; use super::lints; /// Construct the MIR for a given `DefId`. -pub fn mir_build<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> Body<'tcx> { +pub fn mir_build<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> Body<'tcx> { let id = tcx.hir().as_local_hir_id(def_id).unwrap(); // Figure out what primary body this item has. @@ -185,7 +185,7 @@ pub fn mir_build<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> Body<'tc /// to the global tcx. Sadly, we don't have a "folder" that /// can change `'tcx` so we have to transmute afterwards. struct GlobalizeMir<'gcx> { - tcx: TyCtxt<'gcx, 'gcx, 'gcx>, + tcx: TyCtxt<'gcx, 'gcx>, span: Span } @@ -234,7 +234,7 @@ impl<'gcx: 'tcx, 'tcx> MutVisitor<'tcx> for GlobalizeMir<'gcx> { /////////////////////////////////////////////////////////////////////////// // BuildMir -- walks a crate, looking for fn items and methods to build MIR from -fn liberated_closure_env_ty<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, +fn liberated_closure_env_ty<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, closure_expr_id: hir::HirId, body_id: hir::BodyId) -> Ty<'tcx> { @@ -551,7 +551,7 @@ macro_rules! unpack { }; } -fn should_abort_on_panic<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, +fn should_abort_on_panic<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, fn_def_id: DefId, abi: Abi) -> bool { diff --git a/src/librustc_mir/const_eval.rs b/src/librustc_mir/const_eval.rs index eb2680f749b75..458e68cfcc59e 100644 --- a/src/librustc_mir/const_eval.rs +++ b/src/librustc_mir/const_eval.rs @@ -44,7 +44,7 @@ const DETECTOR_SNAPSHOT_PERIOD: isize = 256; /// of a function's generic parameter will require knowledge about the bounds on the generic /// parameter. These bounds are passed to `mk_eval_cx` via the `ParamEnv` argument. pub(crate) fn mk_eval_cx<'mir, 'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, span: Span, param_env: ty::ParamEnv<'tcx>, ) -> CompileTimeEvalContext<'mir, 'tcx> { @@ -53,7 +53,7 @@ pub(crate) fn mk_eval_cx<'mir, 'tcx>( } pub(crate) fn eval_promoted<'mir, 'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, cid: GlobalId<'tcx>, body: &'mir mir::Body<'tcx>, param_env: ty::ParamEnv<'tcx>, @@ -474,7 +474,7 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> // this function uses `unwrap` copiously, because an already validated constant must have valid // fields and can thus never fail outside of compiler bugs pub fn const_field<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, variant: Option, field: mir::Field, @@ -499,7 +499,7 @@ pub fn const_field<'tcx>( // this function uses `unwrap` copiously, because an already validated constant must have valid // fields and can thus never fail outside of compiler bugs pub fn const_variant_index<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, val: &'tcx ty::Const<'tcx>, ) -> VariantIdx { @@ -519,7 +519,7 @@ pub fn error_to_const_error<'mir, 'tcx>( } fn validate_and_turn_into_const<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, constant: RawConst<'tcx>, key: ty::ParamEnvAnd<'tcx, GlobalId<'tcx>>, ) -> ::rustc::mir::interpret::ConstEvalResult<'tcx> { @@ -562,7 +562,7 @@ fn validate_and_turn_into_const<'tcx>( } pub fn const_eval_provider<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, key: ty::ParamEnvAnd<'tcx, GlobalId<'tcx>>, ) -> ::rustc::mir::interpret::ConstEvalResult<'tcx> { // see comment in const_eval_provider for what we're doing here @@ -586,7 +586,7 @@ pub fn const_eval_provider<'tcx>( } pub fn const_eval_raw_provider<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, key: ty::ParamEnvAnd<'tcx, GlobalId<'tcx>>, ) -> ::rustc::mir::interpret::ConstEvalRawResult<'tcx> { // Because the constant is computed twice (once per value of `Reveal`), we are at risk of diff --git a/src/librustc_mir/dataflow/drop_flag_effects.rs b/src/librustc_mir/dataflow/drop_flag_effects.rs index f7cc8c22b0451..6a536dc427bee 100644 --- a/src/librustc_mir/dataflow/drop_flag_effects.rs +++ b/src/librustc_mir/dataflow/drop_flag_effects.rs @@ -46,7 +46,7 @@ pub fn move_path_children_matching<'tcx, F>(move_data: &MoveData<'tcx>, /// is no need to maintain separate drop flags to track such state. // // FIXME: we have to do something for moving slice patterns. -fn place_contents_drop_state_cannot_differ<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, +fn place_contents_drop_state_cannot_differ<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, body: &Body<'tcx>, place: &mir::Place<'tcx>) -> bool { let ty = place.ty(body, tcx).ty; @@ -73,7 +73,7 @@ fn place_contents_drop_state_cannot_differ<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, ' } pub(crate) fn on_lookup_result_bits<'gcx, 'tcx, F>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, body: &Body<'tcx>, move_data: &MoveData<'tcx>, lookup_result: LookupResult, @@ -91,7 +91,7 @@ pub(crate) fn on_lookup_result_bits<'gcx, 'tcx, F>( } pub(crate) fn on_all_children_bits<'gcx, 'tcx, F>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, body: &Body<'tcx>, move_data: &MoveData<'tcx>, move_path_index: MovePathIndex, @@ -99,7 +99,7 @@ pub(crate) fn on_all_children_bits<'gcx, 'tcx, F>( where F: FnMut(MovePathIndex) { fn is_terminal_path<'gcx, 'tcx>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, body: &Body<'tcx>, move_data: &MoveData<'tcx>, path: MovePathIndex) -> bool @@ -109,7 +109,7 @@ pub(crate) fn on_all_children_bits<'gcx, 'tcx, F>( } fn on_all_children_bits<'gcx, 'tcx, F>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, body: &Body<'tcx>, move_data: &MoveData<'tcx>, move_path_index: MovePathIndex, @@ -132,7 +132,7 @@ pub(crate) fn on_all_children_bits<'gcx, 'tcx, F>( } pub(crate) fn on_all_drop_children_bits<'gcx, 'tcx, F>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, body: &Body<'tcx>, ctxt: &MoveDataParamEnv<'gcx, 'tcx>, path: MovePathIndex, @@ -155,7 +155,7 @@ pub(crate) fn on_all_drop_children_bits<'gcx, 'tcx, F>( } pub(crate) fn drop_flag_effects_for_function_entry<'gcx, 'tcx, F>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, body: &Body<'tcx>, ctxt: &MoveDataParamEnv<'gcx, 'tcx>, mut callback: F) @@ -172,7 +172,7 @@ pub(crate) fn drop_flag_effects_for_function_entry<'gcx, 'tcx, F>( } pub(crate) fn drop_flag_effects_for_location<'gcx, 'tcx, F>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, body: &Body<'tcx>, ctxt: &MoveDataParamEnv<'gcx, 'tcx>, loc: Location, @@ -204,7 +204,7 @@ pub(crate) fn drop_flag_effects_for_location<'gcx, 'tcx, F>( } pub(crate) fn for_location_inits<'gcx, 'tcx, F>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, body: &Body<'tcx>, move_data: &MoveData<'tcx>, loc: Location, diff --git a/src/librustc_mir/dataflow/impls/borrows.rs b/src/librustc_mir/dataflow/impls/borrows.rs index 38cb7bd9796c6..ba38ef91ebe46 100644 --- a/src/librustc_mir/dataflow/impls/borrows.rs +++ b/src/librustc_mir/dataflow/impls/borrows.rs @@ -30,7 +30,7 @@ newtype_index! { /// describing the borrow. These indexes are used for representing the /// borrows in compact bitvectors. pub struct Borrows<'a, 'gcx: 'tcx, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, body: &'a Body<'tcx>, borrow_set: Rc>, @@ -135,7 +135,7 @@ fn precompute_borrows_out_of_scope<'tcx>( impl<'a, 'gcx, 'tcx> Borrows<'a, 'gcx, 'tcx> { crate fn new( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, body: &'a Body<'tcx>, nonlexical_regioncx: Rc>, borrow_set: &Rc>, diff --git a/src/librustc_mir/dataflow/impls/mod.rs b/src/librustc_mir/dataflow/impls/mod.rs index 3311353ebd3b6..c1d302744858e 100644 --- a/src/librustc_mir/dataflow/impls/mod.rs +++ b/src/librustc_mir/dataflow/impls/mod.rs @@ -64,13 +64,13 @@ pub(super) mod borrows; /// between this data and `MaybeUninitializedPlaces` yields the set of /// places that would require a dynamic drop-flag at that statement. pub struct MaybeInitializedPlaces<'a, 'gcx: 'tcx, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, body: &'a Body<'tcx>, mdpe: &'a MoveDataParamEnv<'gcx, 'tcx>, } impl<'a, 'gcx: 'tcx, 'tcx> MaybeInitializedPlaces<'a, 'gcx, 'tcx> { - pub fn new(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + pub fn new(tcx: TyCtxt<'gcx, 'tcx>, body: &'a Body<'tcx>, mdpe: &'a MoveDataParamEnv<'gcx, 'tcx>) -> Self @@ -119,13 +119,13 @@ impl<'a, 'gcx, 'tcx> HasMoveData<'tcx> for MaybeInitializedPlaces<'a, 'gcx, 'tcx /// between this data and `MaybeInitializedPlaces` yields the set of /// places that would require a dynamic drop-flag at that statement. pub struct MaybeUninitializedPlaces<'a, 'gcx: 'tcx, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, body: &'a Body<'tcx>, mdpe: &'a MoveDataParamEnv<'gcx, 'tcx>, } impl<'a, 'gcx, 'tcx> MaybeUninitializedPlaces<'a, 'gcx, 'tcx> { - pub fn new(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + pub fn new(tcx: TyCtxt<'gcx, 'tcx>, body: &'a Body<'tcx>, mdpe: &'a MoveDataParamEnv<'gcx, 'tcx>) -> Self @@ -173,13 +173,13 @@ impl<'a, 'gcx, 'tcx> HasMoveData<'tcx> for MaybeUninitializedPlaces<'a, 'gcx, 't /// this data and `MaybeInitializedPlaces` yields the set of places /// that would require a dynamic drop-flag at that statement. pub struct DefinitelyInitializedPlaces<'a, 'gcx: 'tcx, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, body: &'a Body<'tcx>, mdpe: &'a MoveDataParamEnv<'gcx, 'tcx>, } impl<'a, 'gcx, 'tcx: 'a> DefinitelyInitializedPlaces<'a, 'gcx, 'tcx> { - pub fn new(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + pub fn new(tcx: TyCtxt<'gcx, 'tcx>, body: &'a Body<'tcx>, mdpe: &'a MoveDataParamEnv<'gcx, 'tcx>) -> Self @@ -222,13 +222,13 @@ impl<'a, 'gcx, 'tcx: 'a> HasMoveData<'tcx> for DefinitelyInitializedPlaces<'a, ' /// } /// ``` pub struct EverInitializedPlaces<'a, 'gcx: 'tcx, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, body: &'a Body<'tcx>, mdpe: &'a MoveDataParamEnv<'gcx, 'tcx>, } impl<'a, 'gcx: 'tcx, 'tcx: 'a> EverInitializedPlaces<'a, 'gcx, 'tcx> { - pub fn new(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + pub fn new(tcx: TyCtxt<'gcx, 'tcx>, body: &'a Body<'tcx>, mdpe: &'a MoveDataParamEnv<'gcx, 'tcx>) -> Self diff --git a/src/librustc_mir/dataflow/mod.rs b/src/librustc_mir/dataflow/mod.rs index 89b379b95b84c..ae7690554f84e 100644 --- a/src/librustc_mir/dataflow/mod.rs +++ b/src/librustc_mir/dataflow/mod.rs @@ -121,7 +121,7 @@ pub struct MoveDataParamEnv<'gcx, 'tcx> { pub(crate) param_env: ty::ParamEnv<'gcx>, } -pub(crate) fn do_dataflow<'a, 'gcx, 'tcx, BD, P>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, +pub(crate) fn do_dataflow<'a, 'gcx, 'tcx, BD, P>(tcx: TyCtxt<'gcx, 'tcx>, body: &'a Body<'tcx>, def_id: DefId, attributes: &[ast::Attribute], @@ -139,7 +139,7 @@ pub(crate) fn do_dataflow<'a, 'gcx, 'tcx, BD, P>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, impl<'a, 'gcx: 'tcx, 'tcx: 'a, BD> DataflowAnalysis<'a, 'tcx, BD> where BD: BitDenotation<'tcx> { pub(crate) fn run

(self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, def_id: DefId, attributes: &[ast::Attribute], p: P) -> DataflowResults<'tcx, BD> diff --git a/src/librustc_mir/dataflow/move_paths/builder.rs b/src/librustc_mir/dataflow/move_paths/builder.rs index ecc252adb6dc0..e437620272134 100644 --- a/src/librustc_mir/dataflow/move_paths/builder.rs +++ b/src/librustc_mir/dataflow/move_paths/builder.rs @@ -14,13 +14,13 @@ use super::IllegalMoveOriginKind::*; struct MoveDataBuilder<'a, 'gcx: 'tcx, 'tcx: 'a> { body: &'a Body<'tcx>, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, data: MoveData<'tcx>, errors: Vec<(Place<'tcx>, MoveError<'tcx>)>, } impl<'a, 'gcx, 'tcx> MoveDataBuilder<'a, 'gcx, 'tcx> { - fn new(body: &'a Body<'tcx>, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Self { + fn new(body: &'a Body<'tcx>, tcx: TyCtxt<'gcx, 'tcx>) -> Self { let mut move_paths = IndexVec::new(); let mut path_map = IndexVec::new(); let mut init_path_map = IndexVec::new(); @@ -204,7 +204,7 @@ impl<'a, 'gcx, 'tcx> MoveDataBuilder<'a, 'gcx, 'tcx> { pub(super) fn gather_moves<'gcx, 'tcx>( body: &Body<'tcx>, - tcx: TyCtxt<'tcx, 'gcx, 'tcx> + tcx: TyCtxt<'gcx, 'tcx> ) -> Result, (MoveData<'tcx>, Vec<(Place<'tcx>, MoveError<'tcx>)>)> { let mut builder = MoveDataBuilder::new(body, tcx); diff --git a/src/librustc_mir/dataflow/move_paths/mod.rs b/src/librustc_mir/dataflow/move_paths/mod.rs index 2d8d3a28fd6f1..aa8a1e54a6570 100644 --- a/src/librustc_mir/dataflow/move_paths/mod.rs +++ b/src/librustc_mir/dataflow/move_paths/mod.rs @@ -306,7 +306,7 @@ impl<'tcx> MoveError<'tcx> { } impl<'gcx, 'tcx> MoveData<'tcx> { - pub fn gather_moves(body: &Body<'tcx>, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) + pub fn gather_moves(body: &Body<'tcx>, tcx: TyCtxt<'gcx, 'tcx>) -> Result, MoveError<'tcx>)>)> { builder::gather_moves(body, tcx) } diff --git a/src/librustc_mir/hair/constant.rs b/src/librustc_mir/hair/constant.rs index 04eeb6333fd93..934baa55a9043 100644 --- a/src/librustc_mir/hair/constant.rs +++ b/src/librustc_mir/hair/constant.rs @@ -11,7 +11,7 @@ crate enum LitToConstError { crate fn lit_to_const<'gcx, 'tcx>( lit: &'tcx ast::LitKind, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, ty: Ty<'tcx>, neg: bool, ) -> Result<&'tcx ty::Const<'tcx>, LitToConstError> { diff --git a/src/librustc_mir/hair/cx/mod.rs b/src/librustc_mir/hair/cx/mod.rs index e259c6171a3af..ff3383f6e14c0 100644 --- a/src/librustc_mir/hair/cx/mod.rs +++ b/src/librustc_mir/hair/cx/mod.rs @@ -22,7 +22,7 @@ use crate::hair::constant::{lit_to_const, LitToConstError}; #[derive(Clone)] pub struct Cx<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, infcx: &'a InferCtxt<'a, 'gcx, 'tcx>, pub root_lint_level: hir::HirId, @@ -200,7 +200,7 @@ impl<'a, 'gcx, 'tcx> Cx<'a, 'gcx, 'tcx> { ty.needs_drop(self.tcx.global_tcx(), param_env) } - pub fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + pub fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.tcx } @@ -218,7 +218,7 @@ impl<'a, 'gcx, 'tcx> Cx<'a, 'gcx, 'tcx> { } impl UserAnnotatedTyHelpers<'gcx, 'tcx> for Cx<'_, 'gcx, 'tcx> { - fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.tcx() } diff --git a/src/librustc_mir/hair/pattern/_match.rs b/src/librustc_mir/hair/pattern/_match.rs index 7a1fd7843a6ee..9da51cae21830 100644 --- a/src/librustc_mir/hair/pattern/_match.rs +++ b/src/librustc_mir/hair/pattern/_match.rs @@ -195,7 +195,7 @@ pub fn expand_pattern<'a, 'tcx>(cx: &MatchCheckCtxt<'a, 'tcx>, pat: Pattern<'tcx } struct LiteralExpander<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx> + tcx: TyCtxt<'tcx, 'tcx> } impl LiteralExpander<'tcx> { @@ -350,7 +350,7 @@ impl<'p, 'tcx> FromIterator; 2]>> for Matrix<'p, 'tc } pub struct MatchCheckCtxt<'a, 'tcx: 'a> { - pub tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + pub tcx: TyCtxt<'tcx, 'tcx>, /// The module in which the match occurs. This is necessary for /// checking inhabited-ness of types because whether a type is (visibly) /// inhabited can depend on whether it was defined in the current module or @@ -365,7 +365,7 @@ pub struct MatchCheckCtxt<'a, 'tcx: 'a> { impl<'a, 'tcx> MatchCheckCtxt<'a, 'tcx> { pub fn create_and_enter( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, module: DefId, f: F) -> R @@ -827,7 +827,7 @@ struct IntRange<'tcx> { } impl<'tcx> IntRange<'tcx> { - fn from_ctor(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + fn from_ctor(tcx: TyCtxt<'tcx, 'tcx>, ctor: &Constructor<'tcx>) -> Option> { // Floating-point ranges are permitted and we don't want @@ -867,7 +867,7 @@ impl<'tcx> IntRange<'tcx> { } } - fn from_pat(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + fn from_pat(tcx: TyCtxt<'tcx, 'tcx>, mut pat: &Pattern<'tcx>) -> Option> { let range = loop { @@ -889,7 +889,7 @@ impl<'tcx> IntRange<'tcx> { } // The return value of `signed_bias` should be XORed with an endpoint to encode/decode it. - fn signed_bias(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ty: Ty<'tcx>) -> u128 { + fn signed_bias(tcx: TyCtxt<'tcx, 'tcx>, ty: Ty<'tcx>) -> u128 { match ty.sty { ty::Int(ity) => { let bits = Integer::from_attr(&tcx, SignedInt(ity)).size().bits() as u128; @@ -901,7 +901,7 @@ impl<'tcx> IntRange<'tcx> { /// Converts a `RangeInclusive` to a `ConstantValue` or inclusive `ConstantRange`. fn range_to_ctor( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, ty: Ty<'tcx>, r: RangeInclusive, ) -> Constructor<'tcx> { @@ -918,7 +918,7 @@ impl<'tcx> IntRange<'tcx> { /// Returns a collection of ranges that spans the values covered by `ranges`, subtracted /// by the values covered by `self`: i.e., `ranges \ self` (in set notation). fn subtract_from(self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, ranges: Vec>) -> Vec> { let ranges = ranges.into_iter().filter_map(|r| { @@ -988,7 +988,7 @@ enum MissingCtors<'tcx> { // to compute the full set.) fn compute_missing_ctors<'a, 'tcx: 'a>( info: MissingCtorsInfo, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, all_ctors: &Vec>, used_ctors: &Vec>, ) -> MissingCtors<'tcx> { @@ -1424,7 +1424,7 @@ fn constructor_sub_pattern_tys<'a, 'tcx: 'a>(cx: &MatchCheckCtxt<'a, 'tcx>, // meaning all other types will compare unequal and thus equal patterns often do not cause the // second pattern to lint about unreachable match arms. fn slice_pat_covered_by_const<'tcx>( - tcx: TyCtxt<'_, 'tcx, '_>, + tcx: TyCtxt<'tcx, '_>, _span: Span, const_val: &'tcx ty::Const<'tcx>, prefix: &[Pattern<'tcx>], @@ -1477,7 +1477,7 @@ fn slice_pat_covered_by_const<'tcx>( // Whether to evaluate a constructor using exhaustive integer matching. This is true if the // constructor is a range or constant with an integer type. fn should_treat_range_exhaustively( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, ctor: &Constructor<'tcx>, ) -> bool { let ty = match ctor { @@ -1525,7 +1525,7 @@ fn should_treat_range_exhaustively( /// between every pair of boundary points. (This essentially sums up to performing the intuitive /// merging operation depicted above.) fn split_grouped_constructors<'p, 'a: 'p, 'tcx: 'a>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, ctors: Vec>, &Matrix(ref m): &Matrix<'p, 'tcx>, ty: Ty<'tcx>, @@ -1603,7 +1603,7 @@ fn split_grouped_constructors<'p, 'a: 'p, 'tcx: 'a>( /// Checks whether there exists any shared value in either `ctor` or `pat` by intersecting them. fn constructor_intersects_pattern<'p, 'a: 'p, 'tcx: 'a>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, ctor: &Constructor<'tcx>, pat: &'p Pattern<'tcx>, ) -> Option; 2]>> { @@ -1631,7 +1631,7 @@ fn constructor_intersects_pattern<'p, 'a: 'p, 'tcx: 'a>( } fn constructor_covered_by_range<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, ctor: &Constructor<'tcx>, pat: &Pattern<'tcx>, ) -> Result { diff --git a/src/librustc_mir/hair/pattern/check_match.rs b/src/librustc_mir/hair/pattern/check_match.rs index 9b85ea53fa3ec..0a60ed19b9a47 100644 --- a/src/librustc_mir/hair/pattern/check_match.rs +++ b/src/librustc_mir/hair/pattern/check_match.rs @@ -26,7 +26,7 @@ use std::slice; use syntax::ptr::P; use syntax_pos::{Span, DUMMY_SP, MultiSpan}; -pub(crate) fn check_match<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { +pub(crate) fn check_match<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) { let body_id = if let Some(id) = tcx.hir().as_local_hir_id(def_id) { tcx.hir().body_owned_by(id) } else { @@ -48,7 +48,7 @@ fn create_e0004<'a>(sess: &'a Session, sp: Span, error_message: String) -> Diagn } struct MatchVisitor<'a, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, body_owner: DefId, tables: &'a ty::TypeckTables<'tcx>, param_env: ty::ParamEnv<'tcx>, diff --git a/src/librustc_mir/hair/pattern/mod.rs b/src/librustc_mir/hair/pattern/mod.rs index 1a69f37ac2ded..67325e7b75c83 100644 --- a/src/librustc_mir/hair/pattern/mod.rs +++ b/src/librustc_mir/hair/pattern/mod.rs @@ -327,7 +327,7 @@ impl<'tcx> fmt::Display for Pattern<'tcx> { } pub struct PatternContext<'a, 'tcx: 'a> { - pub tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + pub tcx: TyCtxt<'tcx, 'tcx>, pub param_env: ty::ParamEnv<'tcx>, pub tables: &'a ty::TypeckTables<'tcx>, pub substs: SubstsRef<'tcx>, @@ -335,7 +335,7 @@ pub struct PatternContext<'a, 'tcx: 'a> { } impl<'a, 'tcx> Pattern<'tcx> { - pub fn from_hir(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + pub fn from_hir(tcx: TyCtxt<'tcx, 'tcx>, param_env_and_substs: ty::ParamEnvAnd<'tcx, SubstsRef<'tcx>>, tables: &'a ty::TypeckTables<'tcx>, pat: &'tcx hir::Pat) -> Self { @@ -351,7 +351,7 @@ impl<'a, 'tcx> Pattern<'tcx> { } impl<'a, 'tcx> PatternContext<'a, 'tcx> { - pub fn new(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + pub fn new(tcx: TyCtxt<'tcx, 'tcx>, param_env_and_substs: ty::ParamEnvAnd<'tcx, SubstsRef<'tcx>>, tables: &'a ty::TypeckTables<'tcx>) -> Self { PatternContext { @@ -1055,7 +1055,7 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { } impl UserAnnotatedTyHelpers<'tcx, 'tcx> for PatternContext<'_, 'tcx> { - fn tcx(&self) -> TyCtxt<'tcx, 'tcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'tcx, 'tcx> { self.tcx } @@ -1243,7 +1243,7 @@ impl<'tcx> PatternFoldable<'tcx> for PatternKind<'tcx> { } pub fn compare_const_vals<'gcx, 'tcx>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, a: &'tcx ty::Const<'tcx>, b: &'tcx ty::Const<'tcx>, ty: ty::ParamEnvAnd<'tcx, Ty<'tcx>>, diff --git a/src/librustc_mir/hair/util.rs b/src/librustc_mir/hair/util.rs index 32ea39e35a5e5..3b52f45519030 100644 --- a/src/librustc_mir/hair/util.rs +++ b/src/librustc_mir/hair/util.rs @@ -2,7 +2,7 @@ use rustc::hir; use rustc::ty::{self, CanonicalUserType, TyCtxt, UserType}; crate trait UserAnnotatedTyHelpers<'gcx: 'tcx, 'tcx> { - fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx>; + fn tcx(&self) -> TyCtxt<'gcx, 'tcx>; fn tables(&self) -> &ty::TypeckTables<'tcx>; diff --git a/src/librustc_mir/interpret/eval_context.rs b/src/librustc_mir/interpret/eval_context.rs index f085580f68cc7..5b91b88f276ed 100644 --- a/src/librustc_mir/interpret/eval_context.rs +++ b/src/librustc_mir/interpret/eval_context.rs @@ -173,7 +173,7 @@ impl<'mir, 'tcx, M> layout::HasTyCtxt<'tcx> for InterpretCx<'mir, 'tcx, M> where M: Machine<'mir, 'tcx> { #[inline] - fn tcx<'d>(&'d self) -> TyCtxt<'tcx, 'tcx, 'tcx> { + fn tcx<'d>(&'d self) -> TyCtxt<'tcx, 'tcx> { *self.tcx } } diff --git a/src/librustc_mir/interpret/intrinsics/type_name.rs b/src/librustc_mir/interpret/intrinsics/type_name.rs index 2ce3fef38f54f..9c3dc40a5e1a0 100644 --- a/src/librustc_mir/interpret/intrinsics/type_name.rs +++ b/src/librustc_mir/interpret/intrinsics/type_name.rs @@ -10,7 +10,7 @@ use std::fmt::Write; use rustc::mir::interpret::{Allocation, ConstValue}; struct AbsolutePathPrinter<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, path: String, } @@ -23,7 +23,7 @@ impl<'tcx> Printer<'tcx, 'tcx> for AbsolutePathPrinter<'tcx> { type DynExistential = Self; type Const = Self; - fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx, 'tcx> { + fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx> { self.tcx } @@ -212,7 +212,7 @@ impl Write for AbsolutePathPrinter<'_> { /// Produces an absolute path representation of the given type. See also the documentation on /// `std::any::type_name` -pub fn type_name<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ty: Ty<'tcx>) -> &'tcx ty::Const<'tcx> { +pub fn type_name<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, ty: Ty<'tcx>) -> &'tcx ty::Const<'tcx> { let alloc = alloc_type_name(tcx, ty); tcx.mk_const(ty::Const { val: ConstValue::Slice { @@ -226,7 +226,7 @@ pub fn type_name<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ty: Ty<'tcx>) -> &'tcx ty: /// Directly returns an `Allocation` containing an absolute path representation of the given type. pub(super) fn alloc_type_name<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, ty: Ty<'tcx> ) -> &'tcx Allocation { let path = AbsolutePathPrinter { tcx, path: String::new() }.print_type(ty).unwrap().path; diff --git a/src/librustc_mir/interpret/snapshot.rs b/src/librustc_mir/interpret/snapshot.rs index 15ef05ca8cea4..1258dc041b83a 100644 --- a/src/librustc_mir/interpret/snapshot.rs +++ b/src/librustc_mir/interpret/snapshot.rs @@ -47,7 +47,7 @@ impl<'mir, 'tcx> InfiniteLoopDetector<'mir, 'tcx> { pub fn observe_and_analyze( &mut self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, span: Span, memory: &Memory<'mir, 'tcx, CompileTimeInterpreter<'mir, 'tcx>>, stack: &[Frame<'mir, 'tcx>], diff --git a/src/librustc_mir/lints.rs b/src/librustc_mir/lints.rs index 7e637a4130dc1..1cd48312412cc 100644 --- a/src/librustc_mir/lints.rs +++ b/src/librustc_mir/lints.rs @@ -7,7 +7,7 @@ use rustc::mir::{self, Body, TerminatorKind}; use rustc::ty::{self, AssocItem, AssocItemContainer, Instance, TyCtxt}; use rustc::ty::subst::InternalSubsts; -pub fn check(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn check(tcx: TyCtxt<'tcx, 'tcx>, body: &Body<'tcx>, def_id: DefId) { let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); @@ -17,7 +17,7 @@ pub fn check(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } } -fn check_fn_for_unconditional_recursion(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn check_fn_for_unconditional_recursion(tcx: TyCtxt<'tcx, 'tcx>, fn_kind: FnKind<'_>, body: &Body<'tcx>, def_id: DefId) { diff --git a/src/librustc_mir/monomorphize/collector.rs b/src/librustc_mir/monomorphize/collector.rs index 641f1f47ea407..30d1ea726f9a8 100644 --- a/src/librustc_mir/monomorphize/collector.rs +++ b/src/librustc_mir/monomorphize/collector.rs @@ -281,7 +281,7 @@ impl<'tcx> InliningMap<'tcx> { } } -pub fn collect_crate_mono_items<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn collect_crate_mono_items<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, mode: MonoItemCollectionMode) -> (FxHashSet>, InliningMap<'tcx>) { @@ -315,7 +315,7 @@ pub fn collect_crate_mono_items<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, // Find all non-generic items by walking the HIR. These items serve as roots to // start monomorphizing from. -fn collect_roots<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn collect_roots<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, mode: MonoItemCollectionMode) -> Vec> { debug!("Collecting roots"); @@ -347,7 +347,7 @@ fn collect_roots<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } // Collect all monomorphized items reachable from `starting_point` -fn collect_items_rec<'a, 'tcx: 'a>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn collect_items_rec<'a, 'tcx: 'a>(tcx: TyCtxt<'tcx, 'tcx>, starting_point: MonoItem<'tcx>, visited: MTRef<'_, MTLock>>>, recursion_depths: &mut DefIdMap, @@ -413,7 +413,7 @@ fn collect_items_rec<'a, 'tcx: 'a>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, debug!("END collect_items_rec({})", starting_point.to_string(tcx, true)); } -fn record_accesses<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn record_accesses<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, caller: MonoItem<'tcx>, callees: &[MonoItem<'tcx>], inlining_map: MTRef<'_, MTLock>>) { @@ -429,7 +429,7 @@ fn record_accesses<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, inlining_map.lock_mut().record_accesses(caller, accesses); } -fn check_recursion_limit<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn check_recursion_limit<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, instance: Instance<'tcx>, recursion_depths: &mut DefIdMap) -> (DefId, usize) { @@ -463,7 +463,7 @@ fn check_recursion_limit<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, (def_id, recursion_depth) } -fn check_type_length_limit<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn check_type_length_limit<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, instance: Instance<'tcx>) { let type_length = instance.substs.types().flat_map(|ty| ty.walk()).count(); @@ -515,7 +515,7 @@ fn check_type_length_limit<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } struct MirNeighborCollector<'a, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, body: &'a mir::Body<'tcx>, output: &'a mut Vec>, param_substs: SubstsRef<'tcx>, @@ -679,7 +679,7 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> { } } -fn visit_drop_use<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn visit_drop_use<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, ty: Ty<'tcx>, is_direct_call: bool, output: &mut Vec>) @@ -688,7 +688,7 @@ fn visit_drop_use<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, visit_instance_use(tcx, instance, is_direct_call, output); } -fn visit_fn_use<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn visit_fn_use<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, ty: Ty<'tcx>, is_direct_call: bool, output: &mut Vec>) @@ -702,7 +702,7 @@ fn visit_fn_use<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } } -fn visit_instance_use<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn visit_instance_use<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, instance: ty::Instance<'tcx>, is_direct_call: bool, output: &mut Vec>) @@ -741,7 +741,7 @@ fn visit_instance_use<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, // Returns true if we should codegen an instance in the local crate. // Returns false if we can just link to the upstream crate and therefore don't // need a mono item. -fn should_monomorphize_locally<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, instance: &Instance<'tcx>) +fn should_monomorphize_locally<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, instance: &Instance<'tcx>) -> bool { let def_id = match instance.def { ty::InstanceDef::Item(def_id) => def_id, @@ -776,7 +776,7 @@ fn should_monomorphize_locally<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, instance: &I } return true; - fn is_available_upstream_generic<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + fn is_available_upstream_generic<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, substs: SubstsRef<'tcx>) -> bool { @@ -841,7 +841,7 @@ fn should_monomorphize_locally<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, instance: &I /// /// Finally, there is also the case of custom unsizing coercions, e.g., for /// smart pointers such as `Rc` and `Arc`. -fn find_vtable_types_for_unsizing<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn find_vtable_types_for_unsizing<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, source_ty: Ty<'tcx>, target_ty: Ty<'tcx>) -> (Ty<'tcx>, Ty<'tcx>) { @@ -914,7 +914,7 @@ fn create_fn_mono_item<'tcx>(instance: Instance<'tcx>) -> MonoItem<'tcx> { /// Creates a `MonoItem` for each method that is referenced by the vtable for /// the given trait/impl pair. -fn create_mono_items_for_vtable_methods<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn create_mono_items_for_vtable_methods<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, trait_ty: Ty<'tcx>, impl_ty: Ty<'tcx>, output: &mut Vec>) { @@ -949,7 +949,7 @@ fn create_mono_items_for_vtable_methods<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, //=----------------------------------------------------------------------------- struct RootCollector<'a, 'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, mode: MonoItemCollectionMode, output: &'a mut Vec>, entry_fn: Option<(DefId, EntryFnType)>, @@ -1107,12 +1107,12 @@ impl RootCollector<'_, 'v> { } } -fn item_requires_monomorphization<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> bool { +fn item_requires_monomorphization<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> bool { let generics = tcx.generics_of(def_id); generics.requires_monomorphization(tcx) } -fn create_mono_items_for_default_impls<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn create_mono_items_for_default_impls<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, item: &'tcx hir::Item, output: &mut Vec>) { match item.node { @@ -1177,7 +1177,7 @@ fn create_mono_items_for_default_impls<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, /// Scan the miri alloc in order to find function calls, closures, and drop-glue fn collect_miri<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, alloc_id: AllocId, output: &mut Vec>, ) { @@ -1207,7 +1207,7 @@ fn collect_miri<'tcx>( } /// Scan the MIR in order to find function calls, closures, and drop-glue -fn collect_neighbours<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn collect_neighbours<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, instance: Instance<'tcx>, output: &mut Vec>) { @@ -1237,7 +1237,7 @@ fn collect_neighbours<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } } -fn def_id_to_string<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn def_id_to_string<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> String { let mut output = String::new(); @@ -1247,7 +1247,7 @@ fn def_id_to_string<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } fn collect_const<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, constant: &'tcx ty::Const<'tcx>, param_substs: SubstsRef<'tcx>, output: &mut Vec>, diff --git a/src/librustc_mir/monomorphize/item.rs b/src/librustc_mir/monomorphize/item.rs index f23d98cfe1cd4..2ba9600dfc9f0 100644 --- a/src/librustc_mir/monomorphize/item.rs +++ b/src/librustc_mir/monomorphize/item.rs @@ -48,7 +48,7 @@ pub trait MonoItemExt<'tcx>: fmt::Debug { } } - fn symbol_name(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> ty::SymbolName { + fn symbol_name(&self, tcx: TyCtxt<'tcx, 'tcx>) -> ty::SymbolName { match *self.as_mono_item() { MonoItem::Fn(instance) => tcx.symbol_name(instance), MonoItem::Static(def_id) => { @@ -63,7 +63,7 @@ pub trait MonoItemExt<'tcx>: fmt::Debug { } } fn instantiation_mode(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>) + tcx: TyCtxt<'tcx, 'tcx>) -> InstantiationMode { let inline_in_all_cgus = tcx.sess.opts.debugging_opts.inline_in_all_cgus.unwrap_or_else(|| { @@ -108,7 +108,7 @@ pub trait MonoItemExt<'tcx>: fmt::Debug { } } - fn explicit_linkage(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Option { + fn explicit_linkage(&self, tcx: TyCtxt<'tcx, 'tcx>) -> Option { let def_id = match *self.as_mono_item() { MonoItem::Fn(ref instance) => instance.def_id(), MonoItem::Static(def_id) => def_id, @@ -144,7 +144,7 @@ pub trait MonoItemExt<'tcx>: fmt::Debug { /// 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. - fn is_instantiable(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> bool { + fn is_instantiable(&self, tcx: TyCtxt<'tcx, 'tcx>) -> bool { debug!("is_instantiable({:?})", self); let (def_id, substs) = match *self.as_mono_item() { MonoItem::Fn(ref instance) => (instance.def_id(), instance.substs), @@ -156,7 +156,7 @@ pub trait MonoItemExt<'tcx>: fmt::Debug { tcx.substitute_normalize_and_test_predicates((def_id, &substs)) } - fn to_string(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, debug: bool) -> String { + fn to_string(&self, tcx: TyCtxt<'tcx, 'tcx>, debug: bool) -> String { return match *self.as_mono_item() { MonoItem::Fn(instance) => { to_string_internal(tcx, "fn ", instance, debug) @@ -170,7 +170,7 @@ pub trait MonoItemExt<'tcx>: fmt::Debug { } }; - fn to_string_internal<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + fn to_string_internal<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx>, prefix: &str, instance: Instance<'tcx>, debug: bool) @@ -183,7 +183,7 @@ pub trait MonoItemExt<'tcx>: fmt::Debug { } } - fn local_span(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Option { + fn local_span(&self, tcx: TyCtxt<'tcx, 'tcx>) -> Option { match *self.as_mono_item() { MonoItem::Fn(Instance { def, .. }) => { tcx.hir().as_local_hir_id(def.def_id()) diff --git a/src/librustc_mir/monomorphize/mod.rs b/src/librustc_mir/monomorphize/mod.rs index 1e9b13cc60c21..929c2126b4d9e 100644 --- a/src/librustc_mir/monomorphize/mod.rs +++ b/src/librustc_mir/monomorphize/mod.rs @@ -5,7 +5,7 @@ use rustc::ty::{self, Ty, TyCtxt}; pub mod collector; pub mod partitioning; -pub fn custom_coerce_unsize_info<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn custom_coerce_unsize_info<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, source_ty: Ty<'tcx>, target_ty: Ty<'tcx>) -> CustomCoerceUnsized { diff --git a/src/librustc_mir/monomorphize/partitioning.rs b/src/librustc_mir/monomorphize/partitioning.rs index db786b5320bb7..38c887751b68f 100644 --- a/src/librustc_mir/monomorphize/partitioning.rs +++ b/src/librustc_mir/monomorphize/partitioning.rs @@ -125,7 +125,7 @@ fn fallback_cgu_name(name_builder: &mut CodegenUnitNameBuilder<'_, '_>) -> Inter name_builder.build_cgu_name(LOCAL_CRATE, &["fallback"], Some("cgu")) } -pub fn partition<'tcx, I>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn partition<'tcx, I>(tcx: TyCtxt<'tcx, 'tcx>, mono_items: I, strategy: PartitioningStrategy, inlining_map: &InliningMap<'tcx>) @@ -201,7 +201,7 @@ struct PostInliningPartitioning<'tcx> { internalization_candidates: FxHashSet>, } -fn place_root_mono_items<'tcx, I>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn place_root_mono_items<'tcx, I>(tcx: TyCtxt<'tcx, 'tcx>, mono_items: I) -> PreInliningPartitioning<'tcx> where I: Iterator> @@ -276,7 +276,7 @@ fn place_root_mono_items<'tcx, I>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } fn mono_item_linkage_and_visibility( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, mono_item: &MonoItem<'tcx>, can_be_internalized: &mut bool, export_generics: bool, @@ -294,7 +294,7 @@ fn mono_item_linkage_and_visibility( } fn mono_item_visibility( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, mono_item: &MonoItem<'tcx>, can_be_internalized: &mut bool, export_generics: bool, @@ -439,7 +439,7 @@ fn mono_item_visibility( } } -fn default_visibility(tcx: TyCtxt<'_, '_, '_>, id: DefId, is_generic: bool) -> Visibility { +fn default_visibility(tcx: TyCtxt<'_, '_>, id: DefId, is_generic: bool) -> Visibility { if !tcx.sess.target.target.options.default_hidden_visibility { return Visibility::Default } @@ -463,7 +463,7 @@ fn default_visibility(tcx: TyCtxt<'_, '_, '_>, id: DefId, is_generic: bool) -> V } } -fn merge_codegen_units<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn merge_codegen_units<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, initial_partitioning: &mut PreInliningPartitioning<'tcx>, target_cgu_count: usize) { assert!(target_cgu_count >= 1); @@ -585,7 +585,7 @@ fn place_inlined_mono_items<'tcx>(initial_partitioning: PreInliningPartitioning< } } -fn internalize_symbols<'tcx>(_tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn internalize_symbols<'tcx>(_tcx: TyCtxt<'tcx, 'tcx>, partitioning: &mut PostInliningPartitioning<'tcx>, inlining_map: &InliningMap<'tcx>) { if partitioning.codegen_units.len() == 1 { @@ -650,7 +650,7 @@ fn internalize_symbols<'tcx>(_tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } } -fn characteristic_def_id_of_mono_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn characteristic_def_id_of_mono_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, mono_item: MonoItem<'tcx>) -> Option { match mono_item { @@ -698,7 +698,7 @@ fn characteristic_def_id_of_mono_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, type CguNameCache = FxHashMap<(DefId, bool), InternedString>; -fn compute_codegen_unit_name(tcx: TyCtxt<'_, '_, '_>, +fn compute_codegen_unit_name(tcx: TyCtxt<'_, '_>, name_builder: &mut CodegenUnitNameBuilder<'_, '_>, def_id: DefId, volatile: bool, @@ -758,7 +758,7 @@ fn numbered_codegen_unit_name(name_builder: &mut CodegenUnitNameBuilder<'_, '_>, name_builder.build_cgu_name_no_mangle(LOCAL_CRATE, &["cgu"], Some(index)) } -fn debug_dump<'a, 'b, 'tcx, I>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn debug_dump<'a, 'b, 'tcx, I>(tcx: TyCtxt<'tcx, 'tcx>, label: &str, cgus: I) where I: Iterator>, @@ -787,7 +787,7 @@ fn debug_dump<'a, 'b, 'tcx, I>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } #[inline(never)] // give this a place in the profiler -fn assert_symbols_are_distinct<'a, 'tcx: 'a, I>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, mono_items: I) +fn assert_symbols_are_distinct<'a, 'tcx: 'a, I>(tcx: TyCtxt<'tcx, 'tcx>, mono_items: I) where I: Iterator> { let mut symbols: Vec<_> = mono_items.map(|mono_item| { @@ -831,7 +831,7 @@ fn assert_symbols_are_distinct<'a, 'tcx: 'a, I>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, m } fn collect_and_partition_mono_items<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, cnum: CrateNum, ) -> (Arc, Arc>>>) { diff --git a/src/librustc_mir/shim.rs b/src/librustc_mir/shim.rs index cde7e685a0e83..f63e6996ddcbf 100644 --- a/src/librustc_mir/shim.rs +++ b/src/librustc_mir/shim.rs @@ -26,7 +26,7 @@ pub fn provide(providers: &mut Providers<'_>) { providers.mir_shims = make_shim; } -fn make_shim<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn make_shim<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, instance: ty::InstanceDef<'tcx>) -> &'tcx Body<'tcx> { @@ -166,7 +166,7 @@ fn local_decls_for_sig<'tcx>(sig: &ty::FnSig<'tcx>, span: Span) .collect() } -fn build_drop_shim<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn build_drop_shim<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, ty: Option>) -> Body<'tcx> @@ -258,7 +258,7 @@ fn build_drop_shim<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, pub struct DropShimElaborator<'a, 'tcx: 'a> { pub body: &'a Body<'tcx>, pub patch: MirPatch<'tcx>, - pub tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + pub tcx: TyCtxt<'tcx, 'tcx>, pub param_env: ty::ParamEnv<'tcx>, } @@ -273,7 +273,7 @@ impl<'a, 'tcx> DropElaborator<'a, 'tcx> for DropShimElaborator<'a, 'tcx> { fn patch(&mut self) -> &mut MirPatch<'tcx> { &mut self.patch } fn body(&self) -> &'a Body<'tcx> { self.body } - fn tcx(&self) -> TyCtxt<'tcx, 'tcx, 'tcx> { self.tcx } + fn tcx(&self) -> TyCtxt<'tcx, 'tcx> { self.tcx } fn param_env(&self) -> ty::ParamEnv<'tcx> { self.param_env } fn drop_style(&self, _path: Self::Path, mode: DropFlagMode) -> DropStyle { @@ -306,7 +306,7 @@ impl<'a, 'tcx> DropElaborator<'a, 'tcx> for DropShimElaborator<'a, 'tcx> { } /// Builds a `Clone::clone` shim for `self_ty`. Here, `def_id` is `Clone::clone`. -fn build_clone_shim<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn build_clone_shim<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, self_ty: Ty<'tcx>) -> Body<'tcx> @@ -341,7 +341,7 @@ fn build_clone_shim<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } struct CloneShimBuilder<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, local_decls: IndexVec>, blocks: IndexVec>, @@ -350,7 +350,7 @@ struct CloneShimBuilder<'tcx> { } impl CloneShimBuilder<'tcx> { - fn new(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + fn new(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, self_ty: Ty<'tcx>) -> Self { // we must subst the self_ty because it's @@ -691,7 +691,7 @@ impl CloneShimBuilder<'tcx> { /// /// If `untuple_args` is a vec of types, the second argument of the /// function will be untupled as these types. -fn build_call_shim<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn build_call_shim<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, rcvr_adjustment: Adjustment, call_kind: CallKind, @@ -842,7 +842,7 @@ fn build_call_shim<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, body } -pub fn build_adt_ctor<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ctor_id: DefId) -> &'tcx Body<'tcx> { +pub fn build_adt_ctor<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, ctor_id: DefId) -> &'tcx Body<'tcx> { debug_assert!(tcx.is_constructor(ctor_id)); let span = tcx.hir().span_if_local(ctor_id) diff --git a/src/librustc_mir/transform/add_call_guards.rs b/src/librustc_mir/transform/add_call_guards.rs index 18b219422d1a5..f71a1b42611d1 100644 --- a/src/librustc_mir/transform/add_call_guards.rs +++ b/src/librustc_mir/transform/add_call_guards.rs @@ -32,7 +32,7 @@ pub use self::AddCallGuards::*; impl MirPass for AddCallGuards { fn run_pass<'tcx>(&self, - _tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + _tcx: TyCtxt<'tcx, 'tcx>, _src: MirSource<'tcx>, body: &mut Body<'tcx>) { self.add_call_guards(body); diff --git a/src/librustc_mir/transform/add_moves_for_packed_drops.rs b/src/librustc_mir/transform/add_moves_for_packed_drops.rs index 1b9f2093ac120..e0b8805ebfb34 100644 --- a/src/librustc_mir/transform/add_moves_for_packed_drops.rs +++ b/src/librustc_mir/transform/add_moves_for_packed_drops.rs @@ -41,7 +41,7 @@ pub struct AddMovesForPackedDrops; impl MirPass for AddMovesForPackedDrops { fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, src: MirSource<'tcx>, body: &mut Body<'tcx>) { @@ -51,7 +51,7 @@ impl MirPass for AddMovesForPackedDrops { } pub fn add_moves_for_packed_drops<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, body: &mut Body<'tcx>, def_id: DefId) { @@ -60,7 +60,7 @@ pub fn add_moves_for_packed_drops<'tcx>( } fn add_moves_for_packed_drops_patch<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, body: &Body<'tcx>, def_id: DefId) -> MirPatch<'tcx> @@ -91,7 +91,7 @@ fn add_moves_for_packed_drops_patch<'tcx>( } fn add_move_for_packed_drop<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, body: &Body<'tcx>, patch: &mut MirPatch<'tcx>, terminator: &Terminator<'tcx>, diff --git a/src/librustc_mir/transform/add_retag.rs b/src/librustc_mir/transform/add_retag.rs index 43ff3619bf168..8f6c83e170294 100644 --- a/src/librustc_mir/transform/add_retag.rs +++ b/src/librustc_mir/transform/add_retag.rs @@ -48,7 +48,7 @@ fn is_stable<'tcx>( /// Determine whether this type may have a reference in it, recursing below compound types but /// not below references. -fn may_have_reference<'gcx, 'tcx>(ty: Ty<'tcx>, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> bool { +fn may_have_reference<'gcx, 'tcx>(ty: Ty<'tcx>, tcx: TyCtxt<'gcx, 'tcx>) -> bool { match ty.sty { // Primitive types that are not references ty::Bool | ty::Char | @@ -75,7 +75,7 @@ fn may_have_reference<'gcx, 'tcx>(ty: Ty<'tcx>, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) - impl MirPass for AddRetag { fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, _src: MirSource<'tcx>, body: &mut Body<'tcx>) { diff --git a/src/librustc_mir/transform/check_unsafety.rs b/src/librustc_mir/transform/check_unsafety.rs index e418ac7a7c7df..84462c3940df4 100644 --- a/src/librustc_mir/transform/check_unsafety.rs +++ b/src/librustc_mir/transform/check_unsafety.rs @@ -25,7 +25,7 @@ pub struct UnsafetyChecker<'a, 'tcx: 'a> { source_scope_local_data: &'a IndexVec, violations: Vec, source_info: SourceInfo, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, /// Mark an `unsafe` block as used, so we don't lint it. used_unsafe: FxHashSet, @@ -38,7 +38,7 @@ impl<'a, 'tcx> UnsafetyChecker<'a, 'tcx> { min_const_fn: bool, body: &'a Body<'tcx>, source_scope_local_data: &'a IndexVec, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, ) -> Self { // sanity check @@ -480,7 +480,7 @@ impl<'a, 'tcx> hir::intravisit::Visitor<'tcx> for UnusedUnsafeVisitor<'a> { } } -fn check_unused_unsafe<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn check_unused_unsafe<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, used_unsafe: &FxHashSet, unsafe_blocks: &'a mut Vec<(hir::HirId, bool)>) @@ -505,7 +505,7 @@ fn check_unused_unsafe<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, hir::intravisit::Visitor::visit_body(&mut visitor, body); } -fn unsafety_check_result<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) +fn unsafety_check_result<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> UnsafetyCheckResult { debug!("unsafety_violations({:?})", def_id); @@ -546,7 +546,7 @@ fn unsafety_check_result<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) } } -fn unsafe_derive_on_repr_packed<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { +fn unsafe_derive_on_repr_packed<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) { let lint_hir_id = tcx.hir().as_local_hir_id(def_id).unwrap_or_else(|| bug!("checking unsafety for non-local def id {:?}", def_id)); @@ -566,7 +566,7 @@ fn unsafe_derive_on_repr_packed<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: Def } /// Returns the `HirId` for an enclosing scope that is also `unsafe`. -fn is_enclosed(tcx: TyCtxt<'_, '_, '_>, +fn is_enclosed(tcx: TyCtxt<'_, '_>, used_unsafe: &FxHashSet, id: hir::HirId) -> Option<(String, hir::HirId)> { let parent_id = tcx.hir().get_parent_node_by_hir_id(id); @@ -589,7 +589,7 @@ fn is_enclosed(tcx: TyCtxt<'_, '_, '_>, } } -fn report_unused_unsafe(tcx: TyCtxt<'_, '_, '_>, +fn report_unused_unsafe(tcx: TyCtxt<'_, '_>, used_unsafe: &FxHashSet, id: hir::HirId) { let span = tcx.sess.source_map().def_span(tcx.hir().span_by_hir_id(id)); @@ -603,7 +603,7 @@ fn report_unused_unsafe(tcx: TyCtxt<'_, '_, '_>, db.emit(); } -fn builtin_derive_def_id<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> Option { +fn builtin_derive_def_id<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> Option { debug!("builtin_derive_def_id({:?})", def_id); if let Some(impl_def_id) = tcx.impl_of_method(def_id) { if tcx.has_attr(impl_def_id, sym::automatically_derived) { @@ -619,7 +619,7 @@ fn builtin_derive_def_id<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> } } -pub fn check_unsafety<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { +pub fn check_unsafety<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) { debug!("check_unsafety({:?})", def_id); // closures are handled by their parent fn. diff --git a/src/librustc_mir/transform/cleanup_post_borrowck.rs b/src/librustc_mir/transform/cleanup_post_borrowck.rs index 0484f5c8b389c..f552e635299e9 100644 --- a/src/librustc_mir/transform/cleanup_post_borrowck.rs +++ b/src/librustc_mir/transform/cleanup_post_borrowck.rs @@ -28,7 +28,7 @@ pub struct DeleteNonCodegenStatements; impl MirPass for CleanupNonCodegenStatements { fn run_pass<'tcx>(&self, - _tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + _tcx: TyCtxt<'tcx, 'tcx>, _source: MirSource<'tcx>, body: &mut Body<'tcx>) { let mut delete = DeleteNonCodegenStatements; diff --git a/src/librustc_mir/transform/const_prop.rs b/src/librustc_mir/transform/const_prop.rs index 1a42b01f452c2..d7c3cd52ebd05 100644 --- a/src/librustc_mir/transform/const_prop.rs +++ b/src/librustc_mir/transform/const_prop.rs @@ -32,7 +32,7 @@ pub struct ConstProp; impl MirPass for ConstProp { fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, source: MirSource<'tcx>, body: &mut Body<'tcx>) { // will be evaluated by miri and produce its errors there @@ -85,7 +85,7 @@ type Const<'tcx> = OpTy<'tcx>; /// Finds optimization opportunities on the MIR. struct ConstPropagator<'mir, 'tcx> { ecx: InterpretCx<'mir, 'tcx, CompileTimeInterpreter<'mir, 'tcx>>, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, source: MirSource<'tcx>, places: IndexVec>>, can_const_prop: IndexVec, @@ -113,7 +113,7 @@ impl<'mir, 'tcx> HasDataLayout for ConstPropagator<'mir, 'tcx> { impl<'mir, 'tcx> HasTyCtxt<'tcx> for ConstPropagator<'mir, 'tcx> { #[inline] - fn tcx<'c>(&'c self) -> TyCtxt<'tcx, 'tcx, 'tcx> { + fn tcx<'c>(&'c self) -> TyCtxt<'tcx, 'tcx> { self.tcx } } @@ -121,7 +121,7 @@ impl<'mir, 'tcx> HasTyCtxt<'tcx> for ConstPropagator<'mir, 'tcx> { impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { fn new( body: &mut Body<'tcx>, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, source: MirSource<'tcx>, ) -> ConstPropagator<'mir, 'tcx> { let param_env = tcx.param_env(source.def_id()); @@ -599,7 +599,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { } } -fn type_size_of<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn type_size_of<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, ty: Ty<'tcx>) -> Option { tcx.layout_of(param_env.and(ty)).ok().map(|layout| layout.size.bytes()) diff --git a/src/librustc_mir/transform/copy_prop.rs b/src/librustc_mir/transform/copy_prop.rs index 64e139bfe9152..6282c7855f35c 100644 --- a/src/librustc_mir/transform/copy_prop.rs +++ b/src/librustc_mir/transform/copy_prop.rs @@ -31,7 +31,7 @@ pub struct CopyPropagation; impl MirPass for CopyPropagation { fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, _source: MirSource<'tcx>, body: &mut Body<'tcx>) { // We only run when the MIR optimization level is > 1. diff --git a/src/librustc_mir/transform/deaggregator.rs b/src/librustc_mir/transform/deaggregator.rs index e43f1f6f58066..5ba7ba193d00e 100644 --- a/src/librustc_mir/transform/deaggregator.rs +++ b/src/librustc_mir/transform/deaggregator.rs @@ -7,7 +7,7 @@ pub struct Deaggregator; impl MirPass for Deaggregator { fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, _source: MirSource<'tcx>, body: &mut Body<'tcx>) { let (basic_blocks, local_decls) = body.basic_blocks_and_local_decls_mut(); diff --git a/src/librustc_mir/transform/dump_mir.rs b/src/librustc_mir/transform/dump_mir.rs index 77ba0ceb7c362..52aafdef87ecb 100644 --- a/src/librustc_mir/transform/dump_mir.rs +++ b/src/librustc_mir/transform/dump_mir.rs @@ -19,7 +19,7 @@ impl MirPass for Marker { } fn run_pass<'tcx>(&self, - _tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + _tcx: TyCtxt<'tcx, 'tcx>, _source: MirSource<'tcx>, _body: &mut Body<'tcx>) { @@ -38,7 +38,7 @@ impl fmt::Display for Disambiguator { } -pub fn on_mir_pass<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn on_mir_pass<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, pass_num: &dyn fmt::Display, pass_name: &str, source: MirSource<'tcx>, @@ -56,7 +56,7 @@ pub fn on_mir_pass<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } pub fn emit_mir<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, outputs: &OutputFilenames) -> io::Result<()> { diff --git a/src/librustc_mir/transform/elaborate_drops.rs b/src/librustc_mir/transform/elaborate_drops.rs index 66977bfabf408..2a187753626fd 100644 --- a/src/librustc_mir/transform/elaborate_drops.rs +++ b/src/librustc_mir/transform/elaborate_drops.rs @@ -22,7 +22,7 @@ pub struct ElaborateDrops; impl MirPass for ElaborateDrops { fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, src: MirSource<'tcx>, body: &mut Body<'tcx>) { @@ -78,7 +78,7 @@ impl MirPass for ElaborateDrops { /// to not be reachable, because they are `drop` terminators /// that can't drop anything. fn find_dead_unwinds< 'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, body: &Body<'tcx>, def_id: hir::def_id::DefId, env: &MoveDataParamEnv<'tcx, 'tcx>) @@ -142,7 +142,7 @@ struct InitializationData { impl InitializationData { fn apply_location<'tcx>(&mut self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, body: &Body<'tcx>, env: &MoveDataParamEnv<'tcx, 'tcx>, loc: Location) @@ -190,7 +190,7 @@ impl<'a, 'b, 'tcx> DropElaborator<'a, 'tcx> for Elaborator<'a, 'b, 'tcx> { self.ctxt.body } - fn tcx(&self) -> TyCtxt<'tcx, 'tcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'tcx, 'tcx> { self.ctxt.tcx } @@ -290,7 +290,7 @@ impl<'a, 'b, 'tcx> DropElaborator<'a, 'tcx> for Elaborator<'a, 'b, 'tcx> { } struct ElaborateDropsCtxt<'a, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, body: &'a Body<'tcx>, env: &'a MoveDataParamEnv<'tcx, 'tcx>, flow_inits: DataflowResults<'tcx, MaybeInitializedPlaces<'a, 'tcx, 'tcx>>, diff --git a/src/librustc_mir/transform/erase_regions.rs b/src/librustc_mir/transform/erase_regions.rs index 8a5a5fea393df..78713fee82cd8 100644 --- a/src/librustc_mir/transform/erase_regions.rs +++ b/src/librustc_mir/transform/erase_regions.rs @@ -11,11 +11,11 @@ use rustc::mir::visit::{MutVisitor, TyContext}; use crate::transform::{MirPass, MirSource}; struct EraseRegionsVisitor<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, } impl EraseRegionsVisitor<'tcx> { - pub fn new(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Self { + pub fn new(tcx: TyCtxt<'tcx, 'tcx>) -> Self { EraseRegionsVisitor { tcx, } @@ -51,7 +51,7 @@ pub struct EraseRegions; impl MirPass for EraseRegions { fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, _: MirSource<'tcx>, body: &mut Body<'tcx>) { EraseRegionsVisitor::new(tcx).visit_body(body); diff --git a/src/librustc_mir/transform/generator.rs b/src/librustc_mir/transform/generator.rs index 0ded39e21a091..a3fef7c97b4c2 100644 --- a/src/librustc_mir/transform/generator.rs +++ b/src/librustc_mir/transform/generator.rs @@ -169,7 +169,7 @@ struct SuspensionPoint { } struct TransformVisitor<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, state_adt_ref: &'tcx AdtDef, state_substs: SubstsRef<'tcx>, @@ -311,7 +311,7 @@ impl MutVisitor<'tcx> for TransformVisitor<'tcx> { } fn make_generator_state_argument_indirect<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, body: &mut Body<'tcx>) { let gen_ty = body.local_decls.raw[1].ty; @@ -336,7 +336,7 @@ fn make_generator_state_argument_indirect<'tcx>( } fn make_generator_state_argument_pinned<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, body: &mut Body<'tcx>) { let ref_gen_ty = body.local_decls.raw[1].ty; @@ -416,7 +416,7 @@ struct LivenessInfo { } fn locals_live_across_suspend_points( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, body: &Body<'tcx>, source: MirSource<'tcx>, movable: bool, @@ -678,7 +678,7 @@ impl<'body, 'tcx: 'body, 's> StorageConflictVisitor<'body, 'tcx, 's> { } } -fn compute_layout<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn compute_layout<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, source: MirSource<'tcx>, upvars: &Vec>, interior: Ty<'tcx>, @@ -797,7 +797,7 @@ fn insert_switch<'tcx>(body: &mut Body<'tcx>, } } -fn elaborate_generator_drops<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn elaborate_generator_drops<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, body: &mut Body<'tcx>) { use crate::util::elaborate_drops::{elaborate_drop, Unwind}; @@ -849,7 +849,7 @@ fn elaborate_generator_drops<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } fn create_generator_drop_shim<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, transform: &TransformVisitor<'tcx>, def_id: DefId, source: MirSource<'tcx>, @@ -939,7 +939,7 @@ fn insert_term_block<'tcx>(body: &mut Body<'tcx>, kind: TerminatorKind<'tcx>) -> term_block } -fn insert_panic_block<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn insert_panic_block<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, body: &mut Body<'tcx>, message: AssertMessage<'tcx>) -> BasicBlock { let assert_block = BasicBlock::new(body.basic_blocks().len()); @@ -970,7 +970,7 @@ fn insert_panic_block<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } fn create_generator_resume_function<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, transform: TransformVisitor<'tcx>, def_id: DefId, source: MirSource<'tcx>, @@ -1084,7 +1084,7 @@ fn create_cases<'tcx, F>(body: &mut Body<'tcx>, impl MirPass for StateTransform { fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, source: MirSource<'tcx>, body: &mut Body<'tcx>) { let yield_ty = if let Some(yield_ty) = body.yield_ty { diff --git a/src/librustc_mir/transform/inline.rs b/src/librustc_mir/transform/inline.rs index fdbf4ea8d9f1c..2818c11da4697 100644 --- a/src/librustc_mir/transform/inline.rs +++ b/src/librustc_mir/transform/inline.rs @@ -39,7 +39,7 @@ struct CallSite<'tcx> { impl MirPass for Inline { fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, source: MirSource<'tcx>, body: &mut Body<'tcx>) { if tcx.sess.opts.debugging_opts.mir_opt_level >= 2 { @@ -49,7 +49,7 @@ impl MirPass for Inline { } struct Inliner<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, source: MirSource<'tcx>, } @@ -631,7 +631,7 @@ impl Inliner<'tcx> { } } -fn type_size_of<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn type_size_of<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, ty: Ty<'tcx>) -> Option { tcx.layout_of(param_env.and(ty)).ok().map(|layout| layout.size.bytes()) diff --git a/src/librustc_mir/transform/instcombine.rs b/src/librustc_mir/transform/instcombine.rs index 784e3ed5187f1..89be1ba0bdf2f 100644 --- a/src/librustc_mir/transform/instcombine.rs +++ b/src/librustc_mir/transform/instcombine.rs @@ -13,7 +13,7 @@ pub struct InstCombine; impl MirPass for InstCombine { fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, _: MirSource<'tcx>, body: &mut Body<'tcx>) { // We only run when optimizing MIR (at any level). @@ -65,12 +65,12 @@ impl<'tcx> MutVisitor<'tcx> for InstCombineVisitor<'tcx> { /// Finds optimization opportunities on the MIR. struct OptimizationFinder<'b, 'tcx> { body: &'b Body<'tcx>, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, optimizations: OptimizationList<'tcx>, } impl OptimizationFinder<'b, 'tcx> { - fn new(body: &'b Body<'tcx>, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> OptimizationFinder<'b, 'tcx> { + fn new(body: &'b Body<'tcx>, tcx: TyCtxt<'tcx, 'tcx>) -> OptimizationFinder<'b, 'tcx> { OptimizationFinder { body, tcx, diff --git a/src/librustc_mir/transform/lower_128bit.rs b/src/librustc_mir/transform/lower_128bit.rs index 47ac87ad795fa..2b28eeb801ff8 100644 --- a/src/librustc_mir/transform/lower_128bit.rs +++ b/src/librustc_mir/transform/lower_128bit.rs @@ -11,7 +11,7 @@ pub struct Lower128Bit; impl MirPass for Lower128Bit { fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, _src: MirSource<'tcx>, body: &mut Body<'tcx>) { let debugging_override = tcx.sess.opts.debugging_opts.lower_128bit_ops; @@ -25,7 +25,7 @@ impl MirPass for Lower128Bit { } impl Lower128Bit { - fn lower_128bit_ops<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, body: &mut Body<'tcx>) { + fn lower_128bit_ops<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx>, body: &mut Body<'tcx>) { let mut new_blocks = Vec::new(); let cur_len = body.basic_blocks().len(); @@ -126,7 +126,7 @@ fn check_lang_item_type<'tcx, D>( lhs: &Operand<'tcx>, rhs: &Operand<'tcx>, local_decls: &D, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>) + tcx: TyCtxt<'tcx, 'tcx>) -> DefId where D: HasLocalDecls<'tcx> { @@ -142,7 +142,7 @@ fn check_lang_item_type<'tcx, D>( did } -fn lower_to<'tcx, D>(statement: &Statement<'tcx>, local_decls: &D, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) +fn lower_to<'tcx, D>(statement: &Statement<'tcx>, local_decls: &D, tcx: TyCtxt<'tcx, 'tcx>) -> Option<(LangItem, RhsKind)> where D: HasLocalDecls<'tcx> { @@ -172,7 +172,7 @@ enum RhsKind { } impl RhsKind { - fn ty<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Option> { + fn ty<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx>) -> Option> { match *self { RhsKind::Unchanged => None, RhsKind::ForceU128 => Some(tcx.types.u128), diff --git a/src/librustc_mir/transform/mod.rs b/src/librustc_mir/transform/mod.rs index c569f8d65f6c5..eb89648826748 100644 --- a/src/librustc_mir/transform/mod.rs +++ b/src/librustc_mir/transform/mod.rs @@ -50,13 +50,13 @@ pub(crate) fn provide(providers: &mut Providers<'_>) { }; } -fn is_mir_available<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> bool { +fn is_mir_available<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> bool { tcx.mir_keys(def_id.krate).contains(&def_id) } /// Finds the full set of `DefId`s within the current crate that have /// MIR associated with them. -fn mir_keys<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, krate: CrateNum) +fn mir_keys<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, krate: CrateNum) -> &'tcx DefIdSet { assert_eq!(krate, LOCAL_CRATE); @@ -68,7 +68,7 @@ fn mir_keys<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, krate: CrateNum) // Additionally, tuple struct/variant constructors have MIR, but // they don't have a BodyId, so we need to build them separately. struct GatherCtors<'a, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, set: &'a mut DefIdSet, } impl<'a, 'tcx> Visitor<'tcx> for GatherCtors<'a, 'tcx> { @@ -95,7 +95,7 @@ fn mir_keys<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, krate: CrateNum) tcx.arena.alloc(set) } -fn mir_built<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx Steal> { +fn mir_built<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> &'tcx Steal> { let mir = build::mir_build(tcx, def_id); tcx.alloc_steal_mir(mir) } @@ -143,13 +143,13 @@ pub trait MirPass { } fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, source: MirSource<'tcx>, body: &mut Body<'tcx>); } pub fn run_passes( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, body: &mut Body<'tcx>, instance: InstanceDef<'tcx>, mir_phase: MirPhase, @@ -196,7 +196,7 @@ pub fn run_passes( } } -fn mir_const<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx Steal> { +fn mir_const<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> &'tcx Steal> { // Unsafety check uses the raw mir, so make sure it is run let _ = tcx.unsafety_check_result(def_id); @@ -210,7 +210,7 @@ fn mir_const<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx Steal< tcx.alloc_steal_mir(body) } -fn mir_validated(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx Steal> { +fn mir_validated(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> &'tcx Steal> { let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); if let hir::BodyOwnerKind::Const = tcx.hir().body_owner_kind_by_hir_id(hir_id) { // Ensure that we compute the `mir_const_qualif` for constants at @@ -227,7 +227,7 @@ fn mir_validated(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx Steal(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx Body<'tcx> { +fn optimized_mir<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> &'tcx Body<'tcx> { if tcx.is_constructor(def_id) { // There's no reason to run all of the MIR passes on constructors when // we can just output the MIR we want directly. This also saves const diff --git a/src/librustc_mir/transform/no_landing_pads.rs b/src/librustc_mir/transform/no_landing_pads.rs index 38a5fc4c2398d..638aa1e7e02de 100644 --- a/src/librustc_mir/transform/no_landing_pads.rs +++ b/src/librustc_mir/transform/no_landing_pads.rs @@ -10,14 +10,14 @@ pub struct NoLandingPads; impl MirPass for NoLandingPads { fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, _: MirSource<'tcx>, body: &mut Body<'tcx>) { no_landing_pads(tcx, body) } } -pub fn no_landing_pads<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, body: &mut Body<'tcx>) { +pub fn no_landing_pads<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, body: &mut Body<'tcx>) { if tcx.sess.no_landing_pads() { NoLandingPads.visit_body(body); } diff --git a/src/librustc_mir/transform/promote_consts.rs b/src/librustc_mir/transform/promote_consts.rs index 63cd10f8e26fc..7bbaa99798d5f 100644 --- a/src/librustc_mir/transform/promote_consts.rs +++ b/src/librustc_mir/transform/promote_consts.rs @@ -148,7 +148,7 @@ pub fn collect_temps(body: &Body<'_>, } struct Promoter<'a, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, source: &'a mut Body<'tcx>, promoted: Body<'tcx>, temps: &'a mut IndexVec, @@ -370,7 +370,7 @@ impl<'a, 'tcx> MutVisitor<'tcx> for Promoter<'a, 'tcx> { } pub fn promote_candidates<'tcx>(body: &mut Body<'tcx>, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, mut temps: IndexVec, candidates: Vec) { // Visit candidates in reverse, in case they're nested. diff --git a/src/librustc_mir/transform/qualify_consts.rs b/src/librustc_mir/transform/qualify_consts.rs index c0ff2d00a3979..32d3b4589629c 100644 --- a/src/librustc_mir/transform/qualify_consts.rs +++ b/src/librustc_mir/transform/qualify_consts.rs @@ -124,7 +124,7 @@ impl IndexMut for PerQualif { } struct ConstCx<'a, 'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, mode: Mode, body: &'a Body<'tcx>, @@ -652,7 +652,7 @@ impl Deref for Checker<'a, 'tcx> { } impl<'a, 'tcx> Checker<'a, 'tcx> { - fn new(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + fn new(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, body: &'a Body<'tcx>, mode: Mode) @@ -1472,7 +1472,7 @@ pub fn provide(providers: &mut Providers<'_>) { }; } -fn mir_const_qualif<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn mir_const_qualif<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> (u8, &'tcx BitSet) { // N.B., this `borrow()` is guaranteed to be valid (i.e., the value @@ -1493,7 +1493,7 @@ pub struct QualifyAndPromoteConstants; impl MirPass for QualifyAndPromoteConstants { fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, src: MirSource<'tcx>, body: &mut Body<'tcx>) { // There's not really any point in promoting errorful MIR. @@ -1668,7 +1668,7 @@ impl MirPass for QualifyAndPromoteConstants { } } -fn args_required_const(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> Option> { +fn args_required_const(tcx: TyCtxt<'_, '_>, def_id: DefId) -> Option> { let attrs = tcx.get_attrs(def_id); let attr = attrs.iter().find(|a| a.check_name(sym::rustc_args_required_const))?; let mut ret = FxHashSet::default(); diff --git a/src/librustc_mir/transform/qualify_min_const_fn.rs b/src/librustc_mir/transform/qualify_min_const_fn.rs index 952d8f1ba0832..449d2d32456bd 100644 --- a/src/librustc_mir/transform/qualify_min_const_fn.rs +++ b/src/librustc_mir/transform/qualify_min_const_fn.rs @@ -9,7 +9,7 @@ use syntax_pos::Span; type McfResult = Result<(), (Span, Cow<'static, str>)>; pub fn is_min_const_fn( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, body: &'a Body<'tcx>, ) -> McfResult { @@ -80,7 +80,7 @@ pub fn is_min_const_fn( } fn check_ty( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, ty: Ty<'tcx>, span: Span, fn_def_id: DefId, @@ -129,7 +129,7 @@ fn check_ty( } fn check_rvalue( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, body: &'a Body<'tcx>, rvalue: &Rvalue<'tcx>, span: Span, @@ -209,7 +209,7 @@ fn check_rvalue( } fn check_statement( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, body: &'a Body<'tcx>, statement: &Statement<'tcx>, ) -> McfResult { @@ -279,7 +279,7 @@ fn check_place( } fn check_terminator( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, body: &'a Body<'tcx>, terminator: &Terminator<'tcx>, ) -> McfResult { @@ -375,7 +375,7 @@ fn check_terminator( /// for being called from stable `const fn`s (`min_const_fn`). /// /// Adding more intrinsics requires sign-off from @rust-lang/lang. -fn is_intrinsic_whitelisted(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> bool { +fn is_intrinsic_whitelisted(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> bool { match &tcx.item_name(def_id).as_str()[..] { | "size_of" | "min_align_of" diff --git a/src/librustc_mir/transform/remove_noop_landing_pads.rs b/src/librustc_mir/transform/remove_noop_landing_pads.rs index 5a9b30d32de3c..23541a6e6bc7e 100644 --- a/src/librustc_mir/transform/remove_noop_landing_pads.rs +++ b/src/librustc_mir/transform/remove_noop_landing_pads.rs @@ -10,7 +10,7 @@ use crate::util::patch::MirPatch; pub struct RemoveNoopLandingPads; pub fn remove_noop_landing_pads<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, body: &mut Body<'tcx>) { if tcx.sess.no_landing_pads() { @@ -23,7 +23,7 @@ pub fn remove_noop_landing_pads<'tcx>( impl MirPass for RemoveNoopLandingPads { fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, _src: MirSource<'tcx>, body: &mut Body<'tcx>) { remove_noop_landing_pads(tcx, body); diff --git a/src/librustc_mir/transform/rustc_peek.rs b/src/librustc_mir/transform/rustc_peek.rs index adaea15a17a10..2a25cd2c9573a 100644 --- a/src/librustc_mir/transform/rustc_peek.rs +++ b/src/librustc_mir/transform/rustc_peek.rs @@ -25,7 +25,7 @@ use crate::dataflow::has_rustc_mir_with; pub struct SanityCheck; impl MirPass for SanityCheck { - fn run_pass<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + fn run_pass<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx>, src: MirSource<'tcx>, body: &mut Body<'tcx>) { let def_id = src.def_id(); if !tcx.has_attr(def_id, sym::rustc_mir) { @@ -84,7 +84,7 @@ impl MirPass for SanityCheck { /// (If there are any calls to `rustc_peek` that do not match the /// expression form above, then that emits an error as well, but those /// errors are not intended to be used for unit tests.) -pub fn sanity_check_via_rustc_peek<'tcx, O>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn sanity_check_via_rustc_peek<'tcx, O>(tcx: TyCtxt<'tcx, 'tcx>, body: &Body<'tcx>, def_id: DefId, _attributes: &[ast::Attribute], @@ -101,7 +101,7 @@ pub fn sanity_check_via_rustc_peek<'tcx, O>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } } -fn each_block<'tcx, O>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn each_block<'tcx, O>(tcx: TyCtxt<'tcx, 'tcx>, body: &Body<'tcx>, results: &DataflowResults<'tcx, O>, bb: mir::BasicBlock) where @@ -214,7 +214,7 @@ fn each_block<'tcx, O>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, form `&expr`")); } -fn is_rustc_peek<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn is_rustc_peek<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx>, terminator: &'a Option>) -> Option<(&'a [mir::Operand<'tcx>], Span)> { if let Some(mir::Terminator { ref kind, source_info, .. }) = *terminator { diff --git a/src/librustc_mir/transform/simplify.rs b/src/librustc_mir/transform/simplify.rs index 92b7a76c5fa37..65838946a7859 100644 --- a/src/librustc_mir/transform/simplify.rs +++ b/src/librustc_mir/transform/simplify.rs @@ -58,7 +58,7 @@ impl MirPass for SimplifyCfg { } fn run_pass<'tcx>(&self, - _tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + _tcx: TyCtxt<'tcx, 'tcx>, _src: MirSource<'tcx>, body: &mut Body<'tcx>) { debug!("SimplifyCfg({:?}) - simplifying {:?}", self.label, body); @@ -297,7 +297,7 @@ pub struct SimplifyLocals; impl MirPass for SimplifyLocals { fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, _: MirSource<'tcx>, body: &mut Body<'tcx>) { let mut marker = DeclMarker { locals: BitSet::new_empty(body.local_decls.len()) }; diff --git a/src/librustc_mir/transform/simplify_branches.rs b/src/librustc_mir/transform/simplify_branches.rs index 41f2572c2f562..6f6dd1a7c8095 100644 --- a/src/librustc_mir/transform/simplify_branches.rs +++ b/src/librustc_mir/transform/simplify_branches.rs @@ -20,7 +20,7 @@ impl MirPass for SimplifyBranches { } fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, _src: MirSource<'tcx>, body: &mut Body<'tcx>) { for block in body.basic_blocks_mut() { diff --git a/src/librustc_mir/transform/uniform_array_move_out.rs b/src/librustc_mir/transform/uniform_array_move_out.rs index 7eae82c019c88..f71c30e587d7b 100644 --- a/src/librustc_mir/transform/uniform_array_move_out.rs +++ b/src/librustc_mir/transform/uniform_array_move_out.rs @@ -38,7 +38,7 @@ pub struct UniformArrayMoveOut; impl MirPass for UniformArrayMoveOut { fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, _src: MirSource<'tcx>, body: &mut Body<'tcx>) { let mut patch = MirPatch::new(body); @@ -53,7 +53,7 @@ impl MirPass for UniformArrayMoveOut { struct UniformArrayMoveOutVisitor<'a, 'tcx: 'a> { body: &'a Body<'tcx>, patch: &'a mut MirPatch<'tcx>, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, } impl<'a, 'tcx> Visitor<'tcx> for UniformArrayMoveOutVisitor<'a, 'tcx> { @@ -163,7 +163,7 @@ pub struct RestoreSubsliceArrayMoveOut; impl MirPass for RestoreSubsliceArrayMoveOut { fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, _src: MirSource<'tcx>, body: &mut Body<'tcx>) { let mut patch = MirPatch::new(body); diff --git a/src/librustc_mir/util/alignment.rs b/src/librustc_mir/util/alignment.rs index 5ca867d796e99..c171bef4c96c4 100644 --- a/src/librustc_mir/util/alignment.rs +++ b/src/librustc_mir/util/alignment.rs @@ -4,7 +4,7 @@ use rustc::mir::*; /// Returns `true` if this place is allowed to be less aligned /// than its containing struct (because it is within a packed /// struct). -pub fn is_disaligned<'tcx, L>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn is_disaligned<'tcx, L>(tcx: TyCtxt<'tcx, 'tcx>, local_decls: &L, param_env: ty::ParamEnv<'tcx>, place: &Place<'tcx>) @@ -32,7 +32,7 @@ pub fn is_disaligned<'tcx, L>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } } -fn is_within_packed<'tcx, L>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn is_within_packed<'tcx, L>(tcx: TyCtxt<'tcx, 'tcx>, local_decls: &L, place: &Place<'tcx>) -> bool diff --git a/src/librustc_mir/util/borrowck_errors.rs b/src/librustc_mir/util/borrowck_errors.rs index 6740fe5ff6ebd..551cccf3d7d7f 100644 --- a/src/librustc_mir/util/borrowck_errors.rs +++ b/src/librustc_mir/util/borrowck_errors.rs @@ -788,7 +788,7 @@ pub trait BorrowckErrors<'cx>: Sized + Copy { } } -impl BorrowckErrors<'tcx> for TyCtxt<'tcx, 'gcx, 'tcx> { +impl BorrowckErrors<'tcx> for TyCtxt<'gcx, 'tcx> { fn struct_span_err_with_code>( self, sp: S, diff --git a/src/librustc_mir/util/elaborate_drops.rs b/src/librustc_mir/util/elaborate_drops.rs index d18abeeeb15c4..efcb23aab2ed9 100644 --- a/src/librustc_mir/util/elaborate_drops.rs +++ b/src/librustc_mir/util/elaborate_drops.rs @@ -75,7 +75,7 @@ pub trait DropElaborator<'a, 'tcx: 'a> : fmt::Debug { fn patch(&mut self) -> &mut MirPatch<'tcx>; fn body(&self) -> &'a Body<'tcx>; - fn tcx(&self) -> TyCtxt<'tcx, 'tcx, 'tcx>; + fn tcx(&self) -> TyCtxt<'tcx, 'tcx>; fn param_env(&self) -> ty::ParamEnv<'tcx>; fn drop_style(&self, path: Self::Path, mode: DropFlagMode) -> DropStyle; @@ -126,7 +126,7 @@ where place.ty(self.elaborator.body(), self.tcx()).ty } - fn tcx(&self) -> TyCtxt<'tcx, 'tcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'tcx, 'tcx> { self.elaborator.tcx() } diff --git a/src/librustc_mir/util/graphviz.rs b/src/librustc_mir/util/graphviz.rs index ba00fab7b8d57..2dc6c9061bf7a 100644 --- a/src/librustc_mir/util/graphviz.rs +++ b/src/librustc_mir/util/graphviz.rs @@ -8,7 +8,7 @@ use std::io::{self, Write}; use super::pretty::dump_mir_def_ids; /// Write a graphviz DOT graph of a list of MIRs. -pub fn write_mir_graphviz<'tcx, W>(tcx: TyCtxt<'tcx, '_, 'tcx>, +pub fn write_mir_graphviz<'tcx, W>(tcx: TyCtxt<'_, 'tcx>, single: Option, w: &mut W) -> io::Result<()> @@ -32,7 +32,7 @@ pub fn graphviz_safe_def_name(def_id: DefId) -> String { } /// Write a graphviz DOT graph of the MIR. -pub fn write_mir_fn_graphviz<'tcx, W>(tcx: TyCtxt<'tcx, '_, 'tcx>, +pub fn write_mir_fn_graphviz<'tcx, W>(tcx: TyCtxt<'_, 'tcx>, def_id: DefId, body: &Body<'_>, w: &mut W) -> io::Result<()> @@ -133,7 +133,7 @@ fn write_edges(source: BasicBlock, body: &Body<'_>, w: &mut W) -> io:: /// Write the graphviz DOT label for the overall graph. This is essentially a block of text that /// will appear below the graph, showing the type of the `fn` this MIR represents and the types of /// all the variables and temporaries. -fn write_graph_label<'gcx, 'tcx, W: Write>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, +fn write_graph_label<'gcx, 'tcx, W: Write>(tcx: TyCtxt<'gcx, 'tcx>, def_id: DefId, body: &Body<'_>, w: &mut W) diff --git a/src/librustc_mir/util/liveness.rs b/src/librustc_mir/util/liveness.rs index 900e3d19670bf..39840432c690e 100644 --- a/src/librustc_mir/util/liveness.rs +++ b/src/librustc_mir/util/liveness.rs @@ -255,7 +255,7 @@ fn block<'tcx>( } pub fn dump_mir<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, pass_name: &str, source: MirSource<'tcx>, body: &Body<'tcx>, @@ -272,7 +272,7 @@ pub fn dump_mir<'tcx>( } fn dump_matched_mir_node<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, pass_name: &str, node_path: &str, source: MirSource<'tcx>, @@ -295,7 +295,7 @@ fn dump_matched_mir_node<'tcx>( } pub fn write_mir_fn<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, src: MirSource<'tcx>, body: &Body<'tcx>, w: &mut dyn Write, diff --git a/src/librustc_mir/util/mod.rs b/src/librustc_mir/util/mod.rs index da3735e87f6b4..3563ad43051dc 100644 --- a/src/librustc_mir/util/mod.rs +++ b/src/librustc_mir/util/mod.rs @@ -22,7 +22,7 @@ pub use self::graphviz::write_node_label as write_graphviz_node_label; /// If possible, suggest replacing `ref` with `ref mut`. pub fn suggest_ref_mut<'gcx, 'tcx>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, binding_span: Span, ) -> Option<(String)> { let hi_src = tcx.sess.source_map().span_to_snippet(binding_span).unwrap(); diff --git a/src/librustc_mir/util/pretty.rs b/src/librustc_mir/util/pretty.rs index d5c13610e2f7a..8bf491acc26d9 100644 --- a/src/librustc_mir/util/pretty.rs +++ b/src/librustc_mir/util/pretty.rs @@ -63,7 +63,7 @@ pub enum PassWhere { /// - `foo & nll | bar & typeck` == match if `foo` and `nll` both appear in the name /// or `typeck` and `bar` both appear in the name. pub fn dump_mir<'gcx, 'tcx, F>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, pass_num: Option<&dyn Display>, pass_name: &str, disambiguator: &dyn Display, @@ -94,7 +94,7 @@ pub fn dump_mir<'gcx, 'tcx, F>( } pub fn dump_enabled<'gcx, 'tcx>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, pass_name: &str, source: MirSource<'tcx>, ) -> bool { @@ -118,7 +118,7 @@ pub fn dump_enabled<'gcx, 'tcx>( // run while we are already attempting to evaluate `type_of`. fn dump_matched_mir_node<'gcx, 'tcx, F>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, pass_num: Option<&dyn Display>, pass_name: &str, node_path: &str, @@ -158,7 +158,7 @@ fn dump_matched_mir_node<'gcx, 'tcx, F>( /// Also used by other bits of code (e.g., NLL inference) that dump /// graphviz data or other things. fn dump_path( - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, extension: &str, pass_num: Option<&dyn Display>, pass_name: &str, @@ -225,7 +225,7 @@ fn dump_path( /// bits of code (e.g., NLL inference) that dump graphviz data or /// other things, and hence takes the extension as an argument. pub(crate) fn create_dump_file( - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, extension: &str, pass_num: Option<&dyn Display>, pass_name: &str, @@ -241,7 +241,7 @@ pub(crate) fn create_dump_file( /// Write out a human-readable textual representation for the given MIR. pub fn write_mir_pretty<'gcx, 'tcx>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, single: Option, w: &mut dyn Write, ) -> io::Result<()> { @@ -280,7 +280,7 @@ pub fn write_mir_pretty<'gcx, 'tcx>( } pub fn write_mir_fn<'gcx, 'tcx, F>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, src: MirSource<'tcx>, body: &Body<'tcx>, extra_data: &mut F, @@ -304,7 +304,7 @@ where /// Write out a human-readable textual representation for the given basic block. pub fn write_basic_block<'gcx, 'tcx, F>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, block: BasicBlock, body: &Body<'tcx>, extra_data: &mut F, @@ -371,7 +371,7 @@ where /// information. There's often a lot of little things "nuzzled up" in /// a statement. fn write_extra<'gcx, 'tcx, F>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, write: &mut dyn Write, mut visit_op: F, ) -> io::Result<()> @@ -390,7 +390,7 @@ where } struct ExtraComments<'gcx, 'tcx> { - _tcx: TyCtxt<'tcx, 'gcx, 'tcx>, // don't need it now, but bet we will soon + _tcx: TyCtxt<'gcx, 'tcx>, // don't need it now, but bet we will soon comments: Vec, } @@ -453,7 +453,7 @@ impl Visitor<'tcx> for ExtraComments<'gcx, 'tcx> { } } -fn comment(tcx: TyCtxt<'_, '_, '_>, SourceInfo { span, scope }: SourceInfo) -> String { +fn comment(tcx: TyCtxt<'_, '_>, SourceInfo { span, scope }: SourceInfo) -> String { format!( "scope {} at {}", scope.index(), @@ -463,7 +463,7 @@ fn comment(tcx: TyCtxt<'_, '_, '_>, SourceInfo { span, scope }: SourceInfo) -> S /// Prints local variables in a scope tree. fn write_scope_tree( - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, body: &Body<'_>, scope_tree: &FxHashMap>, w: &mut dyn Write, @@ -539,7 +539,7 @@ fn write_scope_tree( /// Write out a human-readable textual representation of the MIR's `fn` type and the types of its /// local variables (both user-defined bindings and compiler temporaries). pub fn write_mir_intro<'gcx, 'tcx>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, src: MirSource<'tcx>, body: &Body<'_>, w: &mut dyn Write, @@ -570,7 +570,7 @@ pub fn write_mir_intro<'gcx, 'tcx>( } fn write_mir_sig( - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, src: MirSource<'tcx>, body: &Body<'_>, w: &mut dyn Write, @@ -642,7 +642,7 @@ fn write_user_type_annotations(body: &Body<'_>, w: &mut dyn Write) -> io::Result Ok(()) } -pub fn dump_mir_def_ids(tcx: TyCtxt<'_, '_, '_>, single: Option) -> Vec { +pub fn dump_mir_def_ids(tcx: TyCtxt<'_, '_>, single: Option) -> Vec { if let Some(i) = single { vec![i] } else { diff --git a/src/librustc_passes/layout_test.rs b/src/librustc_passes/layout_test.rs index b256ff487401e..c4ebd9cf89db2 100644 --- a/src/librustc_passes/layout_test.rs +++ b/src/librustc_passes/layout_test.rs @@ -14,7 +14,7 @@ use rustc::ty::TyCtxt; use syntax::ast::Attribute; use syntax::symbol::sym; -pub fn test_layout<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn test_layout<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) { if tcx.features().rustc_attrs { // if the `rustc_attrs` feature is not enabled, don't bother testing layout tcx.hir() @@ -24,7 +24,7 @@ pub fn test_layout<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { } struct VarianceTest<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, } impl ItemLikeVisitor<'tcx> for VarianceTest<'tcx> { @@ -105,7 +105,7 @@ impl VarianceTest<'tcx> { } struct UnwrapLayoutCx<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, param_env: ParamEnv<'tcx>, } @@ -119,7 +119,7 @@ impl LayoutOf for UnwrapLayoutCx<'tcx> { } impl HasTyCtxt<'tcx> for UnwrapLayoutCx<'tcx> { - fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx, 'tcx> { + fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx> { self.tcx } } diff --git a/src/librustc_passes/loops.rs b/src/librustc_passes/loops.rs index 6bcf4365db0a4..4c361e975b2e0 100644 --- a/src/librustc_passes/loops.rs +++ b/src/librustc_passes/loops.rs @@ -45,7 +45,7 @@ struct CheckLoopVisitor<'a, 'hir: 'a> { cx: Context, } -fn check_mod_loops<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, module_def_id: DefId) { +fn check_mod_loops<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, module_def_id: DefId) { tcx.hir().visit_item_likes_in_module(module_def_id, &mut CheckLoopVisitor { sess: &tcx.sess, hir_map: &tcx.hir(), diff --git a/src/librustc_passes/rvalue_promotion.rs b/src/librustc_passes/rvalue_promotion.rs index 29d6bd3002785..6a26d942537c7 100644 --- a/src/librustc_passes/rvalue_promotion.rs +++ b/src/librustc_passes/rvalue_promotion.rs @@ -39,7 +39,7 @@ pub fn provide(providers: &mut Providers<'_>) { }; } -fn const_is_rvalue_promotable_to_static<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn const_is_rvalue_promotable_to_static<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> bool { @@ -51,7 +51,7 @@ fn const_is_rvalue_promotable_to_static<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, tcx.rvalue_promotable_map(def_id).contains(&body_id.hir_id.local_id) } -fn rvalue_promotable_map<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn rvalue_promotable_map<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> &'tcx ItemLocalSet { @@ -81,7 +81,7 @@ fn rvalue_promotable_map<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } struct CheckCrateVisitor<'a, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, in_fn: bool, in_static: bool, mut_rvalue_borrows: HirIdSet, diff --git a/src/librustc_plugin/build.rs b/src/librustc_plugin/build.rs index 31dec72c0e41b..f269d3af91f89 100644 --- a/src/librustc_plugin/build.rs +++ b/src/librustc_plugin/build.rs @@ -30,12 +30,12 @@ impl<'v> ItemLikeVisitor<'v> for RegistrarFinder { } /// Finds the function marked with `#[plugin_registrar]`, if any. -pub fn find_plugin_registrar<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Option { +pub fn find_plugin_registrar<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) -> Option { tcx.plugin_registrar_fn(LOCAL_CRATE) } fn plugin_registrar_fn<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, cnum: CrateNum, ) -> Option { assert_eq!(cnum, LOCAL_CRATE); diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index 9cf433abc6e68..38e102345b3e7 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -49,7 +49,7 @@ mod error_codes; /// manually. Second, it doesn't visit some type components like signatures of fn types, or traits /// in `impl Trait`, see individual comments in `DefIdVisitorSkeleton::visit_ty`. trait DefIdVisitor<'tcx> { - fn tcx(&self) -> TyCtxt<'tcx, 'tcx, 'tcx>; + fn tcx(&self) -> TyCtxt<'tcx, 'tcx>; fn shallow(&self) -> bool { false } fn skip_assoc_tys(&self) -> bool { false } fn visit_def_id(&mut self, def_id: DefId, kind: &str, descr: &dyn fmt::Display) -> bool; @@ -78,7 +78,7 @@ struct DefIdVisitorSkeleton<'v, 'tcx, V> { def_id_visitor: &'v mut V, visited_opaque_tys: FxHashSet, - dummy: PhantomData>, + dummy: PhantomData>, } impl<'tcx, V> DefIdVisitorSkeleton<'_, 'tcx, V> @@ -220,7 +220,7 @@ impl<'tcx, V> TypeVisitor<'tcx> for DefIdVisitorSkeleton<'_, 'tcx, V> } } -fn def_id_visibility<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) +fn def_id_visibility<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> (ty::Visibility, Span, &'static str) { match tcx.hir().as_local_hir_id(def_id) { Some(hir_id) => { @@ -323,7 +323,7 @@ fn def_id_visibility<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) // Set the correct `TypeckTables` for the given `item_id` (or an empty table if // there is no `TypeckTables` for the item). -fn item_tables<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn item_tables<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx>, hir_id: hir::HirId, empty_tables: &'a ty::TypeckTables<'tcx>) -> &'a ty::TypeckTables<'tcx> { @@ -331,7 +331,7 @@ fn item_tables<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, if tcx.has_typeck_tables(def_id) { tcx.typeck_tables_of(def_id) } else { empty_tables } } -fn min<'tcx>(vis1: ty::Visibility, vis2: ty::Visibility, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) +fn min<'tcx>(vis1: ty::Visibility, vis2: ty::Visibility, tcx: TyCtxt<'tcx, 'tcx>) -> ty::Visibility { if vis1.is_at_least(vis2, tcx) { vis2 } else { vis1 } } @@ -343,7 +343,7 @@ fn min<'tcx>(vis1: ty::Visibility, vis2: ty::Visibility, tcx: TyCtxt<'tcx, 'tcx, /// in crates that have been updated to use pub(restricted). //////////////////////////////////////////////////////////////////////////////// struct PubRestrictedVisitor<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, has_pub_restricted: bool, } @@ -361,13 +361,13 @@ impl Visitor<'tcx> for PubRestrictedVisitor<'tcx> { //////////////////////////////////////////////////////////////////////////////// struct FindMin<'a, 'tcx, VL: VisibilityLike> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, access_levels: &'a AccessLevels, min: VL, } impl<'a, 'tcx, VL: VisibilityLike> DefIdVisitor<'tcx> for FindMin<'a, 'tcx, VL> { - fn tcx(&self) -> TyCtxt<'tcx, 'tcx, 'tcx> { self.tcx } + fn tcx(&self) -> TyCtxt<'tcx, 'tcx> { self.tcx } fn shallow(&self) -> bool { VL::SHALLOW } fn skip_assoc_tys(&self) -> bool { true } fn visit_def_id(&mut self, def_id: DefId, _kind: &str, _descr: &dyn fmt::Display) -> bool { @@ -383,7 +383,7 @@ trait VisibilityLike: Sized { // Returns an over-approximation (`skip_assoc_tys` = true) of visibility due to // associated types for which we can't determine visibility precisely. - fn of_impl<'a, 'tcx>(hir_id: hir::HirId, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + fn of_impl<'a, 'tcx>(hir_id: hir::HirId, tcx: TyCtxt<'tcx, 'tcx>, access_levels: &'a AccessLevels) -> Self { let mut find = FindMin { tcx, access_levels, min: Self::MAX }; let def_id = tcx.hir().local_def_id_from_hir_id(hir_id); @@ -426,7 +426,7 @@ impl VisibilityLike for Option { //////////////////////////////////////////////////////////////////////////////// struct EmbargoVisitor<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, // Accessibility levels for reachable nodes. access_levels: AccessLevels, @@ -815,7 +815,7 @@ impl ReachEverythingInTheInterfaceVisitor<'_, 'tcx> { } impl DefIdVisitor<'tcx> for ReachEverythingInTheInterfaceVisitor<'_, 'tcx> { - fn tcx(&self) -> TyCtxt<'tcx, 'tcx, 'tcx> { self.ev.tcx } + fn tcx(&self) -> TyCtxt<'tcx, 'tcx> { self.ev.tcx } fn visit_def_id(&mut self, def_id: DefId, _kind: &str, _descr: &dyn fmt::Display) -> bool { if let Some(hir_id) = self.ev.tcx.hir().as_local_hir_id(def_id) { self.ev.update(hir_id, self.access_level); @@ -832,7 +832,7 @@ impl DefIdVisitor<'tcx> for ReachEverythingInTheInterfaceVisitor<'_, 'tcx> { ////////////////////////////////////////////////////////////////////////////////////// struct NamePrivacyVisitor<'a, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, tables: &'a ty::TypeckTables<'tcx>, current_item: hir::HirId, empty_tables: &'a ty::TypeckTables<'tcx>, @@ -959,7 +959,7 @@ impl<'a, 'tcx> Visitor<'tcx> for NamePrivacyVisitor<'a, 'tcx> { //////////////////////////////////////////////////////////////////////////////////////////// struct TypePrivacyVisitor<'a, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, tables: &'a ty::TypeckTables<'tcx>, current_item: DefId, in_body: bool, @@ -1178,7 +1178,7 @@ impl<'a, 'tcx> Visitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> { } impl DefIdVisitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> { - fn tcx(&self) -> TyCtxt<'tcx, 'tcx, 'tcx> { self.tcx } + fn tcx(&self) -> TyCtxt<'tcx, 'tcx> { self.tcx } fn visit_def_id(&mut self, def_id: DefId, kind: &str, descr: &dyn fmt::Display) -> bool { self.check_def_id(def_id, kind, descr) } @@ -1192,7 +1192,7 @@ impl DefIdVisitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> { /////////////////////////////////////////////////////////////////////////////// struct ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, access_levels: &'a AccessLevels, in_variant: bool, // Set of errors produced by this obsolete visitor. @@ -1536,7 +1536,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { /////////////////////////////////////////////////////////////////////////////// struct SearchInterfaceForPrivateItemsVisitor<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, item_id: hir::HirId, item_def_id: DefId, span: Span, @@ -1634,14 +1634,14 @@ impl SearchInterfaceForPrivateItemsVisitor<'tcx> { } impl DefIdVisitor<'tcx> for SearchInterfaceForPrivateItemsVisitor<'tcx> { - fn tcx(&self) -> TyCtxt<'tcx, 'tcx, 'tcx> { self.tcx } + fn tcx(&self) -> TyCtxt<'tcx, 'tcx> { self.tcx } fn visit_def_id(&mut self, def_id: DefId, kind: &str, descr: &dyn fmt::Display) -> bool { self.check_def_id(def_id, kind, descr) } } struct PrivateItemsInPublicInterfacesVisitor<'a, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, has_pub_restricted: bool, old_error_set: &'a HirIdSet, } @@ -1814,7 +1814,7 @@ pub fn provide(providers: &mut Providers<'_>) { }; } -fn check_mod_privacy<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, module_def_id: DefId) { +fn check_mod_privacy<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, module_def_id: DefId) { let empty_tables = ty::TypeckTables::empty(None); // Check privacy of names not checked in previous compilation stages. @@ -1842,7 +1842,7 @@ fn check_mod_privacy<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, module_def_id: DefId) } fn privacy_access_levels<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, krate: CrateNum, ) -> &'tcx AccessLevels { assert_eq!(krate, LOCAL_CRATE); @@ -1868,7 +1868,7 @@ fn privacy_access_levels<'tcx>( tcx.arena.alloc(visitor.access_levels) } -fn check_private_in_public<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, krate: CrateNum) { +fn check_private_in_public<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, krate: CrateNum) { assert_eq!(krate, LOCAL_CRATE); let access_levels = tcx.privacy_access_levels(LOCAL_CRATE); diff --git a/src/librustc_save_analysis/dump_visitor.rs b/src/librustc_save_analysis/dump_visitor.rs index e000679ffe36a..3b4ea384a09a3 100644 --- a/src/librustc_save_analysis/dump_visitor.rs +++ b/src/librustc_save_analysis/dump_visitor.rs @@ -77,7 +77,7 @@ macro_rules! access_from_vis { pub struct DumpVisitor<'l, 'tcx: 'l, 'll, O: DumpOutput> { save_ctxt: SaveContext<'l, 'tcx>, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, dumper: &'ll mut JsonDumper, span: SpanUtils<'l>, diff --git a/src/librustc_save_analysis/lib.rs b/src/librustc_save_analysis/lib.rs index 1e143942a791c..139fd640d628c 100644 --- a/src/librustc_save_analysis/lib.rs +++ b/src/librustc_save_analysis/lib.rs @@ -52,7 +52,7 @@ use log::{debug, error, info}; pub struct SaveContext<'l, 'tcx: 'l> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, tables: &'l ty::TypeckTables<'tcx>, access_levels: &'l AccessLevels, span_utils: SpanUtils<'tcx>, @@ -1115,7 +1115,7 @@ impl<'b> SaveHandler for CallbackHandler<'b> { } pub fn process_crate<'l, 'tcx, H: SaveHandler>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, krate: &ast::Crate, cratename: &str, input: &'l Input, diff --git a/src/librustc_traits/chalk_context/mod.rs b/src/librustc_traits/chalk_context/mod.rs index fede04fdce23e..77f59ae6c32ce 100644 --- a/src/librustc_traits/chalk_context/mod.rs +++ b/src/librustc_traits/chalk_context/mod.rs @@ -52,7 +52,7 @@ crate struct ChalkArenas<'gcx> { #[derive(Copy, Clone)] crate struct ChalkContext<'gcx> { _arenas: ChalkArenas<'gcx>, - tcx: TyCtxt<'gcx, 'gcx, 'gcx>, + tcx: TyCtxt<'gcx, 'gcx>, } #[derive(Copy, Clone)] @@ -527,7 +527,7 @@ impl ChalkContextLift<'tcx> for ChalkArenas<'a> { fn lift_ex_clause_to_tcx( ex_clause: &ChalkExClause<'a>, - tcx: TyCtxt<'tcx, 'gcx, 'tcx> + tcx: TyCtxt<'gcx, 'tcx> ) -> Option { Some(ChalkExClause { subst: tcx.lift(&ex_clause.subst)?, @@ -539,7 +539,7 @@ impl ChalkContextLift<'tcx> for ChalkArenas<'a> { fn lift_delayed_literal_to_tcx( literal: &DelayedLiteral>, - tcx: TyCtxt<'tcx, 'gcx, 'tcx> + tcx: TyCtxt<'gcx, 'tcx> ) -> Option { Some(match literal { DelayedLiteral::CannotProve(()) => DelayedLiteral::CannotProve(()), @@ -553,7 +553,7 @@ impl ChalkContextLift<'tcx> for ChalkArenas<'a> { fn lift_literal_to_tcx( literal: &Literal>, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, ) -> Option { Some(match literal { Literal::Negative(goal) => Literal::Negative(tcx.lift(goal)?), @@ -673,7 +673,7 @@ crate fn provide(p: &mut Providers<'_>) { } crate fn evaluate_goal<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, goal: ChalkCanonicalGoal<'tcx> ) -> Result< &'tcx Canonical<'tcx, QueryResponse<'tcx, ()>>, diff --git a/src/librustc_traits/chalk_context/program_clauses/builtin.rs b/src/librustc_traits/chalk_context/program_clauses/builtin.rs index 53375bd4cc9da..7dc8264832249 100644 --- a/src/librustc_traits/chalk_context/program_clauses/builtin.rs +++ b/src/librustc_traits/chalk_context/program_clauses/builtin.rs @@ -15,7 +15,7 @@ use crate::generic_types; /// `Implemented(ty: Trait) :- Implemented(nested: Trait)...` /// where `Trait` is specified by `trait_def_id`. fn builtin_impl_clause( - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, ty: Ty<'tcx>, nested: &[Kind<'tcx>], trait_def_id: DefId @@ -43,7 +43,7 @@ fn builtin_impl_clause( } crate fn assemble_builtin_unsize_impls<'tcx>( - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, unsize_def_id: DefId, source: Ty<'tcx>, target: Ty<'tcx>, @@ -119,7 +119,7 @@ crate fn assemble_builtin_unsize_impls<'tcx>( } crate fn assemble_builtin_sized_impls<'tcx>( - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, sized_def_id: DefId, ty: Ty<'tcx>, clauses: &mut Vec> @@ -223,7 +223,7 @@ crate fn assemble_builtin_sized_impls<'tcx>( } crate fn assemble_builtin_copy_clone_impls<'tcx>( - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, trait_def_id: DefId, ty: Ty<'tcx>, clauses: &mut Vec> diff --git a/src/librustc_traits/chalk_context/program_clauses/mod.rs b/src/librustc_traits/chalk_context/program_clauses/mod.rs index 2bd3902c74350..8702bc7dbc089 100644 --- a/src/librustc_traits/chalk_context/program_clauses/mod.rs +++ b/src/librustc_traits/chalk_context/program_clauses/mod.rs @@ -19,7 +19,7 @@ use self::primitive::*; use self::builtin::*; fn assemble_clauses_from_impls<'tcx>( - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, trait_def_id: DefId, clauses: &mut Vec> ) { @@ -33,7 +33,7 @@ fn assemble_clauses_from_impls<'tcx>( } fn assemble_clauses_from_assoc_ty_values<'tcx>( - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, trait_def_id: DefId, clauses: &mut Vec> ) { diff --git a/src/librustc_traits/chalk_context/program_clauses/primitive.rs b/src/librustc_traits/chalk_context/program_clauses/primitive.rs index a4c3b62a6b772..a1d9e7e0cde23 100644 --- a/src/librustc_traits/chalk_context/program_clauses/primitive.rs +++ b/src/librustc_traits/chalk_context/program_clauses/primitive.rs @@ -16,7 +16,7 @@ use crate::generic_types; use std::iter; crate fn wf_clause_for_raw_ptr<'tcx>( - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, mutbl: hir::Mutability ) -> Clauses<'tcx> { let ptr_ty = generic_types::raw_ptr(tcx, mutbl); @@ -33,7 +33,7 @@ crate fn wf_clause_for_raw_ptr<'tcx>( } crate fn wf_clause_for_fn_ptr<'tcx>( - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, arity_and_output: usize, variadic: bool, unsafety: hir::Unsafety, @@ -53,7 +53,7 @@ crate fn wf_clause_for_fn_ptr<'tcx>( tcx.mk_clauses(iter::once(wf_clause)) } -crate fn wf_clause_for_slice<'tcx>(tcx: TyCtxt<'tcx, '_, 'tcx>) -> Clauses<'tcx> { +crate fn wf_clause_for_slice<'tcx>(tcx: TyCtxt<'_, 'tcx>) -> Clauses<'tcx> { let ty = generic_types::bound(tcx, 0); let slice_ty = tcx.mk_slice(ty); @@ -83,7 +83,7 @@ crate fn wf_clause_for_slice<'tcx>(tcx: TyCtxt<'tcx, '_, 'tcx>) -> Clauses<'tcx> } crate fn wf_clause_for_array<'tcx>( - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, length: &'tcx ty::Const<'tcx> ) -> Clauses<'tcx> { let ty = generic_types::bound(tcx, 0); @@ -115,7 +115,7 @@ crate fn wf_clause_for_array<'tcx>( } crate fn wf_clause_for_tuple<'tcx>( - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, arity: usize ) -> Clauses<'tcx> { let type_list = generic_types::type_list(tcx, arity); @@ -159,7 +159,7 @@ crate fn wf_clause_for_tuple<'tcx>( } crate fn wf_clause_for_ref<'tcx>( - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, mutbl: hir::Mutability ) -> Clauses<'tcx> { let region = tcx.mk_region( @@ -186,7 +186,7 @@ crate fn wf_clause_for_ref<'tcx>( } crate fn wf_clause_for_fn_def<'tcx>( - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, def_id: DefId ) -> Clauses<'tcx> { let fn_def = generic_types::fn_def(tcx, def_id); diff --git a/src/librustc_traits/chalk_context/resolvent_ops.rs b/src/librustc_traits/chalk_context/resolvent_ops.rs index d894c6c2a03e9..ff2cfc87297de 100644 --- a/src/librustc_traits/chalk_context/resolvent_ops.rs +++ b/src/librustc_traits/chalk_context/resolvent_ops.rs @@ -170,7 +170,7 @@ impl AnswerSubstitutor<'cx, 'gcx, 'tcx> { } impl TypeRelation<'gcx, 'tcx> for AnswerSubstitutor<'cx, 'gcx, 'tcx> { - fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.infcx.tcx } diff --git a/src/librustc_traits/dropck_outlives.rs b/src/librustc_traits/dropck_outlives.rs index 3de64f4f4c43e..02b9b078fca91 100644 --- a/src/librustc_traits/dropck_outlives.rs +++ b/src/librustc_traits/dropck_outlives.rs @@ -18,7 +18,7 @@ crate fn provide(p: &mut Providers<'_>) { } fn dropck_outlives<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, canonical_goal: CanonicalTyGoal<'tcx>, ) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, DropckOutlivesResult<'tcx>>>, NoSolution> { debug!("dropck_outlives(goal={:#?})", canonical_goal); @@ -147,7 +147,7 @@ fn dropck_outlives<'tcx>( /// Returns a set of constraints that needs to be satisfied in /// order for `ty` to be valid for destruction. fn dtorck_constraint_for_ty<'gcx, 'tcx>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, span: Span, for_ty: Ty<'tcx>, depth: usize, @@ -280,7 +280,7 @@ fn dtorck_constraint_for_ty<'gcx, 'tcx>( /// Calculates the dtorck constraint for a type. crate fn adt_dtorck_constraint<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, ) -> Result, NoSolution> { let def = tcx.adt_def(def_id); diff --git a/src/librustc_traits/evaluate_obligation.rs b/src/librustc_traits/evaluate_obligation.rs index 789da125ba91f..be3a8340e6006 100644 --- a/src/librustc_traits/evaluate_obligation.rs +++ b/src/librustc_traits/evaluate_obligation.rs @@ -14,7 +14,7 @@ crate fn provide(p: &mut Providers<'_>) { } fn evaluate_obligation<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, canonical_goal: CanonicalPredicateGoal<'tcx>, ) -> Result { tcx.infer_ctxt().enter_with_canonical( diff --git a/src/librustc_traits/generic_types.rs b/src/librustc_traits/generic_types.rs index a9aa540acc11c..7eb1cd093a82f 100644 --- a/src/librustc_traits/generic_types.rs +++ b/src/librustc_traits/generic_types.rs @@ -6,7 +6,7 @@ use rustc::hir; use rustc::hir::def_id::DefId; use rustc_target::spec::abi; -crate fn bound(tcx: TyCtxt<'tcx, '_, 'tcx>, index: u32) -> Ty<'tcx> { +crate fn bound(tcx: TyCtxt<'_, 'tcx>, index: u32) -> Ty<'tcx> { let ty = ty::Bound( ty::INNERMOST, ty::BoundVar::from_u32(index).into() @@ -14,7 +14,7 @@ crate fn bound(tcx: TyCtxt<'tcx, '_, 'tcx>, index: u32) -> Ty<'tcx> { tcx.mk_ty(ty) } -crate fn raw_ptr(tcx: TyCtxt<'tcx, '_, 'tcx>, mutbl: hir::Mutability) -> Ty<'tcx> { +crate fn raw_ptr(tcx: TyCtxt<'_, 'tcx>, mutbl: hir::Mutability) -> Ty<'tcx> { tcx.mk_ptr(ty::TypeAndMut { ty: bound(tcx, 0), mutbl, @@ -22,7 +22,7 @@ crate fn raw_ptr(tcx: TyCtxt<'tcx, '_, 'tcx>, mutbl: hir::Mutability) -> Ty<'tcx } crate fn fn_ptr( - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, arity_and_output: usize, c_variadic: bool, unsafety: hir::Unsafety, @@ -44,7 +44,7 @@ crate fn fn_ptr( tcx.mk_fn_ptr(fn_sig) } -crate fn type_list(tcx: TyCtxt<'tcx, '_, 'tcx>, arity: usize) -> SubstsRef<'tcx> { +crate fn type_list(tcx: TyCtxt<'_, 'tcx>, arity: usize) -> SubstsRef<'tcx> { tcx.mk_substs( (0..arity).into_iter() .map(|i| ty::BoundVar::from(i)) @@ -53,7 +53,7 @@ crate fn type_list(tcx: TyCtxt<'tcx, '_, 'tcx>, arity: usize) -> SubstsRef<'tcx> ) } -crate fn ref_ty(tcx: TyCtxt<'tcx, '_, 'tcx>, mutbl: hir::Mutability) -> Ty<'tcx> { +crate fn ref_ty(tcx: TyCtxt<'_, 'tcx>, mutbl: hir::Mutability) -> Ty<'tcx> { let region = tcx.mk_region( ty::ReLateBound(ty::INNERMOST, ty::BoundRegion::BrAnon(0)) ); @@ -64,17 +64,17 @@ crate fn ref_ty(tcx: TyCtxt<'tcx, '_, 'tcx>, mutbl: hir::Mutability) -> Ty<'tcx> }) } -crate fn fn_def(tcx: TyCtxt<'tcx, '_, 'tcx>, def_id: DefId) -> Ty<'tcx> { +crate fn fn_def(tcx: TyCtxt<'_, 'tcx>, def_id: DefId) -> Ty<'tcx> { tcx.mk_ty(ty::FnDef(def_id, InternalSubsts::bound_vars_for_item(tcx, def_id))) } -crate fn closure(tcx: TyCtxt<'tcx, '_, 'tcx>, def_id: DefId) -> Ty<'tcx> { +crate fn closure(tcx: TyCtxt<'_, 'tcx>, def_id: DefId) -> Ty<'tcx> { tcx.mk_closure(def_id, ty::ClosureSubsts { substs: InternalSubsts::bound_vars_for_item(tcx, def_id), }) } -crate fn generator(tcx: TyCtxt<'tcx, '_, 'tcx>, def_id: DefId) -> Ty<'tcx> { +crate fn generator(tcx: TyCtxt<'_, 'tcx>, def_id: DefId) -> Ty<'tcx> { tcx.mk_generator(def_id, ty::GeneratorSubsts { substs: InternalSubsts::bound_vars_for_item(tcx, def_id), }, hir::GeneratorMovability::Movable) diff --git a/src/librustc_traits/implied_outlives_bounds.rs b/src/librustc_traits/implied_outlives_bounds.rs index 03976ace692ea..88bc61886b7d4 100644 --- a/src/librustc_traits/implied_outlives_bounds.rs +++ b/src/librustc_traits/implied_outlives_bounds.rs @@ -23,7 +23,7 @@ crate fn provide(p: &mut Providers<'_>) { } fn implied_outlives_bounds<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, goal: CanonicalTyGoal<'tcx>, ) -> Result< &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, Vec>>>, diff --git a/src/librustc_traits/lowering/environment.rs b/src/librustc_traits/lowering/environment.rs index 569836680b5fe..537b6d3e09012 100644 --- a/src/librustc_traits/lowering/environment.rs +++ b/src/librustc_traits/lowering/environment.rs @@ -12,12 +12,12 @@ use rustc::hir::def_id::DefId; use rustc_data_structures::fx::FxHashSet; struct ClauseVisitor<'a, 'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, round: &'a mut FxHashSet>, } impl ClauseVisitor<'a, 'tcx> { - fn new(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, round: &'a mut FxHashSet>) -> Self { + fn new(tcx: TyCtxt<'tcx, 'tcx>, round: &'a mut FxHashSet>) -> Self { ClauseVisitor { tcx, round, @@ -128,7 +128,7 @@ impl ClauseVisitor<'a, 'tcx> { } crate fn program_clauses_for_env<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, environment: Environment<'tcx>, ) -> Clauses<'tcx> { debug!("program_clauses_for_env(environment={:?})", environment); @@ -161,7 +161,7 @@ crate fn program_clauses_for_env<'tcx>( } crate fn environment<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId ) -> Environment<'tcx> { use super::{Lower, IntoFromEnvGoal}; diff --git a/src/librustc_traits/lowering/mod.rs b/src/librustc_traits/lowering/mod.rs index 59b61abee8f52..c73f61f070e37 100644 --- a/src/librustc_traits/lowering/mod.rs +++ b/src/librustc_traits/lowering/mod.rs @@ -156,7 +156,7 @@ impl<'tcx> IntoWellFormedGoal for DomainGoal<'tcx> { } crate fn program_clauses_for<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, ) -> Clauses<'tcx> { // FIXME(eddyb) this should only be using `def_kind`. @@ -185,7 +185,7 @@ crate fn program_clauses_for<'tcx>( } fn program_clauses_for_trait<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, ) -> Clauses<'tcx> { // `trait Trait where WC { .. } // P0 == Self` @@ -300,7 +300,7 @@ fn program_clauses_for_trait<'tcx>( ) } -fn program_clauses_for_impl(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> Clauses<'tcx> { +fn program_clauses_for_impl(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> Clauses<'tcx> { if let ImplPolarity::Negative = tcx.impl_polarity(def_id) { return List::empty(); } @@ -344,7 +344,7 @@ fn program_clauses_for_impl(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> Cla } pub fn program_clauses_for_type_def<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, ) -> Clauses<'tcx> { // Rule WellFormed-Type @@ -421,7 +421,7 @@ pub fn program_clauses_for_type_def<'tcx>( } pub fn program_clauses_for_associated_type_def<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, item_id: DefId, ) -> Clauses<'tcx> { // Rule ProjectionEq-Placeholder @@ -559,7 +559,7 @@ pub fn program_clauses_for_associated_type_def<'tcx>( } pub fn program_clauses_for_associated_type_value<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, item_id: DefId, ) -> Clauses<'tcx> { // Rule Normalize-From-Impl (see rustc guide) @@ -620,7 +620,7 @@ pub fn program_clauses_for_associated_type_value<'tcx>( tcx.mk_clauses(iter::once(normalize_clause)) } -pub fn dump_program_clauses<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn dump_program_clauses<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) { if !tcx.features().rustc_attrs { return; } @@ -632,7 +632,7 @@ pub fn dump_program_clauses<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { } struct ClauseDumper<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, } impl ClauseDumper<'tcx> { diff --git a/src/librustc_traits/normalize_erasing_regions.rs b/src/librustc_traits/normalize_erasing_regions.rs index 448c544afbb27..5dec1613f1e95 100644 --- a/src/librustc_traits/normalize_erasing_regions.rs +++ b/src/librustc_traits/normalize_erasing_regions.rs @@ -12,7 +12,7 @@ crate fn provide(p: &mut Providers<'_>) { } fn normalize_ty_after_erasing_regions<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, goal: ParamEnvAnd<'tcx, Ty<'tcx>>, ) -> Ty<'tcx> { debug!("normalize_ty_after_erasing_regions(goal={:#?})", goal); diff --git a/src/librustc_traits/normalize_projection_ty.rs b/src/librustc_traits/normalize_projection_ty.rs index a080ffcb2c1a7..448d42dc9b051 100644 --- a/src/librustc_traits/normalize_projection_ty.rs +++ b/src/librustc_traits/normalize_projection_ty.rs @@ -15,7 +15,7 @@ crate fn provide(p: &mut Providers<'_>) { } fn normalize_projection_ty<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, goal: CanonicalProjectionGoal<'tcx>, ) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, NormalizationResult<'tcx>>>, NoSolution> { debug!("normalize_provider(goal={:#?})", goal); diff --git a/src/librustc_traits/type_op.rs b/src/librustc_traits/type_op.rs index a00e66fa56cac..f2ceff6185e92 100644 --- a/src/librustc_traits/type_op.rs +++ b/src/librustc_traits/type_op.rs @@ -35,7 +35,7 @@ crate fn provide(p: &mut Providers<'_>) { } fn type_op_ascribe_user_type<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, AscribeUserType<'tcx>>>, ) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, ()>>, NoSolution> { tcx.infer_ctxt() @@ -94,7 +94,7 @@ impl AscribeUserTypeCx<'me, 'gcx, 'tcx> { ); } - fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.infcx.tcx } @@ -167,7 +167,7 @@ impl AscribeUserTypeCx<'me, 'gcx, 'tcx> { } fn type_op_eq<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, Eq<'tcx>>>, ) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, ()>>, NoSolution> { tcx.infer_ctxt() @@ -197,7 +197,7 @@ where } fn type_op_normalize_ty( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, Normalize>>>, ) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, Ty<'tcx>>>, NoSolution> { tcx.infer_ctxt() @@ -205,7 +205,7 @@ fn type_op_normalize_ty( } fn type_op_normalize_predicate( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, Normalize>>>, ) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, Predicate<'tcx>>>, NoSolution> { tcx.infer_ctxt() @@ -213,7 +213,7 @@ fn type_op_normalize_predicate( } fn type_op_normalize_fn_sig( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, Normalize>>>, ) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, FnSig<'tcx>>>, NoSolution> { tcx.infer_ctxt() @@ -221,7 +221,7 @@ fn type_op_normalize_fn_sig( } fn type_op_normalize_poly_fn_sig( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, Normalize>>>, ) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, PolyFnSig<'tcx>>>, NoSolution> { tcx.infer_ctxt() @@ -229,7 +229,7 @@ fn type_op_normalize_poly_fn_sig( } fn type_op_subtype<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, Subtype<'tcx>>>, ) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, ()>>, NoSolution> { tcx.infer_ctxt() @@ -243,7 +243,7 @@ fn type_op_subtype<'tcx>( } fn type_op_prove_predicate<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, ProvePredicate<'tcx>>>, ) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, ()>>, NoSolution> { tcx.infer_ctxt() diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index 92a28defa5553..9730623b552ac 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -41,7 +41,7 @@ use rustc_data_structures::fx::FxHashSet; pub struct PathSeg(pub DefId, pub usize); pub trait AstConv<'gcx, 'tcx> { - fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'gcx, 'tcx>; + fn tcx<'a>(&'a self) -> TyCtxt<'gcx, 'tcx>; /// Returns the set of bounds in scope for the type parameter with /// the given id. @@ -208,7 +208,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { /// Report error if there is an explicit type parameter when using `impl Trait`. fn check_impl_trait( - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, span: Span, seg: &hir::PathSegment, generics: &ty::Generics, @@ -239,7 +239,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { /// Checks that the correct number of generic arguments have been provided. /// Used specifically for function calls. pub fn check_generic_arg_count_for_call( - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, span: Span, def: &ty::Generics, seg: &hir::PathSegment, @@ -271,7 +271,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { /// Checks that the correct number of generic arguments have been provided. /// This is used both for datatypes and function calls. fn check_generic_arg_count( - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, span: Span, def: &ty::Generics, args: &hir::GenericArgs, @@ -462,7 +462,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { /// - `inferred_kind`: if no parameter was provided, and inference is enabled, then /// creates a suitable inference variable. pub fn create_substs_for_generic_args<'b>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, def_id: DefId, parent_substs: &[Kind<'tcx>], has_self: bool, @@ -1810,7 +1810,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { has_err } - pub fn prohibit_assoc_ty_binding(tcx: TyCtxt<'_, '_, '_>, span: Span) { + pub fn prohibit_assoc_ty_binding(tcx: TyCtxt<'_, '_>, span: Span) { let mut err = struct_span_err!(tcx.sess, span, E0229, "associated type bindings are not allowed here"); err.span_label(span, "associated type not allowed here").emit(); @@ -2420,7 +2420,7 @@ impl<'gcx, 'tcx> Bounds<'tcx> { /// where-clauses). Because some of our bounds listings (e.g., /// regions) don't include the self-type, you must supply the /// self-type here (the `param_ty` parameter). - pub fn predicates(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, param_ty: Ty<'tcx>) + pub fn predicates(&self, tcx: TyCtxt<'gcx, 'tcx>, param_ty: Ty<'tcx>) -> Vec<(ty::Predicate<'tcx>, Span)> { // If it could be sized, and is, add the `Sized` predicate. diff --git a/src/librustc_typeck/check/autoderef.rs b/src/librustc_typeck/check/autoderef.rs index 6281b20f24af2..8cb4360e65d3d 100644 --- a/src/librustc_typeck/check/autoderef.rs +++ b/src/librustc_typeck/check/autoderef.rs @@ -240,7 +240,7 @@ impl<'a, 'gcx, 'tcx> Autoderef<'a, 'gcx, 'tcx> { } pub fn report_autoderef_recursion_limit_error<'gcx, 'tcx>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, span: Span, ty: Ty<'tcx>) + tcx: TyCtxt<'gcx, 'tcx>, span: Span, ty: Ty<'tcx>) { // We've reached the recursion limit, error gracefully. let suggested_limit = *tcx.sess.recursion_limit.get() * 2; diff --git a/src/librustc_typeck/check/callee.rs b/src/librustc_typeck/check/callee.rs index 8d32583da4b22..8e13bbed89e78 100644 --- a/src/librustc_typeck/check/callee.rs +++ b/src/librustc_typeck/check/callee.rs @@ -18,7 +18,7 @@ use rustc::hir; /// Checks that it is legal to call methods of the trait corresponding /// to `trait_id` (this only cares about the trait, not the specific /// method that is called). -pub fn check_legal_trait_for_method_call(tcx: TyCtxt<'_, '_, '_>, span: Span, trait_id: DefId) { +pub fn check_legal_trait_for_method_call(tcx: TyCtxt<'_, '_>, span: Span, trait_id: DefId) { if tcx.lang_items().drop_trait() == Some(trait_id) { struct_span_err!(tcx.sess, span, E0040, "explicit use of destructor method") .span_label(span, "explicit destructor calls not allowed") diff --git a/src/librustc_typeck/check/compare_method.rs b/src/librustc_typeck/check/compare_method.rs index 920dbff7b8cc6..7c24ea1641493 100644 --- a/src/librustc_typeck/check/compare_method.rs +++ b/src/librustc_typeck/check/compare_method.rs @@ -23,7 +23,7 @@ use super::{Inherited, FnCtxt, potentially_plural_count}; /// - `trait_m`: the method in the trait /// - `impl_trait_ref`: the TraitRef corresponding to the trait implementation -pub fn compare_impl_method<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn compare_impl_method<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, impl_m: &ty::AssocItem, impl_m_span: Span, trait_m: &ty::AssocItem, @@ -73,7 +73,7 @@ pub fn compare_impl_method<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } } -fn compare_predicate_entailment<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn compare_predicate_entailment<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, impl_m: &ty::AssocItem, impl_m_span: Span, trait_m: &ty::AssocItem, @@ -355,7 +355,7 @@ fn compare_predicate_entailment<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, }) } -fn check_region_bounds_on_impl_method<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn check_region_bounds_on_impl_method<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, span: Span, impl_m: &ty::AssocItem, trait_m: &ty::AssocItem, @@ -495,7 +495,7 @@ fn extract_spans_for_error_reporting<'a, 'gcx, 'tcx>(infcx: &infer::InferCtxt<'a } } -fn compare_self_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn compare_self_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, impl_m: &ty::AssocItem, impl_m_span: Span, trait_m: &ty::AssocItem, @@ -581,7 +581,7 @@ fn compare_self_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } fn compare_number_of_generics<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, impl_: &ty::AssocItem, _impl_span: Span, trait_: &ty::AssocItem, @@ -695,7 +695,7 @@ fn compare_number_of_generics<'tcx>( } } -fn compare_number_of_method_arguments<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn compare_number_of_method_arguments<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, impl_m: &ty::AssocItem, impl_m_span: Span, trait_m: &ty::AssocItem, @@ -779,7 +779,7 @@ fn compare_number_of_method_arguments<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, Ok(()) } -fn compare_synthetic_generics<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn compare_synthetic_generics<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, impl_m: &ty::AssocItem, trait_m: &ty::AssocItem) -> Result<(), ErrorReported> { @@ -951,7 +951,7 @@ fn compare_synthetic_generics<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } } -pub fn compare_const_impl<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn compare_const_impl<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, impl_c: &ty::AssocItem, impl_c_span: Span, trait_c: &ty::AssocItem, diff --git a/src/librustc_typeck/check/dropck.rs b/src/librustc_typeck/check/dropck.rs index 6094fd1f5f2fc..1e6ae1e030912 100644 --- a/src/librustc_typeck/check/dropck.rs +++ b/src/librustc_typeck/check/dropck.rs @@ -30,7 +30,7 @@ use syntax_pos::Span; /// cannot do `struct S; impl Drop for S { ... }`). /// pub fn check_drop_impl<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, drop_impl_did: DefId, ) -> Result<(), ErrorReported> { let dtor_self_type = tcx.type_of(drop_impl_did); @@ -65,7 +65,7 @@ pub fn check_drop_impl<'tcx>( } fn ensure_drop_params_and_item_params_correspond<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, drop_impl_did: DefId, drop_impl_ty: Ty<'tcx>, self_type_did: DefId, @@ -141,7 +141,7 @@ fn ensure_drop_params_and_item_params_correspond<'tcx>( /// Confirms that every predicate imposed by dtor_predicates is /// implied by assuming the predicates attached to self_type_did. fn ensure_drop_predicates_are_implied_by_item_defn<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, drop_impl_did: DefId, dtor_predicates: &ty::GenericPredicates<'tcx>, self_type_did: DefId, diff --git a/src/librustc_typeck/check/intrinsic.rs b/src/librustc_typeck/check/intrinsic.rs index 21f4660b08e5c..2a553db5e5dde 100644 --- a/src/librustc_typeck/check/intrinsic.rs +++ b/src/librustc_typeck/check/intrinsic.rs @@ -14,7 +14,7 @@ use rustc::hir; use std::iter; fn equate_intrinsic_type<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, it: &hir::ForeignItem, n_tps: usize, abi: Abi, @@ -79,7 +79,7 @@ pub fn intrisic_operation_unsafety(intrinsic: &str) -> hir::Unsafety { /// Remember to add all intrinsics here, in librustc_codegen_llvm/intrinsic.rs, /// and in libcore/intrinsics.rs -pub fn check_intrinsic_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn check_intrinsic_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, it: &hir::ForeignItem) { let param = |n| tcx.mk_ty_param(n, InternedString::intern(&format!("P{}", n))); let name = it.ident.as_str(); @@ -400,7 +400,7 @@ pub fn check_intrinsic_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } /// Type-check `extern "platform-intrinsic" { ... }` functions. -pub fn check_platform_intrinsic_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn check_platform_intrinsic_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, it: &hir::ForeignItem) { let param = |n| { let name = InternedString::intern(&format!("P{}", n)); diff --git a/src/librustc_typeck/check/method/probe.rs b/src/librustc_typeck/check/method/probe.rs index 96ee140bcfecb..8d55f3afdfd8a 100644 --- a/src/librustc_typeck/check/method/probe.rs +++ b/src/librustc_typeck/check/method/probe.rs @@ -395,7 +395,7 @@ pub fn provide(providers: &mut ty::query::Providers<'_>) { providers.method_autoderef_steps = method_autoderef_steps; } -fn method_autoderef_steps<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'gcx, 'gcx>, +fn method_autoderef_steps<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'gcx>, goal: CanonicalTyGoal<'tcx>) -> MethodAutoderefStepsResult<'gcx> { diff --git a/src/librustc_typeck/check/method/suggest.rs b/src/librustc_typeck/check/method/suggest.rs index 05da24bb62c99..227b0c7035451 100644 --- a/src/librustc_typeck/check/method/suggest.rs +++ b/src/librustc_typeck/check/method/suggest.rs @@ -775,12 +775,12 @@ impl Ord for TraitInfo { } /// Retrieves all traits in this crate and any dependent crates. -pub fn all_traits<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Vec { +pub fn all_traits<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>) -> Vec { tcx.all_traits(LOCAL_CRATE).iter().map(|&def_id| TraitInfo { def_id }).collect() } /// Computes all traits in this crate and any dependent crates. -fn compute_all_traits<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Vec { +fn compute_all_traits<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>) -> Vec { use hir::itemlikevisit; let mut traits = vec![]; @@ -817,7 +817,7 @@ fn compute_all_traits<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Vec { // Cross-crate: let mut external_mods = FxHashSet::default(); - fn handle_external_res(tcx: TyCtxt<'_, '_, '_>, + fn handle_external_res(tcx: TyCtxt<'_, '_>, traits: &mut Vec, external_mods: &mut FxHashSet, res: Res) { @@ -859,12 +859,12 @@ struct UsePlacementFinder<'tcx, 'gcx> { target_module: hir::HirId, span: Option, found_use: bool, - tcx: TyCtxt<'tcx, 'gcx, 'tcx> + tcx: TyCtxt<'gcx, 'tcx> } impl UsePlacementFinder<'tcx, 'gcx> { fn check( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, krate: &'tcx hir::Crate, target_module: hir::HirId, ) -> (Option, bool) { diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index c1111e3ae4695..ba30f481596df 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -594,7 +594,7 @@ pub struct InheritedBuilder<'gcx, 'tcx> { } impl Inherited<'_, 'gcx, 'tcx> { - pub fn build(tcx: TyCtxt<'gcx, 'gcx, 'gcx>, def_id: DefId) + pub fn build(tcx: TyCtxt<'gcx, 'gcx>, def_id: DefId) -> InheritedBuilder<'gcx, 'tcx> { let hir_id_root = if def_id.is_local() { let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); @@ -685,7 +685,7 @@ impl Inherited<'a, 'gcx, 'tcx> { } } -struct CheckItemTypesVisitor<'tcx> { tcx: TyCtxt<'tcx, 'tcx, 'tcx> } +struct CheckItemTypesVisitor<'tcx> { tcx: TyCtxt<'tcx, 'tcx> } impl ItemLikeVisitor<'tcx> for CheckItemTypesVisitor<'tcx> { fn visit_item(&mut self, i: &'tcx hir::Item) { @@ -695,33 +695,33 @@ impl ItemLikeVisitor<'tcx> for CheckItemTypesVisitor<'tcx> { fn visit_impl_item(&mut self, _: &'tcx hir::ImplItem) { } } -pub fn check_wf_new<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Result<(), ErrorReported> { +pub fn check_wf_new<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) -> Result<(), ErrorReported> { tcx.sess.track_errors(|| { let mut visit = wfcheck::CheckTypeWellFormedVisitor::new(tcx); tcx.hir().krate().par_visit_all_item_likes(&mut visit); }) } -fn check_mod_item_types<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, module_def_id: DefId) { +fn check_mod_item_types<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, module_def_id: DefId) { tcx.hir().visit_item_likes_in_module(module_def_id, &mut CheckItemTypesVisitor { tcx }); } -fn typeck_item_bodies<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, crate_num: CrateNum) { +fn typeck_item_bodies<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, crate_num: CrateNum) { debug_assert!(crate_num == LOCAL_CRATE); tcx.par_body_owners(|body_owner_def_id| { tcx.ensure().typeck_tables_of(body_owner_def_id); }); } -fn check_item_well_formed<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { +fn check_item_well_formed<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) { wfcheck::check_item_well_formed(tcx, def_id); } -fn check_trait_item_well_formed<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { +fn check_trait_item_well_formed<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) { wfcheck::check_trait_item(tcx, def_id); } -fn check_impl_item_well_formed<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { +fn check_impl_item_well_formed<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) { wfcheck::check_impl_item(tcx, def_id); } @@ -741,7 +741,7 @@ pub fn provide(providers: &mut Providers<'_>) { }; } -fn adt_destructor<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn adt_destructor<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> Option { tcx.calculate_dtor(def_id, &mut dropck::check_drop_impl) @@ -756,7 +756,7 @@ fn adt_destructor<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, /// may not succeed. In some cases where this function returns `None` /// (notably closures), `typeck_tables(def_id)` would wind up /// redirecting to the owning function. -fn primary_body_of<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn primary_body_of<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, id: hir::HirId) -> Option<(hir::BodyId, Option<&'tcx hir::FnDecl>)> { @@ -797,7 +797,7 @@ fn primary_body_of<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } } -fn has_typeck_tables<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn has_typeck_tables<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> bool { // Closures' tables come from their outermost function, @@ -811,13 +811,13 @@ fn has_typeck_tables<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, primary_body_of(tcx, id).is_some() } -fn used_trait_imports<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn used_trait_imports<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> &'tcx DefIdSet { &*tcx.typeck_tables_of(def_id).used_trait_imports } -fn typeck_tables_of<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn typeck_tables_of<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::TypeckTables<'tcx> { // Closures' tables come from their outermost function, @@ -919,7 +919,7 @@ fn typeck_tables_of<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, tables } -fn check_abi<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, span: Span, abi: Abi) { +fn check_abi<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, span: Span, abi: Abi) { if !tcx.sess.target.target.is_abi_supported(abi) { struct_span_err!(tcx.sess, span, E0570, "The ABI `{}` is not supported for the current target", abi).emit() @@ -1287,7 +1287,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>, (fcx, gen_ty) } -fn check_struct<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn check_struct<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, id: hir::HirId, span: Span) { let def_id = tcx.hir().local_def_id_from_hir_id(id); @@ -1303,7 +1303,7 @@ fn check_struct<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, check_packed(tcx, span, def_id); } -fn check_union<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn check_union<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, id: hir::HirId, span: Span) { let def_id = tcx.hir().local_def_id_from_hir_id(id); @@ -1315,7 +1315,7 @@ fn check_union<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } fn check_opaque<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, substs: SubstsRef<'tcx>, span: Span, @@ -1335,7 +1335,7 @@ fn check_opaque<'tcx>( } } -pub fn check_item_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, it: &'tcx hir::Item) { +pub fn check_item_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, it: &'tcx hir::Item) { debug!( "check_item_type(it.hir_id={}, it.name={})", it.hir_id, @@ -1434,7 +1434,7 @@ pub fn check_item_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, it: &'tcx hir::Item) } } -fn maybe_check_static_with_link_section(tcx: TyCtxt<'_, '_, '_>, id: DefId, span: Span) { +fn maybe_check_static_with_link_section(tcx: TyCtxt<'_, '_>, id: DefId, span: Span) { // Only restricted on wasm32 target for now if !tcx.sess.opts.target_triple.triple().starts_with("wasm32") { return @@ -1472,7 +1472,7 @@ fn maybe_check_static_with_link_section(tcx: TyCtxt<'_, '_, '_>, id: DefId, span } } -fn check_on_unimplemented<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn check_on_unimplemented<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, trait_def_id: DefId, item: &hir::Item) { let item_def_id = tcx.hir().local_def_id_from_hir_id(item.hir_id); @@ -1480,7 +1480,7 @@ fn check_on_unimplemented<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, let _ = traits::OnUnimplementedDirective::of_item(tcx, trait_def_id, item_def_id); } -fn report_forbidden_specialization<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn report_forbidden_specialization<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, impl_item: &hir::ImplItem, parent_impl: DefId) { @@ -1506,7 +1506,7 @@ fn report_forbidden_specialization<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, err.emit(); } -fn check_specialization_validity<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn check_specialization_validity<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, trait_def: &ty::TraitDef, trait_item: &ty::AssocItem, impl_id: DefId, @@ -1532,7 +1532,7 @@ fn check_specialization_validity<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } -fn check_impl_items_against_trait<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn check_impl_items_against_trait<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, impl_span: Span, impl_id: DefId, impl_trait_ref: ty::TraitRef<'tcx>, @@ -1693,7 +1693,7 @@ fn check_impl_items_against_trait<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, /// Checks whether a type can be represented in memory. In particular, it /// identifies types that contain themselves without indirection through a /// pointer, which would mean their size is unbounded. -fn check_representable<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn check_representable<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, sp: Span, item_def_id: DefId) -> bool { @@ -1718,7 +1718,7 @@ fn check_representable<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, return true } -pub fn check_simd<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, sp: Span, def_id: DefId) { +pub fn check_simd<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, sp: Span, def_id: DefId) { let t = tcx.type_of(def_id); if let ty::Adt(def, substs) = t.sty { if def.is_struct() { @@ -1747,7 +1747,7 @@ pub fn check_simd<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, sp: Span, def_id: DefId) } } -fn check_packed<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, sp: Span, def_id: DefId) { +fn check_packed<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, sp: Span, def_id: DefId) { let repr = tcx.adt_def(def_id).repr; if repr.packed() { for attr in tcx.get_attrs(def_id).iter() { @@ -1771,7 +1771,7 @@ fn check_packed<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, sp: Span, def_id: DefId) { } } -fn check_packed_inner<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn check_packed_inner<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, stack: &mut Vec) -> bool { let t = tcx.type_of(def_id); @@ -1801,7 +1801,7 @@ fn check_packed_inner<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, false } -fn check_transparent<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, sp: Span, def_id: DefId) { +fn check_transparent<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, sp: Span, def_id: DefId) { let adt = tcx.adt_def(def_id); if !adt.repr.transparent() { return; @@ -1881,7 +1881,7 @@ fn check_transparent<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, sp: Span, def_id: DefI } #[allow(trivial_numeric_casts)] -pub fn check_enum<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn check_enum<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, sp: Span, vs: &'tcx [hir::Variant], id: hir::HirId) { @@ -1945,7 +1945,7 @@ pub fn check_enum<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, check_transparent(tcx, sp, def_id); } -fn report_unexpected_variant_res<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, +fn report_unexpected_variant_res<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, res: Res, span: Span, qpath: &QPath) { @@ -1956,7 +1956,7 @@ fn report_unexpected_variant_res<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, } impl<'a, 'gcx, 'tcx> AstConv<'gcx, 'tcx> for FnCtxt<'a, 'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.tcx } + fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> { self.tcx } fn get_type_parameter_bounds(&self, _: Span, def_id: DefId) -> &'tcx ty::GenericPredicates<'tcx> @@ -5700,7 +5700,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } } -pub fn check_bounds_are_used<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn check_bounds_are_used<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, generics: &ty::Generics, ty: Ty<'tcx>) { let own_counts = generics.own_counts(); diff --git a/src/librustc_typeck/check/upvar.rs b/src/librustc_typeck/check/upvar.rs index 82c173a6f7a57..2f3861b8d3478 100644 --- a/src/librustc_typeck/check/upvar.rs +++ b/src/librustc_typeck/check/upvar.rs @@ -651,6 +651,6 @@ impl<'a, 'gcx, 'tcx> euv::Delegate<'tcx> for InferBorrowKind<'a, 'gcx, 'tcx> { } } -fn var_name(tcx: TyCtxt<'_, '_, '_>, var_hir_id: hir::HirId) -> ast::Name { +fn var_name(tcx: TyCtxt<'_, '_>, var_hir_id: hir::HirId) -> ast::Name { tcx.hir().name_by_hir_id(var_hir_id) } diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs index 34d6892c18f57..31d85be17b4c0 100644 --- a/src/librustc_typeck/check/wfcheck.rs +++ b/src/librustc_typeck/check/wfcheck.rs @@ -35,7 +35,7 @@ struct CheckWfFcxBuilder<'gcx, 'tcx> { impl<'gcx, 'tcx> CheckWfFcxBuilder<'gcx, 'tcx> { fn with_fcx(&'tcx mut self, f: F) where F: for<'b> FnOnce(&FnCtxt<'b, 'gcx, 'tcx>, - TyCtxt<'gcx, 'gcx, 'gcx>) -> Vec> + TyCtxt<'gcx, 'gcx>) -> Vec> { let id = self.id; let span = self.span; @@ -68,7 +68,7 @@ impl<'gcx, 'tcx> CheckWfFcxBuilder<'gcx, 'tcx> { /// We do this check as a pre-pass before checking fn bodies because if these constraints are /// not included it frequently leads to confusing errors in fn bodies. So it's better to check /// the types first. -pub fn check_item_well_formed<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { +pub fn check_item_well_formed<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) { let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); let item = tcx.hir().expect_item_by_hir_id(hir_id); @@ -156,7 +156,7 @@ pub fn check_item_well_formed<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId } } -pub fn check_trait_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { +pub fn check_trait_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) { let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); let trait_item = tcx.hir().expect_trait_item(hir_id); @@ -167,7 +167,7 @@ pub fn check_trait_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { check_associated_item(tcx, trait_item.hir_id, trait_item.span, method_sig); } -pub fn check_impl_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { +pub fn check_impl_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) { let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); let impl_item = tcx.hir().expect_impl_item(hir_id); @@ -178,7 +178,7 @@ pub fn check_impl_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { check_associated_item(tcx, impl_item.hir_id, impl_item.span, method_sig); } -fn check_associated_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn check_associated_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, item_id: hir::HirId, span: Span, sig_if_method: Option<&hir::MethodSig>) { @@ -225,12 +225,12 @@ fn check_associated_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, }) } -fn for_item<'gcx: 'tcx, 'tcx>(tcx: TyCtxt<'gcx, 'gcx, 'gcx>, item: &hir::Item) +fn for_item<'gcx: 'tcx, 'tcx>(tcx: TyCtxt<'gcx, 'gcx>, item: &hir::Item) -> CheckWfFcxBuilder<'gcx, 'tcx> { for_id(tcx, item.hir_id, item.span) } -fn for_id<'gcx: 'tcx, 'tcx>(tcx: TyCtxt<'gcx, 'gcx, 'gcx>, id: hir::HirId, span: Span) +fn for_id<'gcx: 'tcx, 'tcx>(tcx: TyCtxt<'gcx, 'gcx>, id: hir::HirId, span: Span) -> CheckWfFcxBuilder<'gcx, 'tcx> { let def_id = tcx.hir().local_def_id_from_hir_id(id); CheckWfFcxBuilder { @@ -242,7 +242,7 @@ fn for_id<'gcx: 'tcx, 'tcx>(tcx: TyCtxt<'gcx, 'gcx, 'gcx>, id: hir::HirId, span: } /// In a type definition, we check that to ensure that the types of the fields are well-formed. -fn check_type_defn<'tcx, F>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn check_type_defn<'tcx, F>(tcx: TyCtxt<'tcx, 'tcx>, item: &hir::Item, all_sized: bool, mut lookup_fields: F) where F: for<'fcx, 'gcx, 'tcx2> FnMut(&FnCtxt<'fcx, 'gcx, 'tcx2>) -> Vec> { @@ -312,7 +312,7 @@ fn check_type_defn<'tcx, F>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, }); } -fn check_trait<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item: &hir::Item) { +fn check_trait<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, item: &hir::Item) { debug!("check_trait: {:?}", item.hir_id); let trait_def_id = tcx.hir().local_def_id_from_hir_id(item.hir_id); @@ -335,7 +335,7 @@ fn check_trait<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item: &hir::Item) { }); } -fn check_item_fn<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item: &hir::Item) { +fn check_item_fn<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, item: &hir::Item) { for_item(tcx, item).with_fcx(|fcx, tcx| { let def_id = fcx.tcx.hir().local_def_id_from_hir_id(item.hir_id); let sig = fcx.tcx.fn_sig(def_id); @@ -348,7 +348,7 @@ fn check_item_fn<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item: &hir::Item) { } fn check_item_type<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, item_id: hir::HirId, ty_span: Span, allow_foreign_ty: bool, @@ -380,7 +380,7 @@ fn check_item_type<'tcx>( }); } -fn check_impl<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn check_impl<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, item: &hir::Item, ast_self_ty: &hir::Ty, ast_trait_ref: &Option) @@ -422,7 +422,7 @@ fn check_impl<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, /// Checks where-clauses and inline bounds that are declared on `def_id`. fn check_where_clauses<'gcx, 'fcx, 'tcx>( - tcx: TyCtxt<'gcx, 'gcx, 'gcx>, + tcx: TyCtxt<'gcx, 'gcx>, fcx: &FnCtxt<'fcx, 'gcx, 'tcx>, span: Span, def_id: DefId, @@ -574,7 +574,7 @@ fn check_where_clauses<'gcx, 'fcx, 'tcx>( } } -fn check_fn_or_method<'fcx, 'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'gcx, 'gcx>, +fn check_fn_or_method<'fcx, 'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'gcx>, fcx: &FnCtxt<'fcx, 'gcx, 'tcx>, span: Span, sig: ty::PolyFnSig<'tcx>, @@ -617,7 +617,7 @@ fn check_fn_or_method<'fcx, 'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'gcx, 'gcx>, /// ``` /// fn check_existential_types<'fcx, 'gcx, 'tcx>( - tcx: TyCtxt<'gcx, 'gcx, 'gcx>, + tcx: TyCtxt<'gcx, 'gcx>, fcx: &FnCtxt<'fcx, 'gcx, 'tcx>, fn_def_id: DefId, span: Span, @@ -930,7 +930,7 @@ fn receiver_is_valid<'fcx, 'tcx, 'gcx>( true } -fn check_variances_for_type_defn<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn check_variances_for_type_defn<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, item: &hir::Item, hir_generics: &hir::Generics) { @@ -971,7 +971,7 @@ fn check_variances_for_type_defn<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } } -fn report_bivariance<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn report_bivariance<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, span: Span, param_name: ast::Name) { @@ -987,7 +987,7 @@ fn report_bivariance<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, err.emit(); } -fn reject_shadowing_parameters(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) { +fn reject_shadowing_parameters(tcx: TyCtxt<'_, '_>, def_id: DefId) { let generics = tcx.generics_of(def_id); let parent = tcx.generics_of(generics.parent.unwrap()); let impl_params: FxHashMap<_, _> = parent.params.iter().flat_map(|param| match param.kind { @@ -1053,11 +1053,11 @@ fn check_false_global_bounds<'a, 'gcx, 'tcx>( } pub struct CheckTypeWellFormedVisitor<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, } impl CheckTypeWellFormedVisitor<'gcx> { - pub fn new(tcx: TyCtxt<'gcx, 'gcx, 'gcx>) -> CheckTypeWellFormedVisitor<'gcx> { + pub fn new(tcx: TyCtxt<'gcx, 'gcx>) -> CheckTypeWellFormedVisitor<'gcx> { CheckTypeWellFormedVisitor { tcx, } @@ -1133,7 +1133,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } } -fn error_392<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, span: Span, param_name: ast::Name) +fn error_392<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, span: Span, param_name: ast::Name) -> DiagnosticBuilder<'tcx> { let mut err = struct_span_err!(tcx.sess, span, E0392, "parameter `{}` is never used", param_name); @@ -1141,7 +1141,7 @@ fn error_392<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, span: Span, param_name: ast::N err } -fn error_194(tcx: TyCtxt<'_, '_, '_>, span: Span, trait_decl_span: Span, name: &str) { +fn error_194(tcx: TyCtxt<'_, '_>, span: Span, trait_decl_span: Span, name: &str) { struct_span_err!(tcx.sess, span, E0194, "type parameter `{}` shadows another type parameter of the same name", name) diff --git a/src/librustc_typeck/check/writeback.rs b/src/librustc_typeck/check/writeback.rs index 7683f8cfbc4a6..cc9097ea8c83b 100644 --- a/src/librustc_typeck/check/writeback.rs +++ b/src/librustc_typeck/check/writeback.rs @@ -123,7 +123,7 @@ impl<'cx, 'gcx, 'tcx> WritebackCx<'cx, 'gcx, 'tcx> { } } - fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.fcx.tcx } @@ -762,24 +762,24 @@ impl<'cx, 'gcx, 'tcx> WritebackCx<'cx, 'gcx, 'tcx> { } trait Locatable { - fn to_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span; + fn to_span(&self, tcx: TyCtxt<'_, '_>) -> Span; } impl Locatable for Span { - fn to_span(&self, _: TyCtxt<'_, '_, '_>) -> Span { + fn to_span(&self, _: TyCtxt<'_, '_>) -> Span { *self } } impl Locatable for DefIndex { - fn to_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span { + fn to_span(&self, tcx: TyCtxt<'_, '_>) -> Span { let hir_id = tcx.hir().def_index_to_hir_id(*self); tcx.hir().span_by_hir_id(hir_id) } } impl Locatable for hir::HirId { - fn to_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span { + fn to_span(&self, tcx: TyCtxt<'_, '_>) -> Span { tcx.hir().span_by_hir_id(*self) } } @@ -789,7 +789,7 @@ impl Locatable for hir::HirId { // unresolved types and so forth. struct Resolver<'cx, 'gcx: 'cx + 'tcx, 'tcx: 'cx> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, infcx: &'cx InferCtxt<'cx, 'gcx, 'tcx>, span: &'cx dyn Locatable, body: &'gcx hir::Body, @@ -819,7 +819,7 @@ impl<'cx, 'gcx, 'tcx> Resolver<'cx, 'gcx, 'tcx> { } impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for Resolver<'cx, 'gcx, 'tcx> { - fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx<'a>(&'a self) -> TyCtxt<'gcx, 'tcx> { self.tcx } diff --git a/src/librustc_typeck/check_unused.rs b/src/librustc_typeck/check_unused.rs index bb587da9314f8..5f4f88d954490 100644 --- a/src/librustc_typeck/check_unused.rs +++ b/src/librustc_typeck/check_unused.rs @@ -13,7 +13,7 @@ use rustc::util::nodemap::DefIdSet; use rustc_data_structures::fx::FxHashMap; -pub fn check_crate<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn check_crate<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) { let mut used_trait_imports = DefIdSet::default(); for &body_id in tcx.hir().krate().bodies.keys() { let item_def_id = tcx.hir().body_owner_def_id(body_id); @@ -46,7 +46,7 @@ impl ItemLikeVisitor<'v> for CheckVisitor<'tcx> { } struct CheckVisitor<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, used_trait_imports: DefIdSet, } @@ -70,7 +70,7 @@ impl CheckVisitor<'tcx> { } } -fn unused_crates_lint<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +fn unused_crates_lint<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) { let lint = lint::builtin::UNUSED_EXTERN_CRATES; // Collect first the crates that are completely unused. These we @@ -195,7 +195,7 @@ fn unused_crates_lint<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { } struct CollectExternCrateVisitor<'a, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, crates_to_lint: &'a mut Vec, } diff --git a/src/librustc_typeck/coherence/builtin.rs b/src/librustc_typeck/coherence/builtin.rs index 497392e7661f4..653095e41f425 100644 --- a/src/librustc_typeck/coherence/builtin.rs +++ b/src/librustc_typeck/coherence/builtin.rs @@ -17,7 +17,7 @@ use rustc::hir::def_id::DefId; use hir::Node; use rustc::hir::{self, ItemKind}; -pub fn check_trait<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, trait_def_id: DefId) { +pub fn check_trait<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, trait_def_id: DefId) { Checker { tcx, trait_def_id } .check(tcx.lang_items().drop_trait(), visit_implementation_of_drop) .check(tcx.lang_items().copy_trait(), visit_implementation_of_copy) @@ -27,13 +27,13 @@ pub fn check_trait<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, trait_def_id: DefId) { } struct Checker<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, trait_def_id: DefId } impl<'tcx> Checker<'tcx> { fn check(&self, trait_def_id: Option, mut f: F) -> &Self - where F: FnMut(TyCtxt<'tcx, 'tcx, 'tcx>, DefId) + where F: FnMut(TyCtxt<'tcx, 'tcx>, DefId) { if Some(self.trait_def_id) == trait_def_id { for &impl_id in self.tcx.hir().trait_impls(self.trait_def_id) { @@ -45,7 +45,7 @@ impl<'tcx> Checker<'tcx> { } } -fn visit_implementation_of_drop<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_did: DefId) { +fn visit_implementation_of_drop<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, impl_did: DefId) { if let ty::Adt(..) = tcx.type_of(impl_did).sty { /* do nothing */ } else { @@ -73,7 +73,7 @@ fn visit_implementation_of_drop<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_did: D } } -fn visit_implementation_of_copy<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_did: DefId) { +fn visit_implementation_of_copy<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, impl_did: DefId) { debug!("visit_implementation_of_copy: impl_did={:?}", impl_did); let impl_hir_id = if let Some(n) = tcx.hir().as_local_hir_id(impl_did) { @@ -140,7 +140,7 @@ fn visit_implementation_of_copy<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_did: D } } -fn visit_implementation_of_coerce_unsized(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_did: DefId) { +fn visit_implementation_of_coerce_unsized(tcx: TyCtxt<'tcx, 'tcx>, impl_did: DefId) { debug!("visit_implementation_of_coerce_unsized: impl_did={:?}", impl_did); @@ -154,7 +154,7 @@ fn visit_implementation_of_coerce_unsized(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_di } fn visit_implementation_of_dispatch_from_dyn<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, impl_did: DefId, ) { debug!("visit_implementation_of_dispatch_from_dyn: impl_did={:?}", @@ -324,7 +324,7 @@ fn visit_implementation_of_dispatch_from_dyn<'tcx>( } } -pub fn coerce_unsized_info<'gcx>(gcx: TyCtxt<'gcx, 'gcx, 'gcx>, +pub fn coerce_unsized_info<'gcx>(gcx: TyCtxt<'gcx, 'gcx>, impl_did: DefId) -> CoerceUnsizedInfo { debug!("compute_coerce_unsized_info(impl_did={:?})", impl_did); diff --git a/src/librustc_typeck/coherence/inherent_impls.rs b/src/librustc_typeck/coherence/inherent_impls.rs index edef389726112..8214fc50fed87 100644 --- a/src/librustc_typeck/coherence/inherent_impls.rs +++ b/src/librustc_typeck/coherence/inherent_impls.rs @@ -17,7 +17,7 @@ use syntax::ast; use syntax_pos::Span; /// On-demand query: yields a map containing all types mapped to their inherent impls. -pub fn crate_inherent_impls<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn crate_inherent_impls<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, crate_num: CrateNum) -> &'tcx CrateInherentImpls { assert_eq!(crate_num, LOCAL_CRATE); @@ -32,7 +32,7 @@ pub fn crate_inherent_impls<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } /// On-demand query: yields a vector of the inherent impls for a specific type. -pub fn inherent_impls<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn inherent_impls<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, ty_def_id: DefId) -> &'tcx [DefId] { assert!(ty_def_id.is_local()); @@ -69,7 +69,7 @@ pub fn inherent_impls<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } struct InherentCollect<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, impls_map: CrateInherentImpls, } diff --git a/src/librustc_typeck/coherence/inherent_impls_overlap.rs b/src/librustc_typeck/coherence/inherent_impls_overlap.rs index e1b8169e0c90c..feddd9f0b3cb0 100644 --- a/src/librustc_typeck/coherence/inherent_impls_overlap.rs +++ b/src/librustc_typeck/coherence/inherent_impls_overlap.rs @@ -5,7 +5,7 @@ use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::traits::{self, IntercrateMode}; use rustc::ty::TyCtxt; -pub fn crate_inherent_impls_overlap_check<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn crate_inherent_impls_overlap_check<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, crate_num: CrateNum) { assert_eq!(crate_num, LOCAL_CRATE); let krate = tcx.hir().krate(); @@ -13,7 +13,7 @@ pub fn crate_inherent_impls_overlap_check<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } struct InherentOverlapChecker<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx> + tcx: TyCtxt<'tcx, 'tcx> } impl InherentOverlapChecker<'tcx> { diff --git a/src/librustc_typeck/coherence/mod.rs b/src/librustc_typeck/coherence/mod.rs index 3ec88cbbd29dd..421fdccc1fa25 100644 --- a/src/librustc_typeck/coherence/mod.rs +++ b/src/librustc_typeck/coherence/mod.rs @@ -18,7 +18,7 @@ mod inherent_impls_overlap; mod orphan; mod unsafety; -fn check_impl<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, hir_id: HirId) { +fn check_impl<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, hir_id: HirId) { let impl_def_id = tcx.hir().local_def_id_from_hir_id(hir_id); // If there are no traits, then this implementation must have a @@ -41,7 +41,7 @@ fn check_impl<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, hir_id: HirId) { } fn enforce_trait_manually_implementable( - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, impl_def_id: DefId, trait_def_id: DefId ) { @@ -97,7 +97,7 @@ fn enforce_trait_manually_implementable( /// We allow impls of marker traits to overlap, so they can't override impls /// as that could make it ambiguous which associated item to use. fn enforce_empty_impls_for_marker_traits( - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, impl_def_id: DefId, trait_def_id: DefId ) { @@ -132,7 +132,7 @@ pub fn provide(providers: &mut Providers<'_>) { }; } -fn coherent_trait<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { +fn coherent_trait<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) { let impls = tcx.hir().trait_impls(def_id); for &impl_id in impls { check_impl(tcx, impl_id); @@ -143,7 +143,7 @@ fn coherent_trait<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { builtin::check_trait(tcx, def_id); } -pub fn check_coherence<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn check_coherence<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) { for &trait_def_id in tcx.hir().krate().trait_impls.keys() { tcx.ensure().coherent_trait(trait_def_id); } @@ -159,7 +159,7 @@ pub fn check_coherence<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { /// Overlap: no two impls for the same trait are implemented for the /// same type. Likewise, no two inherent impls for a given type /// constructor provide a method with the same name. -fn check_impl_overlap<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, hir_id: HirId) { +fn check_impl_overlap<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, hir_id: HirId) { let impl_def_id = tcx.hir().local_def_id_from_hir_id(hir_id); let trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap(); let trait_def_id = trait_ref.def_id; diff --git a/src/librustc_typeck/coherence/orphan.rs b/src/librustc_typeck/coherence/orphan.rs index a9307f2669553..4e81102fd3b84 100644 --- a/src/librustc_typeck/coherence/orphan.rs +++ b/src/librustc_typeck/coherence/orphan.rs @@ -6,13 +6,13 @@ use rustc::ty::{self, TyCtxt}; use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::hir; -pub fn check<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn check<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) { let mut orphan = OrphanChecker { tcx }; tcx.hir().krate().visit_all_item_likes(&mut orphan); } struct OrphanChecker<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, } impl ItemLikeVisitor<'v> for OrphanChecker<'tcx> { diff --git a/src/librustc_typeck/coherence/unsafety.rs b/src/librustc_typeck/coherence/unsafety.rs index b5369a8777d22..c3a97bc538941 100644 --- a/src/librustc_typeck/coherence/unsafety.rs +++ b/src/librustc_typeck/coherence/unsafety.rs @@ -5,13 +5,13 @@ use rustc::ty::TyCtxt; use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::hir::{self, Unsafety}; -pub fn check<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn check<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) { let mut unsafety = UnsafetyChecker { tcx }; tcx.hir().krate().visit_all_item_likes(&mut unsafety); } struct UnsafetyChecker<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, } impl UnsafetyChecker<'tcx> { diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index b012468f50966..02edf63dd5c7e 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -56,7 +56,7 @@ struct OnlySelfBounds(bool); /////////////////////////////////////////////////////////////////////////// // Main entry point -fn collect_mod_item_types<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, module_def_id: DefId) { +fn collect_mod_item_types<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, module_def_id: DefId) { tcx.hir().visit_item_likes_in_module( module_def_id, &mut CollectItemTypesVisitor { tcx }.as_deep_visitor() @@ -97,14 +97,14 @@ pub fn provide(providers: &mut Providers<'_>) { /// `get_type_parameter_bounds` requests, drawing the information from /// the AST (`hir::Generics`), recursively. pub struct ItemCtxt<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, item_def_id: DefId, } /////////////////////////////////////////////////////////////////////////// struct CollectItemTypesVisitor<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, } impl Visitor<'tcx> for CollectItemTypesVisitor<'tcx> { @@ -161,7 +161,7 @@ impl Visitor<'tcx> for CollectItemTypesVisitor<'tcx> { // Utility types and common code for the above passes. impl ItemCtxt<'tcx> { - pub fn new(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item_def_id: DefId) -> ItemCtxt<'tcx> { + pub fn new(tcx: TyCtxt<'tcx, 'tcx>, item_def_id: DefId) -> ItemCtxt<'tcx> { ItemCtxt { tcx, item_def_id } } @@ -171,7 +171,7 @@ impl ItemCtxt<'tcx> { } impl AstConv<'tcx, 'tcx> for ItemCtxt<'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'tcx, 'tcx> { + fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'tcx> { self.tcx } @@ -254,7 +254,7 @@ impl AstConv<'tcx, 'tcx> for ItemCtxt<'tcx> { } fn type_param_predicates<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, (item_def_id, def_id): (DefId, DefId), ) -> &'tcx ty::GenericPredicates<'tcx> { use rustc::hir::*; @@ -382,7 +382,7 @@ impl ItemCtxt<'tcx> { /// `ast_ty_to_ty`, because we want to avoid triggering an all-out /// conversion of the type to avoid inducing unnecessary cycles. fn is_param<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, ast_ty: &hir::Ty, param_id: hir::HirId, ) -> bool { @@ -398,7 +398,7 @@ fn is_param<'tcx>( } } -fn convert_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item_id: hir::HirId) { +fn convert_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, item_id: hir::HirId) { let it = tcx.hir().expect_item_by_hir_id(item_id); debug!("convert: item {} with id {}", it.ident, it.hir_id); let def_id = tcx.hir().local_def_id_from_hir_id(item_id); @@ -480,7 +480,7 @@ fn convert_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item_id: hir::HirId) { } } -fn convert_trait_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, trait_item_id: hir::HirId) { +fn convert_trait_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, trait_item_id: hir::HirId) { let trait_item = tcx.hir().expect_trait_item(trait_item_id); let def_id = tcx.hir().local_def_id_from_hir_id(trait_item.hir_id); tcx.generics_of(def_id); @@ -501,7 +501,7 @@ fn convert_trait_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, trait_item_id: hir::H tcx.predicates_of(def_id); } -fn convert_impl_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_item_id: hir::HirId) { +fn convert_impl_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, impl_item_id: hir::HirId) { let def_id = tcx.hir().local_def_id_from_hir_id(impl_item_id); tcx.generics_of(def_id); tcx.type_of(def_id); @@ -511,7 +511,7 @@ fn convert_impl_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_item_id: hir::Hir } } -fn convert_variant_ctor<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ctor_id: hir::HirId) { +fn convert_variant_ctor<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, ctor_id: hir::HirId) { let def_id = tcx.hir().local_def_id_from_hir_id(ctor_id); tcx.generics_of(def_id); tcx.type_of(def_id); @@ -519,7 +519,7 @@ fn convert_variant_ctor<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ctor_id: hir::HirId } fn convert_enum_variant_types<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, variants: &[hir::Variant], ) { @@ -571,7 +571,7 @@ fn convert_enum_variant_types<'tcx>( } fn convert_variant<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, variant_did: Option, ctor_did: Option, ident: Ident, @@ -627,7 +627,7 @@ fn convert_variant<'tcx>( ) } -fn adt_def<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::AdtDef { +fn adt_def<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::AdtDef { use rustc::hir::*; let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); @@ -695,7 +695,7 @@ fn adt_def<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::AdtD /// of `trait_def_id` are converted and stored. This also ensures that /// the transitive super-predicates are converted. fn super_predicates_of<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, trait_def_id: DefId, ) -> &'tcx ty::GenericPredicates<'tcx> { debug!("super_predicates(trait_def_id={:?})", trait_def_id); @@ -748,7 +748,7 @@ fn super_predicates_of<'tcx>( }) } -fn trait_def<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::TraitDef { +fn trait_def<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::TraitDef { let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); let item = tcx.hir().expect_item_by_hir_id(hir_id); @@ -780,11 +780,11 @@ fn trait_def<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::Tr } fn has_late_bound_regions<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, node: Node<'tcx>, ) -> Option { struct LateBoundRegionsDetector<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, outer_index: ty::DebruijnIndex, has_late_bound_regions: Option, } @@ -841,7 +841,7 @@ fn has_late_bound_regions<'tcx>( } fn has_late_bound_regions<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, generics: &'tcx hir::Generics, decl: &'tcx hir::FnDecl, ) -> Option { @@ -890,7 +890,7 @@ fn has_late_bound_regions<'tcx>( } } -fn generics_of<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::Generics { +fn generics_of<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::Generics { use rustc::hir::*; let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); @@ -1133,7 +1133,7 @@ fn generics_of<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty:: }) } -fn report_assoc_ty_on_inherent_impl<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, span: Span) { +fn report_assoc_ty_on_inherent_impl<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, span: Span) { span_err!( tcx.sess, span, @@ -1142,7 +1142,7 @@ fn report_assoc_ty_on_inherent_impl<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, span: S ); } -fn type_of<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> { +fn type_of<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> { checked_type_of(tcx, def_id, true).unwrap() } @@ -1151,7 +1151,7 @@ fn type_of<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> { /// If you want to fail anyway, you can set the `fail` parameter to true, but in this case, /// you'd better just call [`type_of`] directly. pub fn checked_type_of<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, fail: bool, ) -> Option> { @@ -1480,7 +1480,7 @@ pub fn checked_type_of<'tcx>( } fn find_existential_constraints<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, ) -> Ty<'tcx> { use rustc::hir::{ImplItem, Item, TraitItem}; @@ -1488,7 +1488,7 @@ fn find_existential_constraints<'tcx>( debug!("find_existential_constraints({:?})", def_id); struct ConstraintLocator<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, // (first found type span, actual type, mapping from the existential type's generic // parameters to the concrete type's generic parameters) @@ -1700,7 +1700,7 @@ fn find_existential_constraints<'tcx>( } } -fn fn_sig<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> ty::PolyFnSig<'tcx> { +fn fn_sig<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> ty::PolyFnSig<'tcx> { use rustc::hir::*; use rustc::hir::Node::*; @@ -1777,7 +1777,7 @@ fn fn_sig<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> ty::PolyFnSig<' } fn impl_trait_ref<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, ) -> Option> { let icx = ItemCtxt::new(tcx, def_id); @@ -1794,7 +1794,7 @@ fn impl_trait_ref<'tcx>( } } -fn impl_polarity<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> hir::ImplPolarity { +fn impl_polarity<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> hir::ImplPolarity { let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); match tcx.hir().expect_item_by_hir_id(hir_id).node { hir::ItemKind::Impl(_, polarity, ..) => polarity, @@ -1808,7 +1808,7 @@ fn impl_polarity<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> hir::Imp /// screen out those that do not appear in any where-clauses etc using /// `resolve_lifetime::early_bound_lifetimes`. fn early_bound_lifetimes_from_generics<'a, 'tcx: 'a>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, generics: &'a hir::Generics, ) -> impl Iterator + Captures<'tcx> { generics @@ -1826,7 +1826,7 @@ fn early_bound_lifetimes_from_generics<'a, 'tcx: 'a>( /// lifetime constraints. This includes all predicates returned by `explicit_predicates_of`, plus /// inferred constraints concerning which regions outlive other regions. fn predicates_defined_on<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, ) -> &'tcx ty::GenericPredicates<'tcx> { debug!("predicates_defined_on({:?})", def_id); @@ -1856,7 +1856,7 @@ fn predicates_defined_on<'tcx>( /// ID `def_id`. This includes all predicates returned by `predicates_defined_on`, plus /// `Self: Trait` predicates for traits. fn predicates_of<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, ) -> &'tcx ty::GenericPredicates<'tcx> { let mut result = tcx.predicates_defined_on(def_id); @@ -1886,7 +1886,7 @@ fn predicates_of<'tcx>( /// Returns a list of user-specified type predicates for the definition with ID `def_id`. /// N.B., this does not include any implied/inferred constraints. fn explicit_predicates_of<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, ) -> &'tcx ty::GenericPredicates<'tcx> { use rustc::hir::*; @@ -2249,7 +2249,7 @@ fn predicates_from_bound<'tcx>( } fn compute_sig_of_foreign_fn_decl<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, decl: &hir::FnDecl, abi: abi::Abi, @@ -2293,7 +2293,7 @@ fn compute_sig_of_foreign_fn_decl<'tcx>( fty } -fn is_foreign_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> bool { +fn is_foreign_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> bool { match tcx.hir().get_if_local(def_id) { Some(Node::ForeignItem(..)) => true, Some(_) => false, @@ -2302,7 +2302,7 @@ fn is_foreign_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> bool { } fn static_mutability<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, ) -> Option { match tcx.hir().get_if_local(def_id) { @@ -2318,7 +2318,7 @@ fn static_mutability<'tcx>( } fn from_target_feature( - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, id: DefId, attr: &ast::Attribute, whitelist: &FxHashMap>, @@ -2412,7 +2412,7 @@ fn from_target_feature( } } -fn linkage_by_name<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, name: &str) -> Linkage { +fn linkage_by_name<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, name: &str) -> Linkage { use rustc::mir::mono::Linkage::*; // Use the names from src/llvm/docs/LangRef.rst here. Most types are only @@ -2447,7 +2447,7 @@ fn linkage_by_name<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, name: &st } } -fn codegen_fn_attrs<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, id: DefId) -> CodegenFnAttrs { +fn codegen_fn_attrs<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, id: DefId) -> CodegenFnAttrs { let attrs = tcx.get_attrs(id); let mut codegen_fn_attrs = CodegenFnAttrs::new(); diff --git a/src/librustc_typeck/constrained_generic_params.rs b/src/librustc_typeck/constrained_generic_params.rs index a0f592586b43f..c26de71a20ba3 100644 --- a/src/librustc_typeck/constrained_generic_params.rs +++ b/src/librustc_typeck/constrained_generic_params.rs @@ -86,7 +86,7 @@ impl<'tcx> TypeVisitor<'tcx> for ParameterCollector { } } -pub fn identify_constrained_generic_params<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn identify_constrained_generic_params<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, predicates: &ty::GenericPredicates<'tcx>, impl_trait_ref: Option>, input_parameters: &mut FxHashSet) @@ -136,7 +136,7 @@ pub fn identify_constrained_generic_params<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, /// which is determined by 1, which requires `U`, that is determined /// by 0. I should probably pick a less tangled example, but I can't /// think of any. -pub fn setup_constraining_predicates<'tcx>(tcx: TyCtxt<'_, '_, '_>, +pub fn setup_constraining_predicates<'tcx>(tcx: TyCtxt<'_, '_>, predicates: &mut [(ty::Predicate<'tcx>, Span)], impl_trait_ref: Option>, input_parameters: &mut FxHashSet) diff --git a/src/librustc_typeck/impl_wf_check.rs b/src/librustc_typeck/impl_wf_check.rs index 834e939f40f77..6a7bdf48ae9d4 100644 --- a/src/librustc_typeck/impl_wf_check.rs +++ b/src/librustc_typeck/impl_wf_check.rs @@ -49,7 +49,7 @@ use syntax_pos::Span; /// impl<'a> Trait for Bar { type X = &'a i32; } /// // ^ 'a is unused and appears in assoc type, error /// ``` -pub fn impl_wf_check<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn impl_wf_check<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) { // We will tag this as part of the WF check -- logically, it is, // but it's one that we must perform earlier than the rest of // WfCheck. @@ -58,7 +58,7 @@ pub fn impl_wf_check<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { } } -fn check_mod_impl_wf<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, module_def_id: DefId) { +fn check_mod_impl_wf<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, module_def_id: DefId) { tcx.hir().visit_item_likes_in_module( module_def_id, &mut ImplWfCheck { tcx } @@ -73,7 +73,7 @@ pub fn provide(providers: &mut Providers<'_>) { } struct ImplWfCheck<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, } impl ItemLikeVisitor<'tcx> for ImplWfCheck<'tcx> { @@ -92,7 +92,7 @@ impl ItemLikeVisitor<'tcx> for ImplWfCheck<'tcx> { fn visit_impl_item(&mut self, _impl_item: &'tcx hir::ImplItem) { } } -fn enforce_impl_params_are_constrained<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn enforce_impl_params_are_constrained<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, impl_def_id: DefId, impl_item_refs: &[hir::ImplItemRef]) { @@ -171,7 +171,7 @@ fn enforce_impl_params_are_constrained<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, // used elsewhere are not projected back out. } -fn report_unused_parameter(tcx: TyCtxt<'_, '_, '_>, +fn report_unused_parameter(tcx: TyCtxt<'_, '_>, span: Span, kind: &str, name: &str) @@ -186,7 +186,7 @@ fn report_unused_parameter(tcx: TyCtxt<'_, '_, '_>, } /// Enforce that we do not have two items in an impl with the same name. -fn enforce_impl_items_are_distinct<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn enforce_impl_items_are_distinct<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, impl_item_refs: &[hir::ImplItemRef]) { let mut seen_type_items = FxHashMap::default(); diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index 74ff8ad0f1753..cb8e699351aa6 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -124,7 +124,7 @@ pub struct TypeAndSubsts<'tcx> { ty: Ty<'tcx>, } -fn check_type_alias_enum_variants_enabled<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, +fn check_type_alias_enum_variants_enabled<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, span: Span) { if !tcx.features().type_alias_enum_variants { let mut err = tcx.sess.struct_span_err( @@ -140,7 +140,7 @@ fn check_type_alias_enum_variants_enabled<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 't } } -fn require_c_abi_if_c_variadic(tcx: TyCtxt<'_, '_, '_>, +fn require_c_abi_if_c_variadic(tcx: TyCtxt<'_, '_>, decl: &hir::FnDecl, abi: Abi, span: Span) { @@ -151,7 +151,7 @@ fn require_c_abi_if_c_variadic(tcx: TyCtxt<'_, '_, '_>, } } -fn require_same_types<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn require_same_types<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, cause: &ObligationCause<'tcx>, expected: Ty<'tcx>, actual: Ty<'tcx>) @@ -179,7 +179,7 @@ fn require_same_types<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, }) } -fn check_main_fn_ty<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, main_def_id: DefId) { +fn check_main_fn_ty<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, main_def_id: DefId) { let main_id = tcx.hir().as_local_hir_id(main_def_id).unwrap(); let main_span = tcx.def_span(main_def_id); let main_t = tcx.type_of(main_def_id); @@ -244,7 +244,7 @@ fn check_main_fn_ty<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, main_def_id: DefId) { } } -fn check_start_fn_ty<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, start_def_id: DefId) { +fn check_start_fn_ty<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, start_def_id: DefId) { let start_id = tcx.hir().as_local_hir_id(start_def_id).unwrap(); let start_span = tcx.def_span(start_def_id); let start_t = tcx.type_of(start_def_id); @@ -301,7 +301,7 @@ fn check_start_fn_ty<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, start_def_id: DefId) { } } -fn check_for_entry_fn<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +fn check_for_entry_fn<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) { match tcx.entry_fn(LOCAL_CRATE) { Some((def_id, EntryFnType::Main)) => check_main_fn_ty(tcx, def_id), Some((def_id, EntryFnType::Start)) => check_start_fn_ty(tcx, def_id), @@ -318,7 +318,7 @@ pub fn provide(providers: &mut Providers<'_>) { impl_wf_check::provide(providers); } -pub fn check_crate<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) +pub fn check_crate<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) -> Result<(), ErrorReported> { tcx.sess.profiler(|p| p.start_activity("type-check crate")); @@ -381,7 +381,7 @@ pub fn check_crate<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) /// A quasi-deprecated helper used in rustdoc and clippy to get /// the type from a HIR node. -pub fn hir_ty_to_ty<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, hir_ty: &hir::Ty) -> Ty<'tcx> { +pub fn hir_ty_to_ty<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, hir_ty: &hir::Ty) -> Ty<'tcx> { // In case there are any projections, etc., find the "environment" // def-ID that will be used to determine the traits/predicates in // scope. This is derived from the enclosing item-like thing. @@ -392,7 +392,7 @@ pub fn hir_ty_to_ty<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, hir_ty: &hir::Ty) -> Ty astconv::AstConv::ast_ty_to_ty(&item_cx, hir_ty) } -pub fn hir_trait_to_predicates<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, hir_trait: &hir::TraitRef) +pub fn hir_trait_to_predicates<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, hir_trait: &hir::TraitRef) -> (ty::PolyTraitRef<'tcx>, Bounds<'tcx>) { // In case there are any projections, etc., find the "environment" // def-ID that will be used to determine the traits/predicates in diff --git a/src/librustc_typeck/outlives/explicit.rs b/src/librustc_typeck/outlives/explicit.rs index 87ba9a466a82d..9d621407caf5f 100644 --- a/src/librustc_typeck/outlives/explicit.rs +++ b/src/librustc_typeck/outlives/explicit.rs @@ -18,7 +18,7 @@ impl<'tcx> ExplicitPredicatesMap<'tcx> { pub fn explicit_predicates_of( &mut self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, ) -> &RequiredPredicates<'tcx> { self.map.entry(def_id).or_insert_with(|| { diff --git a/src/librustc_typeck/outlives/implicit_infer.rs b/src/librustc_typeck/outlives/implicit_infer.rs index 354be95c05007..73a1be0027ae4 100644 --- a/src/librustc_typeck/outlives/implicit_infer.rs +++ b/src/librustc_typeck/outlives/implicit_infer.rs @@ -15,7 +15,7 @@ use super::utils::*; /// was generated by walking the items in the crate. This will /// now be filled with inferred predicates. pub fn infer_predicates<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, explicit_map: &mut ExplicitPredicatesMap<'tcx>, ) -> FxHashMap> { debug!("infer_predicates"); @@ -44,7 +44,7 @@ pub fn infer_predicates<'tcx>( } pub struct InferVisitor<'cx, 'tcx: 'cx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, global_inferred_outlives: &'cx mut FxHashMap>, predicates_added: &'cx mut bool, explicit_map: &'cx mut ExplicitPredicatesMap<'tcx>, @@ -117,7 +117,7 @@ impl<'cx, 'tcx> ItemLikeVisitor<'tcx> for InferVisitor<'cx, 'tcx> { } fn insert_required_predicates_to_be_wf<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, field_ty: Ty<'tcx>, global_inferred_outlives: &FxHashMap>, required_predicates: &mut RequiredPredicates<'tcx>, @@ -255,7 +255,7 @@ pub struct IgnoreSelfTy(bool); /// can ignore, but we will want to process `U: 'static`, /// applying the substitution as above. pub fn check_explicit_predicates<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, def_id: &DefId, substs: &[Kind<'tcx>], required_predicates: &mut RequiredPredicates<'tcx>, diff --git a/src/librustc_typeck/outlives/mod.rs b/src/librustc_typeck/outlives/mod.rs index 3966a7c1776a1..03e1a6e4d44bc 100644 --- a/src/librustc_typeck/outlives/mod.rs +++ b/src/librustc_typeck/outlives/mod.rs @@ -21,7 +21,7 @@ pub fn provide(providers: &mut Providers<'_>) { } fn inferred_outlives_of<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, item_def_id: DefId, ) -> &'tcx [ty::Predicate<'tcx>] { let id = tcx @@ -71,7 +71,7 @@ fn inferred_outlives_of<'tcx>( } fn inferred_outlives_crate<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, crate_num: CrateNum, ) -> &'tcx CratePredicatesMap<'tcx> { assert_eq!(crate_num, LOCAL_CRATE); diff --git a/src/librustc_typeck/outlives/test.rs b/src/librustc_typeck/outlives/test.rs index 2b0ab90693685..7055bbd3c51d2 100644 --- a/src/librustc_typeck/outlives/test.rs +++ b/src/librustc_typeck/outlives/test.rs @@ -3,14 +3,14 @@ use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::ty::TyCtxt; use syntax::symbol::sym; -pub fn test_inferred_outlives<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn test_inferred_outlives<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) { tcx.hir() .krate() .visit_all_item_likes(&mut OutlivesTest { tcx }); } struct OutlivesTest<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, } impl ItemLikeVisitor<'tcx> for OutlivesTest<'tcx> { diff --git a/src/librustc_typeck/outlives/utils.rs b/src/librustc_typeck/outlives/utils.rs index 26243c765ed13..2aa2efbb6236b 100644 --- a/src/librustc_typeck/outlives/utils.rs +++ b/src/librustc_typeck/outlives/utils.rs @@ -11,7 +11,7 @@ pub type RequiredPredicates<'tcx> = BTreeSet, t /// Given a requirement `T: 'a` or `'b: 'a`, deduce the /// outlives_component and add it to `required_predicates` pub fn insert_outlives_predicate<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, kind: Kind<'tcx>, outlived_region: Region<'tcx>, required_predicates: &mut RequiredPredicates<'tcx>, @@ -125,7 +125,7 @@ pub fn insert_outlives_predicate<'tcx>( } } -fn is_free_region<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, region: Region<'_>) -> bool { +fn is_free_region<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, region: Region<'_>) -> bool { // First, screen for regions that might appear in a type header. match region { // These correspond to `T: 'a` relationships: diff --git a/src/librustc_typeck/variance/constraints.rs b/src/librustc_typeck/variance/constraints.rs index 325f632ad6dee..5433afa2a7b89 100644 --- a/src/librustc_typeck/variance/constraints.rs +++ b/src/librustc_typeck/variance/constraints.rs @@ -124,7 +124,7 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> { self.build_constraints_for_item(def_id); } - fn tcx(&self) -> TyCtxt<'tcx, 'tcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'tcx, 'tcx> { self.terms_cx.tcx } diff --git a/src/librustc_typeck/variance/mod.rs b/src/librustc_typeck/variance/mod.rs index a9d12a0b291b4..c8079210022f6 100644 --- a/src/librustc_typeck/variance/mod.rs +++ b/src/librustc_typeck/variance/mod.rs @@ -34,7 +34,7 @@ pub fn provide(providers: &mut Providers<'_>) { }; } -fn crate_variances<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, crate_num: CrateNum) +fn crate_variances<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, crate_num: CrateNum) -> &'tcx CrateVariancesMap<'tcx> { assert_eq!(crate_num, LOCAL_CRATE); let mut arena = arena::TypedArena::default(); @@ -43,7 +43,7 @@ fn crate_variances<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, crate_num: CrateNum) tcx.arena.alloc(solve::solve_constraints(constraints_cx)) } -fn variances_of<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item_def_id: DefId) +fn variances_of<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, item_def_id: DefId) -> &'tcx [ty::Variance] { let id = tcx.hir().as_local_hir_id(item_def_id).expect("expected local def-id"); let unsupported = || { diff --git a/src/librustc_typeck/variance/terms.rs b/src/librustc_typeck/variance/terms.rs index 2faae2b2a97b2..e566500571335 100644 --- a/src/librustc_typeck/variance/terms.rs +++ b/src/librustc_typeck/variance/terms.rs @@ -48,7 +48,7 @@ impl<'a> fmt::Debug for VarianceTerm<'a> { // The first pass over the crate simply builds up the set of inferreds. pub struct TermsContext<'a, 'tcx: 'a> { - pub tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + pub tcx: TyCtxt<'tcx, 'tcx>, pub arena: &'a TypedArena>, // For marker types, UnsafeCell, and other lang items where @@ -64,7 +64,7 @@ pub struct TermsContext<'a, 'tcx: 'a> { pub inferred_terms: Vec>, } -pub fn determine_parameters_to_be_inferred<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn determine_parameters_to_be_inferred<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx>, arena: &'a mut TypedArena>) -> TermsContext<'a, 'tcx> { let mut terms_cx = TermsContext { @@ -85,7 +85,7 @@ pub fn determine_parameters_to_be_inferred<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tc terms_cx } -fn lang_items(tcx: TyCtxt<'_, '_, '_>) -> Vec<(hir::HirId, Vec)> { +fn lang_items(tcx: TyCtxt<'_, '_>) -> Vec<(hir::HirId, Vec)> { let lang_items = tcx.lang_items(); let all = vec![ (lang_items.phantom_data(), vec![ty::Covariant]), diff --git a/src/librustc_typeck/variance/test.rs b/src/librustc_typeck/variance/test.rs index 0ff86f5a8cfde..3f55b3360154c 100644 --- a/src/librustc_typeck/variance/test.rs +++ b/src/librustc_typeck/variance/test.rs @@ -3,12 +3,12 @@ use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::ty::TyCtxt; use syntax::symbol::sym; -pub fn test_variance<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn test_variance<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) { tcx.hir().krate().visit_all_item_likes(&mut VarianceTest { tcx }); } struct VarianceTest<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx> + tcx: TyCtxt<'tcx, 'tcx> } impl ItemLikeVisitor<'tcx> for VarianceTest<'tcx> { diff --git a/src/librustdoc/clean/auto_trait.rs b/src/librustdoc/clean/auto_trait.rs index 2bf80198381da..b0f274ac6b791 100644 --- a/src/librustdoc/clean/auto_trait.rs +++ b/src/librustdoc/clean/auto_trait.rs @@ -315,7 +315,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { fn extract_for_generics<'c, 'd>( &self, - tcx: TyCtxt<'d, 'c, 'd>, + tcx: TyCtxt<'c, 'd>, pred: ty::Predicate<'d>, ) -> FxHashSet { pred.walk_tys() @@ -450,7 +450,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { // * We explcitly add a '?Sized' bound if we didn't find any 'Sized' predicates for a type fn param_env_to_generics<'c, 'cx>( &self, - tcx: TyCtxt<'cx, 'c, 'cx>, + tcx: TyCtxt<'c, 'cx>, param_env_def_id: DefId, param_env: ty::ParamEnv<'cx>, mut existing_predicates: Vec, @@ -776,7 +776,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { vec.sort_by_cached_key(|x| format!("{:?}", x)) } - fn is_fn_ty(&self, tcx: TyCtxt<'_, '_, '_>, ty: &Type) -> bool { + fn is_fn_ty(&self, tcx: TyCtxt<'_, '_>, ty: &Type) -> bool { match &ty { &&Type::ResolvedPath { ref did, .. } => { *did == tcx.require_lang_item(lang_items::FnTraitLangItem) @@ -791,11 +791,11 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { // Replaces all ReVars in a type with ty::Region's, using the provided map struct RegionReplacer<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { vid_to_region: &'a FxHashMap>, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, } impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for RegionReplacer<'a, 'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> { self.tcx } diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index e44c35b55ffad..559dcaf5a8d3b 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -4432,7 +4432,7 @@ where // Start of code copied from rust-clippy -pub fn path_to_def_local(tcx: TyCtxt<'_, '_, '_>, path: &[Symbol]) -> Option { +pub fn path_to_def_local(tcx: TyCtxt<'_, '_>, path: &[Symbol]) -> Option { let krate = tcx.hir().krate(); let mut items = krate.module.item_ids.clone(); let mut path_it = path.iter().peekable(); @@ -4457,7 +4457,7 @@ pub fn path_to_def_local(tcx: TyCtxt<'_, '_, '_>, path: &[Symbol]) -> Option, path: &[Symbol]) -> Option { +pub fn path_to_def(tcx: TyCtxt<'_, '_>, path: &[Symbol]) -> Option { let crates = tcx.crates(); let krate = crates diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index 2a3bc5e99617f..b48ed12cc6baa 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -44,7 +44,7 @@ pub type ExternalPaths = FxHashMap, clean::TypeKind)>; pub struct DocContext<'tcx> { - pub tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + pub tcx: TyCtxt<'tcx, 'tcx>, pub resolver: Rc>>, /// The stack of module NodeIds up till this point pub crate_name: Option, diff --git a/src/test/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs b/src/test/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs index 7e9f004684d38..7fc3e5a097920 100644 --- a/src/test/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs +++ b/src/test/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs @@ -60,7 +60,7 @@ impl CodegenBackend for TheBackend { fn codegen_crate<'a, 'tcx>( &self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, _metadata: EncodedMetadata, _need_metadata_module: bool, _rx: mpsc::Receiver> diff --git a/src/test/ui-fulldeps/internal-lints/pass_ty_by_ref.rs b/src/test/ui-fulldeps/internal-lints/pass_ty_by_ref.rs index 075ce8b1a1cb2..00190ed12b4d6 100644 --- a/src/test/ui-fulldeps/internal-lints/pass_ty_by_ref.rs +++ b/src/test/ui-fulldeps/internal-lints/pass_ty_by_ref.rs @@ -11,26 +11,26 @@ use rustc::ty::{Ty, TyCtxt}; fn ty_by_ref( ty_val: Ty<'_>, ty_ref: &Ty<'_>, //~ ERROR passing `Ty<'_>` by reference - ty_ctxt_val: TyCtxt<'_, '_, '_>, - ty_ctxt_ref: &TyCtxt<'_, '_, '_>, //~ ERROR passing `TyCtxt<'_, '_, '_>` by reference + ty_ctxt_val: TyCtxt<'_, '_>, + ty_ctxt_ref: &TyCtxt<'_, '_>, //~ ERROR passing `TyCtxt<'_, '_>` by reference ) { } -fn ty_multi_ref(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_, '_, '_>) {} +fn ty_multi_ref(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_, '_>) {} //~^ ERROR passing `Ty<'_>` by reference -//~^^ ERROR passing `TyCtxt<'_, '_, '_>` by reference +//~^^ ERROR passing `TyCtxt<'_, '_>` by reference trait T { fn ty_by_ref_in_trait( ty_val: Ty<'_>, ty_ref: &Ty<'_>, //~ ERROR passing `Ty<'_>` by reference - ty_ctxt_val: TyCtxt<'_, '_, '_>, - ty_ctxt_ref: &TyCtxt<'_, '_, '_>, //~ ERROR passing `TyCtxt<'_, '_, '_>` by reference + ty_ctxt_val: TyCtxt<'_, '_>, + ty_ctxt_ref: &TyCtxt<'_, '_>, //~ ERROR passing `TyCtxt<'_, '_>` by reference ); - fn ty_multi_ref_in_trait(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_, '_, '_>); + fn ty_multi_ref_in_trait(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_, '_>); //~^ ERROR passing `Ty<'_>` by reference - //~^^ ERROR passing `TyCtxt<'_, '_, '_>` by reference + //~^^ ERROR passing `TyCtxt<'_, '_>` by reference } struct Foo; @@ -39,26 +39,26 @@ impl T for Foo { fn ty_by_ref_in_trait( ty_val: Ty<'_>, ty_ref: &Ty<'_>, - ty_ctxt_val: TyCtxt<'_, '_, '_>, - ty_ctxt_ref: &TyCtxt<'_, '_, '_>, + ty_ctxt_val: TyCtxt<'_, '_>, + ty_ctxt_ref: &TyCtxt<'_, '_>, ) { } - fn ty_multi_ref_in_trait(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_, '_, '_>) {} + fn ty_multi_ref_in_trait(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_, '_>) {} } impl Foo { fn ty_by_ref_assoc( ty_val: Ty<'_>, ty_ref: &Ty<'_>, //~ ERROR passing `Ty<'_>` by reference - ty_ctxt_val: TyCtxt<'_, '_, '_>, - ty_ctxt_ref: &TyCtxt<'_, '_, '_>, //~ ERROR passing `TyCtxt<'_, '_, '_>` by reference + ty_ctxt_val: TyCtxt<'_, '_>, + ty_ctxt_ref: &TyCtxt<'_, '_>, //~ ERROR passing `TyCtxt<'_, '_>` by reference ) { } - fn ty_multi_ref_assoc(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_, '_, '_>) {} + fn ty_multi_ref_assoc(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_, '_>) {} //~^ ERROR passing `Ty<'_>` by reference - //~^^ ERROR passing `TyCtxt<'_, '_, '_>` by reference + //~^^ ERROR passing `TyCtxt<'_, '_>` by reference } fn main() {} diff --git a/src/test/ui-fulldeps/internal-lints/pass_ty_by_ref.stderr b/src/test/ui-fulldeps/internal-lints/pass_ty_by_ref.stderr index f3e630f3be238..94440f0385a92 100644 --- a/src/test/ui-fulldeps/internal-lints/pass_ty_by_ref.stderr +++ b/src/test/ui-fulldeps/internal-lints/pass_ty_by_ref.stderr @@ -10,23 +10,23 @@ note: lint level defined here LL | #![deny(ty_pass_by_reference)] | ^^^^^^^^^^^^^^^^^^^^ -error: passing `TyCtxt<'_, '_, '_>` by reference +error: passing `TyCtxt<'_, '_>` by reference --> $DIR/pass_ty_by_ref.rs:15:18 | -LL | ty_ctxt_ref: &TyCtxt<'_, '_, '_>, - | ^^^^^^^^^^^^^^^^^^^ help: try passing by value: `TyCtxt<'_, '_, '_>` +LL | ty_ctxt_ref: &TyCtxt<'_, '_>, + | ^^^^^^^^^^^^^^^ help: try passing by value: `TyCtxt<'_, '_>` error: passing `Ty<'_>` by reference --> $DIR/pass_ty_by_ref.rs:19:28 | -LL | fn ty_multi_ref(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_, '_, '_>) {} +LL | fn ty_multi_ref(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_, '_>) {} | ^^^^^^^ help: try passing by value: `Ty<'_>` -error: passing `TyCtxt<'_, '_, '_>` by reference +error: passing `TyCtxt<'_, '_>` by reference --> $DIR/pass_ty_by_ref.rs:19:55 | -LL | fn ty_multi_ref(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_, '_, '_>) {} - | ^^^^^^^^^^^^^^^^^^^ help: try passing by value: `TyCtxt<'_, '_, '_>` +LL | fn ty_multi_ref(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_, '_>) {} + | ^^^^^^^^^^^^^^^ help: try passing by value: `TyCtxt<'_, '_>` error: passing `Ty<'_>` by reference --> $DIR/pass_ty_by_ref.rs:26:17 @@ -34,23 +34,23 @@ error: passing `Ty<'_>` by reference LL | ty_ref: &Ty<'_>, | ^^^^^^^ help: try passing by value: `Ty<'_>` -error: passing `TyCtxt<'_, '_, '_>` by reference +error: passing `TyCtxt<'_, '_>` by reference --> $DIR/pass_ty_by_ref.rs:28:22 | -LL | ty_ctxt_ref: &TyCtxt<'_, '_, '_>, - | ^^^^^^^^^^^^^^^^^^^ help: try passing by value: `TyCtxt<'_, '_, '_>` +LL | ty_ctxt_ref: &TyCtxt<'_, '_>, + | ^^^^^^^^^^^^^^^ help: try passing by value: `TyCtxt<'_, '_>` error: passing `Ty<'_>` by reference --> $DIR/pass_ty_by_ref.rs:31:41 | -LL | fn ty_multi_ref_in_trait(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_, '_, '_>); +LL | fn ty_multi_ref_in_trait(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_, '_>); | ^^^^^^^ help: try passing by value: `Ty<'_>` -error: passing `TyCtxt<'_, '_, '_>` by reference +error: passing `TyCtxt<'_, '_>` by reference --> $DIR/pass_ty_by_ref.rs:31:68 | -LL | fn ty_multi_ref_in_trait(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_, '_, '_>); - | ^^^^^^^^^^^^^^^^^^^ help: try passing by value: `TyCtxt<'_, '_, '_>` +LL | fn ty_multi_ref_in_trait(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_, '_>); + | ^^^^^^^^^^^^^^^ help: try passing by value: `TyCtxt<'_, '_>` error: passing `Ty<'_>` by reference --> $DIR/pass_ty_by_ref.rs:53:17 @@ -58,23 +58,23 @@ error: passing `Ty<'_>` by reference LL | ty_ref: &Ty<'_>, | ^^^^^^^ help: try passing by value: `Ty<'_>` -error: passing `TyCtxt<'_, '_, '_>` by reference +error: passing `TyCtxt<'_, '_>` by reference --> $DIR/pass_ty_by_ref.rs:55:22 | -LL | ty_ctxt_ref: &TyCtxt<'_, '_, '_>, - | ^^^^^^^^^^^^^^^^^^^ help: try passing by value: `TyCtxt<'_, '_, '_>` +LL | ty_ctxt_ref: &TyCtxt<'_, '_>, + | ^^^^^^^^^^^^^^^ help: try passing by value: `TyCtxt<'_, '_>` error: passing `Ty<'_>` by reference --> $DIR/pass_ty_by_ref.rs:59:38 | -LL | fn ty_multi_ref_assoc(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_, '_, '_>) {} +LL | fn ty_multi_ref_assoc(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_, '_>) {} | ^^^^^^^ help: try passing by value: `Ty<'_>` -error: passing `TyCtxt<'_, '_, '_>` by reference +error: passing `TyCtxt<'_, '_>` by reference --> $DIR/pass_ty_by_ref.rs:59:65 | -LL | fn ty_multi_ref_assoc(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_, '_, '_>) {} - | ^^^^^^^^^^^^^^^^^^^ help: try passing by value: `TyCtxt<'_, '_, '_>` +LL | fn ty_multi_ref_assoc(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_, '_>) {} + | ^^^^^^^^^^^^^^^ help: try passing by value: `TyCtxt<'_, '_>` error: aborting due to 12 previous errors diff --git a/src/test/ui-fulldeps/internal-lints/qualified_ty_ty_ctxt.rs b/src/test/ui-fulldeps/internal-lints/qualified_ty_ty_ctxt.rs index 5e10697ec66d4..fa019dfe3ae09 100644 --- a/src/test/ui-fulldeps/internal-lints/qualified_ty_ty_ctxt.rs +++ b/src/test/ui-fulldeps/internal-lints/qualified_ty_ty_ctxt.rs @@ -13,8 +13,8 @@ macro_rules! qualified_macro { fn ty_in_macro( ty_q: ty::Ty<'_>, ty: Ty<'_>, - ty_ctxt_q: ty::TyCtxt<'_, '_, '_>, - ty_ctxt: TyCtxt<'_, '_, '_>, + ty_ctxt_q: ty::TyCtxt<'_, '_>, + ty_ctxt: TyCtxt<'_, '_>, ) { println!("{}", stringify!($a)); } @@ -24,8 +24,8 @@ macro_rules! qualified_macro { fn ty_qualified( ty_q: ty::Ty<'_>, //~ ERROR usage of qualified `ty::Ty<'_>` ty: Ty<'_>, - ty_ctxt_q: ty::TyCtxt<'_, '_, '_>, //~ ERROR usage of qualified `ty::TyCtxt<'_, '_, '_>` - ty_ctxt: TyCtxt<'_, '_, '_>, + ty_ctxt_q: ty::TyCtxt<'_, '_>, //~ ERROR usage of qualified `ty::TyCtxt<'_, '_>` + ty_ctxt: TyCtxt<'_, '_>, ) { } diff --git a/src/test/ui-fulldeps/internal-lints/qualified_ty_ty_ctxt.stderr b/src/test/ui-fulldeps/internal-lints/qualified_ty_ty_ctxt.stderr index 31d776cd9e00a..445546ab6eec0 100644 --- a/src/test/ui-fulldeps/internal-lints/qualified_ty_ty_ctxt.stderr +++ b/src/test/ui-fulldeps/internal-lints/qualified_ty_ty_ctxt.stderr @@ -10,11 +10,11 @@ note: lint level defined here LL | #![deny(usage_of_qualified_ty)] | ^^^^^^^^^^^^^^^^^^^^^ -error: usage of qualified `ty::TyCtxt<'_, '_, '_>` +error: usage of qualified `ty::TyCtxt<'_, '_>` --> $DIR/qualified_ty_ty_ctxt.rs:27:16 | -LL | ty_ctxt_q: ty::TyCtxt<'_, '_, '_>, - | ^^^^^^^^^^^^^^^^^^^^^^ help: try using it unqualified: `TyCtxt<'_, '_, '_>` +LL | ty_ctxt_q: ty::TyCtxt<'_, '_>, + | ^^^^^^^^^^^^^^^^^^ help: try using it unqualified: `TyCtxt<'_, '_>` error: aborting due to 2 previous errors From 21ac960334485bfad6818510bc12dc65129f2c39 Mon Sep 17 00:00:00 2001 From: Eduard-Mihai Burtescu Date: Wed, 5 Jun 2019 17:03:08 +0300 Subject: [PATCH 4/7] rustc: remove some unnecessary lifetimes in -> TyCtxt methods. --- src/librustc/lint/context.rs | 2 +- src/librustc/mir/interpret/mod.rs | 2 +- .../traits/query/normalize_erasing_regions.rs | 2 +- src/librustc/ty/codec.rs | 39 +++++++------------ src/librustc/ty/layout.rs | 6 +-- src/librustc_codegen_llvm/builder.rs | 2 +- src/librustc_codegen_llvm/context.rs | 2 +- .../symbol_names/legacy.rs | 2 +- src/librustc_codegen_utils/symbol_names/v0.rs | 2 +- src/librustc_mir/interpret/eval_context.rs | 2 +- .../interpret/intrinsics/type_name.rs | 2 +- src/librustc_mir/transform/const_prop.rs | 2 +- src/librustc_passes/layout_test.rs | 2 +- src/librustc_typeck/collect.rs | 2 +- 14 files changed, 28 insertions(+), 41 deletions(-) diff --git a/src/librustc/lint/context.rs b/src/librustc/lint/context.rs index 11047f45343af..a35ed7e862712 100644 --- a/src/librustc/lint/context.rs +++ b/src/librustc/lint/context.rs @@ -793,7 +793,7 @@ impl<'a, 'tcx> LateContext<'a, 'tcx> { type DynExistential = (); type Const = (); - fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'tcx, 'tcx> { self.tcx } diff --git a/src/librustc/mir/interpret/mod.rs b/src/librustc/mir/interpret/mod.rs index 09d7f77ac9d5b..89b2403fa6a03 100644 --- a/src/librustc/mir/interpret/mod.rs +++ b/src/librustc/mir/interpret/mod.rs @@ -144,7 +144,7 @@ pub struct AllocDecodingSession<'s> { impl<'s> AllocDecodingSession<'s> { // Decodes an AllocId in a thread-safe way. - pub fn decode_alloc_id<'tcx, D>(&self, + pub fn decode_alloc_id(&self, decoder: &mut D) -> Result where D: TyDecoder<'tcx>, diff --git a/src/librustc/traits/query/normalize_erasing_regions.rs b/src/librustc/traits/query/normalize_erasing_regions.rs index b9ca0363fc689..8b820e22cac0b 100644 --- a/src/librustc/traits/query/normalize_erasing_regions.rs +++ b/src/librustc/traits/query/normalize_erasing_regions.rs @@ -68,7 +68,7 @@ struct NormalizeAfterErasingRegionsFolder<'tcx> { } impl TypeFolder<'tcx, 'tcx> for NormalizeAfterErasingRegionsFolder<'tcx> { - fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'tcx, 'tcx> { self.tcx } diff --git a/src/librustc/ty/codec.rs b/src/librustc/ty/codec.rs index 3561a647d5e54..7f89b2ccfdb5b 100644 --- a/src/librustc/ty/codec.rs +++ b/src/librustc/ty/codec.rs @@ -131,38 +131,34 @@ pub trait TyDecoder<'tcx>: Decoder { } #[inline] -pub fn decode_arena_allocable<'a, 'tcx, D, T: ArenaAllocatable + Decodable>( +pub fn decode_arena_allocable( decoder: &mut D ) -> Result<&'tcx T, D::Error> where D: TyDecoder<'tcx>, - 'tcx: 'a, { Ok(decoder.tcx().arena.alloc(Decodable::decode(decoder)?)) } #[inline] -pub fn decode_arena_allocable_slice<'a, 'tcx, D, T: ArenaAllocatable + Decodable>( +pub fn decode_arena_allocable_slice( decoder: &mut D ) -> Result<&'tcx [T], D::Error> where D: TyDecoder<'tcx>, - 'tcx: 'a, { Ok(decoder.tcx().arena.alloc_from_iter( as Decodable>::decode(decoder)?)) } #[inline] -pub fn decode_cnum<'a, 'tcx, D>(decoder: &mut D) -> Result +pub fn decode_cnum(decoder: &mut D) -> Result where D: TyDecoder<'tcx>, - 'tcx: 'a, { let cnum = CrateNum::from_u32(u32::decode(decoder)?); Ok(decoder.map_encoded_cnum_to_current(cnum)) } #[inline] -pub fn decode_ty<'a, 'tcx, D>(decoder: &mut D) -> Result, D::Error> +pub fn decode_ty(decoder: &mut D) -> Result, D::Error> where D: TyDecoder<'tcx>, - 'tcx: 'a, { // Handle shorthands first, if we have an usize > 0x80. if decoder.positioned_at_shorthand() { @@ -180,10 +176,9 @@ pub fn decode_ty<'a, 'tcx, D>(decoder: &mut D) -> Result, D::Error> } #[inline] -pub fn decode_predicates<'a, 'tcx, D>(decoder: &mut D) +pub fn decode_predicates(decoder: &mut D) -> Result, D::Error> where D: TyDecoder<'tcx>, - 'tcx: 'a, { Ok(ty::GenericPredicates { parent: Decodable::decode(decoder)?, @@ -205,9 +200,8 @@ pub fn decode_predicates<'a, 'tcx, D>(decoder: &mut D) } #[inline] -pub fn decode_substs<'a, 'tcx, D>(decoder: &mut D) -> Result, D::Error> +pub fn decode_substs(decoder: &mut D) -> Result, D::Error> where D: TyDecoder<'tcx>, - 'tcx: 'a, { let len = decoder.read_usize()?; let tcx = decoder.tcx(); @@ -215,38 +209,34 @@ pub fn decode_substs<'a, 'tcx, D>(decoder: &mut D) -> Result, D: } #[inline] -pub fn decode_region<'a, 'tcx, D>(decoder: &mut D) -> Result, D::Error> +pub fn decode_region(decoder: &mut D) -> Result, D::Error> where D: TyDecoder<'tcx>, - 'tcx: 'a, { Ok(decoder.tcx().mk_region(Decodable::decode(decoder)?)) } #[inline] -pub fn decode_ty_slice<'a, 'tcx, D>(decoder: &mut D) +pub fn decode_ty_slice(decoder: &mut D) -> Result<&'tcx ty::List>, D::Error> where D: TyDecoder<'tcx>, - 'tcx: 'a, { let len = decoder.read_usize()?; Ok(decoder.tcx().mk_type_list((0..len).map(|_| Decodable::decode(decoder)))?) } #[inline] -pub fn decode_adt_def<'a, 'tcx, D>(decoder: &mut D) +pub fn decode_adt_def(decoder: &mut D) -> Result<&'tcx ty::AdtDef, D::Error> where D: TyDecoder<'tcx>, - 'tcx: 'a, { let def_id = DefId::decode(decoder)?; Ok(decoder.tcx().adt_def(def_id)) } #[inline] -pub fn decode_existential_predicate_slice<'a, 'tcx, D>(decoder: &mut D) +pub fn decode_existential_predicate_slice(decoder: &mut D) -> Result<&'tcx ty::List>, D::Error> where D: TyDecoder<'tcx>, - 'tcx: 'a, { let len = decoder.read_usize()?; Ok(decoder.tcx() @@ -254,10 +244,9 @@ pub fn decode_existential_predicate_slice<'a, 'tcx, D>(decoder: &mut D) } #[inline] -pub fn decode_canonical_var_infos<'a, 'tcx, D>(decoder: &mut D) +pub fn decode_canonical_var_infos(decoder: &mut D) -> Result, D::Error> where D: TyDecoder<'tcx>, - 'tcx: 'a, { let len = decoder.read_usize()?; let interned: Result, _> = (0..len).map(|_| Decodable::decode(decoder)) @@ -267,19 +256,17 @@ pub fn decode_canonical_var_infos<'a, 'tcx, D>(decoder: &mut D) } #[inline] -pub fn decode_const<'a, 'tcx, D>(decoder: &mut D) +pub fn decode_const(decoder: &mut D) -> Result<&'tcx ty::Const<'tcx>, D::Error> where D: TyDecoder<'tcx>, - 'tcx: 'a, { Ok(decoder.tcx().mk_const(Decodable::decode(decoder)?)) } #[inline] -pub fn decode_allocation<'a, 'tcx, D>(decoder: &mut D) +pub fn decode_allocation(decoder: &mut D) -> Result<&'tcx Allocation, D::Error> where D: TyDecoder<'tcx>, - 'tcx: 'a, { Ok(decoder.tcx().intern_const_alloc(Decodable::decode(decoder)?)) } diff --git a/src/librustc/ty/layout.rs b/src/librustc/ty/layout.rs index 327c430cd396f..65b6f93e251d6 100644 --- a/src/librustc/ty/layout.rs +++ b/src/librustc/ty/layout.rs @@ -1727,7 +1727,7 @@ impl<'tcx> SizeSkeleton<'tcx> { } pub trait HasTyCtxt<'tcx>: HasDataLayout { - fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx>; + fn tcx(&self) -> TyCtxt<'tcx, 'tcx>; } pub trait HasParamEnv<'tcx> { @@ -1741,7 +1741,7 @@ impl<'gcx, 'tcx> HasDataLayout for TyCtxt<'gcx, 'tcx> { } impl<'gcx, 'tcx> HasTyCtxt<'gcx> for TyCtxt<'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'gcx> { + fn tcx(&self) -> TyCtxt<'gcx, 'gcx> { self.global_tcx() } } @@ -1759,7 +1759,7 @@ impl<'tcx, T: HasDataLayout> HasDataLayout for LayoutCx<'tcx, T> { } impl<'gcx, 'tcx, T: HasTyCtxt<'gcx>> HasTyCtxt<'gcx> for LayoutCx<'tcx, T> { - fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'gcx> { + fn tcx(&self) -> TyCtxt<'gcx, 'gcx> { self.tcx.tcx() } } diff --git a/src/librustc_codegen_llvm/builder.rs b/src/librustc_codegen_llvm/builder.rs index 28e27535a39ad..3d5f00a06921d 100644 --- a/src/librustc_codegen_llvm/builder.rs +++ b/src/librustc_codegen_llvm/builder.rs @@ -66,7 +66,7 @@ impl ty::layout::HasDataLayout for Builder<'_, '_, '_> { } impl ty::layout::HasTyCtxt<'tcx> for Builder<'_, '_, 'tcx> { - fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'tcx, 'tcx> { self.cx.tcx } } diff --git a/src/librustc_codegen_llvm/context.rs b/src/librustc_codegen_llvm/context.rs index e3126d0e25d5a..d0b2b6846f788 100644 --- a/src/librustc_codegen_llvm/context.rs +++ b/src/librustc_codegen_llvm/context.rs @@ -838,7 +838,7 @@ impl HasTargetSpec for CodegenCx<'ll, 'tcx> { } impl ty::layout::HasTyCtxt<'tcx> for CodegenCx<'ll, 'tcx> { - fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'tcx, 'tcx> { self.tcx } } diff --git a/src/librustc_codegen_utils/symbol_names/legacy.rs b/src/librustc_codegen_utils/symbol_names/legacy.rs index 5e7b29d13a166..9645af5309e78 100644 --- a/src/librustc_codegen_utils/symbol_names/legacy.rs +++ b/src/librustc_codegen_utils/symbol_names/legacy.rs @@ -203,7 +203,7 @@ impl Printer<'tcx, 'tcx> for SymbolPrinter<'tcx> { type DynExistential = Self; type Const = Self; - fn tcx(&'a self) -> TyCtxt<'tcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'tcx, 'tcx> { self.tcx } diff --git a/src/librustc_codegen_utils/symbol_names/v0.rs b/src/librustc_codegen_utils/symbol_names/v0.rs index 6a155ba1b2a3b..7e78b9ea88769 100644 --- a/src/librustc_codegen_utils/symbol_names/v0.rs +++ b/src/librustc_codegen_utils/symbol_names/v0.rs @@ -223,7 +223,7 @@ impl Printer<'tcx, 'tcx> for SymbolMangler<'tcx> { type DynExistential = Self; type Const = Self; - fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'tcx, 'tcx> { self.tcx } diff --git a/src/librustc_mir/interpret/eval_context.rs b/src/librustc_mir/interpret/eval_context.rs index 5b91b88f276ed..134c23e56e223 100644 --- a/src/librustc_mir/interpret/eval_context.rs +++ b/src/librustc_mir/interpret/eval_context.rs @@ -173,7 +173,7 @@ impl<'mir, 'tcx, M> layout::HasTyCtxt<'tcx> for InterpretCx<'mir, 'tcx, M> where M: Machine<'mir, 'tcx> { #[inline] - fn tcx<'d>(&'d self) -> TyCtxt<'tcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'tcx, 'tcx> { *self.tcx } } diff --git a/src/librustc_mir/interpret/intrinsics/type_name.rs b/src/librustc_mir/interpret/intrinsics/type_name.rs index 9c3dc40a5e1a0..8ef9b75e4be3b 100644 --- a/src/librustc_mir/interpret/intrinsics/type_name.rs +++ b/src/librustc_mir/interpret/intrinsics/type_name.rs @@ -23,7 +23,7 @@ impl<'tcx> Printer<'tcx, 'tcx> for AbsolutePathPrinter<'tcx> { type DynExistential = Self; type Const = Self; - fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'tcx, 'tcx> { self.tcx } diff --git a/src/librustc_mir/transform/const_prop.rs b/src/librustc_mir/transform/const_prop.rs index d7c3cd52ebd05..4a363f465a74f 100644 --- a/src/librustc_mir/transform/const_prop.rs +++ b/src/librustc_mir/transform/const_prop.rs @@ -113,7 +113,7 @@ impl<'mir, 'tcx> HasDataLayout for ConstPropagator<'mir, 'tcx> { impl<'mir, 'tcx> HasTyCtxt<'tcx> for ConstPropagator<'mir, 'tcx> { #[inline] - fn tcx<'c>(&'c self) -> TyCtxt<'tcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'tcx, 'tcx> { self.tcx } } diff --git a/src/librustc_passes/layout_test.rs b/src/librustc_passes/layout_test.rs index c4ebd9cf89db2..5ed731347bb13 100644 --- a/src/librustc_passes/layout_test.rs +++ b/src/librustc_passes/layout_test.rs @@ -119,7 +119,7 @@ impl LayoutOf for UnwrapLayoutCx<'tcx> { } impl HasTyCtxt<'tcx> for UnwrapLayoutCx<'tcx> { - fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'tcx, 'tcx> { self.tcx } } diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index 02edf63dd5c7e..a78af7875b9c4 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -171,7 +171,7 @@ impl ItemCtxt<'tcx> { } impl AstConv<'tcx, 'tcx> for ItemCtxt<'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'tcx, 'tcx> { self.tcx } From fff08cb04389497d254fb40948674cbbee402908 Mon Sep 17 00:00:00 2001 From: Eduard-Mihai Burtescu Date: Wed, 12 Jun 2019 00:11:55 +0300 Subject: [PATCH 5/7] Run `rustfmt --file-lines ...` for changes from previous commits. --- src/librustc/cfg/construct.rs | 3 +- src/librustc/cfg/mod.rs | 3 +- src/librustc/dep_graph/dep_node.rs | 3 +- src/librustc/dep_graph/graph.rs | 7 +- src/librustc/dep_graph/safe.rs | 3 +- src/librustc/infer/canonical/substitute.rs | 6 +- src/librustc/infer/combine.rs | 14 +- .../nice_region_error/placeholder_error.rs | 5 +- src/librustc/infer/lattice.rs | 2 +- .../infer/outlives/free_region_map.rs | 11 +- src/librustc/lint/context.rs | 7 +- src/librustc/lint/mod.rs | 4 +- src/librustc/middle/cstore.rs | 8 +- src/librustc/middle/dead.rs | 20 +- src/librustc/middle/dependency_format.rs | 14 +- src/librustc/middle/exported_symbols.rs | 13 +- src/librustc/middle/expr_use_visitor.rs | 18 +- src/librustc/middle/intrinsicck.rs | 6 +- src/librustc/middle/liveness.rs | 14 +- src/librustc/middle/mem_categorization.rs | 22 +- src/librustc/middle/reachable.rs | 12 +- src/librustc/middle/region.rs | 43 +- src/librustc/middle/resolve_lifetime.rs | 9 +- src/librustc/middle/stability.rs | 4 +- src/librustc/mir/interpret/error.rs | 21 +- src/librustc/mir/interpret/mod.rs | 8 +- src/librustc/mir/mod.rs | 2 +- src/librustc/mir/mono.rs | 26 +- src/librustc/mir/tcx.rs | 34 +- src/librustc/traits/codegen/mod.rs | 9 +- src/librustc/traits/coherence.rs | 36 +- src/librustc/traits/error_reporting.rs | 29 +- src/librustc/traits/mod.rs | 47 +- src/librustc/traits/object_safety.rs | 4 +- src/librustc/traits/on_unimplemented.rs | 62 +-- src/librustc/traits/query/dropck_outlives.rs | 7 +- src/librustc/traits/specialize/mod.rs | 8 +- .../traits/specialize/specialization_graph.rs | 53 ++- src/librustc/traits/util.rs | 46 +- src/librustc/ty/_match.rs | 2 +- src/librustc/ty/adjustment.rs | 7 +- src/librustc/ty/codec.rs | 66 +-- src/librustc/ty/context.rs | 77 ++-- src/librustc/ty/fast_reject.rs | 10 +- src/librustc/ty/fold.rs | 67 +-- .../ty/inhabitedness/def_id_forest.rs | 17 +- src/librustc/ty/inhabitedness/mod.rs | 13 +- src/librustc/ty/instance.rs | 51 +-- src/librustc/ty/layout.rs | 45 +- src/librustc/ty/mod.rs | 140 +++--- src/librustc/ty/query/config.rs | 6 +- src/librustc/ty/query/job.rs | 4 +- src/librustc/ty/query/keys.rs | 2 +- src/librustc/ty/query/on_disk_cache.rs | 137 +++--- src/librustc/ty/query/plumbing.rs | 16 +- src/librustc/ty/relate.rs | 425 +++++++++++------- src/librustc/ty/structural_impls.rs | 14 +- src/librustc/ty/sty.rs | 118 ++--- src/librustc/ty/subst.rs | 80 ++-- src/librustc/ty/trait_def.rs | 15 +- src/librustc/ty/util.rs | 97 ++-- src/librustc/ty/wf.rs | 5 +- src/librustc_borrowck/borrowck/check_loans.rs | 12 +- src/librustc_borrowck/borrowck/mod.rs | 27 +- src/librustc_borrowck/borrowck/move_data.rs | 82 ++-- src/librustc_borrowck/dataflow.rs | 19 +- src/librustc_borrowck/graphviz.rs | 13 +- src/librustc_codegen_llvm/base.rs | 2 +- src/librustc_codegen_llvm/context.rs | 13 +- .../debuginfo/metadata.rs | 9 +- src/librustc_codegen_llvm/lib.rs | 6 +- .../back/symbol_export.rs | 35 +- src/librustc_codegen_ssa/back/write.rs | 18 +- src/librustc_codegen_ssa/base.rs | 9 +- src/librustc_codegen_ssa/common.rs | 6 +- .../debuginfo/type_names.rs | 42 +- src/librustc_codegen_ssa/traits/backend.rs | 8 +- src/librustc_codegen_utils/codegen_backend.rs | 3 +- src/librustc_driver/pretty.rs | 42 +- src/librustc_incremental/assert_dep_graph.rs | 9 +- src/librustc_incremental/persist/save.rs | 6 +- src/librustc_interface/passes.rs | 7 +- src/librustc_interface/proc_macro_decls.rs | 5 +- src/librustc_lint/types.rs | 11 +- src/librustc_macros/src/query.rs | 2 +- src/librustc_metadata/cstore_impl.rs | 5 +- src/librustc_metadata/decoder.rs | 86 ++-- src/librustc_metadata/encoder.rs | 8 +- src/librustc_metadata/foreign_modules.rs | 2 +- src/librustc_metadata/link_args.rs | 2 +- src/librustc_metadata/native_libs.rs | 2 +- src/librustc_mir/borrow_check/borrow_set.rs | 3 +- src/librustc_mir/borrow_check/path_utils.rs | 4 +- src/librustc_mir/borrow_check/place_ext.rs | 2 +- src/librustc_mir/build/mod.rs | 16 +- src/librustc_mir/const_eval.rs | 15 +- .../dataflow/drop_flag_effects.rs | 47 +- src/librustc_mir/dataflow/impls/mod.rs | 40 +- src/librustc_mir/dataflow/mod.rs | 41 +- .../dataflow/move_paths/builder.rs | 2 +- src/librustc_mir/dataflow/move_paths/mod.rs | 6 +- src/librustc_mir/hair/pattern/_match.rs | 32 +- src/librustc_mir/hair/pattern/mod.rs | 18 +- src/librustc_mir/interpret/eval_context.rs | 26 +- .../interpret/intrinsics/type_name.rs | 5 +- src/librustc_mir/interpret/machine.rs | 4 +- src/librustc_mir/interpret/memory.rs | 13 +- src/librustc_mir/interpret/place.rs | 5 +- src/librustc_mir/interpret/snapshot.rs | 6 +- src/librustc_mir/interpret/validity.rs | 4 +- src/librustc_mir/interpret/visitor.rs | 11 +- src/librustc_mir/lints.rs | 14 +- src/librustc_mir/monomorphize/collector.rs | 135 +++--- src/librustc_mir/monomorphize/item.rs | 15 +- src/librustc_mir/monomorphize/mod.rs | 9 +- src/librustc_mir/monomorphize/partitioning.rs | 82 ++-- src/librustc_mir/shim.rs | 43 +- src/librustc_mir/transform/add_call_guards.rs | 10 +- .../transform/add_moves_for_packed_drops.rs | 19 +- src/librustc_mir/transform/add_retag.rs | 11 +- src/librustc_mir/transform/check_unsafety.rs | 27 +- .../transform/cleanup_post_borrowck.rs | 10 +- src/librustc_mir/transform/const_prop.rs | 18 +- src/librustc_mir/transform/copy_prop.rs | 10 +- src/librustc_mir/transform/deaggregator.rs | 10 +- src/librustc_mir/transform/dump_mir.rs | 32 +- src/librustc_mir/transform/elaborate_drops.rs | 28 +- src/librustc_mir/transform/erase_regions.rs | 5 +- src/librustc_mir/transform/generator.rs | 103 +++-- src/librustc_mir/transform/inline.rs | 20 +- src/librustc_mir/transform/instcombine.rs | 5 +- src/librustc_mir/transform/lower_128bit.rs | 29 +- src/librustc_mir/transform/mod.rs | 13 +- src/librustc_mir/transform/no_landing_pads.rs | 5 +- src/librustc_mir/transform/promote_consts.rs | 12 +- src/librustc_mir/transform/qualify_consts.rs | 15 +- .../transform/qualify_min_const_fn.rs | 13 +- .../transform/remove_noop_landing_pads.rs | 15 +- src/librustc_mir/transform/rustc_peek.rs | 36 +- src/librustc_mir/transform/simplify.rs | 15 +- .../transform/simplify_branches.rs | 10 +- .../transform/uniform_array_move_out.rs | 20 +- src/librustc_mir/util/alignment.rs | 22 +- src/librustc_mir/util/elaborate_drops.rs | 2 +- src/librustc_mir/util/graphviz.rs | 36 +- src/librustc_passes/rvalue_promotion.rs | 10 +- src/librustc_plugin/build.rs | 5 +- src/librustc_privacy/lib.rs | 59 ++- src/librustc_traits/chalk_context/mod.rs | 11 +- .../chalk_context/program_clauses/builtin.rs | 8 +- .../chalk_context/program_clauses/mod.rs | 4 +- .../program_clauses/primitive.rs | 21 +- src/librustc_traits/generic_types.rs | 2 +- .../implied_outlives_bounds.rs | 4 +- src/librustc_traits/lowering/environment.rs | 5 +- src/librustc_traits/lowering/mod.rs | 15 +- src/librustc_typeck/astconv.rs | 8 +- src/librustc_typeck/check/autoderef.rs | 6 +- src/librustc_typeck/check/compare_method.rs | 92 ++-- src/librustc_typeck/check/intrinsic.rs | 6 +- src/librustc_typeck/check/method/probe.rs | 8 +- src/librustc_typeck/check/method/suggest.rs | 12 +- src/librustc_typeck/check/mod.rs | 130 +++--- src/librustc_typeck/check/wfcheck.rs | 86 ++-- src/librustc_typeck/coherence/builtin.rs | 14 +- .../coherence/inherent_impls.rs | 11 +- .../coherence/inherent_impls_overlap.rs | 5 +- src/librustc_typeck/coherence/mod.rs | 4 +- src/librustc_typeck/collect.rs | 28 +- .../constrained_generic_params.rs | 22 +- src/librustc_typeck/impl_wf_check.rs | 22 +- src/librustc_typeck/lib.rs | 29 +- src/librustc_typeck/variance/mod.rs | 9 +- src/librustc_typeck/variance/terms.rs | 7 +- src/librustc_typeck/variance/test.rs | 2 +- src/test/ui/pattern/const-pat-ice.stderr | 2 +- 176 files changed, 2212 insertions(+), 2132 deletions(-) diff --git a/src/librustc/cfg/construct.rs b/src/librustc/cfg/construct.rs index a7411c9667929..a2e7ebfdb0e4b 100644 --- a/src/librustc/cfg/construct.rs +++ b/src/librustc/cfg/construct.rs @@ -30,8 +30,7 @@ struct LoopScope { break_index: CFGIndex, // where to go on a `break` } -pub fn construct<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - body: &hir::Body) -> CFG { +pub fn construct<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, body: &hir::Body) -> CFG { let mut graph = graph::Graph::new(); let entry = graph.add_node(CFGNodeData::Entry); diff --git a/src/librustc/cfg/mod.rs b/src/librustc/cfg/mod.rs index deb76e057c538..d25d58bfd1fa6 100644 --- a/src/librustc/cfg/mod.rs +++ b/src/librustc/cfg/mod.rs @@ -49,8 +49,7 @@ pub type CFGNode = graph::Node; pub type CFGEdge = graph::Edge; impl CFG { - pub fn new<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - body: &hir::Body) -> CFG { + pub fn new<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, body: &hir::Body) -> CFG { construct::construct(tcx, body) } diff --git a/src/librustc/dep_graph/dep_node.rs b/src/librustc/dep_graph/dep_node.rs index acff8f621ac0a..82bba96dd4cc7 100644 --- a/src/librustc/dep_graph/dep_node.rs +++ b/src/librustc/dep_graph/dep_node.rs @@ -480,7 +480,8 @@ trait DepNodeParams<'gcx: 'tcx, 'tcx>: fmt::Debug { } impl<'gcx: 'tcx, 'tcx, T> DepNodeParams<'gcx, 'tcx> for T - where T: HashStable> + fmt::Debug +where + T: HashStable> + fmt::Debug, { default const CAN_RECONSTRUCT_QUERY_KEY: bool = false; diff --git a/src/librustc/dep_graph/graph.rs b/src/librustc/dep_graph/graph.rs index d15980dcbe6d6..40ccd6e7b280a 100644 --- a/src/librustc/dep_graph/graph.rs +++ b/src/librustc/dep_graph/graph.rs @@ -90,7 +90,6 @@ where } impl DepGraph { - pub fn new(prev_graph: PreviousDepGraph, prev_work_products: FxHashMap) -> DepGraph { let prev_graph_node_count = prev_graph.node_count(); @@ -559,7 +558,7 @@ impl DepGraph { pub fn try_mark_green_and_read( &self, tcx: TyCtxt<'_, '_>, - dep_node: &DepNode + dep_node: &DepNode, ) -> Option<(SerializedDepNodeIndex, DepNodeIndex)> { self.try_mark_green(tcx, dep_node).map(|(prev_index, dep_node_index)| { debug_assert!(self.is_green(&dep_node)); @@ -571,7 +570,7 @@ impl DepGraph { pub fn try_mark_green( &self, tcx: TyCtxt<'_, '_>, - dep_node: &DepNode + dep_node: &DepNode, ) -> Option<(SerializedDepNodeIndex, DepNodeIndex)> { debug_assert!(!dep_node.kind.is_eval_always()); @@ -607,7 +606,7 @@ impl DepGraph { tcx: TyCtxt<'tcx, 'tcx>, data: &DepGraphData, prev_dep_node_index: SerializedDepNodeIndex, - dep_node: &DepNode + dep_node: &DepNode, ) -> Option { debug!("try_mark_previous_green({:?}) - BEGIN", dep_node); diff --git a/src/librustc/dep_graph/safe.rs b/src/librustc/dep_graph/safe.rs index 86cba3a4580ba..62667c957cdc0 100644 --- a/src/librustc/dep_graph/safe.rs +++ b/src/librustc/dep_graph/safe.rs @@ -33,8 +33,7 @@ impl DepGraphSafe for DefId { /// The type context itself can be used to access all kinds of tracked /// state, but those accesses should always generate read events. -impl<'gcx, 'tcx> DepGraphSafe for TyCtxt<'gcx, 'tcx> { -} +impl<'gcx, 'tcx> DepGraphSafe for TyCtxt<'gcx, 'tcx> {} /// Tuples make it easy to build up state. impl DepGraphSafe for (A, B) diff --git a/src/librustc/infer/canonical/substitute.rs b/src/librustc/infer/canonical/substitute.rs index 0dace4132b808..d1310771fb353 100644 --- a/src/librustc/infer/canonical/substitute.rs +++ b/src/librustc/infer/canonical/substitute.rs @@ -14,11 +14,7 @@ use crate::ty::{self, TyCtxt}; impl<'tcx, V> Canonical<'tcx, V> { /// Instantiate the wrapped value, replacing each canonical value /// with the value given in `var_values`. - pub fn substitute( - &self, - tcx: TyCtxt<'_, 'tcx>, - var_values: &CanonicalVarValues<'tcx>, - ) -> V + pub fn substitute(&self, tcx: TyCtxt<'_, 'tcx>, var_values: &CanonicalVarValues<'tcx>) -> V where V: TypeFoldable<'tcx>, { diff --git a/src/librustc/infer/combine.rs b/src/librustc/infer/combine.rs index 21d4f3bf51197..d886efd33915f 100644 --- a/src/librustc/infer/combine.rs +++ b/src/librustc/infer/combine.rs @@ -58,12 +58,14 @@ pub enum RelationDir { } impl<'infcx, 'gcx, 'tcx> InferCtxt<'infcx, 'gcx, 'tcx> { - pub fn super_combine_tys(&self, - relation: &mut R, - a: Ty<'tcx>, - b: Ty<'tcx>) - -> RelateResult<'tcx, Ty<'tcx>> - where R: TypeRelation<'gcx, 'tcx> + pub fn super_combine_tys( + &self, + relation: &mut R, + a: Ty<'tcx>, + b: Ty<'tcx>, + ) -> RelateResult<'tcx, Ty<'tcx>> + where + R: TypeRelation<'gcx, 'tcx>, { let a_is_expected = relation.a_is_expected(); diff --git a/src/librustc/infer/error_reporting/nice_region_error/placeholder_error.rs b/src/librustc/infer/error_reporting/nice_region_error/placeholder_error.rs index 43a5e4a0d0e77..8631236c0e36e 100644 --- a/src/librustc/infer/error_reporting/nice_region_error/placeholder_error.rs +++ b/src/librustc/infer/error_reporting/nice_region_error/placeholder_error.rs @@ -338,7 +338,10 @@ impl NiceRegionError<'me, 'gcx, 'tcx> { } impl<'gcx, 'tcx, T> fmt::Display for Highlighted<'gcx, 'tcx, T> - where T: for<'a, 'b, 'c> Print<'gcx, 'tcx, + where + T: for<'a, 'b, 'c> Print< + 'gcx, + 'tcx, FmtPrinter<'a, 'gcx, 'tcx, &'b mut fmt::Formatter<'c>>, Error = fmt::Error, >, diff --git a/src/librustc/infer/lattice.rs b/src/librustc/infer/lattice.rs index 6f76ee9e26dc9..236ebc19340bb 100644 --- a/src/librustc/infer/lattice.rs +++ b/src/librustc/infer/lattice.rs @@ -27,7 +27,7 @@ use crate::ty::TyVar; use crate::ty::{self, Ty}; use crate::ty::relate::{RelateResult, TypeRelation}; -pub trait LatticeDir<'f, 'gcx: 'f+'tcx, 'tcx: 'f> : TypeRelation<'gcx, 'tcx> { +pub trait LatticeDir<'f, 'gcx: 'f + 'tcx, 'tcx: 'f>: TypeRelation<'gcx, 'tcx> { fn infcx(&self) -> &'f InferCtxt<'f, 'gcx, 'tcx>; fn cause(&self) -> &ObligationCause<'tcx>; diff --git a/src/librustc/infer/outlives/free_region_map.rs b/src/librustc/infer/outlives/free_region_map.rs index 2a5558a4a66fd..c2ae561fcd39f 100644 --- a/src/librustc/infer/outlives/free_region_map.rs +++ b/src/librustc/infer/outlives/free_region_map.rs @@ -28,11 +28,12 @@ impl<'tcx> FreeRegionMap<'tcx> { /// cases, this is more conservative than necessary, in order to /// avoid making arbitrary choices. See /// `TransitiveRelation::postdom_upper_bound` for more details. - pub fn lub_free_regions<'gcx>(&self, - tcx: TyCtxt<'gcx, 'tcx>, - r_a: Region<'tcx>, - r_b: Region<'tcx>) - -> Region<'tcx> { + pub fn lub_free_regions<'gcx>( + &self, + tcx: TyCtxt<'gcx, 'tcx>, + r_a: Region<'tcx>, + r_b: Region<'tcx>, + ) -> Region<'tcx> { debug!("lub_free_regions(r_a={:?}, r_b={:?})", r_a, r_b); assert!(is_free(r_a)); assert!(is_free(r_b)); diff --git a/src/librustc/lint/context.rs b/src/librustc/lint/context.rs index a35ed7e862712..c6a77a314be6a 100644 --- a/src/librustc/lint/context.rs +++ b/src/librustc/lint/context.rs @@ -1423,10 +1423,7 @@ pub fn late_lint_mod<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>( } } -fn late_lint_pass_crate<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>( - tcx: TyCtxt<'tcx, 'tcx>, - pass: T -) { +fn late_lint_pass_crate<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>(tcx: TyCtxt<'tcx, 'tcx>, pass: T) { let access_levels = &tcx.privacy_access_levels(LOCAL_CRATE); let krate = tcx.hir().krate(); @@ -1461,7 +1458,7 @@ fn late_lint_pass_crate<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>( fn late_lint_crate<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>( tcx: TyCtxt<'tcx, 'tcx>, - builtin_lints: T + builtin_lints: T, ) { let mut passes = tcx.sess.lint_store.borrow().late_passes.lock().take().unwrap(); diff --git a/src/librustc/lint/mod.rs b/src/librustc/lint/mod.rs index d8f21ced2559d..5a17eee173d5a 100644 --- a/src/librustc/lint/mod.rs +++ b/src/librustc/lint/mod.rs @@ -766,9 +766,7 @@ pub fn maybe_lint_level_root(tcx: TyCtxt<'_, '_>, id: hir::HirId) -> bool { attrs.iter().any(|attr| Level::from_symbol(attr.name_or_empty()).is_some()) } -fn lint_levels<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, cnum: CrateNum) - -> &'tcx LintLevelMap -{ +fn lint_levels<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, cnum: CrateNum) -> &'tcx LintLevelMap { assert_eq!(cnum, LOCAL_CRATE); let mut builder = LintLevelMapBuilder { levels: LintLevelSets::builder(tcx.sess), diff --git a/src/librustc/middle/cstore.rs b/src/librustc/middle/cstore.rs index 2e490931525a3..f258f06b87dcc 100644 --- a/src/librustc/middle/cstore.rs +++ b/src/librustc/middle/cstore.rs @@ -211,9 +211,7 @@ pub trait CrateStore { fn crates_untracked(&self) -> Vec; // utility functions - fn encode_metadata<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx>) - -> EncodedMetadata; + fn encode_metadata<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx>) -> EncodedMetadata; fn metadata_encoding_version(&self) -> &[u8]; } @@ -228,9 +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 9bd80bf3f8b87..18e19e802e889 100644 --- a/src/librustc/middle/dead.rs +++ b/src/librustc/middle/dead.rs @@ -26,8 +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, 'tcx>, hir_id: hir::HirId) -> bool { match tcx.hir().find_by_hir_id(hir_id) { Some(Node::Item(..)) | Some(Node::ImplItem(..)) | @@ -302,9 +301,11 @@ impl<'a, 'tcx> Visitor<'tcx> for MarkSymbolVisitor<'a, 'tcx> { } } -fn has_allow_dead_code_or_lang_attr(tcx: TyCtxt<'_, '_>, - id: hir::HirId, - attrs: &[ast::Attribute]) -> bool { +fn has_allow_dead_code_or_lang_attr( + tcx: TyCtxt<'_, '_>, + id: hir::HirId, + attrs: &[ast::Attribute], +) -> bool { if attr::contains_name(attrs, sym::lang) { return true; } @@ -451,10 +452,11 @@ fn create_and_seed_worklist<'tcx>( (life_seeder.worklist, life_seeder.struct_constructors) } -fn find_live<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - access_levels: &privacy::AccessLevels, - krate: &hir::Crate) - -> FxHashSet { +fn find_live<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + access_levels: &privacy::AccessLevels, + krate: &hir::Crate, +) -> FxHashSet { let (worklist, struct_constructors) = create_and_seed_worklist(tcx, access_levels, krate); let mut symbol_visitor = MarkSymbolVisitor { worklist, diff --git a/src/librustc/middle/dependency_format.rs b/src/librustc/middle/dependency_format.rs index faa3ea27d13ff..2f6a3f2f02721 100644 --- a/src/librustc/middle/dependency_format.rs +++ b/src/librustc/middle/dependency_format.rs @@ -92,9 +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, 'tcx>, ty: config::CrateType) -> DependencyList { let sess = &tcx.sess; if !sess.opts.output_types.should_codegen() { @@ -242,10 +240,12 @@ fn calculate_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, ret } -fn add_library(tcx: TyCtxt<'_, '_>, - cnum: CrateNum, - link: LinkagePreference, - m: &mut FxHashMap) { +fn add_library( + tcx: TyCtxt<'_, '_>, + cnum: CrateNum, + link: LinkagePreference, + m: &mut FxHashMap, +) { match m.get(&cnum) { Some(&link2) => { // If the linkages differ, then we'd have two copies of the library diff --git a/src/librustc/middle/exported_symbols.rs b/src/librustc/middle/exported_symbols.rs index bebfb4b768703..9e7af280408bd 100644 --- a/src/librustc/middle/exported_symbols.rs +++ b/src/librustc/middle/exported_symbols.rs @@ -38,9 +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,10 +52,11 @@ impl<'tcx> ExportedSymbol<'tcx> { } } - pub fn compare_stable(&self, - tcx: TyCtxt<'tcx, '_>, - other: &ExportedSymbol<'tcx>) - -> cmp::Ordering { + pub fn compare_stable( + &self, + tcx: TyCtxt<'tcx, '_>, + other: &ExportedSymbol<'tcx>, + ) -> cmp::Ordering { match *self { ExportedSymbol::NonGeneric(self_def_id) => match *other { ExportedSymbol::NonGeneric(other_def_id) => { diff --git a/src/librustc/middle/expr_use_visitor.rs b/src/librustc/middle/expr_use_visitor.rs index e9f435f8991f5..3ed926d758264 100644 --- a/src/librustc/middle/expr_use_visitor.rs +++ b/src/librustc/middle/expr_use_visitor.rs @@ -266,15 +266,15 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx, 'tcx> { /// `None` means that rvalues will be given more conservative lifetimes. /// /// See also `with_infer`, which is used *during* typeck. - pub fn new(delegate: &'a mut (dyn Delegate<'tcx>+'a), - tcx: TyCtxt<'tcx, 'tcx>, - body_owner: DefId, - param_env: ty::ParamEnv<'tcx>, - region_scope_tree: &'a region::ScopeTree, - tables: &'a ty::TypeckTables<'tcx>, - rvalue_promotable_map: Option<&'tcx ItemLocalSet>) - -> Self - { + pub fn new( + delegate: &'a mut (dyn Delegate<'tcx> + 'a), + tcx: TyCtxt<'tcx, 'tcx>, + body_owner: DefId, + param_env: ty::ParamEnv<'tcx>, + region_scope_tree: &'a region::ScopeTree, + tables: &'a ty::TypeckTables<'tcx>, + rvalue_promotable_map: Option<&'tcx ItemLocalSet>, + ) -> Self { ExprUseVisitor { mc: mc::MemCategorizationContext::new(tcx, body_owner, diff --git a/src/librustc/middle/intrinsicck.rs b/src/librustc/middle/intrinsicck.rs index 9746c7ce05c11..d3ed818c4be45 100644 --- a/src/librustc/middle/intrinsicck.rs +++ b/src/librustc/middle/intrinsicck.rs @@ -25,7 +25,7 @@ pub fn provide(providers: &mut Providers<'_>) { } struct ItemVisitor<'tcx> { - tcx: TyCtxt<'tcx, 'tcx> + tcx: TyCtxt<'tcx, 'tcx>, } struct ExprVisitor<'tcx> { @@ -36,9 +36,7 @@ struct ExprVisitor<'tcx> { /// If the type is `Option`, 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, '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/liveness.rs b/src/librustc/middle/liveness.rs index 43b0c64df7837..92cb407f67d7c 100644 --- a/src/librustc/middle/liveness.rs +++ b/src/librustc/middle/liveness.rs @@ -352,12 +352,14 @@ impl IrMaps<'tcx> { } } -fn visit_fn<'a, 'tcx: 'a>(ir: &mut IrMaps<'tcx>, - fk: FnKind<'tcx>, - decl: &'tcx hir::FnDecl, - body_id: hir::BodyId, - sp: Span, - id: hir::HirId) { +fn visit_fn<'a, 'tcx: 'a>( + ir: &mut IrMaps<'tcx>, + fk: FnKind<'tcx>, + decl: &'tcx hir::FnDecl, + body_id: hir::BodyId, + sp: Span, + id: hir::HirId, +) { debug!("visit_fn"); // swap in a new set of IR maps for this function body: diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs index d7e8f1fb71404..4b5b901f4703e 100644 --- a/src/librustc/middle/mem_categorization.rs +++ b/src/librustc/middle/mem_categorization.rs @@ -287,7 +287,7 @@ impl HirNode for hir::Pat { } #[derive(Clone)] -pub struct MemCategorizationContext<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { +pub struct MemCategorizationContext<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { pub tcx: TyCtxt<'gcx, 'tcx>, pub body_owner: DefId, pub upvars: Option<&'tcx FxIndexMap>, @@ -339,8 +339,11 @@ impl MutabilityCategory { ret } - fn from_local(tcx: TyCtxt<'_, '_>, tables: &ty::TypeckTables<'_>, - id: ast::NodeId) -> MutabilityCategory { + fn from_local( + tcx: TyCtxt<'_, '_>, + tables: &ty::TypeckTables<'_>, + id: ast::NodeId, + ) -> MutabilityCategory { let ret = match tcx.hir().get(id) { Node::Binding(p) => match p.node { PatKind::Binding(..) => { @@ -400,12 +403,13 @@ impl MutabilityCategory { } impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx, 'tcx> { - pub fn new(tcx: TyCtxt<'tcx, '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> { + pub fn new( + tcx: TyCtxt<'tcx, '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 { tcx, body_owner, diff --git a/src/librustc/middle/reachable.rs b/src/librustc/middle/reachable.rs index 116ce7525dab5..b0068a191da4c 100644 --- a/src/librustc/middle/reachable.rs +++ b/src/librustc/middle/reachable.rs @@ -27,9 +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, 'tcx>, item: &hir::Item, attrs: CodegenFnAttrs) -> bool { if attrs.requests_inline() { return true } @@ -44,9 +42,11 @@ fn item_might_be_inlined(tcx: TyCtxt<'tcx, 'tcx>, } } -fn method_might_be_inlined<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - impl_item: &hir::ImplItem, - impl_src: DefId) -> bool { +fn method_might_be_inlined<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + impl_item: &hir::ImplItem, + impl_src: DefId, +) -> bool { let codegen_fn_attrs = tcx.codegen_fn_attrs(impl_item.hir_id.owner_def_id()); let generics = tcx.generics_of(tcx.hir().local_def_id_from_hir_id(impl_item.hir_id)); if codegen_fn_attrs.requests_inline() || generics.requires_monomorphization(tcx) { diff --git a/src/librustc/middle/region.rs b/src/librustc/middle/region.rs index 3c99ec391533c..5968933721de6 100644 --- a/src/librustc/middle/region.rs +++ b/src/librustc/middle/region.rs @@ -646,9 +646,11 @@ 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>(&self, tcx: TyCtxt<'gcx, 'tcx>, - br: &ty::EarlyBoundRegion) - -> Scope { + pub fn early_free_scope<'gcx>( + &self, + tcx: TyCtxt<'gcx, 'tcx>, + br: &ty::EarlyBoundRegion, + ) -> Scope { let param_owner = tcx.parent(br.def_id).unwrap(); let param_owner_id = tcx.hir().as_local_hir_id(param_owner).unwrap(); @@ -677,8 +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<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>, fr: &ty::FreeRegion) -> Scope { let param_owner = match fr.bound_region { ty::BoundRegion::BrNamed(def_id, _) => { tcx.parent(def_id).unwrap() @@ -734,9 +735,11 @@ impl<'tcx> ScopeTree { } /// Records the lifetime of a local variable as `cx.var_parent` -fn record_var_lifetime(visitor: &mut RegionResolutionVisitor<'_>, - var_id: hir::ItemLocalId, - _sp: Span) { +fn record_var_lifetime( + visitor: &mut RegionResolutionVisitor<'_>, + var_id: hir::ItemLocalId, + _sp: Span, +) { match visitor.cx.var_parent { None => { // this can happen in extern fn declarations like @@ -977,9 +980,11 @@ fn resolve_expr<'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, expr: &'tcx h visitor.cx = prev_cx; } -fn resolve_local<'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, - pat: Option<&'tcx hir::Pat>, - init: Option<&'tcx hir::Expr>) { +fn resolve_local<'tcx>( + visitor: &mut RegionResolutionVisitor<'tcx>, + pat: Option<&'tcx hir::Pat>, + init: Option<&'tcx hir::Expr>, +) { debug!("resolve_local(pat={:?}, init={:?})", pat, init); let blk_scope = visitor.cx.var_parent.map(|(p, _)| p); @@ -1130,8 +1135,8 @@ fn resolve_local<'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, fn record_rvalue_scope_if_borrow_expr<'tcx>( visitor: &mut RegionResolutionVisitor<'tcx>, expr: &hir::Expr, - blk_id: Option) - { + blk_id: Option, + ) { match expr.node { hir::ExprKind::AddrOf(_, ref subexpr) => { record_rvalue_scope_if_borrow_expr(visitor, &subexpr, blk_id); @@ -1178,9 +1183,11 @@ fn resolve_local<'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, /// | /// /// Note: ET is intended to match "rvalues or places based on rvalues". - fn record_rvalue_scope<'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, - expr: &hir::Expr, - blk_scope: Option) { + fn record_rvalue_scope<'tcx>( + visitor: &mut RegionResolutionVisitor<'tcx>, + expr: &hir::Expr, + blk_scope: Option, + ) { let mut expr = expr; loop { // Note: give all the expressions matching `ET` with the @@ -1327,9 +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, '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 32577e019e0c2..edd5cb4541a96 100644 --- a/src/librustc/middle/resolve_lifetime.rs +++ b/src/librustc/middle/resolve_lifetime.rs @@ -368,10 +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, 'tcx>, for_krate: CrateNum) -> &'tcx ResolveLifetimes { assert_eq!(for_krate, LOCAL_CRATE); let named_region_map = krate(tcx); @@ -1256,9 +1253,7 @@ fn extract_labels(ctxt: &mut LifetimeContext<'_, '_>, body: &hir::Body) { } } -fn compute_object_lifetime_defaults( - tcx: TyCtxt<'_, '_>, -) -> HirIdMap> { +fn compute_object_lifetime_defaults(tcx: TyCtxt<'_, '_>) -> HirIdMap> { let mut map = HirIdMap::default(); for item in tcx.hir().krate().items.values() { match item.node { diff --git a/src/librustc/middle/stability.rs b/src/librustc/middle/stability.rs index 30c4a46271c21..dbd008256b024 100644 --- a/src/librustc/middle/stability.rs +++ b/src/librustc/middle/stability.rs @@ -452,7 +452,7 @@ impl<'tcx> Index<'tcx> { AnnotationKind::Required, |v| intravisit::walk_crate(v, krate)); } - return index + return index; } pub fn local_stability(&self, id: HirId) -> Option<&'tcx Stability> { @@ -924,7 +924,7 @@ fn unnecessary_stable_feature_lint<'tcx>( tcx: TyCtxt<'tcx, 'tcx>, span: Span, feature: Symbol, - since: Symbol + since: Symbol, ) { tcx.lint_hir(lint::builtin::STABLE_FEATURES, hir::CRATE_HIR_ID, diff --git a/src/librustc/mir/interpret/error.rs b/src/librustc/mir/interpret/error.rs index 35ac2ccb28922..009cab3bd0315 100644 --- a/src/librustc/mir/interpret/error.rs +++ b/src/librustc/mir/interpret/error.rs @@ -75,18 +75,15 @@ impl<'tcx> fmt::Display for FrameInfo<'tcx> { } impl<'gcx, 'tcx> ConstEvalErr<'tcx> { - pub fn struct_error(&self, + pub fn struct_error( + &self, tcx: TyCtxtAt<'gcx, 'tcx>, - message: &str) - -> Result, ErrorHandled> - { + message: &str, + ) -> Result, ErrorHandled> { self.struct_generic(tcx, message, None) } - pub fn report_as_error(&self, - tcx: TyCtxtAt<'gcx, 'tcx>, - message: &str - ) -> ErrorHandled { + pub fn report_as_error(&self, tcx: TyCtxtAt<'gcx, 'tcx>, message: &str) -> ErrorHandled { let err = self.struct_error(tcx, message); match err { Ok(mut err) => { @@ -97,7 +94,8 @@ impl<'gcx, 'tcx> ConstEvalErr<'tcx> { } } - pub fn report_as_lint(&self, + pub fn report_as_lint( + &self, tcx: TyCtxtAt<'gcx, 'tcx>, message: &str, lint_root: hir::HirId, @@ -172,10 +170,7 @@ impl<'gcx, 'tcx> ConstEvalErr<'tcx> { } } -pub fn struct_error<'gcx, 'tcx>( - tcx: TyCtxtAt<'gcx, 'tcx>, - msg: &str, -) -> DiagnosticBuilder<'tcx> { +pub fn struct_error<'gcx, 'tcx>(tcx: TyCtxtAt<'gcx, 'tcx>, msg: &str) -> DiagnosticBuilder<'tcx> { struct_span_err!(tcx.sess, tcx.span, E0080, "{}", msg) } diff --git a/src/librustc/mir/interpret/mod.rs b/src/librustc/mir/interpret/mod.rs index 89b2403fa6a03..f68385ec26759 100644 --- a/src/librustc/mir/interpret/mod.rs +++ b/src/librustc/mir/interpret/mod.rs @@ -142,12 +142,10 @@ pub struct AllocDecodingSession<'s> { } impl<'s> AllocDecodingSession<'s> { - // Decodes an AllocId in a thread-safe way. - pub fn decode_alloc_id(&self, - decoder: &mut D) - -> Result - where D: TyDecoder<'tcx>, + pub fn decode_alloc_id(&self, decoder: &mut D) -> Result + where + D: TyDecoder<'tcx>, { // Read the index of the allocation let idx = decoder.read_u32()? as usize; diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs index 90a683b733362..e73023d9a8cc9 100644 --- a/src/librustc/mir/mod.rs +++ b/src/librustc/mir/mod.rs @@ -3158,7 +3158,7 @@ pub enum ClosureOutlivesSubject<'tcx> { /* * TypeFoldable implementations for MIR types - */ +*/ CloneTypeFoldableAndLiftImpls! { BlockTailInfo, diff --git a/src/librustc/mir/mono.rs b/src/librustc/mir/mono.rs index 0b095c2f0de56..cf1126efc0f86 100644 --- a/src/librustc/mir/mono.rs +++ b/src/librustc/mir/mono.rs @@ -87,9 +87,7 @@ impl<'tcx> MonoItem<'tcx> { } } - pub fn instantiation_mode(&self, - tcx: TyCtxt<'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 @@ -195,11 +193,12 @@ impl<'tcx> MonoItem<'tcx> { } }; - fn to_string_internal<'tcx>(tcx: TyCtxt<'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); @@ -369,17 +368,16 @@ impl<'tcx> CodegenUnit<'tcx> { }) } - pub fn items_in_deterministic_order(&self, - tcx: TyCtxt<'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, SymbolName); - fn item_sort_key<'tcx>(tcx: TyCtxt<'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 { diff --git a/src/librustc/mir/tcx.rs b/src/librustc/mir/tcx.rs index 1d5f726567314..76d7d98b90256 100644 --- a/src/librustc/mir/tcx.rs +++ b/src/librustc/mir/tcx.rs @@ -33,8 +33,7 @@ impl<'gcx, 'tcx> PlaceTy<'tcx> { /// not carry a `Ty` for `T`.) /// /// Note that the resulting type has not been normalized. - pub fn field_ty(self, tcx: TyCtxt<'gcx, 'tcx>, f: &Field) -> Ty<'tcx> - { + pub fn field_ty(self, tcx: TyCtxt<'gcx, 'tcx>, f: &Field) -> Ty<'tcx> { let answer = match self.ty.sty { ty::Adt(adt_def, substs) => { let variant_def = match self.variant_index { @@ -57,10 +56,7 @@ impl<'gcx, 'tcx> PlaceTy<'tcx> { /// Convenience wrapper around `projection_ty_core` for /// `PlaceElem`, where we can just use the `Ty` that is already /// stored inline on field projection elems. - pub fn projection_ty(self, tcx: TyCtxt<'gcx, 'tcx>, - elem: &PlaceElem<'tcx>) - -> PlaceTy<'tcx> - { + pub fn projection_ty(self, tcx: TyCtxt<'gcx, 'tcx>, elem: &PlaceElem<'tcx>) -> PlaceTy<'tcx> { self.projection_ty_core(tcx, elem, |_, _, ty| ty) } @@ -73,10 +69,11 @@ impl<'gcx, 'tcx> PlaceTy<'tcx> { self, tcx: TyCtxt<'gcx, 'tcx>, elem: &ProjectionElem, - mut handle_field: impl FnMut(&Self, &Field, &T) -> Ty<'tcx>) - -> PlaceTy<'tcx> + mut handle_field: impl FnMut(&Self, &Field, &T) -> Ty<'tcx>, + ) -> PlaceTy<'tcx> where - V: ::std::fmt::Debug, T: ::std::fmt::Debug + V: ::std::fmt::Debug, + T: ::std::fmt::Debug, { let answer = match *elem { ProjectionElem::Deref => { @@ -122,7 +119,8 @@ BraceStructTypeFoldableImpl! { impl<'tcx> Place<'tcx> { pub fn ty<'gcx, D>(&self, local_decls: &D, tcx: TyCtxt<'gcx, 'tcx>) -> PlaceTy<'tcx> - where D: HasLocalDecls<'tcx> + where + D: HasLocalDecls<'tcx>, { match *self { Place::Base(PlaceBase::Local(index)) => @@ -142,7 +140,8 @@ pub enum RvalueInitializationState { impl<'tcx> Rvalue<'tcx> { pub fn ty<'gcx, D>(&self, local_decls: &D, tcx: TyCtxt<'gcx, 'tcx>) -> Ty<'tcx> - where D: HasLocalDecls<'tcx> + where + D: HasLocalDecls<'tcx>, { match *self { Rvalue::Use(ref operand) => operand.ty(local_decls, tcx), @@ -223,7 +222,8 @@ impl<'tcx> Rvalue<'tcx> { impl<'tcx> Operand<'tcx> { pub fn ty<'gcx, D>(&self, local_decls: &D, tcx: TyCtxt<'gcx, 'tcx>) -> Ty<'tcx> - where D: HasLocalDecls<'tcx> + where + D: HasLocalDecls<'tcx>, { match self { &Operand::Copy(ref l) | @@ -234,10 +234,12 @@ impl<'tcx> Operand<'tcx> { } impl<'tcx> BinOp { - pub fn ty<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>, - lhs_ty: Ty<'tcx>, - rhs_ty: Ty<'tcx>) - -> Ty<'tcx> { + pub fn ty<'gcx>( + &self, + tcx: TyCtxt<'gcx, 'tcx>, + lhs_ty: Ty<'tcx>, + rhs_ty: Ty<'tcx>, + ) -> Ty<'tcx> { // FIXME: handle SIMD correctly match self { &BinOp::Add | &BinOp::Sub | &BinOp::Mul | &BinOp::Div | &BinOp::Rem | diff --git a/src/librustc/traits/codegen/mod.rs b/src/librustc/traits/codegen/mod.rs index 469fd6f97666a..f2c173230765b 100644 --- a/src/librustc/traits/codegen/mod.rs +++ b/src/librustc/traits/codegen/mod.rs @@ -18,11 +18,10 @@ use crate::ty::fold::TypeFoldable; /// that type check should guarantee to us that all nested /// obligations *could be* resolved if we wanted to. /// Assumes that this is run after the entire crate has been successfully type-checked. -pub fn codegen_fulfill_obligation<'tcx>(ty: TyCtxt<'tcx, 'tcx>, - (param_env, trait_ref): - (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>)) - -> Vtable<'tcx, ()> -{ +pub fn codegen_fulfill_obligation<'tcx>( + ty: TyCtxt<'tcx, 'tcx>, + (param_env, trait_ref): (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>), +) -> Vtable<'tcx, ()> { // Remove any references to regions; this helps improve caching. let trait_ref = ty.erase_regions(&trait_ref); diff --git a/src/librustc/traits/coherence.rs b/src/librustc/traits/coherence.rs index 95e96036b4992..83f9796364163 100644 --- a/src/librustc/traits/coherence.rs +++ b/src/librustc/traits/coherence.rs @@ -183,10 +183,10 @@ fn overlap_within_probe( Some(OverlapResult { impl_header, intercrate_ambiguity_causes, involves_placeholder }) } -pub fn trait_ref_is_knowable<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, - trait_ref: ty::TraitRef<'tcx>) - -> Option -{ +pub fn trait_ref_is_knowable<'gcx, 'tcx>( + tcx: TyCtxt<'gcx, 'tcx>, + trait_ref: ty::TraitRef<'tcx>, +) -> Option { debug!("trait_ref_is_knowable(trait_ref={:?})", trait_ref); if orphan_check_trait_ref(tcx, trait_ref, InCrate::Remote).is_ok() { // A downstream or cousin crate is allowed to implement some @@ -229,9 +229,10 @@ pub fn trait_ref_is_knowable<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, } } -pub fn trait_ref_is_local_or_fundamental<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, - trait_ref: ty::TraitRef<'tcx>) - -> bool { +pub fn trait_ref_is_local_or_fundamental<'gcx, 'tcx>( + tcx: TyCtxt<'gcx, 'tcx>, + trait_ref: ty::TraitRef<'tcx>, +) -> bool { trait_ref.def_id.krate == LOCAL_CRATE || tcx.has_attr(trait_ref.def_id, sym::fundamental) } @@ -246,10 +247,10 @@ pub enum OrphanCheckErr<'tcx> { /// /// 1. All type parameters in `Self` must be "covered" by some local type constructor. /// 2. Some local type must appear in `Self`. -pub fn orphan_check<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, - impl_def_id: DefId) - -> Result<(), OrphanCheckErr<'tcx>> -{ +pub fn orphan_check<'gcx, 'tcx>( + tcx: TyCtxt<'gcx, 'tcx>, + impl_def_id: DefId, +) -> Result<(), OrphanCheckErr<'tcx>> { debug!("orphan_check({:?})", impl_def_id); // We only except this routine to be invoked on implementations @@ -353,11 +354,11 @@ pub fn orphan_check<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, /// /// Note that this function is never called for types that have both type /// parameters and inference variables. -fn orphan_check_trait_ref<'tcx>(tcx: TyCtxt<'_, '_>, - trait_ref: ty::TraitRef<'tcx>, - in_crate: InCrate) - -> Result<(), OrphanCheckErr<'tcx>> -{ +fn orphan_check_trait_ref<'tcx>( + tcx: TyCtxt<'_, '_>, + trait_ref: ty::TraitRef<'tcx>, + in_crate: InCrate, +) -> Result<(), OrphanCheckErr<'tcx>> { debug!("orphan_check_trait_ref(trait_ref={:?}, in_crate={:?})", trait_ref, in_crate); @@ -430,8 +431,7 @@ fn orphan_check_trait_ref<'tcx>(tcx: TyCtxt<'_, '_>, } } -fn uncovered_tys<'tcx>(tcx: TyCtxt<'_, '_>, ty: Ty<'tcx>, in_crate: InCrate) - -> Vec> { +fn uncovered_tys<'tcx>(tcx: TyCtxt<'_, '_>, ty: Ty<'tcx>, in_crate: InCrate) -> Vec> { if ty_is_local_constructor(ty, in_crate) { vec![] } else if fundamental_ty(ty) { diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs index 50eac8f069058..1fb325ae05669 100644 --- a/src/librustc/traits/error_reporting.rs +++ b/src/librustc/traits/error_reporting.rs @@ -1242,15 +1242,17 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { err } - fn report_closure_arg_mismatch(&self, - span: Span, - found_span: Option, - expected_ref: ty::PolyTraitRef<'tcx>, - found: ty::PolyTraitRef<'tcx>) - -> DiagnosticBuilder<'tcx> - { - fn build_fn_sig_string<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, - trait_ref: &ty::TraitRef<'tcx>) -> String { + fn report_closure_arg_mismatch( + &self, + span: Span, + found_span: Option, + expected_ref: ty::PolyTraitRef<'tcx>, + found: ty::PolyTraitRef<'tcx>, + ) -> DiagnosticBuilder<'tcx> { + fn build_fn_sig_string<'gcx, 'tcx>( + tcx: TyCtxt<'gcx, 'tcx>, + trait_ref: &ty::TraitRef<'tcx>, + ) -> String { let inputs = trait_ref.substs.type_at(1); let sig = if let ty::Tuple(inputs) = inputs.sty { tcx.mk_fn_sig( @@ -1447,10 +1449,11 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { /// Returns `true` if the trait predicate may apply for *some* assignment /// to the type parameters. - fn predicate_can_apply(&self, - param_env: ty::ParamEnv<'tcx>, - pred: ty::PolyTraitRef<'tcx>) - -> bool { + fn predicate_can_apply( + &self, + param_env: ty::ParamEnv<'tcx>, + pred: ty::PolyTraitRef<'tcx>, + ) -> bool { struct ParamToVarFolder<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { infcx: &'a InferCtxt<'a, 'gcx, 'tcx>, var_map: FxHashMap, Ty<'tcx>> diff --git a/src/librustc/traits/mod.rs b/src/librustc/traits/mod.rs index b478824129909..01be8de172c26 100644 --- a/src/librustc/traits/mod.rs +++ b/src/librustc/traits/mod.rs @@ -710,13 +710,13 @@ pub fn type_known_to_meet_bound_modulo_regions<'a, 'gcx, 'tcx>( } } -fn do_normalize_predicates<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - region_context: DefId, - cause: ObligationCause<'tcx>, - elaborated_env: ty::ParamEnv<'tcx>, - predicates: Vec>) - -> Result>, ErrorReported> -{ +fn do_normalize_predicates<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + region_context: DefId, + cause: ObligationCause<'tcx>, + elaborated_env: ty::ParamEnv<'tcx>, + predicates: Vec>, +) -> Result>, ErrorReported> { debug!( "do_normalize_predicates(predicates={:?}, region_context={:?}, cause={:?})", predicates, @@ -795,12 +795,12 @@ fn do_normalize_predicates<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, // FIXME: this is gonna need to be removed ... /// Normalizes the parameter environment, reporting errors if they occur. -pub fn normalize_param_env_or_error<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - region_context: DefId, - unnormalized_env: ty::ParamEnv<'tcx>, - cause: ObligationCause<'tcx>) - -> ty::ParamEnv<'tcx> -{ +pub fn normalize_param_env_or_error<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + region_context: DefId, + unnormalized_env: ty::ParamEnv<'tcx>, + cause: ObligationCause<'tcx>, +) -> ty::ParamEnv<'tcx> { // I'm not wild about reporting errors here; I'd prefer to // have the errors get reported at a defined place (e.g., // during typeck). Instead I have all parameter @@ -936,10 +936,10 @@ pub fn fully_normalize<'a, 'gcx, 'tcx, T>( /// environment. If this returns false, then either normalize /// encountered an error or one of the predicates did not hold. Used /// when creating vtables to check for unsatisfiable methods. -fn normalize_and_test_predicates<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - predicates: Vec>) - -> bool -{ +fn normalize_and_test_predicates<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + predicates: Vec>, +) -> bool { debug!("normalize_and_test_predicates(predicates={:?})", predicates); @@ -965,10 +965,10 @@ fn normalize_and_test_predicates<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, result } -fn substitute_normalize_and_test_predicates<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - key: (DefId, SubstsRef<'tcx>)) - -> bool -{ +fn substitute_normalize_and_test_predicates<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + key: (DefId, SubstsRef<'tcx>), +) -> bool { debug!("substitute_normalize_and_test_predicates(key={:?})", key); @@ -985,9 +985,8 @@ fn substitute_normalize_and_test_predicates<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, #[inline] // FIXME(#35870): avoid closures being unexported due to `impl Trait`. fn vtable_methods<'tcx>( tcx: TyCtxt<'tcx, 'tcx>, - trait_ref: ty::PolyTraitRef<'tcx>) - -> &'tcx [Option<(DefId, SubstsRef<'tcx>)>] -{ + trait_ref: ty::PolyTraitRef<'tcx>, +) -> &'tcx [Option<(DefId, SubstsRef<'tcx>)>] { debug!("vtable_methods({:?})", trait_ref); tcx.arena.alloc_from_iter( diff --git a/src/librustc/traits/object_safety.rs b/src/librustc/traits/object_safety.rs index 88961c1dc81f1..01b81b182af96 100644 --- a/src/librustc/traits/object_safety.rs +++ b/src/librustc/traits/object_safety.rs @@ -84,7 +84,6 @@ pub enum MethodViolationCode { } impl<'tcx> TyCtxt<'tcx, 'tcx> { - /// Returns the object safety violations that affect /// astconv -- currently, `Self` in supertraits. This is needed /// because `object_safety_violations` can't be used during @@ -703,7 +702,6 @@ impl<'tcx> TyCtxt<'tcx, 'tcx> { } } -pub(super) fn is_object_safe_provider<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - trait_def_id: DefId) -> bool { +pub(super) fn is_object_safe_provider<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, trait_def_id: DefId) -> bool { tcx.object_safety_violations(trait_def_id).is_empty() } diff --git a/src/librustc/traits/on_unimplemented.rs b/src/librustc/traits/on_unimplemented.rs index 85af5efb42413..fe190db5fdbee 100644 --- a/src/librustc/traits/on_unimplemented.rs +++ b/src/librustc/traits/on_unimplemented.rs @@ -35,12 +35,13 @@ impl OnUnimplementedNote { } } -fn parse_error(tcx: TyCtxt<'_, '_>, span: Span, - message: &str, - label: &str, - note: Option<&str>) - -> ErrorReported -{ +fn parse_error( + tcx: TyCtxt<'_, '_>, + span: Span, + message: &str, + label: &str, + note: Option<&str>, +) -> ErrorReported { let mut diag = struct_span_err!( tcx.sess, span, E0232, "{}", message); diag.span_label(span, label); @@ -52,13 +53,13 @@ fn parse_error(tcx: TyCtxt<'_, '_>, span: Span, } impl<'gcx, 'tcx> OnUnimplementedDirective { - fn parse(tcx: TyCtxt<'gcx, 'tcx>, - trait_def_id: DefId, - items: &[NestedMetaItem], - span: Span, - is_root: bool) - -> Result - { + fn parse( + tcx: TyCtxt<'gcx, 'tcx>, + trait_def_id: DefId, + items: &[NestedMetaItem], + span: Span, + is_root: bool, + ) -> Result { let mut errored = false; let mut item_iter = items.iter(); @@ -132,12 +133,11 @@ impl<'gcx, 'tcx> OnUnimplementedDirective { } } - - pub fn of_item(tcx: TyCtxt<'gcx, 'tcx>, - trait_def_id: DefId, - impl_def_id: DefId) - -> Result, ErrorReported> - { + pub fn of_item( + tcx: TyCtxt<'gcx, 'tcx>, + trait_def_id: DefId, + impl_def_id: DefId, + ) -> Result, ErrorReported> { let attrs = tcx.get_attrs(impl_def_id); let attr = if let Some(item) = attr::find_by_name(&attrs, sym::rustc_on_unimplemented) { @@ -164,12 +164,12 @@ impl<'gcx, 'tcx> OnUnimplementedDirective { result } - pub fn evaluate(&self, - tcx: TyCtxt<'gcx, 'tcx>, - trait_ref: ty::TraitRef<'tcx>, - options: &[(Symbol, Option)]) - -> OnUnimplementedNote - { + pub fn evaluate( + &self, + tcx: TyCtxt<'gcx, 'tcx>, + trait_ref: ty::TraitRef<'tcx>, + options: &[(Symbol, Option)], + ) -> OnUnimplementedNote { let mut message = None; let mut label = None; let mut note = None; @@ -215,12 +215,12 @@ impl<'gcx, 'tcx> OnUnimplementedDirective { } impl<'gcx, 'tcx> OnUnimplementedFormatString { - fn try_parse(tcx: TyCtxt<'gcx, 'tcx>, - trait_def_id: DefId, - from: LocalInternedString, - err_sp: Span) - -> Result - { + fn try_parse( + tcx: TyCtxt<'gcx, 'tcx>, + trait_def_id: DefId, + from: LocalInternedString, + err_sp: Span, + ) -> Result { let result = OnUnimplementedFormatString(from); result.verify(tcx, trait_def_id, err_sp)?; Ok(result) diff --git a/src/librustc/traits/query/dropck_outlives.rs b/src/librustc/traits/query/dropck_outlives.rs index e2cb5cb89d98a..90df5ed10d78f 100644 --- a/src/librustc/traits/query/dropck_outlives.rs +++ b/src/librustc/traits/query/dropck_outlives.rs @@ -85,12 +85,7 @@ pub struct DropckOutlivesResult<'tcx> { } impl<'tcx> DropckOutlivesResult<'tcx> { - pub fn report_overflows( - &self, - tcx: TyCtxt<'_, 'tcx>, - span: Span, - ty: Ty<'tcx>, - ) { + pub fn report_overflows(&self, tcx: TyCtxt<'_, 'tcx>, span: Span, ty: Ty<'tcx>) { if let Some(overflow_ty) = self.overflows.iter().next() { let mut err = struct_span_err!( tcx.sess, diff --git a/src/librustc/traits/specialize/mod.rs b/src/librustc/traits/specialize/mod.rs index d395f7199fb2c..27891bed2b76e 100644 --- a/src/librustc/traits/specialize/mod.rs +++ b/src/librustc/traits/specialize/mod.rs @@ -149,10 +149,10 @@ pub fn find_associated_item<'tcx>( /// Specialization is determined by the sets of types to which the impls apply; /// `impl1` specializes `impl2` if it applies to a subset of the types `impl2` applies /// to. -pub(super) fn specializes<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - (impl1_def_id, impl2_def_id): (DefId, DefId)) - -> bool -{ +pub(super) fn specializes<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + (impl1_def_id, impl2_def_id): (DefId, DefId), +) -> bool { debug!("specializes({:?}, {:?})", impl1_def_id, impl2_def_id); // The feature gate should prevent introducing new specializations, but not diff --git a/src/librustc/traits/specialize/specialization_graph.rs b/src/librustc/traits/specialize/specialization_graph.rs index 89116fac7303b..2e86d40a3ad54 100644 --- a/src/librustc/traits/specialize/specialization_graph.rs +++ b/src/librustc/traits/specialize/specialization_graph.rs @@ -83,9 +83,7 @@ enum Inserted { impl<'gcx, 'tcx> Children { /// Insert an impl into this set of children without comparing to any existing impls. - fn insert_blindly(&mut self, - tcx: TyCtxt<'gcx, 'tcx>, - impl_def_id: DefId) { + fn insert_blindly(&mut self, tcx: TyCtxt<'gcx, 'tcx>, impl_def_id: DefId) { let trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap(); if let Some(sty) = fast_reject::simplify_type(tcx, trait_ref.self_ty(), false) { debug!("insert_blindly: impl_def_id={:?} sty={:?}", impl_def_id, sty); @@ -99,9 +97,7 @@ impl<'gcx, 'tcx> Children { /// Removes an impl from this set of children. Used when replacing /// an impl with a parent. The impl must be present in the list of /// children already. - fn remove_existing(&mut self, - tcx: TyCtxt<'gcx, 'tcx>, - impl_def_id: DefId) { + fn remove_existing(&mut self, tcx: TyCtxt<'gcx, 'tcx>, impl_def_id: DefId) { let trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap(); let vec: &mut Vec; if let Some(sty) = fast_reject::simplify_type(tcx, trait_ref.self_ty(), false) { @@ -118,12 +114,12 @@ impl<'gcx, 'tcx> Children { /// Attempt to insert an impl into this set of children, while comparing for /// specialization relationships. - fn insert(&mut self, - tcx: TyCtxt<'gcx, 'tcx>, - impl_def_id: DefId, - simplified_self: Option) - -> Result - { + fn insert( + &mut self, + tcx: TyCtxt<'gcx, 'tcx>, + impl_def_id: DefId, + simplified_self: Option, + ) -> Result { let mut last_lint = None; let mut replace_children = Vec::new(); @@ -293,10 +289,11 @@ impl<'gcx, 'tcx> Graph { /// Insert a local impl into the specialization graph. If an existing impl /// conflicts with it (has overlap, but neither specializes the other), /// information about the area of overlap is returned in the `Err`. - pub fn insert(&mut self, - tcx: TyCtxt<'gcx, 'tcx>, - impl_def_id: DefId) - -> Result, OverlapError> { + pub fn insert( + &mut self, + tcx: TyCtxt<'gcx, 'tcx>, + impl_def_id: DefId, + ) -> Result, OverlapError> { assert!(impl_def_id.is_local()); let trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap(); @@ -386,10 +383,12 @@ impl<'gcx, 'tcx> Graph { } /// Insert cached metadata mapping from a child impl back to its parent. - pub fn record_impl_from_cstore(&mut self, - tcx: TyCtxt<'gcx, 'tcx>, - parent: DefId, - child: DefId) { + pub fn record_impl_from_cstore( + &mut self, + tcx: TyCtxt<'gcx, 'tcx>, + parent: DefId, + child: DefId, + ) { if self.parent.insert(child, parent).is_some() { bug!("When recording an impl from the crate store, information about its parent \ was already present."); @@ -423,10 +422,7 @@ impl<'gcx, 'tcx> Node { } /// Iterate over the items defined directly by the given (impl or trait) node. - pub fn items( - &self, - tcx: TyCtxt<'gcx, 'tcx>, - ) -> ty::AssocItemsIterator<'gcx, 'tcx> { + pub fn items(&self, tcx: TyCtxt<'gcx, 'tcx>) -> ty::AssocItemsIterator<'gcx, 'tcx> { tcx.associated_items(self.def_id()) } @@ -508,10 +504,11 @@ impl<'gcx, 'tcx> Ancestors<'gcx> { /// Walk up the specialization ancestors of a given impl, starting with that /// impl itself. -pub fn ancestors(tcx: TyCtxt<'tcx, '_>, - trait_def_id: DefId, - start_from_impl: DefId) - -> Ancestors<'tcx> { +pub fn ancestors( + tcx: TyCtxt<'tcx, '_>, + trait_def_id: DefId, + start_from_impl: DefId, +) -> Ancestors<'tcx> { let specialization_graph = tcx.specialization_graph_of(trait_def_id); Ancestors { trait_def_id, diff --git a/src/librustc/traits/util.rs b/src/librustc/traits/util.rs index ef4f6472c87ec..c5ff174e94436 100644 --- a/src/librustc/traits/util.rs +++ b/src/librustc/traits/util.rs @@ -12,9 +12,10 @@ use crate::util::nodemap::FxHashSet; use super::{Obligation, ObligationCause, PredicateObligation, SelectionContext, Normalized}; -fn anonymize_predicate<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, - pred: &ty::Predicate<'tcx>) - -> ty::Predicate<'tcx> { +fn anonymize_predicate<'gcx, 'tcx>( + tcx: TyCtxt<'gcx, 'tcx>, + pred: &ty::Predicate<'tcx>, +) -> ty::Predicate<'tcx> { match *pred { ty::Predicate::Trait(ref data) => ty::Predicate::Trait(tcx.anonymize_late_bound_regions(data)), @@ -95,26 +96,23 @@ pub struct Elaborator<'gcx, 'tcx> { pub fn elaborate_trait_ref<'gcx, 'tcx>( tcx: TyCtxt<'gcx, 'tcx>, - trait_ref: ty::PolyTraitRef<'tcx>) - -> Elaborator<'gcx, 'tcx> -{ + trait_ref: ty::PolyTraitRef<'tcx>, +) -> Elaborator<'gcx, 'tcx> { elaborate_predicates(tcx, vec![trait_ref.to_predicate()]) } pub fn elaborate_trait_refs<'gcx, 'tcx>( tcx: TyCtxt<'gcx, 'tcx>, - trait_refs: impl Iterator>) - -> Elaborator<'gcx, 'tcx> -{ + trait_refs: impl Iterator>, +) -> Elaborator<'gcx, 'tcx> { let predicates = trait_refs.map(|trait_ref| trait_ref.to_predicate()).collect(); elaborate_predicates(tcx, predicates) } pub fn elaborate_predicates<'gcx, 'tcx>( tcx: TyCtxt<'gcx, 'tcx>, - mut predicates: Vec>) - -> Elaborator<'gcx, 'tcx> -{ + mut predicates: Vec>, +) -> Elaborator<'gcx, 'tcx> { let mut visited = PredicateSet::new(tcx); predicates.retain(|pred| visited.insert(pred)); Elaborator { stack: predicates, visited } @@ -256,15 +254,17 @@ impl Iterator for Elaborator<'gcx, 'tcx> { pub type Supertraits<'gcx, 'tcx> = FilterToTraits>; -pub fn supertraits<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, - trait_ref: ty::PolyTraitRef<'tcx>) - -> Supertraits<'gcx, 'tcx> { +pub fn supertraits<'gcx, 'tcx>( + tcx: TyCtxt<'gcx, 'tcx>, + trait_ref: ty::PolyTraitRef<'tcx>, +) -> Supertraits<'gcx, 'tcx> { elaborate_trait_ref(tcx, trait_ref).filter_to_traits() } -pub fn transitive_bounds<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, - bounds: impl Iterator>) - -> Supertraits<'gcx, 'tcx> { +pub fn transitive_bounds<'gcx, 'tcx>( + tcx: TyCtxt<'gcx, 'tcx>, + bounds: impl Iterator>, +) -> Supertraits<'gcx, 'tcx> { elaborate_trait_refs(tcx, bounds).filter_to_traits() } @@ -339,7 +339,7 @@ impl<'tcx> TraitAliasExpansionInfo<'tcx> { pub fn expand_trait_aliases<'gcx, 'tcx>( tcx: TyCtxt<'gcx, 'tcx>, - trait_refs: impl IntoIterator, Span)> + trait_refs: impl IntoIterator, Span)>, ) -> TraitAliasExpander<'gcx, 'tcx> { let items: Vec<_> = trait_refs .into_iter() @@ -420,10 +420,10 @@ pub struct SupertraitDefIds<'gcx, 'tcx> { visited: FxHashSet, } -pub fn supertrait_def_ids<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, - trait_def_id: DefId) - -> SupertraitDefIds<'gcx, 'tcx> -{ +pub fn supertrait_def_ids<'gcx, 'tcx>( + tcx: TyCtxt<'gcx, 'tcx>, + trait_def_id: DefId, +) -> SupertraitDefIds<'gcx, 'tcx> { SupertraitDefIds { tcx, stack: vec![trait_def_id], diff --git a/src/librustc/ty/_match.rs b/src/librustc/ty/_match.rs index 38a85c21963ce..213f556f9acac 100644 --- a/src/librustc/ty/_match.rs +++ b/src/librustc/ty/_match.rs @@ -20,7 +20,7 @@ use crate::mir::interpret::ConstValue; /// important thing about the result is Ok/Err. Also, matching never /// affects any type variables or unification state. pub struct Match<'gcx, 'tcx> { - tcx: TyCtxt<'gcx, 'tcx> + tcx: TyCtxt<'gcx, 'tcx>, } impl Match<'gcx, 'tcx> { diff --git a/src/librustc/ty/adjustment.rs b/src/librustc/ty/adjustment.rs index d5fe106085160..e1f86bee4babb 100644 --- a/src/librustc/ty/adjustment.rs +++ b/src/librustc/ty/adjustment.rs @@ -104,8 +104,11 @@ pub struct OverloadedDeref<'tcx> { } impl<'gcx, 'tcx> OverloadedDeref<'tcx> { - pub fn method_call(&self, tcx: TyCtxt<'gcx, 'tcx>, source: Ty<'tcx>) - -> (DefId, SubstsRef<'tcx>) { + pub fn method_call( + &self, + tcx: TyCtxt<'gcx, 'tcx>, + source: Ty<'tcx>, + ) -> (DefId, SubstsRef<'tcx>) { let trait_def_id = match self.mutbl { hir::MutImmutable => tcx.lang_items().deref_trait(), hir::MutMutable => tcx.lang_items().deref_mut_trait() diff --git a/src/librustc/ty/codec.rs b/src/librustc/ty/codec.rs index 7f89b2ccfdb5b..ea5d088d540fd 100644 --- a/src/librustc/ty/codec.rs +++ b/src/librustc/ty/codec.rs @@ -132,25 +132,28 @@ pub trait TyDecoder<'tcx>: Decoder { #[inline] pub fn decode_arena_allocable( - decoder: &mut D + decoder: &mut D, ) -> Result<&'tcx T, D::Error> - where D: TyDecoder<'tcx>, +where + D: TyDecoder<'tcx>, { Ok(decoder.tcx().arena.alloc(Decodable::decode(decoder)?)) } #[inline] pub fn decode_arena_allocable_slice( - decoder: &mut D + decoder: &mut D, ) -> Result<&'tcx [T], D::Error> - where D: TyDecoder<'tcx>, +where + D: TyDecoder<'tcx>, { Ok(decoder.tcx().arena.alloc_from_iter( as Decodable>::decode(decoder)?)) } #[inline] pub fn decode_cnum(decoder: &mut D) -> Result - where D: TyDecoder<'tcx>, +where + D: TyDecoder<'tcx>, { let cnum = CrateNum::from_u32(u32::decode(decoder)?); Ok(decoder.map_encoded_cnum_to_current(cnum)) @@ -158,7 +161,8 @@ pub fn decode_cnum(decoder: &mut D) -> Result #[inline] pub fn decode_ty(decoder: &mut D) -> Result, D::Error> - where D: TyDecoder<'tcx>, +where + D: TyDecoder<'tcx>, { // Handle shorthands first, if we have an usize > 0x80. if decoder.positioned_at_shorthand() { @@ -176,9 +180,9 @@ pub fn decode_ty(decoder: &mut D) -> Result, D::Error> } #[inline] -pub fn decode_predicates(decoder: &mut D) - -> Result, D::Error> - where D: TyDecoder<'tcx>, +pub fn decode_predicates(decoder: &mut D) -> Result, D::Error> +where + D: TyDecoder<'tcx>, { Ok(ty::GenericPredicates { parent: Decodable::decode(decoder)?, @@ -201,7 +205,8 @@ pub fn decode_predicates(decoder: &mut D) #[inline] pub fn decode_substs(decoder: &mut D) -> Result, D::Error> - where D: TyDecoder<'tcx>, +where + D: TyDecoder<'tcx>, { let len = decoder.read_usize()?; let tcx = decoder.tcx(); @@ -210,33 +215,36 @@ pub fn decode_substs(decoder: &mut D) -> Result, D::Error> #[inline] pub fn decode_region(decoder: &mut D) -> Result, D::Error> - where D: TyDecoder<'tcx>, +where + D: TyDecoder<'tcx>, { Ok(decoder.tcx().mk_region(Decodable::decode(decoder)?)) } #[inline] -pub fn decode_ty_slice(decoder: &mut D) - -> Result<&'tcx ty::List>, D::Error> - where D: TyDecoder<'tcx>, +pub fn decode_ty_slice(decoder: &mut D) -> Result<&'tcx ty::List>, D::Error> +where + D: TyDecoder<'tcx>, { let len = decoder.read_usize()?; Ok(decoder.tcx().mk_type_list((0..len).map(|_| Decodable::decode(decoder)))?) } #[inline] -pub fn decode_adt_def(decoder: &mut D) - -> Result<&'tcx ty::AdtDef, D::Error> - where D: TyDecoder<'tcx>, +pub fn decode_adt_def(decoder: &mut D) -> Result<&'tcx ty::AdtDef, D::Error> +where + D: TyDecoder<'tcx>, { let def_id = DefId::decode(decoder)?; Ok(decoder.tcx().adt_def(def_id)) } #[inline] -pub fn decode_existential_predicate_slice(decoder: &mut D) - -> Result<&'tcx ty::List>, D::Error> - where D: TyDecoder<'tcx>, +pub fn decode_existential_predicate_slice( + decoder: &mut D, +) -> Result<&'tcx ty::List>, D::Error> +where + D: TyDecoder<'tcx>, { let len = decoder.read_usize()?; Ok(decoder.tcx() @@ -244,9 +252,9 @@ pub fn decode_existential_predicate_slice(decoder: &mut D) } #[inline] -pub fn decode_canonical_var_infos(decoder: &mut D) - -> Result, D::Error> - where D: TyDecoder<'tcx>, +pub fn decode_canonical_var_infos(decoder: &mut D) -> Result, D::Error> +where + D: TyDecoder<'tcx>, { let len = decoder.read_usize()?; let interned: Result, _> = (0..len).map(|_| Decodable::decode(decoder)) @@ -256,17 +264,17 @@ pub fn decode_canonical_var_infos(decoder: &mut D) } #[inline] -pub fn decode_const(decoder: &mut D) - -> Result<&'tcx ty::Const<'tcx>, D::Error> - where D: TyDecoder<'tcx>, +pub fn decode_const(decoder: &mut D) -> Result<&'tcx ty::Const<'tcx>, D::Error> +where + D: TyDecoder<'tcx>, { Ok(decoder.tcx().mk_const(Decodable::decode(decoder)?)) } #[inline] -pub fn decode_allocation(decoder: &mut D) - -> Result<&'tcx Allocation, D::Error> - where D: TyDecoder<'tcx>, +pub fn decode_allocation(decoder: &mut D) -> Result<&'tcx Allocation, D::Error> +where + D: TyDecoder<'tcx>, { Ok(decoder.tcx().intern_const_alloc(Decodable::decode(decoder)?)) } diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index 106637a5b2041..4e255edfe8563 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -1678,10 +1678,7 @@ impl<'gcx> GlobalCtxt<'gcx> { /// Call the closure with a local `TyCtxt` using the given arena. /// `interners` is a slot passed so we can create a CtxtInterners /// with the same lifetime as `arena`. - pub fn enter_local<'tcx, F, R>( - &'gcx self, - f: F - ) -> R + pub fn enter_local<'tcx, F, R>(&'gcx self, f: F) -> R where F: FnOnce(TyCtxt<'gcx, 'tcx>) -> R, 'gcx: 'tcx, @@ -1732,41 +1729,41 @@ pub trait Lift<'tcx>: fmt::Debug { macro_rules! nop_lift { ($ty:ty => $lifted:ty) => { impl<'a, 'tcx> Lift<'tcx> for $ty { - type Lifted = $lifted; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { - if tcx.interners.arena.in_arena(*self as *const _) { - return Some(unsafe { mem::transmute(*self) }); - } - // Also try in the global tcx if we're not that. - if !tcx.is_global() { - self.lift_to_tcx(tcx.global_tcx()) - } else { - None + type Lifted = $lifted; + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { + if tcx.interners.arena.in_arena(*self as *const _) { + return Some(unsafe { mem::transmute(*self) }); + } + // Also try in the global tcx if we're not that. + if !tcx.is_global() { + self.lift_to_tcx(tcx.global_tcx()) + } else { + None + } + } } - } - } }; } macro_rules! nop_list_lift { ($ty:ty => $lifted:ty) => { impl<'a, 'tcx> Lift<'tcx> for &'a List<$ty> { - type Lifted = &'tcx List<$lifted>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { - if self.is_empty() { - return Some(List::empty()); - } - if tcx.interners.arena.in_arena(*self as *const _) { - return Some(unsafe { mem::transmute(*self) }); - } - // Also try in the global tcx if we're not that. - if !tcx.is_global() { - self.lift_to_tcx(tcx.global_tcx()) - } else { - None + type Lifted = &'tcx List<$lifted>; + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { + if self.is_empty() { + return Some(List::empty()); + } + if tcx.interners.arena.in_arena(*self as *const _) { + return Some(unsafe { mem::transmute(*self) }); + } + // Also try in the global tcx if we're not that. + if !tcx.is_global() { + self.lift_to_tcx(tcx.global_tcx()) + } else { + None + } + } } - } - } }; } @@ -1941,7 +1938,8 @@ pub mod tls { /// This happens once per rustc session and TyCtxts only exists /// inside the `f` function. pub fn enter_global<'gcx, F, R>(gcx: &'gcx GlobalCtxt<'gcx>, f: F) -> R - where F: FnOnce(TyCtxt<'gcx, 'gcx>) -> R + where + F: FnOnce(TyCtxt<'gcx, 'gcx>) -> R, { // Update GCX_PTR to indicate there's a GlobalCtxt available GCX_PTR.with(|lock| { @@ -1978,7 +1976,8 @@ pub mod tls { /// Creates a TyCtxt and ImplicitCtxt based on the GCX_PTR thread local. /// This is used in the deadlock handler. pub unsafe fn with_global(f: F) -> R - where F: for<'gcx, 'tcx> FnOnce(TyCtxt<'gcx, 'tcx>) -> R + where + F: for<'gcx, 'tcx> FnOnce(TyCtxt<'gcx, 'tcx>) -> R, { let gcx = GCX_PTR.with(|lock| *lock.lock()); assert!(gcx != 0); @@ -2031,7 +2030,8 @@ pub mod tls { /// the current ImplicitCtxt's tcx field. #[inline] pub fn with_related_context<'gcx, 'tcx1, F, R>(tcx: TyCtxt<'gcx, 'tcx1>, f: F) -> R - where F: for<'b, 'tcx2> FnOnce(&ImplicitCtxt<'b, 'gcx, 'tcx2>) -> R + where + F: for<'b, 'tcx2> FnOnce(&ImplicitCtxt<'b, 'gcx, 'tcx2>) -> R, { with_context(|context| { unsafe { @@ -2049,7 +2049,8 @@ pub mod tls { /// a different local interner from the current ImplicitCtxt's tcx field. #[inline] pub fn with_fully_related_context<'gcx, 'tcx, F, R>(tcx: TyCtxt<'gcx, 'tcx>, f: F) -> R - where F: for<'b> FnOnce(&ImplicitCtxt<'b, 'gcx, 'tcx>) -> R + where + F: for<'b> FnOnce(&ImplicitCtxt<'b, 'gcx, 'tcx>) -> R, { with_context(|context| { unsafe { @@ -2065,7 +2066,8 @@ pub mod tls { /// Panics if there is no ImplicitCtxt available #[inline] pub fn with(f: F) -> R - where F: for<'gcx, 'tcx> FnOnce(TyCtxt<'gcx, 'tcx>) -> R + where + F: for<'gcx, 'tcx> FnOnce(TyCtxt<'gcx, 'tcx>) -> R, { with_context(|context| f(context.tcx)) } @@ -2074,7 +2076,8 @@ pub mod tls { /// The closure is passed None if there is no ImplicitCtxt available #[inline] pub fn with_opt(f: F) -> R - where F: for<'gcx, 'tcx> FnOnce(Option>) -> R + where + F: for<'gcx, 'tcx> FnOnce(Option>) -> R, { with_context_opt(|opt_context| f(opt_context.map(|context| context.tcx))) } diff --git a/src/librustc/ty/fast_reject.rs b/src/librustc/ty/fast_reject.rs index 238865c866e50..d32ad0f5c6d50 100644 --- a/src/librustc/ty/fast_reject.rs +++ b/src/librustc/ty/fast_reject.rs @@ -55,11 +55,11 @@ pub enum SimplifiedTypeGen /// then we can't say much about whether two types would unify. Put another way, /// `can_simplify_params` should be true if type parameters appear free in `ty` and `false` if they /// are to be considered bound. -pub fn simplify_type<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, - ty: Ty<'_>, - can_simplify_params: bool) - -> Option -{ +pub fn simplify_type<'gcx, 'tcx>( + tcx: TyCtxt<'gcx, 'tcx>, + ty: Ty<'_>, + can_simplify_params: bool, +) -> Option { match ty.sty { ty::Bool => Some(BoolSimplifiedType), ty::Char => Some(CharSimplifiedType), diff --git a/src/librustc/ty/fold.rs b/src/librustc/ty/fold.rs index 00ef9446fb194..c79dad04df624 100644 --- a/src/librustc/ty/fold.rs +++ b/src/librustc/ty/fold.rs @@ -155,7 +155,7 @@ pub trait TypeFoldable<'tcx>: fmt::Debug + Clone { /// default implementation that does an "identity" fold. Within each /// identity fold, it should invoke `foo.fold_with(self)` to fold each /// sub-item. -pub trait TypeFolder<'gcx: 'tcx, 'tcx> : Sized { +pub trait TypeFolder<'gcx: 'tcx, 'tcx>: Sized { fn tcx<'a>(&'a self) -> TyCtxt<'gcx, 'tcx>; fn fold_binder(&mut self, t: &Binder) -> Binder @@ -199,9 +199,10 @@ pub trait TypeVisitor<'tcx> : Sized { // Some sample folders pub struct BottomUpFolder<'gcx, 'tcx, F, G, H> - where F: FnMut(Ty<'tcx>) -> Ty<'tcx>, - G: FnMut(ty::Region<'tcx>) -> ty::Region<'tcx>, - H: FnMut(&'tcx ty::Const<'tcx>) -> &'tcx ty::Const<'tcx>, +where + F: FnMut(Ty<'tcx>) -> Ty<'tcx>, + G: FnMut(ty::Region<'tcx>) -> ty::Region<'tcx>, + H: FnMut(&'tcx ty::Const<'tcx>) -> &'tcx ty::Const<'tcx>, { pub tcx: TyCtxt<'gcx, 'tcx>, pub ty_op: F, @@ -210,11 +211,14 @@ pub struct BottomUpFolder<'gcx, 'tcx, F, G, H> } impl<'gcx, 'tcx, F, G, H> TypeFolder<'gcx, 'tcx> for BottomUpFolder<'gcx, 'tcx, F, G, H> - where F: FnMut(Ty<'tcx>) -> Ty<'tcx>, - G: FnMut(ty::Region<'tcx>) -> ty::Region<'tcx>, - H: FnMut(&'tcx ty::Const<'tcx>) -> &'tcx ty::Const<'tcx>, +where + F: FnMut(Ty<'tcx>) -> Ty<'tcx>, + G: FnMut(ty::Region<'tcx>) -> ty::Region<'tcx>, + H: FnMut(&'tcx ty::Const<'tcx>) -> &'tcx ty::Const<'tcx>, { - fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> { self.tcx } + fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> { + self.tcx + } fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> { let t = ty.super_fold_with(self); @@ -361,7 +365,7 @@ impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> { /// visited by this folder; only regions that occur free will be /// visited by `fld_r`. -pub struct RegionFolder<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { +pub struct RegionFolder<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { tcx: TyCtxt<'gcx, 'tcx>, skipped_regions: &'a mut bool, @@ -373,10 +377,8 @@ pub struct RegionFolder<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { /// Callback invokes for each free region. The `DebruijnIndex` /// points to the binder *just outside* the ones we have passed /// through. - fold_region_fn: &'a mut (dyn FnMut( - ty::Region<'tcx>, - ty::DebruijnIndex, - ) -> ty::Region<'tcx> + 'a), + fold_region_fn: + &'a mut (dyn FnMut(ty::Region<'tcx>, ty::DebruijnIndex) -> ty::Region<'tcx> + 'a), } impl<'a, 'gcx, 'tcx> RegionFolder<'a, 'gcx, 'tcx> { @@ -396,7 +398,9 @@ impl<'a, 'gcx, 'tcx> RegionFolder<'a, 'gcx, 'tcx> { } impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for RegionFolder<'a, 'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> { self.tcx } + fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> { + self.tcx + } fn fold_binder>(&mut self, t: &ty::Binder) -> ty::Binder { self.current_index.shift_in(1); @@ -445,9 +449,10 @@ impl<'a, 'gcx, 'tcx> BoundVarReplacer<'a, 'gcx, 'tcx> { fld_t: &'a mut G, fld_c: &'a mut H, ) -> Self - where F: FnMut(ty::BoundRegion) -> ty::Region<'tcx>, - G: FnMut(ty::BoundTy) -> Ty<'tcx>, - H: FnMut(ty::BoundVar, Ty<'tcx>) -> &'tcx ty::Const<'tcx>, + where + F: FnMut(ty::BoundRegion) -> ty::Region<'tcx>, + G: FnMut(ty::BoundTy) -> Ty<'tcx>, + H: FnMut(ty::BoundVar, Ty<'tcx>) -> &'tcx ty::Const<'tcx>, { BoundVarReplacer { tcx, @@ -460,7 +465,9 @@ impl<'a, 'gcx, 'tcx> BoundVarReplacer<'a, 'gcx, 'tcx> { } impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for BoundVarReplacer<'a, 'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> { self.tcx } + fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> { + self.tcx + } fn fold_binder>(&mut self, t: &ty::Binder) -> ty::Binder { self.current_index.shift_in(1); @@ -741,7 +748,9 @@ impl Shifter<'gcx, 'tcx> { } impl TypeFolder<'gcx, 'tcx> for Shifter<'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> { self.tcx } + fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> { + self.tcx + } fn fold_binder>(&mut self, t: &ty::Binder) -> ty::Binder { self.current_index.shift_in(1); @@ -820,7 +829,7 @@ impl TypeFolder<'gcx, 'tcx> for Shifter<'gcx, 'tcx> { pub fn shift_region<'gcx, 'tcx>( tcx: TyCtxt<'gcx, 'tcx>, region: ty::Region<'tcx>, - amount: u32 + amount: u32, ) -> ty::Region<'tcx> { match region { ty::ReLateBound(debruijn, br) if amount > 0 => { @@ -832,22 +841,20 @@ pub fn shift_region<'gcx, 'tcx>( } } -pub fn shift_vars<'gcx, 'tcx, T>( - tcx: TyCtxt<'gcx, 'tcx>, - value: &T, - amount: u32 -) -> T where T: TypeFoldable<'tcx> { +pub fn shift_vars<'gcx, 'tcx, T>(tcx: TyCtxt<'gcx, 'tcx>, value: &T, amount: u32) -> T +where + T: TypeFoldable<'tcx>, +{ debug!("shift_vars(value={:?}, amount={})", value, amount); value.fold_with(&mut Shifter::new(tcx, amount, Direction::In)) } -pub fn shift_out_vars<'gcx, 'tcx, T>( - tcx: TyCtxt<'gcx, 'tcx>, - value: &T, - amount: u32 -) -> T where T: TypeFoldable<'tcx> { +pub fn shift_out_vars<'gcx, 'tcx, T>(tcx: TyCtxt<'gcx, 'tcx>, value: &T, amount: u32) -> T +where + T: TypeFoldable<'tcx>, +{ debug!("shift_out_vars(value={:?}, amount={})", value, amount); diff --git a/src/librustc/ty/inhabitedness/def_id_forest.rs b/src/librustc/ty/inhabitedness/def_id_forest.rs index 0573249e57c9a..023460096a882 100644 --- a/src/librustc/ty/inhabitedness/def_id_forest.rs +++ b/src/librustc/ty/inhabitedness/def_id_forest.rs @@ -52,17 +52,14 @@ impl<'gcx, 'tcx> DefIdForest { } /// Tests whether the forest contains a given DefId. - pub fn contains(&self, - tcx: TyCtxt<'gcx, 'tcx>, - id: DefId) -> bool - { + pub fn contains(&self, tcx: TyCtxt<'gcx, 'tcx>, id: DefId) -> bool { self.root_ids.iter().any(|root_id| tcx.is_descendant_of(id, *root_id)) } /// Calculate the intersection of a collection of forests. - pub fn intersection(tcx: TyCtxt<'gcx, 'tcx>, - iter: I) -> DefIdForest - where I: IntoIterator + pub fn intersection(tcx: TyCtxt<'gcx, 'tcx>, iter: I) -> DefIdForest + where + I: IntoIterator, { let mut iter = iter.into_iter(); let mut ret = if let Some(first) = iter.next() { @@ -97,9 +94,9 @@ impl<'gcx, 'tcx> DefIdForest { } /// Calculate the union of a collection of forests. - pub fn union(tcx: TyCtxt<'gcx, 'tcx>, - iter: I) -> DefIdForest - where I: IntoIterator + pub fn union(tcx: TyCtxt<'gcx, 'tcx>, iter: I) -> DefIdForest + where + I: IntoIterator, { let mut ret = DefIdForest::empty(); let mut next_ret = SmallVec::new(); diff --git a/src/librustc/ty/inhabitedness/mod.rs b/src/librustc/ty/inhabitedness/mod.rs index 54558fd6561ac..b9e34e0cabc65 100644 --- a/src/librustc/ty/inhabitedness/mod.rs +++ b/src/librustc/ty/inhabitedness/mod.rs @@ -108,11 +108,7 @@ impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> { impl<'gcx, 'tcx> AdtDef { /// Calculate the forest of DefIds from which this adt is visibly uninhabited. - fn uninhabited_from( - &self, - tcx: TyCtxt<'gcx, 'tcx>, - substs: SubstsRef<'tcx>) -> DefIdForest - { + fn uninhabited_from(&self, tcx: TyCtxt<'gcx, 'tcx>, substs: SubstsRef<'tcx>) -> DefIdForest { // Non-exhaustive ADTs from other crates are always considered inhabited. if self.is_variant_list_non_exhaustive() && !self.did.is_local() { DefIdForest::empty() @@ -130,8 +126,8 @@ impl<'gcx, 'tcx> VariantDef { &self, tcx: TyCtxt<'gcx, 'tcx>, substs: SubstsRef<'tcx>, - adt_kind: AdtKind) -> DefIdForest - { + adt_kind: AdtKind, + ) -> DefIdForest { let is_enum = match adt_kind { // For now, `union`s are never considered uninhabited. // The precise semantics of inhabitedness with respect to unions is currently undecided. @@ -182,8 +178,7 @@ impl<'gcx, 'tcx> FieldDef { impl<'gcx, 'tcx> TyS<'tcx> { /// Calculate the forest of DefIds from which this type is visibly uninhabited. - fn uninhabited_from(&self, tcx: TyCtxt<'gcx, 'tcx>) -> DefIdForest - { + fn uninhabited_from(&self, tcx: TyCtxt<'gcx, 'tcx>) -> DefIdForest { match self.sty { Adt(def, substs) => def.uninhabited_from(tcx, substs), diff --git a/src/librustc/ty/instance.rs b/src/librustc/ty/instance.rs index a48f88220f417..16df0da88207b 100644 --- a/src/librustc/ty/instance.rs +++ b/src/librustc/ty/instance.rs @@ -43,10 +43,7 @@ pub enum InstanceDef<'tcx> { } impl<'tcx> Instance<'tcx> { - pub fn ty(&self, - tcx: TyCtxt<'tcx, 'tcx>) - -> Ty<'tcx> - { + pub fn ty(&self, tcx: TyCtxt<'tcx, 'tcx>) -> Ty<'tcx> { let ty = tcx.type_of(self.def.def_id()); tcx.subst_and_normalize_erasing_regions( self.substs, @@ -140,10 +137,7 @@ impl<'tcx> InstanceDef<'tcx> { tcx.get_attrs(self.def_id()) } - pub fn is_inline( - &self, - tcx: TyCtxt<'tcx, 'tcx> - ) -> bool { + pub fn is_inline(&self, tcx: TyCtxt<'tcx, 'tcx>) -> bool { use crate::hir::map::DefPathData; let def_id = match *self { ty::InstanceDef::Item(def_id) => def_id, @@ -156,10 +150,7 @@ impl<'tcx> InstanceDef<'tcx> { } } - pub fn requires_local( - &self, - tcx: TyCtxt<'tcx, 'tcx> - ) -> bool { + pub fn requires_local(&self, tcx: TyCtxt<'tcx, 'tcx>) -> bool { if self.is_inline(tcx) { return true } @@ -245,10 +236,12 @@ impl<'b, 'tcx> Instance<'tcx> { /// Presuming that coherence and type-check have succeeded, if this method is invoked /// in a monomorphic context (i.e., like during codegen), then it is guaranteed to return /// `Some`. - pub fn resolve(tcx: TyCtxt<'tcx, 'tcx>, - param_env: ty::ParamEnv<'tcx>, - def_id: DefId, - substs: SubstsRef<'tcx>) -> Option> { + pub fn resolve( + tcx: TyCtxt<'tcx, 'tcx>, + param_env: ty::ParamEnv<'tcx>, + def_id: DefId, + substs: SubstsRef<'tcx>, + ) -> Option> { debug!("resolve(def_id={:?}, substs={:?})", def_id, substs); let result = if let Some(trait_def_id) = tcx.trait_of_item(def_id) { debug!(" => associated item, attempting to find impl in param_env {:#?}", param_env); @@ -297,10 +290,12 @@ impl<'b, 'tcx> Instance<'tcx> { result } - pub fn resolve_for_vtable(tcx: TyCtxt<'tcx, 'tcx>, - param_env: ty::ParamEnv<'tcx>, - def_id: DefId, - substs: SubstsRef<'tcx>) -> Option> { + pub fn resolve_for_vtable( + tcx: TyCtxt<'tcx, 'tcx>, + param_env: ty::ParamEnv<'tcx>, + def_id: DefId, + substs: SubstsRef<'tcx>, + ) -> Option> { debug!("resolve(def_id={:?}, substs={:?})", def_id, substs); let fn_sig = tcx.fn_sig(def_id); let is_vtable_shim = @@ -320,9 +315,8 @@ impl<'b, 'tcx> Instance<'tcx> { tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, substs: ty::ClosureSubsts<'tcx>, - requested_kind: ty::ClosureKind) - -> Instance<'tcx> - { + requested_kind: ty::ClosureKind, + ) -> Instance<'tcx> { let actual_kind = substs.closure_kind(def_id, tcx); match needs_fn_once_adapter_shim(actual_kind, requested_kind) { @@ -331,11 +325,7 @@ impl<'b, 'tcx> Instance<'tcx> { } } - pub fn resolve_drop_in_place( - tcx: TyCtxt<'tcx, 'tcx>, - ty: Ty<'tcx>) - -> ty::Instance<'tcx> - { + pub fn resolve_drop_in_place(tcx: TyCtxt<'tcx, 'tcx>, ty: Ty<'tcx>) -> ty::Instance<'tcx> { let def_id = tcx.require_lang_item(DropInPlaceFnLangItem); let substs = tcx.intern_substs(&[ty.into()]); Instance::resolve(tcx, ty::ParamEnv::reveal_all(), def_id, substs).unwrap() @@ -344,9 +334,8 @@ impl<'b, 'tcx> Instance<'tcx> { pub fn fn_once_adapter_instance( tcx: TyCtxt<'tcx, 'tcx>, closure_did: DefId, - substs: ty::ClosureSubsts<'tcx>) - -> Instance<'tcx> - { + substs: ty::ClosureSubsts<'tcx>, + ) -> Instance<'tcx> { debug!("fn_once_adapter_shim({:?}, {:?})", closure_did, substs); diff --git a/src/librustc/ty/layout.rs b/src/librustc/ty/layout.rs index 65b6f93e251d6..efbae81a5dd52 100644 --- a/src/librustc/ty/layout.rs +++ b/src/librustc/ty/layout.rs @@ -28,17 +28,16 @@ use rustc_target::abi::call::{ ArgAttribute, ArgAttributes, ArgType, Conv, FnType, IgnoreMode, PassMode, Reg, RegKind }; - - pub trait IntegerExt { fn to_ty<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx>, signed: bool) -> Ty<'tcx>; fn from_attr(cx: &C, ity: attr::IntType) -> Integer; - fn repr_discr<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - ty: Ty<'tcx>, - repr: &ReprOptions, - min: i128, - max: i128) - -> (Integer, bool); + fn repr_discr<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + ty: Ty<'tcx>, + repr: &ReprOptions, + min: i128, + max: i128, + ) -> (Integer, bool); } impl IntegerExt for Integer { @@ -77,12 +76,13 @@ impl IntegerExt for Integer { /// signed discriminant range and #[repr] attribute. /// N.B.: u128 values above i128::MAX will be treated as signed, but /// that shouldn't affect anything, other than maybe debuginfo. - fn repr_discr<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - ty: Ty<'tcx>, - repr: &ReprOptions, - min: i128, - max: i128) - -> (Integer, bool) { + fn repr_discr<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + ty: Ty<'tcx>, + repr: &ReprOptions, + min: i128, + max: i128, + ) -> (Integer, bool) { // Theoretically, negative values could be larger in unsigned representation // than the unsigned representation of the signed minimum. However, if there // are any negative values, the only valid unsigned representation is u128 @@ -171,10 +171,10 @@ impl<'tcx> fmt::Display for LayoutError<'tcx> { } } -fn layout_raw<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - query: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) - -> Result<&'tcx LayoutDetails, LayoutError<'tcx>> -{ +fn layout_raw<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + query: ty::ParamEnvAnd<'tcx, Ty<'tcx>>, +) -> Result<&'tcx LayoutDetails, LayoutError<'tcx>> { ty::tls::with_related_context(tcx, move |icx| { let rec_limit = *tcx.sess.recursion_limit.get(); let (param_env, ty) = query.into_parts(); @@ -1604,10 +1604,11 @@ pub enum SizeSkeleton<'tcx> { } impl<'tcx> SizeSkeleton<'tcx> { - pub fn compute(ty: Ty<'tcx>, - tcx: TyCtxt<'tcx, 'tcx>, - param_env: ty::ParamEnv<'tcx>) - -> Result, LayoutError<'tcx>> { + pub fn compute( + ty: Ty<'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, + param_env: ty::ParamEnv<'tcx>, + ) -> Result, LayoutError<'tcx>> { debug_assert!(!ty.has_infer_types()); // First try computing a static layout. diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index 76681fe2e8cf4..71955764e100b 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -957,11 +957,11 @@ impl<'gcx, 'tcx> Generics { false } - pub fn region_param(&'tcx self, - param: &EarlyBoundRegion, - tcx: TyCtxt<'gcx, 'tcx>) - -> &'tcx GenericParamDef - { + pub fn region_param( + &'tcx self, + param: &EarlyBoundRegion, + tcx: TyCtxt<'gcx, 'tcx>, + ) -> &'tcx GenericParamDef { if let Some(index) = param.index.checked_sub(self.parent_count as u32) { let param = &self.params[index as usize]; match param.kind { @@ -975,10 +975,11 @@ impl<'gcx, 'tcx> Generics { } /// Returns the `GenericParamDef` associated with this `ParamTy`. - pub fn type_param(&'tcx self, - param: &ParamTy, - tcx: TyCtxt<'gcx, 'tcx>) - -> &'tcx GenericParamDef { + pub fn type_param( + &'tcx self, + param: &ParamTy, + tcx: TyCtxt<'gcx, 'tcx>, + ) -> &'tcx GenericParamDef { if let Some(index) = param.index.checked_sub(self.parent_count as u32) { let param = &self.params[index as usize]; match param.kind { @@ -992,10 +993,11 @@ impl<'gcx, 'tcx> Generics { } /// Returns the `ConstParameterDef` associated with this `ParamConst`. - pub fn const_param(&'tcx self, - param: &ParamConst, - tcx: TyCtxt<'gcx, 'tcx>) - -> &GenericParamDef { + pub fn const_param( + &'tcx self, + param: &ParamConst, + tcx: TyCtxt<'gcx, 'tcx>, + ) -> &GenericParamDef { if let Some(index) = param.index.checked_sub(self.parent_count as u32) { let param = &self.params[index as usize]; match param.kind { @@ -1020,23 +1022,32 @@ impl<'tcx> serialize::UseSpecializedEncodable for GenericPredicates<'tcx> {} impl<'tcx> serialize::UseSpecializedDecodable for GenericPredicates<'tcx> {} impl<'gcx, 'tcx> GenericPredicates<'tcx> { - pub fn instantiate(&self, tcx: TyCtxt<'gcx, 'tcx>, substs: SubstsRef<'tcx>) - -> InstantiatedPredicates<'tcx> { + pub fn instantiate( + &self, + tcx: TyCtxt<'gcx, 'tcx>, + substs: SubstsRef<'tcx>, + ) -> InstantiatedPredicates<'tcx> { let mut instantiated = InstantiatedPredicates::empty(); self.instantiate_into(tcx, &mut instantiated, substs); instantiated } - pub fn instantiate_own(&self, tcx: TyCtxt<'gcx, 'tcx>, substs: SubstsRef<'tcx>) - -> InstantiatedPredicates<'tcx> { + pub fn instantiate_own( + &self, + tcx: TyCtxt<'gcx, 'tcx>, + substs: SubstsRef<'tcx>, + ) -> InstantiatedPredicates<'tcx> { InstantiatedPredicates { predicates: self.predicates.iter().map(|(p, _)| p.subst(tcx, substs)).collect(), } } - fn instantiate_into(&self, tcx: TyCtxt<'gcx, 'tcx>, - instantiated: &mut InstantiatedPredicates<'tcx>, - substs: SubstsRef<'tcx>) { + fn instantiate_into( + &self, + tcx: TyCtxt<'gcx, 'tcx>, + instantiated: &mut InstantiatedPredicates<'tcx>, + substs: SubstsRef<'tcx>, + ) { if let Some(def_id) = self.parent { tcx.predicates_of(def_id).instantiate_into(tcx, instantiated, substs); } @@ -1045,25 +1056,28 @@ impl<'gcx, 'tcx> GenericPredicates<'tcx> { ); } - pub fn instantiate_identity(&self, tcx: TyCtxt<'gcx, 'tcx>) - -> InstantiatedPredicates<'tcx> { + pub fn instantiate_identity(&self, tcx: TyCtxt<'gcx, 'tcx>) -> InstantiatedPredicates<'tcx> { let mut instantiated = InstantiatedPredicates::empty(); self.instantiate_identity_into(tcx, &mut instantiated); instantiated } - fn instantiate_identity_into(&self, tcx: TyCtxt<'gcx, 'tcx>, - instantiated: &mut InstantiatedPredicates<'tcx>) { + fn instantiate_identity_into( + &self, + tcx: TyCtxt<'gcx, 'tcx>, + instantiated: &mut InstantiatedPredicates<'tcx>, + ) { if let Some(def_id) = self.parent { tcx.predicates_of(def_id).instantiate_identity_into(tcx, instantiated); } instantiated.predicates.extend(self.predicates.iter().map(|&(p, _)| p)) } - pub fn instantiate_supertrait(&self, tcx: TyCtxt<'gcx, 'tcx>, - poly_trait_ref: &ty::PolyTraitRef<'tcx>) - -> InstantiatedPredicates<'tcx> - { + pub fn instantiate_supertrait( + &self, + tcx: TyCtxt<'gcx, 'tcx>, + poly_trait_ref: &ty::PolyTraitRef<'tcx>, + ) -> InstantiatedPredicates<'tcx> { assert_eq!(self.parent, None); InstantiatedPredicates { predicates: self.predicates.iter().map(|(pred, _)| { @@ -1134,10 +1148,11 @@ impl<'gcx, 'tcx> Predicate<'tcx> { /// poly-trait-ref holds. This is slightly different from a normal /// substitution in terms of what happens with bound regions. See /// lengthy comment below for details. - pub fn subst_supertrait(&self, tcx: TyCtxt<'gcx, 'tcx>, - trait_ref: &ty::PolyTraitRef<'tcx>) - -> ty::Predicate<'tcx> - { + pub fn subst_supertrait( + &self, + tcx: TyCtxt<'gcx, 'tcx>, + trait_ref: &ty::PolyTraitRef<'tcx>, + ) -> ty::Predicate<'tcx> { // The interaction between HRTB and supertraits is not entirely // obvious. Let me walk you (and myself) through an example. // @@ -2140,7 +2155,6 @@ impl ReprOptions { pub fn inhibit_union_abi_opt(&self) -> bool { self.c() } - } impl<'gcx, 'tcx> AdtDef { @@ -2150,7 +2164,7 @@ impl<'gcx, 'tcx> AdtDef { did: DefId, kind: AdtKind, variants: IndexVec, - repr: ReprOptions + repr: ReprOptions, ) -> Self { debug!("AdtDef::new({:?}, {:?}, {:?}, {:?})", did, kind, variants, repr); let mut flags = AdtFlags::NO_ADT_FLAGS; @@ -2427,10 +2441,11 @@ impl<'gcx, 'tcx> AdtDef { /// discriminant (the last one before the requested variant), /// assuming there are no constant-evaluation errors there. #[inline] - pub fn discriminant_for_variant(&self, - tcx: TyCtxt<'gcx, 'tcx>, - variant_index: VariantIdx) - -> Discr<'tcx> { + pub fn discriminant_for_variant( + &self, + tcx: TyCtxt<'gcx, 'tcx>, + variant_index: VariantIdx, + ) -> Discr<'tcx> { let (val, offset) = self.discriminant_def_for_variant(variant_index); let explicit_value = val .and_then(|expr_did| self.eval_explicit_discr(tcx, expr_did)) @@ -2483,10 +2498,7 @@ impl<'gcx, 'tcx> AdtDef { tcx.adt_sized_constraint(self.did).0 } - fn sized_constraint_for_ty(&self, - tcx: TyCtxt<'tcx, 'tcx>, - ty: Ty<'tcx>) - -> Vec> { + fn sized_constraint_for_ty(&self, tcx: TyCtxt<'tcx, 'tcx>, ty: Ty<'tcx>) -> Vec> { let result = match ty.sty { Bool | Char | Int(..) | Uint(..) | Float(..) | RawPtr(..) | Ref(..) | FnDef(..) | FnPtr(_) | @@ -2763,9 +2775,7 @@ impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> { /// Returns an iterator of the `DefId`s for all body-owners in this /// crate. If you would prefer to iterate over the bodies /// themselves, you can do `self.hir().krate().body_ids.iter()`. - pub fn body_owners( - self, - ) -> impl Iterator + Captures<'gcx> + 'tcx { + pub fn body_owners(self) -> impl Iterator + Captures<'gcx> + 'tcx { self.hir().krate() .body_ids .iter() @@ -2889,10 +2899,7 @@ impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> { }) } - pub fn associated_items( - self, - def_id: DefId, - ) -> AssocItemsIterator<'gcx, 'tcx> { + pub fn associated_items(self, def_id: DefId) -> AssocItemsIterator<'gcx, 'tcx> { // Ideally, we would use `-> impl Iterator` here, but it falls // afoul of the conservative "capture [restrictions]" we put // in place, so we use a hand-written iterator. @@ -3176,9 +3183,7 @@ pub struct AdtSizedConstraint<'tcx>(pub &'tcx [Ty<'tcx>]); /// such. /// - a Error, if a type contained itself. The representability /// check should catch this case. -fn adt_sized_constraint<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - def_id: DefId) - -> AdtSizedConstraint<'tcx> { +fn adt_sized_constraint<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> AdtSizedConstraint<'tcx> { let def = tcx.adt_def(def_id); let result = tcx.mk_type_list(def.variants.iter().flat_map(|v| { @@ -3192,9 +3197,7 @@ fn adt_sized_constraint<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, AdtSizedConstraint(result) } -fn associated_item_def_ids<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - def_id: DefId) - -> &'tcx [DefId] { +fn associated_item_def_ids<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> &'tcx [DefId] { let id = tcx.hir().as_local_hir_id(def_id).unwrap(); let item = tcx.hir().expect_item_by_hir_id(id); match item.node { @@ -3247,10 +3250,7 @@ pub fn is_impl_trait_defn(tcx: TyCtxt<'_, '_>, def_id: DefId) -> Option { } /// See `ParamEnv` struct definition for details. -fn param_env<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - def_id: DefId) - -> ParamEnv<'tcx> -{ +fn param_env<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> ParamEnv<'tcx> { // The param_env of an impl Trait type is its defining function's param_env if let Some(parent) = is_impl_trait_defn(tcx, def_id) { return param_env(tcx, parent); @@ -3285,28 +3285,25 @@ fn param_env<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, traits::normalize_param_env_or_error(tcx, def_id, unnormalized_env, cause) } -fn crate_disambiguator<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - crate_num: CrateNum) -> CrateDisambiguator { +fn crate_disambiguator<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, crate_num: CrateNum) -> CrateDisambiguator { assert_eq!(crate_num, LOCAL_CRATE); tcx.sess.local_crate_disambiguator() } -fn original_crate_name<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - crate_num: CrateNum) -> Symbol { +fn original_crate_name<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, crate_num: CrateNum) -> Symbol { assert_eq!(crate_num, LOCAL_CRATE); tcx.crate_name.clone() } -fn crate_hash<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - crate_num: CrateNum) - -> Svh { +fn crate_hash<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, crate_num: CrateNum) -> Svh { assert_eq!(crate_num, LOCAL_CRATE); tcx.hir().crate_hash } -fn instance_def_size_estimate<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - instance_def: InstanceDef<'tcx>) - -> usize { +fn instance_def_size_estimate<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + instance_def: InstanceDef<'tcx>, +) -> usize { match instance_def { InstanceDef::Item(..) | InstanceDef::DropGlue(..) => { @@ -3321,10 +3318,7 @@ fn instance_def_size_estimate<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, /// If `def_id` is an issue 33140 hack impl, returns its self type; otherwise, returns `None`. /// /// See [`ImplOverlapKind::Issue33140`] for more details. -fn issue33140_self_ty<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - def_id: DefId) - -> Option> -{ +fn issue33140_self_ty<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> Option> { debug!("issue33140_self_ty({:?})", def_id); let trait_ref = tcx.impl_trait_ref(def_id).unwrap_or_else(|| { diff --git a/src/librustc/ty/query/config.rs b/src/librustc/ty/query/config.rs index c595d37989cb1..bd5f33eea7bc5 100644 --- a/src/librustc/ty/query/config.rs +++ b/src/librustc/ty/query/config.rs @@ -54,14 +54,12 @@ pub(crate) trait QueryDescription<'tcx>: QueryAccessors<'tcx> { false } - fn try_load_from_disk(_: TyCtxt<'tcx, 'tcx>, - _: SerializedDepNodeIndex) - -> Option { + fn try_load_from_disk(_: TyCtxt<'tcx, 'tcx>, _: SerializedDepNodeIndex) -> Option { bug!("QueryDescription::load_from_disk() called for an unsupported query.") } } -impl<'tcx, M: QueryAccessors<'tcx, Key=DefId>> QueryDescription<'tcx> for M { +impl<'tcx, M: QueryAccessors<'tcx, Key = DefId>> QueryDescription<'tcx> for M { default fn describe(tcx: TyCtxt<'_, '_>, def_id: DefId) -> Cow<'static, str> { if !tcx.sess.verbose() { format!("processing `{}`", tcx.def_path_str(def_id)).into() diff --git a/src/librustc/ty/query/job.rs b/src/librustc/ty/query/job.rs index f8fc2c1012586..f300d82e372e9 100644 --- a/src/librustc/ty/query/job.rs +++ b/src/librustc/ty/query/job.rs @@ -340,7 +340,7 @@ fn connected_to_root<'tcx>( fn pick_query<'a, 'tcx, T, F: Fn(&T) -> (Span, Lrc>)>( tcx: TyCtxt<'tcx, '_>, queries: &'a [T], - f: F + f: F, ) -> &'a T { // Deterministically pick an entry point // FIXME: Sort this instead @@ -366,7 +366,7 @@ fn pick_query<'a, 'tcx, T, F: Fn(&T) -> (Span, Lrc>)>( fn remove_cycle<'tcx>( jobs: &mut Vec>>, wakelist: &mut Vec>>, - tcx: TyCtxt<'tcx, '_> + tcx: TyCtxt<'tcx, '_>, ) -> bool { let mut visited = FxHashSet::default(); let mut stack = Vec::new(); diff --git a/src/librustc/ty/query/keys.rs b/src/librustc/ty/query/keys.rs index 96a98b45f1f69..af13bbc24efd9 100644 --- a/src/librustc/ty/query/keys.rs +++ b/src/librustc/ty/query/keys.rs @@ -136,7 +136,7 @@ impl<'tcx> Key for (&'tcx ty::Const<'tcx>, mir::Field) { } } -impl<'tcx> Key for ty::PolyTraitRef<'tcx>{ +impl<'tcx> Key for ty::PolyTraitRef<'tcx> { fn query_crate(&self) -> CrateNum { self.def_id().krate } diff --git a/src/librustc/ty/query/on_disk_cache.rs b/src/librustc/ty/query/on_disk_cache.rs index 71ea4ac772c31..bc28396a6f9f8 100644 --- a/src/librustc/ty/query/on_disk_cache.rs +++ b/src/librustc/ty/query/on_disk_cache.rs @@ -156,12 +156,14 @@ impl<'sess> OnDiskCache<'sess> { } } - pub fn serialize<'tcx, E>(&self, - tcx: TyCtxt<'tcx, 'tcx>, - encoder: &mut E) - -> Result<(), E::Error> - where E: ty_codec::TyEncoder - { + pub fn serialize<'tcx, E>( + &self, + tcx: TyCtxt<'tcx, 'tcx>, + encoder: &mut E, + ) -> Result<(), E::Error> + where + E: ty_codec::TyEncoder, + { // Serializing the DepGraph should not modify it: tcx.dep_graph.with_ignore(|| { // Allocate SourceFileIndices @@ -326,10 +328,11 @@ impl<'sess> OnDiskCache<'sess> { } /// Loads a diagnostic emitted during the previous compilation session. - pub fn load_diagnostics<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx>, - dep_node_index: SerializedDepNodeIndex) - -> Vec { + pub fn load_diagnostics<'tcx>( + &self, + tcx: TyCtxt<'tcx, 'tcx>, + dep_node_index: SerializedDepNodeIndex, + ) -> Vec { let diagnostics: Option = self.load_indexed( tcx, dep_node_index, @@ -354,11 +357,13 @@ impl<'sess> OnDiskCache<'sess> { /// Returns the cached query result if there is something in the cache for /// the given `SerializedDepNodeIndex`; otherwise returns `None`. - pub fn try_load_query_result<'tcx, T>(&self, - tcx: TyCtxt<'tcx, 'tcx>, - dep_node_index: SerializedDepNodeIndex) - -> Option - where T: Decodable + pub fn try_load_query_result<'tcx, T>( + &self, + tcx: TyCtxt<'tcx, 'tcx>, + dep_node_index: SerializedDepNodeIndex, + ) -> Option + where + T: Decodable, { self.load_indexed(tcx, dep_node_index, @@ -382,14 +387,15 @@ impl<'sess> OnDiskCache<'sess> { x.extend(Into::>::into(diagnostics)); } - fn load_indexed<'tcx, T>(&self, - tcx: TyCtxt<'tcx, 'tcx>, - dep_node_index: SerializedDepNodeIndex, - index: &FxHashMap, - debug_tag: &'static str) - -> Option - where T: Decodable + fn load_indexed<'tcx, T>( + &self, + tcx: TyCtxt<'tcx, 'tcx>, + dep_node_index: SerializedDepNodeIndex, + index: &FxHashMap, + debug_tag: &'static str, + ) -> Option + where + T: Decodable, { let pos = index.get(&dep_node_index).cloned()?; @@ -423,10 +429,10 @@ impl<'sess> OnDiskCache<'sess> { // current-session-CrateNum. There might be CrateNums from the previous // Session that don't occur in the current one. For these, the mapping // maps to None. - fn compute_cnum_map(tcx: TyCtxt<'_, '_>, - prev_cnums: &[(u32, String, CrateDisambiguator)]) - -> IndexVec> - { + fn compute_cnum_map( + tcx: TyCtxt<'_, '_>, + prev_cnums: &[(u32, String, CrateDisambiguator)], + ) -> IndexVec> { tcx.dep_graph.with_ignore(|| { let current_cnums = tcx.all_crate_nums(LOCAL_CRATE).iter().map(|&cnum| { let crate_name = tcx.original_crate_name(cnum) @@ -524,7 +530,6 @@ fn decode_tagged<'a, 'tcx, D, T, V>(decoder: &mut D, Ok(value) } - impl<'a, 'tcx> ty_codec::TyDecoder<'tcx> for CacheDecoder<'a, 'tcx> { #[inline] fn tcx(&self) -> TyCtxt<'tcx, 'tcx> { @@ -583,7 +588,7 @@ impl<'a, 'tcx> ty_codec::TyDecoder<'tcx> for CacheDecoder<'a, 'tcx> { } } -implement_ty_decoder!( CacheDecoder<'a, 'tcx> ); +implement_ty_decoder!(CacheDecoder<'a, 'tcx>); impl<'a, 'tcx> SpecializedDecoder for CacheDecoder<'a, 'tcx> { fn specialized_decode(&mut self) -> Result { @@ -724,7 +729,8 @@ impl<'a, 'tcx> SpecializedDecoder for CacheDecoder<'a, 'tcx> { } impl<'a, 'tcx, T: Decodable> SpecializedDecoder> -for CacheDecoder<'a, 'tcx> { + for CacheDecoder<'a, 'tcx> +{ #[inline] fn specialized_decode(&mut self) -> Result, Self::Error> { let discr = u8::decode(self)?; @@ -757,7 +763,8 @@ struct CacheEncoder<'a, 'tcx, E: ty_codec::TyEncoder> { } impl<'a, 'tcx, E> CacheEncoder<'a, 'tcx, E> - where E: 'a + ty_codec::TyEncoder +where + E: 'a + ty_codec::TyEncoder, { fn source_file_index(&mut self, source_file: Lrc) -> SourceFileIndex { self.file_to_file_index[&(&*source_file as *const SourceFile)] @@ -784,7 +791,8 @@ impl<'a, 'tcx, E> CacheEncoder<'a, 'tcx, E> } impl<'a, 'tcx, E> SpecializedEncoder for CacheEncoder<'a, 'tcx, E> - where E: 'a + ty_codec::TyEncoder +where + E: 'a + ty_codec::TyEncoder, { fn specialized_encode(&mut self, alloc_id: &interpret::AllocId) -> Result<(), Self::Error> { use std::collections::hash_map::Entry; @@ -803,7 +811,8 @@ impl<'a, 'tcx, E> SpecializedEncoder for CacheEncoder<'a, 't } impl<'a, 'tcx, E> SpecializedEncoder for CacheEncoder<'a, 'tcx, E> - where E: 'a + ty_codec::TyEncoder +where + E: 'a + ty_codec::TyEncoder, { fn specialized_encode(&mut self, span: &Span) -> Result<(), Self::Error> { @@ -859,7 +868,8 @@ impl<'a, 'tcx, E> SpecializedEncoder for CacheEncoder<'a, 'tcx, E> } impl<'a, 'tcx, E> ty_codec::TyEncoder for CacheEncoder<'a, 'tcx, E> - where E: 'a + ty_codec::TyEncoder +where + E: 'a + ty_codec::TyEncoder, { #[inline] fn position(&self) -> usize { @@ -868,7 +878,8 @@ impl<'a, 'tcx, E> ty_codec::TyEncoder for CacheEncoder<'a, 'tcx, E> } impl<'a, 'tcx, E> SpecializedEncoder for CacheEncoder<'a, 'tcx, E> - where E: 'a + ty_codec::TyEncoder +where + E: 'a + ty_codec::TyEncoder, { #[inline] fn specialized_encode(&mut self, cnum: &CrateNum) -> Result<(), Self::Error> { @@ -877,7 +888,8 @@ impl<'a, 'tcx, E> SpecializedEncoder for CacheEncoder<'a, 'tcx, E> } impl<'a, 'tcx, E> SpecializedEncoder> for CacheEncoder<'a, 'tcx, E> - where E: 'a + ty_codec::TyEncoder +where + E: 'a + ty_codec::TyEncoder, { #[inline] fn specialized_encode(&mut self, ty: &Ty<'tcx>) -> Result<(), Self::Error> { @@ -886,9 +898,9 @@ impl<'a, 'tcx, E> SpecializedEncoder> for CacheEncoder<'a, 'tcx, E> } } -impl<'a, 'tcx, E> SpecializedEncoder> - for CacheEncoder<'a, 'tcx, E> - where E: 'a + ty_codec::TyEncoder +impl<'a, 'tcx, E> SpecializedEncoder> for CacheEncoder<'a, 'tcx, E> +where + E: 'a + ty_codec::TyEncoder, { #[inline] fn specialized_encode(&mut self, @@ -900,7 +912,8 @@ impl<'a, 'tcx, E> SpecializedEncoder> } impl<'a, 'tcx, E> SpecializedEncoder for CacheEncoder<'a, 'tcx, E> - where E: 'a + ty_codec::TyEncoder +where + E: 'a + ty_codec::TyEncoder, { #[inline] fn specialized_encode(&mut self, id: &hir::HirId) -> Result<(), Self::Error> { @@ -916,9 +929,9 @@ impl<'a, 'tcx, E> SpecializedEncoder for CacheEncoder<'a, 'tcx, E> } } - impl<'a, 'tcx, E> SpecializedEncoder for CacheEncoder<'a, 'tcx, E> - where E: 'a + ty_codec::TyEncoder +where + E: 'a + ty_codec::TyEncoder, { #[inline] fn specialized_encode(&mut self, id: &DefId) -> Result<(), Self::Error> { @@ -928,7 +941,8 @@ impl<'a, 'tcx, E> SpecializedEncoder for CacheEncoder<'a, 'tcx, E> } impl<'a, 'tcx, E> SpecializedEncoder for CacheEncoder<'a, 'tcx, E> - where E: 'a + ty_codec::TyEncoder +where + E: 'a + ty_codec::TyEncoder, { #[inline] fn specialized_encode(&mut self, id: &LocalDefId) -> Result<(), Self::Error> { @@ -937,7 +951,8 @@ impl<'a, 'tcx, E> SpecializedEncoder for CacheEncoder<'a, 'tcx, E> } impl<'a, 'tcx, E> SpecializedEncoder for CacheEncoder<'a, 'tcx, E> - where E: 'a + ty_codec::TyEncoder +where + E: 'a + ty_codec::TyEncoder, { fn specialized_encode(&mut self, _: &DefIndex) -> Result<(), Self::Error> { bug!("Encoding DefIndex without context.") @@ -947,7 +962,8 @@ impl<'a, 'tcx, E> SpecializedEncoder for CacheEncoder<'a, 'tcx, E> // NodeIds are not stable across compilation sessions, so we store them in their // HirId representation. This allows use to map them to the current NodeId. impl<'a, 'tcx, E> SpecializedEncoder for CacheEncoder<'a, 'tcx, E> - where E: 'a + ty_codec::TyEncoder +where + E: 'a + ty_codec::TyEncoder, { #[inline] fn specialized_encode(&mut self, node_id: &NodeId) -> Result<(), Self::Error> { @@ -956,18 +972,16 @@ impl<'a, 'tcx, E> SpecializedEncoder for CacheEncoder<'a, 'tcx, E> } } -impl<'a, 'tcx> SpecializedEncoder -for CacheEncoder<'a, 'tcx, opaque::Encoder> -{ +impl<'a, 'tcx> SpecializedEncoder for CacheEncoder<'a, 'tcx, opaque::Encoder> { fn specialized_encode(&mut self, f: &Fingerprint) -> Result<(), Self::Error> { f.encode_opaque(&mut self.encoder) } } -impl<'a, 'tcx, E, T> SpecializedEncoder> -for CacheEncoder<'a, 'tcx, E> - where E: 'a + ty_codec::TyEncoder, - T: Encodable, +impl<'a, 'tcx, E, T> SpecializedEncoder> for CacheEncoder<'a, 'tcx, E> +where + E: 'a + ty_codec::TyEncoder, + T: Encodable, { #[inline] fn specialized_encode(&mut self, @@ -994,7 +1008,8 @@ macro_rules! encoder_methods { } impl<'a, 'tcx, E> Encoder for CacheEncoder<'a, 'tcx, E> - where E: 'a + ty_codec::TyEncoder +where + E: 'a + ty_codec::TyEncoder, { type Error = E::Error; @@ -1064,13 +1079,15 @@ impl<'a> SpecializedDecoder for opaque::Decoder<'a> { } } -fn encode_query_results<'a, 'tcx, Q, E>(tcx: TyCtxt<'tcx, 'tcx>, - encoder: &mut CacheEncoder<'a, 'tcx, E>, - query_result_index: &mut EncodedQueryResultIndex) - -> Result<(), E::Error> - where Q: super::config::QueryDescription<'tcx>, - E: 'a + TyEncoder, - Q::Value: Encodable, +fn encode_query_results<'a, 'tcx, Q, E>( + tcx: TyCtxt<'tcx, 'tcx>, + encoder: &mut CacheEncoder<'a, 'tcx, E>, + query_result_index: &mut EncodedQueryResultIndex, +) -> Result<(), E::Error> +where + Q: super::config::QueryDescription<'tcx>, + E: 'a + TyEncoder, + Q::Value: Encodable, { let desc = &format!("encode_query_results for {}", unsafe { ::std::intrinsics::type_name::() }); diff --git a/src/librustc/ty/query/plumbing.rs b/src/librustc/ty/query/plumbing.rs index 639aa8e2c34b8..662d653b2a173 100644 --- a/src/librustc/ty/query/plumbing.rs +++ b/src/librustc/ty/query/plumbing.rs @@ -256,10 +256,10 @@ impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> { self, job: Lrc>, diagnostics: Option<&Lock>>, - compute: F) - -> R + compute: F, + ) -> R where - F: for<'lcx> FnOnce(TyCtxt<'gcx, 'lcx>) -> R + F: for<'lcx> FnOnce(TyCtxt<'gcx, 'lcx>) -> R, { // The TyCtxt stored in TLS has the same global interner lifetime // as `self`, so we use `with_related_context` to relate the 'gcx lifetimes @@ -285,9 +285,8 @@ impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> { #[cold] pub(super) fn report_cycle( self, - CycleError { usage, cycle: stack }: CycleError<'gcx> - ) -> DiagnosticBuilder<'tcx> - { + CycleError { usage, cycle: stack }: CycleError<'gcx>, + ) -> DiagnosticBuilder<'tcx> { assert!(!stack.is_empty()); let fix_span = |span: Span, query: &Query<'gcx>| { @@ -1148,10 +1147,7 @@ macro_rules! define_provider_struct { /// then `force_from_dep_node()` should not fail for it. Otherwise, you can just /// add it to the "We don't have enough information to reconstruct..." group in /// the match below. -pub fn force_from_dep_node<'tcx>( - tcx: TyCtxt<'tcx, 'tcx>, - dep_node: &DepNode -) -> bool { +pub fn force_from_dep_node<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, dep_node: &DepNode) -> bool { use crate::dep_graph::RecoverKey; // We must avoid ever having to call force_from_dep_node() for a diff --git a/src/librustc/ty/relate.rs b/src/librustc/ty/relate.rs index 247f3fea89d15..2bd38ff70d4c5 100644 --- a/src/librustc/ty/relate.rs +++ b/src/librustc/ty/relate.rs @@ -22,7 +22,7 @@ pub enum Cause { ExistentialRegionBound, // relating an existential region bound } -pub trait TypeRelation<'gcx: 'tcx, 'tcx> : Sized { +pub trait TypeRelation<'gcx: 'tcx, 'tcx>: Sized { fn tcx(&self) -> TyCtxt<'gcx, 'tcx>; /// Returns a static string we can use for printouts. @@ -94,20 +94,26 @@ pub trait TypeRelation<'gcx: 'tcx, 'tcx> : Sized { } pub trait Relate<'tcx>: TypeFoldable<'tcx> { - fn relate<'a, 'gcx, R>(relation: &mut R, a: &Self, b: &Self) - -> RelateResult<'tcx, Self> - where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a; + fn relate<'a, 'gcx, R>(relation: &mut R, a: &Self, b: &Self) -> RelateResult<'tcx, Self> + where + R: TypeRelation<'gcx, 'tcx>, + 'gcx: 'a + 'tcx, + 'tcx: 'a; } /////////////////////////////////////////////////////////////////////////// // Relate impls impl<'tcx> Relate<'tcx> for ty::TypeAndMut<'tcx> { - fn relate<'a, 'gcx, R>(relation: &mut R, - a: &ty::TypeAndMut<'tcx>, - b: &ty::TypeAndMut<'tcx>) - -> RelateResult<'tcx, ty::TypeAndMut<'tcx>> - where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a + fn relate<'a, 'gcx, R>( + relation: &mut R, + a: &ty::TypeAndMut<'tcx>, + b: &ty::TypeAndMut<'tcx>, + ) -> RelateResult<'tcx, ty::TypeAndMut<'tcx>> + where + R: TypeRelation<'gcx, 'tcx>, + 'gcx: 'a + 'tcx, + 'tcx: 'a, { debug!("{}.mts({:?}, {:?})", relation.tag(), @@ -127,12 +133,16 @@ impl<'tcx> Relate<'tcx> for ty::TypeAndMut<'tcx> { } } -pub fn relate_substs<'a, 'gcx, 'tcx, R>(relation: &mut R, - variances: Option<&[ty::Variance]>, - a_subst: SubstsRef<'tcx>, - b_subst: SubstsRef<'tcx>) - -> RelateResult<'tcx, SubstsRef<'tcx>> - where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a +pub fn relate_substs<'a, 'gcx, 'tcx, R>( + relation: &mut R, + variances: Option<&[ty::Variance]>, + a_subst: SubstsRef<'tcx>, + b_subst: SubstsRef<'tcx>, +) -> RelateResult<'tcx, SubstsRef<'tcx>> +where + R: TypeRelation<'gcx, 'tcx>, + 'gcx: 'a + 'tcx, + 'tcx: 'a, { let tcx = relation.tcx(); @@ -145,11 +155,15 @@ pub fn relate_substs<'a, 'gcx, 'tcx, R>(relation: &mut R, } impl<'tcx> Relate<'tcx> for ty::FnSig<'tcx> { - fn relate<'a, 'gcx, R>(relation: &mut R, - a: &ty::FnSig<'tcx>, - b: &ty::FnSig<'tcx>) - -> RelateResult<'tcx, ty::FnSig<'tcx>> - where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a + fn relate<'a, 'gcx, R>( + relation: &mut R, + a: &ty::FnSig<'tcx>, + b: &ty::FnSig<'tcx>, + ) -> RelateResult<'tcx, ty::FnSig<'tcx>> + where + R: TypeRelation<'gcx, 'tcx>, + 'gcx: 'a + 'tcx, + 'tcx: 'a, { let tcx = relation.tcx(); @@ -185,11 +199,15 @@ impl<'tcx> Relate<'tcx> for ty::FnSig<'tcx> { } impl<'tcx> Relate<'tcx> for ast::Unsafety { - fn relate<'a, 'gcx, R>(relation: &mut R, - a: &ast::Unsafety, - b: &ast::Unsafety) - -> RelateResult<'tcx, ast::Unsafety> - where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a + fn relate<'a, 'gcx, R>( + relation: &mut R, + a: &ast::Unsafety, + b: &ast::Unsafety, + ) -> RelateResult<'tcx, ast::Unsafety> + where + R: TypeRelation<'gcx, 'tcx>, + 'gcx: 'a + 'tcx, + 'tcx: 'a, { if a != b { Err(TypeError::UnsafetyMismatch(expected_found(relation, a, b))) @@ -200,11 +218,15 @@ impl<'tcx> Relate<'tcx> for ast::Unsafety { } impl<'tcx> Relate<'tcx> for abi::Abi { - fn relate<'a, 'gcx, R>(relation: &mut R, - a: &abi::Abi, - b: &abi::Abi) - -> RelateResult<'tcx, abi::Abi> - where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a + fn relate<'a, 'gcx, R>( + relation: &mut R, + a: &abi::Abi, + b: &abi::Abi, + ) -> RelateResult<'tcx, abi::Abi> + where + R: TypeRelation<'gcx, 'tcx>, + 'gcx: 'a + 'tcx, + 'tcx: 'a, { if a == b { Ok(*a) @@ -215,11 +237,15 @@ impl<'tcx> Relate<'tcx> for abi::Abi { } impl<'tcx> Relate<'tcx> for ty::ProjectionTy<'tcx> { - fn relate<'a, 'gcx, R>(relation: &mut R, - a: &ty::ProjectionTy<'tcx>, - b: &ty::ProjectionTy<'tcx>) - -> RelateResult<'tcx, ty::ProjectionTy<'tcx>> - where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a + fn relate<'a, 'gcx, R>( + relation: &mut R, + a: &ty::ProjectionTy<'tcx>, + b: &ty::ProjectionTy<'tcx>, + ) -> RelateResult<'tcx, ty::ProjectionTy<'tcx>> + where + R: TypeRelation<'gcx, 'tcx>, + 'gcx: 'a + 'tcx, + 'tcx: 'a, { if a.item_def_id != b.item_def_id { Err(TypeError::ProjectionMismatched( @@ -235,11 +261,15 @@ impl<'tcx> Relate<'tcx> for ty::ProjectionTy<'tcx> { } impl<'tcx> Relate<'tcx> for ty::ExistentialProjection<'tcx> { - fn relate<'a, 'gcx, R>(relation: &mut R, - a: &ty::ExistentialProjection<'tcx>, - b: &ty::ExistentialProjection<'tcx>) - -> RelateResult<'tcx, ty::ExistentialProjection<'tcx>> - where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a + fn relate<'a, 'gcx, R>( + relation: &mut R, + a: &ty::ExistentialProjection<'tcx>, + b: &ty::ExistentialProjection<'tcx>, + ) -> RelateResult<'tcx, ty::ExistentialProjection<'tcx>> + where + R: TypeRelation<'gcx, 'tcx>, + 'gcx: 'a + 'tcx, + 'tcx: 'a, { if a.item_def_id != b.item_def_id { Err(TypeError::ProjectionMismatched( @@ -257,11 +287,15 @@ impl<'tcx> Relate<'tcx> for ty::ExistentialProjection<'tcx> { } impl<'tcx> Relate<'tcx> for Vec> { - fn relate<'a, 'gcx, R>(relation: &mut R, - a: &Vec>, - b: &Vec>) - -> RelateResult<'tcx, Vec>> - where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a + fn relate<'a, 'gcx, R>( + relation: &mut R, + a: &Vec>, + b: &Vec>, + ) -> RelateResult<'tcx, Vec>> + where + R: TypeRelation<'gcx, 'tcx>, + 'gcx: 'a + 'tcx, + 'tcx: 'a, { // To be compatible, `a` and `b` must be for precisely the // same set of traits and item names. We always require that @@ -280,11 +314,15 @@ impl<'tcx> Relate<'tcx> for Vec> { } impl<'tcx> Relate<'tcx> for ty::TraitRef<'tcx> { - fn relate<'a, 'gcx, R>(relation: &mut R, - a: &ty::TraitRef<'tcx>, - b: &ty::TraitRef<'tcx>) - -> RelateResult<'tcx, ty::TraitRef<'tcx>> - where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a + fn relate<'a, 'gcx, R>( + relation: &mut R, + a: &ty::TraitRef<'tcx>, + b: &ty::TraitRef<'tcx>, + ) -> RelateResult<'tcx, ty::TraitRef<'tcx>> + where + R: TypeRelation<'gcx, 'tcx>, + 'gcx: 'a + 'tcx, + 'tcx: 'a, { // Different traits cannot be related if a.def_id != b.def_id { @@ -297,11 +335,15 @@ impl<'tcx> Relate<'tcx> for ty::TraitRef<'tcx> { } impl<'tcx> Relate<'tcx> for ty::ExistentialTraitRef<'tcx> { - fn relate<'a, 'gcx, R>(relation: &mut R, - a: &ty::ExistentialTraitRef<'tcx>, - b: &ty::ExistentialTraitRef<'tcx>) - -> RelateResult<'tcx, ty::ExistentialTraitRef<'tcx>> - where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a + fn relate<'a, 'gcx, R>( + relation: &mut R, + a: &ty::ExistentialTraitRef<'tcx>, + b: &ty::ExistentialTraitRef<'tcx>, + ) -> RelateResult<'tcx, ty::ExistentialTraitRef<'tcx>> + where + R: TypeRelation<'gcx, 'tcx>, + 'gcx: 'a + 'tcx, + 'tcx: 'a, { // Different traits cannot be related if a.def_id != b.def_id { @@ -323,11 +365,15 @@ TupleStructTypeFoldableImpl! { } impl<'tcx> Relate<'tcx> for GeneratorWitness<'tcx> { - fn relate<'a, 'gcx, R>(relation: &mut R, - a: &GeneratorWitness<'tcx>, - b: &GeneratorWitness<'tcx>) - -> RelateResult<'tcx, GeneratorWitness<'tcx>> - where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a + fn relate<'a, 'gcx, R>( + relation: &mut R, + a: &GeneratorWitness<'tcx>, + b: &GeneratorWitness<'tcx>, + ) -> RelateResult<'tcx, GeneratorWitness<'tcx>> + where + R: TypeRelation<'gcx, 'tcx>, + 'gcx: 'a + 'tcx, + 'tcx: 'a, { assert_eq!(a.0.len(), b.0.len()); let tcx = relation.tcx(); @@ -337,11 +383,15 @@ impl<'tcx> Relate<'tcx> for GeneratorWitness<'tcx> { } impl<'tcx> Relate<'tcx> for Ty<'tcx> { - fn relate<'a, 'gcx, R>(relation: &mut R, - a: &Ty<'tcx>, - b: &Ty<'tcx>) - -> RelateResult<'tcx, Ty<'tcx>> - where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a + fn relate<'a, 'gcx, R>( + relation: &mut R, + a: &Ty<'tcx>, + b: &Ty<'tcx>, + ) -> RelateResult<'tcx, Ty<'tcx>> + where + R: TypeRelation<'gcx, 'tcx>, + 'gcx: 'a + 'tcx, + 'tcx: 'a, { relation.tys(a, b) } @@ -350,11 +400,15 @@ impl<'tcx> Relate<'tcx> for Ty<'tcx> { /// The main "type relation" routine. Note that this does not handle /// inference artifacts, so you should filter those out before calling /// it. -pub fn super_relate_tys<'a, 'gcx, 'tcx, R>(relation: &mut R, - a: Ty<'tcx>, - b: Ty<'tcx>) - -> RelateResult<'tcx, Ty<'tcx>> - where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a +pub fn super_relate_tys<'a, 'gcx, 'tcx, R>( + relation: &mut R, + a: Ty<'tcx>, + b: Ty<'tcx>, +) -> RelateResult<'tcx, Ty<'tcx>> +where + R: TypeRelation<'gcx, 'tcx>, + 'gcx: 'a + 'tcx, + 'tcx: 'a, { let tcx = relation.tcx(); debug!("super_relate_tys: a={:?} b={:?}", a, b); @@ -553,10 +607,12 @@ pub fn super_relate_tys<'a, 'gcx, 'tcx, R>(relation: &mut R, pub fn super_relate_consts<'a, 'gcx, 'tcx, R>( relation: &mut R, a: &'tcx ty::Const<'tcx>, - b: &'tcx ty::Const<'tcx> + b: &'tcx ty::Const<'tcx>, ) -> RelateResult<'tcx, &'tcx ty::Const<'tcx>> where - R: TypeRelation<'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a + R: TypeRelation<'gcx, 'tcx>, + 'gcx: 'a + 'tcx, + 'tcx: 'a, { let tcx = relation.tcx(); @@ -632,12 +688,12 @@ where } impl<'tcx> Relate<'tcx> for &'tcx ty::List> { - fn relate<'a, 'gcx, R>(relation: &mut R, - a: &Self, - b: &Self) - -> RelateResult<'tcx, Self> - where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a { - + fn relate<'a, 'gcx, R>(relation: &mut R, a: &Self, b: &Self) -> RelateResult<'tcx, Self> + where + R: TypeRelation<'gcx, 'tcx>, + 'gcx: 'a + 'tcx, + 'tcx: 'a, + { if a.len() != b.len() { return Err(TypeError::ExistentialMismatch(expected_found(relation, a, b))); } @@ -657,11 +713,15 @@ impl<'tcx> Relate<'tcx> for &'tcx ty::List> { } impl<'tcx> Relate<'tcx> for ty::ClosureSubsts<'tcx> { - fn relate<'a, 'gcx, R>(relation: &mut R, - a: &ty::ClosureSubsts<'tcx>, - b: &ty::ClosureSubsts<'tcx>) - -> RelateResult<'tcx, ty::ClosureSubsts<'tcx>> - where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a + fn relate<'a, 'gcx, R>( + relation: &mut R, + a: &ty::ClosureSubsts<'tcx>, + b: &ty::ClosureSubsts<'tcx>, + ) -> RelateResult<'tcx, ty::ClosureSubsts<'tcx>> + where + R: TypeRelation<'gcx, 'tcx>, + 'gcx: 'a + 'tcx, + 'tcx: 'a, { let substs = relate_substs(relation, None, a.substs, b.substs)?; Ok(ty::ClosureSubsts { substs }) @@ -669,11 +729,15 @@ impl<'tcx> Relate<'tcx> for ty::ClosureSubsts<'tcx> { } impl<'tcx> Relate<'tcx> for ty::GeneratorSubsts<'tcx> { - fn relate<'a, 'gcx, R>(relation: &mut R, - a: &ty::GeneratorSubsts<'tcx>, - b: &ty::GeneratorSubsts<'tcx>) - -> RelateResult<'tcx, ty::GeneratorSubsts<'tcx>> - where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a + fn relate<'a, 'gcx, R>( + relation: &mut R, + a: &ty::GeneratorSubsts<'tcx>, + b: &ty::GeneratorSubsts<'tcx>, + ) -> RelateResult<'tcx, ty::GeneratorSubsts<'tcx>> + where + R: TypeRelation<'gcx, 'tcx>, + 'gcx: 'a + 'tcx, + 'tcx: 'a, { let substs = relate_substs(relation, None, a.substs, b.substs)?; Ok(ty::GeneratorSubsts { substs }) @@ -681,55 +745,71 @@ impl<'tcx> Relate<'tcx> for ty::GeneratorSubsts<'tcx> { } impl<'tcx> Relate<'tcx> for SubstsRef<'tcx> { - fn relate<'a, 'gcx, R>(relation: &mut R, - a: &SubstsRef<'tcx>, - b: &SubstsRef<'tcx>) - -> RelateResult<'tcx, SubstsRef<'tcx>> - where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a + fn relate<'a, 'gcx, R>( + relation: &mut R, + a: &SubstsRef<'tcx>, + b: &SubstsRef<'tcx>, + ) -> RelateResult<'tcx, SubstsRef<'tcx>> + where + R: TypeRelation<'gcx, 'tcx>, + 'gcx: 'a + 'tcx, + 'tcx: 'a, { relate_substs(relation, None, a, b) } } impl<'tcx> Relate<'tcx> for ty::Region<'tcx> { - fn relate<'a, 'gcx, R>(relation: &mut R, - a: &ty::Region<'tcx>, - b: &ty::Region<'tcx>) - -> RelateResult<'tcx, ty::Region<'tcx>> - where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a + fn relate<'a, 'gcx, R>( + relation: &mut R, + a: &ty::Region<'tcx>, + b: &ty::Region<'tcx>, + ) -> RelateResult<'tcx, ty::Region<'tcx>> + where + R: TypeRelation<'gcx, 'tcx>, + 'gcx: 'a + 'tcx, + 'tcx: 'a, { relation.regions(*a, *b) } } impl<'tcx> Relate<'tcx> for &'tcx ty::Const<'tcx> { - fn relate<'a, 'gcx, R>(relation: &mut R, - a: &&'tcx ty::Const<'tcx>, - b: &&'tcx ty::Const<'tcx>) - -> RelateResult<'tcx, &'tcx ty::Const<'tcx>> - where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a + fn relate<'a, 'gcx, R>( + relation: &mut R, + a: &&'tcx ty::Const<'tcx>, + b: &&'tcx ty::Const<'tcx>, + ) -> RelateResult<'tcx, &'tcx ty::Const<'tcx>> + where + R: TypeRelation<'gcx, 'tcx>, + 'gcx: 'a + 'tcx, + 'tcx: 'a, { relation.consts(*a, *b) } } impl<'tcx, T: Relate<'tcx>> Relate<'tcx> for ty::Binder { - fn relate<'a, 'gcx, R>(relation: &mut R, - a: &ty::Binder, - b: &ty::Binder) - -> RelateResult<'tcx, ty::Binder> - where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a + fn relate<'a, 'gcx, R>( + relation: &mut R, + a: &ty::Binder, + b: &ty::Binder, + ) -> RelateResult<'tcx, ty::Binder> + where + R: TypeRelation<'gcx, 'tcx>, + 'gcx: 'a + 'tcx, + 'tcx: 'a, { relation.binders(a, b) } } impl<'tcx, T: Relate<'tcx>> Relate<'tcx> for Rc { - fn relate<'a, 'gcx, R>(relation: &mut R, - a: &Rc, - b: &Rc) - -> RelateResult<'tcx, Rc> - where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a + fn relate<'a, 'gcx, R>(relation: &mut R, a: &Rc, b: &Rc) -> RelateResult<'tcx, Rc> + where + R: TypeRelation<'gcx, 'tcx>, + 'gcx: 'a + 'tcx, + 'tcx: 'a, { let a: &T = a; let b: &T = b; @@ -738,11 +818,11 @@ impl<'tcx, T: Relate<'tcx>> Relate<'tcx> for Rc { } impl<'tcx, T: Relate<'tcx>> Relate<'tcx> for Box { - fn relate<'a, 'gcx, R>(relation: &mut R, - a: &Box, - b: &Box) - -> RelateResult<'tcx, Box> - where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a + fn relate<'a, 'gcx, R>(relation: &mut R, a: &Box, b: &Box) -> RelateResult<'tcx, Box> + where + R: TypeRelation<'gcx, 'tcx>, + 'gcx: 'a + 'tcx, + 'tcx: 'a, { let a: &T = a; let b: &T = b; @@ -754,10 +834,12 @@ impl<'tcx> Relate<'tcx> for Kind<'tcx> { fn relate<'a, 'gcx, R>( relation: &mut R, a: &Kind<'tcx>, - b: &Kind<'tcx> + b: &Kind<'tcx>, ) -> RelateResult<'tcx, Kind<'tcx>> where - R: TypeRelation<'gcx, 'tcx>, 'gcx: 'a+'tcx, 'tcx: 'a, + R: TypeRelation<'gcx, 'tcx>, + 'gcx: 'a + 'tcx, + 'tcx: 'a, { match (a.unpack(), b.unpack()) { (UnpackedKind::Lifetime(a_lt), UnpackedKind::Lifetime(b_lt)) => { @@ -786,9 +868,12 @@ impl<'tcx> Relate<'tcx> for ty::TraitPredicate<'tcx> { fn relate<'a, 'gcx, R>( relation: &mut R, a: &ty::TraitPredicate<'tcx>, - b: &ty::TraitPredicate<'tcx> + b: &ty::TraitPredicate<'tcx>, ) -> RelateResult<'tcx, ty::TraitPredicate<'tcx>> - where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'tcx, 'tcx: 'a + where + R: TypeRelation<'gcx, 'tcx>, + 'gcx: 'tcx, + 'tcx: 'a, { Ok(ty::TraitPredicate { trait_ref: relation.relate(&a.trait_ref, &b.trait_ref)?, @@ -802,7 +887,10 @@ impl<'tcx> Relate<'tcx> for ty::ProjectionPredicate<'tcx> { a: &ty::ProjectionPredicate<'tcx>, b: &ty::ProjectionPredicate<'tcx>, ) -> RelateResult<'tcx, ty::ProjectionPredicate<'tcx>> - where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'tcx, 'tcx: 'a + where + R: TypeRelation<'gcx, 'tcx>, + 'gcx: 'tcx, + 'tcx: 'a, { Ok(ty::ProjectionPredicate { projection_ty: relation.relate(&a.projection_ty, &b.projection_ty)?, @@ -815,9 +903,12 @@ impl<'tcx> Relate<'tcx> for traits::WhereClause<'tcx> { fn relate<'a, 'gcx, R>( relation: &mut R, a: &traits::WhereClause<'tcx>, - b: &traits::WhereClause<'tcx> + b: &traits::WhereClause<'tcx>, ) -> RelateResult<'tcx, traits::WhereClause<'tcx>> - where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'tcx, 'tcx: 'a + where + R: TypeRelation<'gcx, 'tcx>, + 'gcx: 'tcx, + 'tcx: 'a, { use crate::traits::WhereClause::*; match (a, b) { @@ -852,9 +943,12 @@ impl<'tcx> Relate<'tcx> for traits::WellFormed<'tcx> { fn relate<'a, 'gcx, R>( relation: &mut R, a: &traits::WellFormed<'tcx>, - b: &traits::WellFormed<'tcx> + b: &traits::WellFormed<'tcx>, ) -> RelateResult<'tcx, traits::WellFormed<'tcx>> - where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'tcx, 'tcx: 'a + where + R: TypeRelation<'gcx, 'tcx>, + 'gcx: 'tcx, + 'tcx: 'a, { use crate::traits::WellFormed::*; match (a, b) { @@ -869,9 +963,12 @@ impl<'tcx> Relate<'tcx> for traits::FromEnv<'tcx> { fn relate<'a, 'gcx, R>( relation: &mut R, a: &traits::FromEnv<'tcx>, - b: &traits::FromEnv<'tcx> + b: &traits::FromEnv<'tcx>, ) -> RelateResult<'tcx, traits::FromEnv<'tcx>> - where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'tcx, 'tcx: 'a + where + R: TypeRelation<'gcx, 'tcx>, + 'gcx: 'tcx, + 'tcx: 'a, { use crate::traits::FromEnv::*; match (a, b) { @@ -886,9 +983,12 @@ impl<'tcx> Relate<'tcx> for traits::DomainGoal<'tcx> { fn relate<'a, 'gcx, R>( relation: &mut R, a: &traits::DomainGoal<'tcx>, - b: &traits::DomainGoal<'tcx> + b: &traits::DomainGoal<'tcx>, ) -> RelateResult<'tcx, traits::DomainGoal<'tcx>> - where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'tcx, 'tcx: 'a + where + R: TypeRelation<'gcx, 'tcx>, + 'gcx: 'tcx, + 'tcx: 'a, { use crate::traits::DomainGoal::*; match (a, b) { @@ -909,9 +1009,12 @@ impl<'tcx> Relate<'tcx> for traits::Goal<'tcx> { fn relate<'a, 'gcx, R>( relation: &mut R, a: &traits::Goal<'tcx>, - b: &traits::Goal<'tcx> + b: &traits::Goal<'tcx>, ) -> RelateResult<'tcx, traits::Goal<'tcx>> - where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'tcx, 'tcx: 'a + where + R: TypeRelation<'gcx, 'tcx>, + 'gcx: 'tcx, + 'tcx: 'a, { use crate::traits::GoalKind::*; match (a, b) { @@ -955,9 +1058,12 @@ impl<'tcx> Relate<'tcx> for traits::Goals<'tcx> { fn relate<'a, 'gcx, R>( relation: &mut R, a: &traits::Goals<'tcx>, - b: &traits::Goals<'tcx> + b: &traits::Goals<'tcx>, ) -> RelateResult<'tcx, traits::Goals<'tcx>> - where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'tcx, 'tcx: 'a + where + R: TypeRelation<'gcx, 'tcx>, + 'gcx: 'tcx, + 'tcx: 'a, { if a.len() != b.len() { return Err(TypeError::Mismatch); @@ -973,9 +1079,12 @@ impl<'tcx> Relate<'tcx> for traits::Clause<'tcx> { fn relate<'a, 'gcx, R>( relation: &mut R, a: &traits::Clause<'tcx>, - b: &traits::Clause<'tcx> + b: &traits::Clause<'tcx>, ) -> RelateResult<'tcx, traits::Clause<'tcx>> - where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'tcx, 'tcx: 'a + where + R: TypeRelation<'gcx, 'tcx>, + 'gcx: 'tcx, + 'tcx: 'a, { use crate::traits::Clause::*; match (a, b) { @@ -998,9 +1107,12 @@ impl<'tcx> Relate<'tcx> for traits::Clauses<'tcx> { fn relate<'a, 'gcx, R>( relation: &mut R, a: &traits::Clauses<'tcx>, - b: &traits::Clauses<'tcx> + b: &traits::Clauses<'tcx>, ) -> RelateResult<'tcx, traits::Clauses<'tcx>> - where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'tcx, 'tcx: 'a + where + R: TypeRelation<'gcx, 'tcx>, + 'gcx: 'tcx, + 'tcx: 'a, { if a.len() != b.len() { return Err(TypeError::Mismatch); @@ -1016,9 +1128,12 @@ impl<'tcx> Relate<'tcx> for traits::ProgramClause<'tcx> { fn relate<'a, 'gcx, R>( relation: &mut R, a: &traits::ProgramClause<'tcx>, - b: &traits::ProgramClause<'tcx> + b: &traits::ProgramClause<'tcx>, ) -> RelateResult<'tcx, traits::ProgramClause<'tcx>> - where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'tcx, 'tcx: 'a + where + R: TypeRelation<'gcx, 'tcx>, + 'gcx: 'tcx, + 'tcx: 'a, { Ok(traits::ProgramClause { goal: relation.relate(&a.goal, &b.goal)?, @@ -1032,9 +1147,12 @@ impl<'tcx> Relate<'tcx> for traits::Environment<'tcx> { fn relate<'a, 'gcx, R>( relation: &mut R, a: &traits::Environment<'tcx>, - b: &traits::Environment<'tcx> + b: &traits::Environment<'tcx>, ) -> RelateResult<'tcx, traits::Environment<'tcx>> - where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'tcx, 'tcx: 'a + where + R: TypeRelation<'gcx, 'tcx>, + 'gcx: 'tcx, + 'tcx: 'a, { Ok(traits::Environment { clauses: relation.relate(&a.clauses, &b.clauses)?, @@ -1043,14 +1161,18 @@ impl<'tcx> Relate<'tcx> for traits::Environment<'tcx> { } impl<'tcx, G> Relate<'tcx> for traits::InEnvironment<'tcx, G> - where G: Relate<'tcx> +where + G: Relate<'tcx>, { fn relate<'a, 'gcx, R>( relation: &mut R, a: &traits::InEnvironment<'tcx, G>, - b: &traits::InEnvironment<'tcx, G> + b: &traits::InEnvironment<'tcx, G>, ) -> RelateResult<'tcx, traits::InEnvironment<'tcx, G>> - where R: TypeRelation<'gcx, 'tcx>, 'gcx: 'tcx, 'tcx: 'a + where + R: TypeRelation<'gcx, 'tcx>, + 'gcx: 'tcx, + 'tcx: 'a, { Ok(traits::InEnvironment { environment: relation.relate(&a.environment, &b.environment)?, @@ -1062,11 +1184,12 @@ impl<'tcx, G> Relate<'tcx> for traits::InEnvironment<'tcx, G> /////////////////////////////////////////////////////////////////////////// // Error handling -pub fn expected_found<'a, 'gcx, 'tcx, R, T>(relation: &mut R, - a: &T, - b: &T) - -> ExpectedFound - where R: TypeRelation<'gcx, 'tcx>, T: Clone, 'gcx: 'a+'tcx, 'tcx: 'a +pub fn expected_found<'a, 'gcx, 'tcx, R, T>(relation: &mut R, a: &T, b: &T) -> ExpectedFound +where + R: TypeRelation<'gcx, 'tcx>, + T: Clone, + 'gcx: 'a + 'tcx, + 'tcx: 'a, { expected_found_bool(relation.a_is_expected(), a, b) } diff --git a/src/librustc/ty/structural_impls.rs b/src/librustc/ty/structural_impls.rs index a6584173fd280..35c61f83fceb2 100644 --- a/src/librustc/ty/structural_impls.rs +++ b/src/librustc/ty/structural_impls.rs @@ -450,8 +450,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::ExistentialPredicate<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::TraitPredicate<'a> { type Lifted = ty::TraitPredicate<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) - -> Option> { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option> { tcx.lift(&self.trait_ref).map(|trait_ref| ty::TraitPredicate { trait_ref, }) @@ -460,8 +459,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::TraitPredicate<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::SubtypePredicate<'a> { type Lifted = ty::SubtypePredicate<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) - -> Option> { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option> { tcx.lift(&(self.a, self.b)).map(|(a, b)| ty::SubtypePredicate { a_is_expected: self.a_is_expected, a, @@ -470,7 +468,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::SubtypePredicate<'a> { } } -impl<'tcx, A: Copy+Lift<'tcx>, B: Copy+Lift<'tcx>> Lift<'tcx> for ty::OutlivesPredicate { +impl<'tcx, A: Copy + Lift<'tcx>, B: Copy + Lift<'tcx>> Lift<'tcx> for ty::OutlivesPredicate { type Lifted = ty::OutlivesPredicate; fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { tcx.lift(&(self.0, self.1)).map(|(a, b)| ty::OutlivesPredicate(a, b)) @@ -479,8 +477,7 @@ impl<'tcx, A: Copy+Lift<'tcx>, B: Copy+Lift<'tcx>> Lift<'tcx> for ty::OutlivesPr impl<'a, 'tcx> Lift<'tcx> for ty::ProjectionTy<'a> { type Lifted = ty::ProjectionTy<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) - -> Option> { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option> { tcx.lift(&self.substs).map(|substs| { ty::ProjectionTy { item_def_id: self.item_def_id, @@ -492,8 +489,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::ProjectionTy<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::ProjectionPredicate<'a> { type Lifted = ty::ProjectionPredicate<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) - -> Option> { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option> { tcx.lift(&(self.projection_ty, self.ty)).map(|(projection_ty, ty)| { ty::ProjectionPredicate { projection_ty, diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs index 5036408af39cc..dc2d96ee8b946 100644 --- a/src/librustc/ty/sty.rs +++ b/src/librustc/ty/sty.rs @@ -335,9 +335,11 @@ impl<'tcx> ClosureSubsts<'tcx> { } #[inline] - pub fn upvar_tys(self, def_id: DefId, tcx: TyCtxt<'_, '_>) -> - impl Iterator> + 'tcx - { + pub fn upvar_tys( + self, + def_id: DefId, + tcx: TyCtxt<'_, '_>, + ) -> impl Iterator> + 'tcx { let SplitClosureSubsts { upvar_kinds, .. } = self.split(def_id, tcx); upvar_kinds.iter().map(|t| { if let UnpackedKind::Type(ty) = t.unpack() { @@ -422,9 +424,11 @@ impl<'tcx> GeneratorSubsts<'tcx> { } #[inline] - pub fn upvar_tys(self, def_id: DefId, tcx: TyCtxt<'_, '_>) -> - impl Iterator> + 'tcx - { + pub fn upvar_tys( + self, + def_id: DefId, + tcx: TyCtxt<'_, '_>, + ) -> impl Iterator> + 'tcx { let SplitGeneratorSubsts { upvar_kinds, .. } = self.split(def_id, tcx); upvar_kinds.iter().map(|t| { if let UnpackedKind::Type(ty) = t.unpack() { @@ -489,7 +493,10 @@ impl<'gcx, 'tcx> GeneratorSubsts<'tcx> { /// out of range. #[inline] pub fn discriminant_for_variant( - &self, def_id: DefId, tcx: TyCtxt<'gcx, 'tcx>, variant_index: VariantIdx + &self, + def_id: DefId, + tcx: TyCtxt<'gcx, 'tcx>, + variant_index: VariantIdx, ) -> Discr<'tcx> { // Generators don't support explicit discriminant values, so they are // the same as the variant index. @@ -501,8 +508,10 @@ impl<'gcx, 'tcx> GeneratorSubsts<'tcx> { /// variant indices. #[inline] pub fn discriminants( - &'tcx self, def_id: DefId, tcx: TyCtxt<'gcx, 'tcx> - ) -> impl Iterator)> + Captures<'gcx> { + &'tcx self, + def_id: DefId, + tcx: TyCtxt<'gcx, 'tcx>, + ) -> impl Iterator)> + Captures<'gcx> { self.variant_range(def_id, tcx).map(move |index| { (index, Discr { val: index.as_usize() as u128, ty: self.discr_ty(tcx) }) }) @@ -533,9 +542,11 @@ impl<'gcx, 'tcx> GeneratorSubsts<'tcx> { /// The locals are grouped by their variant number. Note that some locals may /// be repeated in multiple variants. #[inline] - pub fn state_tys(self, def_id: DefId, tcx: TyCtxt<'gcx, 'tcx>) -> - impl Iterator> + Captures<'gcx>> - { + pub fn state_tys( + self, + def_id: DefId, + tcx: TyCtxt<'gcx, 'tcx>, + ) -> impl Iterator> + Captures<'gcx>> { let layout = tcx.generator_layout(def_id); layout.variant_fields.iter().map(move |variant| { variant.iter().map(move |field| { @@ -547,9 +558,11 @@ impl<'gcx, 'tcx> GeneratorSubsts<'tcx> { /// This is the types of the fields of a generator which are not stored in a /// variant. #[inline] - pub fn prefix_tys(self, def_id: DefId, tcx: TyCtxt<'gcx, 'tcx>) -> - impl Iterator> - { + pub fn prefix_tys( + self, + def_id: DefId, + tcx: TyCtxt<'gcx, 'tcx>, + ) -> impl Iterator> { self.upvar_tys(def_id, tcx) } } @@ -562,9 +575,11 @@ pub enum UpvarSubsts<'tcx> { impl<'tcx> UpvarSubsts<'tcx> { #[inline] - pub fn upvar_tys(self, def_id: DefId, tcx: TyCtxt<'_, '_>) -> - impl Iterator> + 'tcx - { + pub fn upvar_tys( + self, + def_id: DefId, + tcx: TyCtxt<'_, '_>, + ) -> impl Iterator> + 'tcx { let upvar_kinds = match self { UpvarSubsts::Closure(substs) => substs.split(def_id, tcx).upvar_kinds, UpvarSubsts::Generator(substs) => substs.split(def_id, tcx).upvar_kinds, @@ -607,12 +622,10 @@ impl<'gcx, 'tcx> ExistentialPredicate<'tcx> { (AutoTrait(_), _) => Ordering::Greater, } } - } impl<'gcx, 'tcx> Binder> { - pub fn with_self_ty(&self, tcx: TyCtxt<'gcx, 'tcx>, self_ty: Ty<'tcx>) - -> ty::Predicate<'tcx> { + pub fn with_self_ty(&self, tcx: TyCtxt<'gcx, 'tcx>, self_ty: Ty<'tcx>) -> ty::Predicate<'tcx> { use crate::ty::ToPredicate; match *self.skip_binder() { ExistentialPredicate::Trait(tr) => Binder(tr).with_self_ty(tcx, self_ty).to_predicate(), @@ -764,10 +777,11 @@ impl<'tcx> TraitRef<'tcx> { self.substs.types() } - pub fn from_method(tcx: TyCtxt<'_, 'tcx>, - trait_id: DefId, - substs: SubstsRef<'tcx>) - -> ty::TraitRef<'tcx> { + pub fn from_method( + tcx: TyCtxt<'_, 'tcx>, + trait_id: DefId, + substs: SubstsRef<'tcx>, + ) -> ty::TraitRef<'tcx> { let defs = tcx.generics_of(trait_id); ty::TraitRef { @@ -817,9 +831,10 @@ impl<'gcx, 'tcx> ExistentialTraitRef<'tcx> { self.substs.types() } - pub fn erase_self_ty(tcx: TyCtxt<'gcx, 'tcx>, - trait_ref: ty::TraitRef<'tcx>) - -> ty::ExistentialTraitRef<'tcx> { + pub fn erase_self_ty( + tcx: TyCtxt<'gcx, 'tcx>, + trait_ref: ty::TraitRef<'tcx>, + ) -> ty::ExistentialTraitRef<'tcx> { // Assert there is a Self. trait_ref.substs.type_at(0); @@ -833,8 +848,7 @@ impl<'gcx, 'tcx> ExistentialTraitRef<'tcx> { /// we convert the principal trait-ref into a normal trait-ref, /// you must give *some* self type. A common choice is `mk_err()` /// or some placeholder type. - pub fn with_self_ty(&self, tcx: TyCtxt<'gcx, 'tcx>, self_ty: Ty<'tcx>) - -> ty::TraitRef<'tcx> { + pub fn with_self_ty(&self, tcx: TyCtxt<'gcx, 'tcx>, self_ty: Ty<'tcx>) -> ty::TraitRef<'tcx> { // otherwise the escaping vars would be captured by the binder // debug_assert!(!self_ty.has_escaping_bound_vars()); @@ -856,9 +870,7 @@ impl<'tcx> PolyExistentialTraitRef<'tcx> { /// we convert the principal trait-ref into a normal trait-ref, /// you must give *some* self type. A common choice is `mk_err()` /// or some placeholder type. - pub fn with_self_ty(&self, tcx: TyCtxt<'_, 'tcx>, - self_ty: Ty<'tcx>) - -> ty::PolyTraitRef<'tcx> { + pub fn with_self_ty(&self, tcx: TyCtxt<'_, 'tcx>, self_ty: Ty<'tcx>) -> ty::PolyTraitRef<'tcx> { self.map_bound(|trait_ref| trait_ref.with_self_ty(tcx, self_ty)) } } @@ -992,7 +1004,9 @@ impl<'tcx> ProjectionTy<'tcx> { /// Construct a `ProjectionTy` by searching the trait from `trait_ref` for the /// associated item named `item_name`. pub fn from_ref_and_name( - tcx: TyCtxt<'_, '_>, trait_ref: ty::TraitRef<'tcx>, item_name: Ident + tcx: TyCtxt<'_, '_>, + trait_ref: ty::TraitRef<'tcx>, + item_name: Ident, ) -> ProjectionTy<'tcx> { let item_def_id = tcx.associated_items(trait_ref.def_id).find(|item| { item.kind == ty::AssocKind::Type && @@ -1421,10 +1435,11 @@ impl<'tcx, 'gcx> ExistentialProjection<'tcx> { } } - pub fn with_self_ty(&self, tcx: TyCtxt<'gcx, 'tcx>, - self_ty: Ty<'tcx>) - -> ty::ProjectionPredicate<'tcx> - { + pub fn with_self_ty( + &self, + tcx: TyCtxt<'gcx, 'tcx>, + self_ty: Ty<'tcx>, + ) -> ty::ProjectionPredicate<'tcx> { // otherwise the escaping regions would be captured by the binders debug_assert!(!self_ty.has_escaping_bound_vars()); @@ -1439,8 +1454,11 @@ impl<'tcx, 'gcx> ExistentialProjection<'tcx> { } impl<'tcx, 'gcx> PolyExistentialProjection<'tcx> { - pub fn with_self_ty(&self, tcx: TyCtxt<'gcx, 'tcx>, self_ty: Ty<'tcx>) - -> ty::PolyProjectionPredicate<'tcx> { + pub fn with_self_ty( + &self, + tcx: TyCtxt<'gcx, 'tcx>, + self_ty: Ty<'tcx>, + ) -> ty::PolyProjectionPredicate<'tcx> { self.map_bound(|p| p.with_self_ty(tcx, self_ty)) } @@ -2099,7 +2117,7 @@ impl<'gcx, 'tcx> TyS<'tcx> { pub fn discriminant_for_variant( &self, tcx: TyCtxt<'gcx, 'tcx>, - variant_index: VariantIdx + variant_index: VariantIdx, ) -> Option> { match self.sty { TyKind::Adt(adt, _) => Some(adt.discriminant_for_variant(tcx, variant_index)), @@ -2239,11 +2257,7 @@ static_assert_size!(Const<'_>, 40); impl<'tcx> Const<'tcx> { #[inline] - pub fn from_scalar( - tcx: TyCtxt<'_, 'tcx>, - val: Scalar, - ty: Ty<'tcx>, - ) -> &'tcx Self { + pub fn from_scalar(tcx: TyCtxt<'_, 'tcx>, val: Scalar, ty: Ty<'tcx>) -> &'tcx Self { tcx.mk_const(Self { val: ConstValue::Scalar(val), ty, @@ -2279,11 +2293,7 @@ impl<'tcx> Const<'tcx> { } #[inline] - pub fn to_bits( - &self, - tcx: TyCtxt<'_, 'tcx>, - ty: ParamEnvAnd<'tcx, Ty<'tcx>>, - ) -> Option { + pub fn to_bits(&self, tcx: TyCtxt<'_, 'tcx>, ty: ParamEnvAnd<'tcx, Ty<'tcx>>) -> Option { if self.ty != ty.value { return None; } @@ -2324,11 +2334,7 @@ impl<'tcx> Const<'tcx> { } #[inline] - pub fn unwrap_bits( - &self, - tcx: TyCtxt<'_, '_>, - ty: ParamEnvAnd<'tcx, Ty<'tcx>>, - ) -> u128 { + pub fn unwrap_bits(&self, tcx: TyCtxt<'_, '_>, ty: ParamEnvAnd<'tcx, Ty<'tcx>>) -> u128 { self.assert_bits(tcx, ty).unwrap_or_else(|| bug!("expected bits of {}, got {:#?}", ty.value, self)) } diff --git a/src/librustc/ty/subst.rs b/src/librustc/ty/subst.rs index 60579bcf3a5b4..a47217138aa1a 100644 --- a/src/librustc/ty/subst.rs +++ b/src/librustc/ty/subst.rs @@ -194,10 +194,7 @@ impl<'a, 'gcx, 'tcx> InternalSubsts<'tcx> { /// var bound at index `0`. For types, we use a `BoundVar` index equal to /// the type parameter index. For regions, we use the `BoundRegion::BrNamed` /// variant (which has a `DefId`). - pub fn bound_vars_for_item( - tcx: TyCtxt<'gcx, 'tcx>, - def_id: DefId - ) -> SubstsRef<'tcx> { + pub fn bound_vars_for_item(tcx: TyCtxt<'gcx, 'tcx>, def_id: DefId) -> SubstsRef<'tcx> { Self::for_item(tcx, def_id, |param, _| { match param.kind { ty::GenericParamDefKind::Type { .. } => { @@ -233,11 +230,9 @@ impl<'a, 'gcx, 'tcx> InternalSubsts<'tcx> { /// The closures get to observe the `InternalSubsts` as they're /// being built, which can be used to correctly /// substitute defaults of generic parameters. - pub fn for_item(tcx: TyCtxt<'gcx, 'tcx>, - def_id: DefId, - mut mk_kind: F) - -> SubstsRef<'tcx> - where F: FnMut(&ty::GenericParamDef, &[Kind<'tcx>]) -> Kind<'tcx> + pub fn for_item(tcx: TyCtxt<'gcx, 'tcx>, def_id: DefId, mut mk_kind: F) -> SubstsRef<'tcx> + where + F: FnMut(&ty::GenericParamDef, &[Kind<'tcx>]) -> Kind<'tcx>, { let defs = tcx.generics_of(def_id); let count = defs.count(); @@ -246,12 +241,14 @@ impl<'a, 'gcx, 'tcx> InternalSubsts<'tcx> { tcx.intern_substs(&substs) } - pub fn extend_to(&self, - tcx: TyCtxt<'gcx, 'tcx>, - def_id: DefId, - mut mk_kind: F) - -> SubstsRef<'tcx> - where F: FnMut(&ty::GenericParamDef, &[Kind<'tcx>]) -> Kind<'tcx> + pub fn extend_to( + &self, + tcx: TyCtxt<'gcx, 'tcx>, + def_id: DefId, + mut mk_kind: F, + ) -> SubstsRef<'tcx> + where + F: FnMut(&ty::GenericParamDef, &[Kind<'tcx>]) -> Kind<'tcx>, { Self::for_item(tcx, def_id, |param, substs| { self.get(param.index as usize) @@ -260,11 +257,13 @@ impl<'a, 'gcx, 'tcx> InternalSubsts<'tcx> { }) } - fn fill_item(substs: &mut SmallVec<[Kind<'tcx>; 8]>, - tcx: TyCtxt<'gcx, 'tcx>, - defs: &ty::Generics, - mk_kind: &mut F) - where F: FnMut(&ty::GenericParamDef, &[Kind<'tcx>]) -> Kind<'tcx> + fn fill_item( + substs: &mut SmallVec<[Kind<'tcx>; 8]>, + tcx: TyCtxt<'gcx, 'tcx>, + defs: &ty::Generics, + mk_kind: &mut F, + ) where + F: FnMut(&ty::GenericParamDef, &[Kind<'tcx>]) -> Kind<'tcx>, { if let Some(def_id) = defs.parent { let parent_defs = tcx.generics_of(def_id); @@ -372,16 +371,17 @@ impl<'a, 'gcx, 'tcx> InternalSubsts<'tcx> { /// in a different item, with `target_substs` as the base for /// the target impl/trait, with the source child-specific /// parameters (e.g., method parameters) on top of that base. - pub fn rebase_onto(&self, tcx: TyCtxt<'gcx, 'tcx>, - source_ancestor: DefId, - target_substs: SubstsRef<'tcx>) - -> SubstsRef<'tcx> { + pub fn rebase_onto( + &self, + tcx: TyCtxt<'gcx, 'tcx>, + source_ancestor: DefId, + target_substs: SubstsRef<'tcx>, + ) -> SubstsRef<'tcx> { let defs = tcx.generics_of(source_ancestor); tcx.mk_substs(target_substs.iter().chain(&self[defs.params.len()..]).cloned()) } - pub fn truncate_to(&self, tcx: TyCtxt<'gcx, 'tcx>, generics: &ty::Generics) - -> SubstsRef<'tcx> { + pub fn truncate_to(&self, tcx: TyCtxt<'gcx, 'tcx>, generics: &ty::Generics) -> SubstsRef<'tcx> { tcx.mk_substs(self.iter().take(generics.count()).cloned()) } } @@ -414,23 +414,25 @@ impl<'tcx> serialize::UseSpecializedDecodable for SubstsRef<'tcx> {} // there is more information available (for better errors). pub trait Subst<'tcx>: Sized { - fn subst<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>, - substs: &[Kind<'tcx>]) -> Self { + fn subst<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>, substs: &[Kind<'tcx>]) -> Self { self.subst_spanned(tcx, substs, None) } - fn subst_spanned<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>, - substs: &[Kind<'tcx>], - span: Option) - -> Self; + fn subst_spanned<'gcx>( + &self, + tcx: TyCtxt<'gcx, 'tcx>, + substs: &[Kind<'tcx>], + span: Option, + ) -> Self; } -impl<'tcx, T:TypeFoldable<'tcx>> Subst<'tcx> for T { - fn subst_spanned<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>, - substs: &[Kind<'tcx>], - span: Option) - -> T - { +impl<'tcx, T: TypeFoldable<'tcx>> Subst<'tcx> for T { + fn subst_spanned<'gcx>( + &self, + tcx: TyCtxt<'gcx, 'tcx>, + substs: &[Kind<'tcx>], + span: Option, + ) -> T { let mut folder = SubstFolder { tcx, substs, span, @@ -444,7 +446,7 @@ impl<'tcx, T:TypeFoldable<'tcx>> Subst<'tcx> for T { /////////////////////////////////////////////////////////////////////////// // The actual substitution engine itself is a type folder. -struct SubstFolder<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { +struct SubstFolder<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { tcx: TyCtxt<'gcx, 'tcx>, substs: &'a [Kind<'tcx>], diff --git a/src/librustc/ty/trait_def.rs b/src/librustc/ty/trait_def.rs index 9c82082f8f5c7..1f99d97605c79 100644 --- a/src/librustc/ty/trait_def.rs +++ b/src/librustc/ty/trait_def.rs @@ -64,9 +64,11 @@ impl<'gcx, 'tcx> TraitDef { } } - pub fn ancestors(&self, tcx: TyCtxt<'gcx, 'tcx>, - of_impl: DefId) - -> specialization_graph::Ancestors<'gcx> { + pub fn ancestors( + &self, + tcx: TyCtxt<'gcx, 'tcx>, + of_impl: DefId, + ) -> specialization_graph::Ancestors<'gcx> { specialization_graph::ancestors(tcx, self.def_id, of_impl) } } @@ -148,9 +150,10 @@ impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> { } // Query provider for `trait_impls_of`. -pub(super) fn trait_impls_of_provider<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - trait_id: DefId) - -> &'tcx TraitImpls { +pub(super) fn trait_impls_of_provider<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + trait_id: DefId, +) -> &'tcx TraitImpls { let mut impls = TraitImpls::default(); { diff --git a/src/librustc/ty/util.rs b/src/librustc/ty/util.rs index a88b3eaa586a3..57319db63404a 100644 --- a/src/librustc/ty/util.rs +++ b/src/librustc/ty/util.rs @@ -105,8 +105,11 @@ impl<'tcx> Discr<'tcx> { pub trait IntTypeExt { fn to_ty<'gcx, 'tcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Ty<'tcx>; - fn disr_incr<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx>, val: Option>) - -> Option>; + fn disr_incr<'tcx>( + &self, + tcx: TyCtxt<'tcx, 'tcx>, + val: Option>, + ) -> Option>; fn initial_discriminant<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx>) -> Discr<'tcx>; } @@ -178,10 +181,11 @@ pub enum Representability { } impl<'tcx> ty::ParamEnv<'tcx> { - pub fn can_type_implement_copy(self, - tcx: TyCtxt<'tcx, 'tcx>, - self_type: Ty<'tcx>) - -> Result<(), CopyImplementationError<'tcx>> { + pub fn can_type_implement_copy( + self, + tcx: TyCtxt<'tcx, 'tcx>, + self_type: Ty<'tcx>, + ) -> Result<(), CopyImplementationError<'tcx>> { // FIXME: (@jroesch) float this code up tcx.infer_ctxt().enter(|infcx| { let (adt, substs) = match self_type.sty { @@ -695,11 +699,12 @@ impl<'tcx> ty::TyS<'tcx> { /// does copies even when the type actually doesn't satisfy the /// full requirements for the `Copy` trait (cc #29149) -- this /// winds up being reported as an error during NLL borrow check. - pub fn is_copy_modulo_regions(&'tcx self, - tcx: TyCtxt<'tcx, 'tcx>, - param_env: ty::ParamEnv<'tcx>, - span: Span) - -> bool { + pub fn is_copy_modulo_regions( + &'tcx self, + tcx: TyCtxt<'tcx, 'tcx>, + param_env: ty::ParamEnv<'tcx>, + span: Span, + ) -> bool { tcx.at(span).is_copy_raw(param_env.and(self)) } @@ -709,10 +714,11 @@ impl<'tcx> ty::TyS<'tcx> { /// over-approximation in generic contexts, where one can have /// strange rules like `>::Bar: Sized` that /// actually carry lifetime requirements. - pub fn is_sized(&'tcx self, - tcx_at: TyCtxtAt<'tcx, 'tcx>, - param_env: ty::ParamEnv<'tcx>)-> bool - { + pub fn is_sized( + &'tcx self, + tcx_at: TyCtxtAt<'tcx, 'tcx>, + param_env: ty::ParamEnv<'tcx>, + ) -> bool { tcx_at.is_sized_raw(param_env.and(self)) } @@ -723,11 +729,12 @@ impl<'tcx> ty::TyS<'tcx> { /// optimization as well as the rules around static values. Note /// that the `Freeze` trait is not exposed to end users and is /// effectively an implementation detail. - pub fn is_freeze(&'tcx self, - tcx: TyCtxt<'tcx, 'tcx>, - param_env: ty::ParamEnv<'tcx>, - span: Span)-> bool - { + pub fn is_freeze( + &'tcx self, + tcx: TyCtxt<'tcx, 'tcx>, + param_env: ty::ParamEnv<'tcx>, + span: Span, + ) -> bool { tcx.at(span).is_freeze_raw(param_env.and(self)) } @@ -738,10 +745,7 @@ impl<'tcx> ty::TyS<'tcx> { /// (Note that this implies that if `ty` has a destructor attached, /// then `needs_drop` will definitely return `true` for `ty`.) #[inline] - pub fn needs_drop(&'tcx self, - tcx: TyCtxt<'tcx, 'tcx>, - param_env: ty::ParamEnv<'tcx>) - -> bool { + pub fn needs_drop(&'tcx self, tcx: TyCtxt<'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>) -> bool { tcx.needs_drop_raw(param_env.and(self)).0 } @@ -760,11 +764,7 @@ impl<'tcx> ty::TyS<'tcx> { /// Check whether a type is representable. This means it cannot contain unboxed /// structural recursion. This check is needed for structs and enums. - pub fn is_representable(&'tcx self, - tcx: TyCtxt<'tcx, 'tcx>, - sp: Span) - -> Representability - { + pub fn is_representable(&'tcx self, tcx: TyCtxt<'tcx, 'tcx>, sp: Span) -> Representability { // Iterate until something non-representable is found fn fold_repr>(iter: It) -> Representability { iter.fold(Representability::Representable, |r1, r2| { @@ -779,12 +779,12 @@ impl<'tcx> ty::TyS<'tcx> { } fn are_inner_types_recursive<'tcx>( - tcx: TyCtxt<'tcx, 'tcx>, sp: Span, + tcx: TyCtxt<'tcx, 'tcx>, + sp: Span, seen: &mut Vec>, representable_cache: &mut FxHashMap, Representability>, - ty: Ty<'tcx>) - -> Representability - { + ty: Ty<'tcx>, + ) -> Representability { match ty.sty { Tuple(ref ts) => { // Find non representable @@ -843,8 +843,8 @@ impl<'tcx> ty::TyS<'tcx> { sp: Span, seen: &mut Vec>, representable_cache: &mut FxHashMap, Representability>, - ty: Ty<'tcx>) -> Representability - { + ty: Ty<'tcx>, + ) -> Representability { debug!("is_type_structurally_recursive: {:?} {:?}", ty, sp); if let Some(representability) = representable_cache.get(ty) { debug!("is_type_structurally_recursive: {:?} {:?} - (cached) {:?}", @@ -864,8 +864,8 @@ impl<'tcx> ty::TyS<'tcx> { sp: Span, seen: &mut Vec>, representable_cache: &mut FxHashMap, Representability>, - ty: Ty<'tcx>) -> Representability - { + ty: Ty<'tcx>, + ) -> Representability { match ty.sty { Adt(def, _) => { { @@ -937,10 +937,7 @@ impl<'tcx> ty::TyS<'tcx> { } } -fn is_copy_raw<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - query: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) - -> bool -{ +fn is_copy_raw<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, query: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool { let (param_env, ty) = query.into_parts(); let trait_def_id = tcx.require_lang_item(lang_items::CopyTraitLangItem); tcx.infer_ctxt() @@ -953,10 +950,7 @@ fn is_copy_raw<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, )) } -fn is_sized_raw<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - query: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) - -> bool -{ +fn is_sized_raw<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, query: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool { let (param_env, ty) = query.into_parts(); let trait_def_id = tcx.require_lang_item(lang_items::SizedTraitLangItem); tcx.infer_ctxt() @@ -969,10 +963,7 @@ fn is_sized_raw<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, )) } -fn is_freeze_raw<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - query: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) - -> bool -{ +fn is_freeze_raw<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, query: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool { let (param_env, ty) = query.into_parts(); let trait_def_id = tcx.require_lang_item(lang_items::FreezeTraitLangItem); tcx.infer_ctxt() @@ -988,10 +979,10 @@ fn is_freeze_raw<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, #[derive(Clone, HashStable)] pub struct NeedsDrop(pub bool); -fn needs_drop_raw<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - query: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) - -> NeedsDrop -{ +fn needs_drop_raw<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + query: ty::ParamEnvAnd<'tcx, Ty<'tcx>>, +) -> NeedsDrop { let (param_env, ty) = query.into_parts(); let needs_drop = |ty: Ty<'tcx>| -> bool { diff --git a/src/librustc/ty/wf.rs b/src/librustc/ty/wf.rs index f0378b2e084df..1ed88f395a943 100644 --- a/src/librustc/ty/wf.rs +++ b/src/librustc/ty/wf.rs @@ -510,9 +510,8 @@ impl<'a, 'gcx, 'tcx> WfPredicates<'a, 'gcx, 'tcx> { /// `ty::required_region_bounds`, see that for more information. pub fn object_region_bounds<'gcx, 'tcx>( tcx: TyCtxt<'gcx, 'tcx>, - existential_predicates: ty::Binder<&'tcx ty::List>>) - -> Vec> -{ + existential_predicates: ty::Binder<&'tcx ty::List>>, +) -> Vec> { // Since we don't actually *know* the self type for an object, // this "open(err)" serves as a kind of dummy standin -- basically // a placeholder type. diff --git a/src/librustc_borrowck/borrowck/check_loans.rs b/src/librustc_borrowck/borrowck/check_loans.rs index 94219650a8e82..45a92daab0dfb 100644 --- a/src/librustc_borrowck/borrowck/check_loans.rs +++ b/src/librustc_borrowck/borrowck/check_loans.rs @@ -179,11 +179,13 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for CheckLoanCtxt<'a, 'tcx> { fn decl_without_init(&mut self, _id: hir::HirId, _span: Span) { } } -pub fn check_loans<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, - dfcx_loans: &LoanDataFlow<'tcx>, - move_data: &move_data::FlowedMoveData<'tcx>, - all_loans: &[Loan<'tcx>], - body: &hir::Body) { +pub fn check_loans<'a, 'tcx>( + bccx: &BorrowckCtxt<'a, 'tcx>, + dfcx_loans: &LoanDataFlow<'tcx>, + move_data: &move_data::FlowedMoveData<'tcx>, + all_loans: &[Loan<'tcx>], + body: &hir::Body, +) { debug!("check_loans(body id={})", body.value.hir_id); let def_id = bccx.tcx.hir().body_owner_def_id(body.id()); diff --git a/src/librustc_borrowck/borrowck/mod.rs b/src/librustc_borrowck/borrowck/mod.rs index aa94e100f334f..e8644d2416db7 100644 --- a/src/librustc_borrowck/borrowck/mod.rs +++ b/src/librustc_borrowck/borrowck/mod.rs @@ -73,9 +73,7 @@ pub struct AnalysisData<'tcx> { pub move_data: move_data::FlowedMoveData<'tcx>, } -fn borrowck<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, owner_def_id: DefId) - -> &'tcx BorrowCheckResult -{ +fn borrowck<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, owner_def_id: DefId) -> &'tcx BorrowCheckResult { assert!(tcx.use_ast_borrowck() || tcx.migrate_borrowck()); debug!("borrowck(body_owner_def_id={:?})", owner_def_id); @@ -141,12 +139,14 @@ fn borrowck<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, owner_def_id: DefId) }) } -fn build_borrowck_dataflow_data<'a, 'c, 'tcx, F>(this: &mut BorrowckCtxt<'a, 'tcx>, - force_analysis: bool, - body_id: hir::BodyId, - get_cfg: F) - -> Option> - where F: FnOnce(&mut BorrowckCtxt<'a, 'tcx>) -> &'c cfg::CFG +fn build_borrowck_dataflow_data<'a, 'c, 'tcx, F>( + this: &mut BorrowckCtxt<'a, 'tcx>, + force_analysis: bool, + body_id: hir::BodyId, + get_cfg: F, +) -> Option> +where + F: FnOnce(&mut BorrowckCtxt<'a, 'tcx>) -> &'c cfg::CFG, { // Check the body of fn items. let (all_loans, move_data) = @@ -195,9 +195,8 @@ fn build_borrowck_dataflow_data<'a, 'c, 'tcx, F>(this: &mut BorrowckCtxt<'a, 'tc pub fn build_borrowck_dataflow_data_for_fn<'a, 'tcx>( tcx: TyCtxt<'tcx, 'tcx>, body_id: hir::BodyId, - cfg: &cfg::CFG) - -> (BorrowckCtxt<'a, 'tcx>, AnalysisData<'tcx>) -{ + cfg: &cfg::CFG, +) -> (BorrowckCtxt<'a, 'tcx>, AnalysisData<'tcx>) { let owner_id = tcx.hir().body_owner(body_id); let owner_def_id = tcx.hir().local_def_id(owner_id); let tables = tcx.typeck_tables_of(owner_def_id); @@ -238,7 +237,6 @@ pub struct BorrowckCtxt<'a, 'tcx> { signalled_any_error: Cell, } - impl BorrowckCtxt<'_, 'tcx> { fn signal_error(&self) { self.signalled_any_error.set(SignalledError::SawSomeError); @@ -390,8 +388,7 @@ pub enum LoanPathElem<'tcx> { LpInterior(Option, InteriorKind), } -fn closure_to_block(closure_id: LocalDefId, - tcx: TyCtxt<'_, '_>) -> HirId { +fn closure_to_block(closure_id: LocalDefId, tcx: TyCtxt<'_, '_>) -> HirId { let closure_id = tcx.hir().local_def_id_to_node_id(closure_id); match tcx.hir().get(closure_id) { Node::Expr(expr) => match expr.node { diff --git a/src/librustc_borrowck/borrowck/move_data.rs b/src/librustc_borrowck/borrowck/move_data.rs index 81d5a49a805c9..38bf590a36fb8 100644 --- a/src/librustc_borrowck/borrowck/move_data.rs +++ b/src/librustc_borrowck/borrowck/move_data.rs @@ -47,7 +47,7 @@ pub struct FlowedMoveData<'tcx> { // We could (and maybe should, for efficiency) combine both move // and assign data flow into one, but this way it's easier to // distinguish the bits that correspond to moves and assignments. - pub dfcx_assign: AssignDataFlow<'tcx> + pub dfcx_assign: AssignDataFlow<'tcx>, } /// Index into `MoveData.paths`, used like a pointer @@ -223,8 +223,7 @@ impl MoveData<'tcx> { /// Returns the existing move path index for `lp`, if any, and otherwise adds a new index for /// `lp` and any of its base paths that do not yet have an index. - pub fn move_path(&self, tcx: TyCtxt<'tcx, 'tcx>, - lp: Rc>) -> MovePathIndex { + pub fn move_path(&self, tcx: TyCtxt<'tcx, 'tcx>, lp: Rc>) -> MovePathIndex { if let Some(&index) = self.path_map.borrow().get(&lp) { return index; } @@ -311,10 +310,13 @@ impl MoveData<'tcx> { } /// Adds a new move entry for a move of `lp` that occurs at location `id` with kind `kind`. - pub fn add_move(&self, tcx: TyCtxt<'tcx, 'tcx>, - orig_lp: Rc>, - id: hir::ItemLocalId, - kind: MoveKind) { + pub fn add_move( + &self, + tcx: TyCtxt<'tcx, 'tcx>, + orig_lp: Rc>, + id: hir::ItemLocalId, + kind: MoveKind, + ) { // Moving one union field automatically moves all its fields. Also move siblings of // all parent union fields, moves do not propagate upwards automatically. let mut lp = orig_lp.clone(); @@ -340,10 +342,13 @@ impl MoveData<'tcx> { self.add_move_helper(tcx, orig_lp, id, kind); } - fn add_move_helper(&self, tcx: TyCtxt<'tcx, 'tcx>, - lp: Rc>, - id: hir::ItemLocalId, - kind: MoveKind) { + fn add_move_helper( + &self, + tcx: TyCtxt<'tcx, 'tcx>, + lp: Rc>, + id: hir::ItemLocalId, + kind: MoveKind, + ) { debug!("add_move(lp={:?}, id={:?}, kind={:?})", lp, id, @@ -365,10 +370,13 @@ impl MoveData<'tcx> { /// Adds a new record for an assignment to `lp` that occurs at location `id` with the given /// `span`. - pub fn add_assignment(&self, tcx: TyCtxt<'tcx, 'tcx>, - lp: Rc>, - assign_id: hir::ItemLocalId, - span: Span) { + pub fn add_assignment( + &self, + tcx: TyCtxt<'tcx, 'tcx>, + lp: Rc>, + assign_id: hir::ItemLocalId, + span: Span, + ) { // Assigning to one union field automatically assigns to all its fields. if let LpExtend(ref base_lp, mutbl, LpInterior(opt_variant_id, interior)) = lp.kind { if let ty::Adt(adt_def, _) = base_lp.ty.sty { @@ -395,10 +403,13 @@ impl MoveData<'tcx> { self.add_assignment_helper(tcx, lp, assign_id, span); } - fn add_assignment_helper(&self, tcx: TyCtxt<'tcx, 'tcx>, - lp: Rc>, - assign_id: hir::ItemLocalId, - span: Span) { + fn add_assignment_helper( + &self, + tcx: TyCtxt<'tcx, 'tcx>, + lp: Rc>, + assign_id: hir::ItemLocalId, + span: Span, + ) { debug!("add_assignment(lp={:?}, assign_id={:?}", lp, assign_id); let path_index = self.move_path(tcx, lp.clone()); @@ -427,10 +438,12 @@ impl MoveData<'tcx> { /// Moves are generated by moves and killed by assignments and /// scoping. Assignments are generated by assignment to variables and /// killed by scoping. See `README.md` for more details. - fn add_gen_kills(&self, - bccx: &BorrowckCtxt<'_, 'tcx>, - dfcx_moves: &mut MoveDataFlow<'_>, - dfcx_assign: &mut AssignDataFlow<'_>) { + fn add_gen_kills( + &self, + bccx: &BorrowckCtxt<'_, 'tcx>, + dfcx_moves: &mut MoveDataFlow<'_>, + dfcx_assign: &mut AssignDataFlow<'_>, + ) { for (i, the_move) in self.moves.borrow().iter().enumerate() { dfcx_moves.add_gen(the_move.id, i); } @@ -534,11 +547,13 @@ impl MoveData<'tcx> { ret } - fn kill_moves(&self, - path: MovePathIndex, - kill_id: hir::ItemLocalId, - kill_kind: KillFrom, - dfcx_moves: &mut MoveDataFlow<'_>) { + fn kill_moves( + &self, + path: MovePathIndex, + kill_id: hir::ItemLocalId, + kill_kind: KillFrom, + dfcx_moves: &mut MoveDataFlow<'_>, + ) { // We can only perform kills for paths that refer to a unique location, // since otherwise we may kill a move from one location with an // assignment referring to another location. @@ -556,11 +571,12 @@ impl MoveData<'tcx> { } impl<'tcx> FlowedMoveData<'tcx> { - pub fn new(move_data: MoveData<'tcx>, - bccx: &BorrowckCtxt<'_, 'tcx>, - cfg: &cfg::CFG, - body: &hir::Body) - -> FlowedMoveData<'tcx> { + pub fn new( + move_data: MoveData<'tcx>, + bccx: &BorrowckCtxt<'_, 'tcx>, + cfg: &cfg::CFG, + body: &hir::Body, + ) -> FlowedMoveData<'tcx> { let tcx = bccx.tcx; let mut dfcx_moves = diff --git a/src/librustc_borrowck/dataflow.rs b/src/librustc_borrowck/dataflow.rs index 4e49fa57cb99c..a42fbb72c03a8 100644 --- a/src/librustc_borrowck/dataflow.rs +++ b/src/librustc_borrowck/dataflow.rs @@ -51,7 +51,6 @@ pub struct DataFlowContext<'tcx, O> { // `id_range`, there is a range of words equal to `words_per_id`. // So, to access the bits for any given id, you take a slice of // the full vector (see the method `compute_id_range()`). - /// bits generated as we exit the cfg node. Updated by `add_gen()`. gens: Vec, @@ -82,7 +81,7 @@ pub trait DataFlowOperator : BitwiseOperator { struct PropagationContext<'a, 'tcx, O> { dfcx: &'a mut DataFlowContext<'tcx, O>, - changed: bool + changed: bool, } fn get_cfg_indices<'a>(id: hir::ItemLocalId, @@ -98,7 +97,7 @@ impl<'tcx, O: DataFlowOperator> DataFlowContext<'tcx, O> { } } -impl<'tcx, O:DataFlowOperator> pprust::PpAnn for DataFlowContext<'tcx, O> { +impl<'tcx, O: DataFlowOperator> pprust::PpAnn for DataFlowContext<'tcx, O> { fn nested(&self, state: &mut pprust::State<'_>, nested: pprust::Nested) -> io::Result<()> { pprust::PpAnn::nested(self.tcx.hir(), state, nested) } @@ -225,12 +224,14 @@ pub enum KillFrom { } impl<'tcx, O: DataFlowOperator> DataFlowContext<'tcx, O> { - pub fn new(tcx: TyCtxt<'tcx, 'tcx>, - analysis_name: &'static str, - body: Option<&hir::Body>, - cfg: &cfg::CFG, - oper: O, - bits_per_id: usize) -> DataFlowContext<'tcx, O> { + pub fn new( + tcx: TyCtxt<'tcx, 'tcx>, + analysis_name: &'static str, + body: Option<&hir::Body>, + cfg: &cfg::CFG, + oper: O, + bits_per_id: usize, + ) -> DataFlowContext<'tcx, O> { let usize_bits = mem::size_of::() * 8; let words_per_id = (bits_per_id + usize_bits - 1) / usize_bits; let num_nodes = cfg.graph.all_nodes().len(); diff --git a/src/librustc_borrowck/graphviz.rs b/src/librustc_borrowck/graphviz.rs index 69c0aa0c6f766..1f2480666959e 100644 --- a/src/librustc_borrowck/graphviz.rs +++ b/src/librustc_borrowck/graphviz.rs @@ -61,11 +61,14 @@ impl<'a, 'tcx> DataflowLabeller<'a, 'tcx> { } } - fn build_set(&self, - e: EntryOrExit, - cfgidx: CFGIndex, - dfcx: &DataFlowContext<'tcx, O>, - mut to_lp: F) -> String where + fn build_set( + &self, + e: EntryOrExit, + cfgidx: CFGIndex, + dfcx: &DataFlowContext<'tcx, O>, + mut to_lp: F, + ) -> String + where F: FnMut(usize) -> Rc>, { let mut saw_some = false; diff --git a/src/librustc_codegen_llvm/base.rs b/src/librustc_codegen_llvm/base.rs index 60c141ab566da..c552cc9223862 100644 --- a/src/librustc_codegen_llvm/base.rs +++ b/src/librustc_codegen_llvm/base.rs @@ -44,7 +44,7 @@ use crate::value::Value; pub fn write_compressed_metadata<'a, 'gcx>( tcx: TyCtxt<'gcx, 'gcx>, metadata: &EncodedMetadata, - llvm_module: &mut ModuleLlvm + llvm_module: &mut ModuleLlvm, ) { use std::io::Write; use flate2::Compression; diff --git a/src/librustc_codegen_llvm/context.rs b/src/librustc_codegen_llvm/context.rs index d0b2b6846f788..0a780fecf41de 100644 --- a/src/librustc_codegen_llvm/context.rs +++ b/src/librustc_codegen_llvm/context.rs @@ -47,8 +47,8 @@ pub struct CodegenCx<'ll, 'tcx: 'll> { /// Cache instances of monomorphic and polymorphic items pub instances: RefCell, &'ll Value>>, /// Cache generated vtables - pub vtables: RefCell, Option>), &'ll Value>>, + pub vtables: + RefCell, Option>), &'ll Value>>, /// Cache of constant strings, pub const_cstr_cache: RefCell>, @@ -207,10 +207,11 @@ pub unsafe fn create_module( } impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> { - crate fn new(tcx: TyCtxt<'tcx, 'tcx>, - codegen_unit: Arc>, - llvm_module: &'ll crate::ModuleLlvm) - -> Self { + crate fn new( + tcx: TyCtxt<'tcx, 'tcx>, + codegen_unit: Arc>, + llvm_module: &'ll crate::ModuleLlvm, + ) -> Self { // An interesting part of Windows which MSVC forces our hand on (and // apparently MinGW didn't) is the usage of `dllimport` and `dllexport` // attributes in LLVM IR as well as native dependencies (in C these diff --git a/src/librustc_codegen_llvm/debuginfo/metadata.rs b/src/librustc_codegen_llvm/debuginfo/metadata.rs index 4fad236c32dd3..c4d9f79e8d301 100644 --- a/src/librustc_codegen_llvm/debuginfo/metadata.rs +++ b/src/librustc_codegen_llvm/debuginfo/metadata.rs @@ -894,10 +894,11 @@ fn pointer_type_metadata( } } -pub fn compile_unit_metadata(tcx: TyCtxt<'_, '_>, - codegen_unit_name: &str, - debug_context: &CrateDebugContext<'ll, '_>) - -> &'ll DIDescriptor { +pub fn compile_unit_metadata( + tcx: TyCtxt<'_, '_>, + codegen_unit_name: &str, + debug_context: &CrateDebugContext<'ll, '_>, +) -> &'ll DIDescriptor { let mut name_in_debuginfo = match tcx.sess.local_crate_source_file { Some(ref path) => path.clone(), None => PathBuf::from(&*tcx.crate_name(LOCAL_CRATE).as_str()), diff --git a/src/librustc_codegen_llvm/lib.rs b/src/librustc_codegen_llvm/lib.rs index 17a6fe090b905..2e922ad5fcd3b 100644 --- a/src/librustc_codegen_llvm/lib.rs +++ b/src/librustc_codegen_llvm/lib.rs @@ -111,7 +111,7 @@ impl ExtraBackendMethods for LlvmCodegenBackend { &self, tcx: TyCtxt<'gcx, 'gcx>, metadata: &EncodedMetadata, - llvm_module: &mut ModuleLlvm + llvm_module: &mut ModuleLlvm, ) { base::write_compressed_metadata(tcx, metadata, llvm_module) } @@ -119,7 +119,7 @@ impl ExtraBackendMethods for LlvmCodegenBackend { &self, tcx: TyCtxt<'gcx, 'gcx>, mods: &mut ModuleLlvm, - kind: AllocatorKind + kind: AllocatorKind, ) { unsafe { allocator::codegen(tcx, mods, kind) } } @@ -289,7 +289,7 @@ impl CodegenBackend for LlvmCodegenBackend { tcx: TyCtxt<'tcx, 'tcx>, metadata: EncodedMetadata, need_metadata_module: bool, - rx: mpsc::Receiver> + rx: mpsc::Receiver>, ) -> Box { box rustc_codegen_ssa::base::codegen_crate( LlvmCodegenBackend(()), tcx, metadata, need_metadata_module, rx) diff --git a/src/librustc_codegen_ssa/back/symbol_export.rs b/src/librustc_codegen_ssa/back/symbol_export.rs index e805cb0003f05..e1693b7c2ef1b 100644 --- a/src/librustc_codegen_ssa/back/symbol_export.rs +++ b/src/librustc_codegen_ssa/back/symbol_export.rs @@ -46,10 +46,10 @@ pub fn crates_export_threshold(crate_types: &[config::CrateType]) -> SymbolExpor } } -fn reachable_non_generics_provider<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - cnum: CrateNum) - -> &'tcx DefIdMap -{ +fn reachable_non_generics_provider<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + cnum: CrateNum, +) -> &'tcx DefIdMap { assert_eq!(cnum, LOCAL_CRATE); if !tcx.sess.opts.output_types.should_codegen() { @@ -157,9 +157,7 @@ fn reachable_non_generics_provider<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, tcx.arena.alloc(reachable_non_generics) } -fn is_reachable_non_generic_provider_local<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - def_id: DefId) - -> bool { +fn is_reachable_non_generic_provider_local<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> bool { let export_threshold = threshold(tcx); if let Some(&level) = tcx.reachable_non_generics(def_id.krate).get(&def_id) { @@ -169,17 +167,14 @@ fn is_reachable_non_generic_provider_local<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, } } -fn is_reachable_non_generic_provider_extern<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - def_id: DefId) - -> bool { +fn is_reachable_non_generic_provider_extern<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> bool { tcx.reachable_non_generics(def_id.krate).contains_key(&def_id) } -fn exported_symbols_provider_local<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - cnum: CrateNum) - -> Arc, - SymbolExportLevel)>> -{ +fn exported_symbols_provider_local<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + cnum: CrateNum, +) -> Arc, SymbolExportLevel)>> { assert_eq!(cnum, LOCAL_CRATE); if !tcx.sess.opts.output_types.should_codegen() { @@ -280,9 +275,8 @@ fn exported_symbols_provider_local<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, fn upstream_monomorphizations_provider<'tcx>( tcx: TyCtxt<'tcx, 'tcx>, - cnum: CrateNum) - -> &'tcx DefIdMap, CrateNum>> -{ + cnum: CrateNum, +) -> &'tcx DefIdMap, CrateNum>> { debug_assert!(cnum == LOCAL_CRATE); let cnums = tcx.all_crate_nums(LOCAL_CRATE); @@ -330,9 +324,8 @@ fn upstream_monomorphizations_provider<'tcx>( fn upstream_monomorphizations_for_provider<'tcx>( tcx: TyCtxt<'tcx, 'tcx>, - def_id: DefId) - -> Option<&'tcx FxHashMap, CrateNum>> -{ + def_id: DefId, +) -> Option<&'tcx FxHashMap, CrateNum>> { debug_assert!(!def_id.is_local()); tcx.upstream_monomorphizations(LOCAL_CRATE).get(&def_id) } diff --git a/src/librustc_codegen_ssa/back/write.rs b/src/librustc_codegen_ssa/back/write.rs index 894884e19c3fd..5a7ca4af4b867 100644 --- a/src/librustc_codegen_ssa/back/write.rs +++ b/src/librustc_codegen_ssa/back/write.rs @@ -378,7 +378,7 @@ pub fn start_async_codegen( tcx: TyCtxt<'_, '_>, metadata: EncodedMetadata, coordinator_receive: Receiver>, - total_cgus: usize + total_cgus: usize, ) -> OngoingCodegen { let sess = tcx.sess; let crate_name = tcx.crate_name(LOCAL_CRATE); @@ -1005,7 +1005,7 @@ fn start_executing_work( jobserver: Client, modules_config: Arc, metadata_config: Arc, - allocator_config: Arc + allocator_config: Arc, ) -> thread::JoinHandle> { let coordinator_send = tcx.tx_to_llvm_workers.lock().clone(); let sess = tcx.sess; @@ -1861,9 +1861,11 @@ impl OngoingCodegen { }, work_products) } - pub fn submit_pre_codegened_module_to_llvm(&self, - tcx: TyCtxt<'_, '_>, - module: ModuleCodegen) { + pub fn submit_pre_codegened_module_to_llvm( + &self, + tcx: TyCtxt<'_, '_>, + module: ModuleCodegen, + ) { self.wait_for_signal_to_codegen_item(); self.check_for_errors(tcx.sess); @@ -1913,7 +1915,7 @@ pub fn submit_codegened_module_to_llvm( _backend: &B, tcx: TyCtxt<'_, '_>, module: ModuleCodegen, - cost: u64 + cost: u64, ) { let llvm_work_item = WorkItem::Optimize(module); drop(tcx.tx_to_llvm_workers.lock().send(Box::new(Message::CodegenDone:: { @@ -1925,7 +1927,7 @@ pub fn submit_codegened_module_to_llvm( pub fn submit_post_lto_module_to_llvm( _backend: &B, tcx: TyCtxt<'_, '_>, - module: CachedModuleCodegen + module: CachedModuleCodegen, ) { let llvm_work_item = WorkItem::CopyPostLtoArtifacts(module); drop(tcx.tx_to_llvm_workers.lock().send(Box::new(Message::CodegenDone:: { @@ -1937,7 +1939,7 @@ pub fn submit_post_lto_module_to_llvm( pub fn submit_pre_lto_module_to_llvm( _backend: &B, tcx: TyCtxt<'_, '_>, - module: CachedModuleCodegen + module: CachedModuleCodegen, ) { let filename = pre_lto_bitcode_filename(&module.name); let bc_path = in_incr_comp_dir_sess(tcx.sess, &filename); diff --git a/src/librustc_codegen_ssa/base.rs b/src/librustc_codegen_ssa/base.rs index 517d19c56a565..9c34b5e4f7927 100644 --- a/src/librustc_codegen_ssa/base.rs +++ b/src/librustc_codegen_ssa/base.rs @@ -483,9 +483,8 @@ pub fn codegen_crate( tcx: TyCtxt<'tcx, 'tcx>, metadata: EncodedMetadata, need_metadata_module: bool, - rx: mpsc::Receiver> + rx: mpsc::Receiver>, ) -> OngoingCodegen { - check_for_rustc_errors_attr(tcx); // Skip crate items and just output metadata in -Z no-codegen mode. @@ -776,7 +775,7 @@ impl CrateInfo { info.missing_lang_items.insert(cnum, missing); } - return info + return info; } } @@ -850,9 +849,7 @@ pub fn provide_both(providers: &mut Providers<'_>) { }; } -fn determine_cgu_reuse<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - cgu: &CodegenUnit<'tcx>) - -> CguReuse { +fn determine_cgu_reuse<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, cgu: &CodegenUnit<'tcx>) -> CguReuse { if !tcx.dep_graph.is_fully_enabled() { return CguReuse::No } diff --git a/src/librustc_codegen_ssa/common.rs b/src/librustc_codegen_ssa/common.rs index 82af0049affc9..66baf06bfb46d 100644 --- a/src/librustc_codegen_ssa/common.rs +++ b/src/librustc_codegen_ssa/common.rs @@ -122,11 +122,7 @@ mod temp_stable_hash_impls { } } -pub fn langcall(tcx: TyCtxt<'_, '_>, - span: Option, - msg: &str, - li: LangItem) - -> DefId { +pub fn langcall(tcx: TyCtxt<'_, '_>, span: Option, msg: &str, li: LangItem) -> DefId { tcx.lang_items().require(li).unwrap_or_else(|s| { let msg = format!("{} {}", msg, s); match span { diff --git a/src/librustc_codegen_ssa/debuginfo/type_names.rs b/src/librustc_codegen_ssa/debuginfo/type_names.rs index 50847b09805e9..943fd254030d2 100644 --- a/src/librustc_codegen_ssa/debuginfo/type_names.rs +++ b/src/librustc_codegen_ssa/debuginfo/type_names.rs @@ -8,10 +8,11 @@ use rustc_data_structures::fx::FxHashSet; // any caching, i.e., calling the function twice with the same type will also do // the work twice. The `qualified` parameter only affects the first level of the // type name, further levels (i.e., type parameters) are always fully qualified. -pub fn compute_debuginfo_type_name<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - t: Ty<'tcx>, - qualified: bool) - -> String { +pub fn compute_debuginfo_type_name<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + t: Ty<'tcx>, + qualified: bool, +) -> String { let mut result = String::with_capacity(64); let mut visited = FxHashSet::default(); push_debuginfo_type_name(tcx, t, qualified, &mut result, &mut visited); @@ -20,12 +21,13 @@ pub fn compute_debuginfo_type_name<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, // Pushes the name of the type as it should be stored in debuginfo on the // `output` String. See also compute_debuginfo_type_name(). -pub fn push_debuginfo_type_name<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - t: Ty<'tcx>, - qualified: bool, - output: &mut String, - visited: &mut FxHashSet>) { - +pub fn push_debuginfo_type_name<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + t: Ty<'tcx>, + qualified: bool, + output: &mut String, + visited: &mut FxHashSet>, +) { // When targeting MSVC, emit C++ style type names for compatibility with // .natvis visualizers (and perhaps other existing native debuggers?) let cpp_like_names = tcx.sess.target.target.options.is_like_msvc; @@ -208,10 +210,12 @@ pub fn push_debuginfo_type_name<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, } } - fn push_item_name(tcx: TyCtxt<'tcx, 'tcx>, - def_id: DefId, - qualified: bool, - output: &mut String) { + fn push_item_name( + tcx: TyCtxt<'tcx, 'tcx>, + def_id: DefId, + qualified: bool, + output: &mut String, + ) { if qualified { output.push_str(&tcx.crate_name(def_id.krate).as_str()); for path_element in tcx.def_path(def_id).data { @@ -228,10 +232,12 @@ pub fn push_debuginfo_type_name<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, // reconstructed for items from non-local crates. For local crates, this // would be possible but with inlining and LTO we have to use the least // common denominator - otherwise we would run into conflicts. - fn push_type_params<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - substs: SubstsRef<'tcx>, - output: &mut String, - visited: &mut FxHashSet>) { + fn push_type_params<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + substs: SubstsRef<'tcx>, + output: &mut String, + visited: &mut FxHashSet>, + ) { if substs.types().next().is_none() { return; } diff --git a/src/librustc_codegen_ssa/traits/backend.rs b/src/librustc_codegen_ssa/traits/backend.rs index e6532f47bc86f..160e554f8565c 100644 --- a/src/librustc_codegen_ssa/traits/backend.rs +++ b/src/librustc_codegen_ssa/traits/backend.rs @@ -42,13 +42,9 @@ pub trait ExtraBackendMethods: CodegenBackend + WriteBackendMethods + Sized + Se &self, tcx: TyCtxt<'gcx, 'gcx>, mods: &mut Self::Module, - kind: AllocatorKind - ); - fn compile_codegen_unit<'a, 'tcx: 'a>( - &self, - tcx: TyCtxt<'tcx, 'tcx>, - cgu_name: InternedString, + kind: AllocatorKind, ); + fn compile_codegen_unit<'a, 'tcx: 'a>(&self, tcx: TyCtxt<'tcx, 'tcx>, cgu_name: InternedString); // If find_features is true this won't access `sess.crate_types` by assuming // that `is_pie_binary` is false. When we discover LLVM target features // `sess.crate_types` is uninitialized so we cannot access it. diff --git a/src/librustc_codegen_utils/codegen_backend.rs b/src/librustc_codegen_utils/codegen_backend.rs index 521ef23b825fd..1bf03c0c45c6d 100644 --- a/src/librustc_codegen_utils/codegen_backend.rs +++ b/src/librustc_codegen_utils/codegen_backend.rs @@ -6,7 +6,6 @@ #![doc(html_root_url = "https://doc.rust-lang.org/nightly/")] #![deny(warnings)] - #![feature(box_syntax)] use std::any::Any; @@ -39,7 +38,7 @@ pub trait CodegenBackend { tcx: TyCtxt<'tcx, 'tcx>, metadata: EncodedMetadata, need_metadata_module: bool, - rx: mpsc::Receiver> + rx: mpsc::Receiver>, ) -> Box; /// This is called on the returned `Box` from `codegen_backend` diff --git a/src/librustc_driver/pretty.rs b/src/librustc_driver/pretty.rs index a447baa7f41a8..4f19a7bbc8b92 100644 --- a/src/librustc_driver/pretty.rs +++ b/src/librustc_driver/pretty.rs @@ -154,12 +154,14 @@ pub fn parse_pretty(sess: &Session, impl PpSourceMode { /// Constructs a `PrinterSupport` object and passes it to `f`. - fn call_with_pp_support<'tcx, A, F>(&self, - sess: &'tcx Session, - tcx: Option>, - f: F) - -> A - where F: FnOnce(&dyn PrinterSupport) -> A + fn call_with_pp_support<'tcx, A, F>( + &self, + sess: &'tcx Session, + tcx: Option>, + f: F, + ) -> A + where + F: FnOnce(&dyn PrinterSupport) -> A, { match *self { PpmNormal | PpmEveryBodyLoops | PpmExpanded => { @@ -186,12 +188,9 @@ impl PpSourceMode { _ => panic!("Should use call_with_pp_support_hir"), } } - fn call_with_pp_support_hir<'tcx, A, F>( - &self, - tcx: TyCtxt<'tcx, 'tcx>, - f: F - ) -> A - where F: FnOnce(&dyn HirPrinterSupport<'_>, &hir::Crate) -> A + fn call_with_pp_support_hir<'tcx, A, F>(&self, tcx: TyCtxt<'tcx, 'tcx>, f: F) -> A + where + F: FnOnce(&dyn HirPrinterSupport<'_>, &hir::Crate) -> A, { match *self { PpmNormal => { @@ -454,7 +453,6 @@ impl<'a> pprust::PpAnn for HygieneAnnotation<'a> { } } - struct TypedAnnotation<'a, 'tcx: 'a> { tcx: TyCtxt<'tcx, 'tcx>, tables: Cell<&'a ty::TypeckTables<'tcx>>, @@ -617,12 +615,13 @@ impl UserIdentifiedItem { } } -fn print_flowgraph<'tcx, W: Write>(variants: Vec, - tcx: TyCtxt<'tcx, 'tcx>, - code: blocks::Code<'tcx>, - mode: PpFlowGraphMode, - mut out: W) - -> io::Result<()> { +fn print_flowgraph<'tcx, W: Write>( + variants: Vec, + tcx: TyCtxt<'tcx, 'tcx>, + code: blocks::Code<'tcx>, + mode: PpFlowGraphMode, + mut out: W, +) -> io::Result<()> { let body_id = match code { blocks::Code::Expr(expr) => { // Find the function this expression is from. @@ -760,7 +759,8 @@ pub fn print_after_hir_lowering<'tcx>( krate: &ast::Crate, ppm: PpMode, opt_uii: Option, - ofile: Option<&Path>) { + ofile: Option<&Path>, +) { if ppm.needs_analysis() { abort_on_err(print_with_analysis( tcx, @@ -869,7 +869,7 @@ fn print_with_analysis<'tcx>( tcx: TyCtxt<'tcx, 'tcx>, ppm: PpMode, uii: Option, - ofile: Option<&Path> + ofile: Option<&Path>, ) -> Result<(), ErrorReported> { let nodeid = if let Some(uii) = uii { debug!("pretty printing for {:?}", uii); diff --git a/src/librustc_incremental/assert_dep_graph.rs b/src/librustc_incremental/assert_dep_graph.rs index 5e41b8c9efda2..0ddcc42ef123c 100644 --- a/src/librustc_incremental/assert_dep_graph.rs +++ b/src/librustc_incremental/assert_dep_graph.rs @@ -184,10 +184,11 @@ impl Visitor<'tcx> for IfThisChanged<'tcx> { } } -fn check_paths<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - if_this_changed: &Sources, - then_this_would_need: &Targets) -{ +fn check_paths<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + if_this_changed: &Sources, + then_this_would_need: &Targets, +) { // Return early here so as not to construct the query, which is not cheap. if if_this_changed.is_empty() { for &(target_span, _, _, _) in then_this_would_need { diff --git a/src/librustc_incremental/persist/save.rs b/src/librustc_incremental/persist/save.rs index 6f175acebf95d..f31718fe50776 100644 --- a/src/librustc_incremental/persist/save.rs +++ b/src/librustc_incremental/persist/save.rs @@ -129,8 +129,7 @@ fn save_in(sess: &Session, path_buf: PathBuf, encode: F) } } -fn encode_dep_graph(tcx: TyCtxt<'_, '_>, - encoder: &mut Encoder) { +fn encode_dep_graph(tcx: TyCtxt<'_, '_>, encoder: &mut Encoder) { // First encode the commandline arguments hash tcx.sess.opts.dep_tracking_hash().encode(encoder).unwrap(); @@ -234,8 +233,7 @@ fn encode_work_product_index(work_products: &FxHashMap, - encoder: &mut Encoder) { +fn encode_query_cache(tcx: TyCtxt<'_, '_>, encoder: &mut Encoder) { time(tcx.sess, "serialize query result cache", || { tcx.serialize_query_result_cache(encoder).unwrap(); }) diff --git a/src/librustc_interface/passes.rs b/src/librustc_interface/passes.rs index 2fc78dcddd040..d76ae18741213 100644 --- a/src/librustc_interface/passes.rs +++ b/src/librustc_interface/passes.rs @@ -798,7 +798,7 @@ declare_box_region_type!( impl BoxedGlobalCtxt { pub fn enter(&mut self, f: F) -> R where - F: for<'tcx> FnOnce(TyCtxt<'tcx, 'tcx>) -> R + F: for<'tcx> FnOnce(TyCtxt<'tcx, 'tcx>) -> R, { self.access(|gcx| ty::tls::enter_global(gcx, |tcx| f(tcx))) } @@ -878,10 +878,7 @@ pub fn create_global_ctxt( /// Runs the resolution, type-checking, region checking and other /// miscellaneous analysis passes on the crate. -fn analysis<'tcx>( - tcx: TyCtxt<'tcx, 'tcx>, - cnum: CrateNum, -) -> Result<()> { +fn analysis<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, cnum: CrateNum) -> Result<()> { assert_eq!(cnum, LOCAL_CRATE); let sess = tcx.sess; diff --git a/src/librustc_interface/proc_macro_decls.rs b/src/librustc_interface/proc_macro_decls.rs index 864b59d8a84c4..49f892ac299f4 100644 --- a/src/librustc_interface/proc_macro_decls.rs +++ b/src/librustc_interface/proc_macro_decls.rs @@ -10,10 +10,7 @@ pub fn find<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) -> Option { tcx.proc_macro_decls_static(LOCAL_CRATE) } -fn proc_macro_decls_static<'tcx>( - tcx: TyCtxt<'tcx, 'tcx>, - cnum: CrateNum, -) -> Option { +fn proc_macro_decls_static<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, cnum: CrateNum) -> Option { assert_eq!(cnum, LOCAL_CRATE); let mut finder = Finder { decls: None }; diff --git a/src/librustc_lint/types.rs b/src/librustc_lint/types.rs index 494f0b6676052..edaacf7749407 100644 --- a/src/librustc_lint/types.rs +++ b/src/librustc_lint/types.rs @@ -555,11 +555,12 @@ fn ty_is_known_nonnull<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, ty: Ty<'tcx>) -> bool { /// to function pointers, references, core::num::NonZero*, /// core::ptr::NonNull, and #[repr(transparent)] newtypes. /// FIXME: This duplicates code in codegen. -fn is_repr_nullable_ptr<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - ty: Ty<'tcx>, - ty_def: &'tcx ty::AdtDef, - substs: SubstsRef<'tcx>) - -> bool { +fn is_repr_nullable_ptr<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + ty: Ty<'tcx>, + ty_def: &'tcx ty::AdtDef, + substs: SubstsRef<'tcx>, +) -> bool { if ty_def.variants.len() != 2 { return false; } diff --git a/src/librustc_macros/src/query.rs b/src/librustc_macros/src/query.rs index bb6595b5a8036..8b7dc557c59ca 100644 --- a/src/librustc_macros/src/query.rs +++ b/src/librustc_macros/src/query.rs @@ -314,7 +314,7 @@ fn process_modifiers(query: &mut Query) -> QueryModifiers { fn add_query_description_impl( query: &Query, modifiers: QueryModifiers, - impls: &mut proc_macro2::TokenStream + impls: &mut proc_macro2::TokenStream, ) { let name = &query.name; let arg = &query.arg; diff --git a/src/librustc_metadata/cstore_impl.rs b/src/librustc_metadata/cstore_impl.rs index 75020693461a4..7d07331cfff70 100644 --- a/src/librustc_metadata/cstore_impl.rs +++ b/src/librustc_metadata/cstore_impl.rs @@ -550,10 +550,7 @@ impl CrateStore for cstore::CStore { self.do_postorder_cnums_untracked() } - fn encode_metadata<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx>) - -> EncodedMetadata - { + fn encode_metadata<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx>) -> EncodedMetadata { encoder::encode_metadata(tcx) } diff --git a/src/librustc_metadata/decoder.rs b/src/librustc_metadata/decoder.rs index 017c38e0f9d50..9ec31e33f9e06 100644 --- a/src/librustc_metadata/decoder.rs +++ b/src/librustc_metadata/decoder.rs @@ -55,7 +55,9 @@ pub trait Metadata<'a, 'tcx>: Copy { fn raw_bytes(self) -> &'a [u8]; fn cdata(self) -> Option<&'a CrateMetadata> { None } fn sess(self) -> Option<&'a Session> { None } - fn tcx(self) -> Option> { None } + fn tcx(self) -> Option> { + None + } fn decoder(self, pos: usize) -> DecodeContext<'a, 'tcx> { let tcx = self.tcx(); @@ -170,7 +172,6 @@ impl<'a, 'tcx> DecodeContext<'a, 'tcx> { } impl<'a, 'tcx> TyDecoder<'tcx> for DecodeContext<'a, 'tcx> { - #[inline] fn tcx(&self) -> TyCtxt<'tcx, 'tcx> { self.tcx.expect("missing TyCtxt in DecodeContext") @@ -551,7 +552,7 @@ impl<'a, 'tcx> CrateMetadata { item: &Entry<'_>, index: DefIndex, parent_did: DefId, - adt_kind: ty::AdtKind + adt_kind: ty::AdtKind, ) -> ty::VariantDef { let data = match item.kind { EntryKind::Variant(data) | @@ -588,10 +589,7 @@ impl<'a, 'tcx> CrateMetadata { ) } - pub fn get_adt_def(&self, - item_id: DefIndex, - tcx: TyCtxt<'tcx, 'tcx>) - -> &'tcx ty::AdtDef { + pub fn get_adt_def(&self, item_id: DefIndex, tcx: TyCtxt<'tcx, 'tcx>) -> &'tcx ty::AdtDef { let item = self.entry(item_id); let did = self.local_def_id(item_id); @@ -616,24 +614,27 @@ impl<'a, 'tcx> CrateMetadata { tcx.alloc_adt_def(did, kind, variants, repr) } - pub fn get_predicates(&self, - item_id: DefIndex, - tcx: TyCtxt<'tcx, 'tcx>) - -> ty::GenericPredicates<'tcx> { + pub fn get_predicates( + &self, + item_id: DefIndex, + tcx: TyCtxt<'tcx, 'tcx>, + ) -> ty::GenericPredicates<'tcx> { self.entry(item_id).predicates.unwrap().decode((self, tcx)) } - pub fn get_predicates_defined_on(&self, - item_id: DefIndex, - tcx: TyCtxt<'tcx, 'tcx>) - -> ty::GenericPredicates<'tcx> { + pub fn get_predicates_defined_on( + &self, + item_id: DefIndex, + tcx: TyCtxt<'tcx, 'tcx>, + ) -> ty::GenericPredicates<'tcx> { self.entry(item_id).predicates_defined_on.unwrap().decode((self, tcx)) } - pub fn get_super_predicates(&self, - item_id: DefIndex, - tcx: TyCtxt<'tcx, 'tcx>) - -> ty::GenericPredicates<'tcx> { + pub fn get_super_predicates( + &self, + item_id: DefIndex, + tcx: TyCtxt<'tcx, 'tcx>, + ) -> ty::GenericPredicates<'tcx> { let super_predicates = match self.entry(item_id).kind { EntryKind::Trait(data) => data.decode(self).super_predicates, EntryKind::TraitAlias(data) => data.decode(self).super_predicates, @@ -700,10 +701,11 @@ impl<'a, 'tcx> CrateMetadata { self.get_impl_data(id).coerce_unsized_info } - pub fn get_impl_trait(&self, - id: DefIndex, - tcx: TyCtxt<'tcx, 'tcx>) - -> Option> { + pub fn get_impl_trait( + &self, + id: DefIndex, + tcx: TyCtxt<'tcx, 'tcx>, + ) -> Option> { self.get_impl_data(id).trait_ref.map(|tr| tr.decode((self, tcx))) } @@ -720,10 +722,7 @@ impl<'a, 'tcx> CrateMetadata { } /// Iterates over the language items in the given crate. - pub fn get_lang_items( - &self, - tcx: TyCtxt<'tcx, '_>, - ) -> &'tcx [(DefId, usize)] { + pub fn get_lang_items(&self, tcx: TyCtxt<'tcx, '_>) -> &'tcx [(DefId, usize)] { if self.proc_macros.is_some() { // Proc macro crates do not export any lang-items to the target. &[] @@ -884,10 +883,11 @@ impl<'a, 'tcx> CrateMetadata { self.maybe_entry(id).and_then(|item| item.decode(self).mir).is_some() } - pub fn maybe_get_optimized_mir(&self, - tcx: TyCtxt<'tcx, 'tcx>, - id: DefIndex) - -> Option> { + pub fn maybe_get_optimized_mir( + &self, + tcx: TyCtxt<'tcx, 'tcx>, + id: DefIndex, + ) -> Option> { match self.is_proc_macro(id) { true => None, false => self.entry(id).mir.map(|mir| mir.decode((self, tcx))), @@ -1020,7 +1020,7 @@ impl<'a, 'tcx> CrateMetadata { pub fn get_inherent_implementations_for_type( &self, tcx: TyCtxt<'tcx, '_>, - id: DefIndex + id: DefIndex, ) -> &'tcx [DefId] { tcx.arena.alloc_from_iter(self.entry(id) .inherent_impls @@ -1085,10 +1085,7 @@ impl<'a, 'tcx> CrateMetadata { } } - pub fn get_foreign_modules( - &self, - tcx: TyCtxt<'tcx, '_>, - ) -> &'tcx [ForeignModule] { + pub fn get_foreign_modules(&self, tcx: TyCtxt<'tcx, '_>) -> &'tcx [ForeignModule] { if self.proc_macros.is_some() { // Proc macro crates do not have any *target* foreign modules. &[] @@ -1111,10 +1108,7 @@ impl<'a, 'tcx> CrateMetadata { })) } - pub fn get_missing_lang_items( - &self, - tcx: TyCtxt<'tcx, '_>, - ) -> &'tcx [lang_items::LangItem] { + pub fn get_missing_lang_items(&self, tcx: TyCtxt<'tcx, '_>) -> &'tcx [lang_items::LangItem] { if self.proc_macros.is_some() { // Proc macro crates do not depend on any target weak lang-items. &[] @@ -1135,9 +1129,10 @@ impl<'a, 'tcx> CrateMetadata { arg_names.decode(self).collect() } - pub fn exported_symbols(&self, - tcx: TyCtxt<'tcx, 'tcx>) - -> Vec<(ExportedSymbol<'tcx>, SymbolExportLevel)> { + pub fn exported_symbols( + &self, + tcx: TyCtxt<'tcx, 'tcx>, + ) -> Vec<(ExportedSymbol<'tcx>, SymbolExportLevel)> { if self.proc_macros.is_some() { // If this crate is a custom derive crate, then we're not even going to // link those in so we skip those crates. @@ -1192,10 +1187,7 @@ impl<'a, 'tcx> CrateMetadata { } } - pub fn fn_sig(&self, - id: DefIndex, - tcx: TyCtxt<'tcx, 'tcx>) - -> ty::PolyFnSig<'tcx> { + pub fn fn_sig(&self, id: DefIndex, tcx: TyCtxt<'tcx, 'tcx>) -> ty::PolyFnSig<'tcx> { let sig = match self.entry(id).kind { EntryKind::Fn(data) | EntryKind::ForeignFn(data) => data.decode(self).sig, diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs index ee7ffa1b06628..5c73ee43c059c 100644 --- a/src/librustc_metadata/encoder.rs +++ b/src/librustc_metadata/encoder.rs @@ -217,8 +217,7 @@ impl<'tcx> SpecializedEncoder for EncodeContext<'tcx> { } } -impl<'tcx, T: Encodable> SpecializedEncoder> -for EncodeContext<'tcx> { +impl<'tcx, T: Encodable> SpecializedEncoder> for EncodeContext<'tcx> { fn specialized_encode(&mut self, _: &mir::ClearCrossCrate) -> Result<(), Self::Error> { @@ -233,7 +232,6 @@ impl<'tcx> TyEncoder for EncodeContext<'tcx> { } impl<'tcx> EncodeContext<'tcx> { - fn emit_node R, R>(&mut self, f: F) -> R { assert_eq!(self.lazy_state, LazyState::NoNode); let pos = self.position(); @@ -1865,9 +1863,7 @@ impl<'tcx, 'v> ItemLikeVisitor<'v> for ImplVisitor<'tcx> { // will allow us to slice the metadata to the precise length that we just // generated regardless of trailing bytes that end up in it. -pub fn encode_metadata<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) - -> EncodedMetadata -{ +pub fn encode_metadata<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) -> EncodedMetadata { let mut encoder = opaque::Encoder::new(vec![]); encoder.emit_raw_bytes(METADATA_HEADER); diff --git a/src/librustc_metadata/foreign_modules.rs b/src/librustc_metadata/foreign_modules.rs index 7520fb607c5fa..63260312fa6de 100644 --- a/src/librustc_metadata/foreign_modules.rs +++ b/src/librustc_metadata/foreign_modules.rs @@ -9,7 +9,7 @@ pub fn collect<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) -> Vec { modules: Vec::new(), }; tcx.hir().krate().visit_all_item_likes(&mut collector); - return collector.modules + return collector.modules; } struct Collector<'tcx> { diff --git a/src/librustc_metadata/link_args.rs b/src/librustc_metadata/link_args.rs index 1c50b0f293a62..576b0da1fd8e2 100644 --- a/src/librustc_metadata/link_args.rs +++ b/src/librustc_metadata/link_args.rs @@ -18,7 +18,7 @@ pub fn collect<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) -> Vec { } } - return collector.args + return collector.args; } struct Collector { diff --git a/src/librustc_metadata/native_libs.rs b/src/librustc_metadata/native_libs.rs index bcd91eb22cf1f..ef74fdf8a9e54 100644 --- a/src/librustc_metadata/native_libs.rs +++ b/src/librustc_metadata/native_libs.rs @@ -18,7 +18,7 @@ pub fn collect<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) -> Vec { }; tcx.hir().krate().visit_all_item_likes(&mut collector); collector.process_command_line(); - return collector.libs + return collector.libs; } pub fn relevant_lib(sess: &Session, lib: &NativeLibrary) -> bool { diff --git a/src/librustc_mir/borrow_check/borrow_set.rs b/src/librustc_mir/borrow_check/borrow_set.rs index 85a5669dfe142..5accf2abdadbf 100644 --- a/src/librustc_mir/borrow_check/borrow_set.rs +++ b/src/librustc_mir/borrow_check/borrow_set.rs @@ -125,9 +125,8 @@ impl<'tcx> BorrowSet<'tcx> { tcx: TyCtxt<'_, 'tcx>, body: &Body<'tcx>, locals_are_invalidated_at_exit: bool, - move_data: &MoveData<'tcx> + move_data: &MoveData<'tcx>, ) -> Self { - let mut visitor = GatherBorrows { tcx, body, diff --git a/src/librustc_mir/borrow_check/path_utils.rs b/src/librustc_mir/borrow_check/path_utils.rs index 10a92253f9f64..978f12af9a1ad 100644 --- a/src/librustc_mir/borrow_check/path_utils.rs +++ b/src/librustc_mir/borrow_check/path_utils.rs @@ -22,7 +22,7 @@ pub(super) enum Control { } /// Encapsulates the idea of iterating over every borrow that involves a particular path -pub(super) fn each_borrow_involving_path<'tcx, 'gcx: 'tcx, F, I, S> ( +pub(super) fn each_borrow_involving_path<'tcx, 'gcx: 'tcx, F, I, S>( s: &mut S, tcx: TyCtxt<'gcx, 'tcx>, body: &Body<'tcx>, @@ -33,7 +33,7 @@ pub(super) fn each_borrow_involving_path<'tcx, 'gcx: 'tcx, F, I, S> ( mut op: F, ) where F: FnMut(&mut S, BorrowIndex, &BorrowData<'tcx>) -> Control, - I: Iterator + I: Iterator, { let (access, place) = access_place; diff --git a/src/librustc_mir/borrow_check/place_ext.rs b/src/librustc_mir/borrow_check/place_ext.rs index b969f0fd3c7aa..542cdf273695d 100644 --- a/src/librustc_mir/borrow_check/place_ext.rs +++ b/src/librustc_mir/borrow_check/place_ext.rs @@ -15,7 +15,7 @@ crate trait PlaceExt<'tcx> { tcx: TyCtxt<'_, 'tcx>, body: &Body<'tcx>, locals_state_at_exit: &LocalsStateAtExit, - ) -> bool; + ) -> bool; } impl<'tcx> PlaceExt<'tcx> for Place<'tcx> { diff --git a/src/librustc_mir/build/mod.rs b/src/librustc_mir/build/mod.rs index f4b6f438163f9..579a403f3aca7 100644 --- a/src/librustc_mir/build/mod.rs +++ b/src/librustc_mir/build/mod.rs @@ -186,7 +186,7 @@ pub fn mir_build<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> Body<'tcx> { /// can change `'tcx` so we have to transmute afterwards. struct GlobalizeMir<'gcx> { tcx: TyCtxt<'gcx, 'gcx>, - span: Span + span: Span, } impl<'gcx: 'tcx, 'tcx> MutVisitor<'tcx> for GlobalizeMir<'gcx> { @@ -234,10 +234,11 @@ impl<'gcx: 'tcx, 'tcx> MutVisitor<'tcx> for GlobalizeMir<'gcx> { /////////////////////////////////////////////////////////////////////////// // BuildMir -- walks a crate, looking for fn items and methods to build MIR from -fn liberated_closure_env_ty<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, - closure_expr_id: hir::HirId, - body_id: hir::BodyId) - -> Ty<'tcx> { +fn liberated_closure_env_ty<'gcx, 'tcx>( + tcx: TyCtxt<'gcx, 'tcx>, + closure_expr_id: hir::HirId, + body_id: hir::BodyId, +) -> Ty<'tcx> { let closure_ty = tcx.body_tables(body_id).node_type(closure_expr_id); let (closure_def_id, closure_substs) = match closure_ty.sty { @@ -551,10 +552,7 @@ macro_rules! unpack { }; } -fn should_abort_on_panic<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, - fn_def_id: DefId, - abi: Abi) - -> bool { +fn should_abort_on_panic<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, fn_def_id: DefId, abi: Abi) -> bool { // Not callable from C, so we can safely unwind through these if abi == Abi::Rust || abi == Abi::RustCall { return false; } diff --git a/src/librustc_mir/const_eval.rs b/src/librustc_mir/const_eval.rs index 458e68cfcc59e..fb031f9e7ec16 100644 --- a/src/librustc_mir/const_eval.rs +++ b/src/librustc_mir/const_eval.rs @@ -308,9 +308,7 @@ impl interpret::MayLeak for ! { } } -impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> - for CompileTimeInterpreter<'mir, 'tcx> -{ +impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir, 'tcx> { type MemoryKinds = !; type PointerTag = (); @@ -454,18 +452,13 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> } #[inline(always)] - fn stack_push( - _ecx: &mut InterpretCx<'mir, 'tcx, Self>, - ) -> InterpResult<'tcx> { + fn stack_push(_ecx: &mut InterpretCx<'mir, 'tcx, Self>) -> InterpResult<'tcx> { Ok(()) } /// Called immediately before a stack frame gets popped. #[inline(always)] - fn stack_pop( - _ecx: &mut InterpretCx<'mir, 'tcx, Self>, - _extra: (), - ) -> InterpResult<'tcx> { + fn stack_pop(_ecx: &mut InterpretCx<'mir, 'tcx, Self>, _extra: ()) -> InterpResult<'tcx> { Ok(()) } } @@ -511,7 +504,7 @@ pub fn const_variant_index<'tcx>( pub fn error_to_const_error<'mir, 'tcx>( ecx: &InterpretCx<'mir, 'tcx, CompileTimeInterpreter<'mir, 'tcx>>, - mut error: InterpErrorInfo<'tcx> + mut error: InterpErrorInfo<'tcx>, ) -> ConstEvalErr<'tcx> { error.print_backtrace(); let stacktrace = ecx.generate_stacktrace(None); diff --git a/src/librustc_mir/dataflow/drop_flag_effects.rs b/src/librustc_mir/dataflow/drop_flag_effects.rs index 6a536dc427bee..dc2893cb3303d 100644 --- a/src/librustc_mir/dataflow/drop_flag_effects.rs +++ b/src/librustc_mir/dataflow/drop_flag_effects.rs @@ -46,9 +46,11 @@ pub fn move_path_children_matching<'tcx, F>(move_data: &MoveData<'tcx>, /// is no need to maintain separate drop flags to track such state. // // FIXME: we have to do something for moving slice patterns. -fn place_contents_drop_state_cannot_differ<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, - body: &Body<'tcx>, - place: &mir::Place<'tcx>) -> bool { +fn place_contents_drop_state_cannot_differ<'gcx, 'tcx>( + tcx: TyCtxt<'gcx, 'tcx>, + body: &Body<'tcx>, + place: &mir::Place<'tcx>, +) -> bool { let ty = place.ty(body, tcx).ty; match ty.sty { ty::Array(..) => { @@ -77,8 +79,9 @@ pub(crate) fn on_lookup_result_bits<'gcx, 'tcx, F>( body: &Body<'tcx>, move_data: &MoveData<'tcx>, lookup_result: LookupResult, - each_child: F) - where F: FnMut(MovePathIndex) + each_child: F, +) where + F: FnMut(MovePathIndex), { match lookup_result { LookupResult::Parent(..) => { @@ -95,15 +98,16 @@ pub(crate) fn on_all_children_bits<'gcx, 'tcx, F>( body: &Body<'tcx>, move_data: &MoveData<'tcx>, move_path_index: MovePathIndex, - mut each_child: F) - where F: FnMut(MovePathIndex) + mut each_child: F, +) where + F: FnMut(MovePathIndex), { fn is_terminal_path<'gcx, 'tcx>( tcx: TyCtxt<'gcx, 'tcx>, body: &Body<'tcx>, move_data: &MoveData<'tcx>, - path: MovePathIndex) -> bool - { + path: MovePathIndex, + ) -> bool { place_contents_drop_state_cannot_differ( tcx, body, &move_data.move_paths[path].place) } @@ -113,8 +117,9 @@ pub(crate) fn on_all_children_bits<'gcx, 'tcx, F>( body: &Body<'tcx>, move_data: &MoveData<'tcx>, move_path_index: MovePathIndex, - each_child: &mut F) - where F: FnMut(MovePathIndex) + each_child: &mut F, + ) where + F: FnMut(MovePathIndex), { each_child(move_path_index); @@ -136,8 +141,9 @@ pub(crate) fn on_all_drop_children_bits<'gcx, 'tcx, F>( body: &Body<'tcx>, ctxt: &MoveDataParamEnv<'gcx, 'tcx>, path: MovePathIndex, - mut each_child: F) - where F: FnMut(MovePathIndex) + mut each_child: F, +) where + F: FnMut(MovePathIndex), { on_all_children_bits(tcx, body, &ctxt.move_data, path, |child| { let place = &ctxt.move_data.move_paths[path].place; @@ -158,8 +164,9 @@ pub(crate) fn drop_flag_effects_for_function_entry<'gcx, 'tcx, F>( tcx: TyCtxt<'gcx, 'tcx>, body: &Body<'tcx>, ctxt: &MoveDataParamEnv<'gcx, 'tcx>, - mut callback: F) - where F: FnMut(MovePathIndex, DropFlagState) + mut callback: F, +) where + F: FnMut(MovePathIndex, DropFlagState), { let move_data = &ctxt.move_data; for arg in body.args_iter() { @@ -176,8 +183,9 @@ pub(crate) fn drop_flag_effects_for_location<'gcx, 'tcx, F>( body: &Body<'tcx>, ctxt: &MoveDataParamEnv<'gcx, 'tcx>, loc: Location, - mut callback: F) - where F: FnMut(MovePathIndex, DropFlagState) + mut callback: F, +) where + F: FnMut(MovePathIndex, DropFlagState), { let move_data = &ctxt.move_data; debug!("drop_flag_effects_for_location({:?})", loc); @@ -208,8 +216,9 @@ pub(crate) fn for_location_inits<'gcx, 'tcx, F>( body: &Body<'tcx>, move_data: &MoveData<'tcx>, loc: Location, - mut callback: F) - where F: FnMut(MovePathIndex) + mut callback: F, +) where + F: FnMut(MovePathIndex), { for ii in &move_data.init_loc_map[loc] { let init = move_data.inits[*ii]; diff --git a/src/librustc_mir/dataflow/impls/mod.rs b/src/librustc_mir/dataflow/impls/mod.rs index c1d302744858e..4148ffc465cf4 100644 --- a/src/librustc_mir/dataflow/impls/mod.rs +++ b/src/librustc_mir/dataflow/impls/mod.rs @@ -70,11 +70,11 @@ pub struct MaybeInitializedPlaces<'a, 'gcx: 'tcx, 'tcx: 'a> { } impl<'a, 'gcx: 'tcx, 'tcx> MaybeInitializedPlaces<'a, 'gcx, 'tcx> { - pub fn new(tcx: TyCtxt<'gcx, 'tcx>, - body: &'a Body<'tcx>, - mdpe: &'a MoveDataParamEnv<'gcx, 'tcx>) - -> Self - { + pub fn new( + tcx: TyCtxt<'gcx, 'tcx>, + body: &'a Body<'tcx>, + mdpe: &'a MoveDataParamEnv<'gcx, 'tcx>, + ) -> Self { MaybeInitializedPlaces { tcx: tcx, body: body, mdpe: mdpe } } } @@ -125,11 +125,11 @@ pub struct MaybeUninitializedPlaces<'a, 'gcx: 'tcx, 'tcx: 'a> { } impl<'a, 'gcx, 'tcx> MaybeUninitializedPlaces<'a, 'gcx, 'tcx> { - pub fn new(tcx: TyCtxt<'gcx, 'tcx>, - body: &'a Body<'tcx>, - mdpe: &'a MoveDataParamEnv<'gcx, 'tcx>) - -> Self - { + pub fn new( + tcx: TyCtxt<'gcx, 'tcx>, + body: &'a Body<'tcx>, + mdpe: &'a MoveDataParamEnv<'gcx, 'tcx>, + ) -> Self { MaybeUninitializedPlaces { tcx: tcx, body: body, mdpe: mdpe } } } @@ -179,11 +179,11 @@ pub struct DefinitelyInitializedPlaces<'a, 'gcx: 'tcx, 'tcx: 'a> { } impl<'a, 'gcx, 'tcx: 'a> DefinitelyInitializedPlaces<'a, 'gcx, 'tcx> { - pub fn new(tcx: TyCtxt<'gcx, 'tcx>, - body: &'a Body<'tcx>, - mdpe: &'a MoveDataParamEnv<'gcx, 'tcx>) - -> Self - { + pub fn new( + tcx: TyCtxt<'gcx, 'tcx>, + body: &'a Body<'tcx>, + mdpe: &'a MoveDataParamEnv<'gcx, 'tcx>, + ) -> Self { DefinitelyInitializedPlaces { tcx: tcx, body: body, mdpe: mdpe } } } @@ -228,11 +228,11 @@ pub struct EverInitializedPlaces<'a, 'gcx: 'tcx, 'tcx: 'a> { } impl<'a, 'gcx: 'tcx, 'tcx: 'a> EverInitializedPlaces<'a, 'gcx, 'tcx> { - pub fn new(tcx: TyCtxt<'gcx, 'tcx>, - body: &'a Body<'tcx>, - mdpe: &'a MoveDataParamEnv<'gcx, 'tcx>) - -> Self - { + pub fn new( + tcx: TyCtxt<'gcx, 'tcx>, + body: &'a Body<'tcx>, + mdpe: &'a MoveDataParamEnv<'gcx, 'tcx>, + ) -> Self { EverInitializedPlaces { tcx: tcx, body: body, mdpe: mdpe } } } diff --git a/src/librustc_mir/dataflow/mod.rs b/src/librustc_mir/dataflow/mod.rs index ae7690554f84e..10e46507d5a26 100644 --- a/src/librustc_mir/dataflow/mod.rs +++ b/src/librustc_mir/dataflow/mod.rs @@ -121,29 +121,36 @@ pub struct MoveDataParamEnv<'gcx, 'tcx> { pub(crate) param_env: ty::ParamEnv<'gcx>, } -pub(crate) fn do_dataflow<'a, 'gcx, 'tcx, BD, P>(tcx: TyCtxt<'gcx, 'tcx>, - body: &'a Body<'tcx>, - def_id: DefId, - attributes: &[ast::Attribute], - dead_unwinds: &BitSet, - bd: BD, - p: P) - -> DataflowResults<'tcx, BD> - where BD: BitDenotation<'tcx> + InitialFlow, - P: Fn(&BD, BD::Idx) -> DebugFormatted +pub(crate) fn do_dataflow<'a, 'gcx, 'tcx, BD, P>( + tcx: TyCtxt<'gcx, 'tcx>, + body: &'a Body<'tcx>, + def_id: DefId, + attributes: &[ast::Attribute], + dead_unwinds: &BitSet, + bd: BD, + p: P, +) -> DataflowResults<'tcx, BD> +where + BD: BitDenotation<'tcx> + InitialFlow, + P: Fn(&BD, BD::Idx) -> DebugFormatted, { let flow_state = DataflowAnalysis::new(body, dead_unwinds, bd); flow_state.run(tcx, def_id, attributes, p) } -impl<'a, 'gcx: 'tcx, 'tcx: 'a, BD> DataflowAnalysis<'a, 'tcx, BD> where BD: BitDenotation<'tcx> +impl<'a, 'gcx: 'tcx, 'tcx: 'a, BD> DataflowAnalysis<'a, 'tcx, BD> +where + BD: BitDenotation<'tcx>, { - pub(crate) fn run

(self, - tcx: TyCtxt<'gcx, 'tcx>, - def_id: DefId, - attributes: &[ast::Attribute], - p: P) -> DataflowResults<'tcx, BD> - where P: Fn(&BD, BD::Idx) -> DebugFormatted + pub(crate) fn run

( + self, + tcx: TyCtxt<'gcx, 'tcx>, + def_id: DefId, + attributes: &[ast::Attribute], + p: P, + ) -> DataflowResults<'tcx, BD> + where + P: Fn(&BD, BD::Idx) -> DebugFormatted, { let name_found = |sess: &Session, attrs: &[ast::Attribute], name| -> Option { if let Some(item) = has_rustc_mir_with(attrs, name) { diff --git a/src/librustc_mir/dataflow/move_paths/builder.rs b/src/librustc_mir/dataflow/move_paths/builder.rs index e437620272134..3acbf2a2f6987 100644 --- a/src/librustc_mir/dataflow/move_paths/builder.rs +++ b/src/librustc_mir/dataflow/move_paths/builder.rs @@ -204,7 +204,7 @@ impl<'a, 'gcx, 'tcx> MoveDataBuilder<'a, 'gcx, 'tcx> { pub(super) fn gather_moves<'gcx, 'tcx>( body: &Body<'tcx>, - tcx: TyCtxt<'gcx, 'tcx> + tcx: TyCtxt<'gcx, 'tcx>, ) -> Result, (MoveData<'tcx>, Vec<(Place<'tcx>, MoveError<'tcx>)>)> { let mut builder = MoveDataBuilder::new(body, tcx); diff --git a/src/librustc_mir/dataflow/move_paths/mod.rs b/src/librustc_mir/dataflow/move_paths/mod.rs index aa8a1e54a6570..33b8134eec918 100644 --- a/src/librustc_mir/dataflow/move_paths/mod.rs +++ b/src/librustc_mir/dataflow/move_paths/mod.rs @@ -306,8 +306,10 @@ impl<'tcx> MoveError<'tcx> { } impl<'gcx, 'tcx> MoveData<'tcx> { - pub fn gather_moves(body: &Body<'tcx>, tcx: TyCtxt<'gcx, 'tcx>) - -> Result, MoveError<'tcx>)>)> { + pub fn gather_moves( + body: &Body<'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, + ) -> Result, MoveError<'tcx>)>)> { builder::gather_moves(body, tcx) } diff --git a/src/librustc_mir/hair/pattern/_match.rs b/src/librustc_mir/hair/pattern/_match.rs index 9da51cae21830..71a274f456a0e 100644 --- a/src/librustc_mir/hair/pattern/_match.rs +++ b/src/librustc_mir/hair/pattern/_match.rs @@ -195,7 +195,7 @@ pub fn expand_pattern<'a, 'tcx>(cx: &MatchCheckCtxt<'a, 'tcx>, pat: Pattern<'tcx } struct LiteralExpander<'tcx> { - tcx: TyCtxt<'tcx, 'tcx> + tcx: TyCtxt<'tcx, 'tcx>, } impl LiteralExpander<'tcx> { @@ -368,8 +368,10 @@ impl<'a, 'tcx> MatchCheckCtxt<'a, 'tcx> { tcx: TyCtxt<'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, module: DefId, - f: F) -> R - where F: for<'b> FnOnce(MatchCheckCtxt<'b, 'tcx>) -> R + f: F, + ) -> R + where + F: for<'b> FnOnce(MatchCheckCtxt<'b, 'tcx>) -> R, { let pattern_arena = TypedArena::default(); @@ -827,9 +829,7 @@ struct IntRange<'tcx> { } impl<'tcx> IntRange<'tcx> { - fn from_ctor(tcx: TyCtxt<'tcx, 'tcx>, - ctor: &Constructor<'tcx>) - -> Option> { + fn from_ctor(tcx: TyCtxt<'tcx, 'tcx>, ctor: &Constructor<'tcx>) -> Option> { // Floating-point ranges are permitted and we don't want // to consider them when constructing integer ranges. fn is_integral<'tcx>(ty: Ty<'tcx>) -> bool { @@ -867,9 +867,7 @@ impl<'tcx> IntRange<'tcx> { } } - fn from_pat(tcx: TyCtxt<'tcx, 'tcx>, - mut pat: &Pattern<'tcx>) - -> Option> { + fn from_pat(tcx: TyCtxt<'tcx, 'tcx>, mut pat: &Pattern<'tcx>) -> Option> { let range = loop { match pat.kind { box PatternKind::Constant { value } => break ConstantValue(value), @@ -917,10 +915,11 @@ impl<'tcx> IntRange<'tcx> { /// Returns a collection of ranges that spans the values covered by `ranges`, subtracted /// by the values covered by `self`: i.e., `ranges \ self` (in set notation). - fn subtract_from(self, - tcx: TyCtxt<'tcx, 'tcx>, - ranges: Vec>) - -> Vec> { + fn subtract_from( + self, + tcx: TyCtxt<'tcx, 'tcx>, + ranges: Vec>, + ) -> Vec> { let ranges = ranges.into_iter().filter_map(|r| { IntRange::from_ctor(tcx, &r).map(|i| i.range) }); @@ -1429,7 +1428,7 @@ fn slice_pat_covered_by_const<'tcx>( const_val: &'tcx ty::Const<'tcx>, prefix: &[Pattern<'tcx>], slice: &Option>, - suffix: &[Pattern<'tcx>] + suffix: &[Pattern<'tcx>], ) -> Result { let data: &[u8] = match (const_val.val, &const_val.ty.sty) { (ConstValue::ByRef(ptr, alloc), ty::Array(t, n)) => { @@ -1476,10 +1475,7 @@ fn slice_pat_covered_by_const<'tcx>( // Whether to evaluate a constructor using exhaustive integer matching. This is true if the // constructor is a range or constant with an integer type. -fn should_treat_range_exhaustively( - tcx: TyCtxt<'tcx, 'tcx>, - ctor: &Constructor<'tcx>, -) -> bool { +fn should_treat_range_exhaustively(tcx: TyCtxt<'tcx, 'tcx>, ctor: &Constructor<'tcx>) -> bool { let ty = match ctor { ConstantValue(value) => value.ty, ConstantRange(_, _, ty, _) => ty, diff --git a/src/librustc_mir/hair/pattern/mod.rs b/src/librustc_mir/hair/pattern/mod.rs index 67325e7b75c83..4b6be426e5178 100644 --- a/src/librustc_mir/hair/pattern/mod.rs +++ b/src/librustc_mir/hair/pattern/mod.rs @@ -335,10 +335,12 @@ pub struct PatternContext<'a, 'tcx: 'a> { } impl<'a, 'tcx> Pattern<'tcx> { - pub fn from_hir(tcx: TyCtxt<'tcx, 'tcx>, - param_env_and_substs: ty::ParamEnvAnd<'tcx, SubstsRef<'tcx>>, - tables: &'a ty::TypeckTables<'tcx>, - pat: &'tcx hir::Pat) -> Self { + pub fn from_hir( + tcx: TyCtxt<'tcx, 'tcx>, + param_env_and_substs: ty::ParamEnvAnd<'tcx, SubstsRef<'tcx>>, + tables: &'a ty::TypeckTables<'tcx>, + pat: &'tcx hir::Pat, + ) -> Self { let mut pcx = PatternContext::new(tcx, param_env_and_substs, tables); let result = pcx.lower_pattern(pat); if !pcx.errors.is_empty() { @@ -351,9 +353,11 @@ impl<'a, 'tcx> Pattern<'tcx> { } impl<'a, 'tcx> PatternContext<'a, 'tcx> { - pub fn new(tcx: TyCtxt<'tcx, 'tcx>, - param_env_and_substs: ty::ParamEnvAnd<'tcx, SubstsRef<'tcx>>, - tables: &'a ty::TypeckTables<'tcx>) -> Self { + pub fn new( + tcx: TyCtxt<'tcx, 'tcx>, + param_env_and_substs: ty::ParamEnvAnd<'tcx, SubstsRef<'tcx>>, + tables: &'a ty::TypeckTables<'tcx>, + ) -> Self { PatternContext { tcx, param_env: param_env_and_substs.param_env, diff --git a/src/librustc_mir/interpret/eval_context.rs b/src/librustc_mir/interpret/eval_context.rs index 134c23e56e223..45c1f71e95043 100644 --- a/src/librustc_mir/interpret/eval_context.rs +++ b/src/librustc_mir/interpret/eval_context.rs @@ -43,10 +43,8 @@ pub struct InterpretCx<'mir, 'tcx, M: Machine<'mir, 'tcx>> { pub(crate) stack: Vec>, /// A cache for deduplicating vtables - pub(super) vtables: FxHashMap< - (Ty<'tcx>, Option>), - Pointer - >, + pub(super) vtables: + FxHashMap<(Ty<'tcx>, Option>), Pointer>, } /// A stack frame. @@ -160,9 +158,7 @@ impl<'tcx, Tag: Copy + 'static> LocalState<'tcx, Tag> { } } -impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> HasDataLayout - for InterpretCx<'mir, 'tcx, M> -{ +impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> HasDataLayout for InterpretCx<'mir, 'tcx, M> { #[inline] fn data_layout(&self) -> &layout::TargetDataLayout { &self.tcx.data_layout @@ -170,7 +166,8 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> HasDataLayout } impl<'mir, 'tcx, M> layout::HasTyCtxt<'tcx> for InterpretCx<'mir, 'tcx, M> - where M: Machine<'mir, 'tcx> +where + M: Machine<'mir, 'tcx>, { #[inline] fn tcx(&self) -> TyCtxt<'tcx, 'tcx> { @@ -179,16 +176,15 @@ impl<'mir, 'tcx, M> layout::HasTyCtxt<'tcx> for InterpretCx<'mir, 'tcx, M> } impl<'mir, 'tcx, M> layout::HasParamEnv<'tcx> for InterpretCx<'mir, 'tcx, M> - where M: Machine<'mir, 'tcx> +where + M: Machine<'mir, 'tcx>, { fn param_env(&self) -> ty::ParamEnv<'tcx> { self.param_env } } -impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> LayoutOf - for InterpretCx<'mir, 'tcx, M> -{ +impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> LayoutOf for InterpretCx<'mir, 'tcx, M> { type Ty = Ty<'tcx>; type TyLayout = InterpResult<'tcx, TyLayout<'tcx>>; @@ -200,11 +196,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> LayoutOf } impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpretCx<'mir, 'tcx, M> { - pub fn new( - tcx: TyCtxtAt<'tcx, 'tcx>, - param_env: ty::ParamEnv<'tcx>, - machine: M, - ) -> Self { + pub fn new(tcx: TyCtxtAt<'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, machine: M) -> Self { InterpretCx { machine, tcx, diff --git a/src/librustc_mir/interpret/intrinsics/type_name.rs b/src/librustc_mir/interpret/intrinsics/type_name.rs index 8ef9b75e4be3b..a44a20adbca0e 100644 --- a/src/librustc_mir/interpret/intrinsics/type_name.rs +++ b/src/librustc_mir/interpret/intrinsics/type_name.rs @@ -225,10 +225,7 @@ pub fn type_name<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, ty: Ty<'tcx>) -> &'tcx ty::Const } /// Directly returns an `Allocation` containing an absolute path representation of the given type. -pub(super) fn alloc_type_name<'tcx>( - tcx: TyCtxt<'tcx, 'tcx>, - ty: Ty<'tcx> -) -> &'tcx Allocation { +pub(super) fn alloc_type_name<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, ty: Ty<'tcx>) -> &'tcx Allocation { let path = AbsolutePathPrinter { tcx, path: String::new() }.print_type(ty).unwrap().path; let alloc = Allocation::from_byte_aligned_bytes(path.into_bytes()); tcx.intern_const_alloc(alloc) diff --git a/src/librustc_mir/interpret/machine.rs b/src/librustc_mir/interpret/machine.rs index 32ab29114f2cd..97e65733bd409 100644 --- a/src/librustc_mir/interpret/machine.rs +++ b/src/librustc_mir/interpret/machine.rs @@ -201,9 +201,7 @@ pub trait Machine<'mir, 'tcx>: Sized { } /// Called immediately before a new stack frame got pushed - fn stack_push( - ecx: &mut InterpretCx<'mir, 'tcx, Self>, - ) -> InterpResult<'tcx, Self::FrameExtra>; + fn stack_push(ecx: &mut InterpretCx<'mir, 'tcx, Self>) -> InterpResult<'tcx, Self::FrameExtra>; /// Called immediately after a stack frame gets popped fn stack_pop( diff --git a/src/librustc_mir/interpret/memory.rs b/src/librustc_mir/interpret/memory.rs index 8f941ed5c6235..d9f522ab12f24 100644 --- a/src/librustc_mir/interpret/memory.rs +++ b/src/librustc_mir/interpret/memory.rs @@ -69,9 +69,7 @@ pub struct Memory<'mir, 'tcx, M: Machine<'mir, 'tcx>> { pub(super) tcx: TyCtxtAt<'tcx, 'tcx>, } -impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> HasDataLayout - for Memory<'mir, 'tcx, M> -{ +impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> HasDataLayout for Memory<'mir, 'tcx, M> { #[inline] fn data_layout(&self) -> &TargetDataLayout { &self.tcx.data_layout @@ -80,12 +78,9 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> HasDataLayout // FIXME: Really we shouldn't clone memory, ever. Snapshot machinery should instead // carefully copy only the reachable parts. -impl<'mir, 'tcx, M> - Clone -for - Memory<'mir, 'tcx, M> +impl<'mir, 'tcx, M> Clone for Memory<'mir, 'tcx, M> where - M: Machine<'mir, 'tcx, PointerTag=(), AllocExtra=(), MemoryExtra=()>, + M: Machine<'mir, 'tcx, PointerTag = (), AllocExtra = (), MemoryExtra = ()>, M::MemoryMap: AllocMap, Allocation)>, { fn clone(&self) -> Self { @@ -641,7 +636,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> { /// Interning (for CTFE) impl<'mir, 'tcx, M> Memory<'mir, 'tcx, M> where - M: Machine<'mir, 'tcx, PointerTag=(), AllocExtra=(), MemoryExtra=()>, + M: Machine<'mir, 'tcx, PointerTag = (), AllocExtra = (), MemoryExtra = ()>, // FIXME: Working around https://github.com/rust-lang/rust/issues/24159 M::MemoryMap: AllocMap, Allocation)>, { diff --git a/src/librustc_mir/interpret/place.rs b/src/librustc_mir/interpret/place.rs index f5d30d2aeb351..b8bb54815d8bf 100644 --- a/src/librustc_mir/interpret/place.rs +++ b/src/librustc_mir/interpret/place.rs @@ -294,7 +294,7 @@ impl<'mir, 'tcx, Tag, M> InterpretCx<'mir, 'tcx, M> where // FIXME: Working around https://github.com/rust-lang/rust/issues/54385 Tag: ::std::fmt::Debug + Copy + Eq + Hash + 'static, - M: Machine<'mir, 'tcx, PointerTag=Tag>, + M: Machine<'mir, 'tcx, PointerTag = Tag>, // FIXME: Working around https://github.com/rust-lang/rust/issues/24159 M::MemoryMap: AllocMap, Allocation)>, M::AllocExtra: AllocationExtra, @@ -396,8 +396,7 @@ where pub fn mplace_array_fields( &self, base: MPlaceTy<'tcx, Tag>, - ) -> - InterpResult<'tcx, impl Iterator>> + 'tcx> + ) -> InterpResult<'tcx, impl Iterator>> + 'tcx> { let len = base.len(self)?; // also asserts that we have a type where this makes sense let stride = match base.layout.fields { diff --git a/src/librustc_mir/interpret/snapshot.rs b/src/librustc_mir/interpret/snapshot.rs index 1258dc041b83a..f52fa0cd48272 100644 --- a/src/librustc_mir/interpret/snapshot.rs +++ b/src/librustc_mir/interpret/snapshot.rs @@ -43,8 +43,7 @@ pub(crate) struct InfiniteLoopDetector<'mir, 'tcx> { snapshots: FxHashSet>, } -impl<'mir, 'tcx> InfiniteLoopDetector<'mir, 'tcx> -{ +impl<'mir, 'tcx> InfiniteLoopDetector<'mir, 'tcx> { pub fn observe_and_analyze( &mut self, tcx: TyCtxt<'tcx, 'tcx>, @@ -392,7 +391,7 @@ struct InterpSnapshot<'mir, 'tcx> { impl InterpSnapshot<'mir, 'tcx> { fn new( memory: &Memory<'mir, 'tcx, CompileTimeInterpreter<'mir, 'tcx>>, - stack: &[Frame<'mir, 'tcx>] + stack: &[Frame<'mir, 'tcx>], ) -> Self { InterpSnapshot { memory: memory.clone(), @@ -407,7 +406,6 @@ impl InterpSnapshot<'mir, 'tcx> { // Start with the stack, iterate and recursively snapshot self.stack.iter().map(|frame| frame.snapshot(&self.memory)).collect() } - } impl<'mir, 'tcx> Hash for InterpSnapshot<'mir, 'tcx> { diff --git a/src/librustc_mir/interpret/validity.rs b/src/librustc_mir/interpret/validity.rs index ef11fce513cd5..8a8cc0fe1d174 100644 --- a/src/librustc_mir/interpret/validity.rs +++ b/src/librustc_mir/interpret/validity.rs @@ -235,8 +235,8 @@ impl<'rt, 'mir, 'tcx, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, 'tcx, M } } -impl<'rt, 'mir, 'tcx, M: Machine<'mir, 'tcx>> - ValueVisitor<'mir, 'tcx, M> for ValidityVisitor<'rt, 'mir, 'tcx, M> +impl<'rt, 'mir, 'tcx, M: Machine<'mir, 'tcx>> ValueVisitor<'mir, 'tcx, M> + for ValidityVisitor<'rt, 'mir, 'tcx, M> { type V = OpTy<'tcx, M::PointerTag>; diff --git a/src/librustc_mir/interpret/visitor.rs b/src/librustc_mir/interpret/visitor.rs index accf9914e0d0e..9150f16526ba7 100644 --- a/src/librustc_mir/interpret/visitor.rs +++ b/src/librustc_mir/interpret/visitor.rs @@ -14,8 +14,7 @@ use super::{ // A thing that we can project into, and that has a layout. // This wouldn't have to depend on `Machine` but with the current type inference, // that's just more convenient to work with (avoids repeating all the `Machine` bounds). -pub trait Value<'mir, 'tcx, M: Machine<'mir, 'tcx>>: Copy -{ +pub trait Value<'mir, 'tcx, M: Machine<'mir, 'tcx>>: Copy { /// Gets this value's layout. fn layout(&self) -> TyLayout<'tcx>; @@ -45,9 +44,7 @@ pub trait Value<'mir, 'tcx, M: Machine<'mir, 'tcx>>: Copy // Operands and memory-places are both values. // Places in general are not due to `place_field` having to do `force_allocation`. -impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Value<'mir, 'tcx, M> - for OpTy<'tcx, M::PointerTag> -{ +impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Value<'mir, 'tcx, M> for OpTy<'tcx, M::PointerTag> { #[inline(always)] fn layout(&self) -> TyLayout<'tcx> { self.layout @@ -84,9 +81,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Value<'mir, 'tcx, M> ecx.operand_field(self, field) } } -impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Value<'mir, 'tcx, M> - for MPlaceTy<'tcx, M::PointerTag> -{ +impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Value<'mir, 'tcx, M> for MPlaceTy<'tcx, M::PointerTag> { #[inline(always)] fn layout(&self) -> TyLayout<'tcx> { self.layout diff --git a/src/librustc_mir/lints.rs b/src/librustc_mir/lints.rs index 1cd48312412cc..621fb8a4b22b3 100644 --- a/src/librustc_mir/lints.rs +++ b/src/librustc_mir/lints.rs @@ -7,9 +7,7 @@ use rustc::mir::{self, Body, TerminatorKind}; use rustc::ty::{self, AssocItem, AssocItemContainer, Instance, TyCtxt}; use rustc::ty::subst::InternalSubsts; -pub fn check(tcx: TyCtxt<'tcx, 'tcx>, - body: &Body<'tcx>, - def_id: DefId) { +pub fn check(tcx: TyCtxt<'tcx, 'tcx>, body: &Body<'tcx>, def_id: DefId) { let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); if let Some(fn_like_node) = FnLikeNode::from_node(tcx.hir().get_by_hir_id(hir_id)) { @@ -17,10 +15,12 @@ pub fn check(tcx: TyCtxt<'tcx, 'tcx>, } } -fn check_fn_for_unconditional_recursion(tcx: TyCtxt<'tcx, 'tcx>, - fn_kind: FnKind<'_>, - body: &Body<'tcx>, - def_id: DefId) { +fn check_fn_for_unconditional_recursion( + tcx: TyCtxt<'tcx, 'tcx>, + fn_kind: FnKind<'_>, + body: &Body<'tcx>, + def_id: DefId, +) { if let FnKind::Closure(_) = fn_kind { // closures can't recur, so they don't matter. return; diff --git a/src/librustc_mir/monomorphize/collector.rs b/src/librustc_mir/monomorphize/collector.rs index 30d1ea726f9a8..0b7dbfeacda59 100644 --- a/src/librustc_mir/monomorphize/collector.rs +++ b/src/librustc_mir/monomorphize/collector.rs @@ -281,10 +281,10 @@ impl<'tcx> InliningMap<'tcx> { } } -pub fn collect_crate_mono_items<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - mode: MonoItemCollectionMode) - -> (FxHashSet>, - InliningMap<'tcx>) { +pub fn collect_crate_mono_items<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + mode: MonoItemCollectionMode, +) -> (FxHashSet>, InliningMap<'tcx>) { let roots = time(tcx.sess, "collecting roots", || { collect_roots(tcx, mode) }); @@ -315,9 +315,10 @@ pub fn collect_crate_mono_items<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, // Find all non-generic items by walking the HIR. These items serve as roots to // start monomorphizing from. -fn collect_roots<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - mode: MonoItemCollectionMode) - -> Vec> { +fn collect_roots<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + mode: MonoItemCollectionMode, +) -> Vec> { debug!("Collecting roots"); let mut roots = Vec::new(); @@ -347,11 +348,13 @@ fn collect_roots<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, } // Collect all monomorphized items reachable from `starting_point` -fn collect_items_rec<'a, 'tcx: 'a>(tcx: TyCtxt<'tcx, 'tcx>, - starting_point: MonoItem<'tcx>, - visited: MTRef<'_, MTLock>>>, - recursion_depths: &mut DefIdMap, - inlining_map: MTRef<'_, MTLock>>) { +fn collect_items_rec<'a, 'tcx: 'a>( + tcx: TyCtxt<'tcx, 'tcx>, + starting_point: MonoItem<'tcx>, + visited: MTRef<'_, MTLock>>>, + recursion_depths: &mut DefIdMap, + inlining_map: MTRef<'_, MTLock>>, +) { if !visited.lock_mut().insert(starting_point.clone()) { // We've been here already, no need to search again. return; @@ -413,10 +416,12 @@ fn collect_items_rec<'a, 'tcx: 'a>(tcx: TyCtxt<'tcx, 'tcx>, debug!("END collect_items_rec({})", starting_point.to_string(tcx, true)); } -fn record_accesses<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - caller: MonoItem<'tcx>, - callees: &[MonoItem<'tcx>], - inlining_map: MTRef<'_, MTLock>>) { +fn record_accesses<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + caller: MonoItem<'tcx>, + callees: &[MonoItem<'tcx>], + inlining_map: MTRef<'_, MTLock>>, +) { let is_inlining_candidate = |mono_item: &MonoItem<'tcx>| { mono_item.instantiation_mode(tcx) == InstantiationMode::LocalCopy }; @@ -429,10 +434,11 @@ fn record_accesses<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, inlining_map.lock_mut().record_accesses(caller, accesses); } -fn check_recursion_limit<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - instance: Instance<'tcx>, - recursion_depths: &mut DefIdMap) - -> (DefId, usize) { +fn check_recursion_limit<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + instance: Instance<'tcx>, + recursion_depths: &mut DefIdMap, +) -> (DefId, usize) { let def_id = instance.def_id(); let recursion_depth = recursion_depths.get(&def_id).cloned().unwrap_or(0); debug!(" => recursion depth={}", recursion_depth); @@ -463,9 +469,7 @@ fn check_recursion_limit<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, (def_id, recursion_depth) } -fn check_type_length_limit<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - instance: Instance<'tcx>) -{ +fn check_type_length_limit<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, instance: Instance<'tcx>) { let type_length = instance.substs.types().flat_map(|ty| ty.walk()).count(); let const_length = instance.substs.consts().flat_map(|ct| ct.ty.walk()).count(); debug!(" => type length={}, const length={}", type_length, const_length); @@ -679,20 +683,22 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> { } } -fn visit_drop_use<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - ty: Ty<'tcx>, - is_direct_call: bool, - output: &mut Vec>) -{ +fn visit_drop_use<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + ty: Ty<'tcx>, + is_direct_call: bool, + output: &mut Vec>, +) { let instance = Instance::resolve_drop_in_place(tcx, ty); visit_instance_use(tcx, instance, is_direct_call, output); } -fn visit_fn_use<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - ty: Ty<'tcx>, - is_direct_call: bool, - output: &mut Vec>) -{ +fn visit_fn_use<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + ty: Ty<'tcx>, + is_direct_call: bool, + output: &mut Vec>, +) { if let ty::FnDef(def_id, substs) = ty.sty { let instance = ty::Instance::resolve(tcx, ty::ParamEnv::reveal_all(), @@ -702,11 +708,12 @@ fn visit_fn_use<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, } } -fn visit_instance_use<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - instance: ty::Instance<'tcx>, - is_direct_call: bool, - output: &mut Vec>) -{ +fn visit_instance_use<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + instance: ty::Instance<'tcx>, + is_direct_call: bool, + output: &mut Vec>, +) { debug!("visit_item_use({:?}, is_direct_call={:?})", instance, is_direct_call); if !should_monomorphize_locally(tcx, &instance) { return @@ -741,8 +748,7 @@ fn visit_instance_use<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, // Returns true if we should codegen an instance in the local crate. // Returns false if we can just link to the upstream crate and therefore don't // need a mono item. -fn should_monomorphize_locally<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, instance: &Instance<'tcx>) - -> bool { +fn should_monomorphize_locally<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, instance: &Instance<'tcx>) -> bool { let def_id = match instance.def { ty::InstanceDef::Item(def_id) => def_id, ty::InstanceDef::VtableShim(..) | @@ -776,10 +782,11 @@ fn should_monomorphize_locally<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, instance: &Instanc } return true; - fn is_available_upstream_generic<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - def_id: DefId, - substs: SubstsRef<'tcx>) - -> bool { + fn is_available_upstream_generic<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + def_id: DefId, + substs: SubstsRef<'tcx>, + ) -> bool { debug_assert!(!def_id.is_local()); // If we are not in share generics mode, we don't link to upstream @@ -841,10 +848,11 @@ fn should_monomorphize_locally<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, instance: &Instanc /// /// Finally, there is also the case of custom unsizing coercions, e.g., for /// smart pointers such as `Rc` and `Arc`. -fn find_vtable_types_for_unsizing<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - source_ty: Ty<'tcx>, - target_ty: Ty<'tcx>) - -> (Ty<'tcx>, Ty<'tcx>) { +fn find_vtable_types_for_unsizing<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + source_ty: Ty<'tcx>, + target_ty: Ty<'tcx>, +) -> (Ty<'tcx>, Ty<'tcx>) { let ptr_vtable = |inner_source: Ty<'tcx>, inner_target: Ty<'tcx>| { let type_has_metadata = |ty: Ty<'tcx>| -> bool { use syntax_pos::DUMMY_SP; @@ -914,10 +922,12 @@ fn create_fn_mono_item<'tcx>(instance: Instance<'tcx>) -> MonoItem<'tcx> { /// Creates a `MonoItem` for each method that is referenced by the vtable for /// the given trait/impl pair. -fn create_mono_items_for_vtable_methods<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - trait_ty: Ty<'tcx>, - impl_ty: Ty<'tcx>, - output: &mut Vec>) { +fn create_mono_items_for_vtable_methods<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + trait_ty: Ty<'tcx>, + impl_ty: Ty<'tcx>, + output: &mut Vec>, +) { assert!(!trait_ty.needs_subst() && !trait_ty.has_escaping_bound_vars() && !impl_ty.needs_subst() && !impl_ty.has_escaping_bound_vars()); @@ -1112,9 +1122,11 @@ fn item_requires_monomorphization<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) generics.requires_monomorphization(tcx) } -fn create_mono_items_for_default_impls<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - item: &'tcx hir::Item, - output: &mut Vec>) { +fn create_mono_items_for_default_impls<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + item: &'tcx hir::Item, + output: &mut Vec>, +) { match item.node { hir::ItemKind::Impl(_, _, _, ref generics, .., ref impl_item_refs) => { for param in &generics.params { @@ -1207,10 +1219,11 @@ fn collect_miri<'tcx>( } /// Scan the MIR in order to find function calls, closures, and drop-glue -fn collect_neighbours<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - instance: Instance<'tcx>, - output: &mut Vec>) -{ +fn collect_neighbours<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + instance: Instance<'tcx>, + output: &mut Vec>, +) { let body = tcx.instance_mir(instance.def); MirNeighborCollector { @@ -1237,9 +1250,7 @@ fn collect_neighbours<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, } } -fn def_id_to_string<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - def_id: DefId) - -> String { +fn def_id_to_string<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> String { let mut output = String::new(); let printer = DefPathBasedNames::new(tcx, false, false); printer.push_def_path(def_id, &mut output); diff --git a/src/librustc_mir/monomorphize/item.rs b/src/librustc_mir/monomorphize/item.rs index 2ba9600dfc9f0..1450534af5e56 100644 --- a/src/librustc_mir/monomorphize/item.rs +++ b/src/librustc_mir/monomorphize/item.rs @@ -62,9 +62,7 @@ pub trait MonoItemExt<'tcx>: fmt::Debug { } } } - fn instantiation_mode(&self, - tcx: TyCtxt<'tcx, 'tcx>) - -> InstantiationMode { + 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 @@ -170,11 +168,12 @@ pub trait MonoItemExt<'tcx>: fmt::Debug { } }; - fn to_string_internal<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - prefix: &str, - instance: Instance<'tcx>, - debug: bool) - -> String { + fn to_string_internal<'a, '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); diff --git a/src/librustc_mir/monomorphize/mod.rs b/src/librustc_mir/monomorphize/mod.rs index 929c2126b4d9e..667c0d7b29c5e 100644 --- a/src/librustc_mir/monomorphize/mod.rs +++ b/src/librustc_mir/monomorphize/mod.rs @@ -5,10 +5,11 @@ use rustc::ty::{self, Ty, TyCtxt}; pub mod collector; pub mod partitioning; -pub fn custom_coerce_unsize_info<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - source_ty: Ty<'tcx>, - target_ty: Ty<'tcx>) - -> CustomCoerceUnsized { +pub fn custom_coerce_unsize_info<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + source_ty: Ty<'tcx>, + target_ty: Ty<'tcx>, +) -> CustomCoerceUnsized { let def_id = tcx.lang_items().coerce_unsized_trait().unwrap(); let trait_ref = ty::Binder::bind(ty::TraitRef { diff --git a/src/librustc_mir/monomorphize/partitioning.rs b/src/librustc_mir/monomorphize/partitioning.rs index 38c887751b68f..f05ccc45c9c4c 100644 --- a/src/librustc_mir/monomorphize/partitioning.rs +++ b/src/librustc_mir/monomorphize/partitioning.rs @@ -125,12 +125,14 @@ fn fallback_cgu_name(name_builder: &mut CodegenUnitNameBuilder<'_, '_>) -> Inter name_builder.build_cgu_name(LOCAL_CRATE, &["fallback"], Some("cgu")) } -pub fn partition<'tcx, I>(tcx: TyCtxt<'tcx, 'tcx>, - mono_items: I, - strategy: PartitioningStrategy, - inlining_map: &InliningMap<'tcx>) - -> Vec> - where I: Iterator> +pub fn partition<'tcx, I>( + tcx: TyCtxt<'tcx, 'tcx>, + mono_items: I, + strategy: PartitioningStrategy, + inlining_map: &InliningMap<'tcx>, +) -> Vec> +where + I: Iterator>, { // In the first step, we place all regular monomorphizations into their // respective 'home' codegen unit. Regular monomorphizations are all @@ -201,10 +203,12 @@ struct PostInliningPartitioning<'tcx> { internalization_candidates: FxHashSet>, } -fn place_root_mono_items<'tcx, I>(tcx: TyCtxt<'tcx, 'tcx>, - mono_items: I) - -> PreInliningPartitioning<'tcx> - where I: Iterator> +fn place_root_mono_items<'tcx, I>( + tcx: TyCtxt<'tcx, 'tcx>, + mono_items: I, +) -> PreInliningPartitioning<'tcx> +where + I: Iterator>, { let mut roots = FxHashSet::default(); let mut codegen_units = FxHashMap::default(); @@ -463,9 +467,11 @@ fn default_visibility(tcx: TyCtxt<'_, '_>, id: DefId, is_generic: bool) -> Visib } } -fn merge_codegen_units<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - initial_partitioning: &mut PreInliningPartitioning<'tcx>, - target_cgu_count: usize) { +fn merge_codegen_units<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + initial_partitioning: &mut PreInliningPartitioning<'tcx>, + target_cgu_count: usize, +) { assert!(target_cgu_count >= 1); let codegen_units = &mut initial_partitioning.codegen_units; @@ -585,9 +591,11 @@ fn place_inlined_mono_items<'tcx>(initial_partitioning: PreInliningPartitioning< } } -fn internalize_symbols<'tcx>(_tcx: TyCtxt<'tcx, 'tcx>, - partitioning: &mut PostInliningPartitioning<'tcx>, - inlining_map: &InliningMap<'tcx>) { +fn internalize_symbols<'tcx>( + _tcx: TyCtxt<'tcx, 'tcx>, + partitioning: &mut PostInliningPartitioning<'tcx>, + inlining_map: &InliningMap<'tcx>, +) { if partitioning.codegen_units.len() == 1 { // Fast path for when there is only one codegen unit. In this case we // can internalize all candidates, since there is nowhere else they @@ -650,9 +658,10 @@ fn internalize_symbols<'tcx>(_tcx: TyCtxt<'tcx, 'tcx>, } } -fn characteristic_def_id_of_mono_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - mono_item: MonoItem<'tcx>) - -> Option { +fn characteristic_def_id_of_mono_item<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + mono_item: MonoItem<'tcx>, +) -> Option { match mono_item { MonoItem::Fn(instance) => { let def_id = match instance.def { @@ -698,12 +707,13 @@ fn characteristic_def_id_of_mono_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, type CguNameCache = FxHashMap<(DefId, bool), InternedString>; -fn compute_codegen_unit_name(tcx: TyCtxt<'_, '_>, - name_builder: &mut CodegenUnitNameBuilder<'_, '_>, - def_id: DefId, - volatile: bool, - cache: &mut CguNameCache) - -> InternedString { +fn compute_codegen_unit_name( + tcx: TyCtxt<'_, '_>, + name_builder: &mut CodegenUnitNameBuilder<'_, '_>, + def_id: DefId, + volatile: bool, + cache: &mut CguNameCache, +) -> InternedString { // Find the innermost module that is not nested within a function. let mut current_def_id = def_id; let mut cgu_def_id = None; @@ -752,17 +762,17 @@ fn compute_codegen_unit_name(tcx: TyCtxt<'_, '_>, }).clone() } -fn numbered_codegen_unit_name(name_builder: &mut CodegenUnitNameBuilder<'_, '_>, - index: usize) - -> InternedString { +fn numbered_codegen_unit_name( + name_builder: &mut CodegenUnitNameBuilder<'_, '_>, + index: usize, +) -> InternedString { name_builder.build_cgu_name_no_mangle(LOCAL_CRATE, &["cgu"], Some(index)) } -fn debug_dump<'a, 'b, 'tcx, I>(tcx: TyCtxt<'tcx, 'tcx>, - label: &str, - cgus: I) - where I: Iterator>, - 'tcx: 'a + 'b +fn debug_dump<'a, 'b, 'tcx, I>(tcx: TyCtxt<'tcx, 'tcx>, label: &str, cgus: I) +where + I: Iterator>, + 'tcx: 'a + 'b, { if cfg!(debug_assertions) { debug!("{}", label); @@ -788,7 +798,8 @@ fn debug_dump<'a, 'b, 'tcx, I>(tcx: TyCtxt<'tcx, 'tcx>, #[inline(never)] // give this a place in the profiler fn assert_symbols_are_distinct<'a, 'tcx: 'a, I>(tcx: TyCtxt<'tcx, 'tcx>, mono_items: I) - where I: Iterator> +where + I: Iterator>, { let mut symbols: Vec<_> = mono_items.map(|mono_item| { (mono_item, mono_item.symbol_name(tcx)) @@ -833,8 +844,7 @@ fn assert_symbols_are_distinct<'a, 'tcx: 'a, I>(tcx: TyCtxt<'tcx, 'tcx>, mono_it fn collect_and_partition_mono_items<'tcx>( tcx: TyCtxt<'tcx, 'tcx>, cnum: CrateNum, -) -> (Arc, Arc>>>) -{ +) -> (Arc, Arc>>>) { assert_eq!(cnum, LOCAL_CRATE); let collection_mode = match tcx.sess.opts.debugging_opts.print_mono_items { diff --git a/src/librustc_mir/shim.rs b/src/librustc_mir/shim.rs index f63e6996ddcbf..ea11901672a23 100644 --- a/src/librustc_mir/shim.rs +++ b/src/librustc_mir/shim.rs @@ -26,10 +26,7 @@ pub fn provide(providers: &mut Providers<'_>) { providers.mir_shims = make_shim; } -fn make_shim<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - instance: ty::InstanceDef<'tcx>) - -> &'tcx Body<'tcx> -{ +fn make_shim<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, instance: ty::InstanceDef<'tcx>) -> &'tcx Body<'tcx> { debug!("make_shim({:?})", instance); let mut result = match instance { @@ -166,11 +163,11 @@ fn local_decls_for_sig<'tcx>(sig: &ty::FnSig<'tcx>, span: Span) .collect() } -fn build_drop_shim<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - def_id: DefId, - ty: Option>) - -> Body<'tcx> -{ +fn build_drop_shim<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + def_id: DefId, + ty: Option>, +) -> Body<'tcx> { debug!("build_drop_shim(def_id={:?}, ty={:?})", def_id, ty); // Check if this is a generator, if so, return the drop glue for it @@ -273,7 +270,9 @@ impl<'a, 'tcx> DropElaborator<'a, 'tcx> for DropShimElaborator<'a, 'tcx> { fn patch(&mut self) -> &mut MirPatch<'tcx> { &mut self.patch } fn body(&self) -> &'a Body<'tcx> { self.body } - fn tcx(&self) -> TyCtxt<'tcx, 'tcx> { self.tcx } + fn tcx(&self) -> TyCtxt<'tcx, 'tcx> { + self.tcx + } fn param_env(&self) -> ty::ParamEnv<'tcx> { self.param_env } fn drop_style(&self, _path: Self::Path, mode: DropFlagMode) -> DropStyle { @@ -306,11 +305,7 @@ impl<'a, 'tcx> DropElaborator<'a, 'tcx> for DropShimElaborator<'a, 'tcx> { } /// Builds a `Clone::clone` shim for `self_ty`. Here, `def_id` is `Clone::clone`. -fn build_clone_shim<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - def_id: DefId, - self_ty: Ty<'tcx>) - -> Body<'tcx> -{ +fn build_clone_shim<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, self_ty: Ty<'tcx>) -> Body<'tcx> { debug!("build_clone_shim(def_id={:?})", def_id); let mut builder = CloneShimBuilder::new(tcx, def_id, self_ty); @@ -350,9 +345,7 @@ struct CloneShimBuilder<'tcx> { } impl CloneShimBuilder<'tcx> { - fn new(tcx: TyCtxt<'tcx, 'tcx>, - def_id: DefId, - self_ty: Ty<'tcx>) -> Self { + fn new(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, self_ty: Ty<'tcx>) -> Self { // we must subst the self_ty because it's // otherwise going to be TySelf and we can't index // or access fields of a Place of type TySelf. @@ -691,13 +684,13 @@ impl CloneShimBuilder<'tcx> { /// /// If `untuple_args` is a vec of types, the second argument of the /// function will be untupled as these types. -fn build_call_shim<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - def_id: DefId, - rcvr_adjustment: Adjustment, - call_kind: CallKind, - untuple_args: Option<&[Ty<'tcx>]>) - -> Body<'tcx> -{ +fn build_call_shim<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + def_id: DefId, + rcvr_adjustment: Adjustment, + call_kind: CallKind, + untuple_args: Option<&[Ty<'tcx>]>, +) -> Body<'tcx> { debug!("build_call_shim(def_id={:?}, rcvr_adjustment={:?}, \ call_kind={:?}, untuple_args={:?})", def_id, rcvr_adjustment, call_kind, untuple_args); diff --git a/src/librustc_mir/transform/add_call_guards.rs b/src/librustc_mir/transform/add_call_guards.rs index f71a1b42611d1..56c824167e185 100644 --- a/src/librustc_mir/transform/add_call_guards.rs +++ b/src/librustc_mir/transform/add_call_guards.rs @@ -31,10 +31,12 @@ pub use self::AddCallGuards::*; */ impl MirPass for AddCallGuards { - fn run_pass<'tcx>(&self, - _tcx: TyCtxt<'tcx, 'tcx>, - _src: MirSource<'tcx>, - body: &mut Body<'tcx>) { + fn run_pass<'tcx>( + &self, + _tcx: TyCtxt<'tcx, 'tcx>, + _src: MirSource<'tcx>, + body: &mut Body<'tcx>, + ) { self.add_call_guards(body); } } diff --git a/src/librustc_mir/transform/add_moves_for_packed_drops.rs b/src/librustc_mir/transform/add_moves_for_packed_drops.rs index e0b8805ebfb34..673b13a22d3d7 100644 --- a/src/librustc_mir/transform/add_moves_for_packed_drops.rs +++ b/src/librustc_mir/transform/add_moves_for_packed_drops.rs @@ -40,11 +40,7 @@ use crate::util; pub struct AddMovesForPackedDrops; impl MirPass for AddMovesForPackedDrops { - fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx>, - src: MirSource<'tcx>, - body: &mut Body<'tcx>) - { + fn run_pass<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx>, src: MirSource<'tcx>, body: &mut Body<'tcx>) { debug!("add_moves_for_packed_drops({:?} @ {:?})", src, body.span); add_moves_for_packed_drops(tcx, body, src.def_id()); } @@ -53,8 +49,8 @@ impl MirPass for AddMovesForPackedDrops { pub fn add_moves_for_packed_drops<'tcx>( tcx: TyCtxt<'tcx, 'tcx>, body: &mut Body<'tcx>, - def_id: DefId) -{ + def_id: DefId, +) { let patch = add_moves_for_packed_drops_patch(tcx, body, def_id); patch.apply(body); } @@ -62,9 +58,8 @@ pub fn add_moves_for_packed_drops<'tcx>( fn add_moves_for_packed_drops_patch<'tcx>( tcx: TyCtxt<'tcx, 'tcx>, body: &Body<'tcx>, - def_id: DefId) - -> MirPatch<'tcx> -{ + def_id: DefId, +) -> MirPatch<'tcx> { let mut patch = MirPatch::new(body); let param_env = tcx.param_env(def_id); @@ -96,8 +91,8 @@ fn add_move_for_packed_drop<'tcx>( patch: &mut MirPatch<'tcx>, terminator: &Terminator<'tcx>, loc: Location, - is_cleanup: bool) -{ + is_cleanup: bool, +) { debug!("add_move_for_packed_drop({:?} @ {:?})", terminator, loc); let (location, target, unwind) = match terminator.kind { TerminatorKind::Drop { ref location, target, unwind } => diff --git a/src/librustc_mir/transform/add_retag.rs b/src/librustc_mir/transform/add_retag.rs index 8f6c83e170294..a67fce9028a32 100644 --- a/src/librustc_mir/transform/add_retag.rs +++ b/src/librustc_mir/transform/add_retag.rs @@ -74,11 +74,12 @@ fn may_have_reference<'gcx, 'tcx>(ty: Ty<'tcx>, tcx: TyCtxt<'gcx, 'tcx>) -> bool } impl MirPass for AddRetag { - fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx>, - _src: MirSource<'tcx>, - body: &mut Body<'tcx>) - { + fn run_pass<'tcx>( + &self, + tcx: TyCtxt<'tcx, 'tcx>, + _src: MirSource<'tcx>, + body: &mut Body<'tcx>, + ) { if !tcx.sess.opts.debugging_opts.mir_emit_retag { return; } diff --git a/src/librustc_mir/transform/check_unsafety.rs b/src/librustc_mir/transform/check_unsafety.rs index 84462c3940df4..0adb37b8722a3 100644 --- a/src/librustc_mir/transform/check_unsafety.rs +++ b/src/librustc_mir/transform/check_unsafety.rs @@ -480,11 +480,12 @@ impl<'a, 'tcx> hir::intravisit::Visitor<'tcx> for UnusedUnsafeVisitor<'a> { } } -fn check_unused_unsafe<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - def_id: DefId, - used_unsafe: &FxHashSet, - unsafe_blocks: &'a mut Vec<(hir::HirId, bool)>) -{ +fn check_unused_unsafe<'a, 'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + def_id: DefId, + used_unsafe: &FxHashSet, + unsafe_blocks: &'a mut Vec<(hir::HirId, bool)>, +) { let body_id = tcx.hir().as_local_hir_id(def_id).and_then(|hir_id| { tcx.hir().maybe_body_owned_by_by_hir_id(hir_id) @@ -505,9 +506,7 @@ fn check_unused_unsafe<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx>, hir::intravisit::Visitor::visit_body(&mut visitor, body); } -fn unsafety_check_result<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) - -> UnsafetyCheckResult -{ +fn unsafety_check_result<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> UnsafetyCheckResult { debug!("unsafety_violations({:?})", def_id); // N.B., this borrow is valid because all the consumers of @@ -566,9 +565,11 @@ fn unsafe_derive_on_repr_packed<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) { } /// Returns the `HirId` for an enclosing scope that is also `unsafe`. -fn is_enclosed(tcx: TyCtxt<'_, '_>, - used_unsafe: &FxHashSet, - id: hir::HirId) -> Option<(String, hir::HirId)> { +fn is_enclosed( + tcx: TyCtxt<'_, '_>, + used_unsafe: &FxHashSet, + id: hir::HirId, +) -> Option<(String, hir::HirId)> { let parent_id = tcx.hir().get_parent_node_by_hir_id(id); if parent_id != id { if used_unsafe.contains(&parent_id) { @@ -589,9 +590,7 @@ fn is_enclosed(tcx: TyCtxt<'_, '_>, } } -fn report_unused_unsafe(tcx: TyCtxt<'_, '_>, - used_unsafe: &FxHashSet, - id: hir::HirId) { +fn report_unused_unsafe(tcx: TyCtxt<'_, '_>, used_unsafe: &FxHashSet, id: hir::HirId) { let span = tcx.sess.source_map().def_span(tcx.hir().span_by_hir_id(id)); let msg = "unnecessary `unsafe` block"; let mut db = tcx.struct_span_lint_hir(UNUSED_UNSAFE, id, span, msg); diff --git a/src/librustc_mir/transform/cleanup_post_borrowck.rs b/src/librustc_mir/transform/cleanup_post_borrowck.rs index f552e635299e9..fb4fdf73a9389 100644 --- a/src/librustc_mir/transform/cleanup_post_borrowck.rs +++ b/src/librustc_mir/transform/cleanup_post_borrowck.rs @@ -27,10 +27,12 @@ pub struct CleanupNonCodegenStatements; pub struct DeleteNonCodegenStatements; impl MirPass for CleanupNonCodegenStatements { - fn run_pass<'tcx>(&self, - _tcx: TyCtxt<'tcx, 'tcx>, - _source: MirSource<'tcx>, - body: &mut Body<'tcx>) { + fn run_pass<'tcx>( + &self, + _tcx: TyCtxt<'tcx, 'tcx>, + _source: MirSource<'tcx>, + body: &mut Body<'tcx>, + ) { let mut delete = DeleteNonCodegenStatements; delete.visit_body(body); } diff --git a/src/librustc_mir/transform/const_prop.rs b/src/librustc_mir/transform/const_prop.rs index 4a363f465a74f..dfc2e7e7c9d86 100644 --- a/src/librustc_mir/transform/const_prop.rs +++ b/src/librustc_mir/transform/const_prop.rs @@ -31,10 +31,12 @@ use crate::transform::{MirPass, MirSource}; pub struct ConstProp; impl MirPass for ConstProp { - fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx>, - source: MirSource<'tcx>, - body: &mut Body<'tcx>) { + fn run_pass<'tcx>( + &self, + tcx: TyCtxt<'tcx, 'tcx>, + source: MirSource<'tcx>, + body: &mut Body<'tcx>, + ) { // will be evaluated by miri and produce its errors there if source.promoted.is_some() { return; @@ -599,9 +601,11 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { } } -fn type_size_of<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - param_env: ty::ParamEnv<'tcx>, - ty: Ty<'tcx>) -> Option { +fn type_size_of<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + param_env: ty::ParamEnv<'tcx>, + ty: Ty<'tcx>, +) -> Option { tcx.layout_of(param_env.and(ty)).ok().map(|layout| layout.size.bytes()) } diff --git a/src/librustc_mir/transform/copy_prop.rs b/src/librustc_mir/transform/copy_prop.rs index 6282c7855f35c..aeb3ed5a2eca8 100644 --- a/src/librustc_mir/transform/copy_prop.rs +++ b/src/librustc_mir/transform/copy_prop.rs @@ -30,10 +30,12 @@ use crate::util::def_use::DefUseAnalysis; pub struct CopyPropagation; impl MirPass for CopyPropagation { - fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx>, - _source: MirSource<'tcx>, - body: &mut Body<'tcx>) { + fn run_pass<'tcx>( + &self, + tcx: TyCtxt<'tcx, 'tcx>, + _source: MirSource<'tcx>, + body: &mut Body<'tcx>, + ) { // We only run when the MIR optimization level is > 1. // This avoids a slow pass, and messing up debug info. if tcx.sess.opts.debugging_opts.mir_opt_level <= 1 { diff --git a/src/librustc_mir/transform/deaggregator.rs b/src/librustc_mir/transform/deaggregator.rs index 5ba7ba193d00e..87704f1221656 100644 --- a/src/librustc_mir/transform/deaggregator.rs +++ b/src/librustc_mir/transform/deaggregator.rs @@ -6,10 +6,12 @@ use crate::util::expand_aggregate; pub struct Deaggregator; impl MirPass for Deaggregator { - fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx>, - _source: MirSource<'tcx>, - body: &mut Body<'tcx>) { + fn run_pass<'tcx>( + &self, + tcx: TyCtxt<'tcx, 'tcx>, + _source: MirSource<'tcx>, + body: &mut Body<'tcx>, + ) { let (basic_blocks, local_decls) = body.basic_blocks_and_local_decls_mut(); let local_decls = &*local_decls; for bb in basic_blocks { diff --git a/src/librustc_mir/transform/dump_mir.rs b/src/librustc_mir/transform/dump_mir.rs index 52aafdef87ecb..96be0e6f6a9d7 100644 --- a/src/librustc_mir/transform/dump_mir.rs +++ b/src/librustc_mir/transform/dump_mir.rs @@ -18,11 +18,12 @@ impl MirPass for Marker { Cow::Borrowed(self.0) } - fn run_pass<'tcx>(&self, - _tcx: TyCtxt<'tcx, 'tcx>, - _source: MirSource<'tcx>, - _body: &mut Body<'tcx>) - { + fn run_pass<'tcx>( + &self, + _tcx: TyCtxt<'tcx, 'tcx>, + _source: MirSource<'tcx>, + _body: &mut Body<'tcx>, + ) { } } @@ -37,13 +38,14 @@ impl fmt::Display for Disambiguator { } } - -pub fn on_mir_pass<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - pass_num: &dyn fmt::Display, - pass_name: &str, - source: MirSource<'tcx>, - body: &Body<'tcx>, - is_after: bool) { +pub fn on_mir_pass<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + pass_num: &dyn fmt::Display, + pass_name: &str, + source: MirSource<'tcx>, + body: &Body<'tcx>, + is_after: bool, +) { if mir_util::dump_enabled(tcx, pass_name, source) { mir_util::dump_mir(tcx, Some(pass_num), @@ -55,11 +57,7 @@ pub fn on_mir_pass<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, } } -pub fn emit_mir<'tcx>( - tcx: TyCtxt<'tcx, 'tcx>, - outputs: &OutputFilenames) - -> io::Result<()> -{ +pub fn emit_mir<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, outputs: &OutputFilenames) -> io::Result<()> { let path = outputs.path(OutputType::Mir); let mut f = File::create(&path)?; mir_util::write_mir_pretty(tcx, None, &mut f)?; diff --git a/src/librustc_mir/transform/elaborate_drops.rs b/src/librustc_mir/transform/elaborate_drops.rs index 2a187753626fd..bf6237fa91acf 100644 --- a/src/librustc_mir/transform/elaborate_drops.rs +++ b/src/librustc_mir/transform/elaborate_drops.rs @@ -21,11 +21,7 @@ use syntax_pos::Span; pub struct ElaborateDrops; impl MirPass for ElaborateDrops { - fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx>, - src: MirSource<'tcx>, - body: &mut Body<'tcx>) - { + fn run_pass<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx>, src: MirSource<'tcx>, body: &mut Body<'tcx>) { debug!("elaborate_drops({:?} @ {:?})", src, body.span); let def_id = src.def_id(); @@ -77,13 +73,12 @@ impl MirPass for ElaborateDrops { /// Returns the set of basic blocks whose unwind edges are known /// to not be reachable, because they are `drop` terminators /// that can't drop anything. -fn find_dead_unwinds< 'tcx>( +fn find_dead_unwinds<'tcx>( tcx: TyCtxt<'tcx, 'tcx>, body: &Body<'tcx>, def_id: hir::def_id::DefId, - env: &MoveDataParamEnv<'tcx, 'tcx>) - -> BitSet -{ + env: &MoveDataParamEnv<'tcx, 'tcx>, +) -> BitSet { debug!("find_dead_unwinds({:?})", body.span); // We only need to do this pass once, because unwind edges can only // reach cleanup blocks, which can't have unwind edges themselves. @@ -141,12 +136,13 @@ struct InitializationData { } impl InitializationData { - fn apply_location<'tcx>(&mut self, - tcx: TyCtxt<'tcx, 'tcx>, - body: &Body<'tcx>, - env: &MoveDataParamEnv<'tcx, 'tcx>, - loc: Location) - { + fn apply_location<'tcx>( + &mut self, + tcx: TyCtxt<'tcx, 'tcx>, + body: &Body<'tcx>, + env: &MoveDataParamEnv<'tcx, 'tcx>, + loc: Location, + ) { drop_flag_effects_for_location(tcx, body, env, loc, |path, df| { debug!("at location {:?}: setting {:?} to {:?}", loc, path, df); @@ -294,7 +290,7 @@ struct ElaborateDropsCtxt<'a, 'tcx: 'a> { body: &'a Body<'tcx>, env: &'a MoveDataParamEnv<'tcx, 'tcx>, flow_inits: DataflowResults<'tcx, MaybeInitializedPlaces<'a, 'tcx, 'tcx>>, - flow_uninits: DataflowResults<'tcx, MaybeUninitializedPlaces<'a, 'tcx, 'tcx>>, + flow_uninits: DataflowResults<'tcx, MaybeUninitializedPlaces<'a, 'tcx, 'tcx>>, drop_flags: FxHashMap, patch: MirPatch<'tcx>, } diff --git a/src/librustc_mir/transform/erase_regions.rs b/src/librustc_mir/transform/erase_regions.rs index 78713fee82cd8..39d5770ee9a09 100644 --- a/src/librustc_mir/transform/erase_regions.rs +++ b/src/librustc_mir/transform/erase_regions.rs @@ -50,10 +50,7 @@ impl MutVisitor<'tcx> for EraseRegionsVisitor<'tcx> { pub struct EraseRegions; impl MirPass for EraseRegions { - fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx>, - _: MirSource<'tcx>, - body: &mut Body<'tcx>) { + fn run_pass<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx>, _: MirSource<'tcx>, body: &mut Body<'tcx>) { EraseRegionsVisitor::new(tcx).visit_body(body); } } diff --git a/src/librustc_mir/transform/generator.rs b/src/librustc_mir/transform/generator.rs index a3fef7c97b4c2..d369fec8c1e67 100644 --- a/src/librustc_mir/transform/generator.rs +++ b/src/librustc_mir/transform/generator.rs @@ -311,9 +311,10 @@ impl MutVisitor<'tcx> for TransformVisitor<'tcx> { } fn make_generator_state_argument_indirect<'tcx>( - tcx: TyCtxt<'tcx, 'tcx>, - def_id: DefId, - body: &mut Body<'tcx>) { + tcx: TyCtxt<'tcx, 'tcx>, + def_id: DefId, + body: &mut Body<'tcx>, +) { let gen_ty = body.local_decls.raw[1].ty; let region = ty::ReFree(ty::FreeRegion { @@ -335,9 +336,7 @@ fn make_generator_state_argument_indirect<'tcx>( DerefArgVisitor.visit_body(body); } -fn make_generator_state_argument_pinned<'tcx>( - tcx: TyCtxt<'tcx, 'tcx>, - body: &mut Body<'tcx>) { +fn make_generator_state_argument_pinned<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, body: &mut Body<'tcx>) { let ref_gen_ty = body.local_decls.raw[1].ty; let pin_did = tcx.lang_items().pin_type().unwrap(); @@ -678,16 +677,18 @@ impl<'body, 'tcx: 'body, 's> StorageConflictVisitor<'body, 'tcx, 's> { } } -fn compute_layout<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - source: MirSource<'tcx>, - upvars: &Vec>, - interior: Ty<'tcx>, - movable: bool, - body: &mut Body<'tcx>) - -> (FxHashMap, VariantIdx, usize)>, - GeneratorLayout<'tcx>, - FxHashMap) -{ +fn compute_layout<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + source: MirSource<'tcx>, + upvars: &Vec>, + interior: Ty<'tcx>, + movable: bool, + body: &mut Body<'tcx>, +) -> ( + FxHashMap, VariantIdx, usize)>, + GeneratorLayout<'tcx>, + FxHashMap, +) { // Use a liveness analysis to compute locals which are live across a suspension point let LivenessInfo { live_locals, live_locals_at_suspension_points, storage_conflicts, storage_liveness @@ -767,10 +768,12 @@ fn compute_layout<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, (remap, layout, storage_liveness) } -fn insert_switch<'tcx>(body: &mut Body<'tcx>, - cases: Vec<(usize, BasicBlock)>, - transform: &TransformVisitor<'tcx>, - default: TerminatorKind<'tcx>) { +fn insert_switch<'tcx>( + body: &mut Body<'tcx>, + cases: Vec<(usize, BasicBlock)>, + transform: &TransformVisitor<'tcx>, + default: TerminatorKind<'tcx>, +) { let default_block = insert_term_block(body, default); let (assign, discr) = transform.get_discr(body); let switch = TerminatorKind::SwitchInt { @@ -797,9 +800,7 @@ fn insert_switch<'tcx>(body: &mut Body<'tcx>, } } -fn elaborate_generator_drops<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - def_id: DefId, - body: &mut Body<'tcx>) { +fn elaborate_generator_drops<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, body: &mut Body<'tcx>) { use crate::util::elaborate_drops::{elaborate_drop, Unwind}; use crate::util::patch::MirPatch; use crate::shim::DropShimElaborator; @@ -849,13 +850,14 @@ fn elaborate_generator_drops<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, } fn create_generator_drop_shim<'tcx>( - tcx: TyCtxt<'tcx, 'tcx>, - transform: &TransformVisitor<'tcx>, - def_id: DefId, - source: MirSource<'tcx>, - gen_ty: Ty<'tcx>, - body: &Body<'tcx>, - drop_clean: BasicBlock) -> Body<'tcx> { + tcx: TyCtxt<'tcx, 'tcx>, + transform: &TransformVisitor<'tcx>, + def_id: DefId, + source: MirSource<'tcx>, + gen_ty: Ty<'tcx>, + body: &Body<'tcx>, + drop_clean: BasicBlock, +) -> Body<'tcx> { let mut body = body.clone(); let source_info = source_info(&body); @@ -939,9 +941,11 @@ fn insert_term_block<'tcx>(body: &mut Body<'tcx>, kind: TerminatorKind<'tcx>) -> term_block } -fn insert_panic_block<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - body: &mut Body<'tcx>, - message: AssertMessage<'tcx>) -> BasicBlock { +fn insert_panic_block<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + body: &mut Body<'tcx>, + message: AssertMessage<'tcx>, +) -> BasicBlock { let assert_block = BasicBlock::new(body.basic_blocks().len()); let term = TerminatorKind::Assert { cond: Operand::Constant(box Constant { @@ -970,11 +974,12 @@ fn insert_panic_block<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, } fn create_generator_resume_function<'tcx>( - tcx: TyCtxt<'tcx, 'tcx>, - transform: TransformVisitor<'tcx>, - def_id: DefId, - source: MirSource<'tcx>, - body: &mut Body<'tcx>) { + tcx: TyCtxt<'tcx, 'tcx>, + transform: TransformVisitor<'tcx>, + def_id: DefId, + source: MirSource<'tcx>, + body: &mut Body<'tcx>, +) { // Poison the generator when it unwinds for block in body.basic_blocks_mut() { let source_info = block.terminator().source_info; @@ -1042,10 +1047,14 @@ fn insert_clean_drop<'tcx>(body: &mut Body<'tcx>) -> BasicBlock { drop_clean } -fn create_cases<'tcx, F>(body: &mut Body<'tcx>, - transform: &TransformVisitor<'tcx>, - target: F) -> Vec<(usize, BasicBlock)> - where F: Fn(&SuspensionPoint) -> Option { +fn create_cases<'tcx, F>( + body: &mut Body<'tcx>, + transform: &TransformVisitor<'tcx>, + target: F, +) -> Vec<(usize, BasicBlock)> +where + F: Fn(&SuspensionPoint) -> Option, +{ let source_info = source_info(body); transform.suspension_points.iter().filter_map(|point| { @@ -1083,10 +1092,12 @@ fn create_cases<'tcx, F>(body: &mut Body<'tcx>, } impl MirPass for StateTransform { - fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx>, - source: MirSource<'tcx>, - body: &mut Body<'tcx>) { + fn run_pass<'tcx>( + &self, + tcx: TyCtxt<'tcx, 'tcx>, + source: MirSource<'tcx>, + body: &mut Body<'tcx>, + ) { let yield_ty = if let Some(yield_ty) = body.yield_ty { yield_ty } else { diff --git a/src/librustc_mir/transform/inline.rs b/src/librustc_mir/transform/inline.rs index 2818c11da4697..55c035f2858a2 100644 --- a/src/librustc_mir/transform/inline.rs +++ b/src/librustc_mir/transform/inline.rs @@ -38,10 +38,12 @@ struct CallSite<'tcx> { } impl MirPass for Inline { - fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx>, - source: MirSource<'tcx>, - body: &mut Body<'tcx>) { + fn run_pass<'tcx>( + &self, + tcx: TyCtxt<'tcx, 'tcx>, + source: MirSource<'tcx>, + body: &mut Body<'tcx>, + ) { if tcx.sess.opts.debugging_opts.mir_opt_level >= 2 { Inliner { tcx, source }.run_pass(body); } @@ -631,9 +633,11 @@ impl Inliner<'tcx> { } } -fn type_size_of<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - param_env: ty::ParamEnv<'tcx>, - ty: Ty<'tcx>) -> Option { +fn type_size_of<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + param_env: ty::ParamEnv<'tcx>, + ty: Ty<'tcx>, +) -> Option { tcx.layout_of(param_env.and(ty)).ok().map(|layout| layout.size.bytes()) } @@ -643,7 +647,7 @@ fn type_size_of<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, * Integrates blocks from the callee function into the calling function. * Updates block indices, references to locals and other control flow * stuff. - */ +*/ struct Integrator<'a, 'tcx: 'a> { block_idx: usize, args: &'a [Local], diff --git a/src/librustc_mir/transform/instcombine.rs b/src/librustc_mir/transform/instcombine.rs index 89be1ba0bdf2f..2194b780ab967 100644 --- a/src/librustc_mir/transform/instcombine.rs +++ b/src/librustc_mir/transform/instcombine.rs @@ -12,10 +12,7 @@ use crate::transform::{MirPass, MirSource}; pub struct InstCombine; impl MirPass for InstCombine { - fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx>, - _: MirSource<'tcx>, - body: &mut Body<'tcx>) { + fn run_pass<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx>, _: MirSource<'tcx>, body: &mut Body<'tcx>) { // We only run when optimizing MIR (at any level). if tcx.sess.opts.debugging_opts.mir_opt_level == 0 { return diff --git a/src/librustc_mir/transform/lower_128bit.rs b/src/librustc_mir/transform/lower_128bit.rs index 2b28eeb801ff8..34a982f72761f 100644 --- a/src/librustc_mir/transform/lower_128bit.rs +++ b/src/librustc_mir/transform/lower_128bit.rs @@ -10,10 +10,12 @@ use crate::transform::{MirPass, MirSource}; pub struct Lower128Bit; impl MirPass for Lower128Bit { - fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx>, - _src: MirSource<'tcx>, - body: &mut Body<'tcx>) { + fn run_pass<'tcx>( + &self, + tcx: TyCtxt<'tcx, 'tcx>, + _src: MirSource<'tcx>, + body: &mut Body<'tcx>, + ) { let debugging_override = tcx.sess.opts.debugging_opts.lower_128bit_ops; let target_default = tcx.sess.host.options.i128_lowering; if !debugging_override.unwrap_or(target_default) { @@ -21,7 +23,7 @@ impl MirPass for Lower128Bit { } self.lower_128bit_ops(tcx, body); - } +} } impl Lower128Bit { @@ -126,9 +128,10 @@ fn check_lang_item_type<'tcx, D>( lhs: &Operand<'tcx>, rhs: &Operand<'tcx>, local_decls: &D, - tcx: TyCtxt<'tcx, 'tcx>) --> DefId - where D: HasLocalDecls<'tcx> + tcx: TyCtxt<'tcx, 'tcx>, +) -> DefId +where + D: HasLocalDecls<'tcx>, { let did = tcx.require_lang_item(lang_item); let poly_sig = tcx.fn_sig(did); @@ -142,9 +145,13 @@ fn check_lang_item_type<'tcx, D>( did } -fn lower_to<'tcx, D>(statement: &Statement<'tcx>, local_decls: &D, tcx: TyCtxt<'tcx, 'tcx>) - -> Option<(LangItem, RhsKind)> - where D: HasLocalDecls<'tcx> +fn lower_to<'tcx, D>( + statement: &Statement<'tcx>, + local_decls: &D, + tcx: TyCtxt<'tcx, 'tcx>, +) -> Option<(LangItem, RhsKind)> +where + D: HasLocalDecls<'tcx>, { match statement.kind { StatementKind::Assign(_, box Rvalue::BinaryOp(bin_op, ref lhs, _)) => { diff --git a/src/librustc_mir/transform/mod.rs b/src/librustc_mir/transform/mod.rs index eb89648826748..6f369acec6440 100644 --- a/src/librustc_mir/transform/mod.rs +++ b/src/librustc_mir/transform/mod.rs @@ -56,8 +56,7 @@ fn is_mir_available<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> bool { /// Finds the full set of `DefId`s within the current crate that have /// MIR associated with them. -fn mir_keys<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, krate: CrateNum) - -> &'tcx DefIdSet { +fn mir_keys<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, krate: CrateNum) -> &'tcx DefIdSet { assert_eq!(krate, LOCAL_CRATE); let mut set = DefIdSet::default(); @@ -142,10 +141,12 @@ pub trait MirPass { default_name::() } - fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx>, - source: MirSource<'tcx>, - body: &mut Body<'tcx>); + fn run_pass<'tcx>( + &self, + tcx: TyCtxt<'tcx, 'tcx>, + source: MirSource<'tcx>, + body: &mut Body<'tcx>, + ); } pub fn run_passes( diff --git a/src/librustc_mir/transform/no_landing_pads.rs b/src/librustc_mir/transform/no_landing_pads.rs index 638aa1e7e02de..6f3f2269d44d2 100644 --- a/src/librustc_mir/transform/no_landing_pads.rs +++ b/src/librustc_mir/transform/no_landing_pads.rs @@ -9,10 +9,7 @@ use crate::transform::{MirPass, MirSource}; pub struct NoLandingPads; impl MirPass for NoLandingPads { - fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx>, - _: MirSource<'tcx>, - body: &mut Body<'tcx>) { + fn run_pass<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx>, _: MirSource<'tcx>, body: &mut Body<'tcx>) { no_landing_pads(tcx, body) } } diff --git a/src/librustc_mir/transform/promote_consts.rs b/src/librustc_mir/transform/promote_consts.rs index 7bbaa99798d5f..f3d05f065ce73 100644 --- a/src/librustc_mir/transform/promote_consts.rs +++ b/src/librustc_mir/transform/promote_consts.rs @@ -155,7 +155,7 @@ struct Promoter<'a, 'tcx: 'a> { /// If true, all nested temps are also kept in the /// source MIR, not moved to the promoted MIR. - keep_original: bool + keep_original: bool, } impl<'a, 'tcx> Promoter<'a, 'tcx> { @@ -369,10 +369,12 @@ impl<'a, 'tcx> MutVisitor<'tcx> for Promoter<'a, 'tcx> { } } -pub fn promote_candidates<'tcx>(body: &mut Body<'tcx>, - tcx: TyCtxt<'tcx, 'tcx>, - mut temps: IndexVec, - candidates: Vec) { +pub fn promote_candidates<'tcx>( + body: &mut Body<'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, + mut temps: IndexVec, + candidates: Vec, +) { // Visit candidates in reverse, in case they're nested. debug!("promote_candidates({:?})", candidates); diff --git a/src/librustc_mir/transform/qualify_consts.rs b/src/librustc_mir/transform/qualify_consts.rs index 32d3b4589629c..125411a717d1e 100644 --- a/src/librustc_mir/transform/qualify_consts.rs +++ b/src/librustc_mir/transform/qualify_consts.rs @@ -652,11 +652,7 @@ impl Deref for Checker<'a, 'tcx> { } impl<'a, 'tcx> Checker<'a, 'tcx> { - fn new(tcx: TyCtxt<'tcx, 'tcx>, - def_id: DefId, - body: &'a Body<'tcx>, - mode: Mode) - -> Self { + fn new(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, body: &'a Body<'tcx>, mode: Mode) -> Self { assert!(def_id.is_local()); let mut rpo = traversal::reverse_postorder(body); let temps = promote_consts::collect_temps(body, &mut rpo); @@ -1472,9 +1468,7 @@ pub fn provide(providers: &mut Providers<'_>) { }; } -fn mir_const_qualif<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - def_id: DefId) - -> (u8, &'tcx BitSet) { +fn mir_const_qualif<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> (u8, &'tcx BitSet) { // N.B., this `borrow()` is guaranteed to be valid (i.e., the value // cannot yet be stolen), because `mir_validated()`, which steals // from `mir_const(), forces this query to execute before @@ -1492,10 +1486,7 @@ fn mir_const_qualif<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, pub struct QualifyAndPromoteConstants; impl MirPass for QualifyAndPromoteConstants { - fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx>, - src: MirSource<'tcx>, - body: &mut Body<'tcx>) { + fn run_pass<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx>, src: MirSource<'tcx>, body: &mut Body<'tcx>) { // There's not really any point in promoting errorful MIR. if body.return_ty().references_error() { tcx.sess.delay_span_bug(body.span, "QualifyAndPromoteConstants: MIR had errors"); diff --git a/src/librustc_mir/transform/qualify_min_const_fn.rs b/src/librustc_mir/transform/qualify_min_const_fn.rs index 449d2d32456bd..7f5afb2394a46 100644 --- a/src/librustc_mir/transform/qualify_min_const_fn.rs +++ b/src/librustc_mir/transform/qualify_min_const_fn.rs @@ -8,11 +8,7 @@ use syntax_pos::Span; type McfResult = Result<(), (Span, Cow<'static, str>)>; -pub fn is_min_const_fn( - tcx: TyCtxt<'tcx, 'tcx>, - def_id: DefId, - body: &'a Body<'tcx>, -) -> McfResult { +pub fn is_min_const_fn(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, body: &'a Body<'tcx>) -> McfResult { let mut current = def_id; loop { let predicates = tcx.predicates_of(current); @@ -79,12 +75,7 @@ pub fn is_min_const_fn( Ok(()) } -fn check_ty( - tcx: TyCtxt<'tcx, 'tcx>, - ty: Ty<'tcx>, - span: Span, - fn_def_id: DefId, -) -> McfResult { +fn check_ty(tcx: TyCtxt<'tcx, 'tcx>, ty: Ty<'tcx>, span: Span, fn_def_id: DefId) -> McfResult { for ty in ty.walk() { match ty.sty { ty::Ref(_, _, hir::Mutability::MutMutable) => return Err(( diff --git a/src/librustc_mir/transform/remove_noop_landing_pads.rs b/src/librustc_mir/transform/remove_noop_landing_pads.rs index 23541a6e6bc7e..1a23fdce050b0 100644 --- a/src/librustc_mir/transform/remove_noop_landing_pads.rs +++ b/src/librustc_mir/transform/remove_noop_landing_pads.rs @@ -9,10 +9,7 @@ use crate::util::patch::MirPatch; /// code for these. pub struct RemoveNoopLandingPads; -pub fn remove_noop_landing_pads<'tcx>( - tcx: TyCtxt<'tcx, 'tcx>, - body: &mut Body<'tcx>) -{ +pub fn remove_noop_landing_pads<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, body: &mut Body<'tcx>) { if tcx.sess.no_landing_pads() { return } @@ -22,10 +19,12 @@ pub fn remove_noop_landing_pads<'tcx>( } impl MirPass for RemoveNoopLandingPads { - fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx>, - _src: MirSource<'tcx>, - body: &mut Body<'tcx>) { + fn run_pass<'tcx>( + &self, + tcx: TyCtxt<'tcx, 'tcx>, + _src: MirSource<'tcx>, + body: &mut Body<'tcx>, + ) { remove_noop_landing_pads(tcx, body); } } diff --git a/src/librustc_mir/transform/rustc_peek.rs b/src/librustc_mir/transform/rustc_peek.rs index 2a25cd2c9573a..1d57f5e27164d 100644 --- a/src/librustc_mir/transform/rustc_peek.rs +++ b/src/librustc_mir/transform/rustc_peek.rs @@ -25,8 +25,7 @@ use crate::dataflow::has_rustc_mir_with; pub struct SanityCheck; impl MirPass for SanityCheck { - fn run_pass<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx>, - src: MirSource<'tcx>, body: &mut Body<'tcx>) { + fn run_pass<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx>, src: MirSource<'tcx>, body: &mut Body<'tcx>) { let def_id = src.def_id(); if !tcx.has_attr(def_id, sym::rustc_mir) { debug!("skipping rustc_peek::SanityCheck on {}", tcx.def_path_str(def_id)); @@ -84,12 +83,14 @@ impl MirPass for SanityCheck { /// (If there are any calls to `rustc_peek` that do not match the /// expression form above, then that emits an error as well, but those /// errors are not intended to be used for unit tests.) -pub fn sanity_check_via_rustc_peek<'tcx, O>(tcx: TyCtxt<'tcx, 'tcx>, - body: &Body<'tcx>, - def_id: DefId, - _attributes: &[ast::Attribute], - results: &DataflowResults<'tcx, O>) - where O: BitDenotation<'tcx, Idx=MovePathIndex> + HasMoveData<'tcx> +pub fn sanity_check_via_rustc_peek<'tcx, O>( + tcx: TyCtxt<'tcx, 'tcx>, + body: &Body<'tcx>, + def_id: DefId, + _attributes: &[ast::Attribute], + results: &DataflowResults<'tcx, O>, +) where + O: BitDenotation<'tcx, Idx = MovePathIndex> + HasMoveData<'tcx>, { debug!("sanity_check_via_rustc_peek def_id: {:?}", def_id); // FIXME: this is not DRY. Figure out way to abstract this and @@ -101,11 +102,13 @@ pub fn sanity_check_via_rustc_peek<'tcx, O>(tcx: TyCtxt<'tcx, 'tcx>, } } -fn each_block<'tcx, O>(tcx: TyCtxt<'tcx, 'tcx>, - body: &Body<'tcx>, - results: &DataflowResults<'tcx, O>, - bb: mir::BasicBlock) where - O: BitDenotation<'tcx, Idx=MovePathIndex> + HasMoveData<'tcx> +fn each_block<'tcx, O>( + tcx: TyCtxt<'tcx, 'tcx>, + body: &Body<'tcx>, + results: &DataflowResults<'tcx, O>, + bb: mir::BasicBlock, +) where + O: BitDenotation<'tcx, Idx = MovePathIndex> + HasMoveData<'tcx>, { let move_data = results.0.operator.move_data(); let mir::BasicBlockData { ref statements, ref terminator, is_cleanup: _ } = body[bb]; @@ -214,9 +217,10 @@ fn each_block<'tcx, O>(tcx: TyCtxt<'tcx, 'tcx>, form `&expr`")); } -fn is_rustc_peek<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - terminator: &'a Option>) - -> Option<(&'a [mir::Operand<'tcx>], Span)> { +fn is_rustc_peek<'a, 'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + terminator: &'a Option>, +) -> Option<(&'a [mir::Operand<'tcx>], Span)> { if let Some(mir::Terminator { ref kind, source_info, .. }) = *terminator { if let mir::TerminatorKind::Call { func: ref oper, ref args, .. } = *kind { if let mir::Operand::Constant(ref func) = *oper { diff --git a/src/librustc_mir/transform/simplify.rs b/src/librustc_mir/transform/simplify.rs index 65838946a7859..ba3a00517ffb0 100644 --- a/src/librustc_mir/transform/simplify.rs +++ b/src/librustc_mir/transform/simplify.rs @@ -57,10 +57,12 @@ impl MirPass for SimplifyCfg { Cow::Borrowed(&self.label) } - fn run_pass<'tcx>(&self, - _tcx: TyCtxt<'tcx, 'tcx>, - _src: MirSource<'tcx>, - body: &mut Body<'tcx>) { + fn run_pass<'tcx>( + &self, + _tcx: TyCtxt<'tcx, 'tcx>, + _src: MirSource<'tcx>, + body: &mut Body<'tcx>, + ) { debug!("SimplifyCfg({:?}) - simplifying {:?}", self.label, body); simplify_cfg(body); } @@ -296,10 +298,7 @@ pub fn remove_dead_blocks(body: &mut Body<'_>) { pub struct SimplifyLocals; impl MirPass for SimplifyLocals { - fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx>, - _: MirSource<'tcx>, - body: &mut Body<'tcx>) { + fn run_pass<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx>, _: MirSource<'tcx>, body: &mut Body<'tcx>) { let mut marker = DeclMarker { locals: BitSet::new_empty(body.local_decls.len()) }; marker.visit_body(body); // Return pointer and arguments are always live diff --git a/src/librustc_mir/transform/simplify_branches.rs b/src/librustc_mir/transform/simplify_branches.rs index 6f6dd1a7c8095..a1c3fec32fcf1 100644 --- a/src/librustc_mir/transform/simplify_branches.rs +++ b/src/librustc_mir/transform/simplify_branches.rs @@ -19,10 +19,12 @@ impl MirPass for SimplifyBranches { Cow::Borrowed(&self.label) } - fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx>, - _src: MirSource<'tcx>, - body: &mut Body<'tcx>) { + fn run_pass<'tcx>( + &self, + tcx: TyCtxt<'tcx, 'tcx>, + _src: MirSource<'tcx>, + body: &mut Body<'tcx>, + ) { for block in body.basic_blocks_mut() { let terminator = block.terminator_mut(); terminator.kind = match terminator.kind { diff --git a/src/librustc_mir/transform/uniform_array_move_out.rs b/src/librustc_mir/transform/uniform_array_move_out.rs index f71c30e587d7b..4e961d80f4c82 100644 --- a/src/librustc_mir/transform/uniform_array_move_out.rs +++ b/src/librustc_mir/transform/uniform_array_move_out.rs @@ -37,10 +37,12 @@ use crate::util::patch::MirPatch; pub struct UniformArrayMoveOut; impl MirPass for UniformArrayMoveOut { - fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx>, - _src: MirSource<'tcx>, - body: &mut Body<'tcx>) { + fn run_pass<'tcx>( + &self, + tcx: TyCtxt<'tcx, 'tcx>, + _src: MirSource<'tcx>, + body: &mut Body<'tcx>, + ) { let mut patch = MirPatch::new(body); { let mut visitor = UniformArrayMoveOutVisitor{body, patch: &mut patch, tcx}; @@ -162,10 +164,12 @@ impl<'a, 'tcx> UniformArrayMoveOutVisitor<'a, 'tcx> { pub struct RestoreSubsliceArrayMoveOut; impl MirPass for RestoreSubsliceArrayMoveOut { - fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx>, - _src: MirSource<'tcx>, - body: &mut Body<'tcx>) { + fn run_pass<'tcx>( + &self, + tcx: TyCtxt<'tcx, 'tcx>, + _src: MirSource<'tcx>, + body: &mut Body<'tcx>, + ) { let mut patch = MirPatch::new(body); { let mut visitor = RestoreDataCollector { diff --git a/src/librustc_mir/util/alignment.rs b/src/librustc_mir/util/alignment.rs index c171bef4c96c4..b23ce28f30120 100644 --- a/src/librustc_mir/util/alignment.rs +++ b/src/librustc_mir/util/alignment.rs @@ -4,12 +4,14 @@ use rustc::mir::*; /// Returns `true` if this place is allowed to be less aligned /// than its containing struct (because it is within a packed /// struct). -pub fn is_disaligned<'tcx, L>(tcx: TyCtxt<'tcx, 'tcx>, - local_decls: &L, - param_env: ty::ParamEnv<'tcx>, - place: &Place<'tcx>) - -> bool - where L: HasLocalDecls<'tcx> +pub fn is_disaligned<'tcx, L>( + tcx: TyCtxt<'tcx, 'tcx>, + local_decls: &L, + param_env: ty::ParamEnv<'tcx>, + place: &Place<'tcx>, +) -> bool +where + L: HasLocalDecls<'tcx>, { debug!("is_disaligned({:?})", place); if !is_within_packed(tcx, local_decls, place) { @@ -32,11 +34,9 @@ pub fn is_disaligned<'tcx, L>(tcx: TyCtxt<'tcx, 'tcx>, } } -fn is_within_packed<'tcx, L>(tcx: TyCtxt<'tcx, 'tcx>, - local_decls: &L, - place: &Place<'tcx>) - -> bool - where L: HasLocalDecls<'tcx> +fn is_within_packed<'tcx, L>(tcx: TyCtxt<'tcx, 'tcx>, local_decls: &L, place: &Place<'tcx>) -> bool +where + L: HasLocalDecls<'tcx>, { let mut place = place; while let &Place::Projection(box Projection { diff --git a/src/librustc_mir/util/elaborate_drops.rs b/src/librustc_mir/util/elaborate_drops.rs index efcb23aab2ed9..f6cc1033b777c 100644 --- a/src/librustc_mir/util/elaborate_drops.rs +++ b/src/librustc_mir/util/elaborate_drops.rs @@ -70,7 +70,7 @@ impl Unwind { } } -pub trait DropElaborator<'a, 'tcx: 'a> : fmt::Debug { +pub trait DropElaborator<'a, 'tcx: 'a>: fmt::Debug { type Path : Copy + fmt::Debug; fn patch(&mut self) -> &mut MirPatch<'tcx>; diff --git a/src/librustc_mir/util/graphviz.rs b/src/librustc_mir/util/graphviz.rs index 2dc6c9061bf7a..0746434c184b5 100644 --- a/src/librustc_mir/util/graphviz.rs +++ b/src/librustc_mir/util/graphviz.rs @@ -8,11 +8,13 @@ use std::io::{self, Write}; use super::pretty::dump_mir_def_ids; /// Write a graphviz DOT graph of a list of MIRs. -pub fn write_mir_graphviz<'tcx, W>(tcx: TyCtxt<'_, 'tcx>, - single: Option, - w: &mut W) - -> io::Result<()> - where W: Write +pub fn write_mir_graphviz<'tcx, W>( + tcx: TyCtxt<'_, 'tcx>, + single: Option, + w: &mut W, +) -> io::Result<()> +where + W: Write, { for def_id in dump_mir_def_ids(tcx, single) { let body = &tcx.optimized_mir(def_id); @@ -32,11 +34,14 @@ pub fn graphviz_safe_def_name(def_id: DefId) -> String { } /// Write a graphviz DOT graph of the MIR. -pub fn write_mir_fn_graphviz<'tcx, W>(tcx: TyCtxt<'_, 'tcx>, - def_id: DefId, - body: &Body<'_>, - w: &mut W) -> io::Result<()> - where W: Write +pub fn write_mir_fn_graphviz<'tcx, W>( + tcx: TyCtxt<'_, 'tcx>, + def_id: DefId, + body: &Body<'_>, + w: &mut W, +) -> io::Result<()> +where + W: Write, { writeln!(w, "digraph Mir_{} {{", graphviz_safe_def_name(def_id))?; @@ -133,11 +138,12 @@ fn write_edges(source: BasicBlock, body: &Body<'_>, w: &mut W) -> io:: /// Write the graphviz DOT label for the overall graph. This is essentially a block of text that /// will appear below the graph, showing the type of the `fn` this MIR represents and the types of /// all the variables and temporaries. -fn write_graph_label<'gcx, 'tcx, W: Write>(tcx: TyCtxt<'gcx, 'tcx>, - def_id: DefId, - body: &Body<'_>, - w: &mut W) - -> io::Result<()> { +fn write_graph_label<'gcx, 'tcx, W: Write>( + tcx: TyCtxt<'gcx, 'tcx>, + def_id: DefId, + body: &Body<'_>, + w: &mut W, +) -> io::Result<()> { write!(w, " label=) { }; } -fn const_is_rvalue_promotable_to_static<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - def_id: DefId) - -> bool -{ +fn const_is_rvalue_promotable_to_static<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> bool { assert!(def_id.is_local()); let hir_id = tcx.hir().as_local_hir_id(def_id) @@ -51,10 +48,7 @@ fn const_is_rvalue_promotable_to_static<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, tcx.rvalue_promotable_map(def_id).contains(&body_id.hir_id.local_id) } -fn rvalue_promotable_map<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - def_id: DefId) - -> &'tcx ItemLocalSet -{ +fn rvalue_promotable_map<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> &'tcx ItemLocalSet { let outer_def_id = tcx.closure_base_def_id(def_id); if outer_def_id != def_id { return tcx.rvalue_promotable_map(outer_def_id); diff --git a/src/librustc_plugin/build.rs b/src/librustc_plugin/build.rs index f269d3af91f89..f5cb04c743250 100644 --- a/src/librustc_plugin/build.rs +++ b/src/librustc_plugin/build.rs @@ -34,10 +34,7 @@ pub fn find_plugin_registrar<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) -> Option { tcx.plugin_registrar_fn(LOCAL_CRATE) } -fn plugin_registrar_fn<'tcx>( - tcx: TyCtxt<'tcx, 'tcx>, - cnum: CrateNum, -) -> Option { +fn plugin_registrar_fn<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, cnum: CrateNum) -> Option { assert_eq!(cnum, LOCAL_CRATE); let mut finder = RegistrarFinder { registrars: Vec::new() }; diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index 38e102345b3e7..a2da014c912d1 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -74,7 +74,8 @@ trait DefIdVisitor<'tcx> { } struct DefIdVisitorSkeleton<'v, 'tcx, V> - where V: DefIdVisitor<'tcx> + ?Sized +where + V: DefIdVisitor<'tcx> + ?Sized, { def_id_visitor: &'v mut V, visited_opaque_tys: FxHashSet, @@ -82,7 +83,8 @@ struct DefIdVisitorSkeleton<'v, 'tcx, V> } impl<'tcx, V> DefIdVisitorSkeleton<'_, 'tcx, V> - where V: DefIdVisitor<'tcx> + ?Sized +where + V: DefIdVisitor<'tcx> + ?Sized, { fn visit_trait(&mut self, trait_ref: TraitRef<'tcx>) -> bool { let TraitRef { def_id, substs } = trait_ref; @@ -125,7 +127,8 @@ impl<'tcx, V> DefIdVisitorSkeleton<'_, 'tcx, V> } impl<'tcx, V> TypeVisitor<'tcx> for DefIdVisitorSkeleton<'_, 'tcx, V> - where V: DefIdVisitor<'tcx> + ?Sized +where + V: DefIdVisitor<'tcx> + ?Sized, { fn visit_ty(&mut self, ty: Ty<'tcx>) -> bool { let tcx = self.def_id_visitor.tcx(); @@ -220,8 +223,10 @@ impl<'tcx, V> TypeVisitor<'tcx> for DefIdVisitorSkeleton<'_, 'tcx, V> } } -fn def_id_visibility<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) - -> (ty::Visibility, Span, &'static str) { +fn def_id_visibility<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + def_id: DefId, +) -> (ty::Visibility, Span, &'static str) { match tcx.hir().as_local_hir_id(def_id) { Some(hir_id) => { let vis = match tcx.hir().get_by_hir_id(hir_id) { @@ -323,16 +328,20 @@ fn def_id_visibility<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) // Set the correct `TypeckTables` for the given `item_id` (or an empty table if // there is no `TypeckTables` for the item). -fn item_tables<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - hir_id: hir::HirId, - empty_tables: &'a ty::TypeckTables<'tcx>) - -> &'a ty::TypeckTables<'tcx> { +fn item_tables<'a, 'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + hir_id: hir::HirId, + empty_tables: &'a ty::TypeckTables<'tcx>, +) -> &'a ty::TypeckTables<'tcx> { let def_id = tcx.hir().local_def_id_from_hir_id(hir_id); if tcx.has_typeck_tables(def_id) { tcx.typeck_tables_of(def_id) } else { empty_tables } } -fn min<'tcx>(vis1: ty::Visibility, vis2: ty::Visibility, tcx: TyCtxt<'tcx, 'tcx>) - -> ty::Visibility { +fn min<'tcx>( + vis1: ty::Visibility, + vis2: ty::Visibility, + tcx: TyCtxt<'tcx, 'tcx>, +) -> ty::Visibility { if vis1.is_at_least(vis2, tcx) { vis2 } else { vis1 } } @@ -343,7 +352,7 @@ fn min<'tcx>(vis1: ty::Visibility, vis2: ty::Visibility, tcx: TyCtxt<'tcx, 'tcx> /// in crates that have been updated to use pub(restricted). //////////////////////////////////////////////////////////////////////////////// struct PubRestrictedVisitor<'tcx> { - tcx: TyCtxt<'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, has_pub_restricted: bool, } @@ -383,8 +392,11 @@ trait VisibilityLike: Sized { // Returns an over-approximation (`skip_assoc_tys` = true) of visibility due to // associated types for which we can't determine visibility precisely. - fn of_impl<'a, 'tcx>(hir_id: hir::HirId, tcx: TyCtxt<'tcx, 'tcx>, - access_levels: &'a AccessLevels) -> Self { + fn of_impl<'a, 'tcx>( + hir_id: hir::HirId, + tcx: TyCtxt<'tcx, 'tcx>, + access_levels: &'a AccessLevels, + ) -> Self { let mut find = FindMin { tcx, access_levels, min: Self::MAX }; let def_id = tcx.hir().local_def_id_from_hir_id(hir_id); find.visit(tcx.type_of(def_id)); @@ -460,8 +472,11 @@ impl EmbargoVisitor<'tcx> { } } - fn reach(&mut self, item_id: hir::HirId, access_level: Option) - -> ReachEverythingInTheInterfaceVisitor<'_, 'tcx> { + fn reach( + &mut self, + item_id: hir::HirId, + access_level: Option, + ) -> ReachEverythingInTheInterfaceVisitor<'_, 'tcx> { ReachEverythingInTheInterfaceVisitor { access_level: cmp::min(access_level, Some(AccessLevel::Reachable)), item_def_id: self.tcx.hir().local_def_id_from_hir_id(item_id), @@ -1647,8 +1662,11 @@ struct PrivateItemsInPublicInterfacesVisitor<'a, 'tcx: 'a> { } impl<'a, 'tcx> PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> { - fn check(&self, item_id: hir::HirId, required_visibility: ty::Visibility) - -> SearchInterfaceForPrivateItemsVisitor<'tcx> { + fn check( + &self, + item_id: hir::HirId, + required_visibility: ty::Visibility, + ) -> SearchInterfaceForPrivateItemsVisitor<'tcx> { let mut has_old_errors = false; // Slow path taken only if there any errors in the crate. @@ -1841,10 +1859,7 @@ fn check_mod_privacy<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, module_def_id: DefId) { intravisit::walk_mod(&mut visitor, module, hir_id); } -fn privacy_access_levels<'tcx>( - tcx: TyCtxt<'tcx, 'tcx>, - krate: CrateNum, -) -> &'tcx AccessLevels { +fn privacy_access_levels<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, krate: CrateNum) -> &'tcx AccessLevels { assert_eq!(krate, LOCAL_CRATE); // Build up a set of all exported items in the AST. This is a set of all diff --git a/src/librustc_traits/chalk_context/mod.rs b/src/librustc_traits/chalk_context/mod.rs index 77f59ae6c32ce..7a519ac2ebea8 100644 --- a/src/librustc_traits/chalk_context/mod.rs +++ b/src/librustc_traits/chalk_context/mod.rs @@ -527,7 +527,7 @@ impl ChalkContextLift<'tcx> for ChalkArenas<'a> { fn lift_ex_clause_to_tcx( ex_clause: &ChalkExClause<'a>, - tcx: TyCtxt<'gcx, 'tcx> + tcx: TyCtxt<'gcx, 'tcx>, ) -> Option { Some(ChalkExClause { subst: tcx.lift(&ex_clause.subst)?, @@ -539,7 +539,7 @@ impl ChalkContextLift<'tcx> for ChalkArenas<'a> { fn lift_delayed_literal_to_tcx( literal: &DelayedLiteral>, - tcx: TyCtxt<'gcx, 'tcx> + tcx: TyCtxt<'gcx, 'tcx>, ) -> Option { Some(match literal { DelayedLiteral::CannotProve(()) => DelayedLiteral::CannotProve(()), @@ -674,11 +674,8 @@ crate fn provide(p: &mut Providers<'_>) { crate fn evaluate_goal<'tcx>( tcx: TyCtxt<'tcx, 'tcx>, - goal: ChalkCanonicalGoal<'tcx> -) -> Result< - &'tcx Canonical<'tcx, QueryResponse<'tcx, ()>>, - traits::query::NoSolution -> { + goal: ChalkCanonicalGoal<'tcx>, +) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, ()>>, traits::query::NoSolution> { use crate::lowering::Lower; use rustc::traits::WellFormed; diff --git a/src/librustc_traits/chalk_context/program_clauses/builtin.rs b/src/librustc_traits/chalk_context/program_clauses/builtin.rs index 7dc8264832249..3c9b335e77769 100644 --- a/src/librustc_traits/chalk_context/program_clauses/builtin.rs +++ b/src/librustc_traits/chalk_context/program_clauses/builtin.rs @@ -18,7 +18,7 @@ fn builtin_impl_clause( tcx: TyCtxt<'_, 'tcx>, ty: Ty<'tcx>, nested: &[Kind<'tcx>], - trait_def_id: DefId + trait_def_id: DefId, ) -> ProgramClause<'tcx> { ProgramClause { goal: ty::TraitPredicate { @@ -47,7 +47,7 @@ crate fn assemble_builtin_unsize_impls<'tcx>( unsize_def_id: DefId, source: Ty<'tcx>, target: Ty<'tcx>, - clauses: &mut Vec> + clauses: &mut Vec>, ) { match (&source.sty, &target.sty) { (ty::Dynamic(data_a, ..), ty::Dynamic(data_b, ..)) => { @@ -122,7 +122,7 @@ crate fn assemble_builtin_sized_impls<'tcx>( tcx: TyCtxt<'_, 'tcx>, sized_def_id: DefId, ty: Ty<'tcx>, - clauses: &mut Vec> + clauses: &mut Vec>, ) { let mut push_builtin_impl = |ty: Ty<'tcx>, nested: &[Kind<'tcx>]| { let clause = builtin_impl_clause(tcx, ty, nested, sized_def_id); @@ -226,7 +226,7 @@ crate fn assemble_builtin_copy_clone_impls<'tcx>( tcx: TyCtxt<'_, 'tcx>, trait_def_id: DefId, ty: Ty<'tcx>, - clauses: &mut Vec> + clauses: &mut Vec>, ) { let mut push_builtin_impl = |ty: Ty<'tcx>, nested: &[Kind<'tcx>]| { let clause = builtin_impl_clause(tcx, ty, nested, trait_def_id); diff --git a/src/librustc_traits/chalk_context/program_clauses/mod.rs b/src/librustc_traits/chalk_context/program_clauses/mod.rs index 8702bc7dbc089..ae2283c3672e7 100644 --- a/src/librustc_traits/chalk_context/program_clauses/mod.rs +++ b/src/librustc_traits/chalk_context/program_clauses/mod.rs @@ -21,7 +21,7 @@ use self::builtin::*; fn assemble_clauses_from_impls<'tcx>( tcx: TyCtxt<'_, 'tcx>, trait_def_id: DefId, - clauses: &mut Vec> + clauses: &mut Vec>, ) { tcx.for_each_impl(trait_def_id, |impl_def_id| { clauses.extend( @@ -35,7 +35,7 @@ fn assemble_clauses_from_impls<'tcx>( fn assemble_clauses_from_assoc_ty_values<'tcx>( tcx: TyCtxt<'_, 'tcx>, trait_def_id: DefId, - clauses: &mut Vec> + clauses: &mut Vec>, ) { tcx.for_each_impl(trait_def_id, |impl_def_id| { for def_id in tcx.associated_item_def_ids(impl_def_id).iter() { diff --git a/src/librustc_traits/chalk_context/program_clauses/primitive.rs b/src/librustc_traits/chalk_context/program_clauses/primitive.rs index a1d9e7e0cde23..fd7b5ec55b08b 100644 --- a/src/librustc_traits/chalk_context/program_clauses/primitive.rs +++ b/src/librustc_traits/chalk_context/program_clauses/primitive.rs @@ -17,7 +17,7 @@ use std::iter; crate fn wf_clause_for_raw_ptr<'tcx>( tcx: TyCtxt<'_, 'tcx>, - mutbl: hir::Mutability + mutbl: hir::Mutability, ) -> Clauses<'tcx> { let ptr_ty = generic_types::raw_ptr(tcx, mutbl); @@ -37,7 +37,7 @@ crate fn wf_clause_for_fn_ptr<'tcx>( arity_and_output: usize, variadic: bool, unsafety: hir::Unsafety, - abi: abi::Abi + abi: abi::Abi, ) -> Clauses<'tcx> { let fn_ptr = generic_types::fn_ptr(tcx, arity_and_output, variadic, unsafety, abi); @@ -84,7 +84,7 @@ crate fn wf_clause_for_slice<'tcx>(tcx: TyCtxt<'_, 'tcx>) -> Clauses<'tcx> { crate fn wf_clause_for_array<'tcx>( tcx: TyCtxt<'_, 'tcx>, - length: &'tcx ty::Const<'tcx> + length: &'tcx ty::Const<'tcx>, ) -> Clauses<'tcx> { let ty = generic_types::bound(tcx, 0); let array_ty = tcx.mk_ty(ty::Array(ty, length)); @@ -114,10 +114,7 @@ crate fn wf_clause_for_array<'tcx>( tcx.mk_clauses(iter::once(wf_clause)) } -crate fn wf_clause_for_tuple<'tcx>( - tcx: TyCtxt<'_, 'tcx>, - arity: usize -) -> Clauses<'tcx> { +crate fn wf_clause_for_tuple<'tcx>(tcx: TyCtxt<'_, 'tcx>, arity: usize) -> Clauses<'tcx> { let type_list = generic_types::type_list(tcx, arity); let tuple_ty = tcx.mk_ty(ty::Tuple(type_list)); @@ -158,10 +155,7 @@ crate fn wf_clause_for_tuple<'tcx>( tcx.mk_clauses(iter::once(wf_clause)) } -crate fn wf_clause_for_ref<'tcx>( - tcx: TyCtxt<'_, 'tcx>, - mutbl: hir::Mutability -) -> Clauses<'tcx> { +crate fn wf_clause_for_ref<'tcx>(tcx: TyCtxt<'_, 'tcx>, mutbl: hir::Mutability) -> Clauses<'tcx> { let region = tcx.mk_region( ty::ReLateBound(ty::INNERMOST, ty::BoundRegion::BrAnon(0)) ); @@ -185,10 +179,7 @@ crate fn wf_clause_for_ref<'tcx>( tcx.mk_clauses(iter::once(wf_clause)) } -crate fn wf_clause_for_fn_def<'tcx>( - tcx: TyCtxt<'_, 'tcx>, - def_id: DefId -) -> Clauses<'tcx> { +crate fn wf_clause_for_fn_def<'tcx>(tcx: TyCtxt<'_, 'tcx>, def_id: DefId) -> Clauses<'tcx> { let fn_def = generic_types::fn_def(tcx, def_id); let wf_clause = ProgramClause { diff --git a/src/librustc_traits/generic_types.rs b/src/librustc_traits/generic_types.rs index 7eb1cd093a82f..dca7fb0dae3d4 100644 --- a/src/librustc_traits/generic_types.rs +++ b/src/librustc_traits/generic_types.rs @@ -26,7 +26,7 @@ crate fn fn_ptr( arity_and_output: usize, c_variadic: bool, unsafety: hir::Unsafety, - abi: abi::Abi + abi: abi::Abi, ) -> Ty<'tcx> { let inputs_and_output = tcx.mk_type_list( (0..arity_and_output).into_iter() diff --git a/src/librustc_traits/implied_outlives_bounds.rs b/src/librustc_traits/implied_outlives_bounds.rs index 88bc61886b7d4..1bb04eab4c4bb 100644 --- a/src/librustc_traits/implied_outlives_bounds.rs +++ b/src/librustc_traits/implied_outlives_bounds.rs @@ -26,8 +26,8 @@ fn implied_outlives_bounds<'tcx>( tcx: TyCtxt<'tcx, 'tcx>, goal: CanonicalTyGoal<'tcx>, ) -> Result< - &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, Vec>>>, - NoSolution, + &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, Vec>>>, + NoSolution, > { tcx.infer_ctxt() .enter_canonical_trait_query(&goal, |infcx, _fulfill_cx, key| { diff --git a/src/librustc_traits/lowering/environment.rs b/src/librustc_traits/lowering/environment.rs index 537b6d3e09012..bab74e80ea6e9 100644 --- a/src/librustc_traits/lowering/environment.rs +++ b/src/librustc_traits/lowering/environment.rs @@ -160,10 +160,7 @@ crate fn program_clauses_for_env<'tcx>( ); } -crate fn environment<'tcx>( - tcx: TyCtxt<'tcx, 'tcx>, - def_id: DefId -) -> Environment<'tcx> { +crate fn environment<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> Environment<'tcx> { use super::{Lower, IntoFromEnvGoal}; use rustc::hir::{Node, TraitItemKind, ImplItemKind, ItemKind, ForeignItemKind}; diff --git a/src/librustc_traits/lowering/mod.rs b/src/librustc_traits/lowering/mod.rs index c73f61f070e37..59cd58ea23d14 100644 --- a/src/librustc_traits/lowering/mod.rs +++ b/src/librustc_traits/lowering/mod.rs @@ -155,10 +155,7 @@ impl<'tcx> IntoWellFormedGoal for DomainGoal<'tcx> { } } -crate fn program_clauses_for<'tcx>( - tcx: TyCtxt<'tcx, 'tcx>, - def_id: DefId, -) -> Clauses<'tcx> { +crate fn program_clauses_for<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> Clauses<'tcx> { // FIXME(eddyb) this should only be using `def_kind`. match tcx.def_key(def_id).disambiguated_data.data { DefPathData::TypeNs(..) => match tcx.def_kind(def_id) { @@ -184,10 +181,7 @@ crate fn program_clauses_for<'tcx>( } } -fn program_clauses_for_trait<'tcx>( - tcx: TyCtxt<'tcx, 'tcx>, - def_id: DefId, -) -> Clauses<'tcx> { +fn program_clauses_for_trait<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> Clauses<'tcx> { // `trait Trait where WC { .. } // P0 == Self` // Rule Implemented-From-Env (see rustc guide) @@ -343,10 +337,7 @@ fn program_clauses_for_impl(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> Clauses<' tcx.mk_clauses(iter::once(Clause::ForAll(ty::Binder::bind(clause)))) } -pub fn program_clauses_for_type_def<'tcx>( - tcx: TyCtxt<'tcx, 'tcx>, - def_id: DefId, -) -> Clauses<'tcx> { +pub fn program_clauses_for_type_def<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> Clauses<'tcx> { // Rule WellFormed-Type // // `struct Ty where WC1, ..., WCm` diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index 9730623b552ac..2c9309a1696cf 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -2420,9 +2420,11 @@ impl<'gcx, 'tcx> Bounds<'tcx> { /// where-clauses). Because some of our bounds listings (e.g., /// regions) don't include the self-type, you must supply the /// self-type here (the `param_ty` parameter). - pub fn predicates(&self, tcx: TyCtxt<'gcx, 'tcx>, param_ty: Ty<'tcx>) - -> Vec<(ty::Predicate<'tcx>, Span)> - { + pub fn predicates( + &self, + tcx: TyCtxt<'gcx, 'tcx>, + param_ty: Ty<'tcx>, + ) -> Vec<(ty::Predicate<'tcx>, Span)> { // If it could be sized, and is, add the `Sized` predicate. let sized_predicate = self.implicitly_sized.and_then(|span| { tcx.lang_items().sized_trait().map(|sized| { diff --git a/src/librustc_typeck/check/autoderef.rs b/src/librustc_typeck/check/autoderef.rs index 8cb4360e65d3d..ce92551c0133f 100644 --- a/src/librustc_typeck/check/autoderef.rs +++ b/src/librustc_typeck/check/autoderef.rs @@ -240,8 +240,10 @@ impl<'a, 'gcx, 'tcx> Autoderef<'a, 'gcx, 'tcx> { } pub fn report_autoderef_recursion_limit_error<'gcx, 'tcx>( - tcx: TyCtxt<'gcx, 'tcx>, span: Span, ty: Ty<'tcx>) -{ + tcx: TyCtxt<'gcx, 'tcx>, + span: Span, + ty: Ty<'tcx>, +) { // We've reached the recursion limit, error gracefully. let suggested_limit = *tcx.sess.recursion_limit.get() * 2; let msg = format!("reached the recursion limit while auto-dereferencing `{:?}`", diff --git a/src/librustc_typeck/check/compare_method.rs b/src/librustc_typeck/check/compare_method.rs index 7c24ea1641493..32ac7cd69e2e3 100644 --- a/src/librustc_typeck/check/compare_method.rs +++ b/src/librustc_typeck/check/compare_method.rs @@ -23,12 +23,14 @@ use super::{Inherited, FnCtxt, potentially_plural_count}; /// - `trait_m`: the method in the trait /// - `impl_trait_ref`: the TraitRef corresponding to the trait implementation -pub fn compare_impl_method<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - impl_m: &ty::AssocItem, - impl_m_span: Span, - trait_m: &ty::AssocItem, - impl_trait_ref: ty::TraitRef<'tcx>, - trait_item_span: Option) { +pub fn compare_impl_method<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + impl_m: &ty::AssocItem, + impl_m_span: Span, + trait_m: &ty::AssocItem, + impl_trait_ref: ty::TraitRef<'tcx>, + trait_item_span: Option, +) { debug!("compare_impl_method(impl_trait_ref={:?})", impl_trait_ref); @@ -73,12 +75,13 @@ pub fn compare_impl_method<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, } } -fn compare_predicate_entailment<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - impl_m: &ty::AssocItem, - impl_m_span: Span, - trait_m: &ty::AssocItem, - impl_trait_ref: ty::TraitRef<'tcx>) - -> Result<(), ErrorReported> { +fn compare_predicate_entailment<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + impl_m: &ty::AssocItem, + impl_m_span: Span, + trait_m: &ty::AssocItem, + impl_trait_ref: ty::TraitRef<'tcx>, +) -> Result<(), ErrorReported> { let trait_to_impl_substs = impl_trait_ref.substs; // This node-id should be used for the `body_id` field on each @@ -355,14 +358,15 @@ fn compare_predicate_entailment<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, }) } -fn check_region_bounds_on_impl_method<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - span: Span, - impl_m: &ty::AssocItem, - trait_m: &ty::AssocItem, - trait_generics: &ty::Generics, - impl_generics: &ty::Generics, - trait_to_skol_substs: SubstsRef<'tcx>) - -> Result<(), ErrorReported> { +fn check_region_bounds_on_impl_method<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + span: Span, + impl_m: &ty::AssocItem, + trait_m: &ty::AssocItem, + trait_generics: &ty::Generics, + impl_generics: &ty::Generics, + trait_to_skol_substs: SubstsRef<'tcx>, +) -> Result<(), ErrorReported> { let trait_params = trait_generics.own_counts().lifetimes; let impl_params = impl_generics.own_counts().lifetimes; @@ -495,13 +499,13 @@ fn extract_spans_for_error_reporting<'a, 'gcx, 'tcx>(infcx: &infer::InferCtxt<'a } } -fn compare_self_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - impl_m: &ty::AssocItem, - impl_m_span: Span, - trait_m: &ty::AssocItem, - impl_trait_ref: ty::TraitRef<'tcx>) - -> Result<(), ErrorReported> -{ +fn compare_self_type<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + impl_m: &ty::AssocItem, + impl_m_span: Span, + trait_m: &ty::AssocItem, + impl_trait_ref: ty::TraitRef<'tcx>, +) -> Result<(), ErrorReported> { // Try to give more informative error messages about self typing // mismatches. Note that any mismatch will also be detected // below, where we construct a canonical function type that @@ -695,12 +699,13 @@ fn compare_number_of_generics<'tcx>( } } -fn compare_number_of_method_arguments<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - impl_m: &ty::AssocItem, - impl_m_span: Span, - trait_m: &ty::AssocItem, - trait_item_span: Option) - -> Result<(), ErrorReported> { +fn compare_number_of_method_arguments<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + impl_m: &ty::AssocItem, + impl_m_span: Span, + trait_m: &ty::AssocItem, + trait_item_span: Option, +) -> Result<(), ErrorReported> { let impl_m_fty = tcx.fn_sig(impl_m.def_id); let trait_m_fty = tcx.fn_sig(trait_m.def_id); let trait_number_args = trait_m_fty.inputs().skip_binder().len(); @@ -779,10 +784,11 @@ fn compare_number_of_method_arguments<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, Ok(()) } -fn compare_synthetic_generics<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - impl_m: &ty::AssocItem, - trait_m: &ty::AssocItem) - -> Result<(), ErrorReported> { +fn compare_synthetic_generics<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + impl_m: &ty::AssocItem, + trait_m: &ty::AssocItem, +) -> Result<(), ErrorReported> { // FIXME(chrisvittal) Clean up this function, list of FIXME items: // 1. Better messages for the span labels // 2. Explanation as to what is going on @@ -951,11 +957,13 @@ fn compare_synthetic_generics<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, } } -pub fn compare_const_impl<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - impl_c: &ty::AssocItem, - impl_c_span: Span, - trait_c: &ty::AssocItem, - impl_trait_ref: ty::TraitRef<'tcx>) { +pub fn compare_const_impl<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + impl_c: &ty::AssocItem, + impl_c_span: Span, + trait_c: &ty::AssocItem, + impl_trait_ref: ty::TraitRef<'tcx>, +) { debug!("compare_const_impl(impl_trait_ref={:?})", impl_trait_ref); tcx.infer_ctxt().enter(|infcx| { diff --git a/src/librustc_typeck/check/intrinsic.rs b/src/librustc_typeck/check/intrinsic.rs index 2a553db5e5dde..0b800fe8247c7 100644 --- a/src/librustc_typeck/check/intrinsic.rs +++ b/src/librustc_typeck/check/intrinsic.rs @@ -79,8 +79,7 @@ pub fn intrisic_operation_unsafety(intrinsic: &str) -> hir::Unsafety { /// Remember to add all intrinsics here, in librustc_codegen_llvm/intrinsic.rs, /// and in libcore/intrinsics.rs -pub fn check_intrinsic_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - it: &hir::ForeignItem) { +pub fn check_intrinsic_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, it: &hir::ForeignItem) { let param = |n| tcx.mk_ty_param(n, InternedString::intern(&format!("P{}", n))); let name = it.ident.as_str(); @@ -400,8 +399,7 @@ pub fn check_intrinsic_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, } /// Type-check `extern "platform-intrinsic" { ... }` functions. -pub fn check_platform_intrinsic_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - it: &hir::ForeignItem) { +pub fn check_platform_intrinsic_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, it: &hir::ForeignItem) { let param = |n| { let name = InternedString::intern(&format!("P{}", n)); tcx.mk_ty_param(n, name) diff --git a/src/librustc_typeck/check/method/probe.rs b/src/librustc_typeck/check/method/probe.rs index 8d55f3afdfd8a..5aab440dc16d0 100644 --- a/src/librustc_typeck/check/method/probe.rs +++ b/src/librustc_typeck/check/method/probe.rs @@ -395,10 +395,10 @@ pub fn provide(providers: &mut ty::query::Providers<'_>) { providers.method_autoderef_steps = method_autoderef_steps; } -fn method_autoderef_steps<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'gcx>, - goal: CanonicalTyGoal<'tcx>) - -> MethodAutoderefStepsResult<'gcx> -{ +fn method_autoderef_steps<'gcx, 'tcx>( + tcx: TyCtxt<'gcx, 'gcx>, + goal: CanonicalTyGoal<'tcx>, +) -> MethodAutoderefStepsResult<'gcx> { debug!("method_autoderef_steps({:?})", goal); tcx.infer_ctxt().enter_with_canonical(DUMMY_SP, &goal, |ref infcx, goal, inference_vars| { diff --git a/src/librustc_typeck/check/method/suggest.rs b/src/librustc_typeck/check/method/suggest.rs index 227b0c7035451..c4157bb60e9da 100644 --- a/src/librustc_typeck/check/method/suggest.rs +++ b/src/librustc_typeck/check/method/suggest.rs @@ -817,10 +817,12 @@ fn compute_all_traits<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>) -> Vec { // Cross-crate: let mut external_mods = FxHashSet::default(); - fn handle_external_res(tcx: TyCtxt<'_, '_>, - traits: &mut Vec, - external_mods: &mut FxHashSet, - res: Res) { + fn handle_external_res( + tcx: TyCtxt<'_, '_>, + traits: &mut Vec, + external_mods: &mut FxHashSet, + res: Res, + ) { match res { Res::Def(DefKind::Trait, def_id) | Res::Def(DefKind::TraitAlias, def_id) => { @@ -859,7 +861,7 @@ struct UsePlacementFinder<'tcx, 'gcx> { target_module: hir::HirId, span: Option, found_use: bool, - tcx: TyCtxt<'gcx, 'tcx> + tcx: TyCtxt<'gcx, 'tcx>, } impl UsePlacementFinder<'tcx, 'gcx> { diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index ba30f481596df..d62536ccb4669 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -594,8 +594,7 @@ pub struct InheritedBuilder<'gcx, 'tcx> { } impl Inherited<'_, 'gcx, 'tcx> { - pub fn build(tcx: TyCtxt<'gcx, 'gcx>, def_id: DefId) - -> InheritedBuilder<'gcx, 'tcx> { + pub fn build(tcx: TyCtxt<'gcx, 'gcx>, def_id: DefId) -> InheritedBuilder<'gcx, 'tcx> { let hir_id_root = if def_id.is_local() { let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); DefId::local(hir_id.owner) @@ -612,7 +611,8 @@ impl Inherited<'_, 'gcx, 'tcx> { impl<'gcx, 'tcx> InheritedBuilder<'gcx, 'tcx> { fn enter(&'tcx mut self, f: F) -> R - where F: for<'a> FnOnce(Inherited<'a, 'gcx, 'tcx>) -> R + where + F: for<'a> FnOnce(Inherited<'a, 'gcx, 'tcx>) -> R, { let def_id = self.def_id; self.infcx.enter(|infcx| f(Inherited::new(infcx, def_id))) @@ -685,7 +685,9 @@ impl Inherited<'a, 'gcx, 'tcx> { } } -struct CheckItemTypesVisitor<'tcx> { tcx: TyCtxt<'tcx, 'tcx> } +struct CheckItemTypesVisitor<'tcx> { + tcx: TyCtxt<'tcx, 'tcx>, +} impl ItemLikeVisitor<'tcx> for CheckItemTypesVisitor<'tcx> { fn visit_item(&mut self, i: &'tcx hir::Item) { @@ -741,9 +743,7 @@ pub fn provide(providers: &mut Providers<'_>) { }; } -fn adt_destructor<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - def_id: DefId) - -> Option { +fn adt_destructor<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> Option { tcx.calculate_dtor(def_id, &mut dropck::check_drop_impl) } @@ -756,10 +756,10 @@ fn adt_destructor<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, /// may not succeed. In some cases where this function returns `None` /// (notably closures), `typeck_tables(def_id)` would wind up /// redirecting to the owning function. -fn primary_body_of<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - id: hir::HirId) - -> Option<(hir::BodyId, Option<&'tcx hir::FnDecl>)> -{ +fn primary_body_of<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + id: hir::HirId, +) -> Option<(hir::BodyId, Option<&'tcx hir::FnDecl>)> { match tcx.hir().get_by_hir_id(id) { Node::Item(item) => { match item.node { @@ -797,9 +797,7 @@ fn primary_body_of<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, } } -fn has_typeck_tables<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - def_id: DefId) - -> bool { +fn has_typeck_tables<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> bool { // Closures' tables come from their outermost function, // as they are part of the same "inference environment". let outer_def_id = tcx.closure_base_def_id(def_id); @@ -811,15 +809,11 @@ fn has_typeck_tables<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, primary_body_of(tcx, id).is_some() } -fn used_trait_imports<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - def_id: DefId) - -> &'tcx DefIdSet { +fn used_trait_imports<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> &'tcx DefIdSet { &*tcx.typeck_tables_of(def_id).used_trait_imports } -fn typeck_tables_of<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - def_id: DefId) - -> &'tcx ty::TypeckTables<'tcx> { +fn typeck_tables_of<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::TypeckTables<'tcx> { // Closures' tables come from their outermost function, // as they are part of the same "inference environment". let outer_def_id = tcx.closure_base_def_id(def_id); @@ -1287,9 +1281,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>, (fcx, gen_ty) } -fn check_struct<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - id: hir::HirId, - span: Span) { +fn check_struct<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, id: hir::HirId, span: Span) { let def_id = tcx.hir().local_def_id_from_hir_id(id); let def = tcx.adt_def(def_id); def.destructor(tcx); // force the destructor to be evaluated @@ -1303,9 +1295,7 @@ fn check_struct<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, check_packed(tcx, span, def_id); } -fn check_union<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - id: hir::HirId, - span: Span) { +fn check_union<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, id: hir::HirId, span: Span) { let def_id = tcx.hir().local_def_id_from_hir_id(id); let def = tcx.adt_def(def_id); def.destructor(tcx); // force the destructor to be evaluated @@ -1314,12 +1304,7 @@ fn check_union<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, check_packed(tcx, span, def_id); } -fn check_opaque<'tcx>( - tcx: TyCtxt<'tcx, 'tcx>, - def_id: DefId, - substs: SubstsRef<'tcx>, - span: Span, -) { +fn check_opaque<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, substs: SubstsRef<'tcx>, span: Span) { if let Err(partially_expanded_type) = tcx.try_expand_impl_trait_type(def_id, substs) { let mut err = struct_span_err!( tcx.sess, span, E0720, @@ -1472,18 +1457,17 @@ fn maybe_check_static_with_link_section(tcx: TyCtxt<'_, '_>, id: DefId, span: Sp } } -fn check_on_unimplemented<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - trait_def_id: DefId, - item: &hir::Item) { +fn check_on_unimplemented<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, trait_def_id: DefId, item: &hir::Item) { let item_def_id = tcx.hir().local_def_id_from_hir_id(item.hir_id); // an error would be reported if this fails. let _ = traits::OnUnimplementedDirective::of_item(tcx, trait_def_id, item_def_id); } -fn report_forbidden_specialization<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - impl_item: &hir::ImplItem, - parent_impl: DefId) -{ +fn report_forbidden_specialization<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + impl_item: &hir::ImplItem, + parent_impl: DefId, +) { let mut err = struct_span_err!( tcx.sess, impl_item.span, E0520, "`{}` specializes an item from a parent `impl`, but \ @@ -1506,12 +1490,13 @@ fn report_forbidden_specialization<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, err.emit(); } -fn check_specialization_validity<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - trait_def: &ty::TraitDef, - trait_item: &ty::AssocItem, - impl_id: DefId, - impl_item: &hir::ImplItem) -{ +fn check_specialization_validity<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + trait_def: &ty::TraitDef, + trait_item: &ty::AssocItem, + impl_id: DefId, + impl_item: &hir::ImplItem, +) { let ancestors = trait_def.ancestors(tcx, impl_id); let kind = match impl_item.node { @@ -1532,11 +1517,13 @@ fn check_specialization_validity<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, } -fn check_impl_items_against_trait<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - impl_span: Span, - impl_id: DefId, - impl_trait_ref: ty::TraitRef<'tcx>, - impl_item_refs: &[hir::ImplItemRef]) { +fn check_impl_items_against_trait<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + impl_span: Span, + impl_id: DefId, + impl_trait_ref: ty::TraitRef<'tcx>, + impl_item_refs: &[hir::ImplItemRef], +) { let impl_span = tcx.sess.source_map().def_span(impl_span); // If the trait reference itself is erroneous (so the compilation is going @@ -1693,10 +1680,7 @@ fn check_impl_items_against_trait<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, /// Checks whether a type can be represented in memory. In particular, it /// identifies types that contain themselves without indirection through a /// pointer, which would mean their size is unbounded. -fn check_representable<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - sp: Span, - item_def_id: DefId) - -> bool { +fn check_representable<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, sp: Span, item_def_id: DefId) -> bool { let rty = tcx.type_of(item_def_id); // Check that it is possible to represent this type. This call identifies @@ -1715,7 +1699,7 @@ fn check_representable<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, } Representability::Representable | Representability::ContainsRecursive => (), } - return true + return true; } pub fn check_simd<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, sp: Span, def_id: DefId) { @@ -1771,9 +1755,11 @@ fn check_packed<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, sp: Span, def_id: DefId) { } } -fn check_packed_inner<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - def_id: DefId, - stack: &mut Vec) -> bool { +fn check_packed_inner<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + def_id: DefId, + stack: &mut Vec, +) -> bool { let t = tcx.type_of(def_id); if stack.contains(&def_id) { debug!("check_packed_inner: {:?} is recursive", t); @@ -1881,10 +1867,12 @@ fn check_transparent<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, sp: Span, def_id: DefId) { } #[allow(trivial_numeric_casts)] -pub fn check_enum<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - sp: Span, - vs: &'tcx [hir::Variant], - id: hir::HirId) { +pub fn check_enum<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + sp: Span, + vs: &'tcx [hir::Variant], + id: hir::HirId, +) { let def_id = tcx.hir().local_def_id_from_hir_id(id); let def = tcx.adt_def(def_id); def.destructor(tcx); // force the destructor to be evaluated @@ -1945,10 +1933,12 @@ pub fn check_enum<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, check_transparent(tcx, sp, def_id); } -fn report_unexpected_variant_res<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, - res: Res, - span: Span, - qpath: &QPath) { +fn report_unexpected_variant_res<'gcx, 'tcx>( + tcx: TyCtxt<'gcx, 'tcx>, + res: Res, + span: Span, + qpath: &QPath, +) { span_err!(tcx.sess, span, E0533, "expected unit struct/variant or constant, found {} `{}`", res.descr(), @@ -1956,7 +1946,9 @@ fn report_unexpected_variant_res<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, } impl<'a, 'gcx, 'tcx> AstConv<'gcx, 'tcx> for FnCtxt<'a, 'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> { self.tcx } + fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> { + self.tcx + } fn get_type_parameter_bounds(&self, _: Span, def_id: DefId) -> &'tcx ty::GenericPredicates<'tcx> @@ -5700,9 +5692,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } } -pub fn check_bounds_are_used<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - generics: &ty::Generics, - ty: Ty<'tcx>) { +pub fn check_bounds_are_used<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, generics: &ty::Generics, ty: Ty<'tcx>) { let own_counts = generics.own_counts(); debug!( "check_bounds_are_used(n_tys={}, n_cts={}, ty={:?})", diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs index 31d85be17b4c0..83711a32e23a5 100644 --- a/src/librustc_typeck/check/wfcheck.rs +++ b/src/librustc_typeck/check/wfcheck.rs @@ -33,9 +33,9 @@ struct CheckWfFcxBuilder<'gcx, 'tcx> { } impl<'gcx, 'tcx> CheckWfFcxBuilder<'gcx, 'tcx> { - fn with_fcx(&'tcx mut self, f: F) where - F: for<'b> FnOnce(&FnCtxt<'b, 'gcx, 'tcx>, - TyCtxt<'gcx, 'gcx>) -> Vec> + fn with_fcx(&'tcx mut self, f: F) + where + F: for<'b> FnOnce(&FnCtxt<'b, 'gcx, 'tcx>, TyCtxt<'gcx, 'gcx>) -> Vec>, { let id = self.id; let span = self.span; @@ -178,10 +178,12 @@ pub fn check_impl_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) { check_associated_item(tcx, impl_item.hir_id, impl_item.span, method_sig); } -fn check_associated_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - item_id: hir::HirId, - span: Span, - sig_if_method: Option<&hir::MethodSig>) { +fn check_associated_item<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + item_id: hir::HirId, + span: Span, + sig_if_method: Option<&hir::MethodSig>, +) { debug!("check_associated_item: {:?}", item_id); let code = ObligationCauseCode::MiscObligation; @@ -225,13 +227,18 @@ fn check_associated_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, }) } -fn for_item<'gcx: 'tcx, 'tcx>(tcx: TyCtxt<'gcx, 'gcx>, item: &hir::Item) - -> CheckWfFcxBuilder<'gcx, 'tcx> { +fn for_item<'gcx: 'tcx, 'tcx>( + tcx: TyCtxt<'gcx, 'gcx>, + item: &hir::Item, +) -> CheckWfFcxBuilder<'gcx, 'tcx> { for_id(tcx, item.hir_id, item.span) } -fn for_id<'gcx: 'tcx, 'tcx>(tcx: TyCtxt<'gcx, 'gcx>, id: hir::HirId, span: Span) - -> CheckWfFcxBuilder<'gcx, 'tcx> { +fn for_id<'gcx: 'tcx, 'tcx>( + tcx: TyCtxt<'gcx, 'gcx>, + id: hir::HirId, + span: Span, +) -> CheckWfFcxBuilder<'gcx, 'tcx> { let def_id = tcx.hir().local_def_id_from_hir_id(id); CheckWfFcxBuilder { inherited: Inherited::build(tcx, def_id), @@ -242,9 +249,13 @@ fn for_id<'gcx: 'tcx, 'tcx>(tcx: TyCtxt<'gcx, 'gcx>, id: hir::HirId, span: Span) } /// In a type definition, we check that to ensure that the types of the fields are well-formed. -fn check_type_defn<'tcx, F>(tcx: TyCtxt<'tcx, 'tcx>, - item: &hir::Item, all_sized: bool, mut lookup_fields: F) - where F: for<'fcx, 'gcx, 'tcx2> FnMut(&FnCtxt<'fcx, 'gcx, 'tcx2>) -> Vec> +fn check_type_defn<'tcx, F>( + tcx: TyCtxt<'tcx, 'tcx>, + item: &hir::Item, + all_sized: bool, + mut lookup_fields: F, +) where + F: for<'fcx, 'gcx, 'tcx2> FnMut(&FnCtxt<'fcx, 'gcx, 'tcx2>) -> Vec>, { for_item(tcx, item).with_fcx(|fcx, fcx_tcx| { let variants = lookup_fields(fcx); @@ -380,11 +391,12 @@ fn check_item_type<'tcx>( }); } -fn check_impl<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - item: &hir::Item, - ast_self_ty: &hir::Ty, - ast_trait_ref: &Option) -{ +fn check_impl<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + item: &hir::Item, + ast_self_ty: &hir::Ty, + ast_trait_ref: &Option, +) { debug!("check_impl: {:?}", item); for_item(tcx, item).with_fcx(|fcx, tcx| { @@ -574,13 +586,14 @@ fn check_where_clauses<'gcx, 'fcx, 'tcx>( } } -fn check_fn_or_method<'fcx, 'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'gcx>, - fcx: &FnCtxt<'fcx, 'gcx, 'tcx>, - span: Span, - sig: ty::PolyFnSig<'tcx>, - def_id: DefId, - implied_bounds: &mut Vec>) -{ +fn check_fn_or_method<'fcx, 'gcx, 'tcx>( + tcx: TyCtxt<'gcx, 'gcx>, + fcx: &FnCtxt<'fcx, 'gcx, 'tcx>, + span: Span, + sig: ty::PolyFnSig<'tcx>, + def_id: DefId, + implied_bounds: &mut Vec>, +) { let sig = fcx.normalize_associated_types_in(span, &sig); let sig = fcx.tcx.liberate_late_bound_regions(def_id, &sig); @@ -930,10 +943,11 @@ fn receiver_is_valid<'fcx, 'tcx, 'gcx>( true } -fn check_variances_for_type_defn<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - item: &hir::Item, - hir_generics: &hir::Generics) -{ +fn check_variances_for_type_defn<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + item: &hir::Item, + hir_generics: &hir::Generics, +) { let item_def_id = tcx.hir().local_def_id_from_hir_id(item.hir_id); let ty = tcx.type_of(item_def_id); if tcx.has_error_field(ty) { @@ -971,10 +985,7 @@ fn check_variances_for_type_defn<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, } } -fn report_bivariance<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - span: Span, - param_name: ast::Name) -{ +fn report_bivariance<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, span: Span, param_name: ast::Name) { let mut err = error_392(tcx, span, param_name); let suggested_marker_id = tcx.lang_items().phantom_data(); @@ -1133,8 +1144,11 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } } -fn error_392<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, span: Span, param_name: ast::Name) - -> DiagnosticBuilder<'tcx> { +fn error_392<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + span: Span, + param_name: ast::Name, +) -> DiagnosticBuilder<'tcx> { let mut err = struct_span_err!(tcx.sess, span, E0392, "parameter `{}` is never used", param_name); err.span_label(span, "unused parameter"); diff --git a/src/librustc_typeck/coherence/builtin.rs b/src/librustc_typeck/coherence/builtin.rs index 653095e41f425..1eb3d108f786c 100644 --- a/src/librustc_typeck/coherence/builtin.rs +++ b/src/librustc_typeck/coherence/builtin.rs @@ -28,12 +28,13 @@ pub fn check_trait<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, trait_def_id: DefId) { struct Checker<'tcx> { tcx: TyCtxt<'tcx, 'tcx>, - trait_def_id: DefId + trait_def_id: DefId, } impl<'tcx> Checker<'tcx> { fn check(&self, trait_def_id: Option, mut f: F) -> &Self - where F: FnMut(TyCtxt<'tcx, 'tcx>, DefId) + where + F: FnMut(TyCtxt<'tcx, 'tcx>, DefId), { if Some(self.trait_def_id) == trait_def_id { for &impl_id in self.tcx.hir().trait_impls(self.trait_def_id) { @@ -153,10 +154,7 @@ fn visit_implementation_of_coerce_unsized(tcx: TyCtxt<'tcx, 'tcx>, impl_did: Def } } -fn visit_implementation_of_dispatch_from_dyn<'tcx>( - tcx: TyCtxt<'tcx, 'tcx>, - impl_did: DefId, -) { +fn visit_implementation_of_dispatch_from_dyn<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, impl_did: DefId) { debug!("visit_implementation_of_dispatch_from_dyn: impl_did={:?}", impl_did); if impl_did.is_local() { @@ -324,9 +322,7 @@ fn visit_implementation_of_dispatch_from_dyn<'tcx>( } } -pub fn coerce_unsized_info<'gcx>(gcx: TyCtxt<'gcx, 'gcx>, - impl_did: DefId) - -> CoerceUnsizedInfo { +pub fn coerce_unsized_info<'gcx>(gcx: TyCtxt<'gcx, 'gcx>, impl_did: DefId) -> CoerceUnsizedInfo { debug!("compute_coerce_unsized_info(impl_did={:?})", impl_did); let coerce_unsized_trait = gcx.lang_items().coerce_unsized_trait().unwrap(); diff --git a/src/librustc_typeck/coherence/inherent_impls.rs b/src/librustc_typeck/coherence/inherent_impls.rs index 8214fc50fed87..d6c2d56a9adf7 100644 --- a/src/librustc_typeck/coherence/inherent_impls.rs +++ b/src/librustc_typeck/coherence/inherent_impls.rs @@ -17,9 +17,10 @@ use syntax::ast; use syntax_pos::Span; /// On-demand query: yields a map containing all types mapped to their inherent impls. -pub fn crate_inherent_impls<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - crate_num: CrateNum) - -> &'tcx CrateInherentImpls { +pub fn crate_inherent_impls<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + crate_num: CrateNum, +) -> &'tcx CrateInherentImpls { assert_eq!(crate_num, LOCAL_CRATE); let krate = tcx.hir().krate(); @@ -32,9 +33,7 @@ pub fn crate_inherent_impls<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, } /// On-demand query: yields a vector of the inherent impls for a specific type. -pub fn inherent_impls<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - ty_def_id: DefId) - -> &'tcx [DefId] { +pub fn inherent_impls<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, ty_def_id: DefId) -> &'tcx [DefId] { assert!(ty_def_id.is_local()); // NB. Until we adopt the red-green dep-tracking algorithm (see diff --git a/src/librustc_typeck/coherence/inherent_impls_overlap.rs b/src/librustc_typeck/coherence/inherent_impls_overlap.rs index feddd9f0b3cb0..d557a9c871b12 100644 --- a/src/librustc_typeck/coherence/inherent_impls_overlap.rs +++ b/src/librustc_typeck/coherence/inherent_impls_overlap.rs @@ -5,15 +5,14 @@ use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::traits::{self, IntercrateMode}; use rustc::ty::TyCtxt; -pub fn crate_inherent_impls_overlap_check<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - crate_num: CrateNum) { +pub fn crate_inherent_impls_overlap_check<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, crate_num: CrateNum) { assert_eq!(crate_num, LOCAL_CRATE); let krate = tcx.hir().krate(); krate.visit_all_item_likes(&mut InherentOverlapChecker { tcx }); } struct InherentOverlapChecker<'tcx> { - tcx: TyCtxt<'tcx, 'tcx> + tcx: TyCtxt<'tcx, 'tcx>, } impl InherentOverlapChecker<'tcx> { diff --git a/src/librustc_typeck/coherence/mod.rs b/src/librustc_typeck/coherence/mod.rs index 421fdccc1fa25..3be46722ecccd 100644 --- a/src/librustc_typeck/coherence/mod.rs +++ b/src/librustc_typeck/coherence/mod.rs @@ -43,7 +43,7 @@ fn check_impl<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, hir_id: HirId) { fn enforce_trait_manually_implementable( tcx: TyCtxt<'_, '_>, impl_def_id: DefId, - trait_def_id: DefId + trait_def_id: DefId, ) { let did = Some(trait_def_id); let li = tcx.lang_items(); @@ -99,7 +99,7 @@ fn enforce_trait_manually_implementable( fn enforce_empty_impls_for_marker_traits( tcx: TyCtxt<'_, '_>, impl_def_id: DefId, - trait_def_id: DefId + trait_def_id: DefId, ) { if !tcx.trait_def(trait_def_id).is_marker { return; diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index a78af7875b9c4..e1af8d8f46f70 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -381,11 +381,7 @@ impl ItemCtxt<'tcx> { /// parameter with ID `param_id`. We use this so as to avoid running /// `ast_ty_to_ty`, because we want to avoid triggering an all-out /// conversion of the type to avoid inducing unnecessary cycles. -fn is_param<'tcx>( - tcx: TyCtxt<'tcx, 'tcx>, - ast_ty: &hir::Ty, - param_id: hir::HirId, -) -> bool { +fn is_param<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, ast_ty: &hir::Ty, param_id: hir::HirId) -> bool { if let hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) = ast_ty.node { match path.res { Res::SelfTy(Some(def_id), None) | Res::Def(DefKind::TyParam, def_id) => { @@ -578,7 +574,7 @@ fn convert_variant<'tcx>( discr: ty::VariantDiscr, def: &hir::VariantData, adt_kind: ty::AdtKind, - parent_did: DefId + parent_did: DefId, ) -> ty::VariantDef { let mut seen_fields: FxHashMap = Default::default(); let hir_id = tcx.hir().as_local_hir_id(variant_did.unwrap_or(parent_did)).unwrap(); @@ -779,10 +775,7 @@ fn trait_def<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::TraitDef tcx.arena.alloc(def) } -fn has_late_bound_regions<'tcx>( - tcx: TyCtxt<'tcx, 'tcx>, - node: Node<'tcx>, -) -> Option { +fn has_late_bound_regions<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, node: Node<'tcx>) -> Option { struct LateBoundRegionsDetector<'tcx> { tcx: TyCtxt<'tcx, 'tcx>, outer_index: ty::DebruijnIndex, @@ -1479,10 +1472,7 @@ pub fn checked_type_of<'tcx>( }) } -fn find_existential_constraints<'tcx>( - tcx: TyCtxt<'tcx, 'tcx>, - def_id: DefId, -) -> Ty<'tcx> { +fn find_existential_constraints<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> { use rustc::hir::{ImplItem, Item, TraitItem}; debug!("find_existential_constraints({:?})", def_id); @@ -1776,10 +1766,7 @@ fn fn_sig<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> ty::PolyFnSig<'tcx> { } } -fn impl_trait_ref<'tcx>( - tcx: TyCtxt<'tcx, 'tcx>, - def_id: DefId, -) -> Option> { +fn impl_trait_ref<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> Option> { let icx = ItemCtxt::new(tcx, def_id); let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); @@ -2301,10 +2288,7 @@ fn is_foreign_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> bool { } } -fn static_mutability<'tcx>( - tcx: TyCtxt<'tcx, 'tcx>, - def_id: DefId, -) -> Option { +fn static_mutability<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> Option { match tcx.hir().get_if_local(def_id) { Some(Node::Item(&hir::Item { node: hir::ItemKind::Static(_, mutbl, _), .. diff --git a/src/librustc_typeck/constrained_generic_params.rs b/src/librustc_typeck/constrained_generic_params.rs index c26de71a20ba3..3d424ce89dbc5 100644 --- a/src/librustc_typeck/constrained_generic_params.rs +++ b/src/librustc_typeck/constrained_generic_params.rs @@ -86,11 +86,12 @@ impl<'tcx> TypeVisitor<'tcx> for ParameterCollector { } } -pub fn identify_constrained_generic_params<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - predicates: &ty::GenericPredicates<'tcx>, - impl_trait_ref: Option>, - input_parameters: &mut FxHashSet) -{ +pub fn identify_constrained_generic_params<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + predicates: &ty::GenericPredicates<'tcx>, + impl_trait_ref: Option>, + input_parameters: &mut FxHashSet, +) { let mut predicates = predicates.predicates.clone(); setup_constraining_predicates(tcx, &mut predicates, impl_trait_ref, input_parameters); } @@ -136,11 +137,12 @@ pub fn identify_constrained_generic_params<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, /// which is determined by 1, which requires `U`, that is determined /// by 0. I should probably pick a less tangled example, but I can't /// think of any. -pub fn setup_constraining_predicates<'tcx>(tcx: TyCtxt<'_, '_>, - predicates: &mut [(ty::Predicate<'tcx>, Span)], - impl_trait_ref: Option>, - input_parameters: &mut FxHashSet) -{ +pub fn setup_constraining_predicates<'tcx>( + tcx: TyCtxt<'_, '_>, + predicates: &mut [(ty::Predicate<'tcx>, Span)], + impl_trait_ref: Option>, + input_parameters: &mut FxHashSet, +) { // The canonical way of doing the needed topological sort // would be a DFS, but getting the graph and its ownership // right is annoying, so I am using an in-place fixed-point iteration, diff --git a/src/librustc_typeck/impl_wf_check.rs b/src/librustc_typeck/impl_wf_check.rs index 6a7bdf48ae9d4..e13a664be0564 100644 --- a/src/librustc_typeck/impl_wf_check.rs +++ b/src/librustc_typeck/impl_wf_check.rs @@ -92,10 +92,11 @@ impl ItemLikeVisitor<'tcx> for ImplWfCheck<'tcx> { fn visit_impl_item(&mut self, _impl_item: &'tcx hir::ImplItem) { } } -fn enforce_impl_params_are_constrained<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - impl_def_id: DefId, - impl_item_refs: &[hir::ImplItemRef]) -{ +fn enforce_impl_params_are_constrained<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + impl_def_id: DefId, + impl_item_refs: &[hir::ImplItemRef], +) { // Every lifetime used in an associated type must be constrained. let impl_self_ty = tcx.type_of(impl_def_id); let impl_generics = tcx.generics_of(impl_def_id); @@ -171,11 +172,7 @@ fn enforce_impl_params_are_constrained<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, // used elsewhere are not projected back out. } -fn report_unused_parameter(tcx: TyCtxt<'_, '_>, - span: Span, - kind: &str, - name: &str) -{ +fn report_unused_parameter(tcx: TyCtxt<'_, '_>, span: Span, kind: &str, name: &str) { struct_span_err!( tcx.sess, span, E0207, "the {} parameter `{}` is not constrained by the \ @@ -186,9 +183,10 @@ fn report_unused_parameter(tcx: TyCtxt<'_, '_>, } /// Enforce that we do not have two items in an impl with the same name. -fn enforce_impl_items_are_distinct<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - impl_item_refs: &[hir::ImplItemRef]) -{ +fn enforce_impl_items_are_distinct<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + impl_item_refs: &[hir::ImplItemRef], +) { let mut seen_type_items = FxHashMap::default(); let mut seen_value_items = FxHashMap::default(); for impl_item_ref in impl_item_refs { diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index cb8e699351aa6..ce8bb975f9866 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -124,8 +124,7 @@ pub struct TypeAndSubsts<'tcx> { ty: Ty<'tcx>, } -fn check_type_alias_enum_variants_enabled<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, - span: Span) { +fn check_type_alias_enum_variants_enabled<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, span: Span) { if !tcx.features().type_alias_enum_variants { let mut err = tcx.sess.struct_span_err( span, @@ -140,10 +139,7 @@ fn check_type_alias_enum_variants_enabled<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, } } -fn require_c_abi_if_c_variadic(tcx: TyCtxt<'_, '_>, - decl: &hir::FnDecl, - abi: Abi, - span: Span) { +fn require_c_abi_if_c_variadic(tcx: TyCtxt<'_, '_>, decl: &hir::FnDecl, abi: Abi, span: Span) { if decl.c_variadic && !(abi == Abi::C || abi == Abi::Cdecl) { let mut err = struct_span_err!(tcx.sess, span, E0045, "C-variadic function must have C or cdecl calling convention"); @@ -151,11 +147,12 @@ fn require_c_abi_if_c_variadic(tcx: TyCtxt<'_, '_>, } } -fn require_same_types<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - cause: &ObligationCause<'tcx>, - expected: Ty<'tcx>, - actual: Ty<'tcx>) - -> bool { +fn require_same_types<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + cause: &ObligationCause<'tcx>, + expected: Ty<'tcx>, + actual: Ty<'tcx>, +) -> bool { tcx.infer_ctxt().enter(|ref infcx| { let param_env = ty::ParamEnv::empty(); let mut fulfill_cx = TraitEngine::new(infcx.tcx); @@ -318,9 +315,7 @@ pub fn provide(providers: &mut Providers<'_>) { impl_wf_check::provide(providers); } -pub fn check_crate<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) - -> Result<(), ErrorReported> -{ +pub fn check_crate<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) -> Result<(), ErrorReported> { tcx.sess.profiler(|p| p.start_activity("type-check crate")); // this ensures that later parts of type checking can assume that items @@ -392,8 +387,10 @@ pub fn hir_ty_to_ty<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, hir_ty: &hir::Ty) -> Ty<'tcx> astconv::AstConv::ast_ty_to_ty(&item_cx, hir_ty) } -pub fn hir_trait_to_predicates<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, hir_trait: &hir::TraitRef) - -> (ty::PolyTraitRef<'tcx>, Bounds<'tcx>) { +pub fn hir_trait_to_predicates<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + hir_trait: &hir::TraitRef, +) -> (ty::PolyTraitRef<'tcx>, Bounds<'tcx>) { // In case there are any projections, etc., find the "environment" // def-ID that will be used to determine the traits/predicates in // scope. This is derived from the enclosing item-like thing. diff --git a/src/librustc_typeck/variance/mod.rs b/src/librustc_typeck/variance/mod.rs index c8079210022f6..22422081bc44e 100644 --- a/src/librustc_typeck/variance/mod.rs +++ b/src/librustc_typeck/variance/mod.rs @@ -34,8 +34,10 @@ pub fn provide(providers: &mut Providers<'_>) { }; } -fn crate_variances<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, crate_num: CrateNum) - -> &'tcx CrateVariancesMap<'tcx> { +fn crate_variances<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + crate_num: CrateNum, +) -> &'tcx CrateVariancesMap<'tcx> { assert_eq!(crate_num, LOCAL_CRATE); let mut arena = arena::TypedArena::default(); let terms_cx = terms::determine_parameters_to_be_inferred(tcx, &mut arena); @@ -43,8 +45,7 @@ fn crate_variances<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, crate_num: CrateNum) tcx.arena.alloc(solve::solve_constraints(constraints_cx)) } -fn variances_of<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, item_def_id: DefId) - -> &'tcx [ty::Variance] { +fn variances_of<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, item_def_id: DefId) -> &'tcx [ty::Variance] { let id = tcx.hir().as_local_hir_id(item_def_id).expect("expected local def-id"); let unsupported = || { // Variance not relevant. diff --git a/src/librustc_typeck/variance/terms.rs b/src/librustc_typeck/variance/terms.rs index e566500571335..4f8bb0c4e462d 100644 --- a/src/librustc_typeck/variance/terms.rs +++ b/src/librustc_typeck/variance/terms.rs @@ -64,9 +64,10 @@ pub struct TermsContext<'a, 'tcx: 'a> { pub inferred_terms: Vec>, } -pub fn determine_parameters_to_be_inferred<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx>, - arena: &'a mut TypedArena>) - -> TermsContext<'a, 'tcx> { +pub fn determine_parameters_to_be_inferred<'a, 'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, + arena: &'a mut TypedArena>, +) -> TermsContext<'a, 'tcx> { let mut terms_cx = TermsContext { tcx, arena, diff --git a/src/librustc_typeck/variance/test.rs b/src/librustc_typeck/variance/test.rs index 3f55b3360154c..f43c200425505 100644 --- a/src/librustc_typeck/variance/test.rs +++ b/src/librustc_typeck/variance/test.rs @@ -8,7 +8,7 @@ pub fn test_variance<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) { } struct VarianceTest<'tcx> { - tcx: TyCtxt<'tcx, 'tcx> + tcx: TyCtxt<'tcx, 'tcx>, } impl ItemLikeVisitor<'tcx> for VarianceTest<'tcx> { diff --git a/src/test/ui/pattern/const-pat-ice.stderr b/src/test/ui/pattern/const-pat-ice.stderr index c4f6e0212621f..7ddeac4abca13 100644 --- a/src/test/ui/pattern/const-pat-ice.stderr +++ b/src/test/ui/pattern/const-pat-ice.stderr @@ -1,4 +1,4 @@ -thread 'rustc' panicked at 'assertion failed: rows.iter().all(|r| r.len() == v.len())', src/librustc_mir/hair/pattern/_match.rs:1085:5 +thread 'rustc' panicked at 'assertion failed: rows.iter().all(|r| r.len() == v.len())', src/librustc_mir/hair/pattern/_match.rs:1084:5 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace. error: internal compiler error: unexpected panic From 87b6b864686eecd3c6ee7b6b3bba04f7d1f67be5 Mon Sep 17 00:00:00 2001 From: Eduard-Mihai Burtescu Date: Wed, 12 Jun 2019 15:59:10 +0300 Subject: [PATCH 6/7] rustc_codegen_llvm: `deny(unused_lifetimes)`. --- src/librustc_codegen_llvm/base.rs | 4 ++-- src/librustc_codegen_llvm/builder.rs | 4 +--- src/librustc_codegen_llvm/debuginfo/metadata.rs | 3 +-- src/librustc_codegen_llvm/lib.rs | 7 ++++--- src/librustc_codegen_llvm/type_.rs | 2 +- src/librustc_codegen_llvm/type_of.rs | 4 ++-- 6 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/librustc_codegen_llvm/base.rs b/src/librustc_codegen_llvm/base.rs index c552cc9223862..9d2cd8618872a 100644 --- a/src/librustc_codegen_llvm/base.rs +++ b/src/librustc_codegen_llvm/base.rs @@ -41,7 +41,7 @@ use rustc::hir::CodegenFnAttrs; use crate::value::Value; -pub fn write_compressed_metadata<'a, 'gcx>( +pub fn write_compressed_metadata<'gcx>( tcx: TyCtxt<'gcx, 'gcx>, metadata: &EncodedMetadata, llvm_module: &mut ModuleLlvm, @@ -123,7 +123,7 @@ pub fn compile_codegen_unit(tcx: TyCtxt<'tcx, 'tcx>, cgu_name: InternedString) { submit_codegened_module_to_llvm(&LlvmCodegenBackend(()), tcx, module, cost); - fn module_codegen<'ll, 'tcx>( + fn module_codegen<'tcx>( tcx: TyCtxt<'tcx, 'tcx>, cgu_name: InternedString, ) -> ModuleCodegen { diff --git a/src/librustc_codegen_llvm/builder.rs b/src/librustc_codegen_llvm/builder.rs index 3d5f00a06921d..2febba6766d53 100644 --- a/src/librustc_codegen_llvm/builder.rs +++ b/src/librustc_codegen_llvm/builder.rs @@ -1228,9 +1228,7 @@ impl Builder<'a, 'll, 'tcx> { ret.expect("LLVM does not have support for catchret") } - fn check_store<'b>(&mut self, - val: &'ll Value, - ptr: &'ll Value) -> &'ll Value { + fn check_store(&mut self, val: &'ll Value, ptr: &'ll Value) -> &'ll Value { let dest_ptr_ty = self.cx.val_ty(ptr); let stored_ty = self.cx.val_ty(val); let stored_ptr_ty = self.cx.type_ptr_to(stored_ty); diff --git a/src/librustc_codegen_llvm/debuginfo/metadata.rs b/src/librustc_codegen_llvm/debuginfo/metadata.rs index c4d9f79e8d301..ac798143c00c8 100644 --- a/src/librustc_codegen_llvm/debuginfo/metadata.rs +++ b/src/librustc_codegen_llvm/debuginfo/metadata.rs @@ -222,8 +222,7 @@ impl TypeMap<'ll, 'tcx> { // Get the unique type id string for an enum variant part. // Variant parts are not types and shouldn't really have their own id, // but it makes set_members_of_composite_type() simpler. - fn get_unique_type_id_str_of_enum_variant_part<'a>(&mut self, - enum_type_id: UniqueTypeId) -> &str { + fn get_unique_type_id_str_of_enum_variant_part(&mut self, enum_type_id: UniqueTypeId) -> &str { let variant_part_type_id = format!("{}_variant_part", self.get_unique_type_id_as_string(enum_type_id)); let interner_key = self.unique_id_interner.intern(&variant_part_type_id); diff --git a/src/librustc_codegen_llvm/lib.rs b/src/librustc_codegen_llvm/lib.rs index 2e922ad5fcd3b..7820e9fa494f0 100644 --- a/src/librustc_codegen_llvm/lib.rs +++ b/src/librustc_codegen_llvm/lib.rs @@ -22,6 +22,7 @@ #![feature(static_nobundle)] #![feature(trusted_len)] #![deny(rust_2018_idioms)] +#![deny(unused_lifetimes)] #![allow(explicit_outlives_requirements)] use back::write::{create_target_machine, create_informational_target_machine}; @@ -107,7 +108,7 @@ impl ExtraBackendMethods for LlvmCodegenBackend { ModuleLlvm::new_metadata(tcx, mod_name) } - fn write_compressed_metadata<'b, 'gcx>( + fn write_compressed_metadata<'gcx>( &self, tcx: TyCtxt<'gcx, 'gcx>, metadata: &EncodedMetadata, @@ -115,7 +116,7 @@ impl ExtraBackendMethods for LlvmCodegenBackend { ) { base::write_compressed_metadata(tcx, metadata, llvm_module) } - fn codegen_allocator<'b, 'gcx>( + fn codegen_allocator<'gcx>( &self, tcx: TyCtxt<'gcx, 'gcx>, mods: &mut ModuleLlvm, @@ -284,7 +285,7 @@ impl CodegenBackend for LlvmCodegenBackend { attributes::provide_extern(providers); } - fn codegen_crate<'b, 'tcx>( + fn codegen_crate<'tcx>( &self, tcx: TyCtxt<'tcx, 'tcx>, metadata: EncodedMetadata, diff --git a/src/librustc_codegen_llvm/type_.rs b/src/librustc_codegen_llvm/type_.rs index a3d3f0756a5f3..2c167256ad56c 100644 --- a/src/librustc_codegen_llvm/type_.rs +++ b/src/librustc_codegen_llvm/type_.rs @@ -327,7 +327,7 @@ impl LayoutTypeMethods<'tcx> for CodegenCx<'ll, 'tcx> { fn backend_field_index(&self, layout: TyLayout<'tcx>, index: usize) -> u64 { layout.llvm_field_index(index) } - fn scalar_pair_element_backend_type<'a>( + fn scalar_pair_element_backend_type( &self, layout: TyLayout<'tcx>, index: usize, diff --git a/src/librustc_codegen_llvm/type_of.rs b/src/librustc_codegen_llvm/type_of.rs index 7a82fd731f604..36a9ff0a2d2e5 100644 --- a/src/librustc_codegen_llvm/type_of.rs +++ b/src/librustc_codegen_llvm/type_of.rs @@ -175,7 +175,7 @@ impl<'a, 'tcx> CodegenCx<'a, 'tcx> { pub trait LayoutLlvmExt<'tcx> { fn is_llvm_immediate(&self) -> bool; - fn is_llvm_scalar_pair<'a>(&self) -> bool; + fn is_llvm_scalar_pair(&self) -> bool; fn llvm_type<'a>(&self, cx: &CodegenCx<'a, 'tcx>) -> &'a Type; fn immediate_llvm_type<'a>(&self, cx: &CodegenCx<'a, 'tcx>) -> &'a Type; fn scalar_llvm_type_at<'a>(&self, cx: &CodegenCx<'a, 'tcx>, @@ -198,7 +198,7 @@ impl<'tcx> LayoutLlvmExt<'tcx> for TyLayout<'tcx> { } } - fn is_llvm_scalar_pair<'a>(&self) -> bool { + fn is_llvm_scalar_pair(&self) -> bool { match self.abi { layout::Abi::ScalarPair(..) => true, layout::Abi::Uninhabited | From 4c98cb6f7586d92be37c94c6063fa9645a448e92 Mon Sep 17 00:00:00 2001 From: Eduard-Mihai Burtescu Date: Wed, 12 Jun 2019 16:06:35 +0300 Subject: [PATCH 7/7] rustc_codegen_llvm: `deny(internal)`. --- src/librustc_codegen_llvm/debuginfo/metadata.rs | 6 +----- src/librustc_codegen_llvm/intrinsic.rs | 12 ++++++------ src/librustc_codegen_llvm/lib.rs | 1 + 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/librustc_codegen_llvm/debuginfo/metadata.rs b/src/librustc_codegen_llvm/debuginfo/metadata.rs index ac798143c00c8..3c37240b1660c 100644 --- a/src/librustc_codegen_llvm/debuginfo/metadata.rs +++ b/src/librustc_codegen_llvm/debuginfo/metadata.rs @@ -2257,11 +2257,7 @@ pub fn create_global_var_metadata( /// given type. /// /// Adds the created metadata nodes directly to the crate's IR. -pub fn create_vtable_metadata( - cx: &CodegenCx<'ll, 'tcx>, - ty: ty::Ty<'tcx>, - vtable: &'ll Value, -) { +pub fn create_vtable_metadata(cx: &CodegenCx<'ll, 'tcx>, ty: Ty<'tcx>, vtable: &'ll Value) { if cx.dbg_cx.is_none() { return; } diff --git a/src/librustc_codegen_llvm/intrinsic.rs b/src/librustc_codegen_llvm/intrinsic.rs index 875f1d0940a3a..dc3631e2ee17b 100644 --- a/src/librustc_codegen_llvm/intrinsic.rs +++ b/src/librustc_codegen_llvm/intrinsic.rs @@ -1417,7 +1417,7 @@ fn generic_simd_intrinsic( // FIXME: use: // https://github.com/llvm-mirror/llvm/blob/master/include/llvm/IR/Function.h#L182 // https://github.com/llvm-mirror/llvm/blob/master/include/llvm/IR/Intrinsics.h#L81 - fn llvm_vector_str(elem_ty: ty::Ty<'_>, vec_len: usize, no_pointers: usize) -> String { + fn llvm_vector_str(elem_ty: Ty<'_>, vec_len: usize, no_pointers: usize) -> String { let p0s: String = "p0".repeat(no_pointers); match elem_ty.sty { ty::Int(v) => format!("v{}{}i{}", vec_len, p0s, v.bit_width().unwrap()), @@ -1427,7 +1427,7 @@ fn generic_simd_intrinsic( } } - fn llvm_vector_ty(cx: &CodegenCx<'ll, '_>, elem_ty: ty::Ty<'_>, vec_len: usize, + fn llvm_vector_ty(cx: &CodegenCx<'ll, '_>, elem_ty: Ty<'_>, vec_len: usize, mut no_pointers: usize) -> &'ll Type { // FIXME: use cx.layout_of(ty).llvm_type() ? let mut elem_ty = match elem_ty.sty { @@ -1473,7 +1473,7 @@ fn generic_simd_intrinsic( in_ty, ret_ty); // This counts how many pointers - fn ptr_count(t: ty::Ty<'_>) -> usize { + fn ptr_count(t: Ty<'_>) -> usize { match t.sty { ty::RawPtr(p) => 1 + ptr_count(p.ty), _ => 0, @@ -1481,7 +1481,7 @@ fn generic_simd_intrinsic( } // Non-ptr type - fn non_ptr(t: ty::Ty<'_>) -> ty::Ty<'_> { + fn non_ptr(t: Ty<'_>) -> Ty<'_> { match t.sty { ty::RawPtr(p) => non_ptr(p.ty), _ => t, @@ -1572,7 +1572,7 @@ fn generic_simd_intrinsic( arg_tys[2].simd_size(tcx)); // This counts how many pointers - fn ptr_count(t: ty::Ty<'_>) -> usize { + fn ptr_count(t: Ty<'_>) -> usize { match t.sty { ty::RawPtr(p) => 1 + ptr_count(p.ty), _ => 0, @@ -1580,7 +1580,7 @@ fn generic_simd_intrinsic( } // Non-ptr type - fn non_ptr(t: ty::Ty<'_>) -> ty::Ty<'_> { + fn non_ptr(t: Ty<'_>) -> Ty<'_> { match t.sty { ty::RawPtr(p) => non_ptr(p.ty), _ => t, diff --git a/src/librustc_codegen_llvm/lib.rs b/src/librustc_codegen_llvm/lib.rs index 7820e9fa494f0..9a0860bc4b09f 100644 --- a/src/librustc_codegen_llvm/lib.rs +++ b/src/librustc_codegen_llvm/lib.rs @@ -22,6 +22,7 @@ #![feature(static_nobundle)] #![feature(trusted_len)] #![deny(rust_2018_idioms)] +#![deny(internal)] #![deny(unused_lifetimes)] #![allow(explicit_outlives_requirements)]