1
Fork 0

Remove unused part of return value from replace_bound_vars_with_placeholders

This commit is contained in:
Matthew Jasper 2020-06-28 20:27:59 +01:00
parent 1b07991574
commit d4d9e7f67f
5 changed files with 12 additions and 20 deletions

View file

@ -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`.

View file

@ -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)