Skip to main content

Module pretty

Module pretty 

Source

Re-exportsΒ§

use std::cell::Cell; πŸ”’
use std::fmt; πŸ”’
use std::fmt::Write as _; πŸ”’
use std::iter; πŸ”’
use std::ops::Deref; πŸ”’
use std::ops::DerefMut; πŸ”’
use rustc_abi::ExternAbi; πŸ”’
use rustc_abi::Size; πŸ”’
use rustc_apfloat::Float; πŸ”’
use rustc_apfloat::ieee::Double; πŸ”’
use rustc_apfloat::ieee::Half; πŸ”’
use rustc_apfloat::ieee::Quad; πŸ”’
use rustc_apfloat::ieee::Single; πŸ”’
use rustc_attr_ir::lang_items::LangItem; πŸ”’
use rustc_crate_store::ExternCrate; πŸ”’
use rustc_crate_store::ExternCrateSource; πŸ”’
use rustc_data_structures::fx::FxIndexMap; πŸ”’
use rustc_data_structures::fx::IndexEntry; πŸ”’
use rustc_data_structures::unord::UnordMap; πŸ”’
use rustc_hir as hir; πŸ”’
use rustc_hir::def; πŸ”’
use rustc_hir::def::CtorKind; πŸ”’
use rustc_hir::def::DefKind; πŸ”’
use rustc_hir::def::Namespace; πŸ”’
use rustc_hir::def_id::DefIdMap; πŸ”’
use rustc_hir::def_id::DefIdSet; πŸ”’
use rustc_hir::def_id::LOCAL_CRATE; πŸ”’
use rustc_hir::def_id::ModId; πŸ”’
use rustc_hir::definitions::DefKey; πŸ”’
use rustc_hir::definitions::DefPathDataName; πŸ”’
use rustc_macros::Lift; πŸ”’
use rustc_macros::extension; πŸ”’
use rustc_span::Ident; πŸ”’
use rustc_span::RemapPathScopeComponents; πŸ”’
use rustc_span::Symbol; πŸ”’
use rustc_span::bug; πŸ”’
use rustc_span::kw; πŸ”’
use rustc_span::sym; πŸ”’
use rustc_structures::Limit; πŸ”’
use rustc_type_ir::FieldInfo; πŸ”’
use rustc_type_ir::Unnormalized; πŸ”’
use rustc_type_ir::Upcast as _; πŸ”’
use rustc_type_ir::elaborate; πŸ”’
use smallvec::SmallVec; πŸ”’
use crate::mir::interpret::AllocRange; πŸ”’
use crate::mir::interpret::GlobalAlloc; πŸ”’
use crate::mir::interpret::Pointer; πŸ”’
use crate::mir::interpret::Provenance; πŸ”’
use crate::mir::interpret::Scalar; πŸ”’
use crate::query::IntoQueryKey; πŸ”’
use crate::query::Providers; πŸ”’
use crate::ty::ConstInt; πŸ”’
use crate::ty::Expr; πŸ”’
use crate::ty::GenericArgKind; πŸ”’
use crate::ty::ParamConst; πŸ”’
use crate::ty::ScalarInt; πŸ”’
use crate::ty::Term; πŸ”’
use crate::ty::TermKind; πŸ”’
use crate::ty::TraitClause; πŸ”’
use crate::ty::TypeFoldable; πŸ”’
use crate::ty::TypeFoldable; πŸ”’
use crate::ty::TypeSuperFoldable; πŸ”’
use crate::ty::TypeSuperVisitable; πŸ”’
use crate::ty::TypeVisitable; πŸ”’
use crate::ty::TypeVisitable; πŸ”’
use crate::ty::TypeVisitableExt; πŸ”’
use super::*; πŸ”’

MacrosΒ§

define_helper πŸ”’
define_print πŸ”’
define_print_and_forward_display πŸ”’
forward_display_to_print πŸ”’
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_no_visible_paths_if_doc_hidden
Prevent selection of visible paths if the paths are through a doc hidden path.
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.
with_resolve_crate_name
Adds the crate name prefix to paths where appropriate. Unlike with_crate_prefix, this unconditionally uses tcx.crate_name instead of sometimes using crate:: for local items.
with_types_for_signature
Print types for the purposes of a signature suggestion.
with_types_for_suggestion
Print types for the purposes of a suggestion.

StructsΒ§

CrateNamePrefixGuard
CratePrefixGuard
FmtPrinter
FmtPrinterData
ForceTrimmedGuard
ForcedImplGuard
NoTrimmedGuard
NoVisibleGuard
NoVisibleIfDocHiddenGuard
OpaqueFnEntry
PrintClosureAsImpl
ReducedQueriesGuard
RegionFolder πŸ”’
Folds through bound vars and placeholders, naming them
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”.
RtnModeHelper
TraitClausePrintModifiersAndPath
TraitClausePrintWithBoundConstness
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.

EnumsΒ§

RtnMode
Rendering style for RTN types.
WrapBinderMode

ConstantsΒ§

FORCE_IMPL_FILENAME_LINE πŸ”’
FORCE_TRIMMED_PATH πŸ”’
NO_TRIMMED_PATH πŸ”’
NO_VISIBLE_PATH πŸ”’
NO_VISIBLE_PATH_IF_DOC_HIDDEN πŸ”’
REDUCED_QUERIES πŸ”’
RTN_MODE πŸ”’
SHOULD_PREFIX_WITH_CRATE πŸ”’
SHOULD_PREFIX_WITH_CRATE_NAME πŸ”’

TraitsΒ§

PrettyPrinter
Trait for printers that pretty-print using fmt::Write to the printer.
PrintPolyTraitClauseExt
PrintPolyTraitRefExt
PrintTraitClauseExt
PrintTraitRefExt

FunctionsΒ§

for_each_def πŸ”’
guess_def_namespace πŸ”’
pretty_print_const πŸ”’
provide
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_no_visible_paths_if_doc_hidden
with_reduced_queries
with_resolve_crate_name