Skip to content
Permalink
Browse files

Rename `type_parameters` to `generics` and so on

  • Loading branch information...
varkor committed Mar 29, 2019
1 parent 33ef0ba commit 44813dfcb68c670f6ff8b7d79cea5f75b9f02ab9
@@ -485,30 +485,30 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item) {
ItemKind::GlobalAsm(_) => {
visitor.visit_id(item.hir_id);
}
ItemKind::Ty(ref typ, ref type_parameters) => {
ItemKind::Ty(ref ty, ref generics) => {
visitor.visit_id(item.hir_id);
visitor.visit_ty(typ);
visitor.visit_generics(type_parameters)
visitor.visit_ty(ty);
visitor.visit_generics(generics)
}
ItemKind::Existential(ExistTy { ref generics, ref bounds, impl_trait_fn: _ }) => {
visitor.visit_id(item.hir_id);
walk_generics(visitor, generics);
walk_list!(visitor, visit_param_bound, bounds);
}
ItemKind::Enum(ref enum_definition, ref type_parameters) => {
visitor.visit_generics(type_parameters);
ItemKind::Enum(ref enum_definition, ref generics) => {
visitor.visit_generics(generics);
// `visit_enum_def()` takes care of visiting the `Item`'s `HirId`.
visitor.visit_enum_def(enum_definition, type_parameters, item.hir_id, item.span)
visitor.visit_enum_def(enum_definition, generics, item.hir_id, item.span)
}
ItemKind::Impl(
..,
ref type_parameters,
ref generics,
ref opt_trait_reference,
ref typ,
ref impl_item_refs
) => {
visitor.visit_id(item.hir_id);
visitor.visit_generics(type_parameters);
visitor.visit_generics(generics);
walk_list!(visitor, visit_trait_ref, opt_trait_reference);
visitor.visit_ty(typ);
walk_list!(visitor, visit_impl_item_ref, impl_item_refs);
@@ -1040,7 +1040,7 @@ impl<'b, 'a, 'v> ItemLikeVisitor<'v> for RootCollector<'b, 'a, 'v> {

impl<'b, 'a, 'v> RootCollector<'b, 'a, 'v> {
fn is_root(&self, def_id: DefId) -> bool {
!item_has_type_parameters(self.tcx, def_id) && match self.mode {
!item_requires_monomorphization(self.tcx, def_id) && match self.mode {
MonoItemCollectionMode::Eager => {
true
}
@@ -1101,7 +1101,7 @@ impl<'b, 'a, 'v> RootCollector<'b, 'a, 'v> {
}
}

fn item_has_type_parameters<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> bool {
fn item_requires_monomorphization<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> bool {
let generics = tcx.generics_of(def_id);
generics.requires_monomorphization(tcx)
}
@@ -659,7 +659,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {
fn process_impl(
&mut self,
item: &'l ast::Item,
type_parameters: &'l ast::Generics,
generics: &'l ast::Generics,
trait_ref: &'l Option<ast::TraitRef>,
typ: &'l ast::Ty,
impl_items: &'l [ast::ImplItem],
@@ -678,7 +678,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {
if let &Some(ref trait_ref) = trait_ref {
self.process_path(trait_ref.ref_id, &trait_ref.path);
}
self.process_generic_params(type_parameters, "", item.id);
self.process_generic_params(generics, "", item.id);
for impl_item in impl_items {
let map = &self.tcx.hir();
self.process_impl_item(impl_item, map.local_def_id(item.id));
@@ -2550,7 +2550,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
Neither if self.type_var_diverges(ty) => self.tcx.mk_diverging_default(),
Neither => return false,
};
debug!("default_type_parameters: defaulting `{:?}` to `{:?}`", ty, fallback);
debug!("fallback_if_possible: defaulting `{:?}` to `{:?}`", ty, fallback);
self.demand_eqtype(syntax_pos::DUMMY_SP, ty, fallback);
true
}
@@ -1,5 +1,5 @@
use crate::check::{Inherited, FnCtxt};
use crate::constrained_type_params::{identify_constrained_type_params, Parameter};
use crate::constrained_generic_params::{identify_constrained_generic_params, Parameter};

use crate::hir::def_id::DefId;
use rustc::traits::{self, ObligationCauseCode};
@@ -941,7 +941,7 @@ fn check_variances_for_type_defn<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
.map(|(index, _)| Parameter(index as u32))
.collect();

identify_constrained_type_params(tcx,
identify_constrained_generic_params(tcx,
&ty_predicates,
None,
&mut constrained_parameters);
@@ -15,7 +15,7 @@
//! crate as a kind of pass. This should eventually be factored away.

use crate::astconv::{AstConv, Bounds};
use crate::constrained_type_params as ctp;
use crate::constrained_generic_params as ctp;
use crate::check::intrinsic::intrisic_operation_unsafety;
use crate::lint;
use crate::middle::lang_items::SizedTraitLangItem;
@@ -86,7 +86,7 @@ impl<'tcx> TypeVisitor<'tcx> for ParameterCollector {
}
}

pub fn identify_constrained_type_params<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>,
pub fn identify_constrained_generic_params<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>,
predicates: &ty::GenericPredicates<'tcx>,
impl_trait_ref: Option<ty::TraitRef<'tcx>>,
input_parameters: &mut FxHashSet<Parameter>)
@@ -8,7 +8,7 @@
//! specialization errors. These things can (and probably should) be
//! fixed, but for the moment it's easier to do these checks early.

use crate::constrained_type_params as ctp;
use crate::constrained_generic_params as ctp;
use rustc::hir;
use rustc::hir::itemlikevisit::ItemLikeVisitor;
use rustc::hir::def_id::DefId;
@@ -103,7 +103,7 @@ fn enforce_impl_params_are_constrained<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
let impl_trait_ref = tcx.impl_trait_ref(impl_def_id);

let mut input_parameters = ctp::parameters_for_impl(impl_self_ty, impl_trait_ref);
ctp::identify_constrained_type_params(
ctp::identify_constrained_generic_params(
tcx, &impl_predicates, impl_trait_ref, &mut input_parameters);

// Disallow unconstrained lifetimes, but only if they appear in assoc types.
@@ -88,7 +88,7 @@ mod check;
mod check_unused;
mod coherence;
mod collect;
mod constrained_type_params;
mod constrained_generic_params;
mod structured_errors;
mod impl_wf_check;
mod namespace;
@@ -244,24 +244,24 @@ pub fn walk_item<'a, V: Visitor<'a>>(visitor: &mut V, item: &'a Item) {
walk_list!(visitor, visit_foreign_item, &foreign_module.items);
}
ItemKind::GlobalAsm(ref ga) => visitor.visit_global_asm(ga),
ItemKind::Ty(ref typ, ref type_parameters) => {
ItemKind::Ty(ref typ, ref generics) => {
visitor.visit_ty(typ);
visitor.visit_generics(type_parameters)
visitor.visit_generics(generics)
}
ItemKind::Existential(ref bounds, ref type_parameters) => {
ItemKind::Existential(ref bounds, ref generics) => {
walk_list!(visitor, visit_param_bound, bounds);
visitor.visit_generics(type_parameters)
visitor.visit_generics(generics)
}
ItemKind::Enum(ref enum_definition, ref type_parameters) => {
visitor.visit_generics(type_parameters);
visitor.visit_enum_def(enum_definition, type_parameters, item.id, item.span)
ItemKind::Enum(ref enum_definition, ref generics) => {
visitor.visit_generics(generics);
visitor.visit_enum_def(enum_definition, generics, item.id, item.span)
}
ItemKind::Impl(_, _, _,
ref type_parameters,
ref generics,
ref opt_trait_reference,
ref typ,
ref impl_items) => {
visitor.visit_generics(type_parameters);
visitor.visit_generics(generics);
walk_list!(visitor, visit_trait_ref, opt_trait_reference);
visitor.visit_ty(typ);
walk_list!(visitor, visit_impl_item, impl_items);

0 comments on commit 44813df

Please sign in to comment.
You can’t perform that action at this time.