@@ -55,7 +55,8 @@ pub(super) fn mangle(
5555
5656 let hash = get_symbol_hash ( tcx, instance, instance_ty, instantiating_crate) ;
5757
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
5960 . print_def_path (
6061 def_id,
6162 if let ty:: InstanceDef :: DropGlue ( _, _) = instance. def {
@@ -198,7 +199,7 @@ struct SymbolPrinter<'tcx> {
198199// `PrettyPrinter` aka pretty printing of e.g. types in paths,
199200// symbol names should have their own printing machinery.
200201
201- impl Printer < ' tcx > for SymbolPrinter < ' tcx > {
202+ impl Printer < ' tcx > for & mut SymbolPrinter < ' tcx > {
202203 type Error = fmt:: Error ;
203204
204205 type Path = Self ;
@@ -242,7 +243,7 @@ impl Printer<'tcx> for SymbolPrinter<'tcx> {
242243 Ok ( self )
243244 }
244245
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 > {
246247 // only print integers
247248 if let ty:: ConstKind :: Value ( ConstValue :: Scalar ( Scalar :: Int { .. } ) ) = ct. val {
248249 if ct. ty . is_integral ( ) {
@@ -253,7 +254,7 @@ impl Printer<'tcx> for SymbolPrinter<'tcx> {
253254 Ok ( self )
254255 }
255256
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 > {
257258 self . write_str ( & self . tcx . crate_name ( cnum) . as_str ( ) ) ?;
258259 Ok ( self )
259260 }
@@ -344,7 +345,7 @@ impl Printer<'tcx> for SymbolPrinter<'tcx> {
344345 }
345346}
346347
347- impl PrettyPrinter < ' tcx > for SymbolPrinter < ' tcx > {
348+ impl PrettyPrinter < ' tcx > for & mut SymbolPrinter < ' tcx > {
348349 fn region_should_not_be_omitted ( & self , _region : ty:: Region < ' _ > ) -> bool {
349350 false
350351 }
0 commit comments