4848//! case but `&a` in the second. Basically, defaults that appear inside
4949//! an rptr (`&r.T`) use the region `r` that appears in the rptr.
5050
51- use middle:: astconv_util:: { prim_ty_to_ty, check_path_args , NO_TPS , NO_REGIONS } ;
51+ use middle:: astconv_util:: { prim_ty_to_ty, prohibit_type_params , prohibit_projection } ;
5252use middle:: const_eval:: { self , ConstVal } ;
5353use middle:: const_eval:: EvalHint :: UncheckedExprHint ;
5454use middle:: def;
@@ -1210,7 +1210,7 @@ fn associated_path_def_to_ty<'tcx>(this: &AstConv<'tcx>,
12101210
12111211 debug ! ( "associated_path_def_to_ty: {:?}::{}" , ty, assoc_name) ;
12121212
1213- check_path_args ( tcx, slice:: ref_slice ( item_segment) , NO_TPS | NO_REGIONS ) ;
1213+ prohibit_type_params ( tcx, slice:: ref_slice ( item_segment) ) ;
12141214
12151215 // Find the type of the associated item, and the trait where the associated
12161216 // item is declared.
@@ -1312,7 +1312,7 @@ fn qpath_to_ty<'tcx>(this: &AstConv<'tcx>,
13121312{
13131313 let tcx = this. tcx ( ) ;
13141314
1315- check_path_args ( tcx, slice:: ref_slice ( item_segment) , NO_TPS | NO_REGIONS ) ;
1315+ prohibit_type_params ( tcx, slice:: ref_slice ( item_segment) ) ;
13161316
13171317 let self_ty = if let Some ( ty) = opt_self_ty {
13181318 ty
@@ -1401,7 +1401,7 @@ fn base_def_to_ty<'tcx>(this: &AstConv<'tcx>,
14011401 base_segments. last ( ) . unwrap ( ) ,
14021402 & mut projection_bounds) ;
14031403
1404- check_path_args ( tcx, base_segments. split_last ( ) . unwrap ( ) . 1 , NO_TPS | NO_REGIONS ) ;
1404+ prohibit_type_params ( tcx, base_segments. split_last ( ) . unwrap ( ) . 1 ) ;
14051405 trait_ref_to_object_type ( this,
14061406 rscope,
14071407 span,
@@ -1410,7 +1410,7 @@ fn base_def_to_ty<'tcx>(this: &AstConv<'tcx>,
14101410 & [ ] )
14111411 }
14121412 def:: DefTy ( did, _) | def:: DefStruct ( did) => {
1413- check_path_args ( tcx, base_segments. split_last ( ) . unwrap ( ) . 1 , NO_TPS | NO_REGIONS ) ;
1413+ prohibit_type_params ( tcx, base_segments. split_last ( ) . unwrap ( ) . 1 ) ;
14141414 ast_path_to_ty ( this,
14151415 rscope,
14161416 span,
@@ -1419,12 +1419,12 @@ fn base_def_to_ty<'tcx>(this: &AstConv<'tcx>,
14191419 base_segments. last ( ) . unwrap ( ) )
14201420 }
14211421 def:: DefTyParam ( space, index, _, name) => {
1422- check_path_args ( tcx, base_segments, NO_TPS | NO_REGIONS ) ;
1422+ prohibit_type_params ( tcx, base_segments) ;
14231423 tcx. mk_param ( space, index, name)
14241424 }
14251425 def:: DefSelfTy ( _, Some ( ( _, self_ty_id) ) ) => {
14261426 // Self in impl (we know the concrete type).
1427- check_path_args ( tcx, base_segments, NO_TPS | NO_REGIONS ) ;
1427+ prohibit_type_params ( tcx, base_segments) ;
14281428 if let Some ( & ty) = tcx. ast_ty_to_ty_cache . borrow ( ) . get ( & self_ty_id) {
14291429 if let Some ( free_substs) = this. get_free_substs ( ) {
14301430 ty. subst ( tcx, free_substs)
@@ -1437,11 +1437,11 @@ fn base_def_to_ty<'tcx>(this: &AstConv<'tcx>,
14371437 }
14381438 def:: DefSelfTy ( Some ( _) , None ) => {
14391439 // Self in trait.
1440- check_path_args ( tcx, base_segments, NO_TPS | NO_REGIONS ) ;
1440+ prohibit_type_params ( tcx, base_segments) ;
14411441 tcx. mk_self_type ( )
14421442 }
14431443 def:: DefAssociatedTy ( trait_did, _) => {
1444- check_path_args ( tcx, & base_segments[ ..base_segments. len ( ) -2 ] , NO_TPS | NO_REGIONS ) ;
1444+ prohibit_type_params ( tcx, & base_segments[ ..base_segments. len ( ) -2 ] ) ;
14451445 qpath_to_ty ( this,
14461446 rscope,
14471447 span,
@@ -2185,8 +2185,7 @@ fn prohibit_projections<'tcx>(tcx: &ty::ctxt<'tcx>,
21852185 bindings : & [ ConvertedBinding < ' tcx > ] )
21862186{
21872187 for binding in bindings. iter ( ) . take ( 1 ) {
2188- span_err ! ( tcx. sess, binding. span, E0229 ,
2189- "associated type bindings are not allowed here" ) ;
2188+ prohibit_projection ( tcx, binding. span ) ;
21902189 }
21912190}
21922191
0 commit comments