Rename ty::Generics::parameters to params
This commit is contained in:
parent
de1c29c95e
commit
63553547e5
6 changed files with 15 additions and 15 deletions
|
|
@ -736,7 +736,7 @@ impl<'a> HashStable<StableHashingContext<'a>> for ty::Generics {
|
|||
let ty::Generics {
|
||||
parent,
|
||||
ref parent_count,
|
||||
ref parameters,
|
||||
ref params,
|
||||
|
||||
// Reverse map to each `TypeParameterDef`'s `index` field, from
|
||||
// `def_id.index` (`def_id.krate` is the same as the item's).
|
||||
|
|
@ -747,7 +747,7 @@ impl<'a> HashStable<StableHashingContext<'a>> for ty::Generics {
|
|||
|
||||
parent.hash_stable(hcx, hasher);
|
||||
parent_count.hash_stable(hcx, hasher);
|
||||
parameters.hash_stable(hcx, hasher);
|
||||
params.hash_stable(hcx, hasher);
|
||||
has_self.hash_stable(hcx, hasher);
|
||||
has_late_bound_regions.hash_stable(hcx, hasher);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -785,7 +785,7 @@ impl GenericParameterDef {
|
|||
pub struct Generics {
|
||||
pub parent: Option<DefId>,
|
||||
pub parent_count: usize,
|
||||
pub parameters: Vec<GenericParameterDef>,
|
||||
pub params: Vec<GenericParameterDef>,
|
||||
|
||||
/// Reverse map to each `TypeParameterDef`'s `index` field
|
||||
pub type_param_to_index: FxHashMap<DefId, u32>,
|
||||
|
|
@ -796,7 +796,7 @@ pub struct Generics {
|
|||
|
||||
impl<'a, 'gcx, 'tcx> Generics {
|
||||
pub fn own_count(&self) -> usize {
|
||||
self.parameters.len()
|
||||
self.params.len()
|
||||
}
|
||||
|
||||
pub fn count(&self) -> usize {
|
||||
|
|
@ -804,7 +804,7 @@ impl<'a, 'gcx, 'tcx> Generics {
|
|||
}
|
||||
|
||||
pub fn lifetimes(&self) -> Vec<&RegionParameterDef> {
|
||||
self.parameters.iter().filter_map(|p| {
|
||||
self.params.iter().filter_map(|p| {
|
||||
if let GenericParameterDef::Lifetime(lt) = p {
|
||||
Some(lt)
|
||||
} else {
|
||||
|
|
@ -814,7 +814,7 @@ impl<'a, 'gcx, 'tcx> Generics {
|
|||
}
|
||||
|
||||
pub fn types(&self) -> Vec<&TypeParameterDef> {
|
||||
self.parameters.iter().filter_map(|p| {
|
||||
self.params.iter().filter_map(|p| {
|
||||
if let GenericParameterDef::Type(ty) = p {
|
||||
Some(ty)
|
||||
} else {
|
||||
|
|
@ -842,7 +842,7 @@ impl<'a, 'gcx, 'tcx> Generics {
|
|||
{
|
||||
if let Some(index) = param.index.checked_sub(self.parent_count as u32) {
|
||||
// We're currently assuming that lifetimes precede other generic parameters.
|
||||
match self.parameters[index as usize - self.has_self as usize] {
|
||||
match self.params[index as usize - self.has_self as usize] {
|
||||
ty::GenericParameterDef::Lifetime(ref lt) => lt,
|
||||
_ => bug!("expected region parameter, but found another generic parameter")
|
||||
}
|
||||
|
|
@ -892,13 +892,13 @@ impl<'a, 'gcx, 'tcx> Generics {
|
|||
|
||||
if let Some(_) = (idx as usize).checked_sub(type_param_offset) {
|
||||
assert!(!is_separated_self, "found a Self after type_param_offset");
|
||||
match self.parameters[idx as usize] {
|
||||
match self.params[idx as usize] {
|
||||
ty::GenericParameterDef::Type(ref ty) => ty,
|
||||
_ => bug!("expected type parameter, but found another generic parameter")
|
||||
}
|
||||
} else {
|
||||
assert!(is_separated_self, "non-Self param before type_param_offset");
|
||||
match self.parameters[type_param_offset] {
|
||||
match self.params[type_param_offset] {
|
||||
ty::GenericParameterDef::Type(ref ty) => ty,
|
||||
_ => bug!("expected type parameter, but found another generic parameter")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -252,7 +252,7 @@ impl<'a, 'gcx, 'tcx> Substs<'tcx> {
|
|||
substs.push(ty.into());
|
||||
}
|
||||
|
||||
for def in &defs.parameters {
|
||||
for def in &defs.params {
|
||||
let param = match def {
|
||||
ty::GenericParameterDef::Lifetime(ref lt) => {
|
||||
UnpackedKind::Lifetime(mk_region(lt, substs))
|
||||
|
|
|
|||
|
|
@ -288,7 +288,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
|
|||
let method_item = self.associated_item(trait_def_id, m_name, Namespace::Value).unwrap();
|
||||
let def_id = method_item.def_id;
|
||||
let generics = tcx.generics_of(def_id);
|
||||
assert_eq!(generics.parameters.len(), 0);
|
||||
assert_eq!(generics.params.len(), 0);
|
||||
|
||||
debug!("lookup_in_trait_adjusted: method_item={:?}", method_item);
|
||||
let mut obligations = vec![];
|
||||
|
|
|
|||
|
|
@ -1384,7 +1384,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> {
|
|||
// in the values from the substitution.
|
||||
let xform_fn_sig = self.erase_late_bound_regions(&fn_sig);
|
||||
|
||||
if generics.parameters.is_empty() {
|
||||
if generics.params.is_empty() {
|
||||
xform_fn_sig.subst(self.tcx, substs)
|
||||
} else {
|
||||
let substs = Substs::for_item(self.tcx, method, |def, _| {
|
||||
|
|
|
|||
|
|
@ -881,7 +881,7 @@ fn generics_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||
assert_eq!(has_self, false);
|
||||
parent_has_self = generics.has_self;
|
||||
own_start = generics.count() as u32;
|
||||
generics.parent_count + generics.parameters.len()
|
||||
generics.parent_count + generics.params.len()
|
||||
});
|
||||
|
||||
let early_lifetimes = early_bound_lifetimes_from_generics(tcx, ast_generics);
|
||||
|
|
@ -974,12 +974,12 @@ fn generics_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||
regions.into_iter().map(|lt| ty::GenericParameterDef::Lifetime(lt)).collect();
|
||||
let types: Vec<ty::GenericParameterDef> =
|
||||
types.into_iter().map(|ty| ty::GenericParameterDef::Type(ty)).collect();
|
||||
let parameters = lifetimes.into_iter().chain(types.into_iter()).collect();
|
||||
let params = lifetimes.into_iter().chain(types.into_iter()).collect();
|
||||
|
||||
tcx.alloc_generics(ty::Generics {
|
||||
parent: parent_def_id,
|
||||
parent_count,
|
||||
parameters,
|
||||
params,
|
||||
type_param_to_index,
|
||||
has_self: has_self || parent_has_self,
|
||||
has_late_bound_regions: has_late_bound_regions(tcx, node),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue