Auto merge of #39877 - estebank:remove-params, r=petrochenkov

Remove noop method `Substs::params()`

Re: 48b3dd11f5 & 7a8d4822d8
This commit is contained in:
bors 2017-02-18 09:50:10 +00:00
commit 3c97cbe4c2
6 changed files with 9 additions and 15 deletions

View File

@ -2547,7 +2547,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
// TyError and ensure they do not affect any other fields.
// This could be checked after type collection for any struct
// with a potentially unsized trailing field.
let params = substs_a.params().iter().enumerate().map(|(i, &k)| {
let params = substs_a.iter().enumerate().map(|(i, &k)| {
if ty_params.contains(i) {
Kind::from(tcx.types.err)
} else {
@ -2567,7 +2567,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
// Check that the source structure with the target's
// type parameters is a subtype of the target.
let params = substs_a.params().iter().enumerate().map(|(i, &k)| {
let params = substs_a.iter().enumerate().map(|(i, &k)| {
if ty_params.contains(i) {
Kind::from(substs_b.type_at(i))
} else {

View File

@ -143,7 +143,7 @@ pub fn relate_substs<'a, 'gcx, 'tcx, R>(relation: &mut R,
{
let tcx = relation.tcx();
let params = a_subst.params().iter().zip(b_subst.params()).enumerate().map(|(i, (a, b))| {
let params = a_subst.iter().zip(b_subst).enumerate().map(|(i, (a, b))| {
let variance = variances.map_or(ty::Invariant, |v| v[i]);
if let (Some(a_ty), Some(b_ty)) = (a.as_type(), b.as_type()) {
Ok(Kind::from(relation.relate_with_variance(variance, &a_ty, &b_ty)?))

View File

@ -254,12 +254,6 @@ impl<'a, 'gcx, 'tcx> Substs<'tcx> {
self.is_empty()
}
#[inline]
pub fn params(&self) -> &[Kind<'tcx>] {
// FIXME (dikaiosune) this should be removed, and corresponding compilation errors fixed
self
}
#[inline]
pub fn types(&'a self) -> impl DoubleEndedIterator<Item=Ty<'tcx>> + 'a {
self.iter().filter_map(|k| k.as_type())

View File

@ -309,17 +309,17 @@ impl<'a, 'gcx, 'tcx> ConfirmContext<'a, 'gcx, 'tcx> {
// parameters from the type and those from the method.
//
// FIXME -- permit users to manually specify lifetimes
let supplied_start = substs.params().len() + method_generics.regions.len();
let supplied_start = substs.len() + method_generics.regions.len();
Substs::for_item(self.tcx, pick.item.def_id, |def, _| {
let i = def.index as usize;
if i < substs.params().len() {
if i < substs.len() {
substs.region_at(i)
} else {
self.region_var_for_def(self.span, def)
}
}, |def, cur_substs| {
let i = def.index as usize;
if i < substs.params().len() {
if i < substs.len() {
substs.type_at(i)
} else if supplied_method_types.is_empty() {
self.type_var_for_def(self.span, def, cur_substs)

View File

@ -1326,7 +1326,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> {
} else {
let substs = Substs::for_item(self.tcx, method, |def, _| {
let i = def.index as usize;
if i < substs.params().len() {
if i < substs.len() {
substs.region_at(i)
} else {
// In general, during probe we erase regions. See
@ -1335,7 +1335,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> {
}
}, |def, cur_substs| {
let i = def.index as usize;
if i < substs.params().len() {
if i < substs.len() {
substs.type_at(i)
} else {
self.type_var_for_def(self.span, def, cur_substs)

View File

@ -100,7 +100,7 @@ impl<'cx, 'gcx, 'tcx> WritebackCx<'cx, 'gcx, 'tcx> {
let gcx = fcx.tcx.global_tcx();
let free_substs = fcx.parameter_environment.free_substs;
for (i, k) in free_substs.params().iter().enumerate() {
for (i, k) in free_substs.iter().enumerate() {
let r = if let Some(r) = k.as_region() {
r
} else {