@@ -434,8 +434,13 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
434
434
value_result = BoundResult ( target_module. clone ( ) ,
435
435
( * child_name_bindings) . clone ( ) ) ;
436
436
if directive. is_public && !child_name_bindings. is_public ( ValueNS ) {
437
- let msg = format ! ( "`{}` is private" , source) ;
437
+ let msg = format ! ( "`{}` is private, and cannot be reexported" ,
438
+ token:: get_name( source) ) ;
439
+ let note_msg =
440
+ format ! ( "Consider marking `{}` as `pub` in the imported module" ,
441
+ token:: get_name( source) ) ;
438
442
span_err ! ( self . resolver. session, directive. span, E0364 , "{}" , & msg) ;
443
+ self . resolver . session . span_note ( directive. span , & note_msg) ;
439
444
pub_err = true ;
440
445
}
441
446
}
@@ -444,8 +449,12 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
444
449
type_result = BoundResult ( target_module. clone ( ) ,
445
450
( * child_name_bindings) . clone ( ) ) ;
446
451
if !pub_err && directive. is_public && !child_name_bindings. is_public ( TypeNS ) {
447
- let msg = format ! ( "`{}` is private" , source) ;
452
+ let msg = format ! ( "`{}` is private, and cannot be reexported" ,
453
+ token:: get_name( source) ) ;
454
+ let note_msg = format ! ( "Consider declaring module `{}` as a `pub mod`" ,
455
+ token:: get_name( source) ) ;
448
456
span_err ! ( self . resolver. session, directive. span, E0365 , "{}" , & msg) ;
457
+ self . resolver . session . span_note ( directive. span , & note_msg) ;
449
458
}
450
459
}
451
460
}
0 commit comments