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() {
|
||||
|
|
|
@ -571,7 +571,7 @@ impl<'cx, 'tcx> TypeFolder<TyCtxt<'tcx>> for TyVarReplacer<'cx, 'tcx> {
|
|||
if let Some(def_id) = origin.param_def_id {
|
||||
// The generics of an `impl` don't have a parent, we can index directly.
|
||||
let index = self.generics.param_def_id_to_index[&def_id];
|
||||
let name = self.generics.params[index as usize].name;
|
||||
let name = self.generics.own_params[index as usize].name;
|
||||
|
||||
Ty::new_param(self.infcx.tcx, index, name)
|
||||
} else {
|
||||
|
|
|
@ -14,7 +14,7 @@ pub(super) fn check_item(
|
|||
trait_def: &TraitDef,
|
||||
) -> Result<(), ErrorGuaranteed> {
|
||||
let unsafe_attr =
|
||||
tcx.generics_of(def_id).params.iter().find(|p| p.pure_wrt_drop).map(|_| "may_dangle");
|
||||
tcx.generics_of(def_id).own_params.iter().find(|p| p.pure_wrt_drop).map(|_| "may_dangle");
|
||||
let trait_ref = trait_header.trait_ref.instantiate_identity();
|
||||
|
||||
match (trait_def.unsafety, unsafe_attr, trait_header.unsafety, trait_header.polarity) {
|
||||
|
|
|
@ -22,28 +22,28 @@ pub(super) fn generics_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Generics {
|
|||
let trait_def_id = tcx.parent(fn_def_id);
|
||||
let opaque_ty_generics = tcx.generics_of(opaque_def_id);
|
||||
let opaque_ty_parent_count = opaque_ty_generics.parent_count;
|
||||
let mut params = opaque_ty_generics.params.clone();
|
||||
let mut own_params = opaque_ty_generics.own_params.clone();
|
||||
|
||||
let parent_generics = tcx.generics_of(trait_def_id);
|
||||
let parent_count = parent_generics.parent_count + parent_generics.params.len();
|
||||
let parent_count = parent_generics.parent_count + parent_generics.own_params.len();
|
||||
|
||||
let mut trait_fn_params = tcx.generics_of(fn_def_id).params.clone();
|
||||
let mut trait_fn_params = tcx.generics_of(fn_def_id).own_params.clone();
|
||||
|
||||
for param in &mut params {
|
||||
for param in &mut own_params {
|
||||
param.index = param.index + parent_count as u32 + trait_fn_params.len() as u32
|
||||
- opaque_ty_parent_count as u32;
|
||||
}
|
||||
|
||||
trait_fn_params.extend(params);
|
||||
params = trait_fn_params;
|
||||
trait_fn_params.extend(own_params);
|
||||
own_params = trait_fn_params;
|
||||
|
||||
let param_def_id_to_index =
|
||||
params.iter().map(|param| (param.def_id, param.index)).collect();
|
||||
own_params.iter().map(|param| (param.def_id, param.index)).collect();
|
||||
|
||||
return ty::Generics {
|
||||
parent: Some(trait_def_id),
|
||||
parent_count,
|
||||
params,
|
||||
own_params,
|
||||
param_def_id_to_index,
|
||||
has_self: opaque_ty_generics.has_self,
|
||||
has_late_bound_regions: opaque_ty_generics.has_late_bound_regions,
|
||||
|
@ -124,9 +124,9 @@ pub(super) fn generics_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Generics {
|
|||
let generics = tcx.generics_of(parent_def_id.to_def_id());
|
||||
let param_def_idx = generics.param_def_id_to_index[¶m_id.to_def_id()];
|
||||
// In the above example this would be .params[..N#0]
|
||||
let params = generics.params_to(param_def_idx as usize, tcx).to_owned();
|
||||
let own_params = generics.params_to(param_def_idx as usize, tcx).to_owned();
|
||||
let param_def_id_to_index =
|
||||
params.iter().map(|param| (param.def_id, param.index)).collect();
|
||||
own_params.iter().map(|param| (param.def_id, param.index)).collect();
|
||||
|
||||
return ty::Generics {
|
||||
// we set the parent of these generics to be our parent's parent so that we
|
||||
|
@ -134,7 +134,7 @@ pub(super) fn generics_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Generics {
|
|||
// struct Foo<const N: usize, const M: usize = { ... }>;
|
||||
parent: generics.parent,
|
||||
parent_count: generics.parent_count,
|
||||
params,
|
||||
own_params,
|
||||
param_def_id_to_index,
|
||||
has_self: generics.has_self,
|
||||
has_late_bound_regions: generics.has_late_bound_regions,
|
||||
|
@ -274,17 +274,17 @@ pub(super) fn generics_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Generics {
|
|||
parent_has_self = generics.has_self;
|
||||
host_effect_index = generics.host_effect_index;
|
||||
own_start = generics.count() as u32;
|
||||
generics.parent_count + generics.params.len()
|
||||
generics.parent_count + generics.own_params.len()
|
||||
});
|
||||
|
||||
let mut params: Vec<_> = Vec::with_capacity(hir_generics.params.len() + has_self as usize);
|
||||
let mut own_params: Vec<_> = Vec::with_capacity(hir_generics.params.len() + has_self as usize);
|
||||
|
||||
if let Some(opt_self) = opt_self {
|
||||
params.push(opt_self);
|
||||
own_params.push(opt_self);
|
||||
}
|
||||
|
||||
let early_lifetimes = super::early_bound_lifetimes_from_generics(tcx, hir_generics);
|
||||
params.extend(early_lifetimes.enumerate().map(|(i, param)| ty::GenericParamDef {
|
||||
own_params.extend(early_lifetimes.enumerate().map(|(i, param)| ty::GenericParamDef {
|
||||
name: param.name.ident().name,
|
||||
index: own_start + i as u32,
|
||||
def_id: param.def_id.to_def_id(),
|
||||
|
@ -293,7 +293,7 @@ pub(super) fn generics_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Generics {
|
|||
}));
|
||||
|
||||
// Now create the real type and const parameters.
|
||||
let type_start = own_start - has_self as u32 + params.len() as u32;
|
||||
let type_start = own_start - has_self as u32 + own_params.len() as u32;
|
||||
let mut i: u32 = 0;
|
||||
let mut next_index = || {
|
||||
let prev = i;
|
||||
|
@ -304,7 +304,7 @@ pub(super) fn generics_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Generics {
|
|||
const TYPE_DEFAULT_NOT_ALLOWED: &'static str = "defaults for type parameters are only allowed in \
|
||||
`struct`, `enum`, `type`, or `trait` definitions";
|
||||
|
||||
params.extend(hir_generics.params.iter().filter_map(|param| match param.kind {
|
||||
own_params.extend(hir_generics.params.iter().filter_map(|param| match param.kind {
|
||||
GenericParamKind::Lifetime { .. } => None,
|
||||
GenericParamKind::Type { default, synthetic, .. } => {
|
||||
if default.is_some() {
|
||||
|
@ -404,7 +404,7 @@ pub(super) fn generics_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Generics {
|
|||
][..],
|
||||
};
|
||||
|
||||
params.extend(dummy_args.iter().map(|&arg| ty::GenericParamDef {
|
||||
own_params.extend(dummy_args.iter().map(|&arg| ty::GenericParamDef {
|
||||
index: next_index(),
|
||||
name: Symbol::intern(arg),
|
||||
def_id: def_id.to_def_id(),
|
||||
|
@ -415,7 +415,7 @@ pub(super) fn generics_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Generics {
|
|||
|
||||
// provide junk type parameter defs for const blocks.
|
||||
if let Node::ConstBlock(_) = node {
|
||||
params.push(ty::GenericParamDef {
|
||||
own_params.push(ty::GenericParamDef {
|
||||
index: next_index(),
|
||||
name: Symbol::intern("<const_ty>"),
|
||||
def_id: def_id.to_def_id(),
|
||||
|
@ -424,12 +424,13 @@ pub(super) fn generics_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Generics {
|
|||
});
|
||||
}
|
||||
|
||||
let param_def_id_to_index = params.iter().map(|param| (param.def_id, param.index)).collect();
|
||||
let param_def_id_to_index =
|
||||
own_params.iter().map(|param| (param.def_id, param.index)).collect();
|
||||
|
||||
ty::Generics {
|
||||
parent: parent_def_id,
|
||||
parent_count,
|
||||
params,
|
||||
own_params,
|
||||
param_def_id_to_index,
|
||||
has_self: has_self || parent_has_self,
|
||||
has_late_bound_regions: has_late_bound_regions(tcx, node),
|
||||
|
|
|
@ -73,8 +73,8 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Gen
|
|||
// opaque lifetimes, which explains the slicing below.
|
||||
compute_bidirectional_outlives_predicates(
|
||||
tcx,
|
||||
&tcx.generics_of(def_id.to_def_id()).params
|
||||
[tcx.generics_of(fn_def_id).params.len()..],
|
||||
&tcx.generics_of(def_id.to_def_id()).own_params
|
||||
[tcx.generics_of(fn_def_id).own_params.len()..],
|
||||
&mut predicates,
|
||||
);
|
||||
|
||||
|
@ -300,7 +300,7 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Gen
|
|||
};
|
||||
debug!(?lifetimes);
|
||||
|
||||
compute_bidirectional_outlives_predicates(tcx, &generics.params, &mut predicates);
|
||||
compute_bidirectional_outlives_predicates(tcx, &generics.own_params, &mut predicates);
|
||||
debug!(?predicates);
|
||||
}
|
||||
|
||||
|
|
|
@ -1562,7 +1562,7 @@ impl<'a, 'tcx> BoundVarContext<'a, 'tcx> {
|
|||
ObjectLifetimeDefault::Ambiguous => None,
|
||||
};
|
||||
generics
|
||||
.params
|
||||
.own_params
|
||||
.iter()
|
||||
.filter_map(|param| {
|
||||
match self.tcx.def_kind(param.def_id) {
|
||||
|
@ -1668,7 +1668,7 @@ impl<'a, 'tcx> BoundVarContext<'a, 'tcx> {
|
|||
binding.ident,
|
||||
ty::AssocKind::Fn,
|
||||
) {
|
||||
bound_vars.extend(self.tcx.generics_of(assoc_fn.def_id).params.iter().map(
|
||||
bound_vars.extend(self.tcx.generics_of(assoc_fn.def_id).own_params.iter().map(
|
||||
|param| match param.kind {
|
||||
ty::GenericParamDefKind::Lifetime => ty::BoundVariableKind::Region(
|
||||
ty::BoundRegionKind::BrNamed(param.def_id, param.name),
|
||||
|
@ -2003,7 +2003,8 @@ fn is_late_bound_map(
|
|||
// just consider args to be unconstrained.
|
||||
let generics = self.tcx.generics_of(alias_def);
|
||||
let mut walker = ConstrainedCollectorPostHirTyLowering {
|
||||
arg_is_constrained: vec![false; generics.params.len()].into_boxed_slice(),
|
||||
arg_is_constrained: vec![false; generics.own_params.len()]
|
||||
.into_boxed_slice(),
|
||||
};
|
||||
walker.visit_ty(self.tcx.type_of(alias_def).instantiate_identity());
|
||||
|
||||
|
|
|
@ -255,7 +255,7 @@ fn anon_const_type_of<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> Ty<'tcx> {
|
|||
debug!(?parent_node);
|
||||
debug!(?generics, ?arg_idx);
|
||||
if let Some(param_def_id) = generics
|
||||
.params
|
||||
.own_params
|
||||
.iter()
|
||||
.filter(|param| param.kind.is_ty_or_const())
|
||||
.nth(match generics.has_self && generics.parent.is_none() {
|
||||
|
|
|
@ -1299,7 +1299,7 @@ pub fn prohibit_assoc_item_binding(
|
|||
// same name as the assoc type name in type binding
|
||||
let generics = tcx.generics_of(def_id);
|
||||
let matching_param =
|
||||
generics.params.iter().find(|p| p.name.as_str() == binding.ident.as_str());
|
||||
generics.own_params.iter().find(|p| p.name.as_str() == binding.ident.as_str());
|
||||
|
||||
// Now emit the appropriate suggestion
|
||||
if let Some(matching_param) = matching_param {
|
||||
|
|
|
@ -196,7 +196,7 @@ pub fn lower_generic_args<'tcx: 'a, 'a>(
|
|||
let mut args: SmallVec<[ty::GenericArg<'tcx>; 8]> = SmallVec::with_capacity(count);
|
||||
// Iterate over each segment of the path.
|
||||
while let Some((def_id, defs)) = stack.pop() {
|
||||
let mut params = defs.params.iter().peekable();
|
||||
let mut params = defs.own_params.iter().peekable();
|
||||
|
||||
// If we have already computed the generic arguments for parents,
|
||||
// we can use those directly.
|
||||
|
@ -312,7 +312,7 @@ pub fn lower_generic_args<'tcx: 'a, 'a>(
|
|||
// We're going to iterate over the parameters to sort them out, and
|
||||
// show that order to the user as a possible order for the parameters
|
||||
let mut param_types_present = defs
|
||||
.params
|
||||
.own_params
|
||||
.iter()
|
||||
.map(|param| (param.kind.to_ord(), param.clone()))
|
||||
.collect::<Vec<(ParamKindOrd, GenericParamDef)>>();
|
||||
|
@ -435,13 +435,13 @@ pub(crate) fn check_generic_arg_count(
|
|||
// Subtracting from param count to ensure type params synthesized from `impl Trait`
|
||||
// cannot be explicitly specified.
|
||||
let synth_type_param_count = gen_params
|
||||
.params
|
||||
.own_params
|
||||
.iter()
|
||||
.filter(|param| matches!(param.kind, ty::GenericParamDefKind::Type { synthetic: true, .. }))
|
||||
.count();
|
||||
let named_type_param_count = param_counts.types - has_self as usize - synth_type_param_count;
|
||||
let synth_const_param_count = gen_params
|
||||
.params
|
||||
.own_params
|
||||
.iter()
|
||||
.filter(|param| {
|
||||
matches!(param.kind, ty::GenericParamDefKind::Const { is_host_effect: true, .. })
|
||||
|
|
|
@ -411,7 +411,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
|
|||
// Traits always have `Self` as a generic parameter, which means they will not return early
|
||||
// here and so associated type bindings will be handled regardless of whether there are any
|
||||
// non-`Self` generic parameters.
|
||||
if generics.params.is_empty() {
|
||||
if generics.own_params.is_empty() {
|
||||
return (tcx.mk_args(parent_args), arg_count);
|
||||
}
|
||||
|
||||
|
|
|
@ -227,7 +227,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
|
|||
.skip(1) // Remove `Self` for `ExistentialPredicate`.
|
||||
.map(|(index, arg)| {
|
||||
if arg == dummy_self.into() {
|
||||
let param = &generics.params[index];
|
||||
let param = &generics.own_params[index];
|
||||
missing_type_params.push(param.name);
|
||||
Ty::new_misc_error(tcx).into()
|
||||
} else if arg.walk().any(|arg| arg == dummy_self.into()) {
|
||||
|
|
|
@ -114,7 +114,7 @@ fn enforce_impl_params_are_constrained(
|
|||
.collect();
|
||||
|
||||
let mut res = Ok(());
|
||||
for param in &impl_generics.params {
|
||||
for param in &impl_generics.own_params {
|
||||
match param.kind {
|
||||
// Disallow ANY unconstrained type parameters.
|
||||
ty::GenericParamDefKind::Type { .. } => {
|
||||
|
|
|
@ -184,7 +184,7 @@ pub fn check_crate(tcx: TyCtxt<'_>) {
|
|||
let def_kind = tcx.def_kind(item_def_id);
|
||||
match def_kind {
|
||||
DefKind::Static { .. } => tcx.ensure().eval_static_initializer(item_def_id),
|
||||
DefKind::Const if tcx.generics_of(item_def_id).params.is_empty() => {
|
||||
DefKind::Const if tcx.generics_of(item_def_id).own_params.is_empty() => {
|
||||
let instance = ty::Instance::new(item_def_id.into(), ty::GenericArgs::empty());
|
||||
let cid = GlobalId { instance, promoted: None };
|
||||
let param_env = ty::ParamEnv::reveal_all();
|
||||
|
|
|
@ -421,7 +421,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
|
|||
// We could not gather enough lifetime parameters in the scope.
|
||||
// We use the parameter names from the target type's definition instead.
|
||||
self.gen_params
|
||||
.params
|
||||
.own_params
|
||||
.iter()
|
||||
.skip(self.params_offset + self.num_provided_lifetime_args())
|
||||
.take(num_params_to_take)
|
||||
|
@ -464,7 +464,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
|
|||
})
|
||||
};
|
||||
self.gen_params
|
||||
.params
|
||||
.own_params
|
||||
.iter()
|
||||
.skip(self.params_offset + self.num_provided_type_or_const_args())
|
||||
.take(num_params_to_take)
|
||||
|
@ -1076,7 +1076,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
|
|||
} else {
|
||||
let params = self
|
||||
.gen_params
|
||||
.params
|
||||
.own_params
|
||||
.iter()
|
||||
.skip(self.params_offset)
|
||||
.take(bound)
|
||||
|
|
|
@ -133,7 +133,7 @@ fn variance_of_opaque(tcx: TyCtxt<'_>, item_def_id: LocalDefId) -> &[ty::Varianc
|
|||
let mut generics = generics;
|
||||
while let Some(def_id) = generics.parent {
|
||||
generics = tcx.generics_of(def_id);
|
||||
for param in &generics.params {
|
||||
for param in &generics.own_params {
|
||||
match param.kind {
|
||||
ty::GenericParamDefKind::Lifetime => {
|
||||
variances[param.index as usize] = ty::Bivariant;
|
||||
|
|
|
@ -76,7 +76,7 @@ impl<'a, 'tcx> SolveContext<'a, 'tcx> {
|
|||
let tcx = self.terms_cx.tcx;
|
||||
|
||||
// Make all const parameters invariant.
|
||||
for param in generics.params.iter() {
|
||||
for param in generics.own_params.iter() {
|
||||
if let ty::GenericParamDefKind::Const { .. } = param.kind {
|
||||
variances[param.index as usize] = ty::Invariant;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue