From 2f31698c263c6fc3a6e5d0ba07b2ea9b882a5c9c Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Wed, 12 Sep 2018 17:45:00 -0400 Subject: [PATCH] use `RegionBoundPairs` type alias --- src/librustc/infer/outlives/env.rs | 2 +- src/librustc/infer/outlives/obligations.rs | 9 +++++---- src/librustc/traits/auto_trait.rs | 2 +- .../nll/type_check/constraint_conversion.rs | 5 +++-- src/librustc_mir/borrow_check/nll/type_check/mod.rs | 10 +++++----- 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/librustc/infer/outlives/env.rs b/src/librustc/infer/outlives/env.rs index 6808e9dc9e3..8deabacab5c 100644 --- a/src/librustc/infer/outlives/env.rs +++ b/src/librustc/infer/outlives/env.rs @@ -97,7 +97,7 @@ impl<'a, 'gcx: 'tcx, 'tcx: 'a> OutlivesEnvironment<'tcx> { } /// Borrows current value of the `region_bound_pairs`. - pub fn region_bound_pairs(&self) -> &[(ty::Region<'tcx>, GenericKind<'tcx>)] { + pub fn region_bound_pairs(&self) -> &RegionBoundPairs<'tcx> { &self.region_bound_pairs_accum } diff --git a/src/librustc/infer/outlives/obligations.rs b/src/librustc/infer/outlives/obligations.rs index 700881ea532..e1f7dcfd90a 100644 --- a/src/librustc/infer/outlives/obligations.rs +++ b/src/librustc/infer/outlives/obligations.rs @@ -71,6 +71,7 @@ use hir::def_id::DefId; use infer::{self, GenericKind, InferCtxt, RegionObligation, SubregionOrigin, VerifyBound}; +use infer::outlives::env::RegionBoundPairs; use syntax::ast; use traits::{self, ObligationCause}; use ty::outlives::Component; @@ -158,7 +159,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> { /// processed. pub fn process_registered_region_obligations( &self, - region_bound_pairs: &[(ty::Region<'tcx>, GenericKind<'tcx>)], + region_bound_pairs: &RegionBoundPairs<'tcx>, implicit_region_bound: Option>, param_env: ty::ParamEnv<'tcx>, body_id: ast::NodeId, @@ -207,7 +208,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> { /// registered in advance. pub fn type_must_outlive( &self, - region_bound_pairs: &[(ty::Region<'tcx>, GenericKind<'tcx>)], + region_bound_pairs: &RegionBoundPairs<'tcx>, implicit_region_bound: Option>, param_env: ty::ParamEnv<'tcx>, origin: infer::SubregionOrigin<'tcx>, @@ -240,7 +241,7 @@ where // of these fields. delegate: D, tcx: TyCtxt<'cx, 'gcx, 'tcx>, - region_bound_pairs: &'cx [(ty::Region<'tcx>, GenericKind<'tcx>)], + region_bound_pairs: &'cx RegionBoundPairs<'tcx>, implicit_region_bound: Option>, param_env: ty::ParamEnv<'tcx>, } @@ -269,7 +270,7 @@ where pub fn new( delegate: D, tcx: TyCtxt<'cx, 'gcx, 'tcx>, - region_bound_pairs: &'cx [(ty::Region<'tcx>, GenericKind<'tcx>)], + region_bound_pairs: &'cx RegionBoundPairs<'tcx>, implicit_region_bound: Option>, param_env: ty::ParamEnv<'tcx>, ) -> Self { diff --git a/src/librustc/traits/auto_trait.rs b/src/librustc/traits/auto_trait.rs index b445adea558..e177382430b 100644 --- a/src/librustc/traits/auto_trait.rs +++ b/src/librustc/traits/auto_trait.rs @@ -239,7 +239,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { .collect(); for id in body_ids { - infcx.process_registered_region_obligations(&[], None, full_env.clone(), id); + infcx.process_registered_region_obligations(&vec![], None, full_env.clone(), id); } let region_data = infcx 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 430c8d67392..220cbfe4fff 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/constraint_conversion.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/constraint_conversion.rs @@ -15,6 +15,7 @@ use borrow_check::nll::region_infer::{RegionTest, TypeTest}; use borrow_check::nll::type_check::Locations; use borrow_check::nll::universal_regions::UniversalRegions; use rustc::infer::canonical::QueryRegionConstraint; +use rustc::infer::outlives::env::RegionBoundPairs; use rustc::infer::outlives::obligations::{TypeOutlives, TypeOutlivesDelegate}; use rustc::infer::region_constraints::{GenericKind, VerifyBound}; use rustc::infer::{self, SubregionOrigin}; @@ -26,7 +27,7 @@ crate struct ConstraintConversion<'a, 'gcx: 'tcx, 'tcx: 'a> { tcx: TyCtxt<'a, 'gcx, 'tcx>, universal_regions: &'a UniversalRegions<'tcx>, location_table: &'a LocationTable, - region_bound_pairs: &'a [(ty::Region<'tcx>, GenericKind<'tcx>)], + region_bound_pairs: &'a RegionBoundPairs<'tcx>, implicit_region_bound: Option>, param_env: ty::ParamEnv<'tcx>, locations: Locations, @@ -41,7 +42,7 @@ impl<'a, 'gcx, 'tcx> ConstraintConversion<'a, 'gcx, 'tcx> { tcx: TyCtxt<'a, 'gcx, 'tcx>, universal_regions: &'a UniversalRegions<'tcx>, location_table: &'a LocationTable, - region_bound_pairs: &'a [(ty::Region<'tcx>, GenericKind<'tcx>)], + region_bound_pairs: &'a RegionBoundPairs<'tcx>, implicit_region_bound: Option>, param_env: ty::ParamEnv<'tcx>, locations: Locations, 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 70687d0efa4..d4719064c28 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/mod.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/mod.rs @@ -29,7 +29,7 @@ use dataflow::MaybeInitializedPlaces; use rustc::hir; use rustc::hir::def_id::DefId; use rustc::infer::canonical::QueryRegionConstraint; -use rustc::infer::region_constraints::GenericKind; +use rustc::infer::outlives::env::RegionBoundPairs; use rustc::infer::{InferCtxt, InferOk, LateBoundRegionConversionTime}; use rustc::mir::interpret::EvalErrorKind::BoundsCheck; use rustc::mir::tcx::PlaceTy; @@ -182,7 +182,7 @@ fn type_check_internal<'a, 'gcx, 'tcx, R>( mir_def_id: DefId, param_env: ty::ParamEnv<'gcx>, mir: &'a Mir<'tcx>, - region_bound_pairs: &'a [(ty::Region<'tcx>, GenericKind<'tcx>)], + region_bound_pairs: &'a RegionBoundPairs<'tcx>, implicit_region_bound: Option>, borrowck_context: Option<&'a mut BorrowCheckContext<'a, 'tcx>>, universal_region_relations: Option<&'a UniversalRegionRelations<'tcx>>, @@ -693,7 +693,7 @@ struct TypeChecker<'a, 'gcx: 'tcx, 'tcx: 'a> { last_span: Span, mir: &'a Mir<'tcx>, mir_def_id: DefId, - region_bound_pairs: &'a [(ty::Region<'tcx>, GenericKind<'tcx>)], + region_bound_pairs: &'a RegionBoundPairs<'tcx>, implicit_region_bound: Option>, reported_errors: FxHashSet<(Ty<'tcx>, Span)>, borrowck_context: Option<&'a mut BorrowCheckContext<'a, 'tcx>>, @@ -802,7 +802,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { mir: &'a Mir<'tcx>, mir_def_id: DefId, param_env: ty::ParamEnv<'gcx>, - region_bound_pairs: &'a [(ty::Region<'tcx>, GenericKind<'tcx>)], + region_bound_pairs: &'a RegionBoundPairs<'tcx>, implicit_region_bound: Option>, borrowck_context: Option<&'a mut BorrowCheckContext<'a, 'tcx>>, universal_region_relations: Option<&'a UniversalRegionRelations<'tcx>>, @@ -2232,7 +2232,7 @@ impl MirPass for TypeckMir { def_id, param_env, mir, - &[], + &vec![], None, None, None,