From b25b466a887d8ceaef533e542431fdec7e70f10f Mon Sep 17 00:00:00 2001 From: Eduard-Mihai Burtescu Date: Fri, 14 Jun 2019 19:39:39 +0300 Subject: [PATCH 1/6] rustc: remove 'x: 'y bounds (except from comments/strings). --- src/librustc/cfg/construct.rs | 2 +- src/librustc/cfg/graphviz.rs | 2 +- src/librustc/dep_graph/dep_node.rs | 4 +-- src/librustc/hir/intravisit.rs | 2 +- src/librustc/hir/lowering.rs | 8 +++--- src/librustc/hir/map/hir_id_validator.rs | 12 ++++----- src/librustc/infer/at.rs | 4 +-- src/librustc/infer/canonical/canonicalizer.rs | 2 +- src/librustc/infer/combine.rs | 4 +-- src/librustc/infer/equate.rs | 2 +- .../error_reporting/nice_region_error/mod.rs | 2 +- src/librustc/infer/freshen.rs | 2 +- src/librustc/infer/fudge.rs | 2 +- src/librustc/infer/glb.rs | 2 +- src/librustc/infer/lattice.rs | 4 +-- .../infer/lexical_region_resolve/graphviz.rs | 2 +- .../infer/lexical_region_resolve/mod.rs | 2 +- src/librustc/infer/lub.rs | 2 +- src/librustc/infer/mod.rs | 2 +- src/librustc/infer/nll_relate/mod.rs | 6 ++--- src/librustc/infer/opaque_types/mod.rs | 2 +- src/librustc/infer/outlives/env.rs | 2 +- src/librustc/infer/outlives/obligations.rs | 2 +- src/librustc/infer/outlives/verify.rs | 2 +- src/librustc/infer/resolve.rs | 8 +++--- src/librustc/infer/sub.rs | 2 +- src/librustc/lint/context.rs | 4 +-- src/librustc/middle/dead.rs | 4 +-- src/librustc/middle/entry.rs | 2 +- src/librustc/middle/expr_use_visitor.rs | 2 +- src/librustc/middle/free_region.rs | 2 +- src/librustc/middle/liveness.rs | 4 +-- src/librustc/middle/reachable.rs | 6 ++--- src/librustc/middle/resolve_lifetime.rs | 4 +-- src/librustc/middle/stability.rs | 8 +++--- src/librustc/middle/weak_lang_items.rs | 2 +- src/librustc/mir/mod.rs | 4 +-- src/librustc/mir/traversal.rs | 6 ++--- src/librustc/traits/error_reporting.rs | 2 +- src/librustc/traits/fulfill.rs | 2 +- src/librustc/traits/project.rs | 2 +- src/librustc/traits/query/normalize.rs | 2 +- src/librustc/traits/select.rs | 10 +++---- src/librustc/ty/query/on_disk_cache.rs | 2 +- src/librustc/ty/query/plumbing.rs | 4 +-- src/librustc/ty/wf.rs | 2 +- src/librustc_borrowck/borrowck/check_loans.rs | 2 +- .../borrowck/gather_loans/gather_moves.rs | 6 ++--- .../borrowck/gather_loans/lifetime.rs | 2 +- .../borrowck/gather_loans/mod.rs | 2 +- .../borrowck/gather_loans/restrictions.rs | 2 +- src/librustc_borrowck/borrowck/mod.rs | 2 +- src/librustc_borrowck/graphviz.rs | 2 +- src/librustc_codegen_llvm/builder.rs | 2 +- src/librustc_codegen_llvm/context.rs | 2 +- src/librustc_codegen_llvm/lib.rs | 2 +- src/librustc_codegen_ssa/README.md | 10 +++---- src/librustc_codegen_ssa/base.rs | 24 ++++++++--------- src/librustc_codegen_ssa/common.rs | 8 +++--- src/librustc_codegen_ssa/glue.rs | 2 +- src/librustc_codegen_ssa/meth.rs | 2 +- src/librustc_codegen_ssa/mir/analyze.rs | 6 ++--- src/librustc_codegen_ssa/mir/block.rs | 4 +-- src/librustc_codegen_ssa/mir/constant.rs | 2 +- src/librustc_codegen_ssa/mir/mod.rs | 12 ++++----- src/librustc_codegen_ssa/mir/operand.rs | 6 ++--- src/librustc_codegen_ssa/mir/place.rs | 6 ++--- src/librustc_codegen_ssa/mir/rvalue.rs | 8 +++--- src/librustc_codegen_ssa/mir/statement.rs | 2 +- src/librustc_codegen_ssa/mono_item.rs | 4 +-- src/librustc_codegen_ssa/traits/backend.rs | 2 +- src/librustc_codegen_ssa/traits/builder.rs | 2 +- src/librustc_driver/pretty.rs | 2 +- src/librustc_lint/builtin.rs | 2 +- src/librustc_lint/types.rs | 2 +- src/librustc_metadata/creader.rs | 2 +- src/librustc_metadata/decoder.rs | 6 ++--- src/librustc_mir/borrow_check/borrow_set.rs | 2 +- src/librustc_mir/borrow_check/flows.rs | 2 +- src/librustc_mir/borrow_check/mod.rs | 6 ++--- .../borrow_check/nll/constraint_generation.rs | 2 +- .../nll/explain_borrow/find_use.rs | 4 +-- .../borrow_check/nll/invalidation.rs | 2 +- .../borrow_check/nll/region_infer/graphviz.rs | 4 +-- .../nll/type_check/constraint_conversion.rs | 2 +- .../nll/type_check/free_region_relations.rs | 2 +- .../nll/type_check/liveness/trace.rs | 12 ++++----- .../borrow_check/nll/type_check/mod.rs | 6 ++--- .../borrow_check/nll/type_check/relate_tys.rs | 2 +- .../borrow_check/nll/universal_regions.rs | 2 +- src/librustc_mir/borrow_check/prefixes.rs | 2 +- src/librustc_mir/borrow_check/used_muts.rs | 2 +- src/librustc_mir/build/matches/mod.rs | 6 ++--- src/librustc_mir/build/mod.rs | 2 +- .../dataflow/impls/borrowed_locals.rs | 6 ++--- src/librustc_mir/dataflow/impls/borrows.rs | 2 +- src/librustc_mir/dataflow/impls/mod.rs | 14 +++++----- .../dataflow/impls/storage_liveness.rs | 4 +-- src/librustc_mir/dataflow/mod.rs | 22 ++++++++-------- .../dataflow/move_paths/builder.rs | 4 +-- src/librustc_mir/hair/cx/mod.rs | 2 +- src/librustc_mir/hair/cx/to_ref.rs | 12 ++++----- src/librustc_mir/hair/pattern/_match.rs | 26 +++++++++---------- src/librustc_mir/hair/pattern/check_match.rs | 8 +++--- src/librustc_mir/hair/pattern/mod.rs | 2 +- src/librustc_mir/interpret/eval_context.rs | 4 +-- src/librustc_mir/interpret/snapshot.rs | 2 +- src/librustc_mir/interpret/visitor.rs | 2 +- src/librustc_mir/monomorphize/collector.rs | 4 +-- src/librustc_mir/monomorphize/partitioning.rs | 4 +-- src/librustc_mir/shim.rs | 2 +- src/librustc_mir/transform/check_unsafety.rs | 2 +- src/librustc_mir/transform/elaborate_drops.rs | 4 +-- src/librustc_mir/transform/generator.rs | 6 ++--- src/librustc_mir/transform/inline.rs | 2 +- src/librustc_mir/transform/mod.rs | 2 +- src/librustc_mir/transform/promote_consts.rs | 2 +- src/librustc_mir/transform/simplify.rs | 4 +-- .../transform/uniform_array_move_out.rs | 2 +- src/librustc_mir/util/elaborate_drops.rs | 4 +-- src/librustc_passes/loops.rs | 2 +- src/librustc_passes/rvalue_promotion.rs | 2 +- src/librustc_privacy/lib.rs | 10 +++---- src/librustc_resolve/build_reduced_graph.rs | 2 +- src/librustc_resolve/check_unused.rs | 2 +- src/librustc_resolve/diagnostics.rs | 2 +- src/librustc_resolve/lib.rs | 2 +- src/librustc_resolve/macros.rs | 2 +- src/librustc_resolve/resolve_imports.rs | 10 +++---- src/librustc_save_analysis/dump_visitor.rs | 6 ++--- src/librustc_save_analysis/lib.rs | 6 ++--- src/librustc_traits/chalk_context/mod.rs | 2 +- .../chalk_context/resolvent_ops.rs | 2 +- src/librustc_traits/chalk_context/unify.rs | 2 +- src/librustc_traits/type_op.rs | 2 +- src/librustc_typeck/check/autoderef.rs | 2 +- .../check/generator_interior.rs | 2 +- src/librustc_typeck/check/method/suggest.rs | 2 +- src/librustc_typeck/check/mod.rs | 8 +++--- src/librustc_typeck/check/writeback.rs | 4 +-- src/librustc_typeck/check_unused.rs | 2 +- src/librustc_typeck/collect.rs | 2 +- .../outlives/implicit_infer.rs | 2 +- src/librustc_typeck/variance/constraints.rs | 2 +- src/librustc_typeck/variance/solve.rs | 2 +- src/librustc_typeck/variance/terms.rs | 2 +- .../passes/check_code_block_syntax.rs | 2 +- src/librustdoc/test.rs | 2 +- src/libserialize/json.rs | 2 +- src/libsyntax/ext/expand.rs | 4 +-- src/libsyntax/ext/placeholders.rs | 2 +- src/libsyntax/ext/tt/macro_parser.rs | 4 +-- src/libsyntax_ext/deriving/generic/mod.rs | 2 +- src/libsyntax_ext/format.rs | 2 +- 154 files changed, 305 insertions(+), 305 deletions(-) diff --git a/src/librustc/cfg/construct.rs b/src/librustc/cfg/construct.rs index 85602320f0b0d..213e57a3b37c2 100644 --- a/src/librustc/cfg/construct.rs +++ b/src/librustc/cfg/construct.rs @@ -7,7 +7,7 @@ use crate::ty::{self, TyCtxt}; use crate::hir::{self, PatKind}; use crate::hir::def_id::DefId; -struct CFGBuilder<'a, 'tcx: 'a> { +struct CFGBuilder<'a, 'tcx> { tcx: TyCtxt<'tcx>, owner_def_id: DefId, tables: &'a ty::TypeckTables<'tcx>, diff --git a/src/librustc/cfg/graphviz.rs b/src/librustc/cfg/graphviz.rs index 66963e5856eec..918120057d4d3 100644 --- a/src/librustc/cfg/graphviz.rs +++ b/src/librustc/cfg/graphviz.rs @@ -11,7 +11,7 @@ use crate::ty::TyCtxt; pub type Node<'a> = (cfg::CFGIndex, &'a cfg::CFGNode); pub type Edge<'a> = &'a cfg::CFGEdge; -pub struct LabelledCFG<'a, 'tcx: 'a> { +pub struct LabelledCFG<'a, 'tcx> { pub tcx: TyCtxt<'tcx>, pub cfg: &'a cfg::CFG, pub name: String, diff --git a/src/librustc/dep_graph/dep_node.rs b/src/librustc/dep_graph/dep_node.rs index f7647167a7578..e8f83093bda11 100644 --- a/src/librustc/dep_graph/dep_node.rs +++ b/src/librustc/dep_graph/dep_node.rs @@ -207,8 +207,8 @@ macro_rules! define_dep_nodes { pub fn new<'a, 'tcx>(tcx: TyCtxt<'tcx>, dep: DepConstructor<'tcx>) -> DepNode - where 'tcx: 'a, - 'tcx: 'a + where 'tcx, + 'tcx { match dep { $( diff --git a/src/librustc/hir/intravisit.rs b/src/librustc/hir/intravisit.rs index 666cfc3f6dcac..e29a373ec3b76 100644 --- a/src/librustc/hir/intravisit.rs +++ b/src/librustc/hir/intravisit.rs @@ -74,7 +74,7 @@ impl<'a> FnKind<'a> { /// /// See the comments on `ItemLikeVisitor` for more details on the overall /// visit strategy. -pub enum NestedVisitorMap<'this, 'tcx: 'this> { +pub enum NestedVisitorMap<'this, 'tcx> { /// Do not visit any nested things. When you add a new /// "non-nested" thing, you will want to audit such uses to see if /// they remain valid. diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index 5a548ce8d9ff4..153397f11b5a0 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -415,7 +415,7 @@ impl<'a> LoweringContext<'a> { /// needed from arbitrary locations in the crate, /// e.g., the number of lifetime generic parameters /// declared for every type and trait definition. - struct MiscCollector<'tcx, 'interner: 'tcx> { + struct MiscCollector<'tcx, 'interner> { lctx: &'tcx mut LoweringContext<'interner>, hir_id_owner: Option, } @@ -561,7 +561,7 @@ impl<'a> LoweringContext<'a> { } } - struct ItemLowerer<'tcx, 'interner: 'tcx> { + struct ItemLowerer<'tcx, 'interner> { lctx: &'tcx mut LoweringContext<'interner>, } @@ -1788,7 +1788,7 @@ impl<'a> LoweringContext<'a> { // This visitor walks over `impl Trait` bounds and creates defs for all lifetimes that // appear in the bounds, excluding lifetimes that are created within the bounds. // E.g., `'a`, `'b`, but not `'c` in `impl for<'c> SomeTrait<'a, 'b, 'c>`. - struct ImplTraitLifetimeCollector<'r, 'a: 'r> { + struct ImplTraitLifetimeCollector<'r, 'a> { context: &'r mut LoweringContext<'a>, parent: DefIndex, exist_ty_id: NodeId, @@ -1799,7 +1799,7 @@ impl<'a> LoweringContext<'a> { output_lifetime_params: Vec, } - impl<'r, 'a: 'r, 'v> hir::intravisit::Visitor<'v> for ImplTraitLifetimeCollector<'r, 'a> { + impl<'r, 'a, 'v> hir::intravisit::Visitor<'v> for ImplTraitLifetimeCollector<'r, 'a> { fn nested_visit_map<'this>( &'this mut self, ) -> hir::intravisit::NestedVisitorMap<'this, 'v> { diff --git a/src/librustc/hir/map/hir_id_validator.rs b/src/librustc/hir/map/hir_id_validator.rs index 32d0e069f72de..60465c04ec62f 100644 --- a/src/librustc/hir/map/hir_id_validator.rs +++ b/src/librustc/hir/map/hir_id_validator.rs @@ -26,19 +26,19 @@ pub fn check_crate<'hir>(hir_map: &hir::map::Map<'hir>) { } } -struct HirIdValidator<'a, 'hir: 'a> { +struct HirIdValidator<'a, 'hir> { hir_map: &'a hir::map::Map<'hir>, owner_def_index: Option, hir_ids_seen: FxHashSet, errors: &'a Lock>, } -struct OuterVisitor<'a, 'hir: 'a> { +struct OuterVisitor<'a, 'hir> { hir_map: &'a hir::map::Map<'hir>, errors: &'a Lock>, } -impl<'a, 'hir: 'a> OuterVisitor<'a, 'hir> { +impl<'a, 'hir> OuterVisitor<'a, 'hir> { fn new_inner_visitor(&self, hir_map: &'a hir::map::Map<'hir>) -> HirIdValidator<'a, 'hir> { @@ -51,7 +51,7 @@ impl<'a, 'hir: 'a> OuterVisitor<'a, 'hir> { } } -impl<'a, 'hir: 'a> ItemLikeVisitor<'hir> for OuterVisitor<'a, 'hir> { +impl<'a, 'hir> ItemLikeVisitor<'hir> for OuterVisitor<'a, 'hir> { fn visit_item(&mut self, i: &'hir hir::Item) { let mut inner_visitor = self.new_inner_visitor(self.hir_map); inner_visitor.check(i.hir_id, |this| intravisit::walk_item(this, i)); @@ -68,7 +68,7 @@ impl<'a, 'hir: 'a> ItemLikeVisitor<'hir> for OuterVisitor<'a, 'hir> { } } -impl<'a, 'hir: 'a> HirIdValidator<'a, 'hir> { +impl<'a, 'hir> HirIdValidator<'a, 'hir> { #[cold] #[inline(never)] fn error(&self, f: impl FnOnce() -> String) { @@ -133,7 +133,7 @@ impl<'a, 'hir: 'a> HirIdValidator<'a, 'hir> { } } -impl<'a, 'hir: 'a> intravisit::Visitor<'hir> for HirIdValidator<'a, 'hir> { +impl<'a, 'hir> intravisit::Visitor<'hir> for HirIdValidator<'a, 'hir> { fn nested_visit_map<'this>(&'this mut self) -> intravisit::NestedVisitorMap<'this, 'hir> { diff --git a/src/librustc/infer/at.rs b/src/librustc/infer/at.rs index 0bb939889a89a..e4aec59c1f64f 100644 --- a/src/librustc/infer/at.rs +++ b/src/librustc/infer/at.rs @@ -30,13 +30,13 @@ use super::*; use crate::ty::Const; use crate::ty::relate::{Relate, TypeRelation}; -pub struct At<'a, 'tcx: 'a> { +pub struct At<'a, 'tcx> { pub infcx: &'a InferCtxt<'a, 'tcx>, pub cause: &'a ObligationCause<'tcx>, pub param_env: ty::ParamEnv<'tcx>, } -pub struct Trace<'a, 'tcx: 'a> { +pub struct Trace<'a, 'tcx> { at: At<'a, 'tcx>, a_is_expected: bool, trace: TypeTrace<'tcx>, diff --git a/src/librustc/infer/canonical/canonicalizer.rs b/src/librustc/infer/canonical/canonicalizer.rs index b4779eec65f4c..383048b5fe72a 100644 --- a/src/librustc/infer/canonical/canonicalizer.rs +++ b/src/librustc/infer/canonical/canonicalizer.rs @@ -275,7 +275,7 @@ impl CanonicalizeRegionMode for CanonicalizeFreeRegionsOtherThanStatic { } } -struct Canonicalizer<'cx, 'tcx: 'cx> { +struct Canonicalizer<'cx, 'tcx> { infcx: Option<&'cx InferCtxt<'cx, 'tcx>>, tcx: TyCtxt<'tcx>, variables: SmallVec<[CanonicalVarInfo; 8]>, diff --git a/src/librustc/infer/combine.rs b/src/librustc/infer/combine.rs index 23550569f7ccf..e20b53455f49c 100644 --- a/src/librustc/infer/combine.rs +++ b/src/librustc/infer/combine.rs @@ -44,7 +44,7 @@ use syntax::ast; use syntax_pos::{Span, DUMMY_SP}; #[derive(Clone)] -pub struct CombineFields<'infcx, 'tcx: 'infcx> { +pub struct CombineFields<'infcx, 'tcx> { pub infcx: &'infcx InferCtxt<'infcx, 'tcx>, pub trace: TypeTrace<'tcx>, pub cause: Option, @@ -355,7 +355,7 @@ impl<'infcx, 'tcx> CombineFields<'infcx, 'tcx> { } } -struct Generalizer<'cx, 'tcx: 'cx> { +struct Generalizer<'cx, 'tcx> { infcx: &'cx InferCtxt<'cx, 'tcx>, /// The span, used when creating new type variables and things. diff --git a/src/librustc/infer/equate.rs b/src/librustc/infer/equate.rs index 39d8241e6b427..5eebe9e78d353 100644 --- a/src/librustc/infer/equate.rs +++ b/src/librustc/infer/equate.rs @@ -11,7 +11,7 @@ use crate::mir::interpret::ConstValue; use crate::infer::unify_key::replace_if_possible; /// Ensures `a` is made equal to `b`. Returns `a` on success. -pub struct Equate<'combine, 'infcx: 'combine, 'tcx: 'infcx> { +pub struct Equate<'combine, 'infcx, 'tcx> { fields: &'combine mut CombineFields<'infcx, 'tcx>, a_is_expected: bool, } 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 541d9a96dbe60..1edb1c601bf1a 100644 --- a/src/librustc/infer/error_reporting/nice_region_error/mod.rs +++ b/src/librustc/infer/error_reporting/nice_region_error/mod.rs @@ -30,7 +30,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> { } } -pub struct NiceRegionError<'cx, 'tcx: 'cx> { +pub struct NiceRegionError<'cx, 'tcx> { infcx: &'cx InferCtxt<'cx, 'tcx>, error: Option>, regions: Option<(Span, ty::Region<'tcx>, ty::Region<'tcx>)>, diff --git a/src/librustc/infer/freshen.rs b/src/librustc/infer/freshen.rs index 645f2b0233800..7f4a817faf182 100644 --- a/src/librustc/infer/freshen.rs +++ b/src/librustc/infer/freshen.rs @@ -41,7 +41,7 @@ use std::collections::hash_map::Entry; use super::InferCtxt; use super::unify_key::ToType; -pub struct TypeFreshener<'a, 'tcx: 'a> { +pub struct TypeFreshener<'a, 'tcx> { infcx: &'a InferCtxt<'a, 'tcx>, ty_freshen_count: u32, const_freshen_count: u32, diff --git a/src/librustc/infer/fudge.rs b/src/librustc/infer/fudge.rs index 59364862c649b..658a9c1d88805 100644 --- a/src/librustc/infer/fudge.rs +++ b/src/librustc/infer/fudge.rs @@ -133,7 +133,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { } } -pub struct InferenceFudger<'a, 'tcx: 'a> { +pub struct InferenceFudger<'a, 'tcx> { infcx: &'a InferCtxt<'a, 'tcx>, type_vars: (Range, Vec), int_vars: Range, diff --git a/src/librustc/infer/glb.rs b/src/librustc/infer/glb.rs index 7f184d3424f2f..550213167470d 100644 --- a/src/librustc/infer/glb.rs +++ b/src/librustc/infer/glb.rs @@ -8,7 +8,7 @@ use crate::ty::{self, Ty, TyCtxt}; use crate::ty::relate::{Relate, RelateResult, TypeRelation}; /// "Greatest lower bound" (common subtype) -pub struct Glb<'combine, 'infcx: 'combine, 'tcx: 'infcx> { +pub struct Glb<'combine, 'infcx, 'tcx> { fields: &'combine mut CombineFields<'infcx, 'tcx>, a_is_expected: bool, } diff --git a/src/librustc/infer/lattice.rs b/src/librustc/infer/lattice.rs index c7766636e04e0..a3372f5037917 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, 'tcx: 'f>: TypeRelation<'tcx> { +pub trait LatticeDir<'f, 'tcx>: TypeRelation<'tcx> { fn infcx(&self) -> &'f InferCtxt<'f, 'tcx>; fn cause(&self) -> &ObligationCause<'tcx>; @@ -48,7 +48,7 @@ pub fn super_lattice_tys<'a, 'tcx, L>( ) -> RelateResult<'tcx, Ty<'tcx>> where L: LatticeDir<'a, 'tcx>, - 'tcx: 'a, + 'tcx, { debug!("{}.lattice_tys({:?}, {:?})", this.tag(), diff --git a/src/librustc/infer/lexical_region_resolve/graphviz.rs b/src/librustc/infer/lexical_region_resolve/graphviz.rs index aa4bbcad6d5bc..ad481417d5e5f 100644 --- a/src/librustc/infer/lexical_region_resolve/graphviz.rs +++ b/src/librustc/infer/lexical_region_resolve/graphviz.rs @@ -107,7 +107,7 @@ pub fn maybe_print_constraints_for<'a, 'tcx>( } } -struct ConstraintGraph<'a, 'tcx: 'a> { +struct ConstraintGraph<'a, 'tcx> { graph_name: String, region_rels: &'a RegionRelations<'a, 'tcx>, map: &'a BTreeMap, SubregionOrigin<'tcx>>, diff --git a/src/librustc/infer/lexical_region_resolve/mod.rs b/src/librustc/infer/lexical_region_resolve/mod.rs index 16f5a9d3b36c4..2613f4c7c2ae3 100644 --- a/src/librustc/infer/lexical_region_resolve/mod.rs +++ b/src/librustc/infer/lexical_region_resolve/mod.rs @@ -93,7 +93,7 @@ struct RegionAndOrigin<'tcx> { type RegionGraph<'tcx> = Graph<(), Constraint<'tcx>>; -struct LexicalResolver<'cx, 'tcx: 'cx> { +struct LexicalResolver<'cx, 'tcx> { region_rels: &'cx RegionRelations<'cx, 'tcx>, var_infos: VarInfos, data: RegionConstraintData<'tcx>, diff --git a/src/librustc/infer/lub.rs b/src/librustc/infer/lub.rs index 2a9f5856eb855..156288b9e6afd 100644 --- a/src/librustc/infer/lub.rs +++ b/src/librustc/infer/lub.rs @@ -8,7 +8,7 @@ use crate::ty::{self, Ty, TyCtxt}; use crate::ty::relate::{Relate, RelateResult, TypeRelation}; /// "Least upper bound" (common supertype) -pub struct Lub<'combine, 'infcx: 'combine, 'tcx: 'infcx> { +pub struct Lub<'combine, 'infcx, 'tcx> { fields: &'combine mut CombineFields<'infcx, 'tcx>, a_is_expected: bool, } diff --git a/src/librustc/infer/mod.rs b/src/librustc/infer/mod.rs index 47a276b2bcc57..fc46fe383c972 100644 --- a/src/librustc/infer/mod.rs +++ b/src/librustc/infer/mod.rs @@ -585,7 +585,7 @@ impl<'tcx> InferOk<'tcx, ()> { } #[must_use = "once you start a snapshot, you should always consume it"] -pub struct CombinedSnapshot<'a, 'tcx: 'a> { +pub struct CombinedSnapshot<'a, 'tcx> { projection_cache_snapshot: traits::ProjectionCacheSnapshot, type_snapshot: type_variable::Snapshot<'tcx>, const_snapshot: ut::Snapshot>>, diff --git a/src/librustc/infer/nll_relate/mod.rs b/src/librustc/infer/nll_relate/mod.rs index 2c821d0ae15c1..21489965b1bf6 100644 --- a/src/librustc/infer/nll_relate/mod.rs +++ b/src/librustc/infer/nll_relate/mod.rs @@ -38,7 +38,7 @@ pub enum NormalizationStrategy { Eager, } -pub struct TypeRelating<'me, 'tcx: 'me, D> +pub struct TypeRelating<'me, 'tcx, D> where D: TypeRelatingDelegate<'tcx>, { @@ -741,7 +741,7 @@ where /// binder depth, and finds late-bound regions targeting the /// `for<..`>. For each of those, it creates an entry in /// `bound_region_scope`. -struct ScopeInstantiator<'me, 'tcx: 'me> { +struct ScopeInstantiator<'me, 'tcx> { next_region: &'me mut dyn FnMut(ty::BoundRegion) -> ty::Region<'tcx>, // The debruijn index of the scope we are instantiating. target_index: ty::DebruijnIndex, @@ -798,7 +798,7 @@ impl<'me, 'tcx> TypeVisitor<'tcx> for ScopeInstantiator<'me, 'tcx> { /// scopes. /// /// [blog post]: https://is.gd/0hKvIr -struct TypeGeneralizer<'me, 'tcx: 'me, D> +struct TypeGeneralizer<'me, 'tcx, D> where D: TypeRelatingDelegate<'tcx> + 'me, { diff --git a/src/librustc/infer/opaque_types/mod.rs b/src/librustc/infer/opaque_types/mod.rs index 328ace51a5828..c164f5446fd8c 100644 --- a/src/librustc/infer/opaque_types/mod.rs +++ b/src/librustc/infer/opaque_types/mod.rs @@ -723,7 +723,7 @@ impl TypeFolder<'tcx> for ReverseMapper<'tcx> { } } -struct Instantiator<'a, 'tcx: 'a> { +struct Instantiator<'a, 'tcx> { infcx: &'a InferCtxt<'a, 'tcx>, parent_def_id: DefId, body_id: hir::HirId, diff --git a/src/librustc/infer/outlives/env.rs b/src/librustc/infer/outlives/env.rs index 4b5df444148be..d555886128598 100644 --- a/src/librustc/infer/outlives/env.rs +++ b/src/librustc/infer/outlives/env.rs @@ -67,7 +67,7 @@ pub struct OutlivesEnvironment<'tcx> { /// because of implied bounds. pub type RegionBoundPairs<'tcx> = Vec<(ty::Region<'tcx>, GenericKind<'tcx>)>; -impl<'a, 'tcx: 'a> OutlivesEnvironment<'tcx> { +impl<'a, 'tcx> OutlivesEnvironment<'tcx> { pub fn new(param_env: ty::ParamEnv<'tcx>) -> Self { let mut env = OutlivesEnvironment { param_env, diff --git a/src/librustc/infer/outlives/obligations.rs b/src/librustc/infer/outlives/obligations.rs index 671718b1008e2..0ae4446ee63fa 100644 --- a/src/librustc/infer/outlives/obligations.rs +++ b/src/librustc/infer/outlives/obligations.rs @@ -226,7 +226,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> { /// via a "delegate" of type `D` -- this is usually the `infcx`, which /// accrues them into the `region_obligations` code, but for NLL we /// use something else. -pub struct TypeOutlives<'cx, 'tcx: 'cx, D> +pub struct TypeOutlives<'cx, 'tcx, D> where D: TypeOutlivesDelegate<'tcx>, { diff --git a/src/librustc/infer/outlives/verify.rs b/src/librustc/infer/outlives/verify.rs index 96335e1052ee3..f23e52fcfe499 100644 --- a/src/librustc/infer/outlives/verify.rs +++ b/src/librustc/infer/outlives/verify.rs @@ -12,7 +12,7 @@ use crate::util::captures::Captures; /// via a "delegate" of type `D` -- this is usually the `infcx`, which /// accrues them into the `region_obligations` code, but for NLL we /// use something else. -pub struct VerifyBoundCx<'cx, 'tcx: 'cx> { +pub struct VerifyBoundCx<'cx, 'tcx> { tcx: TyCtxt<'tcx>, region_bound_pairs: &'cx RegionBoundPairs<'tcx>, implicit_region_bound: Option>, diff --git a/src/librustc/infer/resolve.rs b/src/librustc/infer/resolve.rs index 810c64185a71d..7e553d7666b22 100644 --- a/src/librustc/infer/resolve.rs +++ b/src/librustc/infer/resolve.rs @@ -12,7 +12,7 @@ use crate::ty::fold::{TypeFolder, TypeVisitor}; /// been unified with (similar to `shallow_resolve`, but deep). This is /// useful for printing messages etc but also required at various /// points for correctness. -pub struct OpportunisticVarResolver<'a, 'tcx: 'a> { +pub struct OpportunisticVarResolver<'a, 'tcx> { infcx: &'a InferCtxt<'a, 'tcx>, } @@ -50,7 +50,7 @@ impl<'a, 'tcx> TypeFolder<'tcx> for OpportunisticVarResolver<'a, 'tcx> { /// The opportunistic type and region resolver is similar to the /// opportunistic type resolver, but also opportunistically resolves /// regions. It is useful for canonicalization. -pub struct OpportunisticTypeAndRegionResolver<'a, 'tcx: 'a> { +pub struct OpportunisticTypeAndRegionResolver<'a, 'tcx> { infcx: &'a InferCtxt<'a, 'tcx>, } @@ -101,7 +101,7 @@ impl<'a, 'tcx> TypeFolder<'tcx> for OpportunisticTypeAndRegionResolver<'a, 'tcx> /// type variables that don't yet have a value. The first unresolved type is stored. /// It does not construct the fully resolved type (which might /// involve some hashing and so forth). -pub struct UnresolvedTypeFinder<'a, 'tcx: 'a> { +pub struct UnresolvedTypeFinder<'a, 'tcx> { infcx: &'a InferCtxt<'a, 'tcx>, /// Used to find the type parameter name and location for error reporting. @@ -171,7 +171,7 @@ where // N.B. This type is not public because the protocol around checking the // `err` field is not enforcable otherwise. -struct FullTypeResolver<'a, 'tcx: 'a> { +struct FullTypeResolver<'a, 'tcx> { infcx: &'a InferCtxt<'a, 'tcx>, err: Option>, } diff --git a/src/librustc/infer/sub.rs b/src/librustc/infer/sub.rs index ed84e3f63ae1b..1452a6dee5bc1 100644 --- a/src/librustc/infer/sub.rs +++ b/src/librustc/infer/sub.rs @@ -11,7 +11,7 @@ use crate::mir::interpret::ConstValue; use std::mem; /// Ensures `a` is made a subtype of `b`. Returns `a` on success. -pub struct Sub<'combine, 'infcx: 'combine, 'tcx: 'infcx> { +pub struct Sub<'combine, 'infcx, 'tcx> { fields: &'combine mut CombineFields<'infcx, 'tcx>, a_is_expected: bool, } diff --git a/src/librustc/lint/context.rs b/src/librustc/lint/context.rs index e90f4ca94c625..7f09120bbdd5e 100644 --- a/src/librustc/lint/context.rs +++ b/src/librustc/lint/context.rs @@ -507,7 +507,7 @@ impl LintStore { } /// Context for lint checking after type checking. -pub struct LateContext<'a, 'tcx: 'a> { +pub struct LateContext<'a, 'tcx> { /// Type context we're checking in. pub tcx: TyCtxt<'tcx>, @@ -533,7 +533,7 @@ pub struct LateContext<'a, 'tcx: 'a> { only_module: bool, } -pub struct LateContextAndPass<'a, 'tcx: 'a, T: LateLintPass<'a, 'tcx>> { +pub struct LateContextAndPass<'a, 'tcx, T: LateLintPass<'a, 'tcx>> { context: LateContext<'a, 'tcx>, pass: T, } diff --git a/src/librustc/middle/dead.rs b/src/librustc/middle/dead.rs index 63503f58156bc..9e2038fa89ed0 100644 --- a/src/librustc/middle/dead.rs +++ b/src/librustc/middle/dead.rs @@ -38,7 +38,7 @@ fn should_explore<'tcx>(tcx: TyCtxt<'tcx>, hir_id: hir::HirId) -> bool { } } -struct MarkSymbolVisitor<'a, 'tcx: 'a> { +struct MarkSymbolVisitor<'a, 'tcx> { worklist: Vec, tcx: TyCtxt<'tcx>, tables: &'a ty::TypeckTables<'tcx>, @@ -351,7 +351,7 @@ fn has_allow_dead_code_or_lang_attr( // or // 2) We are not sure to be live or not // * Implementation of a trait method -struct LifeSeeder<'k, 'tcx: 'k> { +struct LifeSeeder<'k, 'tcx> { worklist: Vec, krate: &'k hir::Crate, tcx: TyCtxt<'tcx>, diff --git a/src/librustc/middle/entry.rs b/src/librustc/middle/entry.rs index d9e7caebb9829..d1867e8fa36b2 100644 --- a/src/librustc/middle/entry.rs +++ b/src/librustc/middle/entry.rs @@ -11,7 +11,7 @@ use crate::hir::itemlikevisit::ItemLikeVisitor; use crate::ty::TyCtxt; use crate::ty::query::Providers; -struct EntryContext<'a, 'tcx: 'a> { +struct EntryContext<'a, 'tcx> { session: &'a Session, map: &'a hir_map::Map<'tcx>, diff --git a/src/librustc/middle/expr_use_visitor.rs b/src/librustc/middle/expr_use_visitor.rs index 61770e6f48705..1c3eead90fa99 100644 --- a/src/librustc/middle/expr_use_visitor.rs +++ b/src/librustc/middle/expr_use_visitor.rs @@ -229,7 +229,7 @@ impl OverloadedCallType { // The ExprUseVisitor type // // This is the code that actually walks the tree. -pub struct ExprUseVisitor<'a, 'tcx: 'a> { +pub struct ExprUseVisitor<'a, 'tcx> { mc: mc::MemCategorizationContext<'a, 'tcx>, delegate: &'a mut dyn Delegate<'tcx>, param_env: ty::ParamEnv<'tcx>, diff --git a/src/librustc/middle/free_region.rs b/src/librustc/middle/free_region.rs index a8a7df08469aa..60e41f7eb0f7b 100644 --- a/src/librustc/middle/free_region.rs +++ b/src/librustc/middle/free_region.rs @@ -15,7 +15,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, 'tcx: 'a> { +pub struct RegionRelations<'a, 'tcx> { pub tcx: TyCtxt<'tcx>, /// The context used to fetch the region maps. diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs index 3d2bc6c7bf882..36411f81f1a29 100644 --- a/src/librustc/middle/liveness.rs +++ b/src/librustc/middle/liveness.rs @@ -352,7 +352,7 @@ impl IrMaps<'tcx> { } } -fn visit_fn<'a, 'tcx: 'a>( +fn visit_fn<'a, 'tcx>( ir: &mut IrMaps<'tcx>, fk: FnKind<'tcx>, decl: &'tcx hir::FnDecl, @@ -682,7 +682,7 @@ const ACC_READ: u32 = 1; const ACC_WRITE: u32 = 2; const ACC_USE: u32 = 4; -struct Liveness<'a, 'tcx: 'a> { +struct Liveness<'a, 'tcx> { ir: &'a mut IrMaps<'tcx>, tables: &'a ty::TypeckTables<'tcx>, s: Specials, diff --git a/src/librustc/middle/reachable.rs b/src/librustc/middle/reachable.rs index 628a44cbfe01f..593c5e7342168 100644 --- a/src/librustc/middle/reachable.rs +++ b/src/librustc/middle/reachable.rs @@ -65,7 +65,7 @@ fn method_might_be_inlined<'tcx>( } // Information needed while computing reachability. -struct ReachableContext<'a, 'tcx: 'a> { +struct ReachableContext<'a, 'tcx> { // The type context. tcx: TyCtxt<'tcx>, tables: &'a ty::TypeckTables<'tcx>, @@ -334,13 +334,13 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> { // items of non-exported traits (or maybe all local traits?) unless their respective // 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> { +struct CollectPrivateImplItemsVisitor<'a, 'tcx> { tcx: TyCtxt<'tcx>, access_levels: &'a privacy::AccessLevels, worklist: &'a mut Vec, } -impl<'a, 'tcx: 'a> ItemLikeVisitor<'tcx> for CollectPrivateImplItemsVisitor<'a, 'tcx> { +impl<'a, 'tcx> ItemLikeVisitor<'tcx> for CollectPrivateImplItemsVisitor<'a, 'tcx> { fn visit_item(&mut self, item: &hir::Item) { // Anything which has custom linkage gets thrown on the worklist no // matter where it is in the crate, along with "special std symbols" diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs index 76bff500634a9..f68e18c2bb85b 100644 --- a/src/librustc/middle/resolve_lifetime.rs +++ b/src/librustc/middle/resolve_lifetime.rs @@ -217,7 +217,7 @@ impl_stable_hash_for!(struct crate::middle::resolve_lifetime::ResolveLifetimes { object_lifetime_defaults }); -struct LifetimeContext<'a, 'tcx: 'a> { +struct LifetimeContext<'a, 'tcx> { tcx: TyCtxt<'tcx>, map: &'a mut NamedRegionMap, scope: ScopeRef<'a>, @@ -1160,7 +1160,7 @@ fn signal_shadowing_problem(tcx: TyCtxt<'_>, name: ast::Name, orig: Original, sh // Adds all labels in `b` to `ctxt.labels_in_fn`, signalling a warning // 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> { + struct GatherLabels<'a, 'tcx> { tcx: TyCtxt<'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 19d127a565fc3..5a1e5212f8657 100644 --- a/src/librustc/middle/stability.rs +++ b/src/librustc/middle/stability.rs @@ -105,7 +105,7 @@ impl_stable_hash_for!(struct self::Index<'tcx> { }); // A private tree-walker for producing an Index. -struct Annotator<'a, 'tcx: 'a> { +struct Annotator<'a, 'tcx> { tcx: TyCtxt<'tcx>, index: &'a mut Index<'tcx>, parent_stab: Option<&'tcx Stability>, @@ -113,7 +113,7 @@ struct Annotator<'a, 'tcx: 'a> { in_trait_impl: bool, } -impl<'a, 'tcx: 'a> Annotator<'a, 'tcx> { +impl<'a, 'tcx> Annotator<'a, 'tcx> { // Determine the stability for a node based on its attributes and inherited // stability. The stability is recorded in the index and used as the parent. fn annotate(&mut self, hir_id: HirId, attrs: &[Attribute], @@ -316,12 +316,12 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> { } } -struct MissingStabilityAnnotations<'a, 'tcx: 'a> { +struct MissingStabilityAnnotations<'a, 'tcx> { tcx: TyCtxt<'tcx>, access_levels: &'a AccessLevels, } -impl<'a, 'tcx: 'a> MissingStabilityAnnotations<'a, 'tcx> { +impl<'a, 'tcx> MissingStabilityAnnotations<'a, 'tcx> { fn check_missing_stability(&self, hir_id: HirId, span: Span, name: &str) { let stab = self.tcx.stability().local_stability(hir_id); let is_error = !self.tcx.sess.opts.test && diff --git a/src/librustc/middle/weak_lang_items.rs b/src/librustc/middle/weak_lang_items.rs index 422ff3f2fd366..b6cd24c291ac7 100644 --- a/src/librustc/middle/weak_lang_items.rs +++ b/src/librustc/middle/weak_lang_items.rs @@ -17,7 +17,7 @@ use crate::ty::TyCtxt; macro_rules! weak_lang_items { ($($name:ident, $item:ident, $sym:ident;)*) => ( -struct Context<'a, 'tcx: 'a> { +struct Context<'a, 'tcx> { tcx: TyCtxt<'tcx>, items: &'a mut lang_items::LanguageItems, } diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs index 1d5c1cb927d28..9dfd8d959a3c4 100644 --- a/src/librustc/mir/mod.rs +++ b/src/librustc/mir/mod.rs @@ -2104,7 +2104,7 @@ impl<'tcx> Place<'tcx> { /// N.B., this particular impl strategy is not the most obvious. It was /// chosen because it makes a measurable difference to NLL /// performance, as this code (`borrow_conflicts_with_place`) is somewhat hot. -pub enum Projections<'p, 'tcx: 'p> { +pub enum Projections<'p, 'tcx> { Empty, List { @@ -2143,7 +2143,7 @@ impl<'p, 'tcx> IntoIterator for &'p Projections<'p, 'tcx> { /// N.B., this is not a *true* Rust iterator -- the code above just /// manually invokes `next`. This is because we (sometimes) want to /// keep executing even after `None` has been returned. -pub struct ProjectionsIter<'p, 'tcx: 'p> { +pub struct ProjectionsIter<'p, 'tcx> { pub value: &'p Projections<'p, 'tcx>, } diff --git a/src/librustc/mir/traversal.rs b/src/librustc/mir/traversal.rs index 77af0e6661b73..1416a5f0a6e9f 100644 --- a/src/librustc/mir/traversal.rs +++ b/src/librustc/mir/traversal.rs @@ -20,7 +20,7 @@ use super::*; /// /// A preorder traversal of this graph is either `A B D C` or `A C D B` #[derive(Clone)] -pub struct Preorder<'a, 'tcx: 'a> { +pub struct Preorder<'a, 'tcx> { body: &'a Body<'tcx>, visited: BitSet, worklist: Vec, @@ -98,7 +98,7 @@ impl<'a, 'tcx> Iterator for Preorder<'a, 'tcx> { /// ``` /// /// A Postorder traversal of this graph is `D B C A` or `D C B A` -pub struct Postorder<'a, 'tcx: 'a> { +pub struct Postorder<'a, 'tcx> { body: &'a Body<'tcx>, visited: BitSet, visit_stack: Vec<(BasicBlock, Successors<'a>)>, @@ -251,7 +251,7 @@ impl<'a, 'tcx> Iterator for Postorder<'a, 'tcx> { /// constructed as few times as possible. Use the `reset` method to be able /// to re-use the traversal #[derive(Clone)] -pub struct ReversePostorder<'a, 'tcx: 'a> { +pub struct ReversePostorder<'a, 'tcx> { body: &'a Body<'tcx>, blocks: Vec, idx: usize diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs index dcf69fee0e16d..4b65d3b9d8e3a 100644 --- a/src/librustc/traits/error_reporting.rs +++ b/src/librustc/traits/error_reporting.rs @@ -1449,7 +1449,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { param_env: ty::ParamEnv<'tcx>, pred: ty::PolyTraitRef<'tcx>, ) -> bool { - struct ParamToVarFolder<'a, 'tcx: 'a> { + struct ParamToVarFolder<'a, 'tcx> { infcx: &'a InferCtxt<'a, 'tcx>, var_map: FxHashMap, Ty<'tcx>>, } diff --git a/src/librustc/traits/fulfill.rs b/src/librustc/traits/fulfill.rs index 5e2c949c7d8d6..f106458c7676a 100644 --- a/src/librustc/traits/fulfill.rs +++ b/src/librustc/traits/fulfill.rs @@ -224,7 +224,7 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentContext<'tcx> { } } -struct FulfillProcessor<'a, 'b: 'a, 'tcx: 'b> { +struct FulfillProcessor<'a, 'b, 'tcx> { selcx: &'a mut SelectionContext<'b, 'tcx>, register_region_obligations: bool, } diff --git a/src/librustc/traits/project.rs b/src/librustc/traits/project.rs index d189bb231163e..04364cd631193 100644 --- a/src/librustc/traits/project.rs +++ b/src/librustc/traits/project.rs @@ -285,7 +285,7 @@ where } } -struct AssocTypeNormalizer<'a, 'b: 'a, 'tcx: 'b> { +struct AssocTypeNormalizer<'a, 'b, 'tcx> { selcx: &'a mut SelectionContext<'b, 'tcx>, param_env: ty::ParamEnv<'tcx>, cause: ObligationCause<'tcx>, diff --git a/src/librustc/traits/query/normalize.rs b/src/librustc/traits/query/normalize.rs index 50476721e8247..a45213b06d3a0 100644 --- a/src/librustc/traits/query/normalize.rs +++ b/src/librustc/traits/query/normalize.rs @@ -73,7 +73,7 @@ pub struct NormalizationResult<'tcx> { pub normalized_ty: Ty<'tcx>, } -struct QueryNormalizer<'cx, 'tcx: 'cx> { +struct QueryNormalizer<'cx, 'tcx> { infcx: &'cx InferCtxt<'cx, 'tcx>, cause: &'cx ObligationCause<'tcx>, param_env: ty::ParamEnv<'tcx>, diff --git a/src/librustc/traits/select.rs b/src/librustc/traits/select.rs index 5aa7a120957cf..c698b0c293314 100644 --- a/src/librustc/traits/select.rs +++ b/src/librustc/traits/select.rs @@ -50,7 +50,7 @@ use std::iter; use std::rc::Rc; use crate::util::nodemap::{FxHashMap, FxHashSet}; -pub struct SelectionContext<'cx, 'tcx: 'cx> { +pub struct SelectionContext<'cx, 'tcx> { infcx: &'cx InferCtxt<'cx, 'tcx>, /// Freshener used specifically for entries on the obligation @@ -144,7 +144,7 @@ impl IntercrateAmbiguityCause { } // A stack that walks back up the stack frame. -struct TraitObligationStack<'prev, 'tcx: 'prev> { +struct TraitObligationStack<'prev, 'tcx> { obligation: &'prev TraitObligation<'tcx>, /// Trait ref from `obligation` but "freshened" with the @@ -697,7 +697,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { ) -> Result where I: IntoIterator>, - 'tcx: 'a, + 'tcx, { let mut result = EvaluatedToOk; for obligation in predicates { @@ -3789,7 +3789,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { matcher.relate(previous, current).is_ok() } - fn push_stack<'o, 's: 'o>( + fn push_stack<'o, 's>( &mut self, previous_stack: TraitObligationStackList<'s, 'tcx>, obligation: &'o TraitObligation<'tcx>, @@ -4252,7 +4252,7 @@ impl<'tcx> ProvisionalEvaluationCache<'tcx> { } #[derive(Copy, Clone)] -struct TraitObligationStackList<'o, 'tcx: 'o> { +struct TraitObligationStackList<'o, 'tcx> { cache: &'o ProvisionalEvaluationCache<'tcx>, head: Option<&'o TraitObligationStack<'o, 'tcx>>, } diff --git a/src/librustc/ty/query/on_disk_cache.rs b/src/librustc/ty/query/on_disk_cache.rs index 6f83991a2daa2..5781f40b93ad3 100644 --- a/src/librustc/ty/query/on_disk_cache.rs +++ b/src/librustc/ty/query/on_disk_cache.rs @@ -511,7 +511,7 @@ fn decode_tagged<'a, 'tcx, D, T, V>(decoder: &mut D, where T: Decodable + Eq + ::std::fmt::Debug, V: Decodable, D: DecoderWithPosition, - 'tcx: 'a, + 'tcx, { let start_pos = decoder.position(); diff --git a/src/librustc/ty/query/plumbing.rs b/src/librustc/ty/query/plumbing.rs index 48e68167f824c..0f158d2982a20 100644 --- a/src/librustc/ty/query/plumbing.rs +++ b/src/librustc/ty/query/plumbing.rs @@ -89,7 +89,7 @@ macro_rules! profq_query_msg { /// A type representing the responsibility to execute the job in the `job` field. /// This will poison the relevant query if dropped. -pub(super) struct JobOwner<'a, 'tcx: 'a, Q: QueryDescription<'tcx> + 'a> { +pub(super) struct JobOwner<'a, 'tcx, Q: QueryDescription<'tcx> + 'a> { cache: &'a Lock>, key: Q::Key, job: Lrc>, @@ -230,7 +230,7 @@ pub struct CycleError<'tcx> { } /// The result of `try_get_lock` -pub(super) enum TryGetJob<'a, 'tcx: 'a, D: QueryDescription<'tcx> + 'a> { +pub(super) enum TryGetJob<'a, 'tcx, D: QueryDescription<'tcx> + 'a> { /// The query is not yet started. Contains a guard to the cache eventually used to start it. NotYetStarted(JobOwner<'a, 'tcx, D>), diff --git a/src/librustc/ty/wf.rs b/src/librustc/ty/wf.rs index 6b2f00e5f703f..1979b4317a7ae 100644 --- a/src/librustc/ty/wf.rs +++ b/src/librustc/ty/wf.rs @@ -101,7 +101,7 @@ pub fn predicate_obligations<'a, 'tcx>( wf.normalize() } -struct WfPredicates<'a, 'tcx: 'a> { +struct WfPredicates<'a, 'tcx> { infcx: &'a InferCtxt<'a, 'tcx>, param_env: ty::ParamEnv<'tcx>, body_id: hir::HirId, diff --git a/src/librustc_borrowck/borrowck/check_loans.rs b/src/librustc_borrowck/borrowck/check_loans.rs index 54989db46c1c5..ace44421d3757 100644 --- a/src/librustc_borrowck/borrowck/check_loans.rs +++ b/src/librustc_borrowck/borrowck/check_loans.rs @@ -78,7 +78,7 @@ fn owned_ptr_base_path_rc<'tcx>(loan_path: &Rc>) -> Rc { +struct CheckLoanCtxt<'a, 'tcx> { bccx: &'a BorrowckCtxt<'a, 'tcx>, dfcx_loans: &'a LoanDataFlow<'tcx>, move_data: &'a move_data::FlowedMoveData<'tcx>, diff --git a/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs b/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs index 4d03b58179db0..cc1f7232e04c1 100644 --- a/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs +++ b/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs @@ -16,7 +16,7 @@ use rustc::hir::*; use rustc::hir::Node; use log::debug; -struct GatherMoveInfo<'c, 'tcx: 'c> { +struct GatherMoveInfo<'c, 'tcx> { id: hir::ItemLocalId, kind: MoveKind, cmt: &'c mc::cmt_<'tcx>, @@ -91,7 +91,7 @@ pub fn gather_move_from_expr<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, gather_move(bccx, move_data, move_error_collector, move_info); } -pub fn gather_move_from_pat<'a, 'c, 'tcx: 'c>(bccx: &BorrowckCtxt<'a, 'tcx>, +pub fn gather_move_from_pat<'a, 'c, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, move_data: &MoveData<'tcx>, move_error_collector: &mut MoveErrorCollector<'tcx>, move_pat: &hir::Pat, @@ -121,7 +121,7 @@ pub fn gather_move_from_pat<'a, 'c, 'tcx: 'c>(bccx: &BorrowckCtxt<'a, 'tcx>, gather_move(bccx, move_data, move_error_collector, move_info); } -fn gather_move<'a, 'c, 'tcx: 'c>(bccx: &BorrowckCtxt<'a, 'tcx>, +fn gather_move<'a, 'c, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, move_data: &MoveData<'tcx>, move_error_collector: &mut MoveErrorCollector<'tcx>, move_info: GatherMoveInfo<'c, 'tcx>) { diff --git a/src/librustc_borrowck/borrowck/gather_loans/lifetime.rs b/src/librustc_borrowck/borrowck/gather_loans/lifetime.rs index 1607a62920109..3122a6060fbde 100644 --- a/src/librustc_borrowck/borrowck/gather_loans/lifetime.rs +++ b/src/librustc_borrowck/borrowck/gather_loans/lifetime.rs @@ -38,7 +38,7 @@ pub fn guarantee_lifetime<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, /////////////////////////////////////////////////////////////////////////// // Private -struct GuaranteeLifetimeContext<'a, 'tcx: 'a> { +struct GuaranteeLifetimeContext<'a, 'tcx> { bccx: &'a BorrowckCtxt<'a, 'tcx>, // the scope of the function body for the enclosing item diff --git a/src/librustc_borrowck/borrowck/gather_loans/mod.rs b/src/librustc_borrowck/borrowck/gather_loans/mod.rs index b1854a06693cc..887011d3476d3 100644 --- a/src/librustc_borrowck/borrowck/gather_loans/mod.rs +++ b/src/librustc_borrowck/borrowck/gather_loans/mod.rs @@ -56,7 +56,7 @@ pub fn gather_loans_in_fn<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, (all_loans, move_data) } -struct GatherLoanCtxt<'a, 'tcx: 'a> { +struct GatherLoanCtxt<'a, 'tcx> { bccx: &'a BorrowckCtxt<'a, 'tcx>, move_data: move_data::MoveData<'tcx>, move_error_collector: move_error::MoveErrorCollector<'tcx>, diff --git a/src/librustc_borrowck/borrowck/gather_loans/restrictions.rs b/src/librustc_borrowck/borrowck/gather_loans/restrictions.rs index 9f4c05a6b255f..371e6c55a7389 100644 --- a/src/librustc_borrowck/borrowck/gather_loans/restrictions.rs +++ b/src/librustc_borrowck/borrowck/gather_loans/restrictions.rs @@ -37,7 +37,7 @@ pub fn compute_restrictions<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, /////////////////////////////////////////////////////////////////////////// // Private -struct RestrictionsContext<'a, 'tcx: 'a> { +struct RestrictionsContext<'a, 'tcx> { bccx: &'a BorrowckCtxt<'a, 'tcx>, span: Span, loan_region: ty::Region<'tcx>, diff --git a/src/librustc_borrowck/borrowck/mod.rs b/src/librustc_borrowck/borrowck/mod.rs index 93cea6d2f019f..025d5adc2b3ea 100644 --- a/src/librustc_borrowck/borrowck/mod.rs +++ b/src/librustc_borrowck/borrowck/mod.rs @@ -552,7 +552,7 @@ pub enum bckerr_code<'tcx> { // Combination of an error code and the categorization of the expression // that caused it #[derive(Debug, PartialEq)] -pub struct BckError<'c, 'tcx: 'c> { +pub struct BckError<'c, 'tcx> { span: Span, cause: AliasableViolationKind, cmt: &'c mc::cmt_<'tcx>, diff --git a/src/librustc_borrowck/graphviz.rs b/src/librustc_borrowck/graphviz.rs index 1f2480666959e..7a8a23ca76afc 100644 --- a/src/librustc_borrowck/graphviz.rs +++ b/src/librustc_borrowck/graphviz.rs @@ -30,7 +30,7 @@ impl Variant { } } -pub struct DataflowLabeller<'a, 'tcx: 'a> { +pub struct DataflowLabeller<'a, 'tcx> { pub inner: cfg_dot::LabelledCFG<'a, 'tcx>, pub variants: Vec, pub borrowck_ctxt: &'a BorrowckCtxt<'a, 'tcx>, diff --git a/src/librustc_codegen_llvm/builder.rs b/src/librustc_codegen_llvm/builder.rs index 9102ba91df816..e06b4d8b3063e 100644 --- a/src/librustc_codegen_llvm/builder.rs +++ b/src/librustc_codegen_llvm/builder.rs @@ -27,7 +27,7 @@ use std::iter::TrustedLen; // All Builders must have an llfn associated with them #[must_use] -pub struct Builder<'a, 'll: 'a, 'tcx: 'll> { +pub struct Builder<'a, 'll, 'tcx> { pub llbuilder: &'ll mut llvm::Builder<'ll>, pub cx: &'a CodegenCx<'ll, 'tcx>, } diff --git a/src/librustc_codegen_llvm/context.rs b/src/librustc_codegen_llvm/context.rs index 588f7481cc060..6a61b180de430 100644 --- a/src/librustc_codegen_llvm/context.rs +++ b/src/librustc_codegen_llvm/context.rs @@ -34,7 +34,7 @@ use crate::abi::Abi; /// There is one `CodegenCx` per compilation unit. Each one has its own LLVM /// `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 struct CodegenCx<'ll, 'tcx> { pub tcx: TyCtxt<'tcx>, pub check_overflow: bool, pub use_dll_storage_attrs: bool, diff --git a/src/librustc_codegen_llvm/lib.rs b/src/librustc_codegen_llvm/lib.rs index a0dd767a3a8ff..a8a998a4d9564 100644 --- a/src/librustc_codegen_llvm/lib.rs +++ b/src/librustc_codegen_llvm/lib.rs @@ -125,7 +125,7 @@ impl ExtraBackendMethods for LlvmCodegenBackend { ) { unsafe { allocator::codegen(tcx, mods, kind) } } - fn compile_codegen_unit<'a, 'tcx: 'a>(&self, tcx: TyCtxt<'tcx>, cgu_name: InternedString) { + fn compile_codegen_unit<'a, 'tcx>(&self, tcx: TyCtxt<'tcx>, cgu_name: InternedString) { base::compile_codegen_unit(tcx, cgu_name); } fn target_machine_factory( diff --git a/src/librustc_codegen_ssa/README.md b/src/librustc_codegen_ssa/README.md index 11fac239edf12..c8bb2e7ee9965 100644 --- a/src/librustc_codegen_ssa/README.md +++ b/src/librustc_codegen_ssa/README.md @@ -29,11 +29,11 @@ While the LLVM-specific code will be left in `rustc_codegen_llvm`, all the new t The two most important structures for the LLVM codegen are `CodegenCx` and `Builder`. They are parametrized by multiple lifetime parameters and the type for `Value`. ```rust -struct CodegenCx<'ll, 'tcx: 'll> { +struct CodegenCx<'ll, 'tcx> { /* ... */ } -struct Builder<'a, 'll: 'a, 'tcx: 'll> { +struct Builder<'a, 'll, 'tcx> { cx: &'a CodegenCx<'ll, 'tcx>, /* ... */ } @@ -49,7 +49,7 @@ The code in `rustc_codegen_llvm` has to deal with multiple explicit lifetime par Although there are already many lifetime parameters in the code, making it generic uncovered situations where the borrow-checker was passing only due to the special nature of the LLVM objects manipulated (they are extern pointers). For instance, a additional lifetime parameter had to be added to `LocalAnalyser` in `analyse.rs`, leading to the definition: ```rust -struct LocalAnalyzer<'mir, 'a: 'mir, 'tcx: 'a> { +struct LocalAnalyzer<'mir, 'a, 'tcx> { /* ... */ } ``` @@ -61,7 +61,7 @@ However, the two most important structures `CodegenCx` and `Builder` are not def Because they have to be defined by the backend, `CodegenCx` and `Builder` will be the structures implementing all the traits defining the backend's interface. These traits are defined in the folder `rustc_codegen_ssa/traits` and all the backend-agnostic code is parametrized by them. For instance, let us explain how a function in `base.rs` is parametrized: ```rust -pub fn codegen_instance<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( +pub fn codegen_instance<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( cx: &'a Bx::CodegenCx, instance: Instance<'tcx> ) { @@ -74,7 +74,7 @@ In this signature, we have the two lifetime parameters explained earlier and the On the trait side, here is an example with part of the definition of `BuilderMethods` in `traits/builder.rs`: ```rust -pub trait BuilderMethods<'a, 'tcx: 'a>: +pub trait BuilderMethods<'a, 'tcx>: HasCodegen<'tcx> + DebugInfoBuilderMethods<'tcx> + ArgTypeMethods<'tcx> diff --git a/src/librustc_codegen_ssa/base.rs b/src/librustc_codegen_ssa/base.rs index ca686453b6d4e..a06f324d3895d 100644 --- a/src/librustc_codegen_ssa/base.rs +++ b/src/librustc_codegen_ssa/base.rs @@ -88,7 +88,7 @@ pub fn bin_op_to_fcmp_predicate(op: hir::BinOpKind) -> RealPredicate { } } -pub fn compare_simd_types<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( +pub fn compare_simd_types<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( bx: &mut Bx, lhs: Bx::Value, rhs: Bx::Value, @@ -152,7 +152,7 @@ pub fn unsized_info<'tcx, Cx: CodegenMethods<'tcx>>( } /// Coerce `src` to `dst_ty`. `src_ty` must be a thin pointer. -pub fn unsize_thin_ptr<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( +pub fn unsize_thin_ptr<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( bx: &mut Bx, src: Bx::Value, src_ty: Ty<'tcx>, @@ -207,7 +207,7 @@ pub fn unsize_thin_ptr<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( /// Coerce `src`, which is a reference to a value of type `src_ty`, /// to a value of type `dst_ty` and store the result in `dst` -pub fn coerce_unsized_into<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( +pub fn coerce_unsized_into<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( bx: &mut Bx, src: PlaceRef<'tcx, Bx::Value>, dst: PlaceRef<'tcx, Bx::Value> @@ -266,7 +266,7 @@ pub fn coerce_unsized_into<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( } } -pub fn cast_shift_expr_rhs<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( +pub fn cast_shift_expr_rhs<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( bx: &mut Bx, op: hir::BinOpKind, lhs: Bx::Value, @@ -275,7 +275,7 @@ pub fn cast_shift_expr_rhs<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( cast_shift_rhs(bx, op, lhs, rhs) } -fn cast_shift_rhs<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( +fn cast_shift_rhs<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( bx: &mut Bx, op: hir::BinOpKind, lhs: Bx::Value, @@ -316,7 +316,7 @@ pub fn wants_msvc_seh(sess: &Session) -> bool { sess.target.target.options.is_like_msvc } -pub fn from_immediate<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( +pub fn from_immediate<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( bx: &mut Bx, val: Bx::Value ) -> Bx::Value { @@ -327,7 +327,7 @@ pub fn from_immediate<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( } } -pub fn to_immediate<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( +pub fn to_immediate<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( bx: &mut Bx, val: Bx::Value, layout: layout::TyLayout<'_>, @@ -338,7 +338,7 @@ pub fn to_immediate<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( val } -pub fn to_immediate_scalar<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( +pub fn to_immediate_scalar<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( bx: &mut Bx, val: Bx::Value, scalar: &layout::Scalar, @@ -349,7 +349,7 @@ pub fn to_immediate_scalar<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( val } -pub fn memcpy_ty<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( +pub fn memcpy_ty<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( bx: &mut Bx, dst: Bx::Value, dst_align: Align, @@ -366,7 +366,7 @@ pub fn memcpy_ty<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( bx.memcpy(dst, dst_align, src, src_align, bx.cx().const_usize(size), flags); } -pub fn codegen_instance<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( +pub fn codegen_instance<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( cx: &'a Bx::CodegenCx, instance: Instance<'tcx>, ) { @@ -387,7 +387,7 @@ pub fn codegen_instance<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( /// Creates the `main` function which will initialize the rust runtime and call /// users main function. -pub fn maybe_create_entry_wrapper<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( +pub fn maybe_create_entry_wrapper<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( cx: &'a Bx::CodegenCx ) { let (main_def_id, span) = match cx.tcx().entry_fn(LOCAL_CRATE) { @@ -412,7 +412,7 @@ pub fn maybe_create_entry_wrapper<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( None => {} // Do nothing. } - fn create_entry_fn<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( + fn create_entry_fn<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( cx: &'a Bx::CodegenCx, sp: Span, rust_main: Bx::Value, diff --git a/src/librustc_codegen_ssa/common.rs b/src/librustc_codegen_ssa/common.rs index e22d4db6dcb9a..d17edf2ec0a2b 100644 --- a/src/librustc_codegen_ssa/common.rs +++ b/src/librustc_codegen_ssa/common.rs @@ -137,7 +137,7 @@ pub fn langcall(tcx: TyCtxt<'_>, span: Option, msg: &str, li: LangItem) -> // all shifts). For 32- and 64-bit types, this matches the semantics // of Java. (See related discussion on #1877 and #10183.) -pub fn build_unchecked_lshift<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( +pub fn build_unchecked_lshift<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( bx: &mut Bx, lhs: Bx::Value, rhs: Bx::Value @@ -148,7 +148,7 @@ pub fn build_unchecked_lshift<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( bx.shl(lhs, rhs) } -pub fn build_unchecked_rshift<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( +pub fn build_unchecked_rshift<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( bx: &mut Bx, lhs_t: Ty<'tcx>, lhs: Bx::Value, @@ -165,7 +165,7 @@ pub fn build_unchecked_rshift<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( } } -fn shift_mask_rhs<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( +fn shift_mask_rhs<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( bx: &mut Bx, rhs: Bx::Value ) -> Bx::Value { @@ -174,7 +174,7 @@ fn shift_mask_rhs<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( bx.and(rhs, shift_val) } -pub fn shift_mask_val<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( +pub fn shift_mask_val<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( bx: &mut Bx, llty: Bx::Type, mask_llty: Bx::Type, diff --git a/src/librustc_codegen_ssa/glue.rs b/src/librustc_codegen_ssa/glue.rs index e2b49de05bd11..294e2e021d2af 100644 --- a/src/librustc_codegen_ssa/glue.rs +++ b/src/librustc_codegen_ssa/glue.rs @@ -7,7 +7,7 @@ use crate::common::IntPredicate; use crate::meth; use crate::traits::*; -pub fn size_and_align_of_dst<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( +pub fn size_and_align_of_dst<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( bx: &mut Bx, t: Ty<'tcx>, info: Option diff --git a/src/librustc_codegen_ssa/meth.rs b/src/librustc_codegen_ssa/meth.rs index d38e434d98ce8..7fe9f5f25130a 100644 --- a/src/librustc_codegen_ssa/meth.rs +++ b/src/librustc_codegen_ssa/meth.rs @@ -12,7 +12,7 @@ pub const DESTRUCTOR: VirtualIndex = VirtualIndex(0); pub const SIZE: VirtualIndex = VirtualIndex(1); pub const ALIGN: VirtualIndex = VirtualIndex(2); -impl<'a, 'tcx: 'a> VirtualIndex { +impl<'a, 'tcx> VirtualIndex { pub fn from_index(index: usize) -> Self { VirtualIndex(index as u64 + 3) } diff --git a/src/librustc_codegen_ssa/mir/analyze.rs b/src/librustc_codegen_ssa/mir/analyze.rs index e2fd1c2bc38e7..3d41eddb8035e 100644 --- a/src/librustc_codegen_ssa/mir/analyze.rs +++ b/src/librustc_codegen_ssa/mir/analyze.rs @@ -12,7 +12,7 @@ use rustc::ty::layout::{LayoutOf, HasTyCtxt}; use super::FunctionCx; use crate::traits::*; -pub fn non_ssa_locals<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( +pub fn non_ssa_locals<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( fx: &FunctionCx<'a, 'tcx, Bx> ) -> BitSet { let mir = fx.mir; @@ -43,7 +43,7 @@ pub fn non_ssa_locals<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( analyzer.non_ssa_locals } -struct LocalAnalyzer<'mir, 'a: 'mir, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> { +struct LocalAnalyzer<'mir, 'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> { fx: &'mir FunctionCx<'a, 'tcx, Bx>, dominators: Dominators, non_ssa_locals: BitSet, @@ -94,7 +94,7 @@ impl> LocalAnalyzer<'mir, 'a, 'tcx, Bx> { } } -impl<'mir, 'a: 'mir, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> Visitor<'tcx> +impl<'mir, 'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> Visitor<'tcx> for LocalAnalyzer<'mir, 'a, 'tcx, Bx> { fn visit_assign(&mut self, place: &mir::Place<'tcx>, diff --git a/src/librustc_codegen_ssa/mir/block.rs b/src/librustc_codegen_ssa/mir/block.rs index e4b82d8496669..b4acc4005464c 100644 --- a/src/librustc_codegen_ssa/mir/block.rs +++ b/src/librustc_codegen_ssa/mir/block.rs @@ -151,7 +151,7 @@ impl<'a, 'tcx> TerminatorCodegenHelper<'a, 'tcx> { } /// Codegen implementations for some terminator variants. -impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { +impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { /// Generates code for a `Resume` terminator. fn codegen_resume_terminator<'b>( &mut self, @@ -788,7 +788,7 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { } } -impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { +impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { pub fn codegen_block( &mut self, bb: mir::BasicBlock, diff --git a/src/librustc_codegen_ssa/mir/constant.rs b/src/librustc_codegen_ssa/mir/constant.rs index 78c22206ab7a5..d6951b923bf7d 100644 --- a/src/librustc_codegen_ssa/mir/constant.rs +++ b/src/librustc_codegen_ssa/mir/constant.rs @@ -8,7 +8,7 @@ use crate::traits::*; use super::FunctionCx; -impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { +impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { pub fn eval_mir_constant( &mut self, constant: &mir::Constant<'tcx>, diff --git a/src/librustc_codegen_ssa/mir/mod.rs b/src/librustc_codegen_ssa/mir/mod.rs index dd69d35831318..78af71b5a4982 100644 --- a/src/librustc_codegen_ssa/mir/mod.rs +++ b/src/librustc_codegen_ssa/mir/mod.rs @@ -23,7 +23,7 @@ use rustc::mir::traversal; use self::operand::{OperandRef, OperandValue}; /// Master context for codegenning from MIR. -pub struct FunctionCx<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> { +pub struct FunctionCx<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> { instance: Instance<'tcx>, mir: &'a mir::Body<'tcx>, @@ -87,7 +87,7 @@ pub struct FunctionCx<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> { va_list_ref: Option>, } -impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { +impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { pub fn monomorphize(&self, value: &T) -> T where T: TypeFoldable<'tcx> { @@ -167,7 +167,7 @@ enum LocalRef<'tcx, V> { Operand(Option>), } -impl<'a, 'tcx: 'a, V: CodegenObject> LocalRef<'tcx, V> { +impl<'a, 'tcx, V: CodegenObject> LocalRef<'tcx, V> { fn new_operand>( bx: &mut Bx, layout: TyLayout<'tcx>, @@ -185,7 +185,7 @@ impl<'a, 'tcx: 'a, V: CodegenObject> LocalRef<'tcx, V> { /////////////////////////////////////////////////////////////////////////// -pub fn codegen_mir<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( +pub fn codegen_mir<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( cx: &'a Bx::CodegenCx, llfn: Bx::Value, mir: &'a Body<'tcx>, @@ -351,7 +351,7 @@ pub fn codegen_mir<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( } } -fn create_funclets<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( +fn create_funclets<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( mir: &'a Body<'tcx>, bx: &mut Bx, cleanup_kinds: &IndexVec, @@ -420,7 +420,7 @@ fn create_funclets<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( /// Produces, for each argument, a `Value` pointing at the /// argument's value. As arguments are places, these are always /// indirect. -fn arg_local_refs<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( +fn arg_local_refs<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( bx: &mut Bx, fx: &FunctionCx<'a, 'tcx, Bx>, memory_locals: &BitSet, diff --git a/src/librustc_codegen_ssa/mir/operand.rs b/src/librustc_codegen_ssa/mir/operand.rs index b4303cf5c9b2e..3305dfe1ffbb8 100644 --- a/src/librustc_codegen_ssa/mir/operand.rs +++ b/src/librustc_codegen_ssa/mir/operand.rs @@ -53,7 +53,7 @@ impl fmt::Debug for OperandRef<'tcx, V> { } } -impl<'a, 'tcx: 'a, V: CodegenObject> OperandRef<'tcx, V> { +impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V> { pub fn new_zst>( bx: &mut Bx, layout: TyLayout<'tcx> @@ -266,7 +266,7 @@ impl<'a, 'tcx: 'a, V: CodegenObject> OperandRef<'tcx, V> { } } -impl<'a, 'tcx: 'a, V: CodegenObject> OperandValue { +impl<'a, 'tcx, V: CodegenObject> OperandValue { pub fn store>( self, bx: &mut Bx, @@ -376,7 +376,7 @@ impl<'a, 'tcx: 'a, V: CodegenObject> OperandValue { } } -impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { +impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { fn maybe_codegen_consume_direct( &mut self, bx: &mut Bx, diff --git a/src/librustc_codegen_ssa/mir/place.rs b/src/librustc_codegen_ssa/mir/place.rs index 27311d0a8fbf1..81b17d0bee804 100644 --- a/src/librustc_codegen_ssa/mir/place.rs +++ b/src/librustc_codegen_ssa/mir/place.rs @@ -26,7 +26,7 @@ pub struct PlaceRef<'tcx, V> { pub align: Align, } -impl<'a, 'tcx: 'a, V: CodegenObject> PlaceRef<'tcx, V> { +impl<'a, 'tcx, V: CodegenObject> PlaceRef<'tcx, V> { pub fn new_sized( llval: V, layout: TyLayout<'tcx>, @@ -98,7 +98,7 @@ impl<'a, 'tcx: 'a, V: CodegenObject> PlaceRef<'tcx, V> { } -impl<'a, 'tcx: 'a, V: CodegenObject> PlaceRef<'tcx, V> { +impl<'a, 'tcx, V: CodegenObject> PlaceRef<'tcx, V> { /// Access a field, at a point when the value's case is known. pub fn project_field>( self, bx: &mut Bx, @@ -386,7 +386,7 @@ impl<'a, 'tcx: 'a, V: CodegenObject> PlaceRef<'tcx, V> { } } -impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { +impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { pub fn codegen_place( &mut self, bx: &mut Bx, diff --git a/src/librustc_codegen_ssa/mir/rvalue.rs b/src/librustc_codegen_ssa/mir/rvalue.rs index 87e15ba6aac5e..4a1971e3e2ee0 100644 --- a/src/librustc_codegen_ssa/mir/rvalue.rs +++ b/src/librustc_codegen_ssa/mir/rvalue.rs @@ -18,7 +18,7 @@ use super::{FunctionCx, LocalRef}; use super::operand::{OperandRef, OperandValue}; use super::place::PlaceRef; -impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { +impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { pub fn codegen_rvalue( &mut self, mut bx: Bx, @@ -687,7 +687,7 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { } } -impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { +impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { pub fn rvalue_creates_operand(&self, rvalue: &mir::Rvalue<'tcx>) -> bool { match *rvalue { mir::Rvalue::Ref(..) | @@ -712,7 +712,7 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { } } -fn cast_int_to_float<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( +fn cast_int_to_float<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( bx: &mut Bx, signed: bool, x: Bx::Value, @@ -746,7 +746,7 @@ fn cast_int_to_float<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( } } -fn cast_float_to_int<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( +fn cast_float_to_int<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( bx: &mut Bx, signed: bool, x: Bx::Value, diff --git a/src/librustc_codegen_ssa/mir/statement.rs b/src/librustc_codegen_ssa/mir/statement.rs index 618d05245d2ca..750b2f5b1a50f 100644 --- a/src/librustc_codegen_ssa/mir/statement.rs +++ b/src/librustc_codegen_ssa/mir/statement.rs @@ -6,7 +6,7 @@ use super::LocalRef; use super::OperandValue; use crate::traits::*; -impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { +impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { pub fn codegen_statement( &mut self, mut bx: Bx, diff --git a/src/librustc_codegen_ssa/mono_item.rs b/src/librustc_codegen_ssa/mono_item.rs index dc50c0e19efbf..57bd2f36dd7f5 100644 --- a/src/librustc_codegen_ssa/mono_item.rs +++ b/src/librustc_codegen_ssa/mono_item.rs @@ -6,7 +6,7 @@ use crate::traits::*; use rustc::mir::mono::MonoItem; -pub trait MonoItemExt<'a, 'tcx: 'a> { +pub trait MonoItemExt<'a, 'tcx> { fn define>(&self, cx: &'a Bx::CodegenCx); fn predefine>( &self, @@ -17,7 +17,7 @@ pub trait MonoItemExt<'a, 'tcx: 'a> { fn to_raw_string(&self) -> String; } -impl<'a, 'tcx: 'a> MonoItemExt<'a, 'tcx> for MonoItem<'tcx> { +impl<'a, 'tcx> MonoItemExt<'a, 'tcx> for MonoItem<'tcx> { fn define>(&self, cx: &'a Bx::CodegenCx) { debug!("BEGIN IMPLEMENTING '{} ({})' in cgu {}", self.to_string(cx.tcx(), true), diff --git a/src/librustc_codegen_ssa/traits/backend.rs b/src/librustc_codegen_ssa/traits/backend.rs index 2f95c9a7d8bb4..f2edff2faacee 100644 --- a/src/librustc_codegen_ssa/traits/backend.rs +++ b/src/librustc_codegen_ssa/traits/backend.rs @@ -44,7 +44,7 @@ pub trait ExtraBackendMethods: CodegenBackend + WriteBackendMethods + Sized + Se mods: &mut Self::Module, kind: AllocatorKind, ); - fn compile_codegen_unit<'a, 'tcx: 'a>(&self, tcx: TyCtxt<'tcx>, cgu_name: InternedString); + fn compile_codegen_unit<'a, 'tcx>(&self, tcx: TyCtxt<'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_ssa/traits/builder.rs b/src/librustc_codegen_ssa/traits/builder.rs index 2af57bcb064b7..1c80e614db8d5 100644 --- a/src/librustc_codegen_ssa/traits/builder.rs +++ b/src/librustc_codegen_ssa/traits/builder.rs @@ -22,7 +22,7 @@ pub enum OverflowOp { Mul, } -pub trait BuilderMethods<'a, 'tcx: 'a>: +pub trait BuilderMethods<'a, 'tcx>: HasCodegen<'tcx> + DebugInfoBuilderMethods<'tcx> + ArgTypeMethods<'tcx> diff --git a/src/librustc_driver/pretty.rs b/src/librustc_driver/pretty.rs index 683da5865cda4..eb89b5c1e6370 100644 --- a/src/librustc_driver/pretty.rs +++ b/src/librustc_driver/pretty.rs @@ -453,7 +453,7 @@ impl<'a> pprust::PpAnn for HygieneAnnotation<'a> { } } -struct TypedAnnotation<'a, 'tcx: 'a> { +struct TypedAnnotation<'a, 'tcx> { tcx: TyCtxt<'tcx>, tables: Cell<&'a ty::TypeckTables<'tcx>>, } diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index f3b9408569397..c6f361855c7d1 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -1088,7 +1088,7 @@ impl TypeAliasBounds { // We use a HIR visitor to walk the type. use rustc::hir::intravisit::{self, Visitor}; - struct WalkAssocTypes<'a, 'db> where 'db: 'a { + struct WalkAssocTypes<'a, 'db> where 'db { err: &'a mut DiagnosticBuilder<'db> } impl<'a, 'db, 'v> Visitor<'v> for WalkAssocTypes<'a, 'db> { diff --git a/src/librustc_lint/types.rs b/src/librustc_lint/types.rs index 9fc23e45d203c..2b99e2d91445e 100644 --- a/src/librustc_lint/types.rs +++ b/src/librustc_lint/types.rs @@ -505,7 +505,7 @@ declare_lint! { declare_lint_pass!(ImproperCTypes => [IMPROPER_CTYPES]); -struct ImproperCTypesVisitor<'a, 'tcx: 'a> { +struct ImproperCTypesVisitor<'a, 'tcx> { cx: &'a LateContext<'a, 'tcx>, } diff --git a/src/librustc_metadata/creader.rs b/src/librustc_metadata/creader.rs index 5fef8e53e1d0c..ff523c7b68a90 100644 --- a/src/librustc_metadata/creader.rs +++ b/src/librustc_metadata/creader.rs @@ -295,7 +295,7 @@ impl<'a> CrateLoader<'a> { path_kind: PathKind, ) -> Option<(LoadResult, Option)> where - 'a: 'b + 'a { // Use a new locator Context so trying to load a proc macro doesn't affect the error // message we emit diff --git a/src/librustc_metadata/decoder.rs b/src/librustc_metadata/decoder.rs index 4bafe16b8e66d..98cdeb6996873 100644 --- a/src/librustc_metadata/decoder.rs +++ b/src/librustc_metadata/decoder.rs @@ -35,7 +35,7 @@ use syntax::ext::hygiene::Mark; use syntax_pos::{self, Span, BytePos, Pos, DUMMY_SP, NO_EXPANSION}; use log::debug; -pub struct DecodeContext<'a, 'tcx: 'a> { +pub struct DecodeContext<'a, 'tcx> { opaque: opaque::Decoder<'a>, cdata: Option<&'a CrateMetadata>, sess: Option<&'a Session>, @@ -128,7 +128,7 @@ impl<'a, 'tcx> Metadata<'a, 'tcx> for (&'a CrateMetadata, TyCtxt<'tcx>) { } } -impl<'a, 'tcx: 'a, T: Decodable> Lazy { +impl<'a, 'tcx, T: Decodable> Lazy { pub fn decode>(self, meta: M) -> T { let mut dcx = meta.decoder(self.position); dcx.lazy_state = LazyState::NodeStart(self.position); @@ -136,7 +136,7 @@ impl<'a, 'tcx: 'a, T: Decodable> Lazy { } } -impl<'a, 'tcx: 'a, T: Decodable> LazySeq { +impl<'a, 'tcx, T: Decodable> LazySeq { pub fn decode>( self, meta: M, diff --git a/src/librustc_mir/borrow_check/borrow_set.rs b/src/librustc_mir/borrow_check/borrow_set.rs index f6f2cfbfc0886..40d8173ce400a 100644 --- a/src/librustc_mir/borrow_check/borrow_set.rs +++ b/src/librustc_mir/borrow_check/borrow_set.rs @@ -160,7 +160,7 @@ impl<'tcx> BorrowSet<'tcx> { } } -struct GatherBorrows<'a, 'tcx: 'a> { +struct GatherBorrows<'a, 'tcx> { tcx: TyCtxt<'tcx>, body: &'a Body<'tcx>, idx_vec: IndexVec>, diff --git a/src/librustc_mir/borrow_check/flows.rs b/src/librustc_mir/borrow_check/flows.rs index 5a57db2a6724e..9a9310fbe05f5 100644 --- a/src/librustc_mir/borrow_check/flows.rs +++ b/src/librustc_mir/borrow_check/flows.rs @@ -22,7 +22,7 @@ use std::fmt; use std::rc::Rc; // (forced to be `pub` due to its use as an associated type below.) -crate struct Flows<'b, 'tcx: 'b> { +crate struct Flows<'b, 'tcx> { borrows: FlowAtLocation<'tcx, Borrows<'b, 'tcx>>, pub uninits: FlowAtLocation<'tcx, MaybeUninitializedPlaces<'b, 'tcx>>, pub ever_inits: FlowAtLocation<'tcx, EverInitializedPlaces<'b, 'tcx>>, diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs index c4a11efe5bce4..a21d585a13ca3 100644 --- a/src/librustc_mir/borrow_check/mod.rs +++ b/src/librustc_mir/borrow_check/mod.rs @@ -423,7 +423,7 @@ fn downgrade_if_error(diag: &mut Diagnostic) { } } -pub struct MirBorrowckCtxt<'cx, 'tcx: 'cx> { +pub struct MirBorrowckCtxt<'cx, 'tcx> { infcx: &'cx InferCtxt<'cx, 'tcx>, body: &'cx Body<'tcx>, mir_def_id: DefId, @@ -891,7 +891,7 @@ enum InitializationRequiringAction { PartialAssignment, } -struct RootPlace<'d, 'tcx: 'd> { +struct RootPlace<'d, 'tcx> { place: &'d Place<'tcx>, is_local_mutation_allowed: LocalMutationIsAllowed, } @@ -1693,7 +1693,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { fn move_path_closest_to<'a>( &mut self, place: &'a Place<'tcx>, - ) -> Result<(&'a Place<'tcx>, MovePathIndex), NoMovePathFound> where 'cx: 'a { + ) -> Result<(&'a Place<'tcx>, MovePathIndex), NoMovePathFound> where 'cx { let mut last_prefix = place; for prefix in self.prefixes(place, PrefixSet::All) { if let Some(mpi) = self.move_path_for_place(prefix) { diff --git a/src/librustc_mir/borrow_check/nll/constraint_generation.rs b/src/librustc_mir/borrow_check/nll/constraint_generation.rs index 18c542de27268..058cdec5cea69 100644 --- a/src/librustc_mir/borrow_check/nll/constraint_generation.rs +++ b/src/librustc_mir/borrow_check/nll/constraint_generation.rs @@ -35,7 +35,7 @@ pub(super) fn generate_constraints<'cx, 'tcx>( } /// 'cg = the duration of the constraint generation process itself. -struct ConstraintGeneration<'cg, 'cx: 'cg, 'tcx: 'cx> { +struct ConstraintGeneration<'cg, 'cx, 'tcx> { infcx: &'cg InferCtxt<'cx, 'tcx>, all_facts: &'cg mut Option, location_table: &'cg LocationTable, 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 4d7ab90a4b3ef..7ab069260f940 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 @@ -27,7 +27,7 @@ crate fn find<'tcx>( uf.find() } -struct UseFinder<'cx, 'tcx: 'cx> { +struct UseFinder<'cx, 'tcx> { body: &'cx Body<'tcx>, regioncx: &'cx Rc>, tcx: TyCtxt<'tcx>, @@ -99,7 +99,7 @@ impl<'cx, 'tcx> UseFinder<'cx, 'tcx> { } } -struct DefUseVisitor<'cx, 'tcx: 'cx> { +struct DefUseVisitor<'cx, 'tcx> { body: &'cx Body<'tcx>, tcx: TyCtxt<'tcx>, region_vid: RegionVid, diff --git a/src/librustc_mir/borrow_check/nll/invalidation.rs b/src/librustc_mir/borrow_check/nll/invalidation.rs index 286f3ac5ccdad..c45c28c61465f 100644 --- a/src/librustc_mir/borrow_check/nll/invalidation.rs +++ b/src/librustc_mir/borrow_check/nll/invalidation.rs @@ -43,7 +43,7 @@ pub(super) fn generate_invalidates<'tcx>( } } -struct InvalidationGenerator<'cx, 'tcx: 'cx> { +struct InvalidationGenerator<'cx, 'tcx> { tcx: TyCtxt<'tcx>, all_facts: &'cx mut AllFacts, location_table: &'cx LocationTable, diff --git a/src/librustc_mir/borrow_check/nll/region_infer/graphviz.rs b/src/librustc_mir/borrow_check/nll/region_infer/graphviz.rs index cffc66ac7ddfd..0cf8a0d16f622 100644 --- a/src/librustc_mir/borrow_check/nll/region_infer/graphviz.rs +++ b/src/librustc_mir/borrow_check/nll/region_infer/graphviz.rs @@ -29,7 +29,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { } } -struct RawConstraints<'a, 'tcx: 'a> { +struct RawConstraints<'a, 'tcx> { regioncx: &'a RegionInferenceContext<'tcx>, } @@ -78,7 +78,7 @@ impl<'a, 'this, 'tcx> dot::GraphWalk<'this> for RawConstraints<'a, 'tcx> { } } -struct SccConstraints<'a, 'tcx: 'a> { +struct SccConstraints<'a, 'tcx> { regioncx: &'a RegionInferenceContext<'tcx>, nodes_per_scc: IndexVec>, } 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 d86702773e3f5..77a4d2699fff7 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 @@ -13,7 +13,7 @@ use rustc::ty::subst::UnpackedKind; use rustc::ty::{self, TyCtxt}; use syntax_pos::DUMMY_SP; -crate struct ConstraintConversion<'a, 'tcx: 'a> { +crate struct ConstraintConversion<'a, 'tcx> { infcx: &'a InferCtxt<'a, 'tcx>, tcx: TyCtxt<'tcx>, universal_regions: &'a UniversalRegions<'tcx>, diff --git a/src/librustc_mir/borrow_check/nll/type_check/free_region_relations.rs b/src/librustc_mir/borrow_check/nll/type_check/free_region_relations.rs index ca42f249dc19b..1bb3acc28f0c8 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/free_region_relations.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/free_region_relations.rs @@ -219,7 +219,7 @@ impl UniversalRegionRelations<'tcx> { } } -struct UniversalRegionRelationsBuilder<'this, 'tcx: 'this> { +struct UniversalRegionRelationsBuilder<'this, 'tcx> { infcx: &'this InferCtxt<'this, 'tcx>, param_env: ty::ParamEnv<'tcx>, universal_regions: Rc>, diff --git a/src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs b/src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs index 48e45e9452569..2d65eb021d388 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs @@ -60,9 +60,9 @@ pub(super) fn trace( /// Contextual state for the type-liveness generator. struct LivenessContext<'me, 'typeck, 'flow, 'tcx> where - 'typeck: 'me, - 'flow: 'me, - 'tcx: 'typeck + 'flow, + 'typeck, + 'flow, + 'tcx, { /// Current type-checker, giving us our inference context etc. typeck: &'me mut TypeChecker<'typeck, 'tcx>, @@ -98,9 +98,9 @@ struct DropData<'tcx> { struct LivenessResults<'me, 'typeck, 'flow, 'tcx> where - 'typeck: 'me, - 'flow: 'me, - 'tcx: 'typeck + 'flow, + 'typeck, + 'flow, + 'tcx, { cx: LivenessContext<'me, 'typeck, 'flow, 'tcx>, 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 ad79f2109207b..ac5efa4640661 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/mod.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/mod.rs @@ -251,7 +251,7 @@ enum FieldAccessError { /// The sanitize_XYZ methods here take an MIR object and compute its /// type, calling `span_mirbug` and returning an error type if there /// is a problem. -struct TypeVerifier<'a, 'b: 'a, 'tcx: 'b> { +struct TypeVerifier<'a, 'b, 'tcx> { cx: &'a mut TypeChecker<'b, 'tcx>, body: &'b Body<'tcx>, last_span: Span, @@ -830,7 +830,7 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> { /// constraints needed for it to be valid and well-typed. Along the /// way, it accrues region constraints -- these can later be used by /// NLL region checking. -struct TypeChecker<'a, 'tcx: 'a> { +struct TypeChecker<'a, 'tcx> { infcx: &'a InferCtxt<'a, 'tcx>, param_env: ty::ParamEnv<'tcx>, last_span: Span, @@ -845,7 +845,7 @@ struct TypeChecker<'a, 'tcx: 'a> { universal_region_relations: &'a UniversalRegionRelations<'tcx>, } -struct BorrowCheckContext<'a, 'tcx: 'a> { +struct BorrowCheckContext<'a, 'tcx> { universal_regions: &'a UniversalRegions<'tcx>, location_table: &'a LocationTable, all_facts: &'a mut Option, diff --git a/src/librustc_mir/borrow_check/nll/type_check/relate_tys.rs b/src/librustc_mir/borrow_check/nll/type_check/relate_tys.rs index 5ced356299fc9..2549aa4fbff93 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/relate_tys.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/relate_tys.rs @@ -34,7 +34,7 @@ pub(super) fn relate_types<'tcx>( Ok(()) } -struct NllTypeRelatingDelegate<'me, 'bccx: 'me, 'tcx: 'bccx> { +struct NllTypeRelatingDelegate<'me, 'bccx, 'tcx> { infcx: &'me InferCtxt<'me, 'tcx>, borrowck_context: Option<&'me mut BorrowCheckContext<'bccx, 'tcx>>, diff --git a/src/librustc_mir/borrow_check/nll/universal_regions.rs b/src/librustc_mir/borrow_check/nll/universal_regions.rs index a236359f1d431..fa3c7b9613e19 100644 --- a/src/librustc_mir/borrow_check/nll/universal_regions.rs +++ b/src/librustc_mir/borrow_check/nll/universal_regions.rs @@ -363,7 +363,7 @@ impl<'tcx> UniversalRegions<'tcx> { } } -struct UniversalRegionsBuilder<'cx, 'tcx: 'cx> { +struct UniversalRegionsBuilder<'cx, 'tcx> { infcx: &'cx InferCtxt<'cx, 'tcx>, mir_def_id: DefId, mir_hir_id: HirId, diff --git a/src/librustc_mir/borrow_check/prefixes.rs b/src/librustc_mir/borrow_check/prefixes.rs index b35bcc09a235b..0cc1dfd4def0f 100644 --- a/src/librustc_mir/borrow_check/prefixes.rs +++ b/src/librustc_mir/borrow_check/prefixes.rs @@ -36,7 +36,7 @@ impl<'tcx> IsPrefixOf<'tcx> for Place<'tcx> { } } -pub(super) struct Prefixes<'cx, 'tcx: 'cx> { +pub(super) struct Prefixes<'cx, 'tcx> { body: &'cx Body<'tcx>, tcx: TyCtxt<'tcx>, kind: PrefixSet, diff --git a/src/librustc_mir/borrow_check/used_muts.rs b/src/librustc_mir/borrow_check/used_muts.rs index e609ddbbe95ff..9c5569011df4f 100644 --- a/src/librustc_mir/borrow_check/used_muts.rs +++ b/src/librustc_mir/borrow_check/used_muts.rs @@ -46,7 +46,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { /// MIR visitor for collecting used mutable variables. /// The 'visit lifetime represents the duration of the MIR walk. -struct GatherUsedMutsVisitor<'visit, 'cx: 'visit, 'tcx: 'cx> { +struct GatherUsedMutsVisitor<'visit, 'cx, 'tcx> { temporary_used_locals: FxHashSet, never_initialized_mut_locals: &'visit mut FxHashSet, mbcx: &'visit mut MirBorrowckCtxt<'cx, 'tcx>, diff --git a/src/librustc_mir/build/matches/mod.rs b/src/librustc_mir/build/matches/mod.rs index 134ff52efe1e5..54f935231827a 100644 --- a/src/librustc_mir/build/matches/mod.rs +++ b/src/librustc_mir/build/matches/mod.rs @@ -661,7 +661,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { } #[derive(Debug)] -pub struct Candidate<'pat, 'tcx: 'pat> { +pub struct Candidate<'pat, 'tcx> { // span of the original pattern that gave rise to this candidate span: Span, @@ -705,7 +705,7 @@ struct Ascription<'tcx> { } #[derive(Clone, Debug)] -pub struct MatchPair<'pat, 'tcx: 'pat> { +pub struct MatchPair<'pat, 'tcx> { // this place... place: Place<'tcx>, @@ -1691,7 +1691,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { &mut self, block: BasicBlock, bindings: impl IntoIterator>, - ) where 'tcx: 'b { + ) where 'tcx { debug!("bind_matched_candidate_for_arm_body(block={:?})", block); let re_erased = self.hir.tcx().lifetimes.re_erased; diff --git a/src/librustc_mir/build/mod.rs b/src/librustc_mir/build/mod.rs index a0e45caeb6b3b..001f377c0ee31 100644 --- a/src/librustc_mir/build/mod.rs +++ b/src/librustc_mir/build/mod.rs @@ -241,7 +241,7 @@ impl BlockFrame { #[derive(Debug)] struct BlockContext(Vec); -struct Builder<'a, 'tcx: 'a> { +struct Builder<'a, 'tcx> { hir: Cx<'a, 'tcx>, cfg: CFG<'tcx>, diff --git a/src/librustc_mir/dataflow/impls/borrowed_locals.rs b/src/librustc_mir/dataflow/impls/borrowed_locals.rs index a5e1b4ebaafee..069ce3a78c5f9 100644 --- a/src/librustc_mir/dataflow/impls/borrowed_locals.rs +++ b/src/librustc_mir/dataflow/impls/borrowed_locals.rs @@ -11,11 +11,11 @@ use crate::dataflow::BitDenotation; /// This is used to compute which locals are live during a yield expression for /// immovable generators. #[derive(Copy, Clone)] -pub struct HaveBeenBorrowedLocals<'a, 'tcx: 'a> { +pub struct HaveBeenBorrowedLocals<'a, 'tcx> { body: &'a Body<'tcx>, } -impl<'a, 'tcx: 'a> HaveBeenBorrowedLocals<'a, 'tcx> { +impl<'a, 'tcx> HaveBeenBorrowedLocals<'a, 'tcx> { pub fn new(body: &'a Body<'tcx>) -> Self { HaveBeenBorrowedLocals { body } @@ -97,7 +97,7 @@ impl<'a, 'tcx> InitialFlow for HaveBeenBorrowedLocals<'a, 'tcx> { } } -struct BorrowedLocalsVisitor<'b, 'c: 'b> { +struct BorrowedLocalsVisitor<'b, 'c> { sets: &'b mut BlockSets<'c, Local>, } diff --git a/src/librustc_mir/dataflow/impls/borrows.rs b/src/librustc_mir/dataflow/impls/borrows.rs index ba1a22c8d42eb..899765a1d2daa 100644 --- a/src/librustc_mir/dataflow/impls/borrows.rs +++ b/src/librustc_mir/dataflow/impls/borrows.rs @@ -29,7 +29,7 @@ newtype_index! { /// `BorrowIndex`, and maps each such index to a `BorrowData` /// describing the borrow. These indexes are used for representing the /// borrows in compact bitvectors. -pub struct Borrows<'a, 'tcx: 'a> { +pub struct Borrows<'a, 'tcx> { tcx: TyCtxt<'tcx>, body: &'a Body<'tcx>, diff --git a/src/librustc_mir/dataflow/impls/mod.rs b/src/librustc_mir/dataflow/impls/mod.rs index 50d9bbf4cc324..0a572d2093622 100644 --- a/src/librustc_mir/dataflow/impls/mod.rs +++ b/src/librustc_mir/dataflow/impls/mod.rs @@ -63,7 +63,7 @@ pub(super) mod borrows; /// Similarly, at a given `drop` statement, the set-intersection /// between this data and `MaybeUninitializedPlaces` yields the set of /// places that would require a dynamic drop-flag at that statement. -pub struct MaybeInitializedPlaces<'a, 'tcx: 'a> { +pub struct MaybeInitializedPlaces<'a, 'tcx> { tcx: TyCtxt<'tcx>, body: &'a Body<'tcx>, mdpe: &'a MoveDataParamEnv<'tcx>, @@ -114,7 +114,7 @@ impl<'a, 'tcx> HasMoveData<'tcx> for MaybeInitializedPlaces<'a, 'tcx> { /// Similarly, at a given `drop` statement, the set-intersection /// between this data and `MaybeInitializedPlaces` yields the set of /// places that would require a dynamic drop-flag at that statement. -pub struct MaybeUninitializedPlaces<'a, 'tcx: 'a> { +pub struct MaybeUninitializedPlaces<'a, 'tcx> { tcx: TyCtxt<'tcx>, body: &'a Body<'tcx>, mdpe: &'a MoveDataParamEnv<'tcx>, @@ -164,19 +164,19 @@ impl<'a, 'tcx> HasMoveData<'tcx> for MaybeUninitializedPlaces<'a, 'tcx> { /// Similarly, at a given `drop` statement, the set-difference between /// this data and `MaybeInitializedPlaces` yields the set of places /// that would require a dynamic drop-flag at that statement. -pub struct DefinitelyInitializedPlaces<'a, 'tcx: 'a> { +pub struct DefinitelyInitializedPlaces<'a, 'tcx> { tcx: TyCtxt<'tcx>, body: &'a Body<'tcx>, mdpe: &'a MoveDataParamEnv<'tcx>, } -impl<'a, 'tcx: 'a> DefinitelyInitializedPlaces<'a, 'tcx> { +impl<'a, 'tcx> DefinitelyInitializedPlaces<'a, 'tcx> { pub fn new(tcx: TyCtxt<'tcx>, body: &'a Body<'tcx>, mdpe: &'a MoveDataParamEnv<'tcx>) -> Self { DefinitelyInitializedPlaces { tcx: tcx, body: body, mdpe: mdpe } } } -impl<'a, 'tcx: 'a> HasMoveData<'tcx> for DefinitelyInitializedPlaces<'a, 'tcx> { +impl<'a, 'tcx> HasMoveData<'tcx> for DefinitelyInitializedPlaces<'a, 'tcx> { fn move_data(&self) -> &MoveData<'tcx> { &self.mdpe.move_data } } @@ -209,13 +209,13 @@ impl<'a, 'tcx: 'a> HasMoveData<'tcx> for DefinitelyInitializedPlaces<'a, 'tcx> { /// c = S; // {a, b, c, d } /// } /// ``` -pub struct EverInitializedPlaces<'a, 'tcx: 'a> { +pub struct EverInitializedPlaces<'a, 'tcx> { tcx: TyCtxt<'tcx>, body: &'a Body<'tcx>, mdpe: &'a MoveDataParamEnv<'tcx>, } -impl<'a, 'tcx: 'a> EverInitializedPlaces<'a, 'tcx> { +impl<'a, 'tcx> EverInitializedPlaces<'a, 'tcx> { pub fn new(tcx: TyCtxt<'tcx>, body: &'a Body<'tcx>, mdpe: &'a MoveDataParamEnv<'tcx>) -> Self { EverInitializedPlaces { tcx: tcx, body: body, mdpe: mdpe } } diff --git a/src/librustc_mir/dataflow/impls/storage_liveness.rs b/src/librustc_mir/dataflow/impls/storage_liveness.rs index fed56e987ef49..d7575b0f441e6 100644 --- a/src/librustc_mir/dataflow/impls/storage_liveness.rs +++ b/src/librustc_mir/dataflow/impls/storage_liveness.rs @@ -4,11 +4,11 @@ use rustc::mir::*; use crate::dataflow::BitDenotation; #[derive(Copy, Clone)] -pub struct MaybeStorageLive<'a, 'tcx: 'a> { +pub struct MaybeStorageLive<'a, 'tcx> { body: &'a Body<'tcx>, } -impl<'a, 'tcx: 'a> MaybeStorageLive<'a, 'tcx> { +impl<'a, 'tcx> MaybeStorageLive<'a, 'tcx> { pub fn new(body: &'a Body<'tcx>) -> Self { MaybeStorageLive { body } diff --git a/src/librustc_mir/dataflow/mod.rs b/src/librustc_mir/dataflow/mod.rs index 8c4acd70456b0..1130e7e3f5d00 100644 --- a/src/librustc_mir/dataflow/mod.rs +++ b/src/librustc_mir/dataflow/mod.rs @@ -41,7 +41,7 @@ pub(crate) mod indexes { }; } -pub(crate) struct DataflowBuilder<'a, 'tcx: 'a, BD> +pub(crate) struct DataflowBuilder<'a, 'tcx, BD> where BD: BitDenotation<'tcx> { @@ -86,7 +86,7 @@ pub(crate) trait Dataflow<'tcx, BD: BitDenotation<'tcx>> { fn propagate(&mut self); } -impl<'a, 'tcx: 'a, BD> Dataflow<'tcx, BD> for DataflowBuilder<'a, 'tcx, BD> +impl<'a, 'tcx, BD> Dataflow<'tcx, BD> for DataflowBuilder<'a, 'tcx, BD> where BD: BitDenotation<'tcx> { @@ -138,7 +138,7 @@ where flow_state.run(tcx, def_id, attributes, p) } -impl<'a, 'tcx: 'a, BD> DataflowAnalysis<'a, 'tcx, BD> +impl<'a, 'tcx, BD> DataflowAnalysis<'a, 'tcx, BD> where BD: BitDenotation<'tcx>, { @@ -179,12 +179,12 @@ where } } -struct PropagationContext<'b, 'a: 'b, 'tcx: 'a, O> where O: 'b + BitDenotation<'tcx> +struct PropagationContext<'b, 'a, 'tcx, O> where O: 'b + BitDenotation<'tcx> { builder: &'b mut DataflowAnalysis<'a, 'tcx, O>, } -impl<'a, 'tcx: 'a, BD> DataflowAnalysis<'a, 'tcx, BD> where BD: BitDenotation<'tcx> +impl<'a, 'tcx, BD> DataflowAnalysis<'a, 'tcx, BD> where BD: BitDenotation<'tcx> { fn propagate(&mut self) { let mut temp = BitSet::new_empty(self.flow_state.sets.bits_per_block); @@ -234,7 +234,7 @@ impl<'a, 'tcx: 'a, BD> DataflowAnalysis<'a, 'tcx, BD> where BD: BitDenotation<'t } } -impl<'b, 'a: 'b, 'tcx: 'a, BD> PropagationContext<'b, 'a, 'tcx, BD> where BD: BitDenotation<'tcx> +impl<'b, 'a, 'tcx, BD> PropagationContext<'b, 'a, 'tcx, BD> where BD: BitDenotation<'tcx> { fn walk_cfg(&mut self, in_out: &mut BitSet) { let mut dirty_queue: WorkQueue = @@ -265,7 +265,7 @@ fn dataflow_path(context: &str, path: &str) -> PathBuf { path } -impl<'a, 'tcx: 'a, BD> DataflowBuilder<'a, 'tcx, BD> where BD: BitDenotation<'tcx> +impl<'a, 'tcx, BD> DataflowBuilder<'a, 'tcx, BD> where BD: BitDenotation<'tcx> { fn pre_dataflow_instrumentation

(&self, p: P) -> io::Result<()> where P: Fn(&BD, BD::Idx) -> DebugFormatted @@ -297,7 +297,7 @@ impl<'a, 'tcx: 'a, BD> DataflowBuilder<'a, 'tcx, BD> where BD: BitDenotation<'tc /// underlying flow analysis results, because it needs to handle cases /// where we are combining the results of *multiple* flow analyses /// (e.g., borrows + inits + uninits). -pub(crate) trait DataflowResultsConsumer<'a, 'tcx: 'a> { +pub(crate) trait DataflowResultsConsumer<'a, 'tcx> { type FlowState: FlowsAtLocation; // Observation Hooks: override (at least one of) these to get analysis feedback. @@ -387,14 +387,14 @@ pub fn state_for_location<'tcx, T: BitDenotation<'tcx>>(loc: Location, gen_set.to_dense() } -pub struct DataflowAnalysis<'a, 'tcx: 'a, O> where O: BitDenotation<'tcx> +pub struct DataflowAnalysis<'a, 'tcx, O> where O: BitDenotation<'tcx> { flow_state: DataflowState<'tcx, O>, dead_unwinds: &'a BitSet, body: &'a Body<'tcx>, } -impl<'a, 'tcx: 'a, O> DataflowAnalysis<'a, 'tcx, O> where O: BitDenotation<'tcx> +impl<'a, 'tcx, O> DataflowAnalysis<'a, 'tcx, O> where O: BitDenotation<'tcx> { pub fn results(self) -> DataflowResults<'tcx, O> { DataflowResults(self.flow_state) @@ -734,7 +734,7 @@ impl<'a, 'tcx, D> DataflowAnalysis<'a, 'tcx, D> where D: BitDenotation<'tcx> } } -impl<'a, 'tcx: 'a, D> DataflowAnalysis<'a, 'tcx, D> where D: BitDenotation<'tcx> { +impl<'a, 'tcx, D> DataflowAnalysis<'a, 'tcx, D> where D: BitDenotation<'tcx> { /// Propagates the bits of `in_out` into all the successors of `bb`, /// using bitwise operator denoted by `self.operator`. /// diff --git a/src/librustc_mir/dataflow/move_paths/builder.rs b/src/librustc_mir/dataflow/move_paths/builder.rs index 7c738b75e0722..e8386e8fef11b 100644 --- a/src/librustc_mir/dataflow/move_paths/builder.rs +++ b/src/librustc_mir/dataflow/move_paths/builder.rs @@ -12,7 +12,7 @@ use super::{LocationMap, MoveData, MovePath, MovePathLookup, MovePathIndex, Move use super::{MoveError, InitIndex, Init, InitLocation, LookupResult, InitKind}; use super::IllegalMoveOriginKind::*; -struct MoveDataBuilder<'a, 'tcx: 'a> { +struct MoveDataBuilder<'a, 'tcx> { body: &'a Body<'tcx>, tcx: TyCtxt<'tcx>, data: MoveData<'tcx>, @@ -253,7 +253,7 @@ impl<'a, 'tcx> MoveDataBuilder<'a, 'tcx> { } } -struct Gatherer<'b, 'a: 'b, 'tcx: 'a> { +struct Gatherer<'b, 'a, 'tcx> { builder: &'b mut MoveDataBuilder<'a, 'tcx>, loc: Location, } diff --git a/src/librustc_mir/hair/cx/mod.rs b/src/librustc_mir/hair/cx/mod.rs index ff53cf02d8d15..fe54e2a0f183f 100644 --- a/src/librustc_mir/hair/cx/mod.rs +++ b/src/librustc_mir/hair/cx/mod.rs @@ -21,7 +21,7 @@ use rustc::hir; use crate::hair::constant::{lit_to_const, LitToConstError}; #[derive(Clone)] -pub struct Cx<'a, 'tcx: 'a> { +pub struct Cx<'a, 'tcx> { tcx: TyCtxt<'tcx>, infcx: &'a InferCtxt<'a, 'tcx>, diff --git a/src/librustc_mir/hair/cx/to_ref.rs b/src/librustc_mir/hair/cx/to_ref.rs index a462c61c2acba..d044b1faedfa1 100644 --- a/src/librustc_mir/hair/cx/to_ref.rs +++ b/src/librustc_mir/hair/cx/to_ref.rs @@ -8,7 +8,7 @@ pub trait ToRef { fn to_ref(self) -> Self::Output; } -impl<'a, 'tcx: 'a> ToRef for &'tcx hir::Expr { +impl<'a, 'tcx> ToRef for &'tcx hir::Expr { type Output = ExprRef<'tcx>; fn to_ref(self) -> ExprRef<'tcx> { @@ -16,7 +16,7 @@ impl<'a, 'tcx: 'a> ToRef for &'tcx hir::Expr { } } -impl<'a, 'tcx: 'a> ToRef for &'tcx P { +impl<'a, 'tcx> ToRef for &'tcx P { type Output = ExprRef<'tcx>; fn to_ref(self) -> ExprRef<'tcx> { @@ -24,7 +24,7 @@ impl<'a, 'tcx: 'a> ToRef for &'tcx P { } } -impl<'a, 'tcx: 'a> ToRef for Expr<'tcx> { +impl<'a, 'tcx> ToRef for Expr<'tcx> { type Output = ExprRef<'tcx>; fn to_ref(self) -> ExprRef<'tcx> { @@ -32,7 +32,7 @@ impl<'a, 'tcx: 'a> ToRef for Expr<'tcx> { } } -impl<'a, 'tcx: 'a, T, U> ToRef for &'tcx Option +impl<'a, 'tcx, T, U> ToRef for &'tcx Option where &'tcx T: ToRef { type Output = Option; @@ -42,7 +42,7 @@ impl<'a, 'tcx: 'a, T, U> ToRef for &'tcx Option } } -impl<'a, 'tcx: 'a, T, U> ToRef for &'tcx Vec +impl<'a, 'tcx, T, U> ToRef for &'tcx Vec where &'tcx T: ToRef { type Output = Vec; @@ -52,7 +52,7 @@ impl<'a, 'tcx: 'a, T, U> ToRef for &'tcx Vec } } -impl<'a, 'tcx: 'a, T, U> ToRef for &'tcx P<[T]> +impl<'a, 'tcx, T, U> ToRef for &'tcx P<[T]> where &'tcx T: ToRef { type Output = Vec; diff --git a/src/librustc_mir/hair/pattern/_match.rs b/src/librustc_mir/hair/pattern/_match.rs index bb1a67bcdaeff..22bd802c1fab7 100644 --- a/src/librustc_mir/hair/pattern/_match.rs +++ b/src/librustc_mir/hair/pattern/_match.rs @@ -285,7 +285,7 @@ impl<'tcx> Pattern<'tcx> { /// A 2D matrix. Nx1 matrices are very common, which is why `SmallVec[_; 2]` /// works well for each row. -pub struct Matrix<'p, 'tcx: 'p>(Vec; 2]>>); +pub struct Matrix<'p, 'tcx>(Vec; 2]>>); impl<'p, 'tcx> Matrix<'p, 'tcx> { pub fn empty() -> Self { @@ -349,7 +349,7 @@ impl<'p, 'tcx> FromIterator; 2]>> for Matrix<'p, 'tc } } -pub struct MatchCheckCtxt<'a, 'tcx: 'a> { +pub struct MatchCheckCtxt<'a, 'tcx> { pub tcx: TyCtxt<'tcx>, /// The module in which the match occurs. This is necessary for /// checking inhabited-ness of types because whether a type is (visibly) @@ -393,7 +393,7 @@ impl<'a, 'tcx> MatchCheckCtxt<'a, 'tcx> { } fn is_non_exhaustive_variant<'p>(&self, pattern: &'p Pattern<'tcx>) -> bool - where 'a: 'p + where 'a { match *pattern.kind { PatternKind::Variant { adt_def, variant_index, .. } => { @@ -634,7 +634,7 @@ impl<'tcx> Witness<'tcx> { /// /// We make sure to omit constructors that are statically impossible. E.g., for /// `Option`, we do not include `Some(_)` in the returned list of constructors. -fn all_constructors<'a, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>, +fn all_constructors<'a, 'tcx>(cx: &mut MatchCheckCtxt<'a, 'tcx>, pcx: PatternContext<'tcx>) -> Vec> { @@ -708,7 +708,7 @@ fn all_constructors<'a, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>, ctors } -fn max_slice_length<'p, 'a: 'p, 'tcx: 'a, I>( +fn max_slice_length<'p, 'a, 'tcx, I>( cx: &mut MatchCheckCtxt<'a, 'tcx>, patterns: I) -> u64 where I: Iterator> @@ -985,7 +985,7 @@ enum MissingCtors<'tcx> { // (The split logic gives a performance win, because we always need to know if // the set is empty, but we rarely need the full set, and it can be expensive // to compute the full set.) -fn compute_missing_ctors<'a, 'tcx: 'a>( +fn compute_missing_ctors<'a, 'tcx>( info: MissingCtorsInfo, tcx: TyCtxt<'tcx>, all_ctors: &Vec>, @@ -1057,7 +1057,7 @@ fn compute_missing_ctors<'a, 'tcx: 'a>( /// relation to preceding patterns, it is not reachable) and exhaustiveness /// checking (if a wildcard pattern is useful in relation to a matrix, the /// matrix isn't exhaustive). -pub fn is_useful<'p, 'a: 'p, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>, +pub fn is_useful<'p, 'a, 'tcx>(cx: &mut MatchCheckCtxt<'a, 'tcx>, matrix: &Matrix<'p, 'tcx>, v: &[&Pattern<'tcx>], witness: WitnessPreference) @@ -1267,7 +1267,7 @@ pub fn is_useful<'p, 'a: 'p, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>, /// A shorthand for the `U(S(c, P), S(c, q))` operation from the paper. I.e., `is_useful` applied /// to the specialised version of both the pattern matrix `P` and the new pattern `q`. -fn is_useful_specialized<'p, 'a: 'p, 'tcx: 'a>( +fn is_useful_specialized<'p, 'a, 'tcx>( cx: &mut MatchCheckCtxt<'a, 'tcx>, &Matrix(ref m): &Matrix<'p, 'tcx>, v: &[&Pattern<'tcx>], @@ -1373,7 +1373,7 @@ fn constructor_arity(cx: &MatchCheckCtxt<'a, 'tcx>, ctor: &Constructor<'tcx>, ty /// expanded to. /// /// For instance, a tuple pattern (43u32, 'a') has sub pattern types [u32, char]. -fn constructor_sub_pattern_tys<'a, 'tcx: 'a>(cx: &MatchCheckCtxt<'a, 'tcx>, +fn constructor_sub_pattern_tys<'a, 'tcx>(cx: &MatchCheckCtxt<'a, 'tcx>, ctor: &Constructor<'tcx>, ty: Ty<'tcx>) -> Vec> { @@ -1520,7 +1520,7 @@ fn should_treat_range_exhaustively(tcx: TyCtxt<'tcx>, ctor: &Constructor<'tcx>) /// boundaries for each interval range, sort them, then create constructors for each new interval /// 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>( +fn split_grouped_constructors<'p, 'a, 'tcx>( tcx: TyCtxt<'tcx>, ctors: Vec>, &Matrix(ref m): &Matrix<'p, 'tcx>, @@ -1598,7 +1598,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>( +fn constructor_intersects_pattern<'p, 'a, 'tcx>( tcx: TyCtxt<'tcx>, ctor: &Constructor<'tcx>, pat: &'p Pattern<'tcx>, @@ -1688,7 +1688,7 @@ fn constructor_covered_by_range<'tcx>( } } -fn patterns_for_variant<'p, 'a: 'p, 'tcx: 'a>( +fn patterns_for_variant<'p, 'a, 'tcx>( subpatterns: &'p [FieldPattern<'tcx>], wild_patterns: &[&'p Pattern<'tcx>]) -> SmallVec<[&'p Pattern<'tcx>; 2]> @@ -1711,7 +1711,7 @@ fn patterns_for_variant<'p, 'a: 'p, 'tcx: 'a>( /// different patterns. /// Structure patterns with a partial wild pattern (Foo { a: 42, .. }) have their missing /// fields filled with wild patterns. -fn specialize<'p, 'a: 'p, 'tcx: 'a>( +fn specialize<'p, 'a, 'tcx>( cx: &mut MatchCheckCtxt<'a, 'tcx>, r: &[&'p Pattern<'tcx>], constructor: &Constructor<'tcx>, diff --git a/src/librustc_mir/hair/pattern/check_match.rs b/src/librustc_mir/hair/pattern/check_match.rs index 159b526bdba65..ed850379af60b 100644 --- a/src/librustc_mir/hair/pattern/check_match.rs +++ b/src/librustc_mir/hair/pattern/check_match.rs @@ -47,7 +47,7 @@ fn create_e0004<'a>(sess: &'a Session, sp: Span, error_message: String) -> Diagn struct_span_err!(sess, sp, E0004, "{}", &error_message) } -struct MatchVisitor<'a, 'tcx: 'a> { +struct MatchVisitor<'a, 'tcx> { tcx: TyCtxt<'tcx>, body_owner: DefId, tables: &'a ty::TypeckTables<'tcx>, @@ -439,7 +439,7 @@ fn check_arms<'a, 'tcx>( } } -fn check_exhaustive<'p, 'a: 'p, 'tcx: 'a>( +fn check_exhaustive<'p, 'a, 'tcx>( cx: &mut MatchCheckCtxt<'a, 'tcx>, scrut_ty: Ty<'tcx>, sp: Span, @@ -642,7 +642,7 @@ fn check_for_mutation_in_guard(cx: &MatchVisitor<'_, '_>, guard: &hir::Guard) { }; } -struct MutationChecker<'a, 'tcx: 'a> { +struct MutationChecker<'a, 'tcx> { cx: &'a MatchVisitor<'a, 'tcx>, } @@ -691,7 +691,7 @@ fn check_legality_of_bindings_in_at_patterns(cx: &MatchVisitor<'_, '_>, pat: &Pa AtBindingPatternVisitor { cx: cx, bindings_allowed: true }.visit_pat(pat); } -struct AtBindingPatternVisitor<'a, 'b:'a, 'tcx:'b> { +struct AtBindingPatternVisitor<'a, 'b, 'tcx> { cx: &'a MatchVisitor<'b, 'tcx>, bindings_allowed: bool } diff --git a/src/librustc_mir/hair/pattern/mod.rs b/src/librustc_mir/hair/pattern/mod.rs index e0e14852c577a..cf597ce0b6319 100644 --- a/src/librustc_mir/hair/pattern/mod.rs +++ b/src/librustc_mir/hair/pattern/mod.rs @@ -326,7 +326,7 @@ impl<'tcx> fmt::Display for Pattern<'tcx> { } } -pub struct PatternContext<'a, 'tcx: 'a> { +pub struct PatternContext<'a, 'tcx> { pub tcx: TyCtxt<'tcx>, pub param_env: ty::ParamEnv<'tcx>, pub tables: &'a ty::TypeckTables<'tcx>, diff --git a/src/librustc_mir/interpret/eval_context.rs b/src/librustc_mir/interpret/eval_context.rs index 28dc0d37b36f4..b01826c98db05 100644 --- a/src/librustc_mir/interpret/eval_context.rs +++ b/src/librustc_mir/interpret/eval_context.rs @@ -49,7 +49,7 @@ pub struct InterpretCx<'mir, 'tcx, M: Machine<'mir, 'tcx>> { /// A stack frame. #[derive(Clone)] -pub struct Frame<'mir, 'tcx: 'mir, Tag=(), Extra=()> { +pub struct Frame<'mir, 'tcx, Tag=(), Extra=()> { //////////////////////////////////////////////////////////////////////////////// // Function and callsite information //////////////////////////////////////////////////////////////////////////////// @@ -195,7 +195,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> LayoutOf for InterpretCx<'mir, 'tcx, M> } } -impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpretCx<'mir, 'tcx, M> { +impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpretCx<'mir, 'tcx, M> { pub fn new(tcx: TyCtxtAt<'tcx>, param_env: ty::ParamEnv<'tcx>, machine: M) -> Self { InterpretCx { machine, diff --git a/src/librustc_mir/interpret/snapshot.rs b/src/librustc_mir/interpret/snapshot.rs index 0032e84b266c8..ad631793a0827 100644 --- a/src/librustc_mir/interpret/snapshot.rs +++ b/src/librustc_mir/interpret/snapshot.rs @@ -304,7 +304,7 @@ impl_stable_hash_for!(enum crate::interpret::eval_context::StackPopCleanup { }); #[derive(Eq, PartialEq)] -struct FrameSnapshot<'a, 'tcx: 'a> { +struct FrameSnapshot<'a, 'tcx> { instance: &'a ty::Instance<'tcx>, span: &'a Span, return_to_block: &'a StackPopCleanup, diff --git a/src/librustc_mir/interpret/visitor.rs b/src/librustc_mir/interpret/visitor.rs index 9150f16526ba7..95a679b95ddc9 100644 --- a/src/librustc_mir/interpret/visitor.rs +++ b/src/librustc_mir/interpret/visitor.rs @@ -122,7 +122,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Value<'mir, 'tcx, M> for MPlaceTy<'tcx, 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<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>>: Sized { + pub trait $visitor_trait_name<'mir, 'tcx, M: Machine<'mir, 'tcx>>: Sized { type V: Value<'mir, 'tcx, M>; /// The visitor must have an `InterpretCx` in it. diff --git a/src/librustc_mir/monomorphize/collector.rs b/src/librustc_mir/monomorphize/collector.rs index 2e74ebcf061e2..6dcb23da321a6 100644 --- a/src/librustc_mir/monomorphize/collector.rs +++ b/src/librustc_mir/monomorphize/collector.rs @@ -345,7 +345,7 @@ fn collect_roots<'tcx>(tcx: TyCtxt<'tcx>, mode: MonoItemCollectionMode) -> Vec( +fn collect_items_rec<'a, 'tcx>( tcx: TyCtxt<'tcx>, starting_point: MonoItem<'tcx>, visited: MTRef<'_, MTLock>>>, @@ -515,7 +515,7 @@ fn check_type_length_limit<'tcx>(tcx: TyCtxt<'tcx>, instance: Instance<'tcx>) { } } -struct MirNeighborCollector<'a, 'tcx: 'a> { +struct MirNeighborCollector<'a, 'tcx> { tcx: TyCtxt<'tcx>, body: &'a mir::Body<'tcx>, output: &'a mut Vec>, diff --git a/src/librustc_mir/monomorphize/partitioning.rs b/src/librustc_mir/monomorphize/partitioning.rs index a821cb2cfdad2..59e95215df2a4 100644 --- a/src/librustc_mir/monomorphize/partitioning.rs +++ b/src/librustc_mir/monomorphize/partitioning.rs @@ -769,7 +769,7 @@ fn numbered_codegen_unit_name( fn debug_dump<'a, 'b, 'tcx, I>(tcx: TyCtxt<'tcx>, label: &str, cgus: I) where I: Iterator>, - 'tcx: 'a + 'b, + 'tcx, { if cfg!(debug_assertions) { debug!("{}", label); @@ -794,7 +794,7 @@ where } #[inline(never)] // give this a place in the profiler -fn assert_symbols_are_distinct<'a, 'tcx: 'a, I>(tcx: TyCtxt<'tcx>, mono_items: I) +fn assert_symbols_are_distinct<'a, 'tcx, I>(tcx: TyCtxt<'tcx>, mono_items: I) where I: Iterator>, { diff --git a/src/librustc_mir/shim.rs b/src/librustc_mir/shim.rs index f5a22ea09315f..c04672f8331e6 100644 --- a/src/librustc_mir/shim.rs +++ b/src/librustc_mir/shim.rs @@ -248,7 +248,7 @@ fn build_drop_shim<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId, ty: Option>) body } -pub struct DropShimElaborator<'a, 'tcx: 'a> { +pub struct DropShimElaborator<'a, 'tcx> { pub body: &'a Body<'tcx>, pub patch: MirPatch<'tcx>, pub tcx: TyCtxt<'tcx>, diff --git a/src/librustc_mir/transform/check_unsafety.rs b/src/librustc_mir/transform/check_unsafety.rs index 32153f7bcd9cc..9c78d761cb2ca 100644 --- a/src/librustc_mir/transform/check_unsafety.rs +++ b/src/librustc_mir/transform/check_unsafety.rs @@ -18,7 +18,7 @@ use std::ops::Bound; use crate::util; -pub struct UnsafetyChecker<'a, 'tcx: 'a> { +pub struct UnsafetyChecker<'a, 'tcx> { body: &'a Body<'tcx>, const_context: bool, min_const_fn: bool, diff --git a/src/librustc_mir/transform/elaborate_drops.rs b/src/librustc_mir/transform/elaborate_drops.rs index 584a2fd1341d3..d805c66e3c360 100644 --- a/src/librustc_mir/transform/elaborate_drops.rs +++ b/src/librustc_mir/transform/elaborate_drops.rs @@ -164,7 +164,7 @@ impl InitializationData { } } -struct Elaborator<'a, 'b: 'a, 'tcx: 'b> { +struct Elaborator<'a, 'b, 'tcx> { init_data: &'a InitializationData, ctxt: &'a mut ElaborateDropsCtxt<'b, 'tcx>, } @@ -285,7 +285,7 @@ impl<'a, 'b, 'tcx> DropElaborator<'a, 'tcx> for Elaborator<'a, 'b, 'tcx> { } } -struct ElaborateDropsCtxt<'a, 'tcx: 'a> { +struct ElaborateDropsCtxt<'a, 'tcx> { tcx: TyCtxt<'tcx>, body: &'a Body<'tcx>, env: &'a MoveDataParamEnv<'tcx>, diff --git a/src/librustc_mir/transform/generator.rs b/src/librustc_mir/transform/generator.rs index 9c7aedc12a27b..6be54aa629de7 100644 --- a/src/librustc_mir/transform/generator.rs +++ b/src/librustc_mir/transform/generator.rs @@ -616,7 +616,7 @@ fn compute_storage_conflicts( storage_conflicts } -struct StorageConflictVisitor<'body, 'tcx: 'body, 's> { +struct StorageConflictVisitor<'body, 'tcx, 's> { body: &'body Body<'tcx>, stored_locals: &'s liveness::LiveVarSet, // FIXME(tmandry): Consider using sparse bitsets here once we have good @@ -624,7 +624,7 @@ struct StorageConflictVisitor<'body, 'tcx: 'body, 's> { local_conflicts: BitMatrix, } -impl<'body, 'tcx: 'body, 's> DataflowResultsConsumer<'body, 'tcx> +impl<'body, 'tcx, 's> DataflowResultsConsumer<'body, 'tcx> for StorageConflictVisitor<'body, 'tcx, 's> { type FlowState = FlowAtLocation<'tcx, MaybeStorageLive<'body, 'tcx>>; @@ -654,7 +654,7 @@ for StorageConflictVisitor<'body, 'tcx, 's> { } } -impl<'body, 'tcx: 'body, 's> StorageConflictVisitor<'body, 'tcx, 's> { +impl<'body, 'tcx, 's> StorageConflictVisitor<'body, 'tcx, 's> { fn apply_state(&mut self, flow_state: &FlowAtLocation<'tcx, MaybeStorageLive<'body, 'tcx>>, loc: Location) { diff --git a/src/librustc_mir/transform/inline.rs b/src/librustc_mir/transform/inline.rs index 5e6f1bc15f02a..e2f98e46dba57 100644 --- a/src/librustc_mir/transform/inline.rs +++ b/src/librustc_mir/transform/inline.rs @@ -643,7 +643,7 @@ fn type_size_of<'tcx>( * Updates block indices, references to locals and other control flow * stuff. */ -struct Integrator<'a, 'tcx: 'a> { +struct Integrator<'a, 'tcx> { block_idx: usize, args: &'a [Local], local_map: IndexVec, diff --git a/src/librustc_mir/transform/mod.rs b/src/librustc_mir/transform/mod.rs index 79bb2cfe08db3..81d91dcd0a95f 100644 --- a/src/librustc_mir/transform/mod.rs +++ b/src/librustc_mir/transform/mod.rs @@ -66,7 +66,7 @@ fn mir_keys<'tcx>(tcx: TyCtxt<'tcx>, krate: CrateNum) -> &'tcx DefIdSet { // 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> { + struct GatherCtors<'a, 'tcx> { tcx: TyCtxt<'tcx>, set: &'a mut DefIdSet, } diff --git a/src/librustc_mir/transform/promote_consts.rs b/src/librustc_mir/transform/promote_consts.rs index 84d3f8f4c462b..d78adfe433c47 100644 --- a/src/librustc_mir/transform/promote_consts.rs +++ b/src/librustc_mir/transform/promote_consts.rs @@ -147,7 +147,7 @@ pub fn collect_temps(body: &Body<'_>, collector.temps } -struct Promoter<'a, 'tcx: 'a> { +struct Promoter<'a, 'tcx> { tcx: TyCtxt<'tcx>, source: &'a mut Body<'tcx>, promoted: Body<'tcx>, diff --git a/src/librustc_mir/transform/simplify.rs b/src/librustc_mir/transform/simplify.rs index ac15f52d9ec5b..f226f15c0096f 100644 --- a/src/librustc_mir/transform/simplify.rs +++ b/src/librustc_mir/transform/simplify.rs @@ -63,12 +63,12 @@ impl MirPass for SimplifyCfg { } } -pub struct CfgSimplifier<'a, 'tcx: 'a> { +pub struct CfgSimplifier<'a, 'tcx> { basic_blocks: &'a mut IndexVec>, pred_count: IndexVec } -impl<'a, 'tcx: 'a> CfgSimplifier<'a, 'tcx> { +impl<'a, 'tcx> CfgSimplifier<'a, 'tcx> { pub fn new(body: &'a mut Body<'tcx>) -> Self { let mut pred_count = IndexVec::from_elem(0u32, body.basic_blocks()); diff --git a/src/librustc_mir/transform/uniform_array_move_out.rs b/src/librustc_mir/transform/uniform_array_move_out.rs index 90b52b76155db..812a024e1d911 100644 --- a/src/librustc_mir/transform/uniform_array_move_out.rs +++ b/src/librustc_mir/transform/uniform_array_move_out.rs @@ -47,7 +47,7 @@ impl MirPass for UniformArrayMoveOut { } } -struct UniformArrayMoveOutVisitor<'a, 'tcx: 'a> { +struct UniformArrayMoveOutVisitor<'a, 'tcx> { body: &'a Body<'tcx>, patch: &'a mut MirPatch<'tcx>, tcx: TyCtxt<'tcx>, diff --git a/src/librustc_mir/util/elaborate_drops.rs b/src/librustc_mir/util/elaborate_drops.rs index 0d7d6b4094ad4..6da181ef66807 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>: fmt::Debug { type Path : Copy + fmt::Debug; fn patch(&mut self) -> &mut MirPatch<'tcx>; @@ -90,7 +90,7 @@ pub trait DropElaborator<'a, 'tcx: 'a>: fmt::Debug { } #[derive(Debug)] -struct DropCtxt<'l, 'b: 'l, 'tcx: 'b, D> +struct DropCtxt<'l, 'b, 'tcx, D> where D : DropElaborator<'b, 'tcx> + 'l { elaborator: &'l mut D, diff --git a/src/librustc_passes/loops.rs b/src/librustc_passes/loops.rs index efa4bd65c0bcd..e1e4195d6d516 100644 --- a/src/librustc_passes/loops.rs +++ b/src/librustc_passes/loops.rs @@ -39,7 +39,7 @@ enum Context { } #[derive(Copy, Clone)] -struct CheckLoopVisitor<'a, 'hir: 'a> { +struct CheckLoopVisitor<'a, 'hir> { sess: &'a Session, hir_map: &'a Map<'hir>, cx: Context, diff --git a/src/librustc_passes/rvalue_promotion.rs b/src/librustc_passes/rvalue_promotion.rs index 5397a4af8fa8f..1493d02904806 100644 --- a/src/librustc_passes/rvalue_promotion.rs +++ b/src/librustc_passes/rvalue_promotion.rs @@ -74,7 +74,7 @@ fn rvalue_promotable_map<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> &'tcx ItemLo tcx.arena.alloc(visitor.result) } -struct CheckCrateVisitor<'a, 'tcx: 'a> { +struct CheckCrateVisitor<'a, 'tcx> { tcx: TyCtxt<'tcx>, in_fn: bool, in_static: bool, diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index 9eaa6f920f085..ba834bf09aa84 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -842,7 +842,7 @@ impl DefIdVisitor<'tcx> for ReachEverythingInTheInterfaceVisitor<'_, 'tcx> { /// This pass performs remaining checks for fields in struct expressions and patterns. ////////////////////////////////////////////////////////////////////////////////////// -struct NamePrivacyVisitor<'a, 'tcx: 'a> { +struct NamePrivacyVisitor<'a, 'tcx> { tcx: TyCtxt<'tcx>, tables: &'a ty::TypeckTables<'tcx>, current_item: hir::HirId, @@ -969,7 +969,7 @@ impl<'a, 'tcx> Visitor<'tcx> for NamePrivacyVisitor<'a, 'tcx> { /// Checks are performed on "semantic" types regardless of names and their hygiene. //////////////////////////////////////////////////////////////////////////////////////////// -struct TypePrivacyVisitor<'a, 'tcx: 'a> { +struct TypePrivacyVisitor<'a, 'tcx> { tcx: TyCtxt<'tcx>, tables: &'a ty::TypeckTables<'tcx>, current_item: DefId, @@ -1202,7 +1202,7 @@ impl DefIdVisitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> { /// warnings instead of hard errors when the erroneous node is not in this old set. /////////////////////////////////////////////////////////////////////////////// -struct ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx: 'a> { +struct ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { tcx: TyCtxt<'tcx>, access_levels: &'a AccessLevels, in_variant: bool, @@ -1210,7 +1210,7 @@ struct ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx: 'a> { old_error_set: HirIdSet, } -struct ObsoleteCheckTypeForPrivatenessVisitor<'a, 'b: 'a, 'tcx: 'b> { +struct ObsoleteCheckTypeForPrivatenessVisitor<'a, 'b, 'tcx> { inner: &'a ObsoleteVisiblePrivateTypesVisitor<'b, 'tcx>, /// Whether the type refers to private types. contains_private: bool, @@ -1651,7 +1651,7 @@ impl DefIdVisitor<'tcx> for SearchInterfaceForPrivateItemsVisitor<'tcx> { } } -struct PrivateItemsInPublicInterfacesVisitor<'a, 'tcx: 'a> { +struct PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> { tcx: TyCtxt<'tcx>, has_pub_restricted: bool, old_error_set: &'a HirIdSet, diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs index e3cd2948d7af5..18ed91689ec18 100644 --- a/src/librustc_resolve/build_reduced_graph.rs +++ b/src/librustc_resolve/build_reduced_graph.rs @@ -930,7 +930,7 @@ impl<'a> Resolver<'a> { } } -pub struct BuildReducedGraphVisitor<'a, 'b: 'a> { +pub struct BuildReducedGraphVisitor<'a, 'b> { pub resolver: &'a mut Resolver<'b>, pub current_legacy_scope: LegacyScope<'b>, pub expansion: Mark, diff --git a/src/librustc_resolve/check_unused.rs b/src/librustc_resolve/check_unused.rs index 3b6179f78558b..4fee15c59b33d 100644 --- a/src/librustc_resolve/check_unused.rs +++ b/src/librustc_resolve/check_unused.rs @@ -48,7 +48,7 @@ impl<'a> UnusedImport<'a> { } } -struct UnusedImportCheckVisitor<'a, 'b: 'a> { +struct UnusedImportCheckVisitor<'a, 'b> { resolver: &'a mut Resolver<'b>, /// All the (so far) unused imports, grouped path list unused_imports: NodeMap>, diff --git a/src/librustc_resolve/diagnostics.rs b/src/librustc_resolve/diagnostics.rs index d8292eebce799..e93a2315ca321 100644 --- a/src/librustc_resolve/diagnostics.rs +++ b/src/librustc_resolve/diagnostics.rs @@ -441,7 +441,7 @@ impl<'a> Resolver<'a> { } } -impl<'a, 'b:'a> ImportResolver<'a, 'b> { +impl<'a, 'b> ImportResolver<'a, 'b> { /// Adds suggestions for a path that cannot be resolved. pub(crate) fn make_path_suggestion( &mut self, diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 7f05e0f477c2d..a127c96068549 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -1735,7 +1735,7 @@ impl<'a> ResolverArenas<'a> { } } -impl<'a, 'b: 'a> ty::DefIdTree for &'a Resolver<'b> { +impl<'a, 'b> ty::DefIdTree for &'a Resolver<'b> { fn parent(self, id: DefId) -> Option { match id.krate { LOCAL_CRATE => self.definitions.def_key(id.index).parent, diff --git a/src/librustc_resolve/macros.rs b/src/librustc_resolve/macros.rs index 2369bddf4f75f..47ed3d684b2b6 100644 --- a/src/librustc_resolve/macros.rs +++ b/src/librustc_resolve/macros.rs @@ -132,7 +132,7 @@ impl<'a> base::Resolver for Resolver<'a> { } fn resolve_dollar_crates(&mut self, fragment: &AstFragment) { - struct ResolveDollarCrates<'a, 'b: 'a> { + struct ResolveDollarCrates<'a, 'b> { resolver: &'a mut Resolver<'b> } impl<'a> Visitor<'a> for ResolveDollarCrates<'a, '_> { diff --git a/src/librustc_resolve/resolve_imports.rs b/src/librustc_resolve/resolve_imports.rs index d24d8f8c2b5b1..f69849bb4a9ee 100644 --- a/src/librustc_resolve/resolve_imports.rs +++ b/src/librustc_resolve/resolve_imports.rs @@ -644,30 +644,30 @@ struct UnresolvedImportError { suggestion: Option, } -pub struct ImportResolver<'a, 'b: 'a> { +pub struct ImportResolver<'a, 'b> { pub resolver: &'a mut Resolver<'b>, } -impl<'a, 'b: 'a> std::ops::Deref for ImportResolver<'a, 'b> { +impl<'a, 'b> std::ops::Deref for ImportResolver<'a, 'b> { type Target = Resolver<'b>; fn deref(&self) -> &Resolver<'b> { self.resolver } } -impl<'a, 'b: 'a> std::ops::DerefMut for ImportResolver<'a, 'b> { +impl<'a, 'b> std::ops::DerefMut for ImportResolver<'a, 'b> { fn deref_mut(&mut self) -> &mut Resolver<'b> { self.resolver } } -impl<'a, 'b: 'a> ty::DefIdTree for &'a ImportResolver<'a, 'b> { +impl<'a, 'b> ty::DefIdTree for &'a ImportResolver<'a, 'b> { fn parent(self, id: DefId) -> Option { self.resolver.parent(id) } } -impl<'a, 'b:'a> ImportResolver<'a, 'b> { +impl<'a, 'b> ImportResolver<'a, 'b> { // Import resolution // // This is a fixed-point algorithm. We resolve imports until our efforts diff --git a/src/librustc_save_analysis/dump_visitor.rs b/src/librustc_save_analysis/dump_visitor.rs index f9dd4436434f5..a7f46e876830c 100644 --- a/src/librustc_save_analysis/dump_visitor.rs +++ b/src/librustc_save_analysis/dump_visitor.rs @@ -75,7 +75,7 @@ macro_rules! access_from_vis { }; } -pub struct DumpVisitor<'l, 'tcx: 'l, 'll, O: DumpOutput> { +pub struct DumpVisitor<'l, 'tcx, 'll, O: DumpOutput> { save_ctxt: SaveContext<'l, 'tcx>, tcx: TyCtxt<'tcx>, dumper: &'ll mut JsonDumper, @@ -92,7 +92,7 @@ pub struct DumpVisitor<'l, 'tcx: 'l, 'll, O: DumpOutput> { // macro_calls: FxHashSet, } -impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> { +impl<'l, 'tcx, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> { pub fn new( save_ctxt: SaveContext<'l, 'tcx>, dumper: &'ll mut JsonDumper, @@ -1311,7 +1311,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> { } } -impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> Visitor<'l> for DumpVisitor<'l, 'tcx, 'll, O> { +impl<'l, 'tcx, 'll, O: DumpOutput + 'll> Visitor<'l> for DumpVisitor<'l, 'tcx, 'll, O> { fn visit_mod(&mut self, m: &'l ast::Mod, span: Span, attrs: &[ast::Attribute], id: NodeId) { // Since we handle explicit modules ourselves in visit_item, this should // only get called for the root module of a crate. diff --git a/src/librustc_save_analysis/lib.rs b/src/librustc_save_analysis/lib.rs index fb9f872880eac..4882a4240c831 100644 --- a/src/librustc_save_analysis/lib.rs +++ b/src/librustc_save_analysis/lib.rs @@ -51,7 +51,7 @@ use rls_data::config::Config; use log::{debug, error, info}; -pub struct SaveContext<'l, 'tcx: 'l> { +pub struct SaveContext<'l, 'tcx> { tcx: TyCtxt<'tcx>, tables: &'l ty::TypeckTables<'tcx>, access_levels: &'l AccessLevels, @@ -67,7 +67,7 @@ pub enum Data { RelationData(Relation, Impl), } -impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> { +impl<'l, 'tcx> SaveContext<'l, 'tcx> { fn span_from_span(&self, span: Span) -> SpanData { use rls_span::{Column, Row}; @@ -960,7 +960,7 @@ impl<'l> PathCollector<'l> { } } -impl<'l, 'a: 'l> Visitor<'a> for PathCollector<'l> { +impl<'l, 'a> Visitor<'a> for PathCollector<'l> { fn visit_pat(&mut self, p: &'a ast::Pat) { match p.node { PatKind::Struct(ref path, ..) => { diff --git a/src/librustc_traits/chalk_context/mod.rs b/src/librustc_traits/chalk_context/mod.rs index 2b678919ce41b..bbb0825ee082a 100644 --- a/src/librustc_traits/chalk_context/mod.rs +++ b/src/librustc_traits/chalk_context/mod.rs @@ -56,7 +56,7 @@ crate struct ChalkContext<'tcx> { } #[derive(Copy, Clone)] -crate struct ChalkInferenceContext<'cx, 'tcx: 'cx> { +crate struct ChalkInferenceContext<'cx, 'tcx> { infcx: &'cx InferCtxt<'cx, 'tcx>, } diff --git a/src/librustc_traits/chalk_context/resolvent_ops.rs b/src/librustc_traits/chalk_context/resolvent_ops.rs index 1e8b02659dc6a..59c01b8b1b7b1 100644 --- a/src/librustc_traits/chalk_context/resolvent_ops.rs +++ b/src/librustc_traits/chalk_context/resolvent_ops.rs @@ -139,7 +139,7 @@ impl context::ResolventOps, ChalkArenas<'tcx>> } } -struct AnswerSubstitutor<'cx, 'tcx: 'cx> { +struct AnswerSubstitutor<'cx, 'tcx> { infcx: &'cx InferCtxt<'cx, 'tcx>, environment: Environment<'tcx>, answer_subst: CanonicalVarValues<'tcx>, diff --git a/src/librustc_traits/chalk_context/unify.rs b/src/librustc_traits/chalk_context/unify.rs index d66faa92336fe..1f9090324414b 100644 --- a/src/librustc_traits/chalk_context/unify.rs +++ b/src/librustc_traits/chalk_context/unify.rs @@ -42,7 +42,7 @@ crate fn unify<'me, 'tcx, T: Relate<'tcx>>( }) } -struct ChalkTypeRelatingDelegate<'me, 'tcx: 'me> { +struct ChalkTypeRelatingDelegate<'me, 'tcx> { infcx: &'me InferCtxt<'me, 'tcx>, environment: Environment<'tcx>, goals: Vec>>, diff --git a/src/librustc_traits/type_op.rs b/src/librustc_traits/type_op.rs index dcbb0dffba8f2..cb30eba5b0505 100644 --- a/src/librustc_traits/type_op.rs +++ b/src/librustc_traits/type_op.rs @@ -56,7 +56,7 @@ fn type_op_ascribe_user_type<'tcx>( }) } -struct AscribeUserTypeCx<'me, 'tcx: 'me> { +struct AscribeUserTypeCx<'me, 'tcx> { infcx: &'me InferCtxt<'me, 'tcx>, param_env: ParamEnv<'tcx>, fulfill_cx: &'me mut dyn TraitEngine<'tcx>, diff --git a/src/librustc_typeck/check/autoderef.rs b/src/librustc_typeck/check/autoderef.rs index dc4969d7ad2db..ecdf28e5d7f0b 100644 --- a/src/librustc_typeck/check/autoderef.rs +++ b/src/librustc_typeck/check/autoderef.rs @@ -20,7 +20,7 @@ enum AutoderefKind { Overloaded, } -pub struct Autoderef<'a, 'tcx: 'a> { +pub struct Autoderef<'a, 'tcx> { infcx: &'a InferCtxt<'a, 'tcx>, body_id: hir::HirId, param_env: ty::ParamEnv<'tcx>, diff --git a/src/librustc_typeck/check/generator_interior.rs b/src/librustc_typeck/check/generator_interior.rs index 5f9aa5fbabe04..ac2dcbadad824 100644 --- a/src/librustc_typeck/check/generator_interior.rs +++ b/src/librustc_typeck/check/generator_interior.rs @@ -12,7 +12,7 @@ use syntax_pos::Span; use super::FnCtxt; use crate::util::nodemap::FxHashMap; -struct InteriorVisitor<'a, 'tcx: 'a> { +struct InteriorVisitor<'a, 'tcx> { fcx: &'a FnCtxt<'a, 'tcx>, types: FxHashMap, usize>, region_scope_tree: &'tcx region::ScopeTree, diff --git a/src/librustc_typeck/check/method/suggest.rs b/src/librustc_typeck/check/method/suggest.rs index 29b4fee138e82..5943302c7088f 100644 --- a/src/librustc_typeck/check/method/suggest.rs +++ b/src/librustc_typeck/check/method/suggest.rs @@ -787,7 +787,7 @@ fn compute_all_traits<'tcx>(tcx: TyCtxt<'tcx>) -> Vec { // Crate-local: - struct Visitor<'a, 'tcx: 'a> { + struct Visitor<'a, 'tcx> { map: &'a hir_map::Map<'tcx>, traits: &'a mut Vec, } diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 10bfe9e034d32..864f19933a5f1 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -160,7 +160,7 @@ pub struct LocalTy<'tcx> { /// A wrapper for `InferCtxt`'s `in_progress_tables` field. #[derive(Copy, Clone)] -struct MaybeInProgressTables<'a, 'tcx: 'a> { +struct MaybeInProgressTables<'a, 'tcx> { maybe_tables: Option<&'a RefCell>>, } @@ -193,7 +193,7 @@ impl<'a, 'tcx> MaybeInProgressTables<'a, 'tcx> { /// Here, the function `foo()` and the closure passed to /// `bar()` will each have their own `FnCtxt`, but they will /// share the inherited fields. -pub struct Inherited<'a, 'tcx: 'a> { +pub struct Inherited<'a, 'tcx> { infcx: InferCtxt<'a, 'tcx>, tables: MaybeInProgressTables<'a, 'tcx>, @@ -512,7 +512,7 @@ impl<'tcx> EnclosingBreakables<'tcx> { } } -pub struct FnCtxt<'a, 'tcx: 'a> { +pub struct FnCtxt<'a, 'tcx> { body_id: hir::HirId, /// The parameter environment used for proving trait obligations @@ -919,7 +919,7 @@ fn check_abi<'tcx>(tcx: TyCtxt<'tcx>, span: Span, abi: Abi) { } } -struct GatherLocalsVisitor<'a, 'tcx: 'a> { +struct GatherLocalsVisitor<'a, 'tcx> { fcx: &'a FnCtxt<'a, 'tcx>, parent_id: hir::HirId, } diff --git a/src/librustc_typeck/check/writeback.rs b/src/librustc_typeck/check/writeback.rs index ffc323f28b675..6a95dec1c81bc 100644 --- a/src/librustc_typeck/check/writeback.rs +++ b/src/librustc_typeck/check/writeback.rs @@ -96,7 +96,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // there, it applies a few ad-hoc checks that were not convenient to // do elsewhere. -struct WritebackCx<'cx, 'tcx: 'cx> { +struct WritebackCx<'cx, 'tcx> { fcx: &'cx FnCtxt<'cx, 'tcx>, tables: ty::TypeckTables<'tcx>, @@ -787,7 +787,7 @@ impl Locatable for hir::HirId { // The Resolver. This is the type folding engine that detects // unresolved types and so forth. -struct Resolver<'cx, 'tcx: 'cx> { +struct Resolver<'cx, 'tcx> { tcx: TyCtxt<'tcx>, infcx: &'cx InferCtxt<'cx, 'tcx>, span: &'cx dyn Locatable, diff --git a/src/librustc_typeck/check_unused.rs b/src/librustc_typeck/check_unused.rs index dda86778f2727..8f89a77bd1a3a 100644 --- a/src/librustc_typeck/check_unused.rs +++ b/src/librustc_typeck/check_unused.rs @@ -194,7 +194,7 @@ fn unused_crates_lint<'tcx>(tcx: TyCtxt<'tcx>) { } } -struct CollectExternCrateVisitor<'a, 'tcx: 'a> { +struct CollectExternCrateVisitor<'a, 'tcx> { tcx: TyCtxt<'tcx>, crates_to_lint: &'a mut Vec, } diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index 5606d9c0ce815..70deca9623b45 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -1786,7 +1786,7 @@ fn impl_polarity<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> hir::ImplPolarity { /// 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: 'a>( +fn early_bound_lifetimes_from_generics<'a, 'tcx>( tcx: TyCtxt<'tcx>, generics: &'a hir::Generics, ) -> impl Iterator + Captures<'tcx> { diff --git a/src/librustc_typeck/outlives/implicit_infer.rs b/src/librustc_typeck/outlives/implicit_infer.rs index a2f9a2bb50a2a..1c2bb8c2f0b28 100644 --- a/src/librustc_typeck/outlives/implicit_infer.rs +++ b/src/librustc_typeck/outlives/implicit_infer.rs @@ -43,7 +43,7 @@ pub fn infer_predicates<'tcx>( global_inferred_outlives } -pub struct InferVisitor<'cx, 'tcx: 'cx> { +pub struct InferVisitor<'cx, 'tcx> { tcx: TyCtxt<'tcx>, global_inferred_outlives: &'cx mut FxHashMap>, predicates_added: &'cx mut bool, diff --git a/src/librustc_typeck/variance/constraints.rs b/src/librustc_typeck/variance/constraints.rs index 59213ac3c1342..36f0dbcd2fcbd 100644 --- a/src/librustc_typeck/variance/constraints.rs +++ b/src/librustc_typeck/variance/constraints.rs @@ -12,7 +12,7 @@ use rustc::hir::itemlikevisit::ItemLikeVisitor; use super::terms::*; use super::terms::VarianceTerm::*; -pub struct ConstraintContext<'a, 'tcx: 'a> { +pub struct ConstraintContext<'a, 'tcx> { pub terms_cx: TermsContext<'a, 'tcx>, // These are pointers to common `ConstantTerm` instances diff --git a/src/librustc_typeck/variance/solve.rs b/src/librustc_typeck/variance/solve.rs index 8edf3c52ccc22..3851b918c4855 100644 --- a/src/librustc_typeck/variance/solve.rs +++ b/src/librustc_typeck/variance/solve.rs @@ -14,7 +14,7 @@ use super::terms::*; use super::terms::VarianceTerm::*; use super::xform::*; -struct SolveContext<'a, 'tcx: 'a> { +struct SolveContext<'a, 'tcx> { terms_cx: TermsContext<'a, 'tcx>, constraints: Vec>, diff --git a/src/librustc_typeck/variance/terms.rs b/src/librustc_typeck/variance/terms.rs index 99f87ccb6f65e..3f6eadeac3334 100644 --- a/src/librustc_typeck/variance/terms.rs +++ b/src/librustc_typeck/variance/terms.rs @@ -47,7 +47,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 struct TermsContext<'a, 'tcx> { pub tcx: TyCtxt<'tcx>, pub arena: &'a TypedArena>, diff --git a/src/librustdoc/passes/check_code_block_syntax.rs b/src/librustdoc/passes/check_code_block_syntax.rs index 6d51278b4e5e8..f6ab1290da37c 100644 --- a/src/librustdoc/passes/check_code_block_syntax.rs +++ b/src/librustdoc/passes/check_code_block_syntax.rs @@ -20,7 +20,7 @@ pub fn check_code_block_syntax(krate: clean::Crate, cx: &DocContext<'_>) -> clea SyntaxChecker { cx }.fold_crate(krate) } -struct SyntaxChecker<'a, 'tcx: 'a> { +struct SyntaxChecker<'a, 'tcx> { cx: &'a DocContext<'tcx>, } diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index 9a9fd941240bc..ddce5cab1ebcb 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -878,7 +878,7 @@ impl Tester for Collector { } } -struct HirCollector<'a, 'hir: 'a> { +struct HirCollector<'a, 'hir> { sess: &'a session::Session, collector: &'a mut Collector, map: &'a hir::map::Map<'hir>, diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs index 8f926e6dd2909..2c3bea80e349b 100644 --- a/src/libserialize/json.rs +++ b/src/libserialize/json.rs @@ -2502,7 +2502,7 @@ impl ToJson for Option { } } -struct FormatShim<'a, 'b: 'a> { +struct FormatShim<'a, 'b> { inner: &'a mut fmt::Formatter<'b>, } diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 3fa96c60bff67..d433e6c5a896f 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -242,7 +242,7 @@ impl Invocation { } } -pub struct MacroExpander<'a, 'b:'a> { +pub struct MacroExpander<'a, 'b> { pub cx: &'a mut ExtCtxt<'b>, monotonic: bool, // cf. `cx.monotonic_expander()` } @@ -1031,7 +1031,7 @@ impl<'a> Parser<'a> { } } -struct InvocationCollector<'a, 'b: 'a> { +struct InvocationCollector<'a, 'b> { cx: &'a mut ExtCtxt<'b>, cfg: StripUnconfigured<'a>, invocations: Vec, diff --git a/src/libsyntax/ext/placeholders.rs b/src/libsyntax/ext/placeholders.rs index c56c156182bd6..b2b8bfb09b45e 100644 --- a/src/libsyntax/ext/placeholders.rs +++ b/src/libsyntax/ext/placeholders.rs @@ -69,7 +69,7 @@ pub fn placeholder(kind: AstFragmentKind, id: ast::NodeId) -> AstFragment { } } -pub struct PlaceholderExpander<'a, 'b: 'a> { +pub struct PlaceholderExpander<'a, 'b> { expanded_fragments: FxHashMap, cx: &'a mut ExtCtxt<'b>, monotonic: bool, diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index 4758b6a50e520..d5da4c920bc4f 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -156,7 +156,7 @@ type NamedMatchVec = SmallVec<[NamedMatch; 4]>; /// all the elements in that `SmallVec` strictly outlive the root stack slot /// lifetime. By separating `'tt` from `'root`, we can show that. #[derive(Clone)] -struct MatcherPos<'root, 'tt: 'root> { +struct MatcherPos<'root, 'tt> { /// The token or sequence of tokens that make up the matcher top_elts: TokenTreeOrTokenTreeSlice<'tt>, @@ -233,7 +233,7 @@ impl<'root, 'tt> MatcherPos<'root, 'tt> { // Therefore, the initial MatcherPos is always allocated on the stack, // subsequent ones (of which there aren't that many) are allocated on the heap, // and this type is used to encapsulate both cases. -enum MatcherPosHandle<'root, 'tt: 'root> { +enum MatcherPosHandle<'root, 'tt> { Ref(&'root mut MatcherPos<'root, 'tt>), Box(Box>), } diff --git a/src/libsyntax_ext/deriving/generic/mod.rs b/src/libsyntax_ext/deriving/generic/mod.rs index 8b719b5477c65..3edf7726ec610 100644 --- a/src/libsyntax_ext/deriving/generic/mod.rs +++ b/src/libsyntax_ext/deriving/generic/mod.rs @@ -346,7 +346,7 @@ fn find_type_parameters(ty: &ast::Ty, -> Vec> { use syntax::visit; - struct Visitor<'a, 'b: 'a> { + struct Visitor<'a, 'b> { cx: &'a ExtCtxt<'b>, span: Span, ty_param_names: &'a [ast::Name], diff --git a/src/libsyntax_ext/format.rs b/src/libsyntax_ext/format.rs index f44a6e7efa4f1..a5f96559ca8a2 100644 --- a/src/libsyntax_ext/format.rs +++ b/src/libsyntax_ext/format.rs @@ -31,7 +31,7 @@ enum Position { Named(Symbol), } -struct Context<'a, 'b: 'a> { +struct Context<'a, 'b> { ecx: &'a mut ExtCtxt<'b>, /// The macro's call site. References to unstable formatting internals must /// use this span to pass the stability checker. From 1d0cb40908534beb9eb2b181f0210043e91caae4 Mon Sep 17 00:00:00 2001 From: Eduard-Mihai Burtescu Date: Fri, 14 Jun 2019 19:43:53 +0300 Subject: [PATCH 2/6] rustc: remove leftover lifetimes with no bounds from where clauses. --- src/librustc/dep_graph/dep_node.rs | 2 -- src/librustc/infer/lattice.rs | 1 - src/librustc/traits/select.rs | 1 - src/librustc/ty/query/on_disk_cache.rs | 1 - src/librustc_lint/builtin.rs | 2 +- src/librustc_metadata/creader.rs | 5 +---- src/librustc_mir/borrow_check/mod.rs | 2 +- .../borrow_check/nll/type_check/liveness/trace.rs | 14 ++------------ src/librustc_mir/build/matches/mod.rs | 2 +- src/librustc_mir/hair/pattern/_match.rs | 4 +--- src/librustc_mir/monomorphize/partitioning.rs | 1 - 11 files changed, 7 insertions(+), 28 deletions(-) diff --git a/src/librustc/dep_graph/dep_node.rs b/src/librustc/dep_graph/dep_node.rs index e8f83093bda11..2de52e0cfc5c3 100644 --- a/src/librustc/dep_graph/dep_node.rs +++ b/src/librustc/dep_graph/dep_node.rs @@ -207,8 +207,6 @@ macro_rules! define_dep_nodes { pub fn new<'a, 'tcx>(tcx: TyCtxt<'tcx>, dep: DepConstructor<'tcx>) -> DepNode - where 'tcx, - 'tcx { match dep { $( diff --git a/src/librustc/infer/lattice.rs b/src/librustc/infer/lattice.rs index a3372f5037917..e55ce345bd9d3 100644 --- a/src/librustc/infer/lattice.rs +++ b/src/librustc/infer/lattice.rs @@ -48,7 +48,6 @@ pub fn super_lattice_tys<'a, 'tcx, L>( ) -> RelateResult<'tcx, Ty<'tcx>> where L: LatticeDir<'a, 'tcx>, - 'tcx, { debug!("{}.lattice_tys({:?}, {:?})", this.tag(), diff --git a/src/librustc/traits/select.rs b/src/librustc/traits/select.rs index c698b0c293314..0e22db2b9f13d 100644 --- a/src/librustc/traits/select.rs +++ b/src/librustc/traits/select.rs @@ -697,7 +697,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { ) -> Result where I: IntoIterator>, - 'tcx, { let mut result = EvaluatedToOk; for obligation in predicates { diff --git a/src/librustc/ty/query/on_disk_cache.rs b/src/librustc/ty/query/on_disk_cache.rs index 5781f40b93ad3..1684dac490f3c 100644 --- a/src/librustc/ty/query/on_disk_cache.rs +++ b/src/librustc/ty/query/on_disk_cache.rs @@ -511,7 +511,6 @@ fn decode_tagged<'a, 'tcx, D, T, V>(decoder: &mut D, where T: Decodable + Eq + ::std::fmt::Debug, V: Decodable, D: DecoderWithPosition, - 'tcx, { let start_pos = decoder.position(); diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index c6f361855c7d1..8ed4a556ea97c 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -1088,7 +1088,7 @@ impl TypeAliasBounds { // We use a HIR visitor to walk the type. use rustc::hir::intravisit::{self, Visitor}; - struct WalkAssocTypes<'a, 'db> where 'db { + struct WalkAssocTypes<'a, 'db> { err: &'a mut DiagnosticBuilder<'db> } impl<'a, 'db, 'v> Visitor<'v> for WalkAssocTypes<'a, 'db> { diff --git a/src/librustc_metadata/creader.rs b/src/librustc_metadata/creader.rs index ff523c7b68a90..4564f22025335 100644 --- a/src/librustc_metadata/creader.rs +++ b/src/librustc_metadata/creader.rs @@ -293,10 +293,7 @@ impl<'a> CrateLoader<'a> { &mut self, locate_ctxt: &mut locator::Context<'b>, path_kind: PathKind, - ) -> Option<(LoadResult, Option)> - where - 'a - { + ) -> Option<(LoadResult, Option)> { // Use a new locator Context so trying to load a proc macro doesn't affect the error // message we emit let mut proc_macro_locator = locate_ctxt.clone(); diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs index a21d585a13ca3..288d69f097d3d 100644 --- a/src/librustc_mir/borrow_check/mod.rs +++ b/src/librustc_mir/borrow_check/mod.rs @@ -1693,7 +1693,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { fn move_path_closest_to<'a>( &mut self, place: &'a Place<'tcx>, - ) -> Result<(&'a Place<'tcx>, MovePathIndex), NoMovePathFound> where 'cx { + ) -> Result<(&'a Place<'tcx>, MovePathIndex), NoMovePathFound> { let mut last_prefix = place; for prefix in self.prefixes(place, PrefixSet::All) { if let Some(mpi) = self.move_path_for_place(prefix) { diff --git a/src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs b/src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs index 2d65eb021d388..f1d568f0cf24c 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs @@ -58,12 +58,7 @@ pub(super) fn trace( } /// Contextual state for the type-liveness generator. -struct LivenessContext<'me, 'typeck, 'flow, 'tcx> -where - 'typeck, - 'flow, - 'tcx, -{ +struct LivenessContext<'me, 'typeck, 'flow, 'tcx> { /// Current type-checker, giving us our inference context etc. typeck: &'me mut TypeChecker<'typeck, 'tcx>, @@ -96,12 +91,7 @@ struct DropData<'tcx> { region_constraint_data: Option>>>, } -struct LivenessResults<'me, 'typeck, 'flow, 'tcx> -where - 'typeck, - 'flow, - 'tcx, -{ +struct LivenessResults<'me, 'typeck, 'flow, 'tcx> { cx: LivenessContext<'me, 'typeck, 'flow, 'tcx>, /// Set of points that define the current local. diff --git a/src/librustc_mir/build/matches/mod.rs b/src/librustc_mir/build/matches/mod.rs index 54f935231827a..aa576030ef1dd 100644 --- a/src/librustc_mir/build/matches/mod.rs +++ b/src/librustc_mir/build/matches/mod.rs @@ -1691,7 +1691,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { &mut self, block: BasicBlock, bindings: impl IntoIterator>, - ) where 'tcx { + ) { debug!("bind_matched_candidate_for_arm_body(block={:?})", block); let re_erased = self.hir.tcx().lifetimes.re_erased; diff --git a/src/librustc_mir/hair/pattern/_match.rs b/src/librustc_mir/hair/pattern/_match.rs index 22bd802c1fab7..84e23734be0e1 100644 --- a/src/librustc_mir/hair/pattern/_match.rs +++ b/src/librustc_mir/hair/pattern/_match.rs @@ -392,9 +392,7 @@ impl<'a, 'tcx> MatchCheckCtxt<'a, 'tcx> { } } - fn is_non_exhaustive_variant<'p>(&self, pattern: &'p Pattern<'tcx>) -> bool - where 'a - { + fn is_non_exhaustive_variant<'p>(&self, pattern: &'p Pattern<'tcx>) -> bool { match *pattern.kind { PatternKind::Variant { adt_def, variant_index, .. } => { let ref variant = adt_def.variants[variant_index]; diff --git a/src/librustc_mir/monomorphize/partitioning.rs b/src/librustc_mir/monomorphize/partitioning.rs index 59e95215df2a4..0337f3f1da7b0 100644 --- a/src/librustc_mir/monomorphize/partitioning.rs +++ b/src/librustc_mir/monomorphize/partitioning.rs @@ -769,7 +769,6 @@ fn numbered_codegen_unit_name( fn debug_dump<'a, 'b, 'tcx, I>(tcx: TyCtxt<'tcx>, label: &str, cgus: I) where I: Iterator>, - 'tcx, { if cfg!(debug_assertions) { debug!("{}", label); From 356a37d8d1e9c62481970c36ef45fe7f4f936549 Mon Sep 17 00:00:00 2001 From: Eduard-Mihai Burtescu Date: Sun, 16 Jun 2019 12:33:21 +0300 Subject: [PATCH 3/6] rustc: remove unused lifetimes. --- src/librustc/dep_graph/dep_node.rs | 2 +- src/librustc/middle/liveness.rs | 2 +- src/librustc/traits/select.rs | 2 +- src/librustc/ty/query/on_disk_cache.rs | 2 +- src/librustc_codegen_llvm/lib.rs | 2 +- src/librustc_codegen_ssa/traits/backend.rs | 2 +- src/librustc_mir/hair/cx/to_ref.rs | 12 ++++++------ src/librustc_mir/hair/pattern/_match.rs | 8 ++++---- src/librustc_mir/monomorphize/collector.rs | 2 +- 9 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/librustc/dep_graph/dep_node.rs b/src/librustc/dep_graph/dep_node.rs index 2de52e0cfc5c3..82b0e50b50c48 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, 'tcx>(tcx: TyCtxt<'tcx>, + pub fn new<'tcx>(tcx: TyCtxt<'tcx>, dep: DepConstructor<'tcx>) -> DepNode { diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs index 36411f81f1a29..dc6fa066071a2 100644 --- a/src/librustc/middle/liveness.rs +++ b/src/librustc/middle/liveness.rs @@ -352,7 +352,7 @@ impl IrMaps<'tcx> { } } -fn visit_fn<'a, 'tcx>( +fn visit_fn<'tcx>( ir: &mut IrMaps<'tcx>, fk: FnKind<'tcx>, decl: &'tcx hir::FnDecl, diff --git a/src/librustc/traits/select.rs b/src/librustc/traits/select.rs index 0e22db2b9f13d..645b6f418dcbd 100644 --- a/src/librustc/traits/select.rs +++ b/src/librustc/traits/select.rs @@ -690,7 +690,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { /// Evaluates the predicates in `predicates` recursively. Note that /// this applies projections in the predicates, and therefore /// is run within an inference probe. - fn evaluate_predicates_recursively<'a, 'o, I>( + fn evaluate_predicates_recursively<'o, I>( &mut self, stack: TraitObligationStackList<'o, 'tcx>, predicates: I, diff --git a/src/librustc/ty/query/on_disk_cache.rs b/src/librustc/ty/query/on_disk_cache.rs index 1684dac490f3c..5349b7dbda597 100644 --- a/src/librustc/ty/query/on_disk_cache.rs +++ b/src/librustc/ty/query/on_disk_cache.rs @@ -505,7 +505,7 @@ impl<'a, 'tcx> DecoderWithPosition for CacheDecoder<'a, 'tcx> { // Decode something that was encoded with encode_tagged() and verify that the // tag matches and the correct amount of bytes was read. -fn decode_tagged<'a, 'tcx, D, T, V>(decoder: &mut D, +fn decode_tagged(decoder: &mut D, expected_tag: T) -> Result where T: Decodable + Eq + ::std::fmt::Debug, diff --git a/src/librustc_codegen_llvm/lib.rs b/src/librustc_codegen_llvm/lib.rs index a8a998a4d9564..1eb6e9a5283bd 100644 --- a/src/librustc_codegen_llvm/lib.rs +++ b/src/librustc_codegen_llvm/lib.rs @@ -125,7 +125,7 @@ impl ExtraBackendMethods for LlvmCodegenBackend { ) { unsafe { allocator::codegen(tcx, mods, kind) } } - fn compile_codegen_unit<'a, 'tcx>(&self, tcx: TyCtxt<'tcx>, cgu_name: InternedString) { + fn compile_codegen_unit<'tcx>(&self, tcx: TyCtxt<'tcx>, cgu_name: InternedString) { base::compile_codegen_unit(tcx, cgu_name); } fn target_machine_factory( diff --git a/src/librustc_codegen_ssa/traits/backend.rs b/src/librustc_codegen_ssa/traits/backend.rs index f2edff2faacee..414871be6116e 100644 --- a/src/librustc_codegen_ssa/traits/backend.rs +++ b/src/librustc_codegen_ssa/traits/backend.rs @@ -44,7 +44,7 @@ pub trait ExtraBackendMethods: CodegenBackend + WriteBackendMethods + Sized + Se mods: &mut Self::Module, kind: AllocatorKind, ); - fn compile_codegen_unit<'a, 'tcx>(&self, tcx: TyCtxt<'tcx>, cgu_name: InternedString); + fn compile_codegen_unit<'tcx>(&self, tcx: TyCtxt<'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_mir/hair/cx/to_ref.rs b/src/librustc_mir/hair/cx/to_ref.rs index d044b1faedfa1..2daa8e3cb707d 100644 --- a/src/librustc_mir/hair/cx/to_ref.rs +++ b/src/librustc_mir/hair/cx/to_ref.rs @@ -8,7 +8,7 @@ pub trait ToRef { fn to_ref(self) -> Self::Output; } -impl<'a, 'tcx> ToRef for &'tcx hir::Expr { +impl<'tcx> ToRef for &'tcx hir::Expr { type Output = ExprRef<'tcx>; fn to_ref(self) -> ExprRef<'tcx> { @@ -16,7 +16,7 @@ impl<'a, 'tcx> ToRef for &'tcx hir::Expr { } } -impl<'a, 'tcx> ToRef for &'tcx P { +impl<'tcx> ToRef for &'tcx P { type Output = ExprRef<'tcx>; fn to_ref(self) -> ExprRef<'tcx> { @@ -24,7 +24,7 @@ impl<'a, 'tcx> ToRef for &'tcx P { } } -impl<'a, 'tcx> ToRef for Expr<'tcx> { +impl<'tcx> ToRef for Expr<'tcx> { type Output = ExprRef<'tcx>; fn to_ref(self) -> ExprRef<'tcx> { @@ -32,7 +32,7 @@ impl<'a, 'tcx> ToRef for Expr<'tcx> { } } -impl<'a, 'tcx, T, U> ToRef for &'tcx Option +impl<'tcx, T, U> ToRef for &'tcx Option where &'tcx T: ToRef { type Output = Option; @@ -42,7 +42,7 @@ impl<'a, 'tcx, T, U> ToRef for &'tcx Option } } -impl<'a, 'tcx, T, U> ToRef for &'tcx Vec +impl<'tcx, T, U> ToRef for &'tcx Vec where &'tcx T: ToRef { type Output = Vec; @@ -52,7 +52,7 @@ impl<'a, 'tcx, T, U> ToRef for &'tcx Vec } } -impl<'a, 'tcx, T, U> ToRef for &'tcx P<[T]> +impl<'tcx, T, U> ToRef for &'tcx P<[T]> where &'tcx T: ToRef { type Output = Vec; diff --git a/src/librustc_mir/hair/pattern/_match.rs b/src/librustc_mir/hair/pattern/_match.rs index 84e23734be0e1..e4cff5861ca50 100644 --- a/src/librustc_mir/hair/pattern/_match.rs +++ b/src/librustc_mir/hair/pattern/_match.rs @@ -983,7 +983,7 @@ enum MissingCtors<'tcx> { // (The split logic gives a performance win, because we always need to know if // the set is empty, but we rarely need the full set, and it can be expensive // to compute the full set.) -fn compute_missing_ctors<'a, 'tcx>( +fn compute_missing_ctors<'tcx>( info: MissingCtorsInfo, tcx: TyCtxt<'tcx>, all_ctors: &Vec>, @@ -1518,7 +1518,7 @@ fn should_treat_range_exhaustively(tcx: TyCtxt<'tcx>, ctor: &Constructor<'tcx>) /// boundaries for each interval range, sort them, then create constructors for each new interval /// between every pair of boundary points. (This essentially sums up to performing the intuitive /// merging operation depicted above.) -fn split_grouped_constructors<'p, 'a, 'tcx>( +fn split_grouped_constructors<'p, 'tcx>( tcx: TyCtxt<'tcx>, ctors: Vec>, &Matrix(ref m): &Matrix<'p, 'tcx>, @@ -1596,7 +1596,7 @@ fn split_grouped_constructors<'p, 'a, 'tcx>( } /// Checks whether there exists any shared value in either `ctor` or `pat` by intersecting them. -fn constructor_intersects_pattern<'p, 'a, 'tcx>( +fn constructor_intersects_pattern<'p, 'tcx>( tcx: TyCtxt<'tcx>, ctor: &Constructor<'tcx>, pat: &'p Pattern<'tcx>, @@ -1686,7 +1686,7 @@ fn constructor_covered_by_range<'tcx>( } } -fn patterns_for_variant<'p, 'a, 'tcx>( +fn patterns_for_variant<'p, 'tcx>( subpatterns: &'p [FieldPattern<'tcx>], wild_patterns: &[&'p Pattern<'tcx>]) -> SmallVec<[&'p Pattern<'tcx>; 2]> diff --git a/src/librustc_mir/monomorphize/collector.rs b/src/librustc_mir/monomorphize/collector.rs index 6dcb23da321a6..acc786050a84e 100644 --- a/src/librustc_mir/monomorphize/collector.rs +++ b/src/librustc_mir/monomorphize/collector.rs @@ -345,7 +345,7 @@ fn collect_roots<'tcx>(tcx: TyCtxt<'tcx>, mode: MonoItemCollectionMode) -> Vec( +fn collect_items_rec<'tcx>( tcx: TyCtxt<'tcx>, starting_point: MonoItem<'tcx>, visited: MTRef<'_, MTLock>>>, From 4c4fc7512eff62f5cc63a1a30f4474db003884c9 Mon Sep 17 00:00:00 2001 From: Eduard-Mihai Burtescu Date: Sun, 16 Jun 2019 12:33:47 +0300 Subject: [PATCH 4/6] rustc: reintroduce lifetime bounds where necessary. --- src/librustc/infer/lattice.rs | 2 +- src/librustc/traits/select.rs | 4 ++-- src/librustc_codegen_ssa/base.rs | 2 +- src/librustc_codegen_ssa/mono_item.rs | 2 +- src/librustc_metadata/creader.rs | 7 +++++-- src/librustc_metadata/decoder.rs | 20 +++++++++---------- src/librustc_mir/borrow_check/mod.rs | 2 +- src/librustc_mir/build/matches/mod.rs | 2 +- src/librustc_mir/dataflow/mod.rs | 2 +- src/librustc_mir/hair/pattern/_match.rs | 5 +++-- src/librustc_mir/interpret/visitor.rs | 2 +- src/librustc_mir/monomorphize/partitioning.rs | 6 ++++-- src/librustc_mir/util/elaborate_drops.rs | 4 +++- src/librustc_save_analysis/lib.rs | 4 ++-- src/librustc_typeck/collect.rs | 2 +- 15 files changed, 36 insertions(+), 30 deletions(-) diff --git a/src/librustc/infer/lattice.rs b/src/librustc/infer/lattice.rs index e55ce345bd9d3..68cbef4407677 100644 --- a/src/librustc/infer/lattice.rs +++ b/src/librustc/infer/lattice.rs @@ -41,7 +41,7 @@ pub trait LatticeDir<'f, 'tcx>: TypeRelation<'tcx> { fn relate_bound(&mut self, v: Ty<'tcx>, a: Ty<'tcx>, b: Ty<'tcx>) -> RelateResult<'tcx, ()>; } -pub fn super_lattice_tys<'a, 'tcx, L>( +pub fn super_lattice_tys<'a, 'tcx: 'a, L>( this: &mut L, a: Ty<'tcx>, b: Ty<'tcx>, diff --git a/src/librustc/traits/select.rs b/src/librustc/traits/select.rs index 645b6f418dcbd..7c4742259ac16 100644 --- a/src/librustc/traits/select.rs +++ b/src/librustc/traits/select.rs @@ -3788,9 +3788,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { matcher.relate(previous, current).is_ok() } - fn push_stack<'o, 's>( + fn push_stack<'o>( &mut self, - previous_stack: TraitObligationStackList<'s, 'tcx>, + previous_stack: TraitObligationStackList<'o, 'tcx>, obligation: &'o TraitObligation<'tcx>, ) -> TraitObligationStack<'o, 'tcx> { let fresh_trait_ref = obligation diff --git a/src/librustc_codegen_ssa/base.rs b/src/librustc_codegen_ssa/base.rs index a06f324d3895d..ba96865d23bd1 100644 --- a/src/librustc_codegen_ssa/base.rs +++ b/src/librustc_codegen_ssa/base.rs @@ -366,7 +366,7 @@ pub fn memcpy_ty<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( bx.memcpy(dst, dst_align, src, src_align, bx.cx().const_usize(size), flags); } -pub fn codegen_instance<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( +pub fn codegen_instance<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( cx: &'a Bx::CodegenCx, instance: Instance<'tcx>, ) { diff --git a/src/librustc_codegen_ssa/mono_item.rs b/src/librustc_codegen_ssa/mono_item.rs index 57bd2f36dd7f5..4446f1a3a5ce2 100644 --- a/src/librustc_codegen_ssa/mono_item.rs +++ b/src/librustc_codegen_ssa/mono_item.rs @@ -17,7 +17,7 @@ pub trait MonoItemExt<'a, 'tcx> { fn to_raw_string(&self) -> String; } -impl<'a, 'tcx> MonoItemExt<'a, 'tcx> for MonoItem<'tcx> { +impl<'a, 'tcx: 'a> MonoItemExt<'a, 'tcx> for MonoItem<'tcx> { fn define>(&self, cx: &'a Bx::CodegenCx) { debug!("BEGIN IMPLEMENTING '{} ({})' in cgu {}", self.to_string(cx.tcx(), true), diff --git a/src/librustc_metadata/creader.rs b/src/librustc_metadata/creader.rs index 4564f22025335..6a01d7454bee5 100644 --- a/src/librustc_metadata/creader.rs +++ b/src/librustc_metadata/creader.rs @@ -289,11 +289,14 @@ impl<'a> CrateLoader<'a> { (cnum, cmeta) } - fn load_proc_macro<'b> ( + fn load_proc_macro<'b>( &mut self, locate_ctxt: &mut locator::Context<'b>, path_kind: PathKind, - ) -> Option<(LoadResult, Option)> { + ) -> Option<(LoadResult, Option)> + where + 'a: 'b, + { // Use a new locator Context so trying to load a proc macro doesn't affect the error // message we emit let mut proc_macro_locator = locate_ctxt.clone(); diff --git a/src/librustc_metadata/decoder.rs b/src/librustc_metadata/decoder.rs index 98cdeb6996873..f78cc2f38a93a 100644 --- a/src/librustc_metadata/decoder.rs +++ b/src/librustc_metadata/decoder.rs @@ -38,7 +38,7 @@ use log::debug; pub struct DecodeContext<'a, 'tcx> { opaque: opaque::Decoder<'a>, cdata: Option<&'a CrateMetadata>, - sess: Option<&'a Session>, + sess: Option<&'tcx Session>, tcx: Option>, // Cache the last used source_file for translating spans as an optimization. @@ -54,10 +54,8 @@ pub struct DecodeContext<'a, 'tcx> { 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 sess(self) -> Option<&'tcx Session> { None } + fn tcx(self) -> Option> { None } fn decoder(self, pos: usize) -> DecodeContext<'a, 'tcx> { let tcx = self.tcx(); @@ -82,13 +80,13 @@ impl<'a, 'tcx> Metadata<'a, 'tcx> for &'a MetadataBlob { } -impl<'a, 'tcx> Metadata<'a, 'tcx> for (&'a MetadataBlob, &'a Session) { +impl<'a, 'tcx> Metadata<'a, 'tcx> for (&'a MetadataBlob, &'tcx Session) { fn raw_bytes(self) -> &'a [u8] { let (blob, _) = self; &blob.0 } - fn sess(self) -> Option<&'a Session> { + fn sess(self) -> Option<&'tcx Session> { let (_, sess) = self; Some(sess) } @@ -104,14 +102,14 @@ impl<'a, 'tcx> Metadata<'a, 'tcx> for &'a CrateMetadata { } } -impl<'a, 'tcx> Metadata<'a, 'tcx> for (&'a CrateMetadata, &'a Session) { +impl<'a, 'tcx> Metadata<'a, 'tcx> for (&'a CrateMetadata, &'tcx Session) { fn raw_bytes(self) -> &'a [u8] { self.0.raw_bytes() } fn cdata(self) -> Option<&'a CrateMetadata> { Some(self.0) } - fn sess(self) -> Option<&'a Session> { + fn sess(self) -> Option<&'tcx Session> { Some(&self.1) } } @@ -136,11 +134,11 @@ impl<'a, 'tcx, T: Decodable> Lazy { } } -impl<'a, 'tcx, T: Decodable> LazySeq { +impl<'a: 'x, 'tcx: 'x, 'x, T: Decodable> LazySeq { pub fn decode>( self, meta: M, - ) -> impl Iterator + Captures<'tcx> + 'a { + ) -> impl Iterator + Captures<'a> + Captures<'tcx> + 'x { let mut dcx = meta.decoder(self.position); dcx.lazy_state = LazyState::NodeStart(self.position); (0..self.len).map(move |_| T::decode(&mut dcx).unwrap()) diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs index 288d69f097d3d..afdc9f5c02ae1 100644 --- a/src/librustc_mir/borrow_check/mod.rs +++ b/src/librustc_mir/borrow_check/mod.rs @@ -1693,7 +1693,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { fn move_path_closest_to<'a>( &mut self, place: &'a Place<'tcx>, - ) -> Result<(&'a Place<'tcx>, MovePathIndex), NoMovePathFound> { + ) -> Result<(&'a Place<'tcx>, MovePathIndex), NoMovePathFound> where 'cx: 'a { let mut last_prefix = place; for prefix in self.prefixes(place, PrefixSet::All) { if let Some(mpi) = self.move_path_for_place(prefix) { diff --git a/src/librustc_mir/build/matches/mod.rs b/src/librustc_mir/build/matches/mod.rs index aa576030ef1dd..55093f28a42e1 100644 --- a/src/librustc_mir/build/matches/mod.rs +++ b/src/librustc_mir/build/matches/mod.rs @@ -1691,7 +1691,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { &mut self, block: BasicBlock, bindings: impl IntoIterator>, - ) { + ) where 'tcx: 'b { debug!("bind_matched_candidate_for_arm_body(block={:?})", block); let re_erased = self.hir.tcx().lifetimes.re_erased; diff --git a/src/librustc_mir/dataflow/mod.rs b/src/librustc_mir/dataflow/mod.rs index 1130e7e3f5d00..8f91ba23e23b8 100644 --- a/src/librustc_mir/dataflow/mod.rs +++ b/src/librustc_mir/dataflow/mod.rs @@ -297,7 +297,7 @@ impl<'a, 'tcx, BD> DataflowBuilder<'a, 'tcx, BD> where BD: BitDenotation<'tcx> /// underlying flow analysis results, because it needs to handle cases /// where we are combining the results of *multiple* flow analyses /// (e.g., borrows + inits + uninits). -pub(crate) trait DataflowResultsConsumer<'a, 'tcx> { +pub(crate) trait DataflowResultsConsumer<'a, 'tcx: 'a> { type FlowState: FlowsAtLocation; // Observation Hooks: override (at least one of) these to get analysis feedback. diff --git a/src/librustc_mir/hair/pattern/_match.rs b/src/librustc_mir/hair/pattern/_match.rs index e4cff5861ca50..f5817694c50a3 100644 --- a/src/librustc_mir/hair/pattern/_match.rs +++ b/src/librustc_mir/hair/pattern/_match.rs @@ -709,7 +709,8 @@ fn all_constructors<'a, 'tcx>(cx: &mut MatchCheckCtxt<'a, 'tcx>, fn max_slice_length<'p, 'a, 'tcx, I>( cx: &mut MatchCheckCtxt<'a, 'tcx>, patterns: I) -> u64 - where I: Iterator> + where I: Iterator>, + 'tcx: 'p, { // The exhaustiveness-checking paper does not include any details on // checking variable-length slice patterns. However, they are matched @@ -1709,7 +1710,7 @@ fn patterns_for_variant<'p, 'tcx>( /// different patterns. /// Structure patterns with a partial wild pattern (Foo { a: 42, .. }) have their missing /// fields filled with wild patterns. -fn specialize<'p, 'a, 'tcx>( +fn specialize<'p, 'a: 'p, 'tcx>( cx: &mut MatchCheckCtxt<'a, 'tcx>, r: &[&'p Pattern<'tcx>], constructor: &Constructor<'tcx>, diff --git a/src/librustc_mir/interpret/visitor.rs b/src/librustc_mir/interpret/visitor.rs index 95a679b95ddc9..9150f16526ba7 100644 --- a/src/librustc_mir/interpret/visitor.rs +++ b/src/librustc_mir/interpret/visitor.rs @@ -122,7 +122,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Value<'mir, 'tcx, M> for MPlaceTy<'tcx, 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<'mir, 'tcx, M: Machine<'mir, 'tcx>>: Sized { + 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. diff --git a/src/librustc_mir/monomorphize/partitioning.rs b/src/librustc_mir/monomorphize/partitioning.rs index 0337f3f1da7b0..32e4d4f437a78 100644 --- a/src/librustc_mir/monomorphize/partitioning.rs +++ b/src/librustc_mir/monomorphize/partitioning.rs @@ -766,9 +766,10 @@ fn numbered_codegen_unit_name( name_builder.build_cgu_name_no_mangle(LOCAL_CRATE, &["cgu"], Some(index)) } -fn debug_dump<'a, 'b, 'tcx, I>(tcx: TyCtxt<'tcx>, label: &str, cgus: I) +fn debug_dump<'a, 'tcx, I>(tcx: TyCtxt<'tcx>, label: &str, cgus: I) where - I: Iterator>, + I: Iterator>, + 'tcx: 'a, { if cfg!(debug_assertions) { debug!("{}", label); @@ -796,6 +797,7 @@ where fn assert_symbols_are_distinct<'a, 'tcx, I>(tcx: TyCtxt<'tcx>, mono_items: I) where I: Iterator>, + 'tcx: 'a, { let mut symbols: Vec<_> = mono_items.map(|mono_item| { (mono_item, mono_item.symbol_name(tcx)) diff --git a/src/librustc_mir/util/elaborate_drops.rs b/src/librustc_mir/util/elaborate_drops.rs index 6da181ef66807..002ff4b0b089f 100644 --- a/src/librustc_mir/util/elaborate_drops.rs +++ b/src/librustc_mir/util/elaborate_drops.rs @@ -111,7 +111,8 @@ pub fn elaborate_drop<'b, 'tcx, D>( succ: BasicBlock, unwind: Unwind, bb: BasicBlock) - where D: DropElaborator<'b, 'tcx> + where D: DropElaborator<'b, 'tcx>, + 'tcx: 'b, { DropCtxt { elaborator, source_info, place, path, succ, unwind @@ -121,6 +122,7 @@ pub fn elaborate_drop<'b, 'tcx, D>( impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> where D: DropElaborator<'b, 'tcx>, + 'tcx: 'b, { fn place_ty(&self, place: &Place<'tcx>) -> Ty<'tcx> { place.ty(self.elaborator.body(), self.tcx()).ty diff --git a/src/librustc_save_analysis/lib.rs b/src/librustc_save_analysis/lib.rs index 4882a4240c831..bc813b3d5a2e7 100644 --- a/src/librustc_save_analysis/lib.rs +++ b/src/librustc_save_analysis/lib.rs @@ -960,8 +960,8 @@ impl<'l> PathCollector<'l> { } } -impl<'l, 'a> Visitor<'a> for PathCollector<'l> { - fn visit_pat(&mut self, p: &'a ast::Pat) { +impl<'l> Visitor<'l> for PathCollector<'l> { + fn visit_pat(&mut self, p: &'l ast::Pat) { match p.node { PatKind::Struct(ref path, ..) => { self.collected_paths.push((p.id, path)); diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index 70deca9623b45..5606d9c0ce815 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -1786,7 +1786,7 @@ fn impl_polarity<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> hir::ImplPolarity { /// 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>( +fn early_bound_lifetimes_from_generics<'a, 'tcx: 'a>( tcx: TyCtxt<'tcx>, generics: &'a hir::Generics, ) -> impl Iterator + Captures<'tcx> { From ea78c3aa33c09f987c4ad0d87b9a39a0d065d67c Mon Sep 17 00:00:00 2001 From: Eduard-Mihai Burtescu Date: Sun, 16 Jun 2019 12:41:24 +0300 Subject: [PATCH 5/6] Run `rustfmt --file-lines ...` for changes from previous commits. --- src/librustc/ty/query/on_disk_cache.rs | 11 +++--- .../borrowck/gather_loans/gather_moves.rs | 24 +++++++----- src/librustc_codegen_ssa/base.rs | 16 ++++---- src/librustc_codegen_ssa/common.rs | 8 ++-- src/librustc_codegen_ssa/glue.rs | 2 +- src/librustc_codegen_ssa/mir/analyze.rs | 7 ++-- src/librustc_codegen_ssa/mir/mod.rs | 11 +++--- src/librustc_mir/dataflow/mod.rs | 33 ++++++++++++----- src/librustc_mir/hair/cx/to_ref.rs | 9 +++-- src/librustc_mir/hair/pattern/_match.rs | 37 ++++++++++--------- src/librustc_mir/transform/generator.rs | 3 +- src/librustc_mir/util/elaborate_drops.rs | 8 ++-- src/libsyntax_ext/deriving/generic/mod.rs | 11 +++--- 13 files changed, 103 insertions(+), 77 deletions(-) diff --git a/src/librustc/ty/query/on_disk_cache.rs b/src/librustc/ty/query/on_disk_cache.rs index 5349b7dbda597..982886f0f1573 100644 --- a/src/librustc/ty/query/on_disk_cache.rs +++ b/src/librustc/ty/query/on_disk_cache.rs @@ -505,12 +505,11 @@ impl<'a, 'tcx> DecoderWithPosition for CacheDecoder<'a, 'tcx> { // Decode something that was encoded with encode_tagged() and verify that the // tag matches and the correct amount of bytes was read. -fn decode_tagged(decoder: &mut D, - expected_tag: T) - -> Result - where T: Decodable + Eq + ::std::fmt::Debug, - V: Decodable, - D: DecoderWithPosition, +fn decode_tagged(decoder: &mut D, expected_tag: T) -> Result +where + T: Decodable + Eq + ::std::fmt::Debug, + V: Decodable, + D: DecoderWithPosition, { let start_pos = decoder.position(); diff --git a/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs b/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs index cc1f7232e04c1..05c0a22900a0b 100644 --- a/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs +++ b/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs @@ -20,7 +20,7 @@ struct GatherMoveInfo<'c, 'tcx> { id: hir::ItemLocalId, kind: MoveKind, cmt: &'c mc::cmt_<'tcx>, - span_path_opt: Option> + span_path_opt: Option>, } /// Represents the kind of pattern @@ -91,11 +91,13 @@ pub fn gather_move_from_expr<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, gather_move(bccx, move_data, move_error_collector, move_info); } -pub fn gather_move_from_pat<'a, 'c, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, - move_data: &MoveData<'tcx>, - move_error_collector: &mut MoveErrorCollector<'tcx>, - move_pat: &hir::Pat, - cmt: &'c mc::cmt_<'tcx>) { +pub fn gather_move_from_pat<'a, 'c, 'tcx>( + bccx: &BorrowckCtxt<'a, 'tcx>, + move_data: &MoveData<'tcx>, + move_error_collector: &mut MoveErrorCollector<'tcx>, + move_pat: &hir::Pat, + cmt: &'c mc::cmt_<'tcx>, +) { let source = get_pattern_source(bccx.tcx,move_pat); let pat_span_path_opt = match move_pat.node { PatKind::Binding(_, _, ident, _) => { @@ -121,10 +123,12 @@ pub fn gather_move_from_pat<'a, 'c, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, gather_move(bccx, move_data, move_error_collector, move_info); } -fn gather_move<'a, 'c, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, - move_data: &MoveData<'tcx>, - move_error_collector: &mut MoveErrorCollector<'tcx>, - move_info: GatherMoveInfo<'c, 'tcx>) { +fn gather_move<'a, 'c, 'tcx>( + bccx: &BorrowckCtxt<'a, 'tcx>, + move_data: &MoveData<'tcx>, + move_error_collector: &mut MoveErrorCollector<'tcx>, + move_info: GatherMoveInfo<'c, 'tcx>, +) { debug!("gather_move(move_id={:?}, cmt={:?})", move_info.id, move_info.cmt); diff --git a/src/librustc_codegen_ssa/base.rs b/src/librustc_codegen_ssa/base.rs index ba96865d23bd1..47b383fddbc31 100644 --- a/src/librustc_codegen_ssa/base.rs +++ b/src/librustc_codegen_ssa/base.rs @@ -94,7 +94,7 @@ pub fn compare_simd_types<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( rhs: Bx::Value, t: Ty<'tcx>, ret_ty: Bx::Type, - op: hir::BinOpKind + op: hir::BinOpKind, ) -> Bx::Value { let signed = match t.sty { ty::Float(_) => { @@ -156,7 +156,7 @@ pub fn unsize_thin_ptr<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( bx: &mut Bx, src: Bx::Value, src_ty: Ty<'tcx>, - dst_ty: Ty<'tcx> + dst_ty: Ty<'tcx>, ) -> (Bx::Value, Bx::Value) { debug!("unsize_thin_ptr: {:?} => {:?}", src_ty, dst_ty); match (&src_ty.sty, &dst_ty.sty) { @@ -210,8 +210,8 @@ pub fn unsize_thin_ptr<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( pub fn coerce_unsized_into<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( bx: &mut Bx, src: PlaceRef<'tcx, Bx::Value>, - dst: PlaceRef<'tcx, Bx::Value> -) { + dst: PlaceRef<'tcx, Bx::Value>, +) { let src_ty = src.layout.ty; let dst_ty = dst.layout.ty; let mut coerce_ptr = || { @@ -270,7 +270,7 @@ pub fn cast_shift_expr_rhs<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( bx: &mut Bx, op: hir::BinOpKind, lhs: Bx::Value, - rhs: Bx::Value + rhs: Bx::Value, ) -> Bx::Value { cast_shift_rhs(bx, op, lhs, rhs) } @@ -318,7 +318,7 @@ pub fn wants_msvc_seh(sess: &Session) -> bool { pub fn from_immediate<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( bx: &mut Bx, - val: Bx::Value + val: Bx::Value, ) -> Bx::Value { if bx.cx().val_ty(val) == bx.cx().type_i1() { bx.zext(val, bx.cx().type_i8()) @@ -387,9 +387,7 @@ pub fn codegen_instance<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( /// Creates the `main` function which will initialize the rust runtime and call /// users main function. -pub fn maybe_create_entry_wrapper<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( - cx: &'a Bx::CodegenCx -) { +pub fn maybe_create_entry_wrapper<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(cx: &'a Bx::CodegenCx) { let (main_def_id, span) = match cx.tcx().entry_fn(LOCAL_CRATE) { Some((def_id, _)) => { (def_id, cx.tcx().def_span(def_id)) }, None => return, diff --git a/src/librustc_codegen_ssa/common.rs b/src/librustc_codegen_ssa/common.rs index d17edf2ec0a2b..6376512ca4025 100644 --- a/src/librustc_codegen_ssa/common.rs +++ b/src/librustc_codegen_ssa/common.rs @@ -140,7 +140,7 @@ pub fn langcall(tcx: TyCtxt<'_>, span: Option, msg: &str, li: LangItem) -> pub fn build_unchecked_lshift<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( bx: &mut Bx, lhs: Bx::Value, - rhs: Bx::Value + rhs: Bx::Value, ) -> Bx::Value { let rhs = base::cast_shift_expr_rhs(bx, hir::BinOpKind::Shl, lhs, rhs); // #1877, #10183: Ensure that input is always valid @@ -152,7 +152,7 @@ pub fn build_unchecked_rshift<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( bx: &mut Bx, lhs_t: Ty<'tcx>, lhs: Bx::Value, - rhs: Bx::Value + rhs: Bx::Value, ) -> Bx::Value { let rhs = base::cast_shift_expr_rhs(bx, hir::BinOpKind::Shr, lhs, rhs); // #1877, #10183: Ensure that input is always valid @@ -167,7 +167,7 @@ pub fn build_unchecked_rshift<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( fn shift_mask_rhs<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( bx: &mut Bx, - rhs: Bx::Value + rhs: Bx::Value, ) -> Bx::Value { let rhs_llty = bx.val_ty(rhs); let shift_val = shift_mask_val(bx, rhs_llty, rhs_llty, false); @@ -178,7 +178,7 @@ pub fn shift_mask_val<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( bx: &mut Bx, llty: Bx::Type, mask_llty: Bx::Type, - invert: bool + invert: bool, ) -> Bx::Value { let kind = bx.type_kind(llty); match kind { diff --git a/src/librustc_codegen_ssa/glue.rs b/src/librustc_codegen_ssa/glue.rs index 294e2e021d2af..7fd9f67e2f45b 100644 --- a/src/librustc_codegen_ssa/glue.rs +++ b/src/librustc_codegen_ssa/glue.rs @@ -10,7 +10,7 @@ use crate::traits::*; pub fn size_and_align_of_dst<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( bx: &mut Bx, t: Ty<'tcx>, - info: Option + info: Option, ) -> (Bx::Value, Bx::Value) { let layout = bx.layout_of(t); debug!("size_and_align_of_dst(ty={}, info={:?}): layout: {:?}", diff --git a/src/librustc_codegen_ssa/mir/analyze.rs b/src/librustc_codegen_ssa/mir/analyze.rs index 3d41eddb8035e..0289150a5e42a 100644 --- a/src/librustc_codegen_ssa/mir/analyze.rs +++ b/src/librustc_codegen_ssa/mir/analyze.rs @@ -13,7 +13,7 @@ use super::FunctionCx; use crate::traits::*; pub fn non_ssa_locals<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( - fx: &FunctionCx<'a, 'tcx, Bx> + fx: &FunctionCx<'a, 'tcx, Bx>, ) -> BitSet { let mir = fx.mir; let mut analyzer = LocalAnalyzer::new(fx); @@ -49,7 +49,7 @@ struct LocalAnalyzer<'mir, 'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> { non_ssa_locals: BitSet, // The location of the first visited direct assignment to each // local, or an invalid location (out of bounds `block` index). - first_assignment: IndexVec + first_assignment: IndexVec, } impl> LocalAnalyzer<'mir, 'a, 'tcx, Bx> { @@ -95,7 +95,8 @@ impl> LocalAnalyzer<'mir, 'a, 'tcx, Bx> { } impl<'mir, 'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> Visitor<'tcx> - for LocalAnalyzer<'mir, 'a, 'tcx, Bx> { + for LocalAnalyzer<'mir, 'a, 'tcx, Bx> +{ fn visit_assign(&mut self, place: &mir::Place<'tcx>, rvalue: &mir::Rvalue<'tcx>, diff --git a/src/librustc_codegen_ssa/mir/mod.rs b/src/librustc_codegen_ssa/mir/mod.rs index 78af71b5a4982..c20be56ba0cf5 100644 --- a/src/librustc_codegen_ssa/mir/mod.rs +++ b/src/librustc_codegen_ssa/mir/mod.rs @@ -43,7 +43,7 @@ pub struct FunctionCx<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> { /// don't really care about it very much. Anyway, this value /// contains an alloca into which the personality is stored and /// then later loaded when generating the DIVERGE_BLOCK. - personality_slot: Option>, + personality_slot: Option>, /// A `Block` for each MIR `BasicBlock` blocks: IndexVec, @@ -355,10 +355,11 @@ fn create_funclets<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( mir: &'a Body<'tcx>, bx: &mut Bx, cleanup_kinds: &IndexVec, - block_bxs: &IndexVec) - -> (IndexVec>, - IndexVec>) -{ + block_bxs: &IndexVec, +) -> ( + IndexVec>, + IndexVec>, +) { block_bxs.iter_enumerated().zip(cleanup_kinds).map(|((bb, &llbb), cleanup_kind)| { match *cleanup_kind { CleanupKind::Funclet if base::wants_msvc_seh(bx.sess()) => {} diff --git a/src/librustc_mir/dataflow/mod.rs b/src/librustc_mir/dataflow/mod.rs index 8f91ba23e23b8..0728d5b21bbd1 100644 --- a/src/librustc_mir/dataflow/mod.rs +++ b/src/librustc_mir/dataflow/mod.rs @@ -43,7 +43,7 @@ pub(crate) mod indexes { pub(crate) struct DataflowBuilder<'a, 'tcx, BD> where - BD: BitDenotation<'tcx> + BD: BitDenotation<'tcx>, { def_id: DefId, flow_state: DataflowAnalysis<'a, 'tcx, BD>, @@ -88,7 +88,7 @@ pub(crate) trait Dataflow<'tcx, BD: BitDenotation<'tcx>> { impl<'a, 'tcx, BD> Dataflow<'tcx, BD> for DataflowBuilder<'a, 'tcx, BD> where - BD: BitDenotation<'tcx> + BD: BitDenotation<'tcx>, { fn dataflow

(&mut self, p: P) where P: Fn(&BD, BD::Idx) -> DebugFormatted { self.flow_state.build_sets(); @@ -179,12 +179,16 @@ where } } -struct PropagationContext<'b, 'a, 'tcx, O> where O: 'b + BitDenotation<'tcx> +struct PropagationContext<'b, 'a, 'tcx, O> +where + O: 'b + BitDenotation<'tcx>, { builder: &'b mut DataflowAnalysis<'a, 'tcx, O>, } -impl<'a, 'tcx, BD> DataflowAnalysis<'a, 'tcx, BD> where BD: BitDenotation<'tcx> +impl<'a, 'tcx, BD> DataflowAnalysis<'a, 'tcx, BD> +where + BD: BitDenotation<'tcx>, { fn propagate(&mut self) { let mut temp = BitSet::new_empty(self.flow_state.sets.bits_per_block); @@ -234,7 +238,9 @@ impl<'a, 'tcx, BD> DataflowAnalysis<'a, 'tcx, BD> where BD: BitDenotation<'tcx> } } -impl<'b, 'a, 'tcx, BD> PropagationContext<'b, 'a, 'tcx, BD> where BD: BitDenotation<'tcx> +impl<'b, 'a, 'tcx, BD> PropagationContext<'b, 'a, 'tcx, BD> +where + BD: BitDenotation<'tcx>, { fn walk_cfg(&mut self, in_out: &mut BitSet) { let mut dirty_queue: WorkQueue = @@ -265,7 +271,9 @@ fn dataflow_path(context: &str, path: &str) -> PathBuf { path } -impl<'a, 'tcx, BD> DataflowBuilder<'a, 'tcx, BD> where BD: BitDenotation<'tcx> +impl<'a, 'tcx, BD> DataflowBuilder<'a, 'tcx, BD> +where + BD: BitDenotation<'tcx>, { fn pre_dataflow_instrumentation

(&self, p: P) -> io::Result<()> where P: Fn(&BD, BD::Idx) -> DebugFormatted @@ -387,14 +395,18 @@ pub fn state_for_location<'tcx, T: BitDenotation<'tcx>>(loc: Location, gen_set.to_dense() } -pub struct DataflowAnalysis<'a, 'tcx, O> where O: BitDenotation<'tcx> +pub struct DataflowAnalysis<'a, 'tcx, O> +where + O: BitDenotation<'tcx>, { flow_state: DataflowState<'tcx, O>, dead_unwinds: &'a BitSet, body: &'a Body<'tcx>, } -impl<'a, 'tcx, O> DataflowAnalysis<'a, 'tcx, O> where O: BitDenotation<'tcx> +impl<'a, 'tcx, O> DataflowAnalysis<'a, 'tcx, O> +where + O: BitDenotation<'tcx>, { pub fn results(self) -> DataflowResults<'tcx, O> { DataflowResults(self.flow_state) @@ -734,7 +746,10 @@ impl<'a, 'tcx, D> DataflowAnalysis<'a, 'tcx, D> where D: BitDenotation<'tcx> } } -impl<'a, 'tcx, D> DataflowAnalysis<'a, 'tcx, D> where D: BitDenotation<'tcx> { +impl<'a, 'tcx, D> DataflowAnalysis<'a, 'tcx, D> +where + D: BitDenotation<'tcx>, +{ /// Propagates the bits of `in_out` into all the successors of `bb`, /// using bitwise operator denoted by `self.operator`. /// diff --git a/src/librustc_mir/hair/cx/to_ref.rs b/src/librustc_mir/hair/cx/to_ref.rs index 2daa8e3cb707d..946d66fc91d7d 100644 --- a/src/librustc_mir/hair/cx/to_ref.rs +++ b/src/librustc_mir/hair/cx/to_ref.rs @@ -33,7 +33,8 @@ impl<'tcx> ToRef for Expr<'tcx> { } impl<'tcx, T, U> ToRef for &'tcx Option - where &'tcx T: ToRef +where + &'tcx T: ToRef, { type Output = Option; @@ -43,7 +44,8 @@ impl<'tcx, T, U> ToRef for &'tcx Option } impl<'tcx, T, U> ToRef for &'tcx Vec - where &'tcx T: ToRef +where + &'tcx T: ToRef, { type Output = Vec; @@ -53,7 +55,8 @@ impl<'tcx, T, U> ToRef for &'tcx Vec } impl<'tcx, T, U> ToRef for &'tcx P<[T]> - where &'tcx T: ToRef +where + &'tcx T: ToRef, { type Output = Vec; diff --git a/src/librustc_mir/hair/pattern/_match.rs b/src/librustc_mir/hair/pattern/_match.rs index f5817694c50a3..1fcdf71337251 100644 --- a/src/librustc_mir/hair/pattern/_match.rs +++ b/src/librustc_mir/hair/pattern/_match.rs @@ -632,10 +632,10 @@ impl<'tcx> Witness<'tcx> { /// /// We make sure to omit constructors that are statically impossible. E.g., for /// `Option`, we do not include `Some(_)` in the returned list of constructors. -fn all_constructors<'a, 'tcx>(cx: &mut MatchCheckCtxt<'a, 'tcx>, - pcx: PatternContext<'tcx>) - -> Vec> -{ +fn all_constructors<'a, 'tcx>( + cx: &mut MatchCheckCtxt<'a, 'tcx>, + pcx: PatternContext<'tcx>, +) -> Vec> { debug!("all_constructors({:?})", pcx.ty); let ctors = match pcx.ty.sty { ty::Bool => { @@ -706,11 +706,10 @@ fn all_constructors<'a, 'tcx>(cx: &mut MatchCheckCtxt<'a, 'tcx>, ctors } -fn max_slice_length<'p, 'a, 'tcx, I>( - cx: &mut MatchCheckCtxt<'a, 'tcx>, - patterns: I) -> u64 - where I: Iterator>, - 'tcx: 'p, +fn max_slice_length<'p, 'a, 'tcx, I>(cx: &mut MatchCheckCtxt<'a, 'tcx>, patterns: I) -> u64 +where + I: Iterator>, + 'tcx: 'p, { // The exhaustiveness-checking paper does not include any details on // checking variable-length slice patterns. However, they are matched @@ -1056,11 +1055,12 @@ fn compute_missing_ctors<'tcx>( /// relation to preceding patterns, it is not reachable) and exhaustiveness /// checking (if a wildcard pattern is useful in relation to a matrix, the /// matrix isn't exhaustive). -pub fn is_useful<'p, 'a, 'tcx>(cx: &mut MatchCheckCtxt<'a, 'tcx>, - matrix: &Matrix<'p, 'tcx>, - v: &[&Pattern<'tcx>], - witness: WitnessPreference) - -> Usefulness<'tcx> { +pub fn is_useful<'p, 'a, 'tcx>( + cx: &mut MatchCheckCtxt<'a, 'tcx>, + matrix: &Matrix<'p, 'tcx>, + v: &[&Pattern<'tcx>], + witness: WitnessPreference, +) -> Usefulness<'tcx> { let &Matrix(ref rows) = matrix; debug!("is_useful({:#?}, {:#?})", matrix, v); @@ -1372,10 +1372,11 @@ fn constructor_arity(cx: &MatchCheckCtxt<'a, 'tcx>, ctor: &Constructor<'tcx>, ty /// expanded to. /// /// For instance, a tuple pattern (43u32, 'a') has sub pattern types [u32, char]. -fn constructor_sub_pattern_tys<'a, 'tcx>(cx: &MatchCheckCtxt<'a, 'tcx>, - ctor: &Constructor<'tcx>, - ty: Ty<'tcx>) -> Vec> -{ +fn constructor_sub_pattern_tys<'a, 'tcx>( + cx: &MatchCheckCtxt<'a, 'tcx>, + ctor: &Constructor<'tcx>, + ty: Ty<'tcx>, +) -> Vec> { debug!("constructor_sub_pattern_tys({:#?}, {:?})", ctor, ty); match ty.sty { ty::Tuple(ref fs) => fs.into_iter().map(|t| t.expect_ty()).collect(), diff --git a/src/librustc_mir/transform/generator.rs b/src/librustc_mir/transform/generator.rs index 6be54aa629de7..ba8c47c665e03 100644 --- a/src/librustc_mir/transform/generator.rs +++ b/src/librustc_mir/transform/generator.rs @@ -625,7 +625,8 @@ struct StorageConflictVisitor<'body, 'tcx, 's> { } impl<'body, 'tcx, 's> DataflowResultsConsumer<'body, 'tcx> -for StorageConflictVisitor<'body, 'tcx, 's> { + for StorageConflictVisitor<'body, 'tcx, 's> +{ type FlowState = FlowAtLocation<'tcx, MaybeStorageLive<'body, 'tcx>>; fn body(&self) -> &'body Body<'tcx> { diff --git a/src/librustc_mir/util/elaborate_drops.rs b/src/librustc_mir/util/elaborate_drops.rs index 002ff4b0b089f..815d210d36ea4 100644 --- a/src/librustc_mir/util/elaborate_drops.rs +++ b/src/librustc_mir/util/elaborate_drops.rs @@ -91,7 +91,8 @@ pub trait DropElaborator<'a, 'tcx>: fmt::Debug { #[derive(Debug)] struct DropCtxt<'l, 'b, 'tcx, D> - where D : DropElaborator<'b, 'tcx> + 'l +where + D: DropElaborator<'b, 'tcx> + 'l, { elaborator: &'l mut D, @@ -110,8 +111,9 @@ pub fn elaborate_drop<'b, 'tcx, D>( path: D::Path, succ: BasicBlock, unwind: Unwind, - bb: BasicBlock) - where D: DropElaborator<'b, 'tcx>, + bb: BasicBlock, +) where + D: DropElaborator<'b, 'tcx>, 'tcx: 'b, { DropCtxt { diff --git a/src/libsyntax_ext/deriving/generic/mod.rs b/src/libsyntax_ext/deriving/generic/mod.rs index 3edf7726ec610..444cf1263ce25 100644 --- a/src/libsyntax_ext/deriving/generic/mod.rs +++ b/src/libsyntax_ext/deriving/generic/mod.rs @@ -339,11 +339,12 @@ pub fn combine_substructure<'a>(f: CombineSubstructureFunc<'a>) /// This method helps to extract all the type parameters referenced from a /// type. For a type parameter ``, it looks for either a `TyPath` that /// is not global and starts with `T`, or a `TyQPath`. -fn find_type_parameters(ty: &ast::Ty, - ty_param_names: &[ast::Name], - span: Span, - cx: &ExtCtxt<'_>) - -> Vec> { +fn find_type_parameters( + ty: &ast::Ty, + ty_param_names: &[ast::Name], + span: Span, + cx: &ExtCtxt<'_>, +) -> Vec> { use syntax::visit; struct Visitor<'a, 'b> { From 2be847b2f95414690538bea48138a6738b47b43a Mon Sep 17 00:00:00 2001 From: Eduard-Mihai Burtescu Date: Sun, 16 Jun 2019 14:11:20 +0300 Subject: [PATCH 6/6] test: normalize away the line/column info in ui/pattern/const-pat-ice. --- src/test/ui/pattern/const-pat-ice.rs | 1 + src/test/ui/pattern/const-pat-ice.stderr | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/test/ui/pattern/const-pat-ice.rs b/src/test/ui/pattern/const-pat-ice.rs index b866c7fa6cc9e..0655876788214 100644 --- a/src/test/ui/pattern/const-pat-ice.rs +++ b/src/test/ui/pattern/const-pat-ice.rs @@ -2,6 +2,7 @@ // rustc-env:RUST_BACKTRACE=0 // normalize-stderr-test "note: rustc 1.* running on .*" -> "note: rustc VERSION running on TARGET" // normalize-stderr-test "note: compiler flags: .*" -> "note: compiler flags: FLAGS" +// normalize-stderr-test "/_match.rs:[0-9]+:[0-9]+" -> "/_match.rs:LL:CC" // This is a repro test for an ICE in our pattern handling of constants. diff --git a/src/test/ui/pattern/const-pat-ice.stderr b/src/test/ui/pattern/const-pat-ice.stderr index 7ddeac4abca13..7a0f14425b746 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:1084:5 +thread 'rustc' panicked at 'assertion failed: rows.iter().all(|r| r.len() == v.len())', src/librustc_mir/hair/pattern/_match.rs:LL:CC note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace. error: internal compiler error: unexpected panic