@@ -59,7 +59,7 @@ use crate::{
59
59
lt_from_placeholder_idx,
60
60
mir:: pad16,
61
61
next_solver:: {
62
- BoundExistentialPredicate , Ctor , DbInterner , GenericArgs , SolverDefId ,
62
+ BoundExistentialPredicate , DbInterner , GenericArgs , SolverDefId ,
63
63
mapping:: {
64
64
ChalkToNextSolver , convert_args_for_result, convert_const_for_result,
65
65
convert_region_for_result, convert_ty_for_result,
@@ -911,14 +911,13 @@ fn render_const_scalar_inner(
911
911
f. write_str ( "&" ) ?;
912
912
render_const_scalar_ns ( f, bytes, memory_map, t)
913
913
}
914
- TyKind :: Adt ( adt, _) if b. len ( ) == 2 * size_of :: < usize > ( ) => match adt. def_id ( ) {
915
- SolverDefId :: AdtId ( hir_def:: AdtId :: StructId ( s) ) => {
914
+ TyKind :: Adt ( adt, _) if b. len ( ) == 2 * size_of :: < usize > ( ) => match adt. def_id ( ) . 0 {
915
+ hir_def:: AdtId :: StructId ( s) => {
916
916
let data = f. db . struct_signature ( s) ;
917
917
write ! ( f, "&{}" , data. name. display( f. db, f. edition( ) ) ) ?;
918
918
Ok ( ( ) )
919
919
}
920
- SolverDefId :: AdtId ( _) => f. write_str ( "<unsized-enum-or-union>" ) ,
921
- _ => unreachable ! ( ) ,
920
+ _ => f. write_str ( "<unsized-enum-or-union>" ) ,
922
921
} ,
923
922
_ => {
924
923
let addr = usize:: from_le_bytes ( match b. try_into ( ) {
@@ -966,10 +965,7 @@ fn render_const_scalar_inner(
966
965
f. write_str ( ")" )
967
966
}
968
967
TyKind :: Adt ( def, args) => {
969
- let def = match def. def_id ( ) {
970
- SolverDefId :: AdtId ( def) => def,
971
- _ => unreachable ! ( ) ,
972
- } ;
968
+ let def = def. def_id ( ) . 0 ;
973
969
let Ok ( layout) = f. db . layout_of_adt ( def, args, trait_env. clone ( ) ) else {
974
970
return f. write_str ( "<layout-error>" ) ;
975
971
} ;
@@ -1300,12 +1296,7 @@ impl<'db> HirDisplay for crate::next_solver::Ty<'db> {
1300
1296
sig. hir_fmt ( f) ?;
1301
1297
}
1302
1298
TyKind :: FnDef ( def, args) => {
1303
- let def = match def {
1304
- SolverDefId :: FunctionId ( id) => CallableDefId :: FunctionId ( id) ,
1305
- SolverDefId :: Ctor ( Ctor :: Enum ( e) ) => CallableDefId :: EnumVariantId ( e) ,
1306
- SolverDefId :: Ctor ( Ctor :: Struct ( s) ) => CallableDefId :: StructId ( s) ,
1307
- _ => unreachable ! ( ) ,
1308
- } ;
1299
+ let def = def. 0 ;
1309
1300
let sig = db
1310
1301
. callable_item_signature ( def)
1311
1302
. substitute ( Interner , & convert_args_for_result ( interner, args. as_slice ( ) ) ) ;
@@ -1406,10 +1397,7 @@ impl<'db> HirDisplay for crate::next_solver::Ty<'db> {
1406
1397
}
1407
1398
}
1408
1399
TyKind :: Adt ( def, parameters) => {
1409
- let def_id = match def. def_id ( ) {
1410
- SolverDefId :: AdtId ( id) => id,
1411
- _ => unreachable ! ( ) ,
1412
- } ;
1400
+ let def_id = def. def_id ( ) . 0 ;
1413
1401
f. start_location_link ( def_id. into ( ) ) ;
1414
1402
match f. display_kind {
1415
1403
DisplayKind :: Diagnostics | DisplayKind :: Test => {
@@ -1448,7 +1436,7 @@ impl<'db> HirDisplay for crate::next_solver::Ty<'db> {
1448
1436
hir_fmt_generics (
1449
1437
f,
1450
1438
convert_args_for_result ( interner, parameters. as_slice ( ) ) . as_slice ( Interner ) ,
1451
- def. def_id ( ) . try_into ( ) . ok ( ) ,
1439
+ Some ( def. def_id ( ) . 0 . into ( ) ) ,
1452
1440
None ,
1453
1441
) ?;
1454
1442
}
@@ -1466,13 +1454,9 @@ impl<'db> HirDisplay for crate::next_solver::Ty<'db> {
1466
1454
1467
1455
projection_ty. hir_fmt ( f) ?;
1468
1456
}
1469
- TyKind :: Foreign ( type_alias) => {
1470
- let alias = match type_alias {
1471
- SolverDefId :: TypeAliasId ( id) => id,
1472
- _ => unreachable ! ( ) ,
1473
- } ;
1474
- let type_alias = db. type_alias_signature ( alias) ;
1475
- f. start_location_link ( alias. into ( ) ) ;
1457
+ TyKind :: Foreign ( alias) => {
1458
+ let type_alias = db. type_alias_signature ( alias. 0 ) ;
1459
+ f. start_location_link ( alias. 0 . into ( ) ) ;
1476
1460
write ! ( f, "{}" , type_alias. name. display( f. db, f. edition( ) ) ) ?;
1477
1461
f. end_location_link ( ) ;
1478
1462
}
@@ -1549,10 +1533,7 @@ impl<'db> HirDisplay for crate::next_solver::Ty<'db> {
1549
1533
}
1550
1534
}
1551
1535
TyKind :: Closure ( id, substs) => {
1552
- let id = match id {
1553
- SolverDefId :: InternedClosureId ( id) => id,
1554
- _ => unreachable ! ( ) ,
1555
- } ;
1536
+ let id = id. 0 ;
1556
1537
let substs = convert_args_for_result ( interner, substs. as_slice ( ) ) ;
1557
1538
if f. display_kind . is_source_code ( ) {
1558
1539
if !f. display_kind . allows_opaque ( ) {
0 commit comments