Struct rustc_symbol_mangling::legacy::SymbolPrinter
source · [−]struct SymbolPrinter<'tcx> {
tcx: TyCtxt<'tcx>,
path: SymbolPath,
keep_within_component: bool,
}Fields
tcx: TyCtxt<'tcx>path: SymbolPathkeep_within_component: boolTrait Implementations
sourceimpl<'tcx> PrettyPrinter<'tcx> for &mut SymbolPrinter<'tcx>
impl<'tcx> PrettyPrinter<'tcx> for &mut SymbolPrinter<'tcx>
sourcefn region_should_not_be_omitted(&self, _region: Region<'_>) -> bool
fn region_should_not_be_omitted(&self, _region: Region<'_>) -> bool
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
sourcefn comma_sep<T>(
self,
elems: impl Iterator<Item = T>
) -> Result<Self, Self::Error> where
T: Print<'tcx, Self, Output = Self, Error = Self::Error>,
fn comma_sep<T>(
self,
elems: impl Iterator<Item = T>
) -> Result<Self, Self::Error> where
T: Print<'tcx, Self, Output = Self, Error = Self::Error>,
Prints comma-separated elements.
sourcefn generic_delimiters(
self,
f: impl FnOnce(Self) -> Result<Self, Self::Error>
) -> Result<Self, Self::Error>
fn generic_delimiters(
self,
f: impl FnOnce(Self) -> Result<Self, Self::Error>
) -> Result<Self, Self::Error>
Prints <...> around what f prints.
sourcefn 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, F>(
self,
value: &Binder<'tcx, T>,
f: F
) -> Result<Self, Self::Error> where
F: Fn(&T, Self) -> Result<Self, Error>,
T: Print<'tcx, Self, Output = Self, Error = Self::Error> + TypeFoldable<'tcx>,
sourcefn 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>
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>
Prints {f: t} or {f as t} depending on the cast argument
sourcefn try_print_visible_def_path(
self,
def_id: DefId
) -> Result<(Self, bool), Self::Error>
fn try_print_visible_def_path(
self,
def_id: DefId
) -> Result<(Self, bool), Self::Error>
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
sourcefn try_print_trimmed_def_path(
self,
def_id: DefId
) -> Result<(Self::Path, bool), Self::Error>
fn try_print_trimmed_def_path(
self,
def_id: DefId
) -> Result<(Self::Path, bool), Self::Error>
Try to see if this path can be trimmed to a unique symbol name.
sourcefn try_print_visible_def_path_recur(
self,
def_id: DefId,
callers: &mut Vec<DefId, Global>
) -> Result<(Self, bool), Self::Error>
fn try_print_visible_def_path_recur(
self,
def_id: DefId,
callers: &mut Vec<DefId, Global>
) -> Result<(Self, bool), Self::Error>
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: &'tcx TyS<'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: &'tcx TyS<'tcx>,
trait_ref: Option<TraitRef<'tcx>>
) -> Result<Self::Path, Self::Error>
fn pretty_print_type(
self,
ty: &'tcx TyS<'tcx>
) -> Result<Self::Type, Self::Error>
fn pretty_print_opaque_impl_type(
self,
def_id: DefId,
substs: &'tcx List<GenericArg<'tcx>>
) -> Result<Self::Type, Self::Error>
sourcefn insert_trait_and_projection(
&mut self,
trait_ref: Binder<'tcx, TraitRef<'tcx>>,
proj_ty: Option<(DefId, Binder<'tcx, Term<'tcx>>)>,
traits: &mut BTreeMap<Binder<'tcx, TraitRef<'tcx>>, BTreeMap<DefId, Binder<'tcx, Term<'tcx>>>>,
fn_traits: &mut BTreeMap<Binder<'tcx, TraitRef<'tcx>>, OpaqueFnEntry<'tcx>>
)
fn insert_trait_and_projection(
&mut self,
trait_ref: Binder<'tcx, TraitRef<'tcx>>,
proj_ty: Option<(DefId, Binder<'tcx, Term<'tcx>>)>,
traits: &mut BTreeMap<Binder<'tcx, TraitRef<'tcx>>, BTreeMap<DefId, Binder<'tcx, Term<'tcx>>>>,
fn_traits: &mut BTreeMap<Binder<'tcx, TraitRef<'tcx>>, OpaqueFnEntry<'tcx>>
)
Insert the trait ref and optionally a projection type associated with it into either the traits map or fn_traits map, depending on if the trait is in the Fn* family of traits. Read more
fn pretty_print_bound_var(
&mut self,
debruijn: DebruijnIndex,
var: BoundVar
) -> Result<(), Self::Error>
fn infer_ty_name(&self, TyVid) -> Option<String>
fn pretty_print_dyn_existential(
self,
predicates: &'tcx List<Binder<'tcx, ExistentialPredicate<'tcx>>>
) -> Result<Self::DynExistential, Self::Error>
fn pretty_fn_sig(
self,
inputs: &[&'tcx TyS<'tcx>],
c_variadic: bool,
output: &'tcx TyS<'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<AllocId>,
ty: &'tcx TyS<'tcx>,
print_ty: bool
) -> Result<Self::Const, Self::Error>
fn pretty_print_const_scalar_ptr(
self,
ptr: Pointer<AllocId>,
ty: &'tcx TyS<'tcx>,
print_ty: bool
) -> Result<Self::Const, Self::Error>
fn pretty_print_const_scalar_int(
self,
int: ScalarInt,
ty: &'tcx TyS<'tcx>,
print_ty: bool
) -> Result<Self::Const, Self::Error>
sourcefn pretty_print_const_pointer<Tag>(
self,
Pointer<Tag>,
ty: &'tcx TyS<'tcx>,
print_ty: bool
) -> Result<Self::Const, Self::Error> where
Tag: Provenance,
fn pretty_print_const_pointer<Tag>(
self,
Pointer<Tag>,
ty: &'tcx TyS<'tcx>,
print_ty: bool
) -> Result<Self::Const, Self::Error> where
Tag: Provenance,
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 pretty_print_byte_str(
self,
byte_str: &'tcx [u8]
) -> Result<Self::Const, Self::Error>
fn pretty_print_const_value(
self,
ct: ConstValue<'tcx>,
ty: &'tcx TyS<'tcx>,
print_ty: bool
) -> Result<Self::Const, Self::Error>
sourceimpl<'tcx> Printer<'tcx> for &mut SymbolPrinter<'tcx>
impl<'tcx> Printer<'tcx> for &mut SymbolPrinter<'tcx>
type Error = Error
type Path = Self
type Region = Self
type Type = Self
type DynExistential = Self
type Const = Self
fn tcx(&self) -> TyCtxt<'tcx>
fn print_region(self, _region: Region<'_>) -> Result<Self::Region, Self::Error>
fn print_type(self, ty: Ty<'tcx>) -> Result<Self::Type, Self::Error>
fn print_dyn_existential(
self,
predicates: &'tcx List<Binder<'tcx, ExistentialPredicate<'tcx>>>
) -> Result<Self::DynExistential, Self::Error>
fn print_const(self, ct: &'tcx Const<'tcx>) -> Result<Self::Const, Self::Error>
fn path_crate(self, cnum: CrateNum) -> Result<Self::Path, 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_def_path(
self,
def_id: DefId,
substs: &'tcx [GenericArg<'tcx>]
) -> Result<Self::Path, Self::Error>
fn print_impl_path(
self,
impl_def_id: DefId,
substs: &'tcx [GenericArg<'tcx>],
self_ty: &'tcx TyS<'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>]
fn default_print_impl_path(
self,
impl_def_id: DefId,
_substs: &'tcx [GenericArg<'tcx>],
self_ty: &'tcx TyS<'tcx>,
impl_trait_ref: Option<TraitRef<'tcx>>
) -> Result<Self::Path, Self::Error>
Auto Trait Implementations
impl<'tcx> !RefUnwindSafe for SymbolPrinter<'tcx>
impl<'tcx> !Send for SymbolPrinter<'tcx>
impl<'tcx> !Sync for SymbolPrinter<'tcx>
impl<'tcx> Unpin for SymbolPrinter<'tcx>
impl<'tcx> !UnwindSafe for SymbolPrinter<'tcx>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
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: 64 bytes