@@ -19,7 +19,7 @@ use rustc_expand::base::{SyntaxExtension, SyntaxExtensionKind};
19
19
use rustc_expand:: compile_declarative_macro;
20
20
use rustc_expand:: expand:: { AstFragment , Invocation , InvocationKind , SupportsMacroExpansion } ;
21
21
use rustc_feature:: is_builtin_attr_name;
22
- use rustc_hir:: def:: { self , DefKind , NonMacroAttrKind } ;
22
+ use rustc_hir:: def:: { self , DefKind , Namespace , NonMacroAttrKind } ;
23
23
use rustc_hir:: def_id:: { CrateNum , LocalDefId } ;
24
24
use rustc_hir:: PrimTy ;
25
25
use rustc_middle:: middle:: stability;
@@ -1115,6 +1115,24 @@ impl<'a> Resolver<'a> {
1115
1115
let msg = format ! ( "cannot find {} `{}` in this scope" , expected, ident) ;
1116
1116
let mut err = self . session . struct_span_err ( ident. span , & msg) ;
1117
1117
self . unresolved_macro_suggestions ( & mut err, kind, & parent_scope, ident) ;
1118
+ if let Ok ( binding) = self . early_resolve_ident_in_lexical_scope (
1119
+ ident,
1120
+ ScopeSet :: All ( Namespace :: TypeNS , false ) ,
1121
+ & parent_scope,
1122
+ false ,
1123
+ false ,
1124
+ ident. span ,
1125
+ ) {
1126
+ if let crate :: NameBindingKind :: Import { import, .. } = binding. kind {
1127
+ err. span_note (
1128
+ import. span ,
1129
+ & format ! (
1130
+ "`{}` is imported here, but it is not a {}" ,
1131
+ ident, expected
1132
+ ) ,
1133
+ ) ;
1134
+ }
1135
+ }
1118
1136
err. emit ( ) ;
1119
1137
}
1120
1138
}
0 commit comments