@@ -410,7 +410,9 @@ error[E0603]: module `hosting` is private
410
410
--> src/lib.rs:9:28
411
411
|
412
412
9 | crate::front_of_house::hosting::add_to_waitlist();
413
- | ^^^^^^^ private module
413
+ | ^^^^^^^ --------------- function `add_to_waitlist` is not publicly re-exported
414
+ | |
415
+ | private module
414
416
|
415
417
note: the module `hosting` is defined here
416
418
--> src/lib.rs:2:5
@@ -422,7 +424,9 @@ error[E0603]: module `hosting` is private
422
424
--> src/lib.rs:12:21
423
425
|
424
426
12 | front_of_house::hosting::add_to_waitlist();
425
- | ^^^^^^^ private module
427
+ | ^^^^^^^ --------------- function `add_to_waitlist` is not publicly re-exported
428
+ | |
429
+ | private module
426
430
|
427
431
note: the module `hosting` is defined here
428
432
--> src/lib.rs:2:5
@@ -596,8 +600,8 @@ interested in this topic, see The Rust API Guidelines at *https://rust-lang.gith
596
600
> root as well as a * src/lib.rs* library crate root, and both crates will have
597
601
> the package name by default. Typically, packages with this pattern of
598
602
> containing both a library and a binary crate will have just enough code in the
599
- > binary crate to start an executable that calls code with the library crate.
600
- > This lets other projects benefit from the most functionality that the
603
+ > binary crate to start an executable that calls code within the library crate.
604
+ > This lets other projects benefit from most of the functionality that the
601
605
> package provides because the library crate’s code can be shared.
602
606
>
603
607
> The module tree should be defined in * src/lib.rs* . Then, any public items can
@@ -826,6 +830,11 @@ error[E0433]: failed to resolve: use of undeclared crate or module `hosting`
826
830
|
827
831
11 | hosting::add_to_waitlist();
828
832
| ^^^^^^^ use of undeclared crate or module `hosting`
833
+ |
834
+ help: consider importing this module through its public re-export
835
+ |
836
+ 10 + use crate::hosting;
837
+ |
829
838
830
839
warning: unused import: `crate::front_of_house::hosting`
831
840
--> src/lib.rs:7:5
@@ -992,7 +1001,8 @@ from a new scope with `pub use`
992
1001
993
1002
Before this change, external code would have to call the ` add_to_waitlist `
994
1003
function by using the path
995
- ` restaurant::front_of_house::hosting::add_to_waitlist() ` . Now that this `pub
1004
+ ` restaurant::front_of_house::hosting::add_to_waitlist() ` , which also would have
1005
+ required the ` front_of_house ` module to be marked as ` pub ` . Now that this `pub
996
1006
use` has re-exported the ` hosting` module from the root module, external code
997
1007
can use the path ` restaurant::hosting::add_to_waitlist() ` instead.
998
1008
0 commit comments