diff --git a/src/librustc_resolve/macros.rs b/src/librustc_resolve/macros.rs index 0388465b485cb..3a859c02c16c4 100644 --- a/src/librustc_resolve/macros.rs +++ b/src/librustc_resolve/macros.rs @@ -397,6 +397,18 @@ impl<'a> Resolver<'a> { fn resolve_macro_to_def(&mut self, scope: Mark, path: &ast::Path, kind: MacroKind, force: bool) -> Result { + if path.segments.len() > 1 { + if !self.session.features_untracked().proc_macro_path_invoc { + emit_feature_err( + &self.session.parse_sess, + "proc_macro_path_invoc", + path.span, + GateIssue::Language, + "paths of length greater than one in macro invocations are \ + currently unstable", + ); + } + } let def = self.resolve_macro_to_def_inner(scope, path, kind, force); if def != Err(Determinacy::Undetermined) { // Do not report duplicated errors on every undetermined resolution. diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 678c20402d6f4..1434e5fddeab0 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -514,6 +514,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> { Some(kind.expect_from_annotatables(items)) } AttrProcMacro(ref mac) => { + self.gate_proc_macro_attr_item(attr.span, &item); let item_tok = TokenTree::Token(DUMMY_SP, Token::interpolated(match item { Annotatable::Item(item) => token::NtItem(item), Annotatable::TraitItem(item) => token::NtTraitItem(item.into_inner()), @@ -522,7 +523,8 @@ impl<'a, 'b> MacroExpander<'a, 'b> { Annotatable::Stmt(stmt) => token::NtStmt(stmt.into_inner()), Annotatable::Expr(expr) => token::NtExpr(expr), })).into(); - let tok_result = mac.expand(self.cx, attr.span, attr.tokens, item_tok); + let input = self.extract_proc_macro_attr_input(attr.tokens, attr.span); + let tok_result = mac.expand(self.cx, attr.span, input, item_tok); self.parse_expansion(tok_result, kind, &attr.path, attr.span) } ProcMacroDerive(..) | BuiltinDerive(..) => { @@ -539,6 +541,49 @@ impl<'a, 'b> MacroExpander<'a, 'b> { } } + fn extract_proc_macro_attr_input(&self, tokens: TokenStream, span: Span) -> TokenStream { + let mut trees = tokens.trees(); + match trees.next() { + Some(TokenTree::Delimited(_, delim)) => { + if trees.next().is_none() { + return delim.tts.into() + } + } + Some(TokenTree::Token(..)) => {} + None => return TokenStream::empty(), + } + self.cx.span_err(span, "custom attribute invocations must be \ + of the form #[foo] or #[foo(..)], the macro name must only be \ + followed by a delimiter token"); + TokenStream::empty() + } + + fn gate_proc_macro_attr_item(&self, span: Span, item: &Annotatable) { + let (kind, gate) = match *item { + Annotatable::Item(ref item) => { + match item.node { + ItemKind::Mod(_) if self.cx.ecfg.proc_macro_mod() => return, + ItemKind::Mod(_) => ("modules", "proc_macro_mod"), + _ => return, + } + } + Annotatable::TraitItem(_) => return, + Annotatable::ImplItem(_) => return, + Annotatable::ForeignItem(_) => return, + Annotatable::Stmt(_) | + Annotatable::Expr(_) if self.cx.ecfg.proc_macro_expr() => return, + Annotatable::Stmt(_) => ("statements", "proc_macro_expr"), + Annotatable::Expr(_) => ("expressions", "proc_macro_expr"), + }; + emit_feature_err( + self.cx.parse_sess, + gate, + span, + GateIssue::Language, + &format!("custom attributes cannot be applied to {}", kind), + ); + } + /// Expand a macro invocation. Returns the result of expansion. fn expand_bang_invoc(&mut self, invoc: Invocation, @@ -665,6 +710,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> { self.cx.trace_macros_diag(); kind.dummy(span) } else { + self.gate_proc_macro_expansion_kind(span, kind); invoc.expansion_data.mark.set_expn_info(ExpnInfo { call_site: span, callee: NameAndSpan { @@ -695,6 +741,30 @@ impl<'a, 'b> MacroExpander<'a, 'b> { } } + fn gate_proc_macro_expansion_kind(&self, span: Span, kind: ExpansionKind) { + let kind = match kind { + ExpansionKind::Expr => "expressions", + ExpansionKind::OptExpr => "expressions", + ExpansionKind::Pat => "patterns", + ExpansionKind::Ty => "types", + ExpansionKind::Stmts => "statements", + ExpansionKind::Items => return, + ExpansionKind::TraitItems => return, + ExpansionKind::ImplItems => return, + ExpansionKind::ForeignItems => return, + }; + if self.cx.ecfg.proc_macro_non_items() { + return + } + emit_feature_err( + self.cx.parse_sess, + "proc_macro_non_items", + span, + GateIssue::Language, + &format!("procedural macros cannot be expanded to {}", kind), + ); + } + /// Expand a derive invocation. Returns the result of expansion. fn expand_derive_invoc(&mut self, invoc: Invocation, @@ -1370,6 +1440,9 @@ impl<'feat> ExpansionConfig<'feat> { fn enable_custom_derive = custom_derive, fn proc_macro_enabled = proc_macro, fn macros_in_extern_enabled = macros_in_extern, + fn proc_macro_mod = proc_macro_mod, + fn proc_macro_expr = proc_macro_expr, + fn proc_macro_non_items = proc_macro_non_items, } } diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 7b7cfe5eea00b..6426c9a92f231 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -451,6 +451,15 @@ declare_features! ( (active, mmx_target_feature, "1.27.0", None, None), (active, sse4a_target_feature, "1.27.0", None, None), (active, tbm_target_feature, "1.27.0", None, None), + + // Allows macro invocations of the form `#[foo::bar]` + (active, proc_macro_path_invoc, "1.27.0", None, None), + + // Allows macro invocations on modules expressions and statements and + // procedural macros to expand to non-items. + (active, proc_macro_mod, "1.27.0", None, None), + (active, proc_macro_expr, "1.27.0", None, None), + (active, proc_macro_non_items, "1.27.0", None, None), ); declare_features! ( diff --git a/src/test/compile-fail-fulldeps/proc-macro/attr-invalid-exprs.rs b/src/test/compile-fail-fulldeps/proc-macro/attr-invalid-exprs.rs index 2f65bd16bb54a..749d87e37b559 100644 --- a/src/test/compile-fail-fulldeps/proc-macro/attr-invalid-exprs.rs +++ b/src/test/compile-fail-fulldeps/proc-macro/attr-invalid-exprs.rs @@ -13,7 +13,7 @@ //! Attributes producing expressions in invalid locations -#![feature(proc_macro, stmt_expr_attributes)] +#![feature(proc_macro, stmt_expr_attributes, proc_macro_expr)] extern crate attr_stmt_expr; use attr_stmt_expr::{duplicate, no_output}; diff --git a/src/test/compile-fail-fulldeps/proc-macro/attr-stmt-expr.rs b/src/test/compile-fail-fulldeps/proc-macro/attr-stmt-expr.rs index d29bc00c663c8..ce04fdfb976d4 100644 --- a/src/test/compile-fail-fulldeps/proc-macro/attr-stmt-expr.rs +++ b/src/test/compile-fail-fulldeps/proc-macro/attr-stmt-expr.rs @@ -11,7 +11,7 @@ // aux-build:attr-stmt-expr.rs // ignore-stage1 -#![feature(proc_macro)] +#![feature(proc_macro, proc_macro_expr)] extern crate attr_stmt_expr; use attr_stmt_expr::{expect_let, expect_print_stmt, expect_expr, expect_print_expr}; diff --git a/src/test/compile-fail-fulldeps/proc-macro/attributes-included.rs b/src/test/compile-fail-fulldeps/proc-macro/attributes-included.rs index 2adbee1d3fbd5..9947e8f66ceda 100644 --- a/src/test/compile-fail-fulldeps/proc-macro/attributes-included.rs +++ b/src/test/compile-fail-fulldeps/proc-macro/attributes-included.rs @@ -11,7 +11,7 @@ // aux-build:attributes-included.rs // ignore-stage1 -#![feature(proc_macro, rustc_attrs)] +#![feature(proc_macro, rustc_attrs, proc_macro_path_invoc)] #![warn(unused)] extern crate attributes_included; diff --git a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/proc-macro-gates.rs b/src/test/compile-fail-fulldeps/proc-macro/auxiliary/proc-macro-gates.rs new file mode 100644 index 0000000000000..25579f1fc83d5 --- /dev/null +++ b/src/test/compile-fail-fulldeps/proc-macro/auxiliary/proc-macro-gates.rs @@ -0,0 +1,29 @@ +// Copyright 2018 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// no-prefer-dynamic +// force-host + +#![crate_type = "proc-macro"] +#![feature(proc_macro)] + +extern crate proc_macro; + +use proc_macro::*; + +#[proc_macro] +pub fn m(a: TokenStream) -> TokenStream { + a +} + +#[proc_macro_attribute] +pub fn a(_a: TokenStream, b: TokenStream) -> TokenStream { + b +} diff --git a/src/test/compile-fail-fulldeps/proc-macro/lints_in_proc_macros.rs b/src/test/compile-fail-fulldeps/proc-macro/lints_in_proc_macros.rs index 773b16b945f07..c7be316794746 100644 --- a/src/test/compile-fail-fulldeps/proc-macro/lints_in_proc_macros.rs +++ b/src/test/compile-fail-fulldeps/proc-macro/lints_in_proc_macros.rs @@ -11,7 +11,7 @@ // aux-build:bang_proc_macro2.rs // ignore-stage1 -#![feature(proc_macro)] +#![feature(proc_macro, proc_macro_non_items)] #![allow(unused_macros)] extern crate bang_proc_macro2; diff --git a/src/test/compile-fail-fulldeps/proc-macro/macro-use-bang.rs b/src/test/compile-fail-fulldeps/proc-macro/macro-use-bang.rs index 7ecc685357ee6..f16ca79ca9313 100644 --- a/src/test/compile-fail-fulldeps/proc-macro/macro-use-bang.rs +++ b/src/test/compile-fail-fulldeps/proc-macro/macro-use-bang.rs @@ -10,7 +10,7 @@ // aux-build:bang_proc_macro.rs -#![feature(proc_macro)] +#![feature(proc_macro, proc_macro_non_items)] #[macro_use] extern crate bang_proc_macro; diff --git a/src/test/compile-fail-fulldeps/proc-macro/proc-macro-gates.rs b/src/test/compile-fail-fulldeps/proc-macro/proc-macro-gates.rs new file mode 100644 index 0000000000000..0dc1c2ab2daf9 --- /dev/null +++ b/src/test/compile-fail-fulldeps/proc-macro/proc-macro-gates.rs @@ -0,0 +1,54 @@ +// Copyright 2018 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// aux-build:proc-macro-gates.rs +// gate-test-proc_macro_non_items +// gate-test-proc_macro_path_invoc +// gate-test-proc_macro_mod line +// gate-test-proc_macro_expr +// gate-test-proc_macro_mod + +#![feature(proc_macro, stmt_expr_attributes)] + +extern crate proc_macro_gates as foo; + +use foo::*; + +#[foo::a] //~ ERROR: paths of length greater than one +fn _test() {} + +#[a] //~ ERROR: custom attributes cannot be applied to modules +mod _test2 {} + +#[a = y] //~ ERROR: must only be followed by a delimiter token +fn _test3() {} + +#[a = ] //~ ERROR: must only be followed by a delimiter token +fn _test4() {} + +#[a () = ] //~ ERROR: must only be followed by a delimiter token +fn _test5() {} + +fn main() { + #[a] //~ ERROR: custom attributes cannot be applied to statements + let _x = 2; + let _x = #[a] 2; + //~^ ERROR: custom attributes cannot be applied to expressions + + let _x: m!(u32) = 3; + //~^ ERROR: procedural macros cannot be expanded to types + if let m!(Some(_x)) = Some(3) { + //~^ ERROR: procedural macros cannot be expanded to patterns + } + let _x = m!(3); + //~^ ERROR: procedural macros cannot be expanded to expressions + m!(let _x = 3;); + //~^ ERROR: procedural macros cannot be expanded to statements +} diff --git a/src/test/compile-fail-fulldeps/proc-macro/proc-macro-gates2.rs b/src/test/compile-fail-fulldeps/proc-macro/proc-macro-gates2.rs new file mode 100644 index 0000000000000..a1a15afecd506 --- /dev/null +++ b/src/test/compile-fail-fulldeps/proc-macro/proc-macro-gates2.rs @@ -0,0 +1,35 @@ +// Copyright 2018 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// aux-build:proc-macro-gates.rs + +#![feature(proc_macro, stmt_expr_attributes)] + +extern crate proc_macro_gates as foo; + +use foo::*; + +// NB. these errors aren't the best errors right now, but they're definitely +// intended to be errors. Somehow using a custom attribute in these positions +// should either require a feature gate or not be allowed on stable. + +fn _test6<#[a] T>() {} +//~^ ERROR: unknown to the compiler + +fn _test7() { + match 1 { + #[a] //~ ERROR: unknown to the compiler + 0 => {} + _ => {} + } +} + +fn main() { +} diff --git a/src/test/compile-fail/extern-macro.rs b/src/test/compile-fail/extern-macro.rs index 4267103ab9a3a..08269ce5c7ecf 100644 --- a/src/test/compile-fail/extern-macro.rs +++ b/src/test/compile-fail/extern-macro.rs @@ -10,7 +10,7 @@ // #41719 -#![feature(use_extern_macros)] +#![feature(use_extern_macros, proc_macro_path_invoc)] fn main() { enum Foo {} diff --git a/src/test/compile-fail/macro-with-seps-err-msg.rs b/src/test/compile-fail/macro-with-seps-err-msg.rs index 0f123997ca1d9..6567a100d8c06 100644 --- a/src/test/compile-fail/macro-with-seps-err-msg.rs +++ b/src/test/compile-fail/macro-with-seps-err-msg.rs @@ -10,6 +10,8 @@ // gate-test-use_extern_macros +#![feature(proc_macro_path_invoc)] + fn main() { globnar::brotz!(); //~ ERROR non-ident macro paths are experimental #[derive(foo::Bar)] struct T; //~ ERROR non-ident macro paths are experimental diff --git a/src/test/compile-fail/macros-nonfatal-errors.rs b/src/test/compile-fail/macros-nonfatal-errors.rs index 7046ee12b50e5..40412087cef97 100644 --- a/src/test/compile-fail/macros-nonfatal-errors.rs +++ b/src/test/compile-fail/macros-nonfatal-errors.rs @@ -13,6 +13,7 @@ #![feature(asm)] #![feature(trace_macros, concat_idents)] +#![feature(proc_macro_path_invoc)] #[derive(Default)] //~ ERROR enum OrDeriveThis {} diff --git a/src/test/compile-fail/privacy/associated-item-privacy-inherent.rs b/src/test/compile-fail/privacy/associated-item-privacy-inherent.rs index 63cb6e82c259e..b64829edaa218 100644 --- a/src/test/compile-fail/privacy/associated-item-privacy-inherent.rs +++ b/src/test/compile-fail/privacy/associated-item-privacy-inherent.rs @@ -10,6 +10,7 @@ #![feature(decl_macro, associated_type_defaults)] #![allow(unused, private_in_public)] +#![feature(proc_macro_path_invoc)] mod priv_nominal { pub struct Pub; diff --git a/src/test/compile-fail/privacy/associated-item-privacy-trait.rs b/src/test/compile-fail/privacy/associated-item-privacy-trait.rs index bdc0c680a92bc..062dc53361703 100644 --- a/src/test/compile-fail/privacy/associated-item-privacy-trait.rs +++ b/src/test/compile-fail/privacy/associated-item-privacy-trait.rs @@ -10,6 +10,7 @@ // ignore-tidy-linelength +#![feature(proc_macro_path_invoc)] #![feature(decl_macro, associated_type_defaults)] #![allow(unused, private_in_public)] diff --git a/src/test/compile-fail/privacy/associated-item-privacy-type-binding.rs b/src/test/compile-fail/privacy/associated-item-privacy-type-binding.rs index c25616c54354d..0dfa61a18ab82 100644 --- a/src/test/compile-fail/privacy/associated-item-privacy-type-binding.rs +++ b/src/test/compile-fail/privacy/associated-item-privacy-type-binding.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(proc_macro_path_invoc)] #![feature(decl_macro, associated_type_defaults)] #![allow(unused, private_in_public)] diff --git a/src/test/compile-fail/private-inferred-type-3.rs b/src/test/compile-fail/private-inferred-type-3.rs index 0c393f02323ec..97d6b470d33bb 100644 --- a/src/test/compile-fail/private-inferred-type-3.rs +++ b/src/test/compile-fail/private-inferred-type-3.rs @@ -18,6 +18,7 @@ // error-pattern:type `fn(u8) -> ext::PubTupleStruct {ext::PubTupleStruct::{{constructor}}}` is priv // error-pattern:type `for<'r> fn(&'r ext::Pub) {>::priv_method}` is private +#![feature(proc_macro_path_invoc)] #![feature(decl_macro)] extern crate private_inferred_type as ext; diff --git a/src/test/compile-fail/private-inferred-type.rs b/src/test/compile-fail/private-inferred-type.rs index 5af8b063c1629..dfc0107e07565 100644 --- a/src/test/compile-fail/private-inferred-type.rs +++ b/src/test/compile-fail/private-inferred-type.rs @@ -11,6 +11,7 @@ #![feature(associated_consts)] #![feature(decl_macro)] #![allow(private_in_public)] +#![feature(proc_macro_path_invoc)] mod m { fn priv_fn() {} diff --git a/src/test/run-pass-fulldeps/auxiliary/cond_plugin.rs b/src/test/run-pass-fulldeps/auxiliary/cond_plugin.rs index 281ee70815e11..9e1ae59c01bc0 100644 --- a/src/test/run-pass-fulldeps/auxiliary/cond_plugin.rs +++ b/src/test/run-pass-fulldeps/auxiliary/cond_plugin.rs @@ -11,7 +11,7 @@ // no-prefer-dynamic #![crate_type = "proc-macro"] -#![feature(proc_macro)] +#![feature(proc_macro, proc_macro_non_items)] extern crate proc_macro; diff --git a/src/test/run-pass-fulldeps/auxiliary/hello_macro.rs b/src/test/run-pass-fulldeps/auxiliary/hello_macro.rs index cf6584e961a67..a680698df9a2a 100644 --- a/src/test/run-pass-fulldeps/auxiliary/hello_macro.rs +++ b/src/test/run-pass-fulldeps/auxiliary/hello_macro.rs @@ -11,7 +11,7 @@ // no-prefer-dynamic #![crate_type = "proc-macro"] -#![feature(proc_macro, proc_macro_lib)] +#![feature(proc_macro, proc_macro_lib, proc_macro_non_items)] extern crate proc_macro; diff --git a/src/test/run-pass-fulldeps/auxiliary/proc_macro_def.rs b/src/test/run-pass-fulldeps/auxiliary/proc_macro_def.rs index d3670ae66feed..a280b3d87c685 100644 --- a/src/test/run-pass-fulldeps/auxiliary/proc_macro_def.rs +++ b/src/test/run-pass-fulldeps/auxiliary/proc_macro_def.rs @@ -11,7 +11,7 @@ // no-prefer-dynamic #![crate_type = "proc-macro"] -#![feature(proc_macro, proc_macro_lib)] +#![feature(proc_macro, proc_macro_lib, proc_macro_non_items)] extern crate proc_macro; diff --git a/src/test/run-pass-fulldeps/macro-quote-cond.rs b/src/test/run-pass-fulldeps/macro-quote-cond.rs index cff743bdae6cd..52e8e75f2628e 100644 --- a/src/test/run-pass-fulldeps/macro-quote-cond.rs +++ b/src/test/run-pass-fulldeps/macro-quote-cond.rs @@ -11,7 +11,7 @@ // aux-build:cond_plugin.rs // ignore-stage1 -#![feature(proc_macro)] +#![feature(proc_macro, proc_macro_non_items)] extern crate cond_plugin; diff --git a/src/test/run-pass-fulldeps/macro-quote-test.rs b/src/test/run-pass-fulldeps/macro-quote-test.rs index eb77895e2d7ad..9bb8f691915c7 100644 --- a/src/test/run-pass-fulldeps/macro-quote-test.rs +++ b/src/test/run-pass-fulldeps/macro-quote-test.rs @@ -13,7 +13,7 @@ // aux-build:hello_macro.rs // ignore-stage1 -#![feature(proc_macro)] +#![feature(proc_macro, proc_macro_path_invoc, proc_macro_non_items)] extern crate hello_macro; diff --git a/src/test/run-pass-fulldeps/proc-macro/attr-args.rs b/src/test/run-pass-fulldeps/proc-macro/attr-args.rs index 2968cc7871d7e..bf7ac507ea570 100644 --- a/src/test/run-pass-fulldeps/proc-macro/attr-args.rs +++ b/src/test/run-pass-fulldeps/proc-macro/attr-args.rs @@ -12,7 +12,7 @@ // ignore-stage1 #![allow(warnings)] -#![feature(proc_macro)] +#![feature(proc_macro, proc_macro_path_invoc)] extern crate attr_args; use attr_args::attr_with_args; @@ -20,6 +20,6 @@ use attr_args::attr_with_args; #[attr_with_args(text = "Hello, world!")] fn foo() {} -#[::attr_args::identity - fn main() { assert_eq!(foo(), "Hello, world!"); }] +#[::attr_args::identity( + fn main() { assert_eq!(foo(), "Hello, world!"); })] struct Dummy; diff --git a/src/test/run-pass-fulldeps/proc-macro/attr-on-trait.rs b/src/test/run-pass-fulldeps/proc-macro/attr-on-trait.rs index 52a8652e65bcf..95e4f2211c637 100644 --- a/src/test/run-pass-fulldeps/proc-macro/attr-on-trait.rs +++ b/src/test/run-pass-fulldeps/proc-macro/attr-on-trait.rs @@ -11,7 +11,7 @@ // aux-build:attr-on-trait.rs // ignore-stage1 -#![feature(proc_macro)] +#![feature(proc_macro, proc_macro_path_invoc)] extern crate attr_on_trait; diff --git a/src/test/run-pass-fulldeps/proc-macro/attr-stmt-expr.rs b/src/test/run-pass-fulldeps/proc-macro/attr-stmt-expr.rs index 98316c62ef135..d928f8e557303 100644 --- a/src/test/run-pass-fulldeps/proc-macro/attr-stmt-expr.rs +++ b/src/test/run-pass-fulldeps/proc-macro/attr-stmt-expr.rs @@ -11,7 +11,7 @@ // aux-build:attr-stmt-expr.rs // ignore-stage1 -#![feature(proc_macro, stmt_expr_attributes)] +#![feature(proc_macro, stmt_expr_attributes, proc_macro_stmt, proc_macro_expr)] extern crate attr_stmt_expr; use attr_stmt_expr::{expect_let, expect_print_stmt, expect_expr, expect_print_expr, diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/attr-args.rs b/src/test/run-pass-fulldeps/proc-macro/auxiliary/attr-args.rs index 93815d16837d3..5f12cc96e9fb3 100644 --- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/attr-args.rs +++ b/src/test/run-pass-fulldeps/proc-macro/auxiliary/attr-args.rs @@ -20,7 +20,7 @@ use proc_macro::TokenStream; pub fn attr_with_args(args: TokenStream, input: TokenStream) -> TokenStream { let args = args.to_string(); - assert_eq!(args, r#"( text = "Hello, world!" )"#); + assert_eq!(args, r#"text = "Hello, world!""#); let input = input.to_string(); diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/count_compound_ops.rs b/src/test/run-pass-fulldeps/proc-macro/auxiliary/count_compound_ops.rs index 063d8dc40536d..5376d2740452f 100644 --- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/count_compound_ops.rs +++ b/src/test/run-pass-fulldeps/proc-macro/auxiliary/count_compound_ops.rs @@ -10,7 +10,7 @@ // no-prefer-dynamic -#![feature(proc_macro)] +#![feature(proc_macro, proc_macro_non_items)] #![crate_type = "proc-macro"] extern crate proc_macro; diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/hygiene_example_codegen.rs b/src/test/run-pass-fulldeps/proc-macro/auxiliary/hygiene_example_codegen.rs index 055e4e2fad7af..b8562ffc344de 100644 --- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/hygiene_example_codegen.rs +++ b/src/test/run-pass-fulldeps/proc-macro/auxiliary/hygiene_example_codegen.rs @@ -10,7 +10,7 @@ // no-prefer-dynamic -#![feature(proc_macro)] +#![feature(proc_macro, proc_macro_non_items)] #![crate_type = "proc-macro"] extern crate proc_macro as proc_macro_renamed; // This does not break `quote!` diff --git a/src/test/run-pass-fulldeps/proc-macro/bang-macro.rs b/src/test/run-pass-fulldeps/proc-macro/bang-macro.rs index ffa4731f1e637..82337022ac3bf 100644 --- a/src/test/run-pass-fulldeps/proc-macro/bang-macro.rs +++ b/src/test/run-pass-fulldeps/proc-macro/bang-macro.rs @@ -11,7 +11,7 @@ // aux-build:bang-macro.rs // ignore-stage1 -#![feature(proc_macro)] +#![feature(proc_macro, proc_macro_non_items)] extern crate bang_macro; use bang_macro::rewrite; diff --git a/src/test/run-pass-fulldeps/proc-macro/count_compound_ops.rs b/src/test/run-pass-fulldeps/proc-macro/count_compound_ops.rs index 00ad0e76ed014..3fbe5366b6a1b 100644 --- a/src/test/run-pass-fulldeps/proc-macro/count_compound_ops.rs +++ b/src/test/run-pass-fulldeps/proc-macro/count_compound_ops.rs @@ -11,7 +11,7 @@ // aux-build:count_compound_ops.rs // ignore-stage1 -#![feature(proc_macro)] +#![feature(proc_macro, proc_macro_non_items)] extern crate count_compound_ops; use count_compound_ops::count_compound_ops; diff --git a/src/test/run-pass-fulldeps/proc-macro/derive-b.rs b/src/test/run-pass-fulldeps/proc-macro/derive-b.rs index 995dc65729a50..d4176c0efbf10 100644 --- a/src/test/run-pass-fulldeps/proc-macro/derive-b.rs +++ b/src/test/run-pass-fulldeps/proc-macro/derive-b.rs @@ -11,7 +11,7 @@ // aux-build:derive-b.rs // ignore-stage1 -#![feature(proc_macro)] +#![feature(proc_macro, proc_macro_path_invoc)] extern crate derive_b; diff --git a/src/test/run-pass-fulldeps/proc-macro/hygiene_example.rs b/src/test/run-pass-fulldeps/proc-macro/hygiene_example.rs index 4cac7d19b4de8..48de15b934d23 100644 --- a/src/test/run-pass-fulldeps/proc-macro/hygiene_example.rs +++ b/src/test/run-pass-fulldeps/proc-macro/hygiene_example.rs @@ -12,7 +12,7 @@ // aux-build:hygiene_example.rs // ignore-stage1 -#![feature(proc_macro)] +#![feature(proc_macro, proc_macro_non_items)] extern crate hygiene_example; use hygiene_example::hello; diff --git a/src/test/run-pass-fulldeps/proc-macro/issue-42708.rs b/src/test/run-pass-fulldeps/proc-macro/issue-42708.rs index e53e94ae475b2..a6b7d93c279d9 100644 --- a/src/test/run-pass-fulldeps/proc-macro/issue-42708.rs +++ b/src/test/run-pass-fulldeps/proc-macro/issue-42708.rs @@ -11,7 +11,7 @@ // aux-build:issue-42708.rs // ignore-stage1 -#![feature(decl_macro, proc_macro)] +#![feature(decl_macro, proc_macro, proc_macro_path_invoc)] #![allow(unused)] extern crate issue_42708; diff --git a/src/test/run-pass-fulldeps/proc-macro/negative-token.rs b/src/test/run-pass-fulldeps/proc-macro/negative-token.rs index 418e692fa24ad..1cdf1daf56083 100644 --- a/src/test/run-pass-fulldeps/proc-macro/negative-token.rs +++ b/src/test/run-pass-fulldeps/proc-macro/negative-token.rs @@ -11,7 +11,7 @@ // aux-build:negative-token.rs // ignore-stage1 -#![feature(proc_macro)] +#![feature(proc_macro, proc_macro_non_items)] extern crate negative_token; diff --git a/src/test/run-pass-fulldeps/proc_macro.rs b/src/test/run-pass-fulldeps/proc_macro.rs index cdda723585b7a..aad94c89f2ae3 100644 --- a/src/test/run-pass-fulldeps/proc_macro.rs +++ b/src/test/run-pass-fulldeps/proc_macro.rs @@ -12,7 +12,7 @@ // ignore-stage1 // ignore-cross-compile -#![feature(proc_macro)] +#![feature(proc_macro, proc_macro_non_items)] extern crate proc_macro_def; diff --git a/src/test/run-pass/hygiene/issue-47311.rs b/src/test/run-pass/hygiene/issue-47311.rs index 3b6890cdce63b..c4391ad05778a 100644 --- a/src/test/run-pass/hygiene/issue-47311.rs +++ b/src/test/run-pass/hygiene/issue-47311.rs @@ -10,7 +10,7 @@ // ignore-pretty pretty-printing is unhygienic -#![feature(decl_macro)] +#![feature(decl_macro, proc_macro_path_invoc)] #![allow(unused)] macro m($S:ident, $x:ident) { diff --git a/src/test/run-pass/hygiene/issue-47312.rs b/src/test/run-pass/hygiene/issue-47312.rs index 5e83f3808d8cc..0cda0e7c7cce7 100644 --- a/src/test/run-pass/hygiene/issue-47312.rs +++ b/src/test/run-pass/hygiene/issue-47312.rs @@ -10,7 +10,7 @@ // ignore-pretty pretty-printing is unhygienic -#![feature(decl_macro)] +#![feature(decl_macro, proc_macro_path_invoc)] #![allow(unused)] mod foo { diff --git a/src/test/run-pass/hygiene/legacy_interaction.rs b/src/test/run-pass/hygiene/legacy_interaction.rs index 683a15b99aebe..5395ef3588282 100644 --- a/src/test/run-pass/hygiene/legacy_interaction.rs +++ b/src/test/run-pass/hygiene/legacy_interaction.rs @@ -12,7 +12,7 @@ // aux-build:legacy_interaction.rs -#![feature(decl_macro)] +#![feature(decl_macro, proc_macro_path_invoc)] #[allow(unused)] extern crate legacy_interaction; diff --git a/src/test/run-pass/hygiene/lexical.rs b/src/test/run-pass/hygiene/lexical.rs index cb02a17fec38a..73deda0777e50 100644 --- a/src/test/run-pass/hygiene/lexical.rs +++ b/src/test/run-pass/hygiene/lexical.rs @@ -10,7 +10,7 @@ // ignore-pretty pretty-printing is unhygienic -#![feature(decl_macro)] +#![feature(decl_macro, proc_macro_path_invoc)] mod bar { mod baz { diff --git a/src/test/run-pass/hygiene/wrap_unhygienic_example.rs b/src/test/run-pass/hygiene/wrap_unhygienic_example.rs index 5520695021438..66e83eb7cacd5 100644 --- a/src/test/run-pass/hygiene/wrap_unhygienic_example.rs +++ b/src/test/run-pass/hygiene/wrap_unhygienic_example.rs @@ -13,7 +13,7 @@ // aux-build:my_crate.rs // aux-build:unhygienic_example.rs -#![feature(decl_macro)] +#![feature(decl_macro, proc_macro_path_invoc)] extern crate unhygienic_example; extern crate my_crate; // (b) diff --git a/src/test/run-pass/hygiene/xcrate.rs b/src/test/run-pass/hygiene/xcrate.rs index 6df3a34d3c87f..95d7ae6db60ff 100644 --- a/src/test/run-pass/hygiene/xcrate.rs +++ b/src/test/run-pass/hygiene/xcrate.rs @@ -12,7 +12,7 @@ // aux-build:xcrate.rs -#![feature(decl_macro)] +#![feature(decl_macro, proc_macro_path_invoc)] extern crate xcrate; diff --git a/src/test/run-pass/paths-in-macro-invocations.rs b/src/test/run-pass/paths-in-macro-invocations.rs index 69f8906778a16..2e87809a84ec5 100644 --- a/src/test/run-pass/paths-in-macro-invocations.rs +++ b/src/test/run-pass/paths-in-macro-invocations.rs @@ -10,7 +10,7 @@ // aux-build:two_macros.rs -#![feature(use_extern_macros)] +#![feature(use_extern_macros, proc_macro_path_invoc)] extern crate two_macros; diff --git a/src/test/ui-fulldeps/proc-macro/parent-source-spans.rs b/src/test/ui-fulldeps/proc-macro/parent-source-spans.rs index 4c71afbac4df1..f938700e5157a 100644 --- a/src/test/ui-fulldeps/proc-macro/parent-source-spans.rs +++ b/src/test/ui-fulldeps/proc-macro/parent-source-spans.rs @@ -11,7 +11,7 @@ // aux-build:parent-source-spans.rs // ignore-stage1 -#![feature(proc_macro, decl_macro)] +#![feature(proc_macro, decl_macro, proc_macro_non_items)] extern crate parent_source_spans; diff --git a/src/test/ui-fulldeps/proc-macro/three-equals.rs b/src/test/ui-fulldeps/proc-macro/three-equals.rs index ef2d160529068..66e34afcb13f9 100644 --- a/src/test/ui-fulldeps/proc-macro/three-equals.rs +++ b/src/test/ui-fulldeps/proc-macro/three-equals.rs @@ -11,7 +11,7 @@ // aux-build:three-equals.rs // ignore-stage1 -#![feature(proc_macro)] +#![feature(proc_macro, proc_macro_non_items)] extern crate three_equals; diff --git a/src/test/ui/hygiene/fields.rs b/src/test/ui/hygiene/fields.rs index 64217770b13c9..ed155b28037a0 100644 --- a/src/test/ui/hygiene/fields.rs +++ b/src/test/ui/hygiene/fields.rs @@ -10,7 +10,7 @@ // ignore-pretty pretty-printing is unhygienic -#![feature(decl_macro)] +#![feature(decl_macro, proc_macro_path_invoc)] mod foo { struct S { x: u32 } diff --git a/src/test/ui/hygiene/globs.rs b/src/test/ui/hygiene/globs.rs index 7ba217061c66e..f3f400aafeb2b 100644 --- a/src/test/ui/hygiene/globs.rs +++ b/src/test/ui/hygiene/globs.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(decl_macro)] +#![feature(decl_macro, proc_macro_path_invoc)] mod foo { pub fn f() {} diff --git a/src/test/ui/hygiene/impl_items.rs b/src/test/ui/hygiene/impl_items.rs index cdba559445d19..4f997a790e688 100644 --- a/src/test/ui/hygiene/impl_items.rs +++ b/src/test/ui/hygiene/impl_items.rs @@ -10,7 +10,7 @@ // ignore-pretty pretty-printing is unhygienic -#![feature(decl_macro)] +#![feature(decl_macro, proc_macro_path_invoc)] mod foo { struct S; diff --git a/src/test/ui/hygiene/intercrate.rs b/src/test/ui/hygiene/intercrate.rs index 50fc985ba34fa..20ca918f026f3 100644 --- a/src/test/ui/hygiene/intercrate.rs +++ b/src/test/ui/hygiene/intercrate.rs @@ -14,7 +14,7 @@ // error-pattern:type `fn() -> u32 {intercrate::foo::bar::f}` is private -#![feature(decl_macro)] +#![feature(decl_macro, proc_macro_path_invoc)] extern crate intercrate; diff --git a/src/test/ui/hygiene/no_implicit_prelude.rs b/src/test/ui/hygiene/no_implicit_prelude.rs index c90c7b3093c9f..ea6a45fba6ac7 100644 --- a/src/test/ui/hygiene/no_implicit_prelude.rs +++ b/src/test/ui/hygiene/no_implicit_prelude.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(decl_macro)] +#![feature(decl_macro, proc_macro_path_invoc)] mod foo { pub macro m() { Vec::new(); ().clone() } diff --git a/src/test/ui/hygiene/privacy.rs b/src/test/ui/hygiene/privacy.rs index 987cad187d428..8a392db92f960 100644 --- a/src/test/ui/hygiene/privacy.rs +++ b/src/test/ui/hygiene/privacy.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(decl_macro)] +#![feature(decl_macro, proc_macro_path_invoc)] mod foo { fn f() {} diff --git a/src/test/ui/hygiene/trait_items.rs b/src/test/ui/hygiene/trait_items.rs index 3bd19cbc0ac67..d0da6254b9bd0 100644 --- a/src/test/ui/hygiene/trait_items.rs +++ b/src/test/ui/hygiene/trait_items.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(decl_macro)] +#![feature(decl_macro, proc_macro_path_invoc)] mod foo { pub trait T { diff --git a/src/test/ui/imports/macro-paths.rs b/src/test/ui/imports/macro-paths.rs index e709eeee14a84..51e5257be1bc2 100644 --- a/src/test/ui/imports/macro-paths.rs +++ b/src/test/ui/imports/macro-paths.rs @@ -10,7 +10,7 @@ // aux-build:two_macros.rs -#![feature(use_extern_macros)] +#![feature(use_extern_macros, proc_macro_path_invoc)] extern crate two_macros; diff --git a/src/test/ui/imports/shadow_builtin_macros.rs b/src/test/ui/imports/shadow_builtin_macros.rs index 93de136c4051d..aad0a43be2696 100644 --- a/src/test/ui/imports/shadow_builtin_macros.rs +++ b/src/test/ui/imports/shadow_builtin_macros.rs @@ -10,7 +10,7 @@ // aux-build:two_macros.rs -#![feature(use_extern_macros)] +#![feature(use_extern_macros, proc_macro_path_invoc)] mod foo { extern crate two_macros;