Skip to content

Commit 8a8abc6

Browse files
authored
Rollup merge of #70700 - jrvidal:include-macro-paths, r=Dylan-DPC
Expand on platform details of `include_xxx` macros This is a small detail that is not explicitly mentioned, but it left me scratching my head for a while until I looked into its implementation details. Maybe worth mentioning.
2 parents d644a24 + 65fcc3f commit 8a8abc6

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/libcore/macros/mod.rs

+11-5
Original file line numberDiff line numberDiff line change
@@ -1070,8 +1070,10 @@ pub(crate) mod builtin {
10701070

10711071
/// Includes a utf8-encoded file as a string.
10721072
///
1073-
/// The file is located relative to the current file. (similarly to how
1074-
/// modules are found)
1073+
/// The file is located relative to the current file (similarly to how
1074+
/// modules are found). The provided path is interpreted in a platform-specific
1075+
/// way at compile time. So, for instance, an invocation with a Windows path
1076+
/// containing backslashes `\` would not compile correctly on Unix.
10751077
///
10761078
/// This macro will yield an expression of type `&'static str` which is the
10771079
/// contents of the file.
@@ -1108,8 +1110,10 @@ pub(crate) mod builtin {
11081110

11091111
/// Includes a file as a reference to a byte array.
11101112
///
1111-
/// The file is located relative to the current file. (similarly to how
1112-
/// modules are found)
1113+
/// The file is located relative to the current file (similarly to how
1114+
/// modules are found). The provided path is interpreted in a platform-specific
1115+
/// way at compile time. So, for instance, an invocation with a Windows path
1116+
/// containing backslashes `\` would not compile correctly on Unix.
11131117
///
11141118
/// This macro will yield an expression of type `&'static [u8; N]` which is
11151119
/// the contents of the file.
@@ -1202,7 +1206,9 @@ pub(crate) mod builtin {
12021206
/// Parses a file as an expression or an item according to the context.
12031207
///
12041208
/// The file is located relative to the current file (similarly to how
1205-
/// modules are found).
1209+
/// modules are found). The provided path is interpreted in a platform-specific
1210+
/// way at compile time. So, for instance, an invocation with a Windows path
1211+
/// containing backslashes `\` would not compile correctly on Unix.
12061212
///
12071213
/// Using this macro is often a bad idea, because if the file is
12081214
/// parsed as an expression, it is going to be placed in the

0 commit comments

Comments
 (0)