about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2014-06-18 20:25:36 +0200
committerAlex Crichton <alex@alexcrichton.com>2014-06-18 17:02:22 -0700
commit108b8b6dc707775bd54aeea7820e0d473f556718 (patch)
treea848b9df4646e3311158381252a211a4b8ee2771 /src/libsyntax
parentabf7e933df0c732f14b5b8906161e74e72cd26ca (diff)
downloadrust-108b8b6dc707775bd54aeea7820e0d473f556718.tar.gz
rust-108b8b6dc707775bd54aeea7820e0d473f556718.zip
Deprecate the bytes!() macro.
Replace its usage with byte string literals, except in `bytes!()` tests.
Also add a new snapshot, to be able to use the new b"foo" syntax.

The src/etc/2014-06-rewrite-bytes-macros.py script automatically
rewrites `bytes!()` invocations into byte string literals.
Pass it filenames as arguments to generate a diff that you can inspect,
or `--apply` followed by filenames to apply the changes in place.
Diffs can be piped into `tip` or `pygmentize -l diff` for coloring.
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ext/bytes.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libsyntax/ext/bytes.rs b/src/libsyntax/ext/bytes.rs
index b87a25d4a44..658c28f8202 100644
--- a/src/libsyntax/ext/bytes.rs
+++ b/src/libsyntax/ext/bytes.rs
@@ -19,6 +19,14 @@ use ext::build::AstBuilder;
 
 pub fn expand_syntax_ext(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
                          -> Box<base::MacResult> {
+    cx.span_warn(sp, "`bytes!` is deprecated, use `b\"foo\"` literals instead");
+    cx.parse_sess.span_diagnostic.span_note(sp,
+        "see http://doc.rust-lang.org/rust.html#byte-and-byte-string-literals \
+         for documentation");
+    cx.parse_sess.span_diagnostic.span_note(sp,
+        "see https://github.com/rust-lang/rust/blob/master/src/etc/2014-06-rewrite-bytes-macros.py \
+         for a automated migration");
+
     // Gather all argument expressions
     let exprs = match get_exprs_from_tts(cx, sp, tts) {
         None => return DummyResult::expr(sp),