Struct rustc_middle::ty::print::FmtPrinter [−][src]
pub struct FmtPrinter<'a, 'tcx, F>(Box<FmtPrinterData<'a, 'tcx, F>>);
Tuple Fields
0: Box<FmtPrinterData<'a, 'tcx, F>>
Implementations
pub fn name_all_regions<T>(
self,
value: &Binder<'tcx, T>
) -> Result<(Self, T, BTreeMap<BoundRegion, Region<'tcx>>), Error> where
T: Print<'tcx, Self, Output = Self, Error = Error> + TypeFoldable<'tcx>,
pub fn pretty_in_binder<T>(self, value: &Binder<'tcx, T>) -> Result<Self, Error> where
T: Print<'tcx, Self, Output = Self, Error = Error> + TypeFoldable<'tcx>,
pub fn pretty_wrap_binder<T, C: Fn(&T, Self) -> Result<Self, Error>>(
self,
value: &Binder<'tcx, T>,
f: C
) -> Result<Self, Error> where
T: Print<'tcx, Self, Output = Self, Error = Error> + TypeFoldable<'tcx>,
fn prepare_late_bound_region_info<T>(&mut self, value: &Binder<'tcx, T>) where
T: TypeFoldable<'tcx>,
Trait Implementations
type Target = FmtPrinterData<'a, 'tcx, F>
type Target = FmtPrinterData<'a, 'tcx, F>
The resulting type after dereferencing.
fn print_value_path(
self,
def_id: DefId,
substs: &'tcx [GenericArg<'tcx>]
) -> Result<Self::Path, Self::Error>
fn print_value_path(
self,
def_id: DefId,
substs: &'tcx [GenericArg<'tcx>]
) -> Result<Self::Path, Self::Error>
Like print_def_path
but for value paths.
fn in_binder<T>(self, value: &Binder<'tcx, T>) -> Result<Self, Self::Error> where
T: Print<'tcx, Self, Output = Self, Error = Self::Error> + TypeFoldable<'tcx>,
fn wrap_binder<T, C: Fn(&T, Self) -> Result<Self, Self::Error>>(
self,
value: &Binder<'tcx, T>,
f: C
) -> Result<Self, Self::Error> where
T: Print<'tcx, Self, Output = Self, Error = Self::Error> + TypeFoldable<'tcx>,
Prints {f: t}
or {f as t}
depending on the cast
argument
Prints <...>
around what f
prints.
Returns true
if the region should be printed in
optional positions, e.g., &'a T
or dyn Tr + 'b
.
This is typically the case for all non-'_
regions. Read more
fn pretty_print_const_pointer<Tag: Provenance>(
self,
p: Pointer<Tag>,
ty: Ty<'tcx>,
print_ty: bool
) -> Result<Self::Const, Self::Error>
fn pretty_print_const_pointer<Tag: Provenance>(
self,
p: Pointer<Tag>,
ty: Ty<'tcx>,
print_ty: bool
) -> Result<Self::Const, Self::Error>
This is overridden for MIR printing because we only want to hide alloc ids from users, not from MIR where it is actually useful. Read more
Prints comma-separated elements.
If possible, this returns a global path resolving to def_id
that is visible
from at least one local module, and returns true
. If the crate defining def_id
is
declared with an extern crate
, the path is guaranteed to use the extern crate
. Read more
Try to see if this path can be trimmed to a unique symbol name.
Does the work of try_print_visible_def_path
, building the
full definition path recursively before attempting to
post-process it into the valid and visible version that
accounts for re-exports. Read more
fn pretty_path_qualified(
self,
self_ty: Ty<'tcx>,
trait_ref: Option<TraitRef<'tcx>>
) -> Result<Self::Path, Self::Error>
fn pretty_path_append_impl(
self,
print_prefix: impl FnOnce(Self) -> Result<Self::Path, Self::Error>,
self_ty: Ty<'tcx>,
trait_ref: Option<TraitRef<'tcx>>
) -> Result<Self::Path, Self::Error>
fn pretty_print_bound_var(
&mut self,
debruijn: DebruijnIndex,
var: BoundVar
) -> Result<(), Self::Error>
fn pretty_print_dyn_existential(
self,
predicates: &'tcx List<Binder<'tcx, ExistentialPredicate<'tcx>>>
) -> Result<Self::DynExistential, Self::Error>
fn pretty_fn_sig(
self,
inputs: &[Ty<'tcx>],
c_variadic: bool,
output: Ty<'tcx>
) -> Result<Self, Self::Error>
fn pretty_print_const(
self,
ct: &'tcx Const<'tcx>,
print_ty: bool
) -> Result<Self::Const, Self::Error>
fn pretty_print_const_scalar(
self,
scalar: Scalar,
ty: Ty<'tcx>,
print_ty: bool
) -> Result<Self::Const, Self::Error>
fn pretty_print_const_scalar_ptr(
self,
ptr: Pointer,
ty: Ty<'tcx>,
print_ty: bool
) -> Result<Self::Const, Self::Error>
fn pretty_print_const_scalar_int(
self,
int: ScalarInt,
ty: Ty<'tcx>,
print_ty: bool
) -> Result<Self::Const, Self::Error>
fn pretty_print_const_value(
self,
ct: ConstValue<'tcx>,
ty: Ty<'tcx>,
print_ty: bool
) -> Result<Self::Const, Self::Error>
type Path = Self
type Region = Self
type Type = Self
type DynExistential = Self
type Const = Self
fn print_def_path(
self,
def_id: DefId,
substs: &'tcx [GenericArg<'tcx>]
) -> Result<Self::Path, Self::Error>
fn print_dyn_existential(
self,
predicates: &'tcx List<Binder<'tcx, ExistentialPredicate<'tcx>>>
) -> Result<Self::DynExistential, Self::Error>
fn path_qualified(
self,
self_ty: Ty<'tcx>,
trait_ref: Option<TraitRef<'tcx>>
) -> Result<Self::Path, Self::Error>
fn path_append_impl(
self,
print_prefix: impl FnOnce(Self) -> Result<Self::Path, Self::Error>,
_disambiguated_data: &DisambiguatedDefPathData,
self_ty: Ty<'tcx>,
trait_ref: Option<TraitRef<'tcx>>
) -> Result<Self::Path, Self::Error>
fn path_append(
self,
print_prefix: impl FnOnce(Self) -> Result<Self::Path, Self::Error>,
disambiguated_data: &DisambiguatedDefPathData
) -> Result<Self::Path, Self::Error>
fn path_generic_args(
self,
print_prefix: impl FnOnce(Self) -> Result<Self::Path, Self::Error>,
args: &[GenericArg<'tcx>]
) -> Result<Self::Path, Self::Error>
fn print_impl_path(
self,
impl_def_id: DefId,
substs: &'tcx [GenericArg<'tcx>],
self_ty: Ty<'tcx>,
trait_ref: Option<TraitRef<'tcx>>
) -> Result<Self::Path, Self::Error>
fn default_print_def_path(
self,
def_id: DefId,
substs: &'tcx [GenericArg<'tcx>]
) -> Result<Self::Path, Self::Error>
fn generic_args_to_print(
&self,
generics: &'tcx Generics,
substs: &'tcx [GenericArg<'tcx>]
) -> &'tcx [GenericArg<'tcx>]
Writes a string slice into this writer, returning whether the write succeeded. Read more
Auto Trait Implementations
impl<'a, 'tcx, F> !RefUnwindSafe for FmtPrinter<'a, 'tcx, F>
impl<'a, 'tcx, F> !Send for FmtPrinter<'a, 'tcx, F>
impl<'a, 'tcx, F> !Sync for FmtPrinter<'a, 'tcx, F>
impl<'a, 'tcx, F> Unpin for FmtPrinter<'a, 'tcx, F>
impl<'a, 'tcx, F> !UnwindSafe for FmtPrinter<'a, 'tcx, F>
Blanket Implementations
Layout
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.
Size: 8 bytes