auto merge of #20117 : lfairy/rust/rename-include-bin, r=alexcrichton

According to [RFC 344][], methods that return `&[u8]` should have names ending in `bytes`. Though `include_bin!` is a macro not a method, it seems reasonable to follow the convention anyway.

We keep the old name around for now, but trigger a deprecation warning when it is used.

[RFC 344]: https://github.com/rust-lang/rfcs/blob/master/text/0344-conventions-galore.md

[breaking-change]
This commit is contained in:
bors 2014-12-24 20:47:12 +00:00
commit 7e11b22713
9 changed files with 34 additions and 21 deletions

View file

@ -148,7 +148,7 @@ fn main() {
use std::io::{stdio, MemReader, BufferedReader};
let rdr = if os::getenv("RUST_BENCH").is_some() {
let foo = include_bin!("shootout-k-nucleotide.data");
let foo = include_bytes!("shootout-k-nucleotide.data");
box MemReader::new(foo.to_vec()) as Box<Reader>
} else {
box stdio::stdin() as Box<Reader>

View file

@ -43,8 +43,8 @@ fn main() {
include_str!(invalid); //~ ERROR
include_str!("i'd be quite surprised if a file with this name existed"); //~ ERROR
include_bin!(invalid); //~ ERROR
include_bin!("i'd be quite surprised if a file with this name existed"); //~ ERROR
include_bytes!(invalid); //~ ERROR
include_bytes!("i'd be quite surprised if a file with this name existed"); //~ ERROR
trace_macros!(invalid); //~ ERROR
}

View file

@ -9,7 +9,7 @@
// except according to those terms.
pub static X: &'static str = "foobarbaz";
pub static Y: &'static [u8] = include_bin!("lib.rs");
pub static Y: &'static [u8] = include_bytes!("lib.rs");
trait Foo {}
impl Foo for uint {}

View file

@ -39,7 +39,7 @@ pub fn main() {
.as_slice()
.starts_with("/* this is for "));
assert!(
include_bin!("syntax-extension-source-utils-files/includeme.fragment")
include_bytes!("syntax-extension-source-utils-files/includeme.fragment")
[1] == (42 as u8)); // '*'
// The Windows tests are wrapped in an extra module for some reason
assert!((m1::m2::where_am_i().as_slice().ends_with("m1::m2")));