@@ -1370,7 +1370,14 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
1370
1370
}
1371
1371
// FIXME: check the values
1372
1372
}
1373
- TerminatorKind :: Call { func, args, destination, call_source, target, .. } => {
1373
+ TerminatorKind :: Call { func, args, .. }
1374
+ | TerminatorKind :: TailCall { func, args, .. } => {
1375
+ let call_source = match term. kind {
1376
+ TerminatorKind :: Call { call_source, .. } => call_source,
1377
+ TerminatorKind :: TailCall { .. } => CallSource :: Normal ,
1378
+ _ => unreachable ! ( ) ,
1379
+ } ;
1380
+
1374
1381
self . check_operand ( func, term_location) ;
1375
1382
for arg in args {
1376
1383
self . check_operand ( arg, term_location) ;
@@ -1428,7 +1435,10 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
1428
1435
ConstraintCategory :: Boring ,
1429
1436
) ;
1430
1437
let sig = self . normalize ( sig, term_location) ;
1431
- self . check_call_dest ( body, term, & sig, * destination, * target, term_location) ;
1438
+
1439
+ if let TerminatorKind :: Call { destination, target, .. } = term. kind {
1440
+ self . check_call_dest ( body, term, & sig, destination, target, term_location) ;
1441
+ }
1432
1442
1433
1443
// The ordinary liveness rules will ensure that all
1434
1444
// regions in the type of the callee are live here. We
@@ -1446,7 +1456,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
1446
1456
. add_element ( region_vid, term_location) ;
1447
1457
}
1448
1458
1449
- self . check_call_inputs ( body, term, & sig, args, term_location, * call_source) ;
1459
+ self . check_call_inputs ( body, term, & sig, args, term_location, call_source) ;
1450
1460
}
1451
1461
TerminatorKind :: Assert { cond, msg, .. } => {
1452
1462
self . check_operand ( cond, term_location) ;
@@ -1639,6 +1649,11 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
1639
1649
span_mirbug ! ( self , block_data, "return on cleanup block" )
1640
1650
}
1641
1651
}
1652
+ TerminatorKind :: TailCall { .. } => {
1653
+ if is_cleanup {
1654
+ span_mirbug ! ( self , block_data, "tailcall on cleanup block" )
1655
+ }
1656
+ }
1642
1657
TerminatorKind :: GeneratorDrop { .. } => {
1643
1658
if is_cleanup {
1644
1659
span_mirbug ! ( self , block_data, "generator_drop in cleanup block" )
0 commit comments