@@ -55,7 +55,8 @@ pub(super) fn mangle(
55
55
56
56
let hash = get_symbol_hash ( tcx, instance, instance_ty, instantiating_crate) ;
57
57
58
- let mut printer = SymbolPrinter { tcx, path : SymbolPath :: new ( ) , keep_within_component : false }
58
+ let mut printer = SymbolPrinter { tcx, path : SymbolPath :: new ( ) , keep_within_component : false } ;
59
+ printer
59
60
. print_def_path (
60
61
def_id,
61
62
if let ty:: InstanceDef :: DropGlue ( _, _) = instance. def {
@@ -198,7 +199,7 @@ struct SymbolPrinter<'tcx> {
198
199
// `PrettyPrinter` aka pretty printing of e.g. types in paths,
199
200
// symbol names should have their own printing machinery.
200
201
201
- impl Printer < ' tcx > for SymbolPrinter < ' tcx > {
202
+ impl Printer < ' tcx > for & mut SymbolPrinter < ' tcx > {
202
203
type Error = fmt:: Error ;
203
204
204
205
type Path = Self ;
@@ -242,7 +243,7 @@ impl Printer<'tcx> for SymbolPrinter<'tcx> {
242
243
Ok ( self )
243
244
}
244
245
245
- fn print_const ( mut self , ct : & ' tcx ty:: Const < ' tcx > ) -> Result < Self :: Const , Self :: Error > {
246
+ fn print_const ( self , ct : & ' tcx ty:: Const < ' tcx > ) -> Result < Self :: Const , Self :: Error > {
246
247
// only print integers
247
248
if let ty:: ConstKind :: Value ( ConstValue :: Scalar ( Scalar :: Int { .. } ) ) = ct. val {
248
249
if ct. ty . is_integral ( ) {
@@ -253,7 +254,7 @@ impl Printer<'tcx> for SymbolPrinter<'tcx> {
253
254
Ok ( self )
254
255
}
255
256
256
- fn path_crate ( mut self , cnum : CrateNum ) -> Result < Self :: Path , Self :: Error > {
257
+ fn path_crate ( self , cnum : CrateNum ) -> Result < Self :: Path , Self :: Error > {
257
258
self . write_str ( & self . tcx . crate_name ( cnum) . as_str ( ) ) ?;
258
259
Ok ( self )
259
260
}
@@ -344,7 +345,7 @@ impl Printer<'tcx> for SymbolPrinter<'tcx> {
344
345
}
345
346
}
346
347
347
- impl PrettyPrinter < ' tcx > for SymbolPrinter < ' tcx > {
348
+ impl PrettyPrinter < ' tcx > for & mut SymbolPrinter < ' tcx > {
348
349
fn region_should_not_be_omitted ( & self , _region : ty:: Region < ' _ > ) -> bool {
349
350
false
350
351
}
0 commit comments