File tree Expand file tree Collapse file tree 3 files changed +16
-8
lines changed
librustc_codegen_utils/symbol_names Expand file tree Collapse file tree 3 files changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -198,10 +198,14 @@ impl SymbolMangler<'tcx> {
198198
199199 let lifetimes = regions. into_iter ( ) . map ( |br| {
200200 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+ } ,
202206 _ => bug ! ( "symbol_names: non-anonymized region `{:?}` in `{:?}`" , br, value) ,
203207 }
204- } ) . max ( ) . unwrap_or ( 0 ) ;
208+ } ) . max ( ) . map_or ( 0 , |max| max + 1 ) ;
205209
206210 self . push_opt_integer_62 ( "G" , lifetimes as u64 ) ;
207211 lifetime_depths. end += lifetimes;
@@ -297,6 +301,10 @@ impl Printer<'tcx> for SymbolMangler<'tcx> {
297301 // Late-bound lifetimes use indices starting at 1,
298302 // see `BinderLevel` for more details.
299303 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+
300308 let binder = & self . binders [ self . binders . len ( ) - 1 - debruijn. index ( ) ] ;
301309 let depth = binder. lifetime_depths . start + i;
302310
Original file line number Diff line number Diff line change @@ -64,9 +64,9 @@ fn main() {
6464 //[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
6565 //[legacy]~| ERROR demangling(<[&dyn impl1::Foo+Assoc = extern "C" fn(&u8)+impl1::AutoTrait; _] as impl1::main::{{closure}}::Bar>::method
6666 //[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)
7070 #[ rustc_def_path]
7171 //[legacy]~^ ERROR def-path(<[&dyn Foo<Assoc = for<'r> extern "C" fn(&'r u8)> + AutoTrait; _] as main::{{closure}}#1::Bar>::method)
7272 //[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)
4646LL | #[rustc_def_path]
4747 | ^^^^^^^^^^^^^^^^^
4848
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 )
5050 --> $DIR/impl1.rs:63:13
5151 |
5252LL | #[rustc_symbol_name]
5353 | ^^^^^^^^^^^^^^^^^^^^
5454
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)
5656 --> $DIR/impl1.rs:63:13
5757 |
5858LL | #[rustc_symbol_name]
5959 | ^^^^^^^^^^^^^^^^^^^^
6060
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)
6262 --> $DIR/impl1.rs:63:13
6363 |
6464LL | #[rustc_symbol_name]
You can’t perform that action at this time.
0 commit comments