@@ -3342,9 +3342,8 @@ impl<'a> Resolver<'a> {
33423342 // This is not a crate-relative path. We resolve the
33433343 // first component of the path in the current lexical
33443344 // scope and then proceed to resolve below that.
3345- match self . resolve_module_in_lexical_scope (
3346- module_,
3347- module_path[ 0 ] ) {
3345+ match self . resolve_module_in_lexical_scope ( module_,
3346+ module_path[ 0 ] ) {
33483347 Failed ( err) => return Failed ( err) ,
33493348 Indeterminate => {
33503349 debug ! ( "(resolving module path for import) \
@@ -4525,25 +4524,42 @@ impl<'a> Resolver<'a> {
45254524
45264525 fn resolve_where_clause ( & mut self , where_clause : & ast:: WhereClause ) {
45274526 for predicate in where_clause. predicates . iter ( ) {
4528- match self . resolve_identifier ( predicate. ident ,
4529- TypeNS ,
4530- true ,
4531- predicate. span ) {
4532- Some ( ( def @ DefTyParam ( _, _, _) , last_private) ) => {
4533- self . record_def ( predicate. id , ( def, last_private) ) ;
4534- }
4535- _ => {
4536- self . resolve_error (
4537- predicate. span ,
4538- format ! ( "undeclared type parameter `{}`" ,
4539- token:: get_ident(
4540- predicate. ident) ) . as_slice ( ) ) ;
4527+ match predicate {
4528+ & ast:: BoundPredicate ( ref bound_pred) => {
4529+ match self . resolve_identifier ( bound_pred. ident ,
4530+ TypeNS ,
4531+ true ,
4532+ bound_pred. span ) {
4533+ Some ( ( def @ DefTyParam ( ..) , last_private) ) => {
4534+ self . record_def ( bound_pred. id , ( def, last_private) ) ;
4535+ }
4536+ _ => {
4537+ self . resolve_error (
4538+ bound_pred. span ,
4539+ format ! ( "undeclared type parameter `{}`" ,
4540+ token:: get_ident(
4541+ bound_pred. ident) ) . as_slice ( ) ) ;
4542+ }
4543+ }
4544+
4545+ for bound in bound_pred. bounds . iter ( ) {
4546+ self . resolve_type_parameter_bound ( bound_pred. id , bound,
4547+ TraitBoundingTypeParameter ) ;
4548+ }
45414549 }
4542- }
4550+ & ast:: EqPredicate ( ref eq_pred) => {
4551+ match self . resolve_path ( eq_pred. id , & eq_pred. path , TypeNS , true ) {
4552+ Some ( ( def @ DefTyParam ( ..) , last_private) ) => {
4553+ self . record_def ( eq_pred. id , ( def, last_private) ) ;
4554+ }
4555+ _ => {
4556+ self . resolve_error ( eq_pred. path . span ,
4557+ "undeclared associated type" ) ;
4558+ }
4559+ }
45434560
4544- for bound in predicate. bounds . iter ( ) {
4545- self . resolve_type_parameter_bound ( predicate. id , bound,
4546- TraitBoundingTypeParameter ) ;
4561+ self . resolve_type ( & * eq_pred. ty ) ;
4562+ }
45474563 }
45484564 }
45494565 }
@@ -5204,15 +5220,19 @@ impl<'a> Resolver<'a> {
52045220 path : & Path ,
52055221 namespace : Namespace ,
52065222 check_ribs : bool ) -> Option < ( Def , LastPrivate ) > {
5207- // First, resolve the types.
5223+ // First, resolve the types and associated type bindings .
52085224 for ty in path. segments . iter ( ) . flat_map ( |s| s. parameters . types ( ) . into_iter ( ) ) {
52095225 self . resolve_type ( & * * ty) ;
52105226 }
5227+ for binding in path. segments . iter ( ) . flat_map ( |s| s. parameters . bindings ( ) . into_iter ( ) ) {
5228+ self . resolve_type ( & * binding. ty ) ;
5229+ }
52115230
52125231 if path. global {
52135232 return self . resolve_crate_relative_path ( path, namespace) ;
52145233 }
52155234
5235+ // Try to find a path to an item in a module.
52165236 let unqualified_def =
52175237 self . resolve_identifier ( path. segments
52185238 . last ( ) . unwrap ( )
0 commit comments