From d99195ad8fefb5752423c0c5224a2395e7e9255b Mon Sep 17 00:00:00 2001 From: scalexm Date: Wed, 24 Oct 2018 22:30:34 +0200 Subject: [PATCH] Rename `Binder::no_late_bound_regions` to `Binder::no_bound_vars` --- src/librustc/infer/outlives/verify.rs | 2 +- src/librustc/traits/auto_trait.rs | 4 ++-- src/librustc/traits/fulfill.rs | 8 ++++---- src/librustc/traits/mod.rs | 2 +- src/librustc/traits/project.rs | 2 +- src/librustc/traits/query/outlives_bounds.rs | 2 +- src/librustc/traits/select.rs | 4 ++-- src/librustc/ty/sty.rs | 14 +++++++------- src/librustc_codegen_llvm/base.rs | 2 +- .../nll/type_check/constraint_conversion.rs | 4 ++-- .../borrow_check/nll/type_check/mod.rs | 4 ++-- src/librustc_mir/monomorphize/collector.rs | 2 +- src/librustc_mir/shim.rs | 4 +++- src/librustc_mir/transform/lower_128bit.rs | 2 +- src/librustc_traits/implied_outlives_bounds.rs | 4 ++-- src/librustc_typeck/check/_match.rs | 2 +- src/librustc_typeck/check/intrinsic.rs | 2 +- src/librustc_typeck/collect.rs | 2 +- 18 files changed, 34 insertions(+), 32 deletions(-) diff --git a/src/librustc/infer/outlives/verify.rs b/src/librustc/infer/outlives/verify.rs index e1db295b7e1..88d45671b9a 100644 --- a/src/librustc/infer/outlives/verify.rs +++ b/src/librustc/infer/outlives/verify.rs @@ -323,7 +323,7 @@ impl<'cx, 'gcx, 'tcx> VerifyBoundCx<'cx, 'gcx, 'tcx> { predicates .into_iter() .filter_map(|p| p.as_ref().to_opt_type_outlives()) - .filter_map(|p| p.no_late_bound_regions()) + .filter_map(|p| p.no_bound_vars()) .filter(move |p| compare_ty(p.0)) } } diff --git a/src/librustc/traits/auto_trait.rs b/src/librustc/traits/auto_trait.rs index 50ca6ca78ab..e87e425762d 100644 --- a/src/librustc/traits/auto_trait.rs +++ b/src/librustc/traits/auto_trait.rs @@ -683,8 +683,8 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { } &ty::Predicate::TypeOutlives(ref binder) => { match ( - binder.no_late_bound_regions(), - binder.map_bound_ref(|pred| pred.0).no_late_bound_regions(), + binder.no_bound_vars(), + binder.map_bound_ref(|pred| pred.0).no_bound_vars(), ) { (None, Some(t_a)) => { select.infcx().register_region_obligation_with_cause( diff --git a/src/librustc/traits/fulfill.rs b/src/librustc/traits/fulfill.rs index afe23e47bbf..aea956461f2 100644 --- a/src/librustc/traits/fulfill.rs +++ b/src/librustc/traits/fulfill.rs @@ -349,15 +349,15 @@ impl<'a, 'b, 'gcx, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'gcx, } ty::Predicate::TypeOutlives(ref binder) => { - // Check if there are higher-ranked regions. - match binder.no_late_bound_regions() { + // Check if there are higher-ranked vars. + match binder.no_bound_vars() { // If there are, inspect the underlying type further. None => { // Convert from `Binder>` to `Binder`. let binder = binder.map_bound_ref(|pred| pred.0); - // Check if the type has any bound regions. - match binder.no_late_bound_regions() { + // Check if the type has any bound vars. + match binder.no_bound_vars() { // If so, this obligation is an error (for now). Eventually we should be // able to support additional cases here, like `for<'a> &'a str: 'a`. // NOTE: this is duplicate-implemented between here and fulfillment. diff --git a/src/librustc/traits/mod.rs b/src/librustc/traits/mod.rs index 6b2ec64668e..5e2f1fe08b9 100644 --- a/src/librustc/traits/mod.rs +++ b/src/librustc/traits/mod.rs @@ -352,7 +352,7 @@ impl<'tcx> GoalKind<'tcx> { domain_goal: PolyDomainGoal<'tcx>, tcx: TyCtxt<'a, 'tcx, 'tcx>, ) -> GoalKind<'tcx> { - match domain_goal.no_late_bound_regions() { + match domain_goal.no_bound_vars() { Some(p) => p.into_goal(), None => GoalKind::Quantified( QuantifierKind::Universal, diff --git a/src/librustc/traits/project.rs b/src/librustc/traits/project.rs index c0bc214fe7a..80358294d05 100644 --- a/src/librustc/traits/project.rs +++ b/src/librustc/traits/project.rs @@ -1619,7 +1619,7 @@ impl<'cx, 'gcx, 'tcx> ProjectionCacheKey<'tcx> { let infcx = selcx.infcx(); // We don't do cross-snapshot caching of obligations with escaping regions, // so there's no cache key to use - predicate.no_late_bound_regions() + predicate.no_bound_vars() .map(|predicate| ProjectionCacheKey { // We don't attempt to match up with a specific type-variable state // from a specific call to `opt_normalize_projection_type` - if diff --git a/src/librustc/traits/query/outlives_bounds.rs b/src/librustc/traits/query/outlives_bounds.rs index 99f557d44d9..b3fae3bab34 100644 --- a/src/librustc/traits/query/outlives_bounds.rs +++ b/src/librustc/traits/query/outlives_bounds.rs @@ -164,7 +164,7 @@ pub fn explicit_outlives_bounds<'tcx>( ty::Predicate::ClosureKind(..) | ty::Predicate::TypeOutlives(..) | ty::Predicate::ConstEvaluatable(..) => None, - ty::Predicate::RegionOutlives(ref data) => data.no_late_bound_regions().map( + ty::Predicate::RegionOutlives(ref data) => data.no_bound_vars().map( |ty::OutlivesPredicate(r_a, r_b)| OutlivesBound::RegionSubRegion(r_b, r_a), ), }) diff --git a/src/librustc/traits/select.rs b/src/librustc/traits/select.rs index 6670b83bdf8..45dad508af5 100644 --- a/src/librustc/traits/select.rs +++ b/src/librustc/traits/select.rs @@ -2168,7 +2168,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { // T: Trait // so it seems ok if we (conservatively) fail to accept that `Unsize` // obligation above. Should be possible to extend this in the future. - let source = match obligation.self_ty().no_late_bound_regions() { + let source = match obligation.self_ty().no_bound_vars() { Some(t) => t, None => { // Don't add any candidates if there are bound regions. @@ -3235,7 +3235,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { // assemble_candidates_for_unsizing should ensure there are no late bound // regions here. See the comment there for more details. let source = self.infcx - .shallow_resolve(obligation.self_ty().no_late_bound_regions().unwrap()); + .shallow_resolve(obligation.self_ty().no_bound_vars().unwrap()); let target = obligation .predicate .skip_binder() diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs index f23bd01765a..fbc77fdfea3 100644 --- a/src/librustc/ty/sty.rs +++ b/src/librustc/ty/sty.rs @@ -799,10 +799,10 @@ impl Binder { /// Skips the binder and returns the "bound" value. This is a /// risky thing to do because it's easy to get confused about /// debruijn indices and the like. It is usually better to - /// discharge the binder using `no_late_bound_regions` or + /// discharge the binder using `no_bound_vars` or /// `replace_late_bound_regions` or something like /// that. `skip_binder` is only valid when you are either - /// extracting data that has nothing to do with bound regions, you + /// extracting data that has nothing to do with bound vars, you /// are doing some sort of test that does not involve bound /// regions, or you are being very careful about your depth /// accounting. @@ -811,7 +811,7 @@ impl Binder { /// /// - extracting the def-id from a PolyTraitRef; /// - comparing the self type of a PolyTraitRef to see if it is equal to - /// a type parameter `X`, since the type `X` does not reference any regions + /// a type parameter `X`, since the type `X` does not reference any regions pub fn skip_binder(&self) -> &T { &self.0 } @@ -833,17 +833,17 @@ impl Binder { } /// Unwraps and returns the value within, but only if it contains - /// no bound regions at all. (In other words, if this binder -- + /// no bound vars at all. (In other words, if this binder -- /// and indeed any enclosing binder -- doesn't bind anything at /// all.) Otherwise, returns `None`. /// /// (One could imagine having a method that just unwraps a single - /// binder, but permits late-bound regions bound by enclosing + /// binder, but permits late-bound vars bound by enclosing /// binders, but that would require adjusting the debruijn /// indices, and given the shallow binding structure we often use, /// would not be that useful.) - pub fn no_late_bound_regions<'tcx>(self) -> Option - where T : TypeFoldable<'tcx> + pub fn no_bound_vars<'tcx>(self) -> Option + where T: TypeFoldable<'tcx> { if self.skip_binder().has_escaping_bound_vars() { None diff --git a/src/librustc_codegen_llvm/base.rs b/src/librustc_codegen_llvm/base.rs index a4c7a7123b9..c1f096bc191 100644 --- a/src/librustc_codegen_llvm/base.rs +++ b/src/librustc_codegen_llvm/base.rs @@ -557,7 +557,7 @@ fn maybe_create_entry_wrapper(cx: &CodegenCx) { // regions must appear in the argument // listing. let main_ret_ty = cx.tcx.erase_regions( - &main_ret_ty.no_late_bound_regions().unwrap(), + &main_ret_ty.no_bound_vars().unwrap(), ); if declare::get_defined_value(cx, "main").is_some() { 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 5904138ef60..35ec4781435 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 @@ -82,9 +82,9 @@ impl<'a, 'gcx, 'tcx> ConstraintConversion<'a, 'gcx, 'tcx> { // when we move to universes, we will, and this assertion // will start to fail. let ty::OutlivesPredicate(k1, r2) = - query_constraint.no_late_bound_regions().unwrap_or_else(|| { + query_constraint.no_bound_vars().unwrap_or_else(|| { bug!( - "query_constraint {:?} contained bound regions", + "query_constraint {:?} contained bound vars", query_constraint, ); }); 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 91c2035838d..734ddbc3ab9 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/mod.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/mod.rs @@ -2214,8 +2214,8 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { .enumerate() .filter_map(|(idx, constraint)| { let ty::OutlivesPredicate(k1, r2) = - constraint.no_late_bound_regions().unwrap_or_else(|| { - bug!("query_constraint {:?} contained bound regions", constraint,); + constraint.no_bound_vars().unwrap_or_else(|| { + bug!("query_constraint {:?} contained bound vars", constraint,); }); match k1.unpack() { diff --git a/src/librustc_mir/monomorphize/collector.rs b/src/librustc_mir/monomorphize/collector.rs index 6b39060d6fc..8e27635dee8 100644 --- a/src/librustc_mir/monomorphize/collector.rs +++ b/src/librustc_mir/monomorphize/collector.rs @@ -1082,7 +1082,7 @@ impl<'b, 'a, 'v> RootCollector<'b, 'a, 'v> { // regions must appear in the argument // listing. let main_ret_ty = self.tcx.erase_regions( - &main_ret_ty.no_late_bound_regions().unwrap(), + &main_ret_ty.no_bound_vars().unwrap(), ); let start_instance = Instance::resolve( diff --git a/src/librustc_mir/shim.rs b/src/librustc_mir/shim.rs index 7061504cd0a..76a8501fb17 100644 --- a/src/librustc_mir/shim.rs +++ b/src/librustc_mir/shim.rs @@ -844,7 +844,9 @@ pub fn build_adt_ctor<'a, 'gcx, 'tcx>(infcx: &infer::InferCtxt<'a, 'gcx, 'tcx>, let param_env = gcx.param_env(def_id); // Normalize the sig. - let sig = gcx.fn_sig(def_id).no_late_bound_regions().expect("LBR in ADT constructor signature"); + let sig = gcx.fn_sig(def_id) + .no_bound_vars() + .expect("LBR in ADT constructor signature"); let sig = gcx.normalize_erasing_regions(param_env, sig); let (adt_def, substs) = match sig.output().sty { diff --git a/src/librustc_mir/transform/lower_128bit.rs b/src/librustc_mir/transform/lower_128bit.rs index bd7d9d36761..80072153167 100644 --- a/src/librustc_mir/transform/lower_128bit.rs +++ b/src/librustc_mir/transform/lower_128bit.rs @@ -143,7 +143,7 @@ fn check_lang_item_type<'a, 'tcx, D>( { let did = tcx.require_lang_item(lang_item); let poly_sig = tcx.fn_sig(did); - let sig = poly_sig.no_late_bound_regions().unwrap(); + let sig = poly_sig.no_bound_vars().unwrap(); let lhs_ty = lhs.ty(local_decls, tcx); let rhs_ty = rhs.ty(local_decls, tcx); let place_ty = place.ty(local_decls, tcx).to_ty(tcx); diff --git a/src/librustc_traits/implied_outlives_bounds.rs b/src/librustc_traits/implied_outlives_bounds.rs index b97450f9662..7cc064f9c3d 100644 --- a/src/librustc_traits/implied_outlives_bounds.rs +++ b/src/librustc_traits/implied_outlives_bounds.rs @@ -122,14 +122,14 @@ fn compute_implied_outlives_bounds<'tcx>( vec![] } - ty::Predicate::RegionOutlives(ref data) => match data.no_late_bound_regions() { + ty::Predicate::RegionOutlives(ref data) => match data.no_bound_vars() { None => vec![], Some(ty::OutlivesPredicate(r_a, r_b)) => { vec![OutlivesBound::RegionSubRegion(r_b, r_a)] } }, - ty::Predicate::TypeOutlives(ref data) => match data.no_late_bound_regions() { + ty::Predicate::TypeOutlives(ref data) => match data.no_bound_vars() { None => vec![], Some(ty::OutlivesPredicate(ty_a, r_b)) => { let ty_a = infcx.resolve_type_vars_if_possible(&ty_a); diff --git a/src/librustc_typeck/check/_match.rs b/src/librustc_typeck/check/_match.rs index 3204ef556f5..40f2072079a 100644 --- a/src/librustc_typeck/check/_match.rs +++ b/src/librustc_typeck/check/_match.rs @@ -816,7 +816,7 @@ https://doc.rust-lang.org/reference/types.html#trait-objects"); } // Replace constructor type with constructed type for tuple struct patterns. let pat_ty = pat_ty.fn_sig(tcx).output(); - let pat_ty = pat_ty.no_late_bound_regions().expect("expected fn type"); + let pat_ty = pat_ty.no_bound_vars().expect("expected fn type"); self.demand_eqtype(pat.span, expected, pat_ty); diff --git a/src/librustc_typeck/check/intrinsic.rs b/src/librustc_typeck/check/intrinsic.rs index da96d4f0cba..3156458b4aa 100644 --- a/src/librustc_typeck/check/intrinsic.rs +++ b/src/librustc_typeck/check/intrinsic.rs @@ -419,7 +419,7 @@ pub fn check_platform_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let mut structural_to_nomimal = FxHashMap::default(); let sig = tcx.fn_sig(def_id); - let sig = sig.no_late_bound_regions().unwrap(); + let sig = sig.no_bound_vars().unwrap(); if intr.inputs.len() != sig.inputs().len() { span_err!(tcx.sess, it.span, E0444, "platform-specific intrinsic has invalid number of \ diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index eb52a013b05..bf3887ee8fc 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -208,7 +208,7 @@ impl<'a, 'tcx> AstConv<'tcx, 'tcx> for ItemCtxt<'a, 'tcx> { item_def_id: DefId, poly_trait_ref: ty::PolyTraitRef<'tcx>, ) -> Ty<'tcx> { - if let Some(trait_ref) = poly_trait_ref.no_late_bound_regions() { + if let Some(trait_ref) = poly_trait_ref.no_bound_vars() { self.tcx().mk_projection(item_def_id, trait_ref.substs) } else { // no late-bound regions, we can just ignore the binder