@@ -926,12 +926,19 @@ impl Clean<Attributes> for [ast::Attribute] {
926
926
// for structs, etc, and the link won't work.
927
927
if let Ok ( path) = resolve ( false ) {
928
928
path. def
929
- } else if let Ok ( _path) = resolve ( true ) {
929
+ } else if let Ok ( path) = resolve ( true ) {
930
+ let kind = match path. def {
931
+ Def :: Variant ( ..) | Def :: VariantCtor ( ..) => ( "variant" , format ! ( "{}()" , path_str) ) ,
932
+ Def :: Fn ( ..) => ( "function" , format ! ( "{}()" , path_str) ) ,
933
+ Def :: Method ( ..) => ( "method" , format ! ( "{}()" , path_str) ) ,
934
+ Def :: Const ( ..) => ( "const" , format ! ( "const@{}" , path_str) ) ,
935
+ Def :: Static ( ..) => ( "static" , format ! ( "static@{}" , path_str) ) ,
936
+ _ => ( "value" , format ! ( "static@{}" , path_str) ) ,
937
+ } ;
930
938
let sp = attrs. doc_strings . first ( ) . map_or ( DUMMY_SP , |a| a. span ( ) ) ;
931
- cx. sess ( ) . struct_span_err ( sp, & format ! ( "could not resolve `{}`" ,
932
- path_str) )
933
- . help ( & format ! ( "try `{0}()`, `static@{0}`, or `const@{0}`" ,
934
- path_str) )
939
+ cx. sess ( ) . struct_span_err ( sp, & format ! ( "could not resolve `{}` as a type, it is a {}" ,
940
+ path_str, kind. 0 ) )
941
+ . help ( & format ! ( "try `{}`" , kind. 1 ) )
935
942
. emit ( ) ;
936
943
continue ;
937
944
} else {
0 commit comments