rustc: Stabilize the proc_macro
feature
This commit stabilizes the `proc_macro` and `proc_macro_lib` features in the compiler to stabilize the "Macros 1.1" feature of the language. Many more details can be found on the tracking issue, #35900. Closes #35900
This commit is contained in:
parent
917e5baae7
commit
045f8f6929
65 changed files with 13 additions and 188 deletions
|
@ -15,8 +15,7 @@
|
||||||
//! Currently the primary use of this crate is to provide the ability to define
|
//! Currently the primary use of this crate is to provide the ability to define
|
||||||
//! new custom derive modes through `#[proc_macro_derive]`.
|
//! new custom derive modes through `#[proc_macro_derive]`.
|
||||||
//!
|
//!
|
||||||
//! Added recently as part of [RFC 1681] this crate is currently *unstable* and
|
//! Added recently as part of [RFC 1681] this crate is stable as of Rust 1.15.0.
|
||||||
//! requires the `#![feature(proc_macro_lib)]` directive to use.
|
|
||||||
//!
|
//!
|
||||||
//! [RFC 1681]: https://github.com/rust-lang/rfcs/blob/master/text/1681-macros-1.1.md
|
//! [RFC 1681]: https://github.com/rust-lang/rfcs/blob/master/text/1681-macros-1.1.md
|
||||||
//!
|
//!
|
||||||
|
@ -27,7 +26,7 @@
|
||||||
//! area for macro authors is stabilized.
|
//! area for macro authors is stabilized.
|
||||||
|
|
||||||
#![crate_name = "proc_macro"]
|
#![crate_name = "proc_macro"]
|
||||||
#![unstable(feature = "proc_macro_lib", issue = "27812")]
|
#![stable(feature = "proc_macro_lib", since = "1.15.0")]
|
||||||
#![crate_type = "rlib"]
|
#![crate_type = "rlib"]
|
||||||
#![crate_type = "dylib"]
|
#![crate_type = "dylib"]
|
||||||
#![cfg_attr(not(stage0), deny(warnings))]
|
#![cfg_attr(not(stage0), deny(warnings))]
|
||||||
|
@ -55,12 +54,14 @@ use syntax::ptr::P;
|
||||||
///
|
///
|
||||||
/// The API of this type is intentionally bare-bones, but it'll be expanded over
|
/// The API of this type is intentionally bare-bones, but it'll be expanded over
|
||||||
/// time!
|
/// time!
|
||||||
|
#[stable(feature = "proc_macro_lib", since = "1.15.0")]
|
||||||
pub struct TokenStream {
|
pub struct TokenStream {
|
||||||
inner: Vec<P<ast::Item>>,
|
inner: Vec<P<ast::Item>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Error returned from `TokenStream::from_str`.
|
/// Error returned from `TokenStream::from_str`.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
#[stable(feature = "proc_macro_lib", since = "1.15.0")]
|
||||||
pub struct LexError {
|
pub struct LexError {
|
||||||
_inner: (),
|
_inner: (),
|
||||||
}
|
}
|
||||||
|
@ -131,6 +132,7 @@ pub mod __internal {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[stable(feature = "proc_macro_lib", since = "1.15.0")]
|
||||||
impl FromStr for TokenStream {
|
impl FromStr for TokenStream {
|
||||||
type Err = LexError;
|
type Err = LexError;
|
||||||
|
|
||||||
|
@ -154,6 +156,7 @@ impl FromStr for TokenStream {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[stable(feature = "proc_macro_lib", since = "1.15.0")]
|
||||||
impl fmt::Display for TokenStream {
|
impl fmt::Display for TokenStream {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
for item in self.inner.iter() {
|
for item in self.inner.iter() {
|
||||||
|
|
|
@ -716,8 +716,7 @@ pub fn phase_2_configure_and_expand<F>(sess: &Session,
|
||||||
is_proc_macro_crate,
|
is_proc_macro_crate,
|
||||||
is_test_crate,
|
is_test_crate,
|
||||||
num_crate_types,
|
num_crate_types,
|
||||||
sess.diagnostic(),
|
sess.diagnostic())
|
||||||
&sess.features.borrow())
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
#![feature(conservative_impl_trait)]
|
#![feature(conservative_impl_trait)]
|
||||||
#![feature(core_intrinsics)]
|
#![feature(core_intrinsics)]
|
||||||
#![feature(proc_macro_internals)]
|
#![feature(proc_macro_internals)]
|
||||||
#![feature(proc_macro_lib)]
|
|
||||||
#![feature(quote)]
|
#![feature(quote)]
|
||||||
#![feature(rustc_diagnostic_macros)]
|
#![feature(rustc_diagnostic_macros)]
|
||||||
#![feature(rustc_private)]
|
#![feature(rustc_private)]
|
||||||
|
|
|
@ -926,7 +926,6 @@ impl<'feat> ExpansionConfig<'feat> {
|
||||||
fn enable_allow_internal_unstable = allow_internal_unstable,
|
fn enable_allow_internal_unstable = allow_internal_unstable,
|
||||||
fn enable_custom_derive = custom_derive,
|
fn enable_custom_derive = custom_derive,
|
||||||
fn enable_pushpop_unsafe = pushpop_unsafe,
|
fn enable_pushpop_unsafe = pushpop_unsafe,
|
||||||
fn enable_proc_macro = proc_macro,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -279,9 +279,6 @@ declare_features! (
|
||||||
// instead of just the platforms on which it is the C ABI
|
// instead of just the platforms on which it is the C ABI
|
||||||
(active, abi_sysv64, "1.13.0", Some(36167)),
|
(active, abi_sysv64, "1.13.0", Some(36167)),
|
||||||
|
|
||||||
// Macros 1.1
|
|
||||||
(active, proc_macro, "1.13.0", Some(35900)),
|
|
||||||
|
|
||||||
// Allows untagged unions `union U { ... }`
|
// Allows untagged unions `union U { ... }`
|
||||||
(active, untagged_unions, "1.13.0", Some(32836)),
|
(active, untagged_unions, "1.13.0", Some(32836)),
|
||||||
|
|
||||||
|
@ -377,6 +374,8 @@ declare_features! (
|
||||||
// Allows `..` in tuple (struct) patterns
|
// Allows `..` in tuple (struct) patterns
|
||||||
(accepted, dotdot_in_tuple_patterns, "1.14.0", Some(33627)),
|
(accepted, dotdot_in_tuple_patterns, "1.14.0", Some(33627)),
|
||||||
(accepted, item_like_imports, "1.14.0", Some(35120)),
|
(accepted, item_like_imports, "1.14.0", Some(35120)),
|
||||||
|
// Macros 1.1
|
||||||
|
(accepted, proc_macro, "1.15.0", Some(35900)),
|
||||||
);
|
);
|
||||||
// (changing above list without updating src/doc/reference.md makes @cmr sad)
|
// (changing above list without updating src/doc/reference.md makes @cmr sad)
|
||||||
|
|
||||||
|
@ -650,11 +649,7 @@ pub const BUILTIN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeG
|
||||||
is an experimental feature",
|
is an experimental feature",
|
||||||
cfg_fn!(fundamental))),
|
cfg_fn!(fundamental))),
|
||||||
|
|
||||||
("proc_macro_derive", Normal, Gated(Stability::Unstable,
|
("proc_macro_derive", Normal, Ungated),
|
||||||
"proc_macro",
|
|
||||||
"the `#[proc_macro_derive]` attribute \
|
|
||||||
is an experimental feature",
|
|
||||||
cfg_fn!(proc_macro))),
|
|
||||||
|
|
||||||
("rustc_copy_clone_marker", Whitelisted, Gated(Stability::Unstable,
|
("rustc_copy_clone_marker", Whitelisted, Gated(Stability::Unstable,
|
||||||
"rustc_attrs",
|
"rustc_attrs",
|
||||||
|
@ -760,7 +755,6 @@ const GATED_CFGS: &'static [(&'static str, &'static str, fn(&Features) -> bool)]
|
||||||
("target_vendor", "cfg_target_vendor", cfg_fn!(cfg_target_vendor)),
|
("target_vendor", "cfg_target_vendor", cfg_fn!(cfg_target_vendor)),
|
||||||
("target_thread_local", "cfg_target_thread_local", cfg_fn!(cfg_target_thread_local)),
|
("target_thread_local", "cfg_target_thread_local", cfg_fn!(cfg_target_thread_local)),
|
||||||
("target_has_atomic", "cfg_target_has_atomic", cfg_fn!(cfg_target_has_atomic)),
|
("target_has_atomic", "cfg_target_has_atomic", cfg_fn!(cfg_target_has_atomic)),
|
||||||
("proc_macro", "proc_macro", cfg_fn!(proc_macro)),
|
|
||||||
];
|
];
|
||||||
|
|
||||||
#[derive(Debug, Eq, PartialEq)]
|
#[derive(Debug, Eq, PartialEq)]
|
||||||
|
|
|
@ -15,7 +15,7 @@ use syntax::attr::HasAttrs;
|
||||||
use syntax::codemap;
|
use syntax::codemap;
|
||||||
use syntax::ext::base::{Annotatable, ExtCtxt, SyntaxExtension};
|
use syntax::ext::base::{Annotatable, ExtCtxt, SyntaxExtension};
|
||||||
use syntax::ext::build::AstBuilder;
|
use syntax::ext::build::AstBuilder;
|
||||||
use syntax::feature_gate::{self, emit_feature_err};
|
use syntax::feature_gate;
|
||||||
use syntax::ptr::P;
|
use syntax::ptr::P;
|
||||||
use syntax::symbol::Symbol;
|
use syntax::symbol::Symbol;
|
||||||
use syntax_pos::Span;
|
use syntax_pos::Span;
|
||||||
|
@ -220,12 +220,6 @@ pub fn expand_derive(cx: &mut ExtCtxt,
|
||||||
.filter(|&(_, ref name)| !is_builtin_trait(name.name().unwrap()))
|
.filter(|&(_, ref name)| !is_builtin_trait(name.name().unwrap()))
|
||||||
.next();
|
.next();
|
||||||
if let Some((i, titem)) = macros_11_derive {
|
if let Some((i, titem)) = macros_11_derive {
|
||||||
if !cx.ecfg.features.unwrap().proc_macro {
|
|
||||||
let issue = feature_gate::GateIssue::Language;
|
|
||||||
let msg = "custom derive macros are experimentally supported";
|
|
||||||
emit_feature_err(cx.parse_sess, "proc_macro", titem.span, issue, msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
let tname = ast::Ident::with_empty_ctxt(titem.name().unwrap());
|
let tname = ast::Ident::with_empty_ctxt(titem.name().unwrap());
|
||||||
let path = ast::Path::from_ident(titem.span, tname);
|
let path = ast::Path::from_ident(titem.span, tname);
|
||||||
let ext = cx.resolver.resolve_macro(cx.current_expansion.mark, &path, false).unwrap();
|
let ext = cx.resolver.resolve_macro(cx.current_expansion.mark, &path, false).unwrap();
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
html_root_url = "https://doc.rust-lang.org/nightly/")]
|
html_root_url = "https://doc.rust-lang.org/nightly/")]
|
||||||
#![cfg_attr(not(stage0), deny(warnings))]
|
#![cfg_attr(not(stage0), deny(warnings))]
|
||||||
|
|
||||||
#![feature(proc_macro_lib)]
|
|
||||||
#![feature(proc_macro_internals)]
|
#![feature(proc_macro_internals)]
|
||||||
#![feature(rustc_private)]
|
#![feature(rustc_private)]
|
||||||
#![feature(staged_api)]
|
#![feature(staged_api)]
|
||||||
|
|
|
@ -17,7 +17,6 @@ use syntax::ext::base::ExtCtxt;
|
||||||
use syntax::ext::build::AstBuilder;
|
use syntax::ext::build::AstBuilder;
|
||||||
use syntax::ext::expand::ExpansionConfig;
|
use syntax::ext::expand::ExpansionConfig;
|
||||||
use syntax::parse::ParseSess;
|
use syntax::parse::ParseSess;
|
||||||
use syntax::feature_gate::Features;
|
|
||||||
use syntax::fold::Folder;
|
use syntax::fold::Folder;
|
||||||
use syntax::ptr::P;
|
use syntax::ptr::P;
|
||||||
use syntax::symbol::Symbol;
|
use syntax::symbol::Symbol;
|
||||||
|
@ -47,8 +46,7 @@ pub fn modify(sess: &ParseSess,
|
||||||
is_proc_macro_crate: bool,
|
is_proc_macro_crate: bool,
|
||||||
is_test_crate: bool,
|
is_test_crate: bool,
|
||||||
num_crate_types: usize,
|
num_crate_types: usize,
|
||||||
handler: &errors::Handler,
|
handler: &errors::Handler) -> ast::Crate {
|
||||||
features: &Features) -> ast::Crate {
|
|
||||||
let ecfg = ExpansionConfig::default("proc_macro".to_string());
|
let ecfg = ExpansionConfig::default("proc_macro".to_string());
|
||||||
let mut cx = ExtCtxt::new(sess, ecfg, resolver);
|
let mut cx = ExtCtxt::new(sess, ecfg, resolver);
|
||||||
|
|
||||||
|
@ -66,12 +64,6 @@ pub fn modify(sess: &ParseSess,
|
||||||
|
|
||||||
if !is_proc_macro_crate {
|
if !is_proc_macro_crate {
|
||||||
return krate
|
return krate
|
||||||
} else if !features.proc_macro {
|
|
||||||
let mut err = handler.struct_err("the `proc-macro` crate type is \
|
|
||||||
experimental");
|
|
||||||
err.help("add #![feature(proc_macro)] to the crate attributes to \
|
|
||||||
enable");
|
|
||||||
err.emit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if num_crate_types > 1 {
|
if num_crate_types > 1 {
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![crate_type = "proc-macro"]
|
#![crate_type = "proc-macro"]
|
||||||
#![feature(proc_macro, proc_macro_lib)]
|
|
||||||
|
|
||||||
extern crate proc_macro;
|
extern crate proc_macro;
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
// force-host
|
// force-host
|
||||||
// no-prefer-dynamic
|
// no-prefer-dynamic
|
||||||
|
|
||||||
#![feature(proc_macro, proc_macro_lib)]
|
|
||||||
#![crate_type = "proc-macro"]
|
#![crate_type = "proc-macro"]
|
||||||
|
|
||||||
extern crate proc_macro;
|
extern crate proc_macro;
|
||||||
|
|
|
@ -11,8 +11,6 @@
|
||||||
// force-host
|
// force-host
|
||||||
// no-prefer-dynamic
|
// no-prefer-dynamic
|
||||||
|
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![feature(proc_macro_lib)]
|
|
||||||
#![crate_type = "proc-macro"]
|
#![crate_type = "proc-macro"]
|
||||||
|
|
||||||
extern crate proc_macro;
|
extern crate proc_macro;
|
||||||
|
|
|
@ -11,8 +11,6 @@
|
||||||
// force-host
|
// force-host
|
||||||
// no-prefer-dynamic
|
// no-prefer-dynamic
|
||||||
|
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![feature(proc_macro_lib)]
|
|
||||||
#![crate_type = "proc-macro"]
|
#![crate_type = "proc-macro"]
|
||||||
|
|
||||||
extern crate proc_macro;
|
extern crate proc_macro;
|
||||||
|
|
|
@ -11,8 +11,6 @@
|
||||||
// no-prefer-dynamic
|
// no-prefer-dynamic
|
||||||
// force-host
|
// force-host
|
||||||
|
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![feature(proc_macro_lib)]
|
|
||||||
#![crate_type = "proc-macro"]
|
#![crate_type = "proc-macro"]
|
||||||
|
|
||||||
extern crate proc_macro;
|
extern crate proc_macro;
|
||||||
|
|
|
@ -11,8 +11,6 @@
|
||||||
// no-prefer-dynamic
|
// no-prefer-dynamic
|
||||||
// force-host
|
// force-host
|
||||||
|
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![feature(proc_macro_lib)]
|
|
||||||
#![crate_type = "proc-macro"]
|
#![crate_type = "proc-macro"]
|
||||||
|
|
||||||
extern crate proc_macro;
|
extern crate proc_macro;
|
||||||
|
|
|
@ -11,8 +11,6 @@
|
||||||
// force-host
|
// force-host
|
||||||
// no-prefer-dynamic
|
// no-prefer-dynamic
|
||||||
|
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![feature(proc_macro_lib)]
|
|
||||||
#![crate_type = "proc-macro"]
|
#![crate_type = "proc-macro"]
|
||||||
|
|
||||||
extern crate proc_macro;
|
extern crate proc_macro;
|
||||||
|
|
|
@ -11,8 +11,6 @@
|
||||||
// force-host
|
// force-host
|
||||||
// no-prefer-dynamic
|
// no-prefer-dynamic
|
||||||
|
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![feature(proc_macro_lib)]
|
|
||||||
#![crate_type = "proc-macro"]
|
#![crate_type = "proc-macro"]
|
||||||
|
|
||||||
extern crate proc_macro;
|
extern crate proc_macro;
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
// no-prefer-dynamic
|
// no-prefer-dynamic
|
||||||
|
|
||||||
#![crate_type = "proc-macro"]
|
#![crate_type = "proc-macro"]
|
||||||
#![feature(proc_macro, proc_macro_lib)]
|
|
||||||
|
|
||||||
extern crate proc_macro;
|
extern crate proc_macro;
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,6 @@
|
||||||
|
|
||||||
// aux-build:derive-bad.rs
|
// aux-build:derive-bad.rs
|
||||||
|
|
||||||
#![feature(proc_macro)]
|
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate derive_bad;
|
extern crate derive_bad;
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
// aux-build:derive-a.rs
|
// aux-build:derive-a.rs
|
||||||
|
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![allow(warnings)]
|
#![allow(warnings)]
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
// aux-build:derive-unstable-2.rs
|
// aux-build:derive-unstable-2.rs
|
||||||
|
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![allow(warnings)]
|
#![allow(warnings)]
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
// aux-build:derive-unstable.rs
|
// aux-build:derive-unstable.rs
|
||||||
|
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![allow(warnings)]
|
#![allow(warnings)]
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
// error-pattern: cannot export macro_rules! macros from a `proc-macro` crate
|
// error-pattern: cannot export macro_rules! macros from a `proc-macro` crate
|
||||||
|
|
||||||
#![crate_type = "proc-macro"]
|
#![crate_type = "proc-macro"]
|
||||||
#![feature(proc_macro)]
|
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! foo {
|
macro_rules! foo {
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
// error-pattern: the `proc-macro` crate type is experimental
|
|
||||||
|
|
||||||
#![crate_type = "proc-macro"]
|
|
|
@ -1,13 +0,0 @@
|
||||||
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
extern crate proc_macro; //~ ERROR: use of unstable library feature
|
|
||||||
|
|
||||||
fn main() {}
|
|
|
@ -1,15 +0,0 @@
|
||||||
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
#![crate_type = "proc-macro"]
|
|
||||||
|
|
||||||
#[proc_macro_derive(Foo)] //~ ERROR: is an experimental feature
|
|
||||||
pub fn foo() {
|
|
||||||
}
|
|
|
@ -1,17 +0,0 @@
|
||||||
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
// aux-build:derive-a.rs
|
|
||||||
|
|
||||||
#[macro_use]
|
|
||||||
extern crate derive_a;
|
|
||||||
|
|
||||||
#[derive(A)] //~ ERROR custom derive macros are experimentally supported
|
|
||||||
struct S;
|
|
|
@ -1,12 +0,0 @@
|
||||||
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
#[cfg(proc_macro)] //~ ERROR: experimental and subject to change
|
|
||||||
fn foo() {}
|
|
|
@ -8,8 +8,6 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(proc_macro, proc_macro_lib)]
|
|
||||||
|
|
||||||
extern crate proc_macro;
|
extern crate proc_macro;
|
||||||
|
|
||||||
#[proc_macro_derive(Foo)]
|
#[proc_macro_derive(Foo)]
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
// aux-build:derive-a.rs
|
// aux-build:derive-a.rs
|
||||||
|
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![allow(warnings)]
|
#![allow(warnings)]
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
|
|
|
@ -10,8 +10,6 @@
|
||||||
|
|
||||||
// aux-build:derive-a-b.rs
|
// aux-build:derive-a-b.rs
|
||||||
|
|
||||||
#![feature(proc_macro)]
|
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate derive_a_b;
|
extern crate derive_a_b;
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
// aux-build:derive-b.rs
|
// aux-build:derive-b.rs
|
||||||
|
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![allow(warnings)]
|
#![allow(warnings)]
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
|
|
|
@ -10,8 +10,6 @@
|
||||||
|
|
||||||
// aux-build:derive-panic.rs
|
// aux-build:derive-panic.rs
|
||||||
|
|
||||||
#![feature(proc_macro)]
|
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate derive_panic;
|
extern crate derive_panic;
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
// aux-build:derive-b.rs
|
// aux-build:derive-b.rs
|
||||||
|
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![allow(warnings)]
|
#![allow(warnings)]
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![crate_type = "proc-macro"]
|
#![crate_type = "proc-macro"]
|
||||||
#![feature(proc_macro, proc_macro_lib)]
|
|
||||||
|
|
||||||
extern crate proc_macro;
|
extern crate proc_macro;
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![crate_type = "proc-macro"]
|
#![crate_type = "proc-macro"]
|
||||||
#![feature(proc_macro, proc_macro_lib)]
|
|
||||||
|
|
||||||
extern crate proc_macro;
|
extern crate proc_macro;
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,6 @@
|
||||||
|
|
||||||
// aux-build:derive-a.rs
|
// aux-build:derive-a.rs
|
||||||
|
|
||||||
#![feature(proc_macro)]
|
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate derive_a;
|
extern crate derive_a;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![crate_type = "proc-macro"]
|
#![crate_type = "proc-macro"]
|
||||||
#![feature(proc_macro, proc_macro_lib)]
|
|
||||||
#![allow(warnings)]
|
#![allow(warnings)]
|
||||||
|
|
||||||
extern crate proc_macro;
|
extern crate proc_macro;
|
||||||
|
|
|
@ -8,6 +8,5 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![allow(unused)]
|
#![allow(unused)]
|
||||||
#![crate_type = "proc-macro"]
|
#![crate_type = "proc-macro"]
|
||||||
|
|
|
@ -8,6 +8,5 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![allow(unused)]
|
#![allow(unused)]
|
||||||
#![crate_type = "proc-macro"]
|
#![crate_type = "proc-macro"]
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![crate_type = "proc-macro"]
|
#![crate_type = "proc-macro"]
|
||||||
#![feature(proc_macro, proc_macro_lib)]
|
|
||||||
|
|
||||||
extern crate proc_macro;
|
extern crate proc_macro;
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(proc_macro)]
|
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate foo;
|
extern crate foo;
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,6 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![crate_type = "proc-macro"]
|
#![crate_type = "proc-macro"]
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![feature(proc_macro_lib)]
|
|
||||||
|
|
||||||
extern crate proc_macro;
|
extern crate proc_macro;
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,6 @@
|
||||||
|
|
||||||
// aux-build:add-impl.rs
|
// aux-build:add-impl.rs
|
||||||
|
|
||||||
#![feature(proc_macro)]
|
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate add_impl;
|
extern crate add_impl;
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
// aux-build:append-impl.rs
|
// aux-build:append-impl.rs
|
||||||
|
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![allow(warnings)]
|
#![allow(warnings)]
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
|
|
|
@ -11,8 +11,6 @@
|
||||||
// no-prefer-dynamic
|
// no-prefer-dynamic
|
||||||
|
|
||||||
#![crate_type = "proc-macro"]
|
#![crate_type = "proc-macro"]
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![feature(proc_macro_lib)]
|
|
||||||
|
|
||||||
extern crate proc_macro;
|
extern crate proc_macro;
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,6 @@
|
||||||
// force-host
|
// force-host
|
||||||
// no-prefer-dynamic
|
// no-prefer-dynamic
|
||||||
|
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![feature(proc_macro_lib)]
|
|
||||||
#![crate_type = "proc-macro"]
|
#![crate_type = "proc-macro"]
|
||||||
|
|
||||||
extern crate proc_macro;
|
extern crate proc_macro;
|
||||||
|
|
|
@ -11,8 +11,6 @@
|
||||||
// no-prefer-dynamic
|
// no-prefer-dynamic
|
||||||
|
|
||||||
#![crate_type = "proc-macro"]
|
#![crate_type = "proc-macro"]
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![feature(proc_macro_lib)]
|
|
||||||
|
|
||||||
extern crate proc_macro;
|
extern crate proc_macro;
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,6 @@
|
||||||
// no-prefer-dynamic
|
// no-prefer-dynamic
|
||||||
|
|
||||||
#![crate_type = "proc-macro"]
|
#![crate_type = "proc-macro"]
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![feature(proc_macro_lib)]
|
|
||||||
|
|
||||||
extern crate proc_macro;
|
extern crate proc_macro;
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,6 @@
|
||||||
// no-prefer-dynamic
|
// no-prefer-dynamic
|
||||||
|
|
||||||
#![crate_type = "proc-macro"]
|
#![crate_type = "proc-macro"]
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![feature(proc_macro_lib)]
|
|
||||||
|
|
||||||
extern crate proc_macro;
|
extern crate proc_macro;
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,6 @@
|
||||||
// no-prefer-dynamic
|
// no-prefer-dynamic
|
||||||
|
|
||||||
#![crate_type = "proc-macro"]
|
#![crate_type = "proc-macro"]
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![feature(proc_macro_lib)]
|
|
||||||
|
|
||||||
extern crate proc_macro;
|
extern crate proc_macro;
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,6 @@
|
||||||
// no-prefer-dynamic
|
// no-prefer-dynamic
|
||||||
|
|
||||||
#![crate_type = "proc-macro"]
|
#![crate_type = "proc-macro"]
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![feature(proc_macro_lib)]
|
|
||||||
|
|
||||||
extern crate proc_macro;
|
extern crate proc_macro;
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
// ignore-test
|
// ignore-test
|
||||||
|
|
||||||
#![feature(macro_reexport, proc_macro)]
|
#![feature(macro_reexport)]
|
||||||
|
|
||||||
#[macro_reexport(A)]
|
#[macro_reexport(A)]
|
||||||
extern crate derive_a;
|
extern crate derive_a;
|
||||||
|
|
|
@ -11,9 +11,6 @@
|
||||||
// no-prefer-dynamic
|
// no-prefer-dynamic
|
||||||
// compile-flags:--crate-type proc-macro
|
// compile-flags:--crate-type proc-macro
|
||||||
|
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![feature(proc_macro_lib)]
|
|
||||||
|
|
||||||
extern crate proc_macro;
|
extern crate proc_macro;
|
||||||
|
|
||||||
use proc_macro::TokenStream;
|
use proc_macro::TokenStream;
|
||||||
|
|
|
@ -11,8 +11,6 @@
|
||||||
// no-prefer-dynamic
|
// no-prefer-dynamic
|
||||||
|
|
||||||
#![crate_type = "proc-macro"]
|
#![crate_type = "proc-macro"]
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![feature(proc_macro_lib)]
|
|
||||||
|
|
||||||
extern crate proc_macro;
|
extern crate proc_macro;
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,6 @@
|
||||||
// no-prefer-dynamic
|
// no-prefer-dynamic
|
||||||
|
|
||||||
#![crate_type = "proc-macro"]
|
#![crate_type = "proc-macro"]
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![feature(proc_macro_lib)]
|
|
||||||
#![deny(warnings)]
|
#![deny(warnings)]
|
||||||
|
|
||||||
extern crate proc_macro;
|
extern crate proc_macro;
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
// aux-build:double.rs
|
// aux-build:double.rs
|
||||||
|
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![allow(unused)]
|
#![allow(unused)]
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
|
|
|
@ -11,8 +11,6 @@
|
||||||
// aux-build:derive-b.rs
|
// aux-build:derive-b.rs
|
||||||
// ignore-stage1
|
// ignore-stage1
|
||||||
|
|
||||||
#![feature(proc_macro)]
|
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate derive_b;
|
extern crate derive_b;
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,6 @@
|
||||||
|
|
||||||
// aux-build:derive-same-struct.rs
|
// aux-build:derive-same-struct.rs
|
||||||
|
|
||||||
#![feature(proc_macro)]
|
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate derive_same_struct;
|
extern crate derive_same_struct;
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,6 @@
|
||||||
// compile-flags: --test
|
// compile-flags: --test
|
||||||
|
|
||||||
#![crate_type = "proc-macro"]
|
#![crate_type = "proc-macro"]
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![feature(proc_macro, proc_macro_lib)]
|
|
||||||
|
|
||||||
extern crate proc_macro;
|
extern crate proc_macro;
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
// aux-build:expand-with-a-macro.rs
|
// aux-build:expand-with-a-macro.rs
|
||||||
// ignore-stage1
|
// ignore-stage1
|
||||||
|
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![deny(warnings)]
|
#![deny(warnings)]
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
|
|
|
@ -11,8 +11,6 @@
|
||||||
// aux-build:derive-atob.rs
|
// aux-build:derive-atob.rs
|
||||||
// aux-build:derive-ctod.rs
|
// aux-build:derive-ctod.rs
|
||||||
|
|
||||||
#![feature(proc_macro)]
|
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate derive_atob;
|
extern crate derive_atob;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
|
|
|
@ -11,8 +11,6 @@
|
||||||
// aux-build:derive-a.rs
|
// aux-build:derive-a.rs
|
||||||
// ignore-stage1
|
// ignore-stage1
|
||||||
|
|
||||||
#![feature(proc_macro)]
|
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate derive_a;
|
extern crate derive_a;
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,6 @@
|
||||||
// aux-build:derive-nothing.rs
|
// aux-build:derive-nothing.rs
|
||||||
// ignore-stage1
|
// ignore-stage1
|
||||||
|
|
||||||
#![feature(proc_macro)]
|
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate derive_nothing;
|
extern crate derive_nothing;
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,6 @@
|
||||||
// aux-build:derive-a.rs
|
// aux-build:derive-a.rs
|
||||||
// aux-build:derive-reexport.rs
|
// aux-build:derive-reexport.rs
|
||||||
|
|
||||||
#![feature(proc_macro)]
|
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate derive_reexport;
|
extern crate derive_reexport;
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,6 @@
|
||||||
|
|
||||||
// no-prefer-dynamic
|
// no-prefer-dynamic
|
||||||
|
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![feature(proc_macro_lib)]
|
|
||||||
#![crate_type = "proc-macro"]
|
#![crate_type = "proc-macro"]
|
||||||
|
|
||||||
extern crate proc_macro;
|
extern crate proc_macro;
|
||||||
|
|
Loading…
Add table
Reference in a new issue