@@ -72,7 +72,7 @@ use rustc_front::intravisit::{self, FnKind, Visitor};
72
72
use rustc_front:: hir;
73
73
use rustc_front:: hir:: { Arm , BindByRef , BindByValue , BindingMode , Block } ;
74
74
use rustc_front:: hir:: Crate ;
75
- use rustc_front:: hir:: { Expr , ExprAgain , ExprBreak , ExprField } ;
75
+ use rustc_front:: hir:: { Expr , ExprAgain , ExprBreak , ExprCall , ExprField } ;
76
76
use rustc_front:: hir:: { ExprLoop , ExprWhile , ExprMethodCall } ;
77
77
use rustc_front:: hir:: { ExprPath , ExprStruct , FnDecl } ;
78
78
use rustc_front:: hir:: { ForeignItemFn , ForeignItemStatic , Generics } ;
@@ -423,7 +423,7 @@ fn resolve_error<'b, 'a: 'b, 'tcx: 'a>(resolver: &'b Resolver<'a, 'tcx>,
423
423
msg) ;
424
424
425
425
match context {
426
- UnresolvedNameContext :: Other => { } // no help available
426
+ UnresolvedNameContext :: Other => { } // no help available
427
427
UnresolvedNameContext :: PathIsMod ( id) => {
428
428
let mut help_msg = String :: new ( ) ;
429
429
let parent_id = resolver. ast_map . get_parent_node ( id) ;
@@ -436,17 +436,22 @@ fn resolve_error<'b, 'a: 'b, 'tcx: 'a>(resolver: &'b Resolver<'a, 'tcx>,
436
436
module = & * path,
437
437
ident = ident. node) ;
438
438
}
439
-
440
439
ExprMethodCall ( ident, _, _) => {
441
440
help_msg = format ! ( "To call a function from the \
442
441
`{module}` module, use \
443
442
`{module}::{ident}(..)`",
444
443
module = & * path,
445
444
ident = ident. node) ;
446
445
}
447
-
448
- _ => { } // no help available
446
+ ExprCall ( _, _) => {
447
+ help_msg = format ! ( "No function corresponds to `{module}(..)`" ,
448
+ module = & * path) ;
449
+ }
450
+ _ => { } // no help available
449
451
}
452
+ } else {
453
+ help_msg = format ! ( "Module `{module}` cannot be the value of an expression" ,
454
+ module = & * path) ;
450
455
}
451
456
452
457
if !help_msg. is_empty ( ) {
0 commit comments