Rename Generics::params to Generics::own_params

This commit is contained in:
Michael Goulet 2024-05-09 20:56:44 -04:00
parent 18fe295d33
commit 9523b3fbf0
7 changed files with 11 additions and 11 deletions

View File

@ -382,7 +382,7 @@ impl<'tcx> LateLintPass<'tcx> for Dereferencing<'tcx> {
cx, cx,
impl_ty, impl_ty,
trait_id, trait_id,
&args[..cx.tcx.generics_of(trait_id).params.len() - 1], &args[..cx.tcx.generics_of(trait_id).own_params.len() - 1],
) )
{ {
false false

View File

@ -480,7 +480,7 @@ fn param_env_for_derived_eq(tcx: TyCtxt<'_>, did: DefId, eq_trait_id: DefId) ->
// Vec<(param_def, needs_eq)> // Vec<(param_def, needs_eq)>
let mut params = tcx let mut params = tcx
.generics_of(did) .generics_of(did)
.params .own_params
.iter() .iter()
.map(|p| (p, matches!(p.kind, GenericParamDefKind::Type { .. }))) .map(|p| (p, matches!(p.kind, GenericParamDefKind::Type { .. })))
.collect::<Vec<_>>(); .collect::<Vec<_>>();

View File

@ -148,7 +148,7 @@ fn try_resolve_type<'tcx>(
match args.get(index - 1) { match args.get(index - 1) {
Some(GenericArg::Type(ty)) => Some(lower_ty(tcx, ty)), Some(GenericArg::Type(ty)) => Some(lower_ty(tcx, ty)),
Some(_) => None, Some(_) => None,
None => Some(tcx.type_of(generics.params[index].def_id).skip_binder()), None => Some(tcx.type_of(generics.own_params[index].def_id).skip_binder()),
} }
} }

View File

@ -225,7 +225,7 @@ impl {self_ty_without_ref} {{
&& let ImplItemKind::Fn(sig, _) = item.kind && let ImplItemKind::Fn(sig, _) = item.kind
&& let FnRetTy::Return(ret) = sig.decl.output && let FnRetTy::Return(ret) = sig.decl.output
&& is_nameable_in_impl_trait(ret) && is_nameable_in_impl_trait(ret)
&& cx.tcx.generics_of(item_did).params.is_empty() && cx.tcx.generics_of(item_did).own_params.is_empty()
&& sig.decl.implicit_self == expected_implicit_self && sig.decl.implicit_self == expected_implicit_self
&& sig.decl.inputs.len() == 1 && sig.decl.inputs.len() == 1
&& let Some(imp) = get_parent_as_impl(cx.tcx, item.hir_id()) && let Some(imp) = get_parent_as_impl(cx.tcx, item.hir_id())

View File

@ -76,7 +76,7 @@ impl<'tcx> LateLintPass<'tcx> for TypeParamMismatch {
}; };
// get the names of the generic parameters in the type // get the names of the generic parameters in the type
let type_params = &cx.tcx.generics_of(defid).params; let type_params = &cx.tcx.generics_of(defid).own_params;
let type_param_names: Vec<_> = type_params let type_param_names: Vec<_> = type_params
.iter() .iter()
.filter_map(|p| match p.kind { .filter_map(|p| match p.kind {

View File

@ -1070,11 +1070,11 @@ pub fn approx_ty_size<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -> u64 {
fn assert_generic_args_match<'tcx>(tcx: TyCtxt<'tcx>, did: DefId, args: &[GenericArg<'tcx>]) { fn assert_generic_args_match<'tcx>(tcx: TyCtxt<'tcx>, did: DefId, args: &[GenericArg<'tcx>]) {
let g = tcx.generics_of(did); let g = tcx.generics_of(did);
let parent = g.parent.map(|did| tcx.generics_of(did)); let parent = g.parent.map(|did| tcx.generics_of(did));
let count = g.parent_count + g.params.len(); let count = g.parent_count + g.own_params.len();
let params = parent let params = parent
.map_or([].as_slice(), |p| p.params.as_slice()) .map_or([].as_slice(), |p| p.own_params.as_slice())
.iter() .iter()
.chain(&g.params) .chain(&g.own_params)
.map(|x| &x.kind); .map(|x| &x.kind);
assert!( assert!(

View File

@ -176,7 +176,7 @@ fn qpath_certainty(cx: &LateContext<'_>, qpath: &QPath<'_>, resolves_to_type: bo
.get(*lang_item) .get(*lang_item)
.map_or(Certainty::Uncertain, |def_id| { .map_or(Certainty::Uncertain, |def_id| {
let generics = cx.tcx.generics_of(def_id); let generics = cx.tcx.generics_of(def_id);
if generics.parent_count == 0 && generics.params.is_empty() { if generics.parent_count == 0 && generics.own_params.is_empty() {
Certainty::Certain(if resolves_to_type { Some(def_id) } else { None }) Certainty::Certain(if resolves_to_type { Some(def_id) } else { None })
} else { } else {
Certainty::Uncertain Certainty::Uncertain
@ -206,7 +206,7 @@ fn path_segment_certainty(
// Checking `res_generics_def_id(..)` before calling `generics_of` avoids an ICE. // Checking `res_generics_def_id(..)` before calling `generics_of` avoids an ICE.
if cx.tcx.res_generics_def_id(path_segment.res).is_some() { if cx.tcx.res_generics_def_id(path_segment.res).is_some() {
let generics = cx.tcx.generics_of(def_id); let generics = cx.tcx.generics_of(def_id);
let count = generics.params.len() - usize::from(generics.host_effect_index.is_some()); let count = generics.own_params.len() - usize::from(generics.host_effect_index.is_some());
let lhs = if (parent_certainty.is_certain() || generics.parent_count == 0) && count == 0 { let lhs = if (parent_certainty.is_certain() || generics.parent_count == 0) && count == 0 {
Certainty::Certain(None) Certainty::Certain(None)
} else { } else {
@ -299,7 +299,7 @@ fn type_is_inferable_from_arguments(cx: &LateContext<'_>, expr: &Expr<'_>) -> bo
let fn_sig = cx.tcx.fn_sig(callee_def_id).skip_binder(); let fn_sig = cx.tcx.fn_sig(callee_def_id).skip_binder();
// Check that all type parameters appear in the functions input types. // Check that all type parameters appear in the functions input types.
(0..(generics.parent_count + generics.params.len()) as u32).all(|index| { (0..(generics.parent_count + generics.own_params.len()) as u32).all(|index| {
Some(index as usize) == generics.host_effect_index Some(index as usize) == generics.host_effect_index
|| fn_sig || fn_sig
.inputs() .inputs()