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( &mut self, print_prefix: impl FnOnce(&mut Self) -> Result<(), PrintError>, ns: char, disambiguator: u64, name: &str ) -> Result<(), PrintError>
fn print_backref(&mut self, i: usize) -> Result<(), PrintError>
fn in_binder<T>(
&mut self,
value: &Binder<'tcx, T>,
print_value: impl FnOnce(&mut Self, &T) -> Result<(), PrintError>
) -> Result<(), PrintError>where
T: TypeVisitable<TyCtxt<'tcx>>,
Trait Implementations§
source§impl<'tcx> Printer<'tcx> for SymbolMangler<'tcx>
impl<'tcx> Printer<'tcx> for SymbolMangler<'tcx>
fn tcx(&self) -> TyCtxt<'tcx>
fn print_def_path( &mut self, def_id: DefId, args: &'tcx [GenericArg<'tcx>] ) -> Result<(), PrintError>
fn print_impl_path( &mut self, impl_def_id: DefId, args: &'tcx [GenericArg<'tcx>], self_ty: Ty<'tcx>, impl_trait_ref: Option<TraitRef<'tcx>> ) -> Result<(), PrintError>
fn print_region(&mut self, region: Region<'_>) -> Result<(), PrintError>
fn print_type(&mut self, ty: Ty<'tcx>) -> Result<(), PrintError>
fn print_dyn_existential( &mut self, predicates: &'tcx List<PolyExistentialPredicate<'tcx>> ) -> Result<(), PrintError>
fn print_const(&mut self, ct: Const<'tcx>) -> Result<(), PrintError>
fn path_crate(&mut self, cnum: CrateNum) -> Result<(), PrintError>
fn path_qualified( &mut self, self_ty: Ty<'tcx>, trait_ref: Option<TraitRef<'tcx>> ) -> Result<(), PrintError>
fn path_append_impl( &mut self, _: impl FnOnce(&mut Self) -> Result<(), PrintError>, _: &DisambiguatedDefPathData, _: Ty<'tcx>, _: Option<TraitRef<'tcx>> ) -> Result<(), PrintError>
fn path_append( &mut self, print_prefix: impl FnOnce(&mut Self) -> Result<(), PrintError>, disambiguated_data: &DisambiguatedDefPathData ) -> Result<(), PrintError>
fn path_generic_args( &mut self, print_prefix: impl FnOnce(&mut Self) -> Result<(), PrintError>, args: &[GenericArg<'tcx>] ) -> Result<(), PrintError>
fn default_print_def_path( &mut self, def_id: DefId, args: &'tcx [GenericArg<'tcx>] ) -> Result<(), Error>
fn default_print_impl_path( &mut self, impl_def_id: DefId, _args: &'tcx [GenericArg<'tcx>], self_ty: Ty<'tcx>, impl_trait_ref: Option<TraitRef<'tcx>> ) -> Result<(), Error>
Auto Trait Implementations§
impl<'tcx> DynSend for SymbolMangler<'tcx>
impl<'tcx> DynSync for SymbolMangler<'tcx>
impl<'tcx> Freeze for SymbolMangler<'tcx>
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§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
§impl<T> Filterable for T
impl<T> Filterable for T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<P> IntoQueryParam<P> for P
impl<P> IntoQueryParam<P> for P
fn into_query_param(self) -> P
source§impl<T> MaybeResult<T> for T
impl<T> MaybeResult<T> for T
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<'tcx, T> ToPredicate<'tcx, T> for T
impl<'tcx, T> ToPredicate<'tcx, T> for T
fn to_predicate(self, _tcx: TyCtxt<'tcx>) -> T
source§impl<Tcx, T> Value<Tcx> for Twhere
Tcx: DepContext,
impl<Tcx, T> Value<Tcx> for Twhere
Tcx: DepContext,
default fn from_cycle_error( tcx: Tcx, cycle_error: &CycleError, _guar: ErrorGuaranteed ) -> T
source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<'a, T> Captures<'a> for Twhere
T: ?Sized,
impl<T> ErasedDestructor for Twhere
T: 'static,
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