@@ -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 } ;
@@ -433,7 +433,7 @@ fn resolve_struct_error<'b, 'a: 'b, 'tcx: 'a>(resolver: &'b Resolver<'a, 'tcx>,
433
433
msg) ;
434
434
435
435
match context {
436
- UnresolvedNameContext :: Other => { } // no help available
436
+ UnresolvedNameContext :: Other => { } // no help available
437
437
UnresolvedNameContext :: PathIsMod ( id) => {
438
438
let mut help_msg = String :: new ( ) ;
439
439
let parent_id = resolver. ast_map . get_parent_node ( id) ;
@@ -446,17 +446,22 @@ fn resolve_struct_error<'b, 'a: 'b, 'tcx: 'a>(resolver: &'b Resolver<'a, 'tcx>,
446
446
module = & * path,
447
447
ident = ident. node) ;
448
448
}
449
-
450
449
ExprMethodCall ( ident, _, _) => {
451
450
help_msg = format ! ( "To call a function from the \
452
451
`{module}` module, use \
453
452
`{module}::{ident}(..)`",
454
453
module = & * path,
455
454
ident = ident. node) ;
456
455
}
457
-
458
- _ => { } // no help available
456
+ ExprCall ( _, _) => {
457
+ help_msg = format ! ( "No function corresponds to `{module}(..)`" ,
458
+ module = & * path) ;
459
+ }
460
+ _ => { } // no help available
459
461
}
462
+ } else {
463
+ help_msg = format ! ( "Module `{module}` cannot be the value of an expression" ,
464
+ module = & * path) ;
460
465
}
461
466
462
467
if !help_msg. is_empty ( ) {
0 commit comments