File tree 3 files changed +16
-8
lines changed
librustc_codegen_utils/symbol_names
3 files changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -198,10 +198,14 @@ impl SymbolMangler<'tcx> {
198
198
199
199
let lifetimes = regions. into_iter ( ) . map ( |br| {
200
200
match br {
201
- ty:: BrAnon ( i) => i + 1 ,
201
+ ty:: BrAnon ( i) => {
202
+ // FIXME(eddyb) for some reason, `anonymize_late_bound_regions` starts at `1`.
203
+ assert_ne ! ( i, 0 ) ;
204
+ i - 1
205
+ } ,
202
206
_ => bug ! ( "symbol_names: non-anonymized region `{:?}` in `{:?}`" , br, value) ,
203
207
}
204
- } ) . max ( ) . unwrap_or ( 0 ) ;
208
+ } ) . max ( ) . map_or ( 0 , |max| max + 1 ) ;
205
209
206
210
self . push_opt_integer_62 ( "G" , lifetimes as u64 ) ;
207
211
lifetime_depths. end += lifetimes;
@@ -297,6 +301,10 @@ impl Printer<'tcx> for SymbolMangler<'tcx> {
297
301
// Late-bound lifetimes use indices starting at 1,
298
302
// see `BinderLevel` for more details.
299
303
ty:: ReLateBound ( debruijn, ty:: BrAnon ( i) ) => {
304
+ // FIXME(eddyb) for some reason, `anonymize_late_bound_regions` starts at `1`.
305
+ assert_ne ! ( i, 0 ) ;
306
+ let i = i - 1 ;
307
+
300
308
let binder = & self . binders [ self . binders . len ( ) - 1 - debruijn. index ( ) ] ;
301
309
let depth = binder. lifetime_depths . start + i;
302
310
Original file line number Diff line number Diff line change @@ -64,9 +64,9 @@ fn main() {
64
64
//[legacy]~^ ERROR symbol-name(_ZN198_$LT$$u5b$$RF$dyn$u20$impl1..Foo$u2b$Assoc$u20$$u3d$$u20$extern$u20$$u22$C$u22$$u20$fn$LP$$RF$u8$RP$$u2b$impl1..AutoTrait$u3b$$u20$_$u5d$$u20$as$u20$impl1..main..$u7b$$u7b$closure$u7d$$u7d$..Bar$GT$6method
65
65
//[legacy]~| ERROR demangling(<[&dyn impl1::Foo+Assoc = extern "C" fn(&u8)+impl1::AutoTrait; _] as impl1::main::{{closure}}::Bar>::method
66
66
//[legacy]~| ERROR demangling-alt(<[&dyn impl1::Foo+Assoc = extern "C" fn(&u8)+impl1::AutoTrait; _] as impl1::main::{{closure}}::Bar>::method)
67
- //[v0]~^^^^ ERROR symbol-name(_RNvXNCNvCs4fqI2P2rA04_5impl14mains_0ARDNtB6_3Foop5AssocFG0_KCRL0_hEuNtB6_9AutoTraitEL_j3_NtB2_3Bar6method )
68
- //[v0]~| ERROR demangling(<[&dyn impl1[317d481089b8c8fe]::Foo<Assoc = for<'a, 'b > extern "C" fn(&'b u8)> + impl1[317d481089b8c8fe]::AutoTrait; 3: usize] as impl1[317d481089b8c8fe]::main::{closure#1}::Bar>::method)
69
- //[v0]~| ERROR demangling-alt(<[&dyn impl1::Foo<Assoc = for<'a, 'b > extern "C" fn(&'b u8)> + impl1::AutoTrait; 3] as impl1::main::{closure#1}::Bar>::method)
67
+ //[v0]~^^^^ ERROR symbol-name(_RNvXNCNvCs4fqI2P2rA04_5impl14mains_0ARDNtB6_3Foop5AssocFG_KCRL0_hEuNtB6_9AutoTraitEL_j3_NtB2_3Bar6method )
68
+ //[v0]~| ERROR demangling(<[&dyn impl1[317d481089b8c8fe]::Foo<Assoc = for<'a> extern "C" fn(&'a u8)> + impl1[317d481089b8c8fe]::AutoTrait; 3: usize] as impl1[317d481089b8c8fe]::main::{closure#1}::Bar>::method)
69
+ //[v0]~| ERROR demangling-alt(<[&dyn impl1::Foo<Assoc = for<'a> extern "C" fn(&'a u8)> + impl1::AutoTrait; 3] as impl1::main::{closure#1}::Bar>::method)
70
70
#[ rustc_def_path]
71
71
//[legacy]~^ ERROR def-path(<[&dyn Foo<Assoc = for<'r> extern "C" fn(&'r u8)> + AutoTrait; _] as main::{{closure}}#1::Bar>::method)
72
72
//[v0]~^^ ERROR def-path(<[&dyn Foo<Assoc = for<'r> extern "C" fn(&'r u8)> + AutoTrait; _] as main::{{closure}}#1::Bar>::method)
Original file line number Diff line number Diff line change @@ -46,19 +46,19 @@ error: def-path(bar::<impl foo::Foo>::baz)
46
46
LL | #[rustc_def_path]
47
47
| ^^^^^^^^^^^^^^^^^
48
48
49
- error: symbol-name(_RNvXNCNvCs4fqI2P2rA04_5impl14mains_0ARDNtB6_3Foop5AssocFG0_KCRL0_hEuNtB6_9AutoTraitEL_j3_NtB2_3Bar6method )
49
+ error: symbol-name(_RNvXNCNvCs4fqI2P2rA04_5impl14mains_0ARDNtB6_3Foop5AssocFG_KCRL0_hEuNtB6_9AutoTraitEL_j3_NtB2_3Bar6method )
50
50
--> $DIR/impl1.rs:63:13
51
51
|
52
52
LL | #[rustc_symbol_name]
53
53
| ^^^^^^^^^^^^^^^^^^^^
54
54
55
- error: demangling(<[&dyn impl1[317d481089b8c8fe]::Foo<Assoc = for<'a, 'b > extern "C" fn(&'b u8)> + impl1[317d481089b8c8fe]::AutoTrait; 3: usize] as impl1[317d481089b8c8fe]::main::{closure#1}::Bar>::method)
55
+ error: demangling(<[&dyn impl1[317d481089b8c8fe]::Foo<Assoc = for<'a> extern "C" fn(&'a u8)> + impl1[317d481089b8c8fe]::AutoTrait; 3: usize] as impl1[317d481089b8c8fe]::main::{closure#1}::Bar>::method)
56
56
--> $DIR/impl1.rs:63:13
57
57
|
58
58
LL | #[rustc_symbol_name]
59
59
| ^^^^^^^^^^^^^^^^^^^^
60
60
61
- error: demangling-alt(<[&dyn impl1::Foo<Assoc = for<'a, 'b > extern "C" fn(&'b u8)> + impl1::AutoTrait; 3] as impl1::main::{closure#1}::Bar>::method)
61
+ error: demangling-alt(<[&dyn impl1::Foo<Assoc = for<'a> extern "C" fn(&'a u8)> + impl1::AutoTrait; 3] as impl1::main::{closure#1}::Bar>::method)
62
62
--> $DIR/impl1.rs:63:13
63
63
|
64
64
LL | #[rustc_symbol_name]
You can’t perform that action at this time.
0 commit comments