@@ -23,7 +23,7 @@ pub(super) fn mangle(
23
23
let substs = tcx. normalize_erasing_regions ( ty:: ParamEnv :: reveal_all ( ) , instance. substs ) ;
24
24
25
25
let prefix = "_R" ;
26
- let mut cx = SymbolMangler {
26
+ let mut cx = & mut SymbolMangler {
27
27
tcx,
28
28
start_offset : prefix. len ( ) ,
29
29
paths : FxHashMap :: default ( ) ,
@@ -49,7 +49,7 @@ pub(super) fn mangle(
49
49
if let Some ( instantiating_crate) = instantiating_crate {
50
50
cx = cx. print_def_path ( instantiating_crate. as_def_id ( ) , & [ ] ) . unwrap ( ) ;
51
51
}
52
- cx. out
52
+ std :: mem :: take ( & mut cx. out )
53
53
}
54
54
55
55
struct BinderLevel {
@@ -153,13 +153,13 @@ impl SymbolMangler<'tcx> {
153
153
self . push ( ident) ;
154
154
}
155
155
156
- fn path_append_ns (
157
- mut self ,
158
- print_prefix : impl FnOnce ( Self ) -> Result < Self , !> ,
156
+ fn path_append_ns < ' a > (
157
+ mut self : & ' a mut Self ,
158
+ print_prefix : impl FnOnce ( & ' a mut Self ) -> Result < & ' a mut Self , !> ,
159
159
ns : char ,
160
160
disambiguator : u64 ,
161
161
name : & str ,
162
- ) -> Result < Self , !> {
162
+ ) -> Result < & ' a mut Self , !> {
163
163
self . push ( "N" ) ;
164
164
self . out . push ( ns) ;
165
165
self = print_prefix ( self ) ?;
@@ -168,17 +168,17 @@ impl SymbolMangler<'tcx> {
168
168
Ok ( self )
169
169
}
170
170
171
- fn print_backref ( mut self , i : usize ) -> Result < Self , !> {
171
+ fn print_backref ( & mut self , i : usize ) -> Result < & mut Self , !> {
172
172
self . push ( "B" ) ;
173
173
self . push_integer_62 ( ( i - self . start_offset ) as u64 ) ;
174
174
Ok ( self )
175
175
}
176
176
177
- fn in_binder < T > (
178
- mut self ,
177
+ fn in_binder < ' a , T > (
178
+ mut self : & ' a mut Self ,
179
179
value : & ty:: Binder < ' tcx , T > ,
180
- print_value : impl FnOnce ( Self , & T ) -> Result < Self , !> ,
181
- ) -> Result < Self , !>
180
+ print_value : impl FnOnce ( & ' a mut Self , & T ) -> Result < & ' a mut Self , !> ,
181
+ ) -> Result < & ' a mut Self , !>
182
182
where
183
183
T : TypeFoldable < ' tcx > ,
184
184
{
@@ -211,7 +211,7 @@ impl SymbolMangler<'tcx> {
211
211
}
212
212
}
213
213
214
- impl Printer < ' tcx > for SymbolMangler < ' tcx > {
214
+ impl Printer < ' tcx > for & mut SymbolMangler < ' tcx > {
215
215
type Error = !;
216
216
217
217
type Path = Self ;
@@ -303,7 +303,7 @@ impl Printer<'tcx> for SymbolMangler<'tcx> {
303
303
Ok ( self )
304
304
}
305
305
306
- fn print_region ( mut self , region : ty:: Region < ' _ > ) -> Result < Self :: Region , Self :: Error > {
306
+ fn print_region ( self , region : ty:: Region < ' _ > ) -> Result < Self :: Region , Self :: Error > {
307
307
let i = match * region {
308
308
// Erased lifetimes use the index 0, for a
309
309
// shorter mangling of `L_`.
@@ -577,7 +577,7 @@ impl Printer<'tcx> for SymbolMangler<'tcx> {
577
577
Ok ( self )
578
578
}
579
579
580
- fn path_crate ( mut self , cnum : CrateNum ) -> Result < Self :: Path , Self :: Error > {
580
+ fn path_crate ( self , cnum : CrateNum ) -> Result < Self :: Path , Self :: Error > {
581
581
self . push ( "C" ) ;
582
582
let stable_crate_id = self . tcx . def_path_hash ( cnum. as_def_id ( ) ) . stable_crate_id ( ) ;
583
583
self . push_disambiguator ( stable_crate_id. to_u64 ( ) ) ;
0 commit comments