@@ -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 {
@@ -984,17 +1005,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
984
1005
) ;
985
1006
let pending_binding = match binding_result {
986
1007
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
- }
998
1008
// We need the `target`, `source` can be extracted.
999
1009
let imported_binding = this. import ( binding, import) ;
1000
1010
PendingBinding :: Ready ( Some ( imported_binding) )
@@ -1573,16 +1583,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
1573
1583
return SideEffectBindings :: None ;
1574
1584
} ;
1575
1585
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
-
1586
1586
if module == import. parent_scope . module {
1587
1587
return SideEffectBindings :: None ;
1588
1588
}
0 commit comments