Skip to main content

Module print

Module print 

Source
Expand description

Pattern analysis sometimes wants to print patterns as part of a user-visible diagnostic.

Historically it did so by creating a synthetic thir::Pat and printing that, but doing so was making it hard to modify the THIR pattern representation for other purposes.

So this module contains a forked copy of thir::Pat that is used only for diagnostics, and has been partly simplified to remove things that aren’t needed for printing.

Re-exportsΒ§

use std::fmt; πŸ”’
use rustc_abi::FieldIdx; πŸ”’
use rustc_abi::VariantIdx; πŸ”’
use rustc_middle::ty; πŸ”’
use rustc_middle::ty::AdtDef; πŸ”’
use rustc_middle::ty::Ty; πŸ”’
use rustc_middle::ty::TyCtxt; πŸ”’
use rustc_span::bug; πŸ”’
use rustc_span::sym; πŸ”’

StructsΒ§

FieldPat πŸ”’

EnumsΒ§

EnumInfo πŸ”’

FunctionsΒ§

start_or_comma πŸ”’
Returns a closure that will return "" when called the first time, and then return ", " when called any subsequent times. Useful for printing comma-separated lists.
write_ref_like πŸ”’
write_slice_like πŸ”’
write_struct_like πŸ”’