@@ -620,15 +620,6 @@ enum PointerTy {
620620 Uniq
621621}
622622
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-
632623pub fn trait_ref_for_unboxed_function < ' tcx , AC : AstConv < ' tcx > ,
633624 RS : RegionScope > (
634625 this : & AC ,
@@ -687,31 +678,6 @@ fn mk_pointer<'tcx, AC: AstConv<'tcx>, RS: RegionScope>(
687678 let ty = ast_ty_to_ty ( this, rscope, & * * ty) ;
688679 return constr ( ty:: mk_vec ( tcx, ty, None ) ) ;
689680 }
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- }
715681 ast:: TyPath ( ref path, ref opt_bounds, id) => {
716682 // Note that the "bounds must be empty if path is not a trait"
717683 // 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>(
941907
942908 ty:: mk_closure ( tcx, fn_decl)
943909 }
944- ast:: TyUnboxedFn ( ..) => {
945- tcx. sess . span_err ( ast_ty. span ,
946- "cannot use unboxed functions here" ) ;
947- ty:: mk_err ( )
948- }
949910 ast:: TyPath ( ref path, ref bounds, id) => {
950911 let a_def = match tcx. def_map . borrow ( ) . find ( & id) {
951912 None => {
@@ -1425,8 +1386,7 @@ pub fn conv_existential_bounds<'tcx, AC: AstConv<'tcx>, RS:RegionScope>(
14251386
14261387 let PartitionedBounds { builtin_bounds,
14271388 trait_bounds,
1428- region_bounds,
1429- unboxed_fn_ty_bounds } =
1389+ region_bounds } =
14301390 partition_bounds ( this. tcx ( ) , span, ast_bound_refs. as_slice ( ) ) ;
14311391
14321392 if !trait_bounds. is_empty ( ) {
@@ -1437,13 +1397,6 @@ pub fn conv_existential_bounds<'tcx, AC: AstConv<'tcx>, RS:RegionScope>(
14371397 as closure or object bounds") . as_slice ( ) ) ;
14381398 }
14391399
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-
14471400 // The "main trait refs", rather annoyingly, have no type
14481401 // specified for the `Self` parameter of the trait. The reason for
14491402 // this is that they are, after all, *existential* types, and
@@ -1572,7 +1525,6 @@ fn compute_region_bound<'tcx, AC: AstConv<'tcx>, RS:RegionScope>(
15721525pub struct PartitionedBounds < ' a > {
15731526 pub builtin_bounds : ty:: BuiltinBounds ,
15741527 pub trait_bounds : Vec < & ' a ast:: TraitRef > ,
1575- pub unboxed_fn_ty_bounds : Vec < & ' a ast:: UnboxedFnBound > ,
15761528 pub region_bounds : Vec < & ' a ast:: Lifetime > ,
15771529}
15781530
@@ -1590,7 +1542,6 @@ pub fn partition_bounds<'a>(tcx: &ty::ctxt,
15901542 let mut builtin_bounds = ty:: empty_builtin_bounds ( ) ;
15911543 let mut region_bounds = Vec :: new ( ) ;
15921544 let mut trait_bounds = Vec :: new ( ) ;
1593- let mut unboxed_fn_ty_bounds = Vec :: new ( ) ;
15941545 let mut trait_def_ids = HashMap :: new ( ) ;
15951546 for & ast_bound in ast_bounds. iter ( ) {
15961547 match * ast_bound {
@@ -1635,17 +1586,13 @@ pub fn partition_bounds<'a>(tcx: &ty::ctxt,
16351586 ast:: RegionTyParamBound ( ref l) => {
16361587 region_bounds. push ( l) ;
16371588 }
1638- ast:: UnboxedFnTyParamBound ( ref unboxed_function) => {
1639- unboxed_fn_ty_bounds. push ( & * * unboxed_function) ;
1640- }
16411589 }
16421590 }
16431591
16441592 PartitionedBounds {
16451593 builtin_bounds : builtin_bounds,
16461594 trait_bounds : trait_bounds,
16471595 region_bounds : region_bounds,
1648- unboxed_fn_ty_bounds : unboxed_fn_ty_bounds
16491596 }
16501597}
16511598
0 commit comments