Module print

Source

Modules§

pretty 🔒

Macros§

with_crate_prefix
Adds the crate:: prefix to paths where appropriate.
with_forced_impl_filename_line
Force us to name impls with just the filename/line number. We normally try to use types. But at some points, notably while printing cycle errors, this can result in extra or suboptimal error output, so this variable disables that check.
with_forced_trimmed_paths
with_no_queries
Avoids running any queries during prints.
with_no_trimmed_paths
Prevent path trimming if it is turned on. Path trimming affects Display impl of various rustc types, for example std::vec::Vec would be trimmed to Vec, if no other Vec is found.
with_no_visible_paths
Prevent selection of visible paths. Display impl of DefId will prefer visible (public) reexports of types as paths.
with_reduced_queries
Avoids running select queries during any prints that occur during the closure. This may alter the appearance of some types (e.g. forcing verbose printing for opaque types). This method is used during some queries (e.g. explicit_item_bounds for opaque types), to ensure that any debug printing that occurs during the query computation does not end up recursively calling the same query.

Structs§

CratePrefixGuard
FmtPrinter
FmtPrinterData
ForceTrimmedGuard
ForcedImplGuard
NoTrimmedGuard
NoVisibleGuard
OpaqueFnEntry
PrintClosureAsImpl
ReducedQueriesGuard
RegionHighlightMode
The “region highlights” are used to control region printing during specific error messages. When a “region highlight” is enabled, it gives an alternate way to print specific regions. For now, we always print those regions using a number, so something like “'0”.
TraitPredPrintModifiersAndPath
TraitPredPrintWithBoundConstness
TraitRefPrintOnlyTraitName
Wrapper type for ty::TraitRef which opts-in to pretty printing only the trait name. That is, it will print Trait instead of <T as Trait<U>>.
TraitRefPrintOnlyTraitPath
Wrapper type for ty::TraitRef which opts-in to pretty printing only the trait path. That is, it will print Trait<U> instead of <T as Trait<U>>.
TraitRefPrintSugared
Wrapper type for ty::TraitRef which opts-in to pretty printing only the trait path, and additionally tries to “sugar” Fn(...) trait bounds.

Traits§

PrettyPrinter
Trait for printers that pretty-print using fmt::Write to the printer.
Print
PrintPolyTraitPredicateExt
PrintPolyTraitRefExt
PrintTraitPredicateExt
PrintTraitRefExt
Printer
Interface for outputting user-facing “type-system entities” (paths, types, lifetimes, constants, etc.) as a side-effect (e.g. formatting, like PrettyPrinter implementors do) or by constructing some alternative representation (e.g. an AST), which the associated types allow passing through the methods.

Functions§

characteristic_def_id_of_type
characteristic_def_id_of_type_cached 🔒
As a heuristic, when we see an impl, if we see that the ‘self type’ is a type defined in the same module as the impl, we can omit including the path to the impl itself. This function tries to find a “characteristic DefId” for a type. It’s just a heuristic so it makes some questionable decisions and we may want to adjust it later.
describe_as_module
provide
shrunk_instance_name
Format instance name that is already known to be too long for rustc. Show only the first 2 types if it is longer than 32 characters to avoid blasting the user’s terminal with thousands of lines of type-name.
trimmed_def_paths
The purpose of this function is to collect public symbols names that are unique across all crates in the build. Later, when printing about types we can use those names instead of the full exported path to them.
with_crate_prefix
with_forced_impl_filename_line
with_forced_trimmed_paths
with_no_trimmed_paths
with_no_visible_paths
with_reduced_queries

Type Aliases§

PrintError