Struct rustc_middle::ty::print::pretty::FmtPrinter[−][src]

pub struct FmtPrinter<'a, 'tcx, F>(Box<FmtPrinterData<'a, 'tcx, F>>);

Implementations

impl<F, 'a, 'tcx> FmtPrinter<'a, 'tcx, F>[src]

pub fn new(tcx: TyCtxt<'tcx>, fmt: F, ns: Namespace) -> Self[src]

impl<F: Write> FmtPrinter<'_, '_, F>[src]

pub fn pretty_print_region(self, region: Region<'_>) -> Result<Self, Error>[src]

impl<F: Write, 'tcx> FmtPrinter<'_, 'tcx, F>[src]

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>, 
[src]

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>, 
[src]

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>, 
[src]

fn prepare_late_bound_region_info<T>(&mut self, value: &Binder<'tcx, T>) where
    T: TypeFoldable<'tcx>, 
[src]

Trait Implementations

impl<F, 'a, 'tcx> Deref for FmtPrinter<'a, 'tcx, F>[src]

type Target = FmtPrinterData<'a, 'tcx, F>

The resulting type after dereferencing.

fn deref(&self) -> &Self::Target[src]

Dereferences the value.

impl<F> DerefMut for FmtPrinter<'_, '_, F>[src]

fn deref_mut(&mut self) -> &mut Self::Target[src]

Mutably dereferences the value.

impl<F: Write, 'tcx> PrettyPrinter<'tcx> for FmtPrinter<'_, 'tcx, F>[src]

fn infer_ty_name(&self, id: TyVid) -> Option<String>[src]

fn print_value_path(
    self,
    def_id: DefId,
    substs: &'tcx [GenericArg<'tcx>]
) -> Result<Self::Path, Self::Error>
[src]

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>, 
[src]

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>, 
[src]

fn typed_value(
    self,
    f: impl FnOnce(Self) -> Result<Self, Self::Error>,
    t: impl FnOnce(Self) -> Result<Self, Self::Error>,
    conversion: &str
) -> Result<Self::Const, Self::Error>
[src]

Prints {f: t} or {f as t} depending on the cast argument

fn generic_delimiters(
    self,
    f: impl FnOnce(Self) -> Result<Self, Self::Error>
) -> Result<Self, Self::Error>
[src]

Prints <...> around what f prints.

fn region_should_not_be_omitted(&self, region: Region<'_>) -> bool[src]

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(
    self,
    p: Pointer,
    ty: Ty<'tcx>,
    print_ty: bool
) -> Result<Self::Const, Self::Error>
[src]

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

fn comma_sep<T>(
    self,
    elems: impl Iterator<Item = T>
) -> Result<Self, Self::Error> where
    T: Print<'tcx, Self, Output = Self, Error = Self::Error>, 
[src]

Prints comma-separated elements.

fn try_print_visible_def_path(
    self,
    def_id: DefId
) -> Result<(Self, bool), Self::Error>
[src]

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

fn try_print_trimmed_def_path(
    self,
    def_id: DefId
) -> Result<(Self::Path, bool), Self::Error>
[src]

Try to see if this path can be trimmed to a unique symbol name.

fn try_print_visible_def_path_recur(
    self,
    def_id: DefId,
    callers: &mut Vec<DefId>
) -> Result<(Self, bool), Self::Error>
[src]

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>
[src]

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>
[src]

fn pretty_print_type(self, ty: Ty<'tcx>) -> Result<Self::Type, Self::Error>[src]

fn pretty_print_bound_var(
    &mut self,
    debruijn: DebruijnIndex,
    var: BoundVar
) -> Result<(), Self::Error>
[src]

fn pretty_print_dyn_existential(
    self,
    predicates: &'tcx List<Binder<'tcx, ExistentialPredicate<'tcx>>>
) -> Result<Self::DynExistential, Self::Error>
[src]

fn pretty_fn_sig(
    self,
    inputs: &[Ty<'tcx>],
    c_variadic: bool,
    output: Ty<'tcx>
) -> Result<Self, Self::Error>
[src]

fn pretty_print_const(
    self,
    ct: &'tcx Const<'tcx>,
    print_ty: bool
) -> Result<Self::Const, Self::Error>
[src]

fn pretty_print_const_scalar(
    self,
    scalar: Scalar,
    ty: Ty<'tcx>,
    print_ty: bool
) -> Result<Self::Const, Self::Error>
[src]

fn pretty_print_const_scalar_ptr(
    self,
    ptr: Pointer,
    ty: Ty<'tcx>,
    print_ty: bool
) -> Result<Self::Const, Self::Error>
[src]

fn pretty_print_const_scalar_int(
    self,
    int: ScalarInt,
    ty: Ty<'tcx>,
    print_ty: bool
) -> Result<Self::Const, Self::Error>
[src]

fn pretty_print_byte_str(
    self,
    byte_str: &'tcx [u8]
) -> Result<Self::Const, Self::Error>
[src]

fn pretty_print_const_value(
    self,
    ct: ConstValue<'tcx>,
    ty: Ty<'tcx>,
    print_ty: bool
) -> Result<Self::Const, Self::Error>
[src]

impl<F: Write, 'tcx> Printer<'tcx> for FmtPrinter<'_, 'tcx, F>[src]

type Error = Error

type Path = Self

type Region = Self

type Type = Self

type DynExistential = Self

type Const = Self

fn tcx<'a>(&'a self) -> TyCtxt<'tcx>[src]

fn print_def_path(
    self,
    def_id: DefId,
    substs: &'tcx [GenericArg<'tcx>]
) -> Result<Self::Path, Self::Error>
[src]

fn print_region(self, region: Region<'_>) -> Result<Self::Region, Self::Error>[src]

fn print_type(self, ty: Ty<'tcx>) -> Result<Self::Type, Self::Error>[src]

fn print_dyn_existential(
    self,
    predicates: &'tcx List<Binder<'tcx, ExistentialPredicate<'tcx>>>
) -> Result<Self::DynExistential, Self::Error>
[src]

fn print_const(self, ct: &'tcx Const<'tcx>) -> Result<Self::Const, Self::Error>[src]

fn path_crate(self, cnum: CrateNum) -> Result<Self::Path, Self::Error>[src]

fn path_qualified(
    self,
    self_ty: Ty<'tcx>,
    trait_ref: Option<TraitRef<'tcx>>
) -> Result<Self::Path, Self::Error>
[src]

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>
[src]

fn path_append(
    self,
    print_prefix: impl FnOnce(Self) -> Result<Self::Path, Self::Error>,
    disambiguated_data: &DisambiguatedDefPathData
) -> Result<Self::Path, Self::Error>
[src]

fn path_generic_args(
    self,
    print_prefix: impl FnOnce(Self) -> Result<Self::Path, Self::Error>,
    args: &[GenericArg<'tcx>]
) -> Result<Self::Path, Self::Error>
[src]

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>
[src]

fn default_print_def_path(
    self,
    def_id: DefId,
    substs: &'tcx [GenericArg<'tcx>]
) -> Result<Self::Path, Self::Error>
[src]

fn generic_args_to_print(
    &self,
    generics: &'tcx Generics,
    substs: &'tcx [GenericArg<'tcx>]
) -> &'tcx [GenericArg<'tcx>]ⓘ

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

fn default_print_impl_path(
    self,
    impl_def_id: DefId,
    _substs: &'tcx [GenericArg<'tcx>],
    self_ty: Ty<'tcx>,
    impl_trait_ref: Option<TraitRef<'tcx>>
) -> Result<Self::Path, Self::Error>
[src]

impl<F: Write> Write for FmtPrinter<'_, '_, F>[src]

fn write_str(&mut self, s: &str) -> Result[src]

Writes a string slice into this writer, returning whether the write succeeded. Read more

fn write_char(&mut self, c: char) -> Result<(), Error>1.1.0[src]

Writes a char into this writer, returning whether the write succeeded. Read more

fn write_fmt(&mut self, args: Arguments<'_>) -> Result<(), Error>1.0.0[src]

Glue for usage of the write! macro with implementors of this trait. 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

impl<T> Any for T where
    T: 'static + ?Sized, 
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized, 
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized, 
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> MaybeResult<T> for T[src]

type Error = !

pub fn from(Result<T, <T as MaybeResult<T>>::Error>) -> T[src]

pub fn to_result(self) -> Result<T, <T as MaybeResult<T>>::Error>[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<T> WithConstness for T[src]

fn with_constness(self, constness: Constness) -> ConstnessAnd<Self>[src]

fn with_const(self) -> ConstnessAnd<Self>[src]

fn without_const(self) -> ConstnessAnd<Self>[src]

impl<'a, T> Captures<'a> for T where
    T: ?Sized, 
[src]