rustdoc::clean - Rust (original) (raw)

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.

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 πŸ”’

ContainerTy πŸ”’

ObjectLifetimeDefault πŸ”’

ParamDefaults πŸ”’

Whether to clean generic parameter defaults or not.

ParamsSrc πŸ”’

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_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 usingrustc_legacy_const_generics. More information inhttps://github.com/rust-lang/rust/issues/83167.

clean_fn_decl_with_params πŸ”’

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_params πŸ”’

clean_params_via_body πŸ”’

clean_path πŸ”’

clean_path_segment πŸ”’

clean_poly_fn_sig πŸ”’

clean_poly_trait_predicate πŸ”’

clean_poly_trait_ref πŸ”’

clean_poly_trait_ref_with_constraints πŸ”’

clean_precise_capturing_arg πŸ”’

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 πŸ”’