Rename Generics::params to Generics::own_params
This commit is contained in:
parent
8c7c151a7a
commit
1c19b6ad60
54 changed files with 177 additions and 169 deletions
|
@ -561,7 +561,7 @@ fn check_opaque_precise_captures<'tcx>(tcx: TyCtxt<'tcx>, opaque_def_id: LocalDe
|
|||
let generics = tcx.generics_of(generics);
|
||||
def_id = generics.parent;
|
||||
|
||||
for param in &generics.params {
|
||||
for param in &generics.own_params {
|
||||
if expected_captures.contains(¶m.def_id) {
|
||||
assert_eq!(
|
||||
variances[param.index as usize],
|
||||
|
@ -778,7 +778,7 @@ pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) {
|
|||
let def_id = item.id.owner_id.def_id;
|
||||
let generics = tcx.generics_of(def_id);
|
||||
let own_counts = generics.own_counts();
|
||||
if generics.params.len() - own_counts.lifetimes != 0 {
|
||||
if generics.own_params.len() - own_counts.lifetimes != 0 {
|
||||
let (kinds, kinds_pl, egs) = match (own_counts.types, own_counts.consts)
|
||||
{
|
||||
(_, 0) => ("type", "types", Some("u32")),
|
||||
|
@ -1544,7 +1544,7 @@ fn check_type_alias_type_params_are_used<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalD
|
|||
.collect::<FxIndexMap<_, _>>()
|
||||
});
|
||||
|
||||
let mut params_used = BitSet::new_empty(generics.params.len());
|
||||
let mut params_used = BitSet::new_empty(generics.own_params.len());
|
||||
for leaf in ty.walk() {
|
||||
if let GenericArgKind::Type(leaf_ty) = leaf.unpack()
|
||||
&& let ty::Param(param) = leaf_ty.kind()
|
||||
|
@ -1554,7 +1554,7 @@ fn check_type_alias_type_params_are_used<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalD
|
|||
}
|
||||
}
|
||||
|
||||
for param in &generics.params {
|
||||
for param in &generics.own_params {
|
||||
if !params_used.contains(param.index)
|
||||
&& let ty::GenericParamDefKind::Type { .. } = param.kind
|
||||
{
|
||||
|
|
|
@ -716,7 +716,7 @@ pub(super) fn collect_return_position_impl_trait_in_trait_tys<'tcx>(
|
|||
// since we previously enforce that the trait method and impl method have the
|
||||
// same generics.
|
||||
let num_trait_args = trait_to_impl_args.len();
|
||||
let num_impl_args = tcx.generics_of(impl_m.container_id(tcx)).params.len();
|
||||
let num_impl_args = tcx.generics_of(impl_m.container_id(tcx)).own_params.len();
|
||||
let ty = match ty.try_fold_with(&mut RemapHiddenTyRegions {
|
||||
tcx,
|
||||
map,
|
||||
|
@ -1494,14 +1494,16 @@ fn compare_synthetic_generics<'tcx>(
|
|||
let mut error_found = None;
|
||||
let impl_m_generics = tcx.generics_of(impl_m.def_id);
|
||||
let trait_m_generics = tcx.generics_of(trait_m.def_id);
|
||||
let impl_m_type_params = impl_m_generics.params.iter().filter_map(|param| match param.kind {
|
||||
GenericParamDefKind::Type { synthetic, .. } => Some((param.def_id, synthetic)),
|
||||
GenericParamDefKind::Lifetime | GenericParamDefKind::Const { .. } => None,
|
||||
});
|
||||
let trait_m_type_params = trait_m_generics.params.iter().filter_map(|param| match param.kind {
|
||||
GenericParamDefKind::Type { synthetic, .. } => Some((param.def_id, synthetic)),
|
||||
GenericParamDefKind::Lifetime | GenericParamDefKind::Const { .. } => None,
|
||||
});
|
||||
let impl_m_type_params =
|
||||
impl_m_generics.own_params.iter().filter_map(|param| match param.kind {
|
||||
GenericParamDefKind::Type { synthetic, .. } => Some((param.def_id, synthetic)),
|
||||
GenericParamDefKind::Lifetime | GenericParamDefKind::Const { .. } => None,
|
||||
});
|
||||
let trait_m_type_params =
|
||||
trait_m_generics.own_params.iter().filter_map(|param| match param.kind {
|
||||
GenericParamDefKind::Type { synthetic, .. } => Some((param.def_id, synthetic)),
|
||||
GenericParamDefKind::Lifetime | GenericParamDefKind::Const { .. } => None,
|
||||
});
|
||||
for ((impl_def_id, impl_synthetic), (trait_def_id, trait_synthetic)) in
|
||||
iter::zip(impl_m_type_params, trait_m_type_params)
|
||||
{
|
||||
|
@ -1639,7 +1641,7 @@ fn compare_generic_param_kinds<'tcx>(
|
|||
assert_eq!(impl_item.kind, trait_item.kind);
|
||||
|
||||
let ty_const_params_of = |def_id| {
|
||||
tcx.generics_of(def_id).params.iter().filter(|param| {
|
||||
tcx.generics_of(def_id).own_params.iter().filter(|param| {
|
||||
matches!(
|
||||
param.kind,
|
||||
GenericParamDefKind::Const { .. } | GenericParamDefKind::Type { .. }
|
||||
|
@ -2140,7 +2142,7 @@ fn param_env_with_gat_bounds<'tcx>(
|
|||
};
|
||||
|
||||
let mut bound_vars: smallvec::SmallVec<[ty::BoundVariableKind; 8]> =
|
||||
smallvec::SmallVec::with_capacity(tcx.generics_of(impl_ty.def_id).params.len());
|
||||
smallvec::SmallVec::with_capacity(tcx.generics_of(impl_ty.def_id).own_params.len());
|
||||
// Extend the impl's identity args with late-bound GAT vars
|
||||
let normalize_impl_ty_args = ty::GenericArgs::identity_for_item(tcx, container_id)
|
||||
.extend_to(tcx, impl_ty.def_id, |param, _| match param.kind {
|
||||
|
|
|
@ -431,7 +431,7 @@ fn check_gat_where_clauses(tcx: TyCtxt<'_>, trait_def_id: LocalDefId) {
|
|||
}
|
||||
let gat_generics = tcx.generics_of(gat_def_id);
|
||||
// FIXME(jackh726): we can also warn in the more general case
|
||||
if gat_generics.params.is_empty() {
|
||||
if gat_generics.own_params.is_empty() {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1400,7 +1400,7 @@ fn check_where_clauses<'tcx>(wfcx: &WfCheckingCtxt<'_, 'tcx>, span: Span, def_id
|
|||
// struct Foo<T = Vec<[u32]>> { .. }
|
||||
//
|
||||
// Here, the default `Vec<[u32]>` is not WF because `[u32]: Sized` does not hold.
|
||||
for param in &generics.params {
|
||||
for param in &generics.own_params {
|
||||
match param.kind {
|
||||
GenericParamDefKind::Type { .. } => {
|
||||
if is_our_default(param) {
|
||||
|
@ -1879,7 +1879,7 @@ fn check_variances_for_type_defn<'tcx>(
|
|||
continue;
|
||||
}
|
||||
|
||||
let ty_param = &ty_generics.params[index];
|
||||
let ty_param = &ty_generics.own_params[index];
|
||||
let hir_param = &hir_generics.params[index];
|
||||
|
||||
if ty_param.def_id != hir_param.def_id.into() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue