Struct rustc_symbol_mangling::v0::SymbolMangler
source · struct SymbolMangler<'tcx> {
tcx: TyCtxt<'tcx>,
binders: Vec<BinderLevel>,
out: String,
start_offset: usize,
paths: FxHashMap<(DefId, &'tcx [GenericArg<'tcx>]), usize>,
types: FxHashMap<Ty<'tcx>, usize>,
consts: FxHashMap<Const<'tcx>, usize>,
}
Fields§
§tcx: TyCtxt<'tcx>
§binders: Vec<BinderLevel>
§out: String
§start_offset: usize
The length of the prefix in out
(e.g. 2 for _R
).
paths: FxHashMap<(DefId, &'tcx [GenericArg<'tcx>]), usize>
The values are start positions in out
, in bytes.
types: FxHashMap<Ty<'tcx>, usize>
§consts: FxHashMap<Const<'tcx>, usize>
Implementations§
source§impl<'tcx> SymbolMangler<'tcx>
impl<'tcx> SymbolMangler<'tcx>
fn push(&mut self, s: &str)
sourcefn push_integer_62(&mut self, x: u64)
fn push_integer_62(&mut self, x: u64)
Push a _
-terminated base 62 integer, using the format
specified in the RFC as <base-62-number>
, that is:
x = 0
is encoded as just the"_"
terminatorx > 0
is encoded asx - 1
in base 62, followed by"_"
, e.g.1
becomes"0_"
,62
becomes"Z_"
, etc.
sourcefn push_opt_integer_62(&mut self, tag: &str, x: u64)
fn push_opt_integer_62(&mut self, tag: &str, x: u64)
Push a tag
-prefixed base 62 integer, when larger than 0
, that is:
x = 0
is encoded as""
(nothing)x > 0
is encoded as thetag
followed bypush_integer_62(x - 1)
e.g.1
becomestag + "_"
,2
becomestag + "0_"
, etc.
fn push_disambiguator(&mut self, dis: u64)
fn push_ident(&mut self, ident: &str)
fn path_append_ns<'a>(
&'a mut self,
print_prefix: impl FnOnce(&'a mut Self) -> Result<&'a mut Self, !>,
ns: char,
disambiguator: u64,
name: &str
) -> Result<&'a mut Self, !>
fn print_backref(&mut self, i: usize) -> Result<&mut Self, !>
fn in_binder<'a, T>(
&'a mut self,
value: &Binder<'tcx, T>,
print_value: impl FnOnce(&'a mut Self, &T) -> Result<&'a mut Self, !>
) -> Result<&'a mut Self, !>where
T: TypeVisitable<'tcx>,
Trait Implementations§
source§impl<'tcx> Printer<'tcx> for &mut SymbolMangler<'tcx>
impl<'tcx> Printer<'tcx> for &mut SymbolMangler<'tcx>
type Error = !
type Path = &mut SymbolMangler<'tcx>
type Region = &mut SymbolMangler<'tcx>
type Type = &mut SymbolMangler<'tcx>
type DynExistential = &mut SymbolMangler<'tcx>
type Const = &mut SymbolMangler<'tcx>
fn tcx(&self) -> TyCtxt<'tcx>
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: Ty<'tcx>,
impl_trait_ref: Option<TraitRef<'tcx>>
) -> Result<Self::Path, Self::Error>
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<PolyExistentialPredicate<'tcx>>
) -> Result<Self::DynExistential, Self::Error>
fn print_const(self, ct: 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,
_: impl FnOnce(Self) -> Result<Self::Path, Self::Error>,
_: &DisambiguatedDefPathData,
_: Ty<'tcx>,
_: 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 default_print_def_path(
self,
def_id: DefId,
substs: &'tcx [GenericArg<'tcx>]
) -> Result<Self::Path, Self::Error>
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>
Auto Trait Implementations§
impl<'tcx> !RefUnwindSafe for SymbolMangler<'tcx>
impl<'tcx> !Send for SymbolMangler<'tcx>
impl<'tcx> !Sync for SymbolMangler<'tcx>
impl<'tcx> Unpin for SymbolMangler<'tcx>
impl<'tcx> !UnwindSafe for SymbolMangler<'tcx>
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: 160 bytes