mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-26 22:53:28 +00:00
Remove unused part of return value from replace_bound_vars_with_placeholders
This commit is contained in:
parent
1b07991574
commit
d4d9e7f67f
@ -2,7 +2,7 @@
|
||||
//! the end of the file for details.
|
||||
|
||||
use super::combine::CombineFields;
|
||||
use super::{HigherRankedType, InferCtxt, PlaceholderMap};
|
||||
use super::{HigherRankedType, InferCtxt};
|
||||
|
||||
use crate::infer::CombinedSnapshot;
|
||||
use rustc_middle::ty::relate::{Relate, RelateResult, TypeRelation};
|
||||
@ -33,7 +33,7 @@ impl<'a, 'tcx> CombineFields<'a, 'tcx> {
|
||||
self.infcx.commit_if_ok(|_| {
|
||||
// First, we instantiate each bound region in the supertype with a
|
||||
// fresh placeholder region.
|
||||
let (b_prime, _) = self.infcx.replace_bound_vars_with_placeholders(&b);
|
||||
let b_prime = self.infcx.replace_bound_vars_with_placeholders(&b);
|
||||
|
||||
// Next, we instantiate each bound region in the subtype
|
||||
// with a fresh region variable. These region variables --
|
||||
@ -66,10 +66,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
/// the [rustc dev guide].
|
||||
///
|
||||
/// [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/traits/hrtb.html
|
||||
pub fn replace_bound_vars_with_placeholders<T>(
|
||||
&self,
|
||||
binder: &ty::Binder<T>,
|
||||
) -> (T, PlaceholderMap<'tcx>)
|
||||
pub fn replace_bound_vars_with_placeholders<T>(&self, binder: &ty::Binder<T>) -> T
|
||||
where
|
||||
T: TypeFoldable<'tcx>,
|
||||
{
|
||||
@ -122,7 +119,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
next_universe, binder, result, map,
|
||||
);
|
||||
|
||||
(result, map)
|
||||
result
|
||||
}
|
||||
|
||||
/// See `infer::region_constraints::RegionConstraintCollector::leak_check`.
|
||||
|
@ -351,11 +351,6 @@ pub struct InferCtxt<'a, 'tcx> {
|
||||
universe: Cell<ty::UniverseIndex>,
|
||||
}
|
||||
|
||||
/// A map returned by `replace_bound_vars_with_placeholders()`
|
||||
/// indicating the placeholder region that each late-bound region was
|
||||
/// replaced with.
|
||||
pub type PlaceholderMap<'tcx> = BTreeMap<ty::BoundRegion, ty::Region<'tcx>>;
|
||||
|
||||
/// See the `error_reporting` module for more details.
|
||||
#[derive(Clone, Debug, PartialEq, Eq, TypeFoldable)]
|
||||
pub enum ValuePairs<'tcx> {
|
||||
@ -992,7 +987,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
}
|
||||
|
||||
Some(self.commit_if_ok(|_snapshot| {
|
||||
let (ty::SubtypePredicate { a_is_expected, a, b }, _) =
|
||||
let ty::SubtypePredicate { a_is_expected, a, b } =
|
||||
self.replace_bound_vars_with_placeholders(&predicate);
|
||||
|
||||
let ok = self.at(cause, param_env).sub_exp(a_is_expected, a, b)?;
|
||||
@ -1007,7 +1002,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
predicate: ty::PolyRegionOutlivesPredicate<'tcx>,
|
||||
) -> UnitResult<'tcx> {
|
||||
self.commit_if_ok(|_snapshot| {
|
||||
let (ty::OutlivesPredicate(r_a, r_b), _) =
|
||||
let ty::OutlivesPredicate(r_a, r_b) =
|
||||
self.replace_bound_vars_with_placeholders(&predicate);
|
||||
let origin = SubregionOrigin::from_obligation_cause(cause, || {
|
||||
RelateRegionParamBound(cause.span)
|
||||
|
@ -167,7 +167,7 @@ pub(super) fn poly_project_and_unify_type<'cx, 'tcx>(
|
||||
|
||||
let infcx = selcx.infcx();
|
||||
infcx.commit_if_ok(|_snapshot| {
|
||||
let (placeholder_predicate, _) =
|
||||
let placeholder_predicate =
|
||||
infcx.replace_bound_vars_with_placeholders(&obligation.predicate);
|
||||
|
||||
let placeholder_obligation = obligation.with(placeholder_predicate);
|
||||
|
@ -253,7 +253,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
let trait_obligations: Vec<PredicateObligation<'_>> =
|
||||
self.infcx.commit_unconditionally(|_| {
|
||||
let poly_trait_ref = obligation.predicate.to_poly_trait_ref();
|
||||
let (trait_ref, _) =
|
||||
let trait_ref =
|
||||
self.infcx.replace_bound_vars_with_placeholders(&poly_trait_ref);
|
||||
let cause = obligation.derived_cause(ImplDerivedObligation);
|
||||
self.impl_or_trait_obligations(
|
||||
@ -437,7 +437,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
debug!("confirm_trait_alias_candidate({:?}, {:?})", obligation, alias_def_id);
|
||||
|
||||
self.infcx.commit_unconditionally(|_| {
|
||||
let (predicate, _) =
|
||||
let predicate =
|
||||
self.infcx().replace_bound_vars_with_placeholders(&obligation.predicate);
|
||||
let trait_ref = predicate.trait_ref;
|
||||
let trait_def_id = trait_ref.def_id;
|
||||
|
@ -1161,7 +1161,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
obligation: &TraitObligation<'tcx>,
|
||||
) -> Option<ty::PolyTraitRef<'tcx>> {
|
||||
let poly_trait_predicate = self.infcx().resolve_vars_if_possible(&obligation.predicate);
|
||||
let (placeholder_trait_predicate, _) =
|
||||
let placeholder_trait_predicate =
|
||||
self.infcx().replace_bound_vars_with_placeholders(&poly_trait_predicate);
|
||||
debug!(
|
||||
"match_projection_obligation_against_definition_bounds: \
|
||||
@ -1640,7 +1640,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
let ty: ty::Binder<Ty<'tcx>> = ty::Binder::bind(ty); // <----/
|
||||
|
||||
self.infcx.commit_unconditionally(|_| {
|
||||
let (placeholder_ty, _) = self.infcx.replace_bound_vars_with_placeholders(&ty);
|
||||
let placeholder_ty = self.infcx.replace_bound_vars_with_placeholders(&ty);
|
||||
let Normalized { value: normalized_ty, mut obligations } =
|
||||
ensure_sufficient_stack(|| {
|
||||
project::normalize_with_depth(
|
||||
@ -1708,7 +1708,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
return Err(());
|
||||
}
|
||||
|
||||
let (placeholder_obligation, _) =
|
||||
let placeholder_obligation =
|
||||
self.infcx().replace_bound_vars_with_placeholders(&obligation.predicate);
|
||||
let placeholder_obligation_trait_ref = placeholder_obligation.trait_ref;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user