From 97551ade5ba6872b436b6b4e117007c47181503f Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Thu, 13 Oct 2016 10:31:49 -0700 Subject: [PATCH] derive: update to proc-macro --- derive/Cargo.toml | 3 +-- derive/src/lib.rs | 10 +++++----- derive/tests/compile-fail/derive_on_struct.rs | 2 +- derive/tests/compile-fail/enum_with_associated_data.rs | 2 +- derive/tests/empty_enum.rs | 2 +- derive/tests/trivial.rs | 2 +- derive/tests/with_custom_values.rs | 2 +- 7 files changed, 11 insertions(+), 12 deletions(-) diff --git a/derive/Cargo.toml b/derive/Cargo.toml index dee2bf5..c20bc43 100644 --- a/derive/Cargo.toml +++ b/derive/Cargo.toml @@ -21,7 +21,6 @@ path = ".." version = "0.1" [lib] -crate-type = ["rustc-macro"] name = "num_derive" -rustc-macro = true +proc-macro = true test = false diff --git a/derive/src/lib.rs b/derive/src/lib.rs index 3283bb0..49854b5 100644 --- a/derive/src/lib.rs +++ b/derive/src/lib.rs @@ -8,20 +8,20 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![crate_type = "rustc-macro"] -#![feature(rustc_macro, rustc_macro_lib)] +#![crate_type = "proc-macro"] +#![feature(proc_macro, proc_macro_lib)] extern crate syn; #[macro_use] extern crate quote; -extern crate rustc_macro; +extern crate proc_macro; -use rustc_macro::TokenStream; +use proc_macro::TokenStream; use syn::Body::Enum; use syn::VariantData::Unit; -#[rustc_macro_derive(FromPrimitive)] +#[proc_macro_derive(FromPrimitive)] pub fn from_primitive(input: TokenStream) -> TokenStream { let source = input.to_string(); diff --git a/derive/tests/compile-fail/derive_on_struct.rs b/derive/tests/compile-fail/derive_on_struct.rs index 6ce4cd1..b75c096 100644 --- a/derive/tests/compile-fail/derive_on_struct.rs +++ b/derive/tests/compile-fail/derive_on_struct.rs @@ -9,7 +9,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(rustc_macro)] +#![feature(proc_macro)] extern crate num; #[macro_use] diff --git a/derive/tests/compile-fail/enum_with_associated_data.rs b/derive/tests/compile-fail/enum_with_associated_data.rs index 312f0f7..59eb87c 100644 --- a/derive/tests/compile-fail/enum_with_associated_data.rs +++ b/derive/tests/compile-fail/enum_with_associated_data.rs @@ -9,7 +9,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(rustc_macro)] +#![feature(proc_macro)] extern crate num; #[macro_use] diff --git a/derive/tests/empty_enum.rs b/derive/tests/empty_enum.rs index 6b1c22b..5dd964d 100644 --- a/derive/tests/empty_enum.rs +++ b/derive/tests/empty_enum.rs @@ -9,7 +9,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(rustc_macro)] +#![feature(proc_macro)] extern crate num; #[macro_use] diff --git a/derive/tests/trivial.rs b/derive/tests/trivial.rs index 298ca6d..c4efe47 100644 --- a/derive/tests/trivial.rs +++ b/derive/tests/trivial.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(rustc_macro)] +#![feature(proc_macro)] extern crate num; #[macro_use] diff --git a/derive/tests/with_custom_values.rs b/derive/tests/with_custom_values.rs index 4ecf672..a2038c7 100644 --- a/derive/tests/with_custom_values.rs +++ b/derive/tests/with_custom_values.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(rustc_macro)] +#![feature(proc_macro)] extern crate num; #[macro_use]