@@ -620,15 +620,6 @@ enum PointerTy {
620
620
Uniq
621
621
}
622
622
623
- impl PointerTy {
624
- fn default_region ( & self ) -> ty:: Region {
625
- match * self {
626
- Uniq => ty:: ReStatic ,
627
- RPtr ( r) => r,
628
- }
629
- }
630
- }
631
-
632
623
pub fn trait_ref_for_unboxed_function < ' tcx , AC : AstConv < ' tcx > ,
633
624
RS : RegionScope > (
634
625
this : & AC ,
@@ -687,31 +678,6 @@ fn mk_pointer<'tcx, AC: AstConv<'tcx>, RS: RegionScope>(
687
678
let ty = ast_ty_to_ty ( this, rscope, & * * ty) ;
688
679
return constr ( ty:: mk_vec ( tcx, ty, None ) ) ;
689
680
}
690
- ast:: TyUnboxedFn ( ref unboxed_function) => {
691
- let ty:: TraitRef {
692
- def_id,
693
- substs
694
- } = trait_ref_for_unboxed_function ( this,
695
- rscope,
696
- unboxed_function. kind ,
697
- & * unboxed_function. decl ,
698
- None ) ;
699
- let r = ptr_ty. default_region ( ) ;
700
- let tr = ty:: mk_trait ( this. tcx ( ) ,
701
- def_id,
702
- substs,
703
- ty:: region_existential_bound ( r) ) ;
704
- match ptr_ty {
705
- Uniq => {
706
- return ty:: mk_uniq ( this. tcx ( ) , tr) ;
707
- }
708
- RPtr ( r) => {
709
- return ty:: mk_rptr ( this. tcx ( ) ,
710
- r,
711
- ty:: mt { mutbl : a_seq_mutbl, ty : tr} ) ;
712
- }
713
- }
714
- }
715
681
ast:: TyPath ( ref path, ref opt_bounds, id) => {
716
682
// Note that the "bounds must be empty if path is not a trait"
717
683
// restriction is enforced in the below case for ty_path, which
@@ -941,11 +907,6 @@ pub fn ast_ty_to_ty<'tcx, AC: AstConv<'tcx>, RS: RegionScope>(
941
907
942
908
ty:: mk_closure ( tcx, fn_decl)
943
909
}
944
- ast:: TyUnboxedFn ( ..) => {
945
- tcx. sess . span_err ( ast_ty. span ,
946
- "cannot use unboxed functions here" ) ;
947
- ty:: mk_err ( )
948
- }
949
910
ast:: TyPath ( ref path, ref bounds, id) => {
950
911
let a_def = match tcx. def_map . borrow ( ) . find ( & id) {
951
912
None => {
@@ -1425,8 +1386,7 @@ pub fn conv_existential_bounds<'tcx, AC: AstConv<'tcx>, RS:RegionScope>(
1425
1386
1426
1387
let PartitionedBounds { builtin_bounds,
1427
1388
trait_bounds,
1428
- region_bounds,
1429
- unboxed_fn_ty_bounds } =
1389
+ region_bounds } =
1430
1390
partition_bounds ( this. tcx ( ) , span, ast_bound_refs. as_slice ( ) ) ;
1431
1391
1432
1392
if !trait_bounds. is_empty ( ) {
@@ -1437,13 +1397,6 @@ pub fn conv_existential_bounds<'tcx, AC: AstConv<'tcx>, RS:RegionScope>(
1437
1397
as closure or object bounds") . as_slice ( ) ) ;
1438
1398
}
1439
1399
1440
- if !unboxed_fn_ty_bounds. is_empty ( ) {
1441
- this. tcx ( ) . sess . span_err (
1442
- span,
1443
- format ! ( "only the builtin traits can be used \
1444
- as closure or object bounds") . as_slice ( ) ) ;
1445
- }
1446
-
1447
1400
// The "main trait refs", rather annoyingly, have no type
1448
1401
// specified for the `Self` parameter of the trait. The reason for
1449
1402
// this is that they are, after all, *existential* types, and
@@ -1572,7 +1525,6 @@ fn compute_region_bound<'tcx, AC: AstConv<'tcx>, RS:RegionScope>(
1572
1525
pub struct PartitionedBounds < ' a > {
1573
1526
pub builtin_bounds : ty:: BuiltinBounds ,
1574
1527
pub trait_bounds : Vec < & ' a ast:: TraitRef > ,
1575
- pub unboxed_fn_ty_bounds : Vec < & ' a ast:: UnboxedFnBound > ,
1576
1528
pub region_bounds : Vec < & ' a ast:: Lifetime > ,
1577
1529
}
1578
1530
@@ -1590,7 +1542,6 @@ pub fn partition_bounds<'a>(tcx: &ty::ctxt,
1590
1542
let mut builtin_bounds = ty:: empty_builtin_bounds ( ) ;
1591
1543
let mut region_bounds = Vec :: new ( ) ;
1592
1544
let mut trait_bounds = Vec :: new ( ) ;
1593
- let mut unboxed_fn_ty_bounds = Vec :: new ( ) ;
1594
1545
let mut trait_def_ids = HashMap :: new ( ) ;
1595
1546
for & ast_bound in ast_bounds. iter ( ) {
1596
1547
match * ast_bound {
@@ -1635,17 +1586,13 @@ pub fn partition_bounds<'a>(tcx: &ty::ctxt,
1635
1586
ast:: RegionTyParamBound ( ref l) => {
1636
1587
region_bounds. push ( l) ;
1637
1588
}
1638
- ast:: UnboxedFnTyParamBound ( ref unboxed_function) => {
1639
- unboxed_fn_ty_bounds. push ( & * * unboxed_function) ;
1640
- }
1641
1589
}
1642
1590
}
1643
1591
1644
1592
PartitionedBounds {
1645
1593
builtin_bounds : builtin_bounds,
1646
1594
trait_bounds : trait_bounds,
1647
1595
region_bounds : region_bounds,
1648
- unboxed_fn_ty_bounds : unboxed_fn_ty_bounds
1649
1596
}
1650
1597
}
1651
1598
0 commit comments