@@ -1315,22 +1315,41 @@ pub(crate) mod builtin {
13151315
13161316 /// Parses a file as an expression or an item according to the context.
13171317 ///
1318- /// The file is located relative to the current file (similarly to how
1319- /// modules are found). The provided path is interpreted in a platform-specific
1320- /// way at compile time. So, for instance, an invocation with a Windows path
1321- /// containing backslashes `\` would not compile correctly on Unix.
1318+ /// **Warning**: For multi-file Rust projects, the `include!` macro is probably not what you
1319+ /// are looking for. Usually, multi-file Rust projects use
1320+ /// [modules](https://doc.rust-lang.org/reference/items/modules.html). Multi-file projects and
1321+ /// modules are explained in the Rust-by-Example book
1322+ /// [here](https://doc.rust-lang.org/rust-by-example/mod/split.html) and the module system is
1323+ /// explained in the Rust Book
1324+ /// [here](https://doc.rust-lang.org/book/ch07-02-defining-modules-to-control-scope-and-privacy.html).
1325+ ///
1326+ /// The included file is placed in the surrounding code
1327+ /// [unhygienically](https://doc.rust-lang.org/reference/macros-by-example.html#hygiene). If
1328+ /// the included file is parsed as an expression and variables or functions share names across
1329+ /// both files, it could result in variables or functions being different from what the
1330+ /// included file expected.
1331+ ///
1332+ /// The included file is located relative to the current file (similarly to how modules are
1333+ /// found). The provided path is interpreted in a platform-specific way at compile time. So,
1334+ /// for instance, an invocation with a Windows path containing backslashes `\` would not
1335+ /// compile correctly on Unix.
13221336 ///
1323- /// Using this macro is often a bad idea, because if the file is
1324- /// parsed as an expression, it is going to be placed in the
1325- /// surrounding code unhygienically. This could result in variables
1326- /// or functions being different from what the file expected if
1327- /// there are variables or functions that have the same name in
1328- /// the current file.
1337+ /// # Uses
1338+ ///
1339+ /// The `include!` macro is primarily used for two purposes. It is used to include
1340+ /// documentation that is written in a separate file and it is used to include [build artifacts
1341+ /// usually as a result from the `build.rs`
1342+ /// script](https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script).
1343+ ///
1344+ /// When using the `include` macro to include stretches of documentation, remember that the
1345+ /// included file still needs to be a valid rust syntax. It is also possible to
1346+ /// use the [`include_str`] macro as `#![doc = include_str!("...")]` (at the module level) or
1347+ /// `#[doc = include_str!("...")]` (at the item level) to include documentation from a plain
1348+ /// text or markdown file.
13291349 ///
13301350 /// # Examples
13311351 ///
1332- /// Assume there are two files in the same directory with the following
1333- /// contents:
1352+ /// Assume there are two files in the same directory with the following contents:
13341353 ///
13351354 /// File 'monkeys.in':
13361355 ///
0 commit comments