Skip to content

Commit d99195a

Browse files
committed
Rename Binder::no_late_bound_regions to Binder::no_bound_vars
1 parent 45be1ac commit d99195a

File tree

18 files changed

+34
-32
lines changed

18 files changed

+34
-32
lines changed

src/librustc/infer/outlives/verify.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ impl<'cx, 'gcx, 'tcx> VerifyBoundCx<'cx, 'gcx, 'tcx> {
323323
predicates
324324
.into_iter()
325325
.filter_map(|p| p.as_ref().to_opt_type_outlives())
326-
.filter_map(|p| p.no_late_bound_regions())
326+
.filter_map(|p| p.no_bound_vars())
327327
.filter(move |p| compare_ty(p.0))
328328
}
329329
}

src/librustc/traits/auto_trait.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -683,8 +683,8 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
683683
}
684684
&ty::Predicate::TypeOutlives(ref binder) => {
685685
match (
686-
binder.no_late_bound_regions(),
687-
binder.map_bound_ref(|pred| pred.0).no_late_bound_regions(),
686+
binder.no_bound_vars(),
687+
binder.map_bound_ref(|pred| pred.0).no_bound_vars(),
688688
) {
689689
(None, Some(t_a)) => {
690690
select.infcx().register_region_obligation_with_cause(

src/librustc/traits/fulfill.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -349,15 +349,15 @@ impl<'a, 'b, 'gcx, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'gcx,
349349
}
350350

351351
ty::Predicate::TypeOutlives(ref binder) => {
352-
// Check if there are higher-ranked regions.
353-
match binder.no_late_bound_regions() {
352+
// Check if there are higher-ranked vars.
353+
match binder.no_bound_vars() {
354354
// If there are, inspect the underlying type further.
355355
None => {
356356
// Convert from `Binder<OutlivesPredicate<Ty, Region>>` to `Binder<Ty>`.
357357
let binder = binder.map_bound_ref(|pred| pred.0);
358358

359-
// Check if the type has any bound regions.
360-
match binder.no_late_bound_regions() {
359+
// Check if the type has any bound vars.
360+
match binder.no_bound_vars() {
361361
// If so, this obligation is an error (for now). Eventually we should be
362362
// able to support additional cases here, like `for<'a> &'a str: 'a`.
363363
// NOTE: this is duplicate-implemented between here and fulfillment.

src/librustc/traits/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ impl<'tcx> GoalKind<'tcx> {
352352
domain_goal: PolyDomainGoal<'tcx>,
353353
tcx: TyCtxt<'a, 'tcx, 'tcx>,
354354
) -> GoalKind<'tcx> {
355-
match domain_goal.no_late_bound_regions() {
355+
match domain_goal.no_bound_vars() {
356356
Some(p) => p.into_goal(),
357357
None => GoalKind::Quantified(
358358
QuantifierKind::Universal,

src/librustc/traits/project.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1619,7 +1619,7 @@ impl<'cx, 'gcx, 'tcx> ProjectionCacheKey<'tcx> {
16191619
let infcx = selcx.infcx();
16201620
// We don't do cross-snapshot caching of obligations with escaping regions,
16211621
// so there's no cache key to use
1622-
predicate.no_late_bound_regions()
1622+
predicate.no_bound_vars()
16231623
.map(|predicate| ProjectionCacheKey {
16241624
// We don't attempt to match up with a specific type-variable state
16251625
// from a specific call to `opt_normalize_projection_type` - if

src/librustc/traits/query/outlives_bounds.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ pub fn explicit_outlives_bounds<'tcx>(
164164
ty::Predicate::ClosureKind(..) |
165165
ty::Predicate::TypeOutlives(..) |
166166
ty::Predicate::ConstEvaluatable(..) => None,
167-
ty::Predicate::RegionOutlives(ref data) => data.no_late_bound_regions().map(
167+
ty::Predicate::RegionOutlives(ref data) => data.no_bound_vars().map(
168168
|ty::OutlivesPredicate(r_a, r_b)| OutlivesBound::RegionSubRegion(r_b, r_a),
169169
),
170170
})

src/librustc/traits/select.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2168,7 +2168,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
21682168
// T: Trait
21692169
// so it seems ok if we (conservatively) fail to accept that `Unsize`
21702170
// obligation above. Should be possible to extend this in the future.
2171-
let source = match obligation.self_ty().no_late_bound_regions() {
2171+
let source = match obligation.self_ty().no_bound_vars() {
21722172
Some(t) => t,
21732173
None => {
21742174
// Don't add any candidates if there are bound regions.
@@ -3235,7 +3235,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
32353235
// assemble_candidates_for_unsizing should ensure there are no late bound
32363236
// regions here. See the comment there for more details.
32373237
let source = self.infcx
3238-
.shallow_resolve(obligation.self_ty().no_late_bound_regions().unwrap());
3238+
.shallow_resolve(obligation.self_ty().no_bound_vars().unwrap());
32393239
let target = obligation
32403240
.predicate
32413241
.skip_binder()

src/librustc/ty/sty.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -799,10 +799,10 @@ impl<T> Binder<T> {
799799
/// Skips the binder and returns the "bound" value. This is a
800800
/// risky thing to do because it's easy to get confused about
801801
/// debruijn indices and the like. It is usually better to
802-
/// discharge the binder using `no_late_bound_regions` or
802+
/// discharge the binder using `no_bound_vars` or
803803
/// `replace_late_bound_regions` or something like
804804
/// that. `skip_binder` is only valid when you are either
805-
/// extracting data that has nothing to do with bound regions, you
805+
/// extracting data that has nothing to do with bound vars, you
806806
/// are doing some sort of test that does not involve bound
807807
/// regions, or you are being very careful about your depth
808808
/// accounting.
@@ -811,7 +811,7 @@ impl<T> Binder<T> {
811811
///
812812
/// - extracting the def-id from a PolyTraitRef;
813813
/// - comparing the self type of a PolyTraitRef to see if it is equal to
814-
/// a type parameter `X`, since the type `X` does not reference any regions
814+
/// a type parameter `X`, since the type `X` does not reference any regions
815815
pub fn skip_binder(&self) -> &T {
816816
&self.0
817817
}
@@ -833,17 +833,17 @@ impl<T> Binder<T> {
833833
}
834834

835835
/// Unwraps and returns the value within, but only if it contains
836-
/// no bound regions at all. (In other words, if this binder --
836+
/// no bound vars at all. (In other words, if this binder --
837837
/// and indeed any enclosing binder -- doesn't bind anything at
838838
/// all.) Otherwise, returns `None`.
839839
///
840840
/// (One could imagine having a method that just unwraps a single
841-
/// binder, but permits late-bound regions bound by enclosing
841+
/// binder, but permits late-bound vars bound by enclosing
842842
/// binders, but that would require adjusting the debruijn
843843
/// indices, and given the shallow binding structure we often use,
844844
/// would not be that useful.)
845-
pub fn no_late_bound_regions<'tcx>(self) -> Option<T>
846-
where T : TypeFoldable<'tcx>
845+
pub fn no_bound_vars<'tcx>(self) -> Option<T>
846+
where T: TypeFoldable<'tcx>
847847
{
848848
if self.skip_binder().has_escaping_bound_vars() {
849849
None

src/librustc_codegen_llvm/base.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ fn maybe_create_entry_wrapper(cx: &CodegenCx) {
557557
// regions must appear in the argument
558558
// listing.
559559
let main_ret_ty = cx.tcx.erase_regions(
560-
&main_ret_ty.no_late_bound_regions().unwrap(),
560+
&main_ret_ty.no_bound_vars().unwrap(),
561561
);
562562

563563
if declare::get_defined_value(cx, "main").is_some() {

src/librustc_mir/borrow_check/nll/type_check/constraint_conversion.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ impl<'a, 'gcx, 'tcx> ConstraintConversion<'a, 'gcx, 'tcx> {
8282
// when we move to universes, we will, and this assertion
8383
// will start to fail.
8484
let ty::OutlivesPredicate(k1, r2) =
85-
query_constraint.no_late_bound_regions().unwrap_or_else(|| {
85+
query_constraint.no_bound_vars().unwrap_or_else(|| {
8686
bug!(
87-
"query_constraint {:?} contained bound regions",
87+
"query_constraint {:?} contained bound vars",
8888
query_constraint,
8989
);
9090
});

src/librustc_mir/borrow_check/nll/type_check/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2214,8 +2214,8 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
22142214
.enumerate()
22152215
.filter_map(|(idx, constraint)| {
22162216
let ty::OutlivesPredicate(k1, r2) =
2217-
constraint.no_late_bound_regions().unwrap_or_else(|| {
2218-
bug!("query_constraint {:?} contained bound regions", constraint,);
2217+
constraint.no_bound_vars().unwrap_or_else(|| {
2218+
bug!("query_constraint {:?} contained bound vars", constraint,);
22192219
});
22202220

22212221
match k1.unpack() {

src/librustc_mir/monomorphize/collector.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1082,7 +1082,7 @@ impl<'b, 'a, 'v> RootCollector<'b, 'a, 'v> {
10821082
// regions must appear in the argument
10831083
// listing.
10841084
let main_ret_ty = self.tcx.erase_regions(
1085-
&main_ret_ty.no_late_bound_regions().unwrap(),
1085+
&main_ret_ty.no_bound_vars().unwrap(),
10861086
);
10871087

10881088
let start_instance = Instance::resolve(

src/librustc_mir/shim.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -844,7 +844,9 @@ pub fn build_adt_ctor<'a, 'gcx, 'tcx>(infcx: &infer::InferCtxt<'a, 'gcx, 'tcx>,
844844
let param_env = gcx.param_env(def_id);
845845

846846
// Normalize the sig.
847-
let sig = gcx.fn_sig(def_id).no_late_bound_regions().expect("LBR in ADT constructor signature");
847+
let sig = gcx.fn_sig(def_id)
848+
.no_bound_vars()
849+
.expect("LBR in ADT constructor signature");
848850
let sig = gcx.normalize_erasing_regions(param_env, sig);
849851

850852
let (adt_def, substs) = match sig.output().sty {

src/librustc_mir/transform/lower_128bit.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ fn check_lang_item_type<'a, 'tcx, D>(
143143
{
144144
let did = tcx.require_lang_item(lang_item);
145145
let poly_sig = tcx.fn_sig(did);
146-
let sig = poly_sig.no_late_bound_regions().unwrap();
146+
let sig = poly_sig.no_bound_vars().unwrap();
147147
let lhs_ty = lhs.ty(local_decls, tcx);
148148
let rhs_ty = rhs.ty(local_decls, tcx);
149149
let place_ty = place.ty(local_decls, tcx).to_ty(tcx);

src/librustc_traits/implied_outlives_bounds.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -122,14 +122,14 @@ fn compute_implied_outlives_bounds<'tcx>(
122122
vec![]
123123
}
124124

125-
ty::Predicate::RegionOutlives(ref data) => match data.no_late_bound_regions() {
125+
ty::Predicate::RegionOutlives(ref data) => match data.no_bound_vars() {
126126
None => vec![],
127127
Some(ty::OutlivesPredicate(r_a, r_b)) => {
128128
vec![OutlivesBound::RegionSubRegion(r_b, r_a)]
129129
}
130130
},
131131

132-
ty::Predicate::TypeOutlives(ref data) => match data.no_late_bound_regions() {
132+
ty::Predicate::TypeOutlives(ref data) => match data.no_bound_vars() {
133133
None => vec![],
134134
Some(ty::OutlivesPredicate(ty_a, r_b)) => {
135135
let ty_a = infcx.resolve_type_vars_if_possible(&ty_a);

src/librustc_typeck/check/_match.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,7 @@ https://doc.rust-lang.org/reference/types.html#trait-objects");
816816
}
817817
// Replace constructor type with constructed type for tuple struct patterns.
818818
let pat_ty = pat_ty.fn_sig(tcx).output();
819-
let pat_ty = pat_ty.no_late_bound_regions().expect("expected fn type");
819+
let pat_ty = pat_ty.no_bound_vars().expect("expected fn type");
820820

821821
self.demand_eqtype(pat.span, expected, pat_ty);
822822

src/librustc_typeck/check/intrinsic.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ pub fn check_platform_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
419419
let mut structural_to_nomimal = FxHashMap::default();
420420

421421
let sig = tcx.fn_sig(def_id);
422-
let sig = sig.no_late_bound_regions().unwrap();
422+
let sig = sig.no_bound_vars().unwrap();
423423
if intr.inputs.len() != sig.inputs().len() {
424424
span_err!(tcx.sess, it.span, E0444,
425425
"platform-specific intrinsic has invalid number of \

src/librustc_typeck/collect.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ impl<'a, 'tcx> AstConv<'tcx, 'tcx> for ItemCtxt<'a, 'tcx> {
208208
item_def_id: DefId,
209209
poly_trait_ref: ty::PolyTraitRef<'tcx>,
210210
) -> Ty<'tcx> {
211-
if let Some(trait_ref) = poly_trait_ref.no_late_bound_regions() {
211+
if let Some(trait_ref) = poly_trait_ref.no_bound_vars() {
212212
self.tcx().mk_projection(item_def_id, trait_ref.substs)
213213
} else {
214214
// no late-bound regions, we can just ignore the binder

0 commit comments

Comments
 (0)