Skip to content

Commit acea5f4

Browse files
committed
Clarify that include_bytes! returns a reference to an array, not just a slice
This can be shown with the example code ```rust fn main() { let () = include_bytes!("/etc/hosts"); } Which will have the error: expected `&[u8; 195]`, found `()`
1 parent 7bf626a commit acea5f4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/libstd/macros.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,9 +412,9 @@ pub mod builtin {
412412
#[macro_export]
413413
macro_rules! include_str { ($file:expr) => ({ /* compiler built-in */ }) }
414414

415-
/// Includes a file as a byte slice.
415+
/// Includes a file as a reference to a byte array.
416416
///
417-
/// This macro will yield an expression of type `&'static [u8]` which is
417+
/// This macro will yield an expression of type `&'static [u8; N]` which is
418418
/// the contents of the filename specified. The file is located relative to
419419
/// the current file (similarly to how modules are found),
420420
///

0 commit comments

Comments
 (0)