@@ -1152,6 +1152,21 @@ impl<'a, 'b, 's> Printer<'a, 'b, 's> {
11521152 self . print_const ( true ) ?;
11531153 }
11541154 }
1155+ b'A' => {
1156+ open_brace_if_outside_expr ( self ) ?;
1157+ self . print ( "[" ) ?;
1158+ self . print_sep_list ( |this| this. print_const ( true ) , ", " ) ?;
1159+ self . print ( "]" ) ?;
1160+ }
1161+ b'T' => {
1162+ open_brace_if_outside_expr ( self ) ?;
1163+ self . print ( "(" ) ?;
1164+ let count = self . print_sep_list ( |this| this. print_const ( true ) , ", " ) ?;
1165+ if count == 1 {
1166+ self . print ( "," ) ?;
1167+ }
1168+ self . print ( ")" ) ?;
1169+ }
11551170 b'B' => {
11561171 self . print_backref ( |this| this. print_const ( in_value) ) ?;
11571172 }
@@ -1340,6 +1355,27 @@ mod tests {
13401355 t_const ! ( "Rc58_" , "{&'X'}" ) ;
13411356 t_const ! ( "RRRh0_" , "{&&&0}" ) ;
13421357 t_const ! ( "RRRe_" , "{&&\" \" }" ) ;
1358+ t_const ! ( "QAE" , "{&mut []}" ) ;
1359+ }
1360+
1361+ #[ test]
1362+ fn demangle_const_array ( ) {
1363+ t_const ! ( "AE" , "{[]}" ) ;
1364+ t_const ! ( "Aj0_E" , "{[0]}" ) ;
1365+ t_const ! ( "Ah1_h2_h3_E" , "{[1, 2, 3]}" ) ;
1366+ t_const ! ( "ARe61_Re62_Re63_E" , "{[\" a\" , \" b\" , \" c\" ]}" ) ;
1367+ t_const ! ( "AAh1_h2_EAh3_h4_EE" , "{[[1, 2], [3, 4]]}" ) ;
1368+ }
1369+
1370+ #[ test]
1371+ fn demangle_const_tuple ( ) {
1372+ t_const ! ( "TE" , "{()}" ) ;
1373+ t_const ! ( "Tj0_E" , "{(0,)}" ) ;
1374+ t_const ! ( "Th1_b0_E" , "{(1, false)}" ) ;
1375+ t_const ! (
1376+ "TRe616263_c78_RAh1_h2_h3_EE" ,
1377+ "{(\" abc\" , 'x', &[1, 2, 3])}"
1378+ ) ;
13431379 }
13441380
13451381 #[ test]
0 commit comments