@@ -5141,18 +5141,12 @@ pub fn instantiate_path<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
51415141 }
51425142
51435143 Some ( space) => {
5144- let trait_def_id = match def {
5145- def:: DefTrait ( did) => Some ( did) ,
5146- _ => None
5147- } ;
51485144 push_explicit_parameters_from_segment_to_substs ( fcx,
51495145 space,
51505146 path. span ,
51515147 type_defs,
51525148 region_defs,
51535149 segment,
5154- trait_def_id,
5155- path. span ,
51565150 & mut substs) ;
51575151 }
51585152 }
@@ -5239,14 +5233,12 @@ pub fn instantiate_path<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
52395233 type_defs : & VecPerParamSpace < ty:: TypeParameterDef < ' tcx > > ,
52405234 region_defs : & VecPerParamSpace < ty:: RegionParameterDef > ,
52415235 segment : & ast:: PathSegment ,
5242- trait_def_id : Option < DefId > ,
5243- path_span : Span ,
52445236 substs : & mut Substs < ' tcx > )
52455237 {
52465238 match segment. parameters {
52475239 ast:: AngleBracketedParameters ( ref data) => {
52485240 push_explicit_angle_bracketed_parameters_from_segment_to_substs (
5249- fcx, space, type_defs, region_defs, data, trait_def_id , path_span , substs) ;
5241+ fcx, space, type_defs, region_defs, data, substs) ;
52505242 }
52515243
52525244 ast:: ParenthesizedParameters ( ref data) => {
@@ -5262,8 +5254,6 @@ pub fn instantiate_path<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
52625254 type_defs : & VecPerParamSpace < ty:: TypeParameterDef < ' tcx > > ,
52635255 region_defs : & VecPerParamSpace < ty:: RegionParameterDef > ,
52645256 data : & ast:: AngleBracketedParameterData ,
5265- trait_def_id : Option < DefId > ,
5266- path_span : Span ,
52675257 substs : & mut Substs < ' tcx > )
52685258 {
52695259 {
@@ -5285,49 +5275,11 @@ pub fn instantiate_path<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
52855275 }
52865276 }
52875277
5288- if let Some ( trait_def_id) = trait_def_id {
5289- let ref items = fcx. tcx ( ) . trait_item_def_ids . borrow ( ) [ trait_def_id] ;
5290- let mut assoc_tys = Vec :: new ( ) ;
5291- for item in items. iter ( ) {
5292- if let & ty:: ImplOrTraitItemId :: TypeTraitItemId ( id) = item {
5293- if let ty:: ImplOrTraitItem :: TypeTraitItem ( ref ty) =
5294- fcx. tcx ( ) . impl_or_trait_items . borrow ( ) [ id] {
5295- assoc_tys. push ( ty. clone ( ) ) ;
5296- }
5297- }
5298- }
5299-
5300- if data. bindings . len ( ) > assoc_tys. len ( ) {
5301- span_err ! ( fcx. tcx( ) . sess, data. bindings[ assoc_tys. len( ) ] . span, E0174 ,
5302- "too many type equality constraints provided: \
5303- expected at most {} constraint(s), \
5304- found {} constraint(s)",
5305- assoc_tys. len( ) , data. types. len( ) ) ;
5306- substs. types . truncate ( space, 0 ) ;
5307- } else if data. bindings . len ( ) > 0 {
5308- for assoc_ty in assoc_tys. iter ( ) {
5309- let mut matched = false ;
5310- for binding in data. bindings . iter ( ) {
5311- if assoc_ty. name . ident ( ) == binding. ident {
5312- let t = fcx. to_ty ( & * binding. ty ) ;
5313- substs. types . push ( space, t) ;
5314- matched = true ;
5315- break ;
5316- }
5317- }
5318- if !matched {
5319- span_err ! ( fcx. tcx( ) . sess, path_span, E0176 ,
5320- "missing type equality constraint for associated type: {}" ,
5321- assoc_ty. name) ;
5322- substs. types . truncate ( space, 0 ) ;
5323- break ;
5324- }
5325- }
5326- }
5327- } else if data. bindings . len ( ) > 0 {
5328- span_err ! ( fcx. tcx( ) . sess, path_span, E0175 ,
5329- "type equality constraints provided on a non-trait type" ) ;
5330- substs. types . truncate ( space, 0 ) ;
5278+ if data. bindings . len ( ) > 0 {
5279+ span_err ! ( fcx. tcx( ) . sess, data. bindings[ 0 ] . span, E0174 ,
5280+ "unexpected binding of associated item in expression path \
5281+ (only allowed in type paths)") ;
5282+ substs. types . truncate ( subst:: ParamSpace :: AssocSpace , 0 ) ;
53315283 }
53325284
53335285 {
0 commit comments