Module clean

Source
Expand description

This module defines the primary IR1 used in rustdoc together with the procedures that transform rustc data types into it.

This IR — commonly referred to as the cleaned AST — is modeled after the AST.

There are two kinds of transformation — cleaning — procedures:

  1. Cleans HIR types. Used for user-written code and inlined local re-exports both found in the local crate.
  2. Cleans rustc_middle::ty types. Used for inlined cross-crate re-exports and anything output by the trait solver (e.g., when synthesizing blanket and auto-trait impls). They usually have ty or middle in their name.

Their name is prefixed by clean_.

Both the HIR and the rustc_middle::ty IR are quite removed from the source code. The cleaned AST on the other hand is closer to it which simplifies the rendering process. Furthermore, operating on a single IR instead of two avoids duplicating efforts down the line.

This IR is consumed by both the HTML and the JSON backend.


  1. Intermediate representation. 

Modules§

auto_trait 🔒
blanket_impl 🔒
cfg 🔒
The representation of a #[doc(cfg(...))] attribute.
inline 🔒
Support for inlining external documentation into the current AST.
render_macro_matchers 🔒
simplify 🔒
Simplification of where-clauses and parameter bounds into a prettier and more canonical form.
types 🔒
utils 🔒

Enums§

ContainerTy 🔒
FunctionArgs 🔒
ObjectLifetimeDefault 🔒
ParamDefaults 🔒
Whether to clean generic parameter defaults or not.

Functions§

add_without_unwanted_attributes 🔒
When inlining items, we merge their attributes (and all the reexports attributes too) with the final reexport. For example:
can_elide_trait_object_lifetime_bound 🔒
clean_args_from_types_and_body_id 🔒
clean_args_from_types_and_names 🔒
clean_assoc_item_constraint 🔒
clean_bare_fn_ty 🔒
clean_bound_vars 🔒
clean_const 🔒
clean_doc_module 🔒
clean_extern_crate 🔒
clean_field 🔒
clean_field_with_def_id 🔒
clean_fn_decl_legacy_const_generics 🔒
This is needed to make it more “readable” when documenting functions using rustc_legacy_const_generics. More information in https://github.com/rust-lang/rust/issues/83167.
clean_fn_decl_with_args 🔒
clean_fn_or_proc_macro 🔒
clean_function 🔒
clean_generic_args 🔒
clean_generic_bound 🔒
clean_generic_param 🔒
clean_generic_param_def 🔒
clean_generics 🔒
clean_hir_term 🔒
clean_impl 🔒
clean_impl_item 🔒
clean_lifetime 🔒
clean_maybe_renamed_foreign_item 🔒
clean_maybe_renamed_item 🔒
clean_middle_assoc_item 🔒
clean_middle_const 🔒
clean_middle_field 🔒
clean_middle_opaque_bounds 🔒
clean_middle_region 🔒
clean_middle_term 🔒
clean_middle_ty 🔒
clean_path 🔒
clean_path_segment 🔒
clean_poly_fn_sig 🔒
clean_poly_trait_predicate 🔒
clean_poly_trait_ref 🔒
clean_poly_trait_ref_with_constraints 🔒
clean_predicate 🔒
clean_proc_macro 🔒
clean_projection 🔒
clean_projection_predicate 🔒
clean_qpath 🔒
clean_region_outlives_predicate 🔒
clean_trait_item 🔒
clean_trait_object_lifetime_bound 🔒
clean_trait_ref 🔒
clean_trait_ref_with_constraints 🔒
clean_ty 🔒
clean_ty_alias_inner_type 🔒
clean_ty_generics 🔒
clean_type_outlives_predicate 🔒
clean_unsafe_binder_ty 🔒
clean_use_statement 🔒
clean_use_statement_inner 🔒
clean_variant 🔒
clean_variant_data 🔒
clean_variant_def 🔒
clean_variant_def_with_args 🔒
clean_where_predicate 🔒
compute_should_show_cast 🔒
filter_doc_attr 🔒
Remove attributes from normal that should not be inherited by use re-export. Before calling this function, make sure normal is a #[doc] attribute.
filter_doc_attr_ident 🔒
filter_tokens_from_list 🔒
first_non_private 🔒
The goal of this function is to return the first Path which is not private (ie not private or doc(hidden)). If it’s not possible, it’ll return the “end type”.
first_non_private_clean_path 🔒
generate_item_with_correct_attrs 🔒
get_all_import_attributes 🔒
Collect attributes from the whole import chain.
is_elided_lifetime 🔒
This can happen for async fn, e.g. async fn f<'_>(&'_ self).
is_glob_import 🔒
is_impl_trait 🔒
Synthetic type-parameters are inserted after normal ones. In order for normal parameters to be able to refer to synthetic ones, scans them first.
maybe_expand_private_type_alias 🔒
normalize 🔒
Returns None if the type could not be normalized
projection_to_path_segment 🔒
reexport_chain 🔒