@@ -85,6 +85,17 @@ impl<'ra> ImportResolutionOutputs<'ra> {
8585 for ( ns, pending_binding) in import_bindings. into_iter_with ( ) {
8686 match pending_binding {
8787 PendingBinding :: Ready ( Some ( binding) ) => {
88+ if binding. is_assoc_item ( )
89+ && !r. tcx . features ( ) . import_trait_associated_functions ( )
90+ {
91+ feature_err (
92+ r. tcx . sess ,
93+ sym:: import_trait_associated_functions,
94+ import. span ,
95+ "`use` associated items of traits is unstable" ,
96+ )
97+ . emit ( ) ;
98+ }
8899 r. define_binding_local ( parent, * target, ns, binding) ;
89100 }
90101 PendingBinding :: Ready ( None ) => {
@@ -105,6 +116,16 @@ impl<'ra> ImportResolutionOutputs<'ra> {
105116 continue ;
106117 } ;
107118
119+ if module. is_trait ( ) && !r. tcx . features ( ) . import_trait_associated_functions ( ) {
120+ feature_err (
121+ r. tcx . sess ,
122+ sym:: import_trait_associated_functions,
123+ import. span ,
124+ "`use` associated items of traits is unstable" ,
125+ )
126+ . emit ( ) ;
127+ }
128+
108129 module. glob_importers . borrow_mut ( ) . push ( import) ;
109130
110131 for ( binding, key, warn_ambiguity) in import_bindings {
@@ -984,17 +1005,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
9841005 ) ;
9851006 let pending_binding = match binding_result {
9861007 Ok ( binding) => {
987- if binding. is_assoc_item ( )
988- && !this. tcx . features ( ) . import_trait_associated_functions ( )
989- {
990- feature_err (
991- this. tcx . sess ,
992- sym:: import_trait_associated_functions,
993- import. span ,
994- "`use` associated items of traits is unstable" ,
995- )
996- . emit ( ) ;
997- }
9981008 // We need the `target`, `source` can be extracted.
9991009 let imported_binding = this. import ( binding, import) ;
10001010 PendingBinding :: Ready ( Some ( imported_binding) )
@@ -1573,16 +1583,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
15731583 return SideEffectBindings :: None ;
15741584 } ;
15751585
1576- if module. is_trait ( ) && !self . tcx . features ( ) . import_trait_associated_functions ( ) {
1577- feature_err (
1578- self . tcx . sess ,
1579- sym:: import_trait_associated_functions,
1580- import. span ,
1581- "`use` associated items of traits is unstable" ,
1582- )
1583- . emit ( ) ;
1584- }
1585-
15861586 if module == import. parent_scope . module {
15871587 return SideEffectBindings :: None ;
15881588 }
0 commit comments