astconv-no-mo
: AstConv
⟼ HirTyLowerer
probe_adt
butfind
, too.ty
over type
and assoc
over associated
in item names.Below you can find an exhaustive alphabetically sorted mapping from old to new name together with an optional comment justifying the respective renaming grouped by module (with one exception).
Old Name | New Name | Comment |
---|---|---|
rustc_hir_analysis | ||
astconv | hir_ty_lowering | |
hir_ty_to_ty | lower_ty | |
hir_ty_lowering | ||
AstConv | HirTyLowering | |
PathSeg | GenericPathSegment | See the comment over at probe_ for more context. This type doesn't represent arbitrary path segments but specifically only ones that are semantically allowed to have generic arguments. |
HirTyLowerer | ||
allow_ty_infer | allow_infer | This isn't specifically about type variables but generally about any kind of inference variables. |
astconv | lowerer | |
get_type_parameter_bounds | probe_ty_param_bounds | |
projected_ty_from_poly_trait_ref | lower_assoc_ty | The new name describes what the method does conceptually, while the old one describes what it does internally. |
dyn HirTyLowerer<'tcx> + '_ | ||
add_bounds | lower_poly_bounds | The old naming scheme is nondescript, the new one is slightly more descriptive: This method lowers polymorphic bounds in the sense that they are potentially collectively quantified universally by an overarching / outer binder. If not, individual bounds may still be universally quantified by inner binders. The terminology poly is preexisting, consider |
add_implicitly_sized | add_sized_bound | If I can trust my non-native English skills, the old name is beyond ungrammatical even if we include More noteworthily, I strongly lean towards dropping the word implicit here since it violates the layers of abstraction. Indeed, some entities have implicit Rephrased, the hypothetical alternative name |
add_predicates_for_ast_type_binding | lower_assoc_item_binding | The new name describes what the method does conceptually (specification-wise), while the old one describes what it does internally (implementation-wise). Regarding item over type: This method not only lowers assoc type bindings but also assoc const bindings as well as RTN (assoc functions). Note that |
associated_path_to_ty | lower_assoc_path | |
ast_path_args_for_ty | lower_generic_args_of_path_segment | |
ast_path_to_mono_trait_ref | lower_mono_trait_ref | |
ast_path_to_ty | lower_path_segment | |
ast_region_to_region | lower_lifetime | We lower HIR lifetimes (to middle regions), not “HIR regions” (those don't exist). |
ast_ty_to_ty | lower_ty | |
ast_ty_to_ty_in_path | lower_ty_in_path | |
ast_ty_to_ty_inner | lower_ty_common | Inspired by the terminology of the parser. |
compute_bounds | lower_mono_bounds | The old naming scheme is nondescript, the new one is slightly more descriptive: This method lowers monomorphic bounds in the sense that they aren't collectively quantified universally by an overarching / outer binder. However, individual bounds may still be universally quantified by inner binders. Therefore the term mono could be regarded as confusing by some. Note however that this is consistent with the preexisting |
conv_object_ty_poly_trait_ref | lower_trait_object_ty | More succinct. |
create_args_for_associated_item | lower_generic_args_of_assoc_item | |
create_args_for_ast_path | lower_generic_args_of_path | |
def_ids_for_value_path_segments | probe_generic_path_segments | The old name is super nondescript. I had no idea what its job was until I read the comments and the implementation and looked at the usage sites. While the contained lengthy comment is somewhat true, namely that there is some work involved in recovering More significantly, this methods searches for path segments that are semantically allowed to have generic arguments. For example, it extracts the necessary information to reject |
find_bound_for_assoc_item | probe_single_ty_param_bound_for_assoc_ty | Only cares about assoc types, not arbitrary assoc items. Name disambiguated to differentiate it from |
hir_id_to_bound_const | lower_const_param | The old name is nondescript and inaccurate. Not only we do we lower to ty:: but also to ty:: depending on the boundness (early vs. late). |
hir_id_to_bound_ty | lower_ty_param | The old name is nondescript and inaccurate. Not only do we lower to ty:: but also to ty:: depending on the boundness (early vs. late). |
impl_trait_ty_to_ty | lower_opaque_ty | The HIR type kind is called OpaqueDef , so we should keep this nomenclature. It's the right semantic level. “impl-Trait” is ambiguous (universial vs. existential) and more appropriate in contexts concerning the surface syntax. |
instantiate_mono_trait_ref | lower_impl_trait_ref | It's not instantiating anything, it's just lowering. Furthermore, the new name is more descriptive: This method lowers impl trait refs (preexisting terminology), i.e., the main trait ref inside impl headers to the left of keyword for . |
instantiate_poly_trait_ref | lower_poly_trait_ref | It's not instantiating anything, it's just lowering. |
lookup_assoc_ty | probe_assoc_ty | |
lookup_assoc_ty_unchecked | probe_assoc_ty_unchecked | |
lookup_inherent_assoc_ty | probe_inherent_assoc_ty | |
one_bound_for_assoc_item | probe_single_bound_for_assoc_item | |
prohibit_assoc_ty_binding | prohibit_assoc_item_binding | Regarding item over type: This method not only prohibits assoc type bindings but also assoc const bindings as well as RTN (assoc functions). Note that Type should probably renamed, too, at some point (to Assoc ). |
prohibit_generics | prohibit_generic_args | Generics typically stands for generic parameters not arguments — in the compiler at least — and this function prohibits the latter. |
qpath_to_ty | lower_qpath | |
res_to_ty | lower_path | Conceptually speaking, this method lowers paths. The fact that it utilizes the Res to achieve this is an implementation detail and shouldn't be mentioned as part of its name. |
trait_defines_associated_item_named | probe_trait_that_defines_assoc_item | |
ty_from_delegation | lower_delegation_ty | |
ty_of_arg | lower_arg_ty | |
ty_of_fn | lower_fn_ty | |
hir::GenericArgs<'hir> ⟼ ty::GenericArgs<'tcx> | ||
create_args_for_parent_generic_args | lower_generic_args | Before the “substs → generic args” renaming, this used to be called The current name Respectfully, I think the author of the renaming PR saw the |
CreateCtorInstantiationsContext | CtorGenericArgsCtxt | Local struct in rustc_ . Consistent with {Fn,Item}Ctxt . |
CreateInstantiationsForGenericArgsCtxt | GenericArgsLowerer | Before the “substs → generic args” renaming, this used to be called This trait models contexts that can lower |
InstantiationsForAstPathCtxt | GenericArgsCtxt | Local struct in rustc_ . Consistent with {Fn,Item}Ctxt . |
MethodInstantiationsCtxt | GenericArgsCtxt | Local struct in rustc_ . Consistent with {Fn,Item}Ctxt . |
dyn HirTyLowerer<'tcx> + '_ in hir_ty_lowering::errors | ||
complain_about_inherent_assoc_type_not_found | complain_about_inherent_assoc_ty_not_found | |
complain_about_ambiguous_inherent_assoc_type | complain_about_ambiguous_inherent_assoc_ty | |
complain_about_missing_associated_types | complain_about_missing_assoc_tys | |
note_ambiguous_inherent_assoc_type | note_ambiguous_inherent_assoc_ty | |
report_ambiguous_associated_type | report_ambiguous_assoc_ty | |
rustc_hir_analysis::collect::ItemCtxt | ||
to_ty | lower_ty | |
type_parameter_bounds_in_generics | probe_ty_param_bounds_in_generics | |
rustc_hir_typeck::FnCtxt | ||
array_length_to_const | lower_array_length | |
const_arg_to_ty | lower_const_arg | |
to_ty | lower_ty | |
to_ty_saving_user_provided_ty | lower_ty_saving_user_provided_ty | |
rustc_hir_analysis::collect | ||
convert_⟨item⟩ | lower_⟨item⟩ | |
rustc_trait_selection::traits | ||
astconv_object_safety_violations | hir_ty_lowering_object_safety_violations | |
resolve_bound_vars::is_late_bound_map | ||
ConstrainedCollectorPostAstConv | ConstrainedCollectorPostHirTyLowering |
To properly demonstrate the beauty of the new naming scheme, below there's a non-exhaustive logically sorted mapping from new to old name of the main lowering methods only.
New Name | Old Name |
---|---|
add_sized_bound | add_implicitly_sized |
lower_arg_ty | ty_of_arg |
lower_assoc_ty | projected_ty_from_poly_trait_ref |
lower_delegation_ty | ty_from_delegation |
lower_fn_ty | ty_of_fn |
lower_opaque_ty | impl_trait_ty_to_ty |
lower_trait_object_ty | conv_object_ty_poly_trait_ref |
lower_assoc_item_binding | add_predicates_for_ast_type_binding |
lower_assoc_path | associated_path_to_ty |
lower_path_segment | ast_path_to_ty |
lower_path | res_to_ty |
lower_qpath | qpath_to_ty |
lower_const_param | hir_id_to_bound_const |
lower_ty_param | hir_id_to_bound_ty |
lower_generic_args_of_assoc_item | create_args_for_associated_item |
lower_generic_args_of_path_segment | ast_path_args_for_ty |
lower_generic_args_of_path | create_args_for_ast_path |
lower_impl_trait_ref | instantiate_mono_trait_ref |
lower_mono_trait_ref | ast_path_to_mono_trait_ref |
lower_poly_trait_ref | instantiate_poly_trait_ref |
lower_lifetime | ast_region_to_region |
lower_mono_bounds | compute_bounds |
lower_poly_bounds | add_bounds |
lower_ty | ast_ty_to_ty |
lower_ty_common | ast_ty_to_ty_inner |
lower_ty_in_path | ast_ty_to_ty_in_path |
probe_assoc_ty_unchecked | lookup_assoc_ty_unchecked |
probe_assoc_ty | lookup_assoc_ty |
probe_generic_path_segments | def_ids_for_value_path_segments |
probe_inherent_assoc_ty | lookup_inherent_assoc_ty |
probe_single_bound_for_assoc_item | one_bound_for_assoc_item |
probe_single_ty_param_bound_for_assoc_ty | find_bound_for_assoc_item |
probe_trait_that_defines_assoc_item | trait_defines_associated_item_named |
probe_ty_param_bounds | get_type_parameter_bounds |
prohibit_assoc_item_binding | prohibit_assoc_ty_binding |
prohibit_generic_args | prohibit_generics |