@@ -19,7 +19,7 @@ use rustc_expand::base::{SyntaxExtension, SyntaxExtensionKind};
1919use rustc_expand:: compile_declarative_macro;
2020use rustc_expand:: expand:: { AstFragment , Invocation , InvocationKind , SupportsMacroExpansion } ;
2121use rustc_feature:: is_builtin_attr_name;
22- use rustc_hir:: def:: { self , DefKind , NonMacroAttrKind } ;
22+ use rustc_hir:: def:: { self , DefKind , Namespace , NonMacroAttrKind } ;
2323use rustc_hir:: def_id:: { CrateNum , LocalDefId } ;
2424use rustc_hir:: PrimTy ;
2525use rustc_middle:: middle:: stability;
@@ -1115,6 +1115,24 @@ impl<'a> Resolver<'a> {
11151115 let msg = format ! ( "cannot find {} `{}` in this scope" , expected, ident) ;
11161116 let mut err = self . session . struct_span_err ( ident. span , & msg) ;
11171117 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+ }
11181136 err. emit ( ) ;
11191137 }
11201138 }
0 commit comments