Skip to content

Commit 369fc5e

Browse files
committed
Document crate top-level and directory modules. Closes #1097
1 parent 9375204 commit 369fc5e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

doc/rust.texi

+8-1
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,7 @@ and compiled crates have a 1:1 relationship.
10311031
The syntactic form of a crate is a sequence of @emph{directives}, some of
10321032
which have nested sub-directives.
10331033

1034-
A crate defines an implicit top-level anonymous module: within this module,
1034+
A crate defines an implicit top-level module: within this module,
10351035
all members of the crate have canonical path names. @xref{Ref.Path}. The
10361036
@code{mod} directives within a crate file specify sub-modules to include in
10371037
the crate: these are either directory modules, corresponding to directories in
@@ -1040,6 +1040,13 @@ to Rust source files. The names given to such modules in @code{mod} directives
10401040
become prefixes of the paths of items defined within any included Rust source
10411041
files.
10421042

1043+
If a .rs file exists in the filesystem alongside the .rc crate file, then it
1044+
will be used to provide the top-level module of the crate. Similarly,
1045+
directory modules may be paired with .rs files of the same name as the
1046+
directory to provide the code for those modules. These source files are never
1047+
mentioned explicitly in the crate file; they are simply used if they are
1048+
present.
1049+
10431050
The @code{use} directives within the crate specify @emph{other crates} to scan
10441051
for, locate, import into the crate's module namespace during compilation, and
10451052
link against at runtime. Use directives may also occur independently in rust

0 commit comments

Comments
 (0)