From acea5f4c82fa8ae084606b5383562f3dc3357d90 Mon Sep 17 00:00:00 2001 From: Jake Goulding Date: Mon, 7 Sep 2015 20:01:14 -0400 Subject: [PATCH] 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 `()` --- src/libstd/macros.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs index e4866982176..a0c3f013f2b 100644 --- a/src/libstd/macros.rs +++ b/src/libstd/macros.rs @@ -412,9 +412,9 @@ pub mod builtin { #[macro_export] macro_rules! include_str { ($file:expr) => ({ /* compiler built-in */ }) } - /// Includes a file as a byte slice. + /// Includes a file as a reference to a byte array. /// - /// This macro will yield an expression of type `&'static [u8]` which is + /// This macro will yield an expression of type `&'static [u8; N]` which is /// the contents of the filename specified. The file is located relative to /// the current file (similarly to how modules are found), /// -- GitLab