Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit d4d9e7f

Browse files
committed
Remove unused part of return value from replace_bound_vars_with_placeholders
1 parent 1b07991 commit d4d9e7f

File tree

5 files changed

+12
-20
lines changed

5 files changed

+12
-20
lines changed

compiler/rustc_infer/src/infer/higher_ranked/mod.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//! the end of the file for details.
33
44
use super::combine::CombineFields;
5-
use super::{HigherRankedType, InferCtxt, PlaceholderMap};
5+
use super::{HigherRankedType, InferCtxt};
66

77
use crate::infer::CombinedSnapshot;
88
use rustc_middle::ty::relate::{Relate, RelateResult, TypeRelation};
@@ -33,7 +33,7 @@ impl<'a, 'tcx> CombineFields<'a, 'tcx> {
3333
self.infcx.commit_if_ok(|_| {
3434
// First, we instantiate each bound region in the supertype with a
3535
// fresh placeholder region.
36-
let (b_prime, _) = self.infcx.replace_bound_vars_with_placeholders(&b);
36+
let b_prime = self.infcx.replace_bound_vars_with_placeholders(&b);
3737

3838
// Next, we instantiate each bound region in the subtype
3939
// with a fresh region variable. These region variables --
@@ -66,10 +66,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
6666
/// the [rustc dev guide].
6767
///
6868
/// [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/traits/hrtb.html
69-
pub fn replace_bound_vars_with_placeholders<T>(
70-
&self,
71-
binder: &ty::Binder<T>,
72-
) -> (T, PlaceholderMap<'tcx>)
69+
pub fn replace_bound_vars_with_placeholders<T>(&self, binder: &ty::Binder<T>) -> T
7370
where
7471
T: TypeFoldable<'tcx>,
7572
{
@@ -122,7 +119,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
122119
next_universe, binder, result, map,
123120
);
124121

125-
(result, map)
122+
result
126123
}
127124

128125
/// See `infer::region_constraints::RegionConstraintCollector::leak_check`.

compiler/rustc_infer/src/infer/mod.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -351,11 +351,6 @@ pub struct InferCtxt<'a, 'tcx> {
351351
universe: Cell<ty::UniverseIndex>,
352352
}
353353

354-
/// A map returned by `replace_bound_vars_with_placeholders()`
355-
/// indicating the placeholder region that each late-bound region was
356-
/// replaced with.
357-
pub type PlaceholderMap<'tcx> = BTreeMap<ty::BoundRegion, ty::Region<'tcx>>;
358-
359354
/// See the `error_reporting` module for more details.
360355
#[derive(Clone, Debug, PartialEq, Eq, TypeFoldable)]
361356
pub enum ValuePairs<'tcx> {
@@ -992,7 +987,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
992987
}
993988

994989
Some(self.commit_if_ok(|_snapshot| {
995-
let (ty::SubtypePredicate { a_is_expected, a, b }, _) =
990+
let ty::SubtypePredicate { a_is_expected, a, b } =
996991
self.replace_bound_vars_with_placeholders(&predicate);
997992

998993
let ok = self.at(cause, param_env).sub_exp(a_is_expected, a, b)?;
@@ -1007,7 +1002,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
10071002
predicate: ty::PolyRegionOutlivesPredicate<'tcx>,
10081003
) -> UnitResult<'tcx> {
10091004
self.commit_if_ok(|_snapshot| {
1010-
let (ty::OutlivesPredicate(r_a, r_b), _) =
1005+
let ty::OutlivesPredicate(r_a, r_b) =
10111006
self.replace_bound_vars_with_placeholders(&predicate);
10121007
let origin = SubregionOrigin::from_obligation_cause(cause, || {
10131008
RelateRegionParamBound(cause.span)

compiler/rustc_trait_selection/src/traits/project.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ pub(super) fn poly_project_and_unify_type<'cx, 'tcx>(
167167

168168
let infcx = selcx.infcx();
169169
infcx.commit_if_ok(|_snapshot| {
170-
let (placeholder_predicate, _) =
170+
let placeholder_predicate =
171171
infcx.replace_bound_vars_with_placeholders(&obligation.predicate);
172172

173173
let placeholder_obligation = obligation.with(placeholder_predicate);

compiler/rustc_trait_selection/src/traits/select/confirmation.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
253253
let trait_obligations: Vec<PredicateObligation<'_>> =
254254
self.infcx.commit_unconditionally(|_| {
255255
let poly_trait_ref = obligation.predicate.to_poly_trait_ref();
256-
let (trait_ref, _) =
256+
let trait_ref =
257257
self.infcx.replace_bound_vars_with_placeholders(&poly_trait_ref);
258258
let cause = obligation.derived_cause(ImplDerivedObligation);
259259
self.impl_or_trait_obligations(
@@ -437,7 +437,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
437437
debug!("confirm_trait_alias_candidate({:?}, {:?})", obligation, alias_def_id);
438438

439439
self.infcx.commit_unconditionally(|_| {
440-
let (predicate, _) =
440+
let predicate =
441441
self.infcx().replace_bound_vars_with_placeholders(&obligation.predicate);
442442
let trait_ref = predicate.trait_ref;
443443
let trait_def_id = trait_ref.def_id;

compiler/rustc_trait_selection/src/traits/select/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,7 +1161,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
11611161
obligation: &TraitObligation<'tcx>,
11621162
) -> Option<ty::PolyTraitRef<'tcx>> {
11631163
let poly_trait_predicate = self.infcx().resolve_vars_if_possible(&obligation.predicate);
1164-
let (placeholder_trait_predicate, _) =
1164+
let placeholder_trait_predicate =
11651165
self.infcx().replace_bound_vars_with_placeholders(&poly_trait_predicate);
11661166
debug!(
11671167
"match_projection_obligation_against_definition_bounds: \
@@ -1640,7 +1640,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
16401640
let ty: ty::Binder<Ty<'tcx>> = ty::Binder::bind(ty); // <----/
16411641

16421642
self.infcx.commit_unconditionally(|_| {
1643-
let (placeholder_ty, _) = self.infcx.replace_bound_vars_with_placeholders(&ty);
1643+
let placeholder_ty = self.infcx.replace_bound_vars_with_placeholders(&ty);
16441644
let Normalized { value: normalized_ty, mut obligations } =
16451645
ensure_sufficient_stack(|| {
16461646
project::normalize_with_depth(
@@ -1708,7 +1708,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
17081708
return Err(());
17091709
}
17101710

1711-
let (placeholder_obligation, _) =
1711+
let placeholder_obligation =
17121712
self.infcx().replace_bound_vars_with_placeholders(&obligation.predicate);
17131713
let placeholder_obligation_trait_ref = placeholder_obligation.trait_ref;
17141714

0 commit comments

Comments
 (0)