@@ -85,6 +85,17 @@ impl<'ra> ImportResolutionOutputs<'ra> {
85
85
for ( ns, pending_binding) in import_bindings. into_iter_with ( ) {
86
86
match pending_binding {
87
87
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
+ }
88
99
r. define_binding_local ( parent, * target, ns, binding) ;
89
100
}
90
101
PendingBinding :: Ready ( None ) => {
@@ -105,6 +116,16 @@ impl<'ra> ImportResolutionOutputs<'ra> {
105
116
continue ;
106
117
} ;
107
118
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
+
108
129
module. glob_importers . borrow_mut ( ) . push ( import) ;
109
130
110
131
for ( binding, key, warn_ambiguity) in import_bindings {
@@ -987,17 +1008,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
987
1008
) ;
988
1009
let pending_binding = match binding_result {
989
1010
Ok ( binding) => {
990
- if binding. is_assoc_item ( )
991
- && !this. tcx . features ( ) . import_trait_associated_functions ( )
992
- {
993
- feature_err (
994
- this. tcx . sess ,
995
- sym:: import_trait_associated_functions,
996
- import. span ,
997
- "`use` associated items of traits is unstable" ,
998
- )
999
- . emit ( ) ;
1000
- }
1001
1011
// We need the `target`, `source` can be extracted.
1002
1012
let imported_binding = this. import ( binding, import) ;
1003
1013
PendingBinding :: Ready ( Some ( imported_binding) )
@@ -1579,16 +1589,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
1579
1589
return SideEffectBindings :: None ;
1580
1590
} ;
1581
1591
1582
- if module. is_trait ( ) && !self . tcx . features ( ) . import_trait_associated_functions ( ) {
1583
- feature_err (
1584
- self . tcx . sess ,
1585
- sym:: import_trait_associated_functions,
1586
- import. span ,
1587
- "`use` associated items of traits is unstable" ,
1588
- )
1589
- . emit ( ) ;
1590
- }
1591
-
1592
1592
if module == import. parent_scope . module {
1593
1593
return SideEffectBindings :: None ;
1594
1594
}
0 commit comments