]> git.lizzy.rs Git - rust.git/commitdiff
Move former compile-fail-fulldeps tests to ui
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>
Sun, 2 Dec 2018 19:27:37 +0000 (22:27 +0300)
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>
Sun, 9 Dec 2018 16:56:30 +0000 (19:56 +0300)
127 files changed:
src/test/compile-fail/proc-macro/attr-invalid-exprs.rs [deleted file]
src/test/compile-fail/proc-macro/attr-stmt-expr.rs [deleted file]
src/test/compile-fail/proc-macro/attribute-with-error.rs [deleted file]
src/test/compile-fail/proc-macro/attribute.rs [deleted file]
src/test/compile-fail/proc-macro/attributes-included.rs [deleted file]
src/test/compile-fail/proc-macro/auxiliary/attr-stmt-expr.rs [deleted file]
src/test/compile-fail/proc-macro/auxiliary/attribute-with-error.rs [deleted file]
src/test/compile-fail/proc-macro/auxiliary/attributes-included.rs [deleted file]
src/test/compile-fail/proc-macro/auxiliary/bang_proc_macro2.rs [deleted file]
src/test/compile-fail/proc-macro/auxiliary/derive-a-b.rs [deleted file]
src/test/compile-fail/proc-macro/auxiliary/derive-a.rs [deleted file]
src/test/compile-fail/proc-macro/auxiliary/derive-b.rs [deleted file]
src/test/compile-fail/proc-macro/auxiliary/derive-bad.rs [deleted file]
src/test/compile-fail/proc-macro/auxiliary/derive-clona.rs [deleted file]
src/test/compile-fail/proc-macro/auxiliary/derive-foo.rs [deleted file]
src/test/compile-fail/proc-macro/auxiliary/derive-unstable-2.rs [deleted file]
src/test/compile-fail/proc-macro/auxiliary/derive-unstable.rs [deleted file]
src/test/compile-fail/proc-macro/auxiliary/issue-41211.rs [deleted file]
src/test/compile-fail/proc-macro/auxiliary/issue_38586.rs [deleted file]
src/test/compile-fail/proc-macro/auxiliary/issue_50493.rs [deleted file]
src/test/compile-fail/proc-macro/auxiliary/more-gates.rs [deleted file]
src/test/compile-fail/proc-macro/auxiliary/proc-macro-gates.rs [deleted file]
src/test/compile-fail/proc-macro/auxiliary/test-macros.rs [deleted file]
src/test/compile-fail/proc-macro/define-two.rs [deleted file]
src/test/compile-fail/proc-macro/derive-bad.rs [deleted file]
src/test/compile-fail/proc-macro/derive-still-gated.rs [deleted file]
src/test/compile-fail/proc-macro/expand-to-unstable-2.rs [deleted file]
src/test/compile-fail/proc-macro/expand-to-unstable.rs [deleted file]
src/test/compile-fail/proc-macro/export-macro.rs [deleted file]
src/test/compile-fail/proc-macro/exports.rs [deleted file]
src/test/compile-fail/proc-macro/illegal-proc-macro-derive-use.rs [deleted file]
src/test/compile-fail/proc-macro/import.rs [deleted file]
src/test/compile-fail/proc-macro/issue-37788.rs [deleted file]
src/test/compile-fail/proc-macro/issue-38586.rs [deleted file]
src/test/compile-fail/proc-macro/issue-41211.rs [deleted file]
src/test/compile-fail/proc-macro/issue-50493.rs [deleted file]
src/test/compile-fail/proc-macro/item-error.rs [deleted file]
src/test/compile-fail/proc-macro/lints_in_proc_macros.rs [deleted file]
src/test/compile-fail/proc-macro/macros-in-extern.rs [deleted file]
src/test/compile-fail/proc-macro/more-gates.rs [deleted file]
src/test/compile-fail/proc-macro/no-macro-use-attr.rs [deleted file]
src/test/compile-fail/proc-macro/proc-macro-attributes.rs [deleted file]
src/test/compile-fail/proc-macro/proc-macro-gates.rs [deleted file]
src/test/compile-fail/proc-macro/proc-macro-gates2.rs [deleted file]
src/test/compile-fail/proc-macro/pub-at-crate-root.rs [deleted file]
src/test/compile-fail/proc-macro/shadow-builtin.rs [deleted file]
src/test/compile-fail/proc-macro/shadow.rs [deleted file]
src/test/compile-fail/proc-macro/two-crate-types-1.rs [deleted file]
src/test/compile-fail/proc-macro/two-crate-types-2.rs [deleted file]
src/test/ui/proc-macro/attr-invalid-exprs.rs [new file with mode: 0644]
src/test/ui/proc-macro/attr-invalid-exprs.stderr [new file with mode: 0644]
src/test/ui/proc-macro/attr-stmt-expr.rs [new file with mode: 0644]
src/test/ui/proc-macro/attr-stmt-expr.stderr [new file with mode: 0644]
src/test/ui/proc-macro/attribute-with-error.rs [new file with mode: 0644]
src/test/ui/proc-macro/attribute-with-error.stderr [new file with mode: 0644]
src/test/ui/proc-macro/attribute.rs [new file with mode: 0644]
src/test/ui/proc-macro/attribute.stderr [new file with mode: 0644]
src/test/ui/proc-macro/attributes-included.rs [new file with mode: 0644]
src/test/ui/proc-macro/attributes-included.stderr [new file with mode: 0644]
src/test/ui/proc-macro/auxiliary/attr-stmt-expr.rs [new file with mode: 0644]
src/test/ui/proc-macro/auxiliary/attribute-with-error.rs [new file with mode: 0644]
src/test/ui/proc-macro/auxiliary/attributes-included.rs [new file with mode: 0644]
src/test/ui/proc-macro/auxiliary/bang_proc_macro2.rs [new file with mode: 0644]
src/test/ui/proc-macro/auxiliary/derive-a-b.rs [new file with mode: 0644]
src/test/ui/proc-macro/auxiliary/derive-a.rs [new file with mode: 0644]
src/test/ui/proc-macro/auxiliary/derive-b.rs [new file with mode: 0644]
src/test/ui/proc-macro/auxiliary/derive-bad.rs [new file with mode: 0644]
src/test/ui/proc-macro/auxiliary/derive-unstable-2.rs [new file with mode: 0644]
src/test/ui/proc-macro/auxiliary/derive-unstable.rs [new file with mode: 0644]
src/test/ui/proc-macro/auxiliary/issue-41211.rs [new file with mode: 0644]
src/test/ui/proc-macro/auxiliary/issue_38586.rs [new file with mode: 0644]
src/test/ui/proc-macro/auxiliary/issue_50493.rs [new file with mode: 0644]
src/test/ui/proc-macro/auxiliary/more-gates.rs [new file with mode: 0644]
src/test/ui/proc-macro/auxiliary/proc-macro-gates.rs [new file with mode: 0644]
src/test/ui/proc-macro/auxiliary/test-macros.rs [new file with mode: 0644]
src/test/ui/proc-macro/define-two.rs [new file with mode: 0644]
src/test/ui/proc-macro/define-two.stderr [new file with mode: 0644]
src/test/ui/proc-macro/derive-bad.rs [new file with mode: 0644]
src/test/ui/proc-macro/derive-bad.stderr [new file with mode: 0644]
src/test/ui/proc-macro/derive-still-gated.rs [new file with mode: 0644]
src/test/ui/proc-macro/derive-still-gated.stderr [new file with mode: 0644]
src/test/ui/proc-macro/expand-to-unstable-2.rs [new file with mode: 0644]
src/test/ui/proc-macro/expand-to-unstable-2.stderr [new file with mode: 0644]
src/test/ui/proc-macro/expand-to-unstable.rs [new file with mode: 0644]
src/test/ui/proc-macro/expand-to-unstable.stderr [new file with mode: 0644]
src/test/ui/proc-macro/export-macro.rs [new file with mode: 0644]
src/test/ui/proc-macro/export-macro.stderr [new file with mode: 0644]
src/test/ui/proc-macro/exports.rs [new file with mode: 0644]
src/test/ui/proc-macro/exports.stderr [new file with mode: 0644]
src/test/ui/proc-macro/illegal-proc-macro-derive-use.rs [new file with mode: 0644]
src/test/ui/proc-macro/illegal-proc-macro-derive-use.stderr [new file with mode: 0644]
src/test/ui/proc-macro/import.rs [new file with mode: 0644]
src/test/ui/proc-macro/import.stderr [new file with mode: 0644]
src/test/ui/proc-macro/issue-37788.rs [new file with mode: 0644]
src/test/ui/proc-macro/issue-37788.stderr [new file with mode: 0644]
src/test/ui/proc-macro/issue-38586.rs [new file with mode: 0644]
src/test/ui/proc-macro/issue-38586.stderr [new file with mode: 0644]
src/test/ui/proc-macro/issue-41211.rs [new file with mode: 0644]
src/test/ui/proc-macro/issue-41211.stderr [new file with mode: 0644]
src/test/ui/proc-macro/issue-50493.rs [new file with mode: 0644]
src/test/ui/proc-macro/issue-50493.stderr [new file with mode: 0644]
src/test/ui/proc-macro/item-error.rs [new file with mode: 0644]
src/test/ui/proc-macro/item-error.stderr [new file with mode: 0644]
src/test/ui/proc-macro/lints_in_proc_macros.rs [new file with mode: 0644]
src/test/ui/proc-macro/lints_in_proc_macros.stderr [new file with mode: 0644]
src/test/ui/proc-macro/macros-in-extern.rs [new file with mode: 0644]
src/test/ui/proc-macro/macros-in-extern.stderr [new file with mode: 0644]
src/test/ui/proc-macro/more-gates.rs [new file with mode: 0644]
src/test/ui/proc-macro/more-gates.stderr [new file with mode: 0644]
src/test/ui/proc-macro/no-macro-use-attr.rs [new file with mode: 0644]
src/test/ui/proc-macro/no-macro-use-attr.stderr [new file with mode: 0644]
src/test/ui/proc-macro/proc-macro-attributes.rs [new file with mode: 0644]
src/test/ui/proc-macro/proc-macro-attributes.stderr [new file with mode: 0644]
src/test/ui/proc-macro/proc-macro-gates.rs [new file with mode: 0644]
src/test/ui/proc-macro/proc-macro-gates.stderr [new file with mode: 0644]
src/test/ui/proc-macro/proc-macro-gates2.rs [new file with mode: 0644]
src/test/ui/proc-macro/proc-macro-gates2.stderr [new file with mode: 0644]
src/test/ui/proc-macro/pub-at-crate-root.rs [new file with mode: 0644]
src/test/ui/proc-macro/pub-at-crate-root.stderr [new file with mode: 0644]
src/test/ui/proc-macro/shadow-builtin.rs [new file with mode: 0644]
src/test/ui/proc-macro/shadow-builtin.stderr [new file with mode: 0644]
src/test/ui/proc-macro/shadow.rs [new file with mode: 0644]
src/test/ui/proc-macro/shadow.stderr [new file with mode: 0644]
src/test/ui/proc-macro/two-crate-types-1.rs [new file with mode: 0644]
src/test/ui/proc-macro/two-crate-types-1.stderr [new file with mode: 0644]
src/test/ui/proc-macro/two-crate-types-2.rs [new file with mode: 0644]
src/test/ui/proc-macro/two-crate-types-2.stderr [new file with mode: 0644]

diff --git a/src/test/compile-fail/proc-macro/attr-invalid-exprs.rs b/src/test/compile-fail/proc-macro/attr-invalid-exprs.rs
deleted file mode 100644 (file)
index 798cd14..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-// 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 <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:attr-stmt-expr.rs
-
-//! Attributes producing expressions in invalid locations
-
-#![feature(stmt_expr_attributes, proc_macro_hygiene)]
-
-extern crate attr_stmt_expr;
-use attr_stmt_expr::{duplicate, no_output};
-
-fn main() {
-    let _ = #[no_output] "Hello, world!";
-    //~^ ERROR expected expression, found `<eof>`
-
-    let _ = #[duplicate] "Hello, world!";
-    //~^ ERROR macro expansion ignores token `,` and any following
-
-    let _ = {
-        #[no_output]
-        "Hello, world!"
-    };
-
-    let _ = {
-        #[duplicate]
-        //~^ ERROR macro expansion ignores token `,` and any following
-        "Hello, world!"
-    };
-}
diff --git a/src/test/compile-fail/proc-macro/attr-stmt-expr.rs b/src/test/compile-fail/proc-macro/attr-stmt-expr.rs
deleted file mode 100644 (file)
index 6d1d5df..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-// 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 <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:attr-stmt-expr.rs
-
-#![feature(proc_macro_hygiene)]
-
-extern crate attr_stmt_expr;
-use attr_stmt_expr::{expect_let, expect_print_stmt, expect_expr, expect_print_expr};
-
-fn print_str(string: &'static str) {
-    // macros are handled a bit differently
-    #[expect_print_expr]
-    //~^ ERROR attributes on expressions are experimental
-    //~| HELP add #![feature(stmt_expr_attributes)] to the crate attributes to enable
-    println!("{}", string)
-}
-
-fn main() {
-    #[expect_let]
-    let string = "Hello, world!";
-
-    #[expect_print_stmt]
-    println!("{}", string);
-
-    #[expect_expr]
-    //~^ ERROR attributes on expressions are experimental
-    //~| HELP add #![feature(stmt_expr_attributes)] to the crate attributes to enable
-    print_str("string")
-}
diff --git a/src/test/compile-fail/proc-macro/attribute-with-error.rs b/src/test/compile-fail/proc-macro/attribute-with-error.rs
deleted file mode 100644 (file)
index ed2e8ec..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright 2017 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:attribute-with-error.rs
-
-#![feature(custom_inner_attributes)]
-
-extern crate attribute_with_error;
-
-use attribute_with_error::foo;
-
-#[foo]
-fn test1() {
-    let a: i32 = "foo";
-    //~^ ERROR: mismatched types
-    let b: i32 = "f'oo";
-    //~^ ERROR: mismatched types
-}
-
-fn test2() {
-    #![foo]
-
-    // FIXME: should have a type error here and assert it works but it doesn't
-}
-
-trait A {
-    // FIXME: should have a #[foo] attribute here and assert that it works
-    fn foo(&self) {
-        let a: i32 = "foo";
-        //~^ ERROR: mismatched types
-    }
-}
-
-struct B;
-
-impl A for B {
-    #[foo]
-    fn foo(&self) {
-        let a: i32 = "foo";
-        //~^ ERROR: mismatched types
-    }
-}
-
-#[foo]
-fn main() {
-}
diff --git a/src/test/compile-fail/proc-macro/attribute.rs b/src/test/compile-fail/proc-macro/attribute.rs
deleted file mode 100644 (file)
index f89d74d..0000000
+++ /dev/null
@@ -1,66 +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.
-
-// force-host
-// no-prefer-dynamic
-
-#![crate_type = "proc-macro"]
-
-extern crate proc_macro;
-
-#[proc_macro_derive]
-//~^ ERROR: attribute must be of form: #[proc_macro_derive(TraitName)]
-pub fn foo1(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
-    input
-}
-
-#[proc_macro_derive = "foo"]
-//~^ ERROR: attribute must be of form: #[proc_macro_derive(TraitName)]
-pub fn foo2(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
-    input
-}
-
-#[proc_macro_derive(
-    a = "b"
-)]
-//~^^ ERROR: must only be one word
-pub fn foo3(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
-    input
-}
-
-#[proc_macro_derive(b, c, d)]
-//~^ ERROR: attribute must have either one or two arguments
-pub fn foo4(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
-    input
-}
-
-#[proc_macro_derive(d(e))]
-//~^ ERROR: must only be one word
-pub fn foo5(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
-    input
-}
-
-#[proc_macro_derive(f, attributes(g = "h"))]
-//~^ ERROR: must only be one word
-pub fn foo6(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
-    input
-}
-
-#[proc_macro_derive(i, attributes(j(k)))]
-//~^ ERROR: must only be one word
-pub fn foo7(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
-    input
-}
-
-#[proc_macro_derive(l, attributes(m), n)]
-//~^ ERROR: attribute must have either one or two arguments
-pub fn foo8(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
-    input
-}
diff --git a/src/test/compile-fail/proc-macro/attributes-included.rs b/src/test/compile-fail/proc-macro/attributes-included.rs
deleted file mode 100644 (file)
index e129711..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright 2017 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:attributes-included.rs
-// compile-pass
-
-#![warn(unused)]
-
-extern crate attributes_included;
-
-use attributes_included::*;
-
-#[bar]
-#[inline]
-/// doc
-#[foo]
-#[inline]
-/// doc
-fn foo() {
-    let a: i32 = "foo"; //~ WARN: unused variable
-}
-
-fn main() {
-    foo()
-}
diff --git a/src/test/compile-fail/proc-macro/auxiliary/attr-stmt-expr.rs b/src/test/compile-fail/proc-macro/auxiliary/attr-stmt-expr.rs
deleted file mode 100644 (file)
index 4cfeec2..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-// 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 <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.
-
-// force-host
-// no-prefer-dynamic
-
-#![crate_type = "proc-macro"]
-
-extern crate proc_macro;
-
-use proc_macro::TokenStream;
-
-#[proc_macro_attribute]
-pub fn expect_let(attr: TokenStream, item: TokenStream) -> TokenStream {
-    assert!(attr.to_string().is_empty());
-    assert_eq!(item.to_string(), "let string = \"Hello, world!\";");
-    item
-}
-
-#[proc_macro_attribute]
-pub fn expect_print_stmt(attr: TokenStream, item: TokenStream) -> TokenStream {
-    assert!(attr.to_string().is_empty());
-    assert_eq!(item.to_string(), "println!(\"{}\" , string);");
-    item
-}
-
-#[proc_macro_attribute]
-pub fn expect_expr(attr: TokenStream, item: TokenStream) -> TokenStream {
-    assert!(attr.to_string().is_empty());
-    assert_eq!(item.to_string(), "print_str(\"string\")");
-    item
-}
-
-#[proc_macro_attribute]
-pub fn expect_print_expr(attr: TokenStream, item: TokenStream) -> TokenStream {
-    assert!(attr.to_string().is_empty());
-    assert_eq!(item.to_string(), "println!(\"{}\" , string)");
-    item
-}
-
-#[proc_macro_attribute]
-pub fn duplicate(attr: TokenStream, item: TokenStream) -> TokenStream {
-    assert!(attr.to_string().is_empty());
-    format!("{}, {}", item, item).parse().unwrap()
-}
-
-#[proc_macro_attribute]
-pub fn no_output(attr: TokenStream, item: TokenStream) -> TokenStream {
-    assert!(attr.to_string().is_empty());
-    assert!(!item.to_string().is_empty());
-    "".parse().unwrap()
-}
diff --git a/src/test/compile-fail/proc-macro/auxiliary/attribute-with-error.rs b/src/test/compile-fail/proc-macro/auxiliary/attribute-with-error.rs
deleted file mode 100644 (file)
index 1428409..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2017 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.
-
-// force-host
-// no-prefer-dynamic
-
-#![crate_type = "proc-macro"]
-
-extern crate proc_macro;
-
-use proc_macro::TokenStream;
-
-#[proc_macro_attribute]
-pub fn foo(_attr: TokenStream, input: TokenStream) -> TokenStream {
-    input.into_iter().collect()
-}
diff --git a/src/test/compile-fail/proc-macro/auxiliary/attributes-included.rs b/src/test/compile-fail/proc-macro/auxiliary/attributes-included.rs
deleted file mode 100644 (file)
index a1f4209..0000000
+++ /dev/null
@@ -1,160 +0,0 @@
-// Copyright 2017 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.
-
-// force-host
-// no-prefer-dynamic
-
-#![crate_type = "proc-macro"]
-
-extern crate proc_macro;
-
-use proc_macro::{TokenStream, TokenTree, Delimiter, Literal, Spacing, Group};
-
-#[proc_macro_attribute]
-pub fn foo(attr: TokenStream, input: TokenStream) -> TokenStream {
-    assert!(attr.is_empty());
-    let input = input.into_iter().collect::<Vec<_>>();
-    {
-        let mut cursor = &input[..];
-        assert_inline(&mut cursor);
-        assert_doc(&mut cursor);
-        assert_inline(&mut cursor);
-        assert_doc(&mut cursor);
-        assert_foo(&mut cursor);
-        assert!(cursor.is_empty());
-    }
-    fold_stream(input.into_iter().collect())
-}
-
-#[proc_macro_attribute]
-pub fn bar(attr: TokenStream, input: TokenStream) -> TokenStream {
-    assert!(attr.is_empty());
-    let input = input.into_iter().collect::<Vec<_>>();
-    {
-        let mut cursor = &input[..];
-        assert_inline(&mut cursor);
-        assert_doc(&mut cursor);
-        assert_invoc(&mut cursor);
-        assert_inline(&mut cursor);
-        assert_doc(&mut cursor);
-        assert_foo(&mut cursor);
-        assert!(cursor.is_empty());
-    }
-    input.into_iter().collect()
-}
-
-fn assert_inline(slice: &mut &[TokenTree]) {
-    match &slice[0] {
-        TokenTree::Punct(tt) => assert_eq!(tt.as_char(), '#'),
-        _ => panic!("expected '#' char"),
-    }
-    match &slice[1] {
-        TokenTree::Group(tt) => assert_eq!(tt.delimiter(), Delimiter::Bracket),
-        _ => panic!("expected brackets"),
-    }
-    *slice = &slice[2..];
-}
-
-fn assert_doc(slice: &mut &[TokenTree]) {
-    match &slice[0] {
-        TokenTree::Punct(tt) => {
-            assert_eq!(tt.as_char(), '#');
-            assert_eq!(tt.spacing(), Spacing::Alone);
-        }
-        _ => panic!("expected #"),
-    }
-    let inner = match &slice[1] {
-        TokenTree::Group(tt) => {
-            assert_eq!(tt.delimiter(), Delimiter::Bracket);
-            tt.stream()
-        }
-        _ => panic!("expected brackets"),
-    };
-    let tokens = inner.into_iter().collect::<Vec<_>>();
-    let tokens = &tokens[..];
-
-    if tokens.len() != 3 {
-        panic!("expected three tokens in doc")
-    }
-
-    match &tokens[0] {
-        TokenTree::Ident(tt) => assert_eq!("doc", &*tt.to_string()),
-        _ => panic!("expected `doc`"),
-    }
-    match &tokens[1] {
-        TokenTree::Punct(tt) => {
-            assert_eq!(tt.as_char(), '=');
-            assert_eq!(tt.spacing(), Spacing::Alone);
-        }
-        _ => panic!("expected equals"),
-    }
-    match tokens[2] {
-        TokenTree::Literal(_) => {}
-        _ => panic!("expected literal"),
-    }
-
-    *slice = &slice[2..];
-}
-
-fn assert_invoc(slice: &mut &[TokenTree]) {
-    match &slice[0] {
-        TokenTree::Punct(tt) => assert_eq!(tt.as_char(), '#'),
-        _ => panic!("expected '#' char"),
-    }
-    match &slice[1] {
-        TokenTree::Group(tt) => assert_eq!(tt.delimiter(), Delimiter::Bracket),
-        _ => panic!("expected brackets"),
-    }
-    *slice = &slice[2..];
-}
-
-fn assert_foo(slice: &mut &[TokenTree]) {
-    match &slice[0] {
-        TokenTree::Ident(tt) => assert_eq!(&*tt.to_string(), "fn"),
-        _ => panic!("expected fn"),
-    }
-    match &slice[1] {
-        TokenTree::Ident(tt) => assert_eq!(&*tt.to_string(), "foo"),
-        _ => panic!("expected foo"),
-    }
-    match &slice[2] {
-        TokenTree::Group(tt) => {
-            assert_eq!(tt.delimiter(), Delimiter::Parenthesis);
-            assert!(tt.stream().is_empty());
-        }
-        _ => panic!("expected parens"),
-    }
-    match &slice[3] {
-        TokenTree::Group(tt) => assert_eq!(tt.delimiter(), Delimiter::Brace),
-        _ => panic!("expected braces"),
-    }
-    *slice = &slice[4..];
-}
-
-fn fold_stream(input: TokenStream) -> TokenStream {
-    input.into_iter().map(fold_tree).collect()
-}
-
-fn fold_tree(input: TokenTree) -> TokenTree {
-    match input {
-        TokenTree::Group(b) => {
-            TokenTree::Group(Group::new(b.delimiter(), fold_stream(b.stream())))
-        }
-        TokenTree::Punct(b) => TokenTree::Punct(b),
-        TokenTree::Ident(a) => TokenTree::Ident(a),
-        TokenTree::Literal(a) => {
-            if a.to_string() != "\"foo\"" {
-                TokenTree::Literal(a)
-            } else {
-                TokenTree::Literal(Literal::i32_unsuffixed(3))
-            }
-        }
-    }
-}
diff --git a/src/test/compile-fail/proc-macro/auxiliary/bang_proc_macro2.rs b/src/test/compile-fail/proc-macro/auxiliary/bang_proc_macro2.rs
deleted file mode 100644 (file)
index 3f0a457..0000000
+++ /dev/null
@@ -1,23 +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.
-
-// force-host
-// no-prefer-dynamic
-
-#![crate_type = "proc-macro"]
-
-extern crate proc_macro;
-
-use proc_macro::TokenStream;
-
-#[proc_macro]
-pub fn bang_proc_macro2(_: TokenStream) -> TokenStream {
-    "let x = foobar2;".parse().unwrap()
-}
diff --git a/src/test/compile-fail/proc-macro/auxiliary/derive-a-b.rs b/src/test/compile-fail/proc-macro/auxiliary/derive-a-b.rs
deleted file mode 100644 (file)
index cd8750b..0000000
+++ /dev/null
@@ -1,27 +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.
-
-// force-host
-// no-prefer-dynamic
-
-#![crate_type = "proc-macro"]
-
-extern crate proc_macro;
-use proc_macro::TokenStream;
-
-#[proc_macro_derive(A)]
-pub fn derive_a(_: TokenStream) -> TokenStream {
-    "".parse().unwrap()
-}
-
-#[proc_macro_derive(B)]
-pub fn derive_b(_: TokenStream) -> TokenStream {
-    "".parse().unwrap()
-}
diff --git a/src/test/compile-fail/proc-macro/auxiliary/derive-a.rs b/src/test/compile-fail/proc-macro/auxiliary/derive-a.rs
deleted file mode 100644 (file)
index 53b2c23..0000000
+++ /dev/null
@@ -1,23 +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.
-
-// force-host
-// no-prefer-dynamic
-
-#![crate_type = "proc-macro"]
-
-extern crate proc_macro;
-
-use proc_macro::TokenStream;
-
-#[proc_macro_derive(A)]
-pub fn derive_a(input: TokenStream) -> TokenStream {
-    "".parse().unwrap()
-}
diff --git a/src/test/compile-fail/proc-macro/auxiliary/derive-b.rs b/src/test/compile-fail/proc-macro/auxiliary/derive-b.rs
deleted file mode 100644 (file)
index 5787546..0000000
+++ /dev/null
@@ -1,23 +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.
-
-// force-host
-// no-prefer-dynamic
-
-#![crate_type = "proc-macro"]
-
-extern crate proc_macro;
-
-use proc_macro::TokenStream;
-
-#[proc_macro_derive(B, attributes(B))]
-pub fn derive_b(input: TokenStream) -> TokenStream {
-    "".parse().unwrap()
-}
diff --git a/src/test/compile-fail/proc-macro/auxiliary/derive-bad.rs b/src/test/compile-fail/proc-macro/auxiliary/derive-bad.rs
deleted file mode 100644 (file)
index b2ded05..0000000
+++ /dev/null
@@ -1,24 +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.
-
-// force-host
-// no-prefer-dynamic
-
-#![crate_type = "proc-macro"]
-
-extern crate proc_macro;
-
-use proc_macro::TokenStream;
-
-#[proc_macro_derive(A)]
-pub fn derive_a(_input: TokenStream) -> TokenStream {
-    "struct A { inner }".parse().unwrap()
-}
-
diff --git a/src/test/compile-fail/proc-macro/auxiliary/derive-clona.rs b/src/test/compile-fail/proc-macro/auxiliary/derive-clona.rs
deleted file mode 100644 (file)
index 719fbdb..0000000
+++ /dev/null
@@ -1,23 +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.
-
-// force-host
-// no-prefer-dynamic
-
-#![crate_type = "proc-macro"]
-
-extern crate proc_macro;
-
-use proc_macro::TokenStream;
-
-#[proc_macro_derive(Clona)]
-pub fn derive_clonea(input: TokenStream) -> TokenStream {
-    "".parse().unwrap()
-}
diff --git a/src/test/compile-fail/proc-macro/auxiliary/derive-foo.rs b/src/test/compile-fail/proc-macro/auxiliary/derive-foo.rs
deleted file mode 100644 (file)
index 64dcf72..0000000
+++ /dev/null
@@ -1,23 +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.
-
-// force-host
-// no-prefer-dynamic
-
-#![crate_type = "proc-macro"]
-
-extern crate proc_macro;
-
-use proc_macro::TokenStream;
-
-#[proc_macro_derive(FooWithLongName)]
-pub fn derive_foo(input: TokenStream) -> TokenStream {
-    "".parse().unwrap()
-}
diff --git a/src/test/compile-fail/proc-macro/auxiliary/derive-unstable-2.rs b/src/test/compile-fail/proc-macro/auxiliary/derive-unstable-2.rs
deleted file mode 100644 (file)
index 2d492d3..0000000
+++ /dev/null
@@ -1,27 +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.
-
-// force-host
-// no-prefer-dynamic
-
-#![crate_type = "proc-macro"]
-
-extern crate proc_macro;
-
-use proc_macro::TokenStream;
-
-#[proc_macro_derive(Unstable)]
-pub fn derive(_input: TokenStream) -> TokenStream {
-
-    "
-        #[rustc_foo]
-        fn foo() {}
-    ".parse().unwrap()
-}
diff --git a/src/test/compile-fail/proc-macro/auxiliary/derive-unstable.rs b/src/test/compile-fail/proc-macro/auxiliary/derive-unstable.rs
deleted file mode 100644 (file)
index a7b5d1e..0000000
+++ /dev/null
@@ -1,24 +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.
-
-// force-host
-// no-prefer-dynamic
-
-#![crate_type = "proc-macro"]
-
-extern crate proc_macro;
-
-use proc_macro::TokenStream;
-
-#[proc_macro_derive(Unstable)]
-pub fn derive(_input: TokenStream) -> TokenStream {
-
-    "unsafe fn foo() -> u32 { ::std::intrinsics::init() }".parse().unwrap()
-}
diff --git a/src/test/compile-fail/proc-macro/auxiliary/issue-41211.rs b/src/test/compile-fail/proc-macro/auxiliary/issue-41211.rs
deleted file mode 100644 (file)
index 5365e82..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2017 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.
-
-// force-host
-// no-prefer-dynamic
-
-#![crate_type = "proc-macro"]
-
-extern crate proc_macro;
-use proc_macro::TokenStream;
-
-#[proc_macro_attribute]
-pub fn emit_unchanged(_args: TokenStream, input: TokenStream) -> TokenStream {
-    input
-}
diff --git a/src/test/compile-fail/proc-macro/auxiliary/issue_38586.rs b/src/test/compile-fail/proc-macro/auxiliary/issue_38586.rs
deleted file mode 100644 (file)
index e1a7ffa..0000000
+++ /dev/null
@@ -1,21 +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.
-
-// force-host
-// no-prefer-dynamic
-
-#![crate_type = "proc-macro"]
-
-extern crate proc_macro;
-
-#[proc_macro_derive(A)]
-pub fn derive_a(_: proc_macro::TokenStream) -> proc_macro::TokenStream {
-    "fn f() { println!(\"{}\", foo); }".parse().unwrap()
-}
diff --git a/src/test/compile-fail/proc-macro/auxiliary/issue_50493.rs b/src/test/compile-fail/proc-macro/auxiliary/issue_50493.rs
deleted file mode 100644 (file)
index e71b792..0000000
+++ /dev/null
@@ -1,31 +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.
-
-// force-host
-// no-prefer-dynamic
-
-#![crate_type = "proc-macro"]
-
-extern crate proc_macro;
-use proc_macro::TokenStream;
-
-#[proc_macro_derive(Derive)]
-pub fn derive(_: TokenStream) -> TokenStream {
-    let code = "
-        fn one(r: Restricted) {
-            r.field;
-        }
-        fn two(r: Restricted) {
-            r.field;
-        }
-    ";
-
-    code.parse().unwrap()
-}
diff --git a/src/test/compile-fail/proc-macro/auxiliary/more-gates.rs b/src/test/compile-fail/proc-macro/auxiliary/more-gates.rs
deleted file mode 100644 (file)
index cc9420e..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-// 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 <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.
-
-// force-host
-// no-prefer-dynamic
-
-#![crate_type = "proc-macro"]
-
-extern crate proc_macro;
-
-use proc_macro::*;
-
-#[proc_macro_attribute]
-pub fn attr2mac1(_: TokenStream, _: TokenStream) -> TokenStream {
-    "macro_rules! foo1 { (a) => (a) }".parse().unwrap()
-}
-
-#[proc_macro_attribute]
-pub fn attr2mac2(_: TokenStream, _: TokenStream) -> TokenStream {
-    "macro foo2(a) { a }".parse().unwrap()
-}
-
-#[proc_macro]
-pub fn mac2mac1(_: TokenStream) -> TokenStream {
-    "macro_rules! foo3 { (a) => (a) }".parse().unwrap()
-}
-
-#[proc_macro]
-pub fn mac2mac2(_: TokenStream) -> TokenStream {
-    "macro foo4(a) { a }".parse().unwrap()
-}
-
-#[proc_macro]
-pub fn tricky(_: TokenStream) -> TokenStream {
-    "fn foo() {
-        macro_rules! foo { (a) => (a) }
-    }".parse().unwrap()
-}
diff --git a/src/test/compile-fail/proc-macro/auxiliary/proc-macro-gates.rs b/src/test/compile-fail/proc-macro/auxiliary/proc-macro-gates.rs
deleted file mode 100644 (file)
index 7e4b7fe..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-// 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 <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.
-
-// force-host
-// no-prefer-dynamic
-
-#![crate_type = "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/proc-macro/auxiliary/test-macros.rs b/src/test/compile-fail/proc-macro/auxiliary/test-macros.rs
deleted file mode 100644 (file)
index 0e4343a..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-// 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 <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.
-
-// force-host
-// no-prefer-dynamic
-
-#![crate_type = "proc-macro"]
-
-extern crate proc_macro;
-
-use proc_macro::TokenStream;
-
-#[proc_macro_attribute]
-pub fn nop_attr(_attr: TokenStream, input: TokenStream) -> TokenStream {
-    assert!(_attr.to_string().is_empty());
-    input
-}
-
-#[proc_macro_attribute]
-pub fn no_output(_attr: TokenStream, _input: TokenStream) -> TokenStream {
-    assert!(_attr.to_string().is_empty());
-    assert!(!_input.to_string().is_empty());
-    "".parse().unwrap()
-}
-
-#[proc_macro]
-pub fn emit_input(input: TokenStream) -> TokenStream {
-    input
-}
diff --git a/src/test/compile-fail/proc-macro/define-two.rs b/src/test/compile-fail/proc-macro/define-two.rs
deleted file mode 100644 (file)
index f8c287b..0000000
+++ /dev/null
@@ -1,28 +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.
-
-// force-host
-// no-prefer-dynamic
-
-#![crate_type = "proc-macro"]
-
-extern crate proc_macro;
-
-use proc_macro::TokenStream;
-
-#[proc_macro_derive(A)]
-pub fn foo(input: TokenStream) -> TokenStream {
-    input
-}
-
-#[proc_macro_derive(A)] //~ ERROR the name `A` is defined multiple times
-pub fn bar(input: TokenStream) -> TokenStream {
-    input
-}
diff --git a/src/test/compile-fail/proc-macro/derive-bad.rs b/src/test/compile-fail/proc-macro/derive-bad.rs
deleted file mode 100644 (file)
index ac27e87..0000000
+++ /dev/null
@@ -1,23 +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-bad.rs
-
-#[macro_use]
-extern crate derive_bad;
-
-#[derive(
-    A
-)]
-//~^^ ERROR proc-macro derive produced unparseable tokens
-//~| ERROR expected `:`, found `}`
-struct A;
-
-fn main() {}
diff --git a/src/test/compile-fail/proc-macro/derive-still-gated.rs b/src/test/compile-fail/proc-macro/derive-still-gated.rs
deleted file mode 100644 (file)
index edf5cc7..0000000
+++ /dev/null
@@ -1,21 +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
-
-#![allow(warnings)]
-
-#[macro_use]
-extern crate derive_a;
-
-#[derive_A] //~ ERROR attribute `derive_A` is currently unknown
-struct A;
-
-fn main() {}
diff --git a/src/test/compile-fail/proc-macro/expand-to-unstable-2.rs b/src/test/compile-fail/proc-macro/expand-to-unstable-2.rs
deleted file mode 100644 (file)
index e4fcbb1..0000000
+++ /dev/null
@@ -1,24 +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-unstable-2.rs
-
-#![allow(warnings)]
-
-#[macro_use]
-extern crate derive_unstable_2;
-
-#[derive(Unstable)]
-//~^ ERROR: reserved for internal compiler
-struct A;
-
-fn main() {
-    foo();
-}
diff --git a/src/test/compile-fail/proc-macro/expand-to-unstable.rs b/src/test/compile-fail/proc-macro/expand-to-unstable.rs
deleted file mode 100644 (file)
index 836e336..0000000
+++ /dev/null
@@ -1,24 +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-unstable.rs
-
-#![allow(warnings)]
-
-#[macro_use]
-extern crate derive_unstable;
-
-#[derive(Unstable)]
-//~^ ERROR: use of unstable library feature
-struct A;
-
-fn main() {
-    unsafe { foo(); }
-}
diff --git a/src/test/compile-fail/proc-macro/export-macro.rs b/src/test/compile-fail/proc-macro/export-macro.rs
deleted file mode 100644 (file)
index d8bb357..0000000
+++ /dev/null
@@ -1,21 +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: cannot export macro_rules! macros from a `proc-macro` crate
-
-// force-host
-// no-prefer-dynamic
-
-#![crate_type = "proc-macro"]
-
-#[macro_export]
-macro_rules! foo {
-    ($e:expr) => ($e)
-}
diff --git a/src/test/compile-fail/proc-macro/exports.rs b/src/test/compile-fail/proc-macro/exports.rs
deleted file mode 100644 (file)
index 07e5723..0000000
+++ /dev/null
@@ -1,25 +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.
-
-// force-host
-// no-prefer-dynamic
-
-#![crate_type = "proc-macro"]
-#![allow(warnings)]
-
-pub fn a() {} //~ ERROR: cannot export any items
-pub struct B; //~ ERROR: cannot export any items
-pub enum C {} //~ ERROR: cannot export any items
-pub mod d {} //~ ERROR: cannot export any items
-
-mod e {}
-struct F;
-enum G {}
-fn h() {}
diff --git a/src/test/compile-fail/proc-macro/illegal-proc-macro-derive-use.rs b/src/test/compile-fail/proc-macro/illegal-proc-macro-derive-use.rs
deleted file mode 100644 (file)
index f37980c..0000000
+++ /dev/null
@@ -1,25 +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;
-
-#[proc_macro_derive(Foo)]
-//~^ ERROR: only usable with crates of the `proc-macro` crate type
-pub fn foo(a: proc_macro::TokenStream) -> proc_macro::TokenStream {
-    a
-}
-
-// Issue #37590
-#[proc_macro_derive(Foo)]
-//~^ ERROR: the `#[proc_macro_derive]` attribute may only be used on bare functions
-pub struct Foo {
-}
-
-fn main() {}
diff --git a/src/test/compile-fail/proc-macro/import.rs b/src/test/compile-fail/proc-macro/import.rs
deleted file mode 100644 (file)
index fae2439..0000000
+++ /dev/null
@@ -1,21 +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
-
-#![allow(warnings)]
-
-#[macro_use]
-extern crate derive_a;
-
-use derive_a::derive_a;
-//~^ ERROR: unresolved import `derive_a::derive_a`
-
-fn main() {}
diff --git a/src/test/compile-fail/proc-macro/issue-37788.rs b/src/test/compile-fail/proc-macro/issue-37788.rs
deleted file mode 100644 (file)
index 691c280..0000000
+++ /dev/null
@@ -1,19 +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-b.rs
-
-#[macro_use]
-extern crate derive_a_b;
-
-fn main() {
-    // Test that constructing the `visible_parent_map` (in `cstore_impl.rs`) does not ICE.
-    std::cell::Cell::new(0) //~ ERROR mismatched types
-}
diff --git a/src/test/compile-fail/proc-macro/issue-38586.rs b/src/test/compile-fail/proc-macro/issue-38586.rs
deleted file mode 100644 (file)
index 649220a..0000000
+++ /dev/null
@@ -1,19 +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:issue_38586.rs
-
-#[macro_use]
-extern crate issue_38586;
-
-#[derive(A)] //~ ERROR `foo`
-struct A;
-
-fn main() {}
diff --git a/src/test/compile-fail/proc-macro/issue-41211.rs b/src/test/compile-fail/proc-macro/issue-41211.rs
deleted file mode 100644 (file)
index e0922c4..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2017 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:issue-41211.rs
-
-// FIXME: https://github.com/rust-lang/rust/issues/41430
-// This is a temporary regression test for the ICE reported in #41211
-
-#![feature(custom_inner_attributes)]
-
-#![emit_unchanged]
-//~^ ERROR attribute `emit_unchanged` is currently unknown to the compiler
-extern crate issue_41211;
-use issue_41211::emit_unchanged;
-
-fn main() {}
diff --git a/src/test/compile-fail/proc-macro/issue-50493.rs b/src/test/compile-fail/proc-macro/issue-50493.rs
deleted file mode 100644 (file)
index 635da57..0000000
+++ /dev/null
@@ -1,24 +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:issue_50493.rs
-
-#[macro_use]
-extern crate issue_50493;
-
-#[derive(Derive)] //~ ERROR field `field` of struct `Restricted` is private
-struct Restricted {
-    pub(in restricted) field: usize, //~ visibilities can only be restricted to ancestor modules
-}
-
-mod restricted {}
-
-fn main() {}
-
diff --git a/src/test/compile-fail/proc-macro/item-error.rs b/src/test/compile-fail/proc-macro/item-error.rs
deleted file mode 100644 (file)
index 4133e75..0000000
+++ /dev/null
@@ -1,25 +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-b.rs
-
-#![allow(warnings)]
-
-#[macro_use]
-extern crate derive_b;
-
-#[derive(B)]
-struct A {
-    a: &u64
-//~^ ERROR: missing lifetime specifier
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/proc-macro/lints_in_proc_macros.rs b/src/test/compile-fail/proc-macro/lints_in_proc_macros.rs
deleted file mode 100644 (file)
index d49c612..0000000
+++ /dev/null
@@ -1,26 +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:bang_proc_macro2.rs
-
-#![feature(proc_macro_hygiene)]
-#![allow(unused_macros)]
-
-extern crate bang_proc_macro2;
-
-use bang_proc_macro2::bang_proc_macro2;
-
-fn main() {
-    let foobar = 42;
-    bang_proc_macro2!();
-    //~^ ERROR cannot find value `foobar2` in this scope
-    //~^^ did you mean `foobar`?
-    println!("{}", x);
-}
diff --git a/src/test/compile-fail/proc-macro/macros-in-extern.rs b/src/test/compile-fail/proc-macro/macros-in-extern.rs
deleted file mode 100644 (file)
index 43d7077..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-// 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 <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:test-macros.rs
-// ignore-wasm32
-
-extern crate test_macros;
-
-use test_macros::{nop_attr, no_output, emit_input};
-
-fn main() {
-    assert_eq!(unsafe { rust_get_test_int() }, 0isize);
-    assert_eq!(unsafe { rust_dbg_extern_identity_u32(0xDEADBEEF) }, 0xDEADBEEF);
-}
-
-#[link(name = "rust_test_helpers", kind = "static")]
-extern {
-    #[no_output]
-    //~^ ERROR macro invocations in `extern {}` blocks are experimental
-    fn some_definitely_unknown_symbol_which_should_be_removed();
-
-    #[nop_attr]
-    //~^ ERROR macro invocations in `extern {}` blocks are experimental
-    fn rust_get_test_int() -> isize;
-
-    emit_input!(fn rust_dbg_extern_identity_u32(arg: u32) -> u32;);
-    //~^ ERROR macro invocations in `extern {}` blocks are experimental
-}
diff --git a/src/test/compile-fail/proc-macro/more-gates.rs b/src/test/compile-fail/proc-macro/more-gates.rs
deleted file mode 100644 (file)
index 4c03817..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-// 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 <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:more-gates.rs
-
-extern crate more_gates as foo;
-
-use foo::*;
-
-#[attr2mac1]
-//~^ ERROR: cannot expand to macro definitions
-pub fn a() {}
-#[attr2mac2]
-//~^ ERROR: cannot expand to macro definitions
-pub fn a() {}
-
-mac2mac1!(); //~ ERROR: cannot expand to macro definitions
-mac2mac2!(); //~ ERROR: cannot expand to macro definitions
-
-tricky!();
-//~^ ERROR: cannot expand to macro definitions
-
-fn main() {}
diff --git a/src/test/compile-fail/proc-macro/no-macro-use-attr.rs b/src/test/compile-fail/proc-macro/no-macro-use-attr.rs
deleted file mode 100644 (file)
index ab05ca2..0000000
+++ /dev/null
@@ -1,20 +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
-
-#![feature(rustc_attrs)]
-#![warn(unused_extern_crates)]
-
-extern crate derive_a;
-//~^ WARN unused extern crate
-
-#[rustc_error]
-fn main() {} //~ ERROR compilation successful
diff --git a/src/test/compile-fail/proc-macro/proc-macro-attributes.rs b/src/test/compile-fail/proc-macro/proc-macro-attributes.rs
deleted file mode 100644 (file)
index 6e52411..0000000
+++ /dev/null
@@ -1,24 +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-b.rs
-
-#[macro_use]
-extern crate derive_b;
-
-#[B]
-#[C] //~ ERROR attribute `C` is currently unknown to the compiler
-#[B(D)]
-#[B(E = "foo")]
-#[B(arbitrary tokens)]
-#[derive(B)]
-struct B;
-
-fn main() {}
diff --git a/src/test/compile-fail/proc-macro/proc-macro-gates.rs b/src/test/compile-fail/proc-macro/proc-macro-gates.rs
deleted file mode 100644 (file)
index 5049a47..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-// 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 <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:proc-macro-gates.rs
-// gate-test-proc_macro_hygiene
-
-#![feature(stmt_expr_attributes)]
-
-extern crate proc_macro_gates as foo;
-
-use foo::*;
-
-fn _test_inner() {
-    #![a] //~ ERROR: non-builtin inner attributes are unstable
-}
-
-#[a] //~ ERROR: custom attributes cannot be applied to modules
-mod _test2 {}
-
-mod _test2_inner {
-    #![a] //~ ERROR: custom attributes cannot be applied to modules
-          //~| ERROR: non-builtin inner attributes are unstable
-}
-
-#[a = y] //~ ERROR: must only be followed by a delimiter token
-fn _test3() {}
-
-fn attrs() {
-    // Statement, item
-    #[a] // OK
-    struct S;
-
-    // Statement, macro
-    #[a] //~ ERROR: custom attributes cannot be applied to statements
-    println!();
-
-    // Statement, semi
-    #[a] //~ ERROR: custom attributes cannot be applied to statements
-    S;
-
-    // Statement, local
-    #[a] //~ ERROR: custom attributes cannot be applied to statements
-    let _x = 2;
-
-    // Expr
-    let _x = #[a] 2; //~ ERROR: custom attributes cannot be applied to expressions
-
-    // Opt expr
-    let _x = [#[a] 2]; //~ ERROR: custom attributes cannot be applied to expressions
-
-    // Expr macro
-    let _x = #[a] println!(); //~ ERROR: custom attributes cannot be applied to expressions
-}
-
-fn main() {
-    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
-
-    m!(struct S;); //~ ERROR: procedural macros cannot be expanded to statements
-    m!(let _x = 3;); //~ ERROR: procedural macros cannot be expanded to statements
-
-    let _x = m!(3); //~ ERROR: procedural macros cannot be expanded to expressions
-    let _x = [m!(3)]; //~ ERROR: procedural macros cannot be expanded to expressions
-}
diff --git a/src/test/compile-fail/proc-macro/proc-macro-gates2.rs b/src/test/compile-fail/proc-macro/proc-macro-gates2.rs
deleted file mode 100644 (file)
index dc18241..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-// 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 <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:proc-macro-gates.rs
-
-#![feature(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/proc-macro/pub-at-crate-root.rs b/src/test/compile-fail/proc-macro/pub-at-crate-root.rs
deleted file mode 100644 (file)
index e995eb5..0000000
+++ /dev/null
@@ -1,32 +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.
-
-// force-host
-// no-prefer-dynamic
-
-#![crate_type = "proc-macro"]
-
-extern crate proc_macro;
-
-pub mod a { //~ `proc-macro` crate types cannot export any items
-    use proc_macro::TokenStream;
-
-    #[proc_macro_derive(B)]
-    pub fn bar(a: TokenStream) -> TokenStream {
-    //~^ ERROR: must currently reside in the root of the crate
-        a
-    }
-}
-
-#[proc_macro_derive(B)]
-fn bar(a: proc_macro::TokenStream) -> proc_macro::TokenStream {
-//~^ ERROR: functions tagged with `#[proc_macro_derive]` must be `pub`
-    a
-}
diff --git a/src/test/compile-fail/proc-macro/shadow-builtin.rs b/src/test/compile-fail/proc-macro/shadow-builtin.rs
deleted file mode 100644 (file)
index a5fcfde..0000000
+++ /dev/null
@@ -1,24 +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.
-
-// force-host
-// no-prefer-dynamic
-
-#![crate_type = "proc-macro"]
-
-extern crate proc_macro;
-
-use proc_macro::TokenStream;
-
-#[proc_macro_derive(PartialEq)]
-//~^ ERROR: cannot override a built-in #[derive] mode
-pub fn foo(input: TokenStream) -> TokenStream {
-    input
-}
diff --git a/src/test/compile-fail/proc-macro/shadow.rs b/src/test/compile-fail/proc-macro/shadow.rs
deleted file mode 100644 (file)
index 9bff1c5..0000000
+++ /dev/null
@@ -1,18 +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;
-#[macro_use]
-extern crate derive_a; //~ ERROR the name `derive_a` is defined multiple times
-
-fn main() {}
diff --git a/src/test/compile-fail/proc-macro/two-crate-types-1.rs b/src/test/compile-fail/proc-macro/two-crate-types-1.rs
deleted file mode 100644 (file)
index 06bd3f9..0000000
+++ /dev/null
@@ -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.
-
-// error-pattern: cannot mix `proc-macro` crate type with others
-
-// force-host
-// no-prefer-dynamic
-
-#![crate_type = "proc-macro"]
-#![crate_type = "rlib"]
diff --git a/src/test/compile-fail/proc-macro/two-crate-types-2.rs b/src/test/compile-fail/proc-macro/two-crate-types-2.rs
deleted file mode 100644 (file)
index dd5e5ac..0000000
+++ /dev/null
@@ -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: cannot mix `proc-macro` crate type with others
-// compile-flags: --crate-type rlib --crate-type proc-macro
-// force-host
diff --git a/src/test/ui/proc-macro/attr-invalid-exprs.rs b/src/test/ui/proc-macro/attr-invalid-exprs.rs
new file mode 100644 (file)
index 0000000..798cd14
--- /dev/null
@@ -0,0 +1,37 @@
+// 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 <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:attr-stmt-expr.rs
+
+//! Attributes producing expressions in invalid locations
+
+#![feature(stmt_expr_attributes, proc_macro_hygiene)]
+
+extern crate attr_stmt_expr;
+use attr_stmt_expr::{duplicate, no_output};
+
+fn main() {
+    let _ = #[no_output] "Hello, world!";
+    //~^ ERROR expected expression, found `<eof>`
+
+    let _ = #[duplicate] "Hello, world!";
+    //~^ ERROR macro expansion ignores token `,` and any following
+
+    let _ = {
+        #[no_output]
+        "Hello, world!"
+    };
+
+    let _ = {
+        #[duplicate]
+        //~^ ERROR macro expansion ignores token `,` and any following
+        "Hello, world!"
+    };
+}
diff --git a/src/test/ui/proc-macro/attr-invalid-exprs.stderr b/src/test/ui/proc-macro/attr-invalid-exprs.stderr
new file mode 100644 (file)
index 0000000..c28def6
--- /dev/null
@@ -0,0 +1,28 @@
+error: expected expression, found `<eof>`
+  --> $DIR/attr-invalid-exprs.rs:21:13
+   |
+LL |     let _ = #[no_output] "Hello, world!";
+   |             ^^^^^^^^^^^^
+
+error: macro expansion ignores token `,` and any following
+  --> $DIR/attr-invalid-exprs.rs:24:13
+   |
+LL |     let _ = #[duplicate] "Hello, world!";
+   |             ^^^^^^^^^^^^- help: you might be missing a semicolon here: `;`
+   |             |
+   |             caused by the macro expansion here
+   |
+   = note: the usage of `duplicate!` is likely invalid in expression context
+
+error: macro expansion ignores token `,` and any following
+  --> $DIR/attr-invalid-exprs.rs:33:9
+   |
+LL |         #[duplicate]
+   |         ^^^^^^^^^^^^- help: you might be missing a semicolon here: `;`
+   |         |
+   |         caused by the macro expansion here
+   |
+   = note: the usage of `duplicate!` is likely invalid in expression context
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/ui/proc-macro/attr-stmt-expr.rs b/src/test/ui/proc-macro/attr-stmt-expr.rs
new file mode 100644 (file)
index 0000000..6d1d5df
--- /dev/null
@@ -0,0 +1,37 @@
+// 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 <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:attr-stmt-expr.rs
+
+#![feature(proc_macro_hygiene)]
+
+extern crate attr_stmt_expr;
+use attr_stmt_expr::{expect_let, expect_print_stmt, expect_expr, expect_print_expr};
+
+fn print_str(string: &'static str) {
+    // macros are handled a bit differently
+    #[expect_print_expr]
+    //~^ ERROR attributes on expressions are experimental
+    //~| HELP add #![feature(stmt_expr_attributes)] to the crate attributes to enable
+    println!("{}", string)
+}
+
+fn main() {
+    #[expect_let]
+    let string = "Hello, world!";
+
+    #[expect_print_stmt]
+    println!("{}", string);
+
+    #[expect_expr]
+    //~^ ERROR attributes on expressions are experimental
+    //~| HELP add #![feature(stmt_expr_attributes)] to the crate attributes to enable
+    print_str("string")
+}
diff --git a/src/test/ui/proc-macro/attr-stmt-expr.stderr b/src/test/ui/proc-macro/attr-stmt-expr.stderr
new file mode 100644 (file)
index 0000000..ee9bc77
--- /dev/null
@@ -0,0 +1,19 @@
+error[E0658]: attributes on expressions are experimental. (see issue #15701)
+  --> $DIR/attr-stmt-expr.rs:20:5
+   |
+LL |     #[expect_print_expr]
+   |     ^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable
+
+error[E0658]: attributes on expressions are experimental. (see issue #15701)
+  --> $DIR/attr-stmt-expr.rs:33:5
+   |
+LL |     #[expect_expr]
+   |     ^^^^^^^^^^^^^^
+   |
+   = help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/proc-macro/attribute-with-error.rs b/src/test/ui/proc-macro/attribute-with-error.rs
new file mode 100644 (file)
index 0000000..ed2e8ec
--- /dev/null
@@ -0,0 +1,53 @@
+// Copyright 2017 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:attribute-with-error.rs
+
+#![feature(custom_inner_attributes)]
+
+extern crate attribute_with_error;
+
+use attribute_with_error::foo;
+
+#[foo]
+fn test1() {
+    let a: i32 = "foo";
+    //~^ ERROR: mismatched types
+    let b: i32 = "f'oo";
+    //~^ ERROR: mismatched types
+}
+
+fn test2() {
+    #![foo]
+
+    // FIXME: should have a type error here and assert it works but it doesn't
+}
+
+trait A {
+    // FIXME: should have a #[foo] attribute here and assert that it works
+    fn foo(&self) {
+        let a: i32 = "foo";
+        //~^ ERROR: mismatched types
+    }
+}
+
+struct B;
+
+impl A for B {
+    #[foo]
+    fn foo(&self) {
+        let a: i32 = "foo";
+        //~^ ERROR: mismatched types
+    }
+}
+
+#[foo]
+fn main() {
+}
diff --git a/src/test/ui/proc-macro/attribute-with-error.stderr b/src/test/ui/proc-macro/attribute-with-error.stderr
new file mode 100644 (file)
index 0000000..d2b4ac6
--- /dev/null
@@ -0,0 +1,39 @@
+error[E0308]: mismatched types
+  --> $DIR/attribute-with-error.rs:21:18
+   |
+LL |     let a: i32 = "foo";
+   |                  ^^^^^ expected i32, found reference
+   |
+   = note: expected type `i32`
+              found type `&'static str`
+
+error[E0308]: mismatched types
+  --> $DIR/attribute-with-error.rs:23:18
+   |
+LL |     let b: i32 = "f'oo";
+   |                  ^^^^^^ expected i32, found reference
+   |
+   = note: expected type `i32`
+              found type `&'static str`
+
+error[E0308]: mismatched types
+  --> $DIR/attribute-with-error.rs:36:22
+   |
+LL |         let a: i32 = "foo";
+   |                      ^^^^^ expected i32, found reference
+   |
+   = note: expected type `i32`
+              found type `&'static str`
+
+error[E0308]: mismatched types
+  --> $DIR/attribute-with-error.rs:46:22
+   |
+LL |         let a: i32 = "foo";
+   |                      ^^^^^ expected i32, found reference
+   |
+   = note: expected type `i32`
+              found type `&'static str`
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/proc-macro/attribute.rs b/src/test/ui/proc-macro/attribute.rs
new file mode 100644 (file)
index 0000000..f89d74d
--- /dev/null
@@ -0,0 +1,66 @@
+// 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.
+
+// force-host
+// no-prefer-dynamic
+
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+
+#[proc_macro_derive]
+//~^ ERROR: attribute must be of form: #[proc_macro_derive(TraitName)]
+pub fn foo1(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
+    input
+}
+
+#[proc_macro_derive = "foo"]
+//~^ ERROR: attribute must be of form: #[proc_macro_derive(TraitName)]
+pub fn foo2(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
+    input
+}
+
+#[proc_macro_derive(
+    a = "b"
+)]
+//~^^ ERROR: must only be one word
+pub fn foo3(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
+    input
+}
+
+#[proc_macro_derive(b, c, d)]
+//~^ ERROR: attribute must have either one or two arguments
+pub fn foo4(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
+    input
+}
+
+#[proc_macro_derive(d(e))]
+//~^ ERROR: must only be one word
+pub fn foo5(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
+    input
+}
+
+#[proc_macro_derive(f, attributes(g = "h"))]
+//~^ ERROR: must only be one word
+pub fn foo6(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
+    input
+}
+
+#[proc_macro_derive(i, attributes(j(k)))]
+//~^ ERROR: must only be one word
+pub fn foo7(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
+    input
+}
+
+#[proc_macro_derive(l, attributes(m), n)]
+//~^ ERROR: attribute must have either one or two arguments
+pub fn foo8(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
+    input
+}
diff --git a/src/test/ui/proc-macro/attribute.stderr b/src/test/ui/proc-macro/attribute.stderr
new file mode 100644 (file)
index 0000000..c752c53
--- /dev/null
@@ -0,0 +1,50 @@
+error: attribute must be of form: #[proc_macro_derive(TraitName)]
+  --> $DIR/attribute.rs:18:1
+   |
+LL | #[proc_macro_derive]
+   | ^^^^^^^^^^^^^^^^^^^^
+
+error: attribute must be of form: #[proc_macro_derive(TraitName)]
+  --> $DIR/attribute.rs:24:1
+   |
+LL | #[proc_macro_derive = "foo"]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: must only be one word
+  --> $DIR/attribute.rs:31:5
+   |
+LL |     a = "b"
+   |     ^^^^^^^
+
+error: attribute must have either one or two arguments
+  --> $DIR/attribute.rs:38:1
+   |
+LL | #[proc_macro_derive(b, c, d)]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: must only be one word
+  --> $DIR/attribute.rs:44:21
+   |
+LL | #[proc_macro_derive(d(e))]
+   |                     ^^^^
+
+error: must only be one word
+  --> $DIR/attribute.rs:50:35
+   |
+LL | #[proc_macro_derive(f, attributes(g = "h"))]
+   |                                   ^^^^^^^
+
+error: must only be one word
+  --> $DIR/attribute.rs:56:35
+   |
+LL | #[proc_macro_derive(i, attributes(j(k)))]
+   |                                   ^^^^
+
+error: attribute must have either one or two arguments
+  --> $DIR/attribute.rs:62:1
+   |
+LL | #[proc_macro_derive(l, attributes(m), n)]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 8 previous errors
+
diff --git a/src/test/ui/proc-macro/attributes-included.rs b/src/test/ui/proc-macro/attributes-included.rs
new file mode 100644 (file)
index 0000000..e129711
--- /dev/null
@@ -0,0 +1,32 @@
+// Copyright 2017 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:attributes-included.rs
+// compile-pass
+
+#![warn(unused)]
+
+extern crate attributes_included;
+
+use attributes_included::*;
+
+#[bar]
+#[inline]
+/// doc
+#[foo]
+#[inline]
+/// doc
+fn foo() {
+    let a: i32 = "foo"; //~ WARN: unused variable
+}
+
+fn main() {
+    foo()
+}
diff --git a/src/test/ui/proc-macro/attributes-included.stderr b/src/test/ui/proc-macro/attributes-included.stderr
new file mode 100644 (file)
index 0000000..e7eeccc
--- /dev/null
@@ -0,0 +1,13 @@
+warning: unused variable: `a`
+  --> $DIR/attributes-included.rs:27:9
+   |
+LL |     let a: i32 = "foo"; //~ WARN: unused variable
+   |         ^ help: consider using `_a` instead
+   |
+note: lint level defined here
+  --> $DIR/attributes-included.rs:14:9
+   |
+LL | #![warn(unused)]
+   |         ^^^^^^
+   = note: #[warn(unused_variables)] implied by #[warn(unused)]
+
diff --git a/src/test/ui/proc-macro/auxiliary/attr-stmt-expr.rs b/src/test/ui/proc-macro/auxiliary/attr-stmt-expr.rs
new file mode 100644 (file)
index 0000000..4cfeec2
--- /dev/null
@@ -0,0 +1,59 @@
+// 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 <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.
+
+// force-host
+// no-prefer-dynamic
+
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+
+use proc_macro::TokenStream;
+
+#[proc_macro_attribute]
+pub fn expect_let(attr: TokenStream, item: TokenStream) -> TokenStream {
+    assert!(attr.to_string().is_empty());
+    assert_eq!(item.to_string(), "let string = \"Hello, world!\";");
+    item
+}
+
+#[proc_macro_attribute]
+pub fn expect_print_stmt(attr: TokenStream, item: TokenStream) -> TokenStream {
+    assert!(attr.to_string().is_empty());
+    assert_eq!(item.to_string(), "println!(\"{}\" , string);");
+    item
+}
+
+#[proc_macro_attribute]
+pub fn expect_expr(attr: TokenStream, item: TokenStream) -> TokenStream {
+    assert!(attr.to_string().is_empty());
+    assert_eq!(item.to_string(), "print_str(\"string\")");
+    item
+}
+
+#[proc_macro_attribute]
+pub fn expect_print_expr(attr: TokenStream, item: TokenStream) -> TokenStream {
+    assert!(attr.to_string().is_empty());
+    assert_eq!(item.to_string(), "println!(\"{}\" , string)");
+    item
+}
+
+#[proc_macro_attribute]
+pub fn duplicate(attr: TokenStream, item: TokenStream) -> TokenStream {
+    assert!(attr.to_string().is_empty());
+    format!("{}, {}", item, item).parse().unwrap()
+}
+
+#[proc_macro_attribute]
+pub fn no_output(attr: TokenStream, item: TokenStream) -> TokenStream {
+    assert!(attr.to_string().is_empty());
+    assert!(!item.to_string().is_empty());
+    "".parse().unwrap()
+}
diff --git a/src/test/ui/proc-macro/auxiliary/attribute-with-error.rs b/src/test/ui/proc-macro/auxiliary/attribute-with-error.rs
new file mode 100644 (file)
index 0000000..1428409
--- /dev/null
@@ -0,0 +1,23 @@
+// Copyright 2017 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.
+
+// force-host
+// no-prefer-dynamic
+
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+
+use proc_macro::TokenStream;
+
+#[proc_macro_attribute]
+pub fn foo(_attr: TokenStream, input: TokenStream) -> TokenStream {
+    input.into_iter().collect()
+}
diff --git a/src/test/ui/proc-macro/auxiliary/attributes-included.rs b/src/test/ui/proc-macro/auxiliary/attributes-included.rs
new file mode 100644 (file)
index 0000000..a1f4209
--- /dev/null
@@ -0,0 +1,160 @@
+// Copyright 2017 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.
+
+// force-host
+// no-prefer-dynamic
+
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+
+use proc_macro::{TokenStream, TokenTree, Delimiter, Literal, Spacing, Group};
+
+#[proc_macro_attribute]
+pub fn foo(attr: TokenStream, input: TokenStream) -> TokenStream {
+    assert!(attr.is_empty());
+    let input = input.into_iter().collect::<Vec<_>>();
+    {
+        let mut cursor = &input[..];
+        assert_inline(&mut cursor);
+        assert_doc(&mut cursor);
+        assert_inline(&mut cursor);
+        assert_doc(&mut cursor);
+        assert_foo(&mut cursor);
+        assert!(cursor.is_empty());
+    }
+    fold_stream(input.into_iter().collect())
+}
+
+#[proc_macro_attribute]
+pub fn bar(attr: TokenStream, input: TokenStream) -> TokenStream {
+    assert!(attr.is_empty());
+    let input = input.into_iter().collect::<Vec<_>>();
+    {
+        let mut cursor = &input[..];
+        assert_inline(&mut cursor);
+        assert_doc(&mut cursor);
+        assert_invoc(&mut cursor);
+        assert_inline(&mut cursor);
+        assert_doc(&mut cursor);
+        assert_foo(&mut cursor);
+        assert!(cursor.is_empty());
+    }
+    input.into_iter().collect()
+}
+
+fn assert_inline(slice: &mut &[TokenTree]) {
+    match &slice[0] {
+        TokenTree::Punct(tt) => assert_eq!(tt.as_char(), '#'),
+        _ => panic!("expected '#' char"),
+    }
+    match &slice[1] {
+        TokenTree::Group(tt) => assert_eq!(tt.delimiter(), Delimiter::Bracket),
+        _ => panic!("expected brackets"),
+    }
+    *slice = &slice[2..];
+}
+
+fn assert_doc(slice: &mut &[TokenTree]) {
+    match &slice[0] {
+        TokenTree::Punct(tt) => {
+            assert_eq!(tt.as_char(), '#');
+            assert_eq!(tt.spacing(), Spacing::Alone);
+        }
+        _ => panic!("expected #"),
+    }
+    let inner = match &slice[1] {
+        TokenTree::Group(tt) => {
+            assert_eq!(tt.delimiter(), Delimiter::Bracket);
+            tt.stream()
+        }
+        _ => panic!("expected brackets"),
+    };
+    let tokens = inner.into_iter().collect::<Vec<_>>();
+    let tokens = &tokens[..];
+
+    if tokens.len() != 3 {
+        panic!("expected three tokens in doc")
+    }
+
+    match &tokens[0] {
+        TokenTree::Ident(tt) => assert_eq!("doc", &*tt.to_string()),
+        _ => panic!("expected `doc`"),
+    }
+    match &tokens[1] {
+        TokenTree::Punct(tt) => {
+            assert_eq!(tt.as_char(), '=');
+            assert_eq!(tt.spacing(), Spacing::Alone);
+        }
+        _ => panic!("expected equals"),
+    }
+    match tokens[2] {
+        TokenTree::Literal(_) => {}
+        _ => panic!("expected literal"),
+    }
+
+    *slice = &slice[2..];
+}
+
+fn assert_invoc(slice: &mut &[TokenTree]) {
+    match &slice[0] {
+        TokenTree::Punct(tt) => assert_eq!(tt.as_char(), '#'),
+        _ => panic!("expected '#' char"),
+    }
+    match &slice[1] {
+        TokenTree::Group(tt) => assert_eq!(tt.delimiter(), Delimiter::Bracket),
+        _ => panic!("expected brackets"),
+    }
+    *slice = &slice[2..];
+}
+
+fn assert_foo(slice: &mut &[TokenTree]) {
+    match &slice[0] {
+        TokenTree::Ident(tt) => assert_eq!(&*tt.to_string(), "fn"),
+        _ => panic!("expected fn"),
+    }
+    match &slice[1] {
+        TokenTree::Ident(tt) => assert_eq!(&*tt.to_string(), "foo"),
+        _ => panic!("expected foo"),
+    }
+    match &slice[2] {
+        TokenTree::Group(tt) => {
+            assert_eq!(tt.delimiter(), Delimiter::Parenthesis);
+            assert!(tt.stream().is_empty());
+        }
+        _ => panic!("expected parens"),
+    }
+    match &slice[3] {
+        TokenTree::Group(tt) => assert_eq!(tt.delimiter(), Delimiter::Brace),
+        _ => panic!("expected braces"),
+    }
+    *slice = &slice[4..];
+}
+
+fn fold_stream(input: TokenStream) -> TokenStream {
+    input.into_iter().map(fold_tree).collect()
+}
+
+fn fold_tree(input: TokenTree) -> TokenTree {
+    match input {
+        TokenTree::Group(b) => {
+            TokenTree::Group(Group::new(b.delimiter(), fold_stream(b.stream())))
+        }
+        TokenTree::Punct(b) => TokenTree::Punct(b),
+        TokenTree::Ident(a) => TokenTree::Ident(a),
+        TokenTree::Literal(a) => {
+            if a.to_string() != "\"foo\"" {
+                TokenTree::Literal(a)
+            } else {
+                TokenTree::Literal(Literal::i32_unsuffixed(3))
+            }
+        }
+    }
+}
diff --git a/src/test/ui/proc-macro/auxiliary/bang_proc_macro2.rs b/src/test/ui/proc-macro/auxiliary/bang_proc_macro2.rs
new file mode 100644 (file)
index 0000000..3f0a457
--- /dev/null
@@ -0,0 +1,23 @@
+// 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.
+
+// force-host
+// no-prefer-dynamic
+
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+
+use proc_macro::TokenStream;
+
+#[proc_macro]
+pub fn bang_proc_macro2(_: TokenStream) -> TokenStream {
+    "let x = foobar2;".parse().unwrap()
+}
diff --git a/src/test/ui/proc-macro/auxiliary/derive-a-b.rs b/src/test/ui/proc-macro/auxiliary/derive-a-b.rs
new file mode 100644 (file)
index 0000000..cd8750b
--- /dev/null
@@ -0,0 +1,27 @@
+// 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.
+
+// force-host
+// no-prefer-dynamic
+
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+use proc_macro::TokenStream;
+
+#[proc_macro_derive(A)]
+pub fn derive_a(_: TokenStream) -> TokenStream {
+    "".parse().unwrap()
+}
+
+#[proc_macro_derive(B)]
+pub fn derive_b(_: TokenStream) -> TokenStream {
+    "".parse().unwrap()
+}
diff --git a/src/test/ui/proc-macro/auxiliary/derive-a.rs b/src/test/ui/proc-macro/auxiliary/derive-a.rs
new file mode 100644 (file)
index 0000000..53b2c23
--- /dev/null
@@ -0,0 +1,23 @@
+// 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.
+
+// force-host
+// no-prefer-dynamic
+
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+
+use proc_macro::TokenStream;
+
+#[proc_macro_derive(A)]
+pub fn derive_a(input: TokenStream) -> TokenStream {
+    "".parse().unwrap()
+}
diff --git a/src/test/ui/proc-macro/auxiliary/derive-b.rs b/src/test/ui/proc-macro/auxiliary/derive-b.rs
new file mode 100644 (file)
index 0000000..5787546
--- /dev/null
@@ -0,0 +1,23 @@
+// 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.
+
+// force-host
+// no-prefer-dynamic
+
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+
+use proc_macro::TokenStream;
+
+#[proc_macro_derive(B, attributes(B))]
+pub fn derive_b(input: TokenStream) -> TokenStream {
+    "".parse().unwrap()
+}
diff --git a/src/test/ui/proc-macro/auxiliary/derive-bad.rs b/src/test/ui/proc-macro/auxiliary/derive-bad.rs
new file mode 100644 (file)
index 0000000..b2ded05
--- /dev/null
@@ -0,0 +1,24 @@
+// 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.
+
+// force-host
+// no-prefer-dynamic
+
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+
+use proc_macro::TokenStream;
+
+#[proc_macro_derive(A)]
+pub fn derive_a(_input: TokenStream) -> TokenStream {
+    "struct A { inner }".parse().unwrap()
+}
+
diff --git a/src/test/ui/proc-macro/auxiliary/derive-unstable-2.rs b/src/test/ui/proc-macro/auxiliary/derive-unstable-2.rs
new file mode 100644 (file)
index 0000000..2d492d3
--- /dev/null
@@ -0,0 +1,27 @@
+// 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.
+
+// force-host
+// no-prefer-dynamic
+
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+
+use proc_macro::TokenStream;
+
+#[proc_macro_derive(Unstable)]
+pub fn derive(_input: TokenStream) -> TokenStream {
+
+    "
+        #[rustc_foo]
+        fn foo() {}
+    ".parse().unwrap()
+}
diff --git a/src/test/ui/proc-macro/auxiliary/derive-unstable.rs b/src/test/ui/proc-macro/auxiliary/derive-unstable.rs
new file mode 100644 (file)
index 0000000..a7b5d1e
--- /dev/null
@@ -0,0 +1,24 @@
+// 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.
+
+// force-host
+// no-prefer-dynamic
+
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+
+use proc_macro::TokenStream;
+
+#[proc_macro_derive(Unstable)]
+pub fn derive(_input: TokenStream) -> TokenStream {
+
+    "unsafe fn foo() -> u32 { ::std::intrinsics::init() }".parse().unwrap()
+}
diff --git a/src/test/ui/proc-macro/auxiliary/issue-41211.rs b/src/test/ui/proc-macro/auxiliary/issue-41211.rs
new file mode 100644 (file)
index 0000000..5365e82
--- /dev/null
@@ -0,0 +1,22 @@
+// Copyright 2017 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.
+
+// force-host
+// no-prefer-dynamic
+
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+use proc_macro::TokenStream;
+
+#[proc_macro_attribute]
+pub fn emit_unchanged(_args: TokenStream, input: TokenStream) -> TokenStream {
+    input
+}
diff --git a/src/test/ui/proc-macro/auxiliary/issue_38586.rs b/src/test/ui/proc-macro/auxiliary/issue_38586.rs
new file mode 100644 (file)
index 0000000..e1a7ffa
--- /dev/null
@@ -0,0 +1,21 @@
+// 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.
+
+// force-host
+// no-prefer-dynamic
+
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+
+#[proc_macro_derive(A)]
+pub fn derive_a(_: proc_macro::TokenStream) -> proc_macro::TokenStream {
+    "fn f() { println!(\"{}\", foo); }".parse().unwrap()
+}
diff --git a/src/test/ui/proc-macro/auxiliary/issue_50493.rs b/src/test/ui/proc-macro/auxiliary/issue_50493.rs
new file mode 100644 (file)
index 0000000..e71b792
--- /dev/null
@@ -0,0 +1,31 @@
+// 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.
+
+// force-host
+// no-prefer-dynamic
+
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+use proc_macro::TokenStream;
+
+#[proc_macro_derive(Derive)]
+pub fn derive(_: TokenStream) -> TokenStream {
+    let code = "
+        fn one(r: Restricted) {
+            r.field;
+        }
+        fn two(r: Restricted) {
+            r.field;
+        }
+    ";
+
+    code.parse().unwrap()
+}
diff --git a/src/test/ui/proc-macro/auxiliary/more-gates.rs b/src/test/ui/proc-macro/auxiliary/more-gates.rs
new file mode 100644 (file)
index 0000000..cc9420e
--- /dev/null
@@ -0,0 +1,45 @@
+// 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 <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.
+
+// force-host
+// no-prefer-dynamic
+
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+
+use proc_macro::*;
+
+#[proc_macro_attribute]
+pub fn attr2mac1(_: TokenStream, _: TokenStream) -> TokenStream {
+    "macro_rules! foo1 { (a) => (a) }".parse().unwrap()
+}
+
+#[proc_macro_attribute]
+pub fn attr2mac2(_: TokenStream, _: TokenStream) -> TokenStream {
+    "macro foo2(a) { a }".parse().unwrap()
+}
+
+#[proc_macro]
+pub fn mac2mac1(_: TokenStream) -> TokenStream {
+    "macro_rules! foo3 { (a) => (a) }".parse().unwrap()
+}
+
+#[proc_macro]
+pub fn mac2mac2(_: TokenStream) -> TokenStream {
+    "macro foo4(a) { a }".parse().unwrap()
+}
+
+#[proc_macro]
+pub fn tricky(_: TokenStream) -> TokenStream {
+    "fn foo() {
+        macro_rules! foo { (a) => (a) }
+    }".parse().unwrap()
+}
diff --git a/src/test/ui/proc-macro/auxiliary/proc-macro-gates.rs b/src/test/ui/proc-macro/auxiliary/proc-macro-gates.rs
new file mode 100644 (file)
index 0000000..7e4b7fe
--- /dev/null
@@ -0,0 +1,28 @@
+// 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 <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.
+
+// force-host
+// no-prefer-dynamic
+
+#![crate_type = "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/ui/proc-macro/auxiliary/test-macros.rs b/src/test/ui/proc-macro/auxiliary/test-macros.rs
new file mode 100644 (file)
index 0000000..0e4343a
--- /dev/null
@@ -0,0 +1,36 @@
+// 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 <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.
+
+// force-host
+// no-prefer-dynamic
+
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+
+use proc_macro::TokenStream;
+
+#[proc_macro_attribute]
+pub fn nop_attr(_attr: TokenStream, input: TokenStream) -> TokenStream {
+    assert!(_attr.to_string().is_empty());
+    input
+}
+
+#[proc_macro_attribute]
+pub fn no_output(_attr: TokenStream, _input: TokenStream) -> TokenStream {
+    assert!(_attr.to_string().is_empty());
+    assert!(!_input.to_string().is_empty());
+    "".parse().unwrap()
+}
+
+#[proc_macro]
+pub fn emit_input(input: TokenStream) -> TokenStream {
+    input
+}
diff --git a/src/test/ui/proc-macro/define-two.rs b/src/test/ui/proc-macro/define-two.rs
new file mode 100644 (file)
index 0000000..f8c287b
--- /dev/null
@@ -0,0 +1,28 @@
+// 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.
+
+// force-host
+// no-prefer-dynamic
+
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+
+use proc_macro::TokenStream;
+
+#[proc_macro_derive(A)]
+pub fn foo(input: TokenStream) -> TokenStream {
+    input
+}
+
+#[proc_macro_derive(A)] //~ ERROR the name `A` is defined multiple times
+pub fn bar(input: TokenStream) -> TokenStream {
+    input
+}
diff --git a/src/test/ui/proc-macro/define-two.stderr b/src/test/ui/proc-macro/define-two.stderr
new file mode 100644 (file)
index 0000000..1ca2e0a
--- /dev/null
@@ -0,0 +1,14 @@
+error[E0428]: the name `A` is defined multiple times
+  --> $DIR/define-two.rs:25:21
+   |
+LL | #[proc_macro_derive(A)]
+   |                     - previous definition of the macro `A` here
+...
+LL | #[proc_macro_derive(A)] //~ ERROR the name `A` is defined multiple times
+   |                     ^ `A` redefined here
+   |
+   = note: `A` must be defined only once in the macro namespace of this module
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0428`.
diff --git a/src/test/ui/proc-macro/derive-bad.rs b/src/test/ui/proc-macro/derive-bad.rs
new file mode 100644 (file)
index 0000000..ac27e87
--- /dev/null
@@ -0,0 +1,23 @@
+// 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-bad.rs
+
+#[macro_use]
+extern crate derive_bad;
+
+#[derive(
+    A
+)]
+//~^^ ERROR proc-macro derive produced unparseable tokens
+//~| ERROR expected `:`, found `}`
+struct A;
+
+fn main() {}
diff --git a/src/test/ui/proc-macro/derive-bad.stderr b/src/test/ui/proc-macro/derive-bad.stderr
new file mode 100644 (file)
index 0000000..57e72a0
--- /dev/null
@@ -0,0 +1,14 @@
+error: expected `:`, found `}`
+  --> $DIR/derive-bad.rs:17:5
+   |
+LL |     A
+   |     ^ expected `:`
+
+error: proc-macro derive produced unparseable tokens
+  --> $DIR/derive-bad.rs:17:5
+   |
+LL |     A
+   |     ^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/proc-macro/derive-still-gated.rs b/src/test/ui/proc-macro/derive-still-gated.rs
new file mode 100644 (file)
index 0000000..edf5cc7
--- /dev/null
@@ -0,0 +1,21 @@
+// 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
+
+#![allow(warnings)]
+
+#[macro_use]
+extern crate derive_a;
+
+#[derive_A] //~ ERROR attribute `derive_A` is currently unknown
+struct A;
+
+fn main() {}
diff --git a/src/test/ui/proc-macro/derive-still-gated.stderr b/src/test/ui/proc-macro/derive-still-gated.stderr
new file mode 100644 (file)
index 0000000..f2e92b9
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0658]: attributes of the form `#[derive_*]` are reserved for the compiler (see issue #29644)
+  --> $DIR/derive-still-gated.rs:18:3
+   |
+LL | #[derive_A] //~ ERROR: attributes of the form `#[derive_*]` are reserved for the compiler
+   |   ^^^^^^^^
+   |
+   = help: add #![feature(custom_derive)] to the crate attributes to enable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/proc-macro/expand-to-unstable-2.rs b/src/test/ui/proc-macro/expand-to-unstable-2.rs
new file mode 100644 (file)
index 0000000..e4fcbb1
--- /dev/null
@@ -0,0 +1,24 @@
+// 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-unstable-2.rs
+
+#![allow(warnings)]
+
+#[macro_use]
+extern crate derive_unstable_2;
+
+#[derive(Unstable)]
+//~^ ERROR: reserved for internal compiler
+struct A;
+
+fn main() {
+    foo();
+}
diff --git a/src/test/ui/proc-macro/expand-to-unstable-2.stderr b/src/test/ui/proc-macro/expand-to-unstable-2.stderr
new file mode 100644 (file)
index 0000000..855e905
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0658]: unless otherwise specified, attributes with the prefix `rustc_` are reserved for internal compiler diagnostics (see issue #29642)
+  --> $DIR/expand-to-unstable-2.rs:18:10
+   |
+LL | #[derive(Unstable)]
+   |          ^^^^^^^^
+   |
+   = help: add #![feature(rustc_attrs)] to the crate attributes to enable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/proc-macro/expand-to-unstable.rs b/src/test/ui/proc-macro/expand-to-unstable.rs
new file mode 100644 (file)
index 0000000..836e336
--- /dev/null
@@ -0,0 +1,24 @@
+// 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-unstable.rs
+
+#![allow(warnings)]
+
+#[macro_use]
+extern crate derive_unstable;
+
+#[derive(Unstable)]
+//~^ ERROR: use of unstable library feature
+struct A;
+
+fn main() {
+    unsafe { foo(); }
+}
diff --git a/src/test/ui/proc-macro/expand-to-unstable.stderr b/src/test/ui/proc-macro/expand-to-unstable.stderr
new file mode 100644 (file)
index 0000000..e851b0e
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0658]: use of unstable library feature 'core_intrinsics': intrinsics are unlikely to ever be stabilized, instead they should be used through stabilized interfaces in the rest of the standard library
+  --> $DIR/expand-to-unstable.rs:18:10
+   |
+LL | #[derive(Unstable)]
+   |          ^^^^^^^^
+   |
+   = help: add #![feature(core_intrinsics)] to the crate attributes to enable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/proc-macro/export-macro.rs b/src/test/ui/proc-macro/export-macro.rs
new file mode 100644 (file)
index 0000000..d8bb357
--- /dev/null
@@ -0,0 +1,21 @@
+// 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: cannot export macro_rules! macros from a `proc-macro` crate
+
+// force-host
+// no-prefer-dynamic
+
+#![crate_type = "proc-macro"]
+
+#[macro_export]
+macro_rules! foo {
+    ($e:expr) => ($e)
+}
diff --git a/src/test/ui/proc-macro/export-macro.stderr b/src/test/ui/proc-macro/export-macro.stderr
new file mode 100644 (file)
index 0000000..f82d5ab
--- /dev/null
@@ -0,0 +1,10 @@
+error: cannot export macro_rules! macros from a `proc-macro` crate type currently
+  --> $DIR/export-macro.rs:19:1
+   |
+LL | / macro_rules! foo {
+LL | |     ($e:expr) => ($e)
+LL | | }
+   | |_^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/proc-macro/exports.rs b/src/test/ui/proc-macro/exports.rs
new file mode 100644 (file)
index 0000000..07e5723
--- /dev/null
@@ -0,0 +1,25 @@
+// 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.
+
+// force-host
+// no-prefer-dynamic
+
+#![crate_type = "proc-macro"]
+#![allow(warnings)]
+
+pub fn a() {} //~ ERROR: cannot export any items
+pub struct B; //~ ERROR: cannot export any items
+pub enum C {} //~ ERROR: cannot export any items
+pub mod d {} //~ ERROR: cannot export any items
+
+mod e {}
+struct F;
+enum G {}
+fn h() {}
diff --git a/src/test/ui/proc-macro/exports.stderr b/src/test/ui/proc-macro/exports.stderr
new file mode 100644 (file)
index 0000000..3637d0f
--- /dev/null
@@ -0,0 +1,26 @@
+error: `proc-macro` crate types cannot export any items other than functions tagged with `#[proc_macro_derive]` currently
+  --> $DIR/exports.rs:17:1
+   |
+LL | pub fn a() {} //~ ERROR: cannot export any items
+   | ^^^^^^^^^^^^^
+
+error: `proc-macro` crate types cannot export any items other than functions tagged with `#[proc_macro_derive]` currently
+  --> $DIR/exports.rs:18:1
+   |
+LL | pub struct B; //~ ERROR: cannot export any items
+   | ^^^^^^^^^^^^^
+
+error: `proc-macro` crate types cannot export any items other than functions tagged with `#[proc_macro_derive]` currently
+  --> $DIR/exports.rs:19:1
+   |
+LL | pub enum C {} //~ ERROR: cannot export any items
+   | ^^^^^^^^^^^^^
+
+error: `proc-macro` crate types cannot export any items other than functions tagged with `#[proc_macro_derive]` currently
+  --> $DIR/exports.rs:20:1
+   |
+LL | pub mod d {} //~ ERROR: cannot export any items
+   | ^^^^^^^^^^^^
+
+error: aborting due to 4 previous errors
+
diff --git a/src/test/ui/proc-macro/illegal-proc-macro-derive-use.rs b/src/test/ui/proc-macro/illegal-proc-macro-derive-use.rs
new file mode 100644 (file)
index 0000000..f37980c
--- /dev/null
@@ -0,0 +1,25 @@
+// 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;
+
+#[proc_macro_derive(Foo)]
+//~^ ERROR: only usable with crates of the `proc-macro` crate type
+pub fn foo(a: proc_macro::TokenStream) -> proc_macro::TokenStream {
+    a
+}
+
+// Issue #37590
+#[proc_macro_derive(Foo)]
+//~^ ERROR: the `#[proc_macro_derive]` attribute may only be used on bare functions
+pub struct Foo {
+}
+
+fn main() {}
diff --git a/src/test/ui/proc-macro/illegal-proc-macro-derive-use.stderr b/src/test/ui/proc-macro/illegal-proc-macro-derive-use.stderr
new file mode 100644 (file)
index 0000000..715ff0e
--- /dev/null
@@ -0,0 +1,14 @@
+error: the `#[proc_macro_derive]` attribute is only usable with crates of the `proc-macro` crate type
+  --> $DIR/illegal-proc-macro-derive-use.rs:13:1
+   |
+LL | #[proc_macro_derive(Foo)]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: the `#[proc_macro_derive]` attribute may only be used on bare functions
+  --> $DIR/illegal-proc-macro-derive-use.rs:20:1
+   |
+LL | #[proc_macro_derive(Foo)]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/proc-macro/import.rs b/src/test/ui/proc-macro/import.rs
new file mode 100644 (file)
index 0000000..fae2439
--- /dev/null
@@ -0,0 +1,21 @@
+// 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
+
+#![allow(warnings)]
+
+#[macro_use]
+extern crate derive_a;
+
+use derive_a::derive_a;
+//~^ ERROR: unresolved import `derive_a::derive_a`
+
+fn main() {}
diff --git a/src/test/ui/proc-macro/import.stderr b/src/test/ui/proc-macro/import.stderr
new file mode 100644 (file)
index 0000000..f3633b2
--- /dev/null
@@ -0,0 +1,9 @@
+error[E0432]: unresolved import `derive_a::derive_a`
+  --> $DIR/import.rs:18:5
+   |
+LL | use derive_a::derive_a;
+   |     ^^^^^^^^^^^^^^^^^^ no `derive_a` in the root
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0432`.
diff --git a/src/test/ui/proc-macro/issue-37788.rs b/src/test/ui/proc-macro/issue-37788.rs
new file mode 100644 (file)
index 0000000..691c280
--- /dev/null
@@ -0,0 +1,19 @@
+// 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-b.rs
+
+#[macro_use]
+extern crate derive_a_b;
+
+fn main() {
+    // Test that constructing the `visible_parent_map` (in `cstore_impl.rs`) does not ICE.
+    std::cell::Cell::new(0) //~ ERROR mismatched types
+}
diff --git a/src/test/ui/proc-macro/issue-37788.stderr b/src/test/ui/proc-macro/issue-37788.stderr
new file mode 100644 (file)
index 0000000..f5ddf9b
--- /dev/null
@@ -0,0 +1,17 @@
+error[E0308]: mismatched types
+  --> $DIR/issue-37788.rs:18:5
+   |
+LL | fn main() {
+   |           - expected `()` because of default return type
+LL |     // Test that constructing the `visible_parent_map` (in `cstore_impl.rs`) does not ICE.
+LL |     std::cell::Cell::new(0) //~ ERROR mismatched types
+   |     ^^^^^^^^^^^^^^^^^^^^^^^- help: try adding a semicolon: `;`
+   |     |
+   |     expected (), found struct `std::cell::Cell`
+   |
+   = note: expected type `()`
+              found type `std::cell::Cell<{integer}>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/proc-macro/issue-38586.rs b/src/test/ui/proc-macro/issue-38586.rs
new file mode 100644 (file)
index 0000000..649220a
--- /dev/null
@@ -0,0 +1,19 @@
+// 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:issue_38586.rs
+
+#[macro_use]
+extern crate issue_38586;
+
+#[derive(A)] //~ ERROR `foo`
+struct A;
+
+fn main() {}
diff --git a/src/test/ui/proc-macro/issue-38586.stderr b/src/test/ui/proc-macro/issue-38586.stderr
new file mode 100644 (file)
index 0000000..6ba2c0b
--- /dev/null
@@ -0,0 +1,9 @@
+error[E0425]: cannot find value `foo` in this scope
+  --> $DIR/issue-38586.rs:16:10
+   |
+LL | #[derive(A)] //~ ERROR `foo`
+   |          ^ not found in this scope
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0425`.
diff --git a/src/test/ui/proc-macro/issue-41211.rs b/src/test/ui/proc-macro/issue-41211.rs
new file mode 100644 (file)
index 0000000..e0922c4
--- /dev/null
@@ -0,0 +1,23 @@
+// Copyright 2017 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:issue-41211.rs
+
+// FIXME: https://github.com/rust-lang/rust/issues/41430
+// This is a temporary regression test for the ICE reported in #41211
+
+#![feature(custom_inner_attributes)]
+
+#![emit_unchanged]
+//~^ ERROR attribute `emit_unchanged` is currently unknown to the compiler
+extern crate issue_41211;
+use issue_41211::emit_unchanged;
+
+fn main() {}
diff --git a/src/test/ui/proc-macro/issue-41211.stderr b/src/test/ui/proc-macro/issue-41211.stderr
new file mode 100644 (file)
index 0000000..ba5fad4
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0658]: The attribute `emit_unchanged` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
+  --> $DIR/issue-41211.rs:18:4
+   |
+LL | #![emit_unchanged]
+   |    ^^^^^^^^^^^^^^
+   |
+   = help: add #![feature(custom_attribute)] to the crate attributes to enable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/proc-macro/issue-50493.rs b/src/test/ui/proc-macro/issue-50493.rs
new file mode 100644 (file)
index 0000000..635da57
--- /dev/null
@@ -0,0 +1,24 @@
+// 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:issue_50493.rs
+
+#[macro_use]
+extern crate issue_50493;
+
+#[derive(Derive)] //~ ERROR field `field` of struct `Restricted` is private
+struct Restricted {
+    pub(in restricted) field: usize, //~ visibilities can only be restricted to ancestor modules
+}
+
+mod restricted {}
+
+fn main() {}
+
diff --git a/src/test/ui/proc-macro/issue-50493.stderr b/src/test/ui/proc-macro/issue-50493.stderr
new file mode 100644 (file)
index 0000000..3dcb526
--- /dev/null
@@ -0,0 +1,15 @@
+error: visibilities can only be restricted to ancestor modules
+  --> $DIR/issue-50493.rs:18:12
+   |
+LL |     pub(in restricted) field: usize, //~ visibilities can only be restricted to ancestor modules
+   |            ^^^^^^^^^^
+
+error[E0616]: field `field` of struct `Restricted` is private
+  --> $DIR/issue-50493.rs:16:10
+   |
+LL | #[derive(Derive)] //~ ERROR field `field` of struct `Restricted` is private
+   |          ^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0616`.
diff --git a/src/test/ui/proc-macro/item-error.rs b/src/test/ui/proc-macro/item-error.rs
new file mode 100644 (file)
index 0000000..4133e75
--- /dev/null
@@ -0,0 +1,25 @@
+// 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-b.rs
+
+#![allow(warnings)]
+
+#[macro_use]
+extern crate derive_b;
+
+#[derive(B)]
+struct A {
+    a: &u64
+//~^ ERROR: missing lifetime specifier
+}
+
+fn main() {
+}
diff --git a/src/test/ui/proc-macro/item-error.stderr b/src/test/ui/proc-macro/item-error.stderr
new file mode 100644 (file)
index 0000000..d193286
--- /dev/null
@@ -0,0 +1,9 @@
+error[E0106]: missing lifetime specifier
+  --> $DIR/item-error.rs:20:8
+   |
+LL |     a: &u64
+   |        ^ expected lifetime parameter
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0106`.
diff --git a/src/test/ui/proc-macro/lints_in_proc_macros.rs b/src/test/ui/proc-macro/lints_in_proc_macros.rs
new file mode 100644 (file)
index 0000000..d49c612
--- /dev/null
@@ -0,0 +1,26 @@
+// 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:bang_proc_macro2.rs
+
+#![feature(proc_macro_hygiene)]
+#![allow(unused_macros)]
+
+extern crate bang_proc_macro2;
+
+use bang_proc_macro2::bang_proc_macro2;
+
+fn main() {
+    let foobar = 42;
+    bang_proc_macro2!();
+    //~^ ERROR cannot find value `foobar2` in this scope
+    //~^^ did you mean `foobar`?
+    println!("{}", x);
+}
diff --git a/src/test/ui/proc-macro/lints_in_proc_macros.stderr b/src/test/ui/proc-macro/lints_in_proc_macros.stderr
new file mode 100644 (file)
index 0000000..42d9a30
--- /dev/null
@@ -0,0 +1,9 @@
+error[E0425]: cannot find value `foobar2` in this scope
+  --> $DIR/lints_in_proc_macros.rs:22:5
+   |
+LL |     bang_proc_macro2!();
+   |     ^^^^^^^^^^^^^^^^^^^^ did you mean `foobar`?
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0425`.
diff --git a/src/test/ui/proc-macro/macros-in-extern.rs b/src/test/ui/proc-macro/macros-in-extern.rs
new file mode 100644 (file)
index 0000000..43d7077
--- /dev/null
@@ -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 <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:test-macros.rs
+// ignore-wasm32
+
+extern crate test_macros;
+
+use test_macros::{nop_attr, no_output, emit_input};
+
+fn main() {
+    assert_eq!(unsafe { rust_get_test_int() }, 0isize);
+    assert_eq!(unsafe { rust_dbg_extern_identity_u32(0xDEADBEEF) }, 0xDEADBEEF);
+}
+
+#[link(name = "rust_test_helpers", kind = "static")]
+extern {
+    #[no_output]
+    //~^ ERROR macro invocations in `extern {}` blocks are experimental
+    fn some_definitely_unknown_symbol_which_should_be_removed();
+
+    #[nop_attr]
+    //~^ ERROR macro invocations in `extern {}` blocks are experimental
+    fn rust_get_test_int() -> isize;
+
+    emit_input!(fn rust_dbg_extern_identity_u32(arg: u32) -> u32;);
+    //~^ ERROR macro invocations in `extern {}` blocks are experimental
+}
diff --git a/src/test/ui/proc-macro/macros-in-extern.stderr b/src/test/ui/proc-macro/macros-in-extern.stderr
new file mode 100644 (file)
index 0000000..5c51de4
--- /dev/null
@@ -0,0 +1,27 @@
+error[E0658]: macro invocations in `extern {}` blocks are experimental (see issue #49476)
+  --> $DIR/macros-in-extern.rs:25:5
+   |
+LL |     #[no_output]
+   |     ^^^^^^^^^^^^
+   |
+   = help: add #![feature(macros_in_extern)] to the crate attributes to enable
+
+error[E0658]: macro invocations in `extern {}` blocks are experimental (see issue #49476)
+  --> $DIR/macros-in-extern.rs:29:5
+   |
+LL |     #[nop_attr]
+   |     ^^^^^^^^^^^
+   |
+   = help: add #![feature(macros_in_extern)] to the crate attributes to enable
+
+error[E0658]: macro invocations in `extern {}` blocks are experimental (see issue #49476)
+  --> $DIR/macros-in-extern.rs:33:5
+   |
+LL |     emit_input!(fn rust_dbg_extern_identity_u32(arg: u32) -> u32;);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: add #![feature(macros_in_extern)] to the crate attributes to enable
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/proc-macro/more-gates.rs b/src/test/ui/proc-macro/more-gates.rs
new file mode 100644 (file)
index 0000000..4c03817
--- /dev/null
@@ -0,0 +1,30 @@
+// 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 <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:more-gates.rs
+
+extern crate more_gates as foo;
+
+use foo::*;
+
+#[attr2mac1]
+//~^ ERROR: cannot expand to macro definitions
+pub fn a() {}
+#[attr2mac2]
+//~^ ERROR: cannot expand to macro definitions
+pub fn a() {}
+
+mac2mac1!(); //~ ERROR: cannot expand to macro definitions
+mac2mac2!(); //~ ERROR: cannot expand to macro definitions
+
+tricky!();
+//~^ ERROR: cannot expand to macro definitions
+
+fn main() {}
diff --git a/src/test/ui/proc-macro/more-gates.stderr b/src/test/ui/proc-macro/more-gates.stderr
new file mode 100644 (file)
index 0000000..d5f30d5
--- /dev/null
@@ -0,0 +1,43 @@
+error[E0658]: procedural macros cannot expand to macro definitions (see issue #54727)
+  --> $DIR/more-gates.rs:17:1
+   |
+LL | #[attr2mac1]
+   | ^^^^^^^^^^^^
+   |
+   = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable
+
+error[E0658]: procedural macros cannot expand to macro definitions (see issue #54727)
+  --> $DIR/more-gates.rs:20:1
+   |
+LL | #[attr2mac2]
+   | ^^^^^^^^^^^^
+   |
+   = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable
+
+error[E0658]: procedural macros cannot expand to macro definitions (see issue #54727)
+  --> $DIR/more-gates.rs:24:1
+   |
+LL | mac2mac1!(); //~ ERROR: cannot expand to macro definitions
+   | ^^^^^^^^^^^^
+   |
+   = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable
+
+error[E0658]: procedural macros cannot expand to macro definitions (see issue #54727)
+  --> $DIR/more-gates.rs:25:1
+   |
+LL | mac2mac2!(); //~ ERROR: cannot expand to macro definitions
+   | ^^^^^^^^^^^^
+   |
+   = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable
+
+error[E0658]: procedural macros cannot expand to macro definitions (see issue #54727)
+  --> $DIR/more-gates.rs:27:1
+   |
+LL | tricky!();
+   | ^^^^^^^^^^
+   |
+   = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/proc-macro/no-macro-use-attr.rs b/src/test/ui/proc-macro/no-macro-use-attr.rs
new file mode 100644 (file)
index 0000000..ab05ca2
--- /dev/null
@@ -0,0 +1,20 @@
+// 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
+
+#![feature(rustc_attrs)]
+#![warn(unused_extern_crates)]
+
+extern crate derive_a;
+//~^ WARN unused extern crate
+
+#[rustc_error]
+fn main() {} //~ ERROR compilation successful
diff --git a/src/test/ui/proc-macro/no-macro-use-attr.stderr b/src/test/ui/proc-macro/no-macro-use-attr.stderr
new file mode 100644 (file)
index 0000000..447cb26
--- /dev/null
@@ -0,0 +1,20 @@
+warning: unused extern crate
+  --> $DIR/no-macro-use-attr.rs:16:1
+   |
+LL | extern crate derive_a;
+   | ^^^^^^^^^^^^^^^^^^^^^^ help: remove it
+   |
+note: lint level defined here
+  --> $DIR/no-macro-use-attr.rs:14:9
+   |
+LL | #![warn(unused_extern_crates)]
+   |         ^^^^^^^^^^^^^^^^^^^^
+
+error: compilation successful
+  --> $DIR/no-macro-use-attr.rs:20:1
+   |
+LL | fn main() {} //~ ERROR compilation successful
+   | ^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/proc-macro/proc-macro-attributes.rs b/src/test/ui/proc-macro/proc-macro-attributes.rs
new file mode 100644 (file)
index 0000000..6e52411
--- /dev/null
@@ -0,0 +1,24 @@
+// 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-b.rs
+
+#[macro_use]
+extern crate derive_b;
+
+#[B]
+#[C] //~ ERROR attribute `C` is currently unknown to the compiler
+#[B(D)]
+#[B(E = "foo")]
+#[B(arbitrary tokens)]
+#[derive(B)]
+struct B;
+
+fn main() {}
diff --git a/src/test/ui/proc-macro/proc-macro-attributes.stderr b/src/test/ui/proc-macro/proc-macro-attributes.stderr
new file mode 100644 (file)
index 0000000..a1289c6
--- /dev/null
@@ -0,0 +1,11 @@
+error[E0658]: The attribute `C` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
+  --> $DIR/proc-macro-attributes.rs:17:3
+   |
+LL | #[C] //~ ERROR attribute `C` is currently unknown to the compiler
+   |   ^
+   |
+   = help: add #![feature(custom_attribute)] to the crate attributes to enable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/proc-macro/proc-macro-gates.rs b/src/test/ui/proc-macro/proc-macro-gates.rs
new file mode 100644 (file)
index 0000000..5049a47
--- /dev/null
@@ -0,0 +1,71 @@
+// 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 <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:proc-macro-gates.rs
+// gate-test-proc_macro_hygiene
+
+#![feature(stmt_expr_attributes)]
+
+extern crate proc_macro_gates as foo;
+
+use foo::*;
+
+fn _test_inner() {
+    #![a] //~ ERROR: non-builtin inner attributes are unstable
+}
+
+#[a] //~ ERROR: custom attributes cannot be applied to modules
+mod _test2 {}
+
+mod _test2_inner {
+    #![a] //~ ERROR: custom attributes cannot be applied to modules
+          //~| ERROR: non-builtin inner attributes are unstable
+}
+
+#[a = y] //~ ERROR: must only be followed by a delimiter token
+fn _test3() {}
+
+fn attrs() {
+    // Statement, item
+    #[a] // OK
+    struct S;
+
+    // Statement, macro
+    #[a] //~ ERROR: custom attributes cannot be applied to statements
+    println!();
+
+    // Statement, semi
+    #[a] //~ ERROR: custom attributes cannot be applied to statements
+    S;
+
+    // Statement, local
+    #[a] //~ ERROR: custom attributes cannot be applied to statements
+    let _x = 2;
+
+    // Expr
+    let _x = #[a] 2; //~ ERROR: custom attributes cannot be applied to expressions
+
+    // Opt expr
+    let _x = [#[a] 2]; //~ ERROR: custom attributes cannot be applied to expressions
+
+    // Expr macro
+    let _x = #[a] println!(); //~ ERROR: custom attributes cannot be applied to expressions
+}
+
+fn main() {
+    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
+
+    m!(struct S;); //~ ERROR: procedural macros cannot be expanded to statements
+    m!(let _x = 3;); //~ ERROR: procedural macros cannot be expanded to statements
+
+    let _x = m!(3); //~ ERROR: procedural macros cannot be expanded to expressions
+    let _x = [m!(3)]; //~ ERROR: procedural macros cannot be expanded to expressions
+}
diff --git a/src/test/ui/proc-macro/proc-macro-gates.stderr b/src/test/ui/proc-macro/proc-macro-gates.stderr
new file mode 100644 (file)
index 0000000..d5c85d9
--- /dev/null
@@ -0,0 +1,137 @@
+error[E0658]: non-builtin inner attributes are unstable (see issue #54726)
+  --> $DIR/proc-macro-gates.rs:21:5
+   |
+LL |     #![a] //~ ERROR: non-builtin inner attributes are unstable
+   |     ^^^^^
+   |
+   = help: add #![feature(custom_inner_attributes)] to the crate attributes to enable
+
+error[E0658]: non-builtin inner attributes are unstable (see issue #54726)
+  --> $DIR/proc-macro-gates.rs:28:5
+   |
+LL |     #![a] //~ ERROR: custom attributes cannot be applied to modules
+   |     ^^^^^
+   |
+   = help: add #![feature(custom_inner_attributes)] to the crate attributes to enable
+
+error[E0658]: custom attributes cannot be applied to modules (see issue #54727)
+  --> $DIR/proc-macro-gates.rs:24:1
+   |
+LL | #[a] //~ ERROR: custom attributes cannot be applied to modules
+   | ^^^^
+   |
+   = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable
+
+error[E0658]: custom attributes cannot be applied to modules (see issue #54727)
+  --> $DIR/proc-macro-gates.rs:28:5
+   |
+LL |     #![a] //~ ERROR: custom attributes cannot be applied to modules
+   |     ^^^^^
+   |
+   = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable
+
+error: custom attribute invocations must be of the form #[foo] or #[foo(..)], the macro name must only be followed by a delimiter token
+  --> $DIR/proc-macro-gates.rs:32:1
+   |
+LL | #[a = y] //~ ERROR: must only be followed by a delimiter token
+   | ^^^^^^^^
+
+error[E0658]: custom attributes cannot be applied to statements (see issue #54727)
+  --> $DIR/proc-macro-gates.rs:41:5
+   |
+LL |     #[a] //~ ERROR: custom attributes cannot be applied to statements
+   |     ^^^^
+   |
+   = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable
+
+error[E0658]: custom attributes cannot be applied to statements (see issue #54727)
+  --> $DIR/proc-macro-gates.rs:45:5
+   |
+LL |     #[a] //~ ERROR: custom attributes cannot be applied to statements
+   |     ^^^^
+   |
+   = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable
+
+error[E0658]: custom attributes cannot be applied to statements (see issue #54727)
+  --> $DIR/proc-macro-gates.rs:49:5
+   |
+LL |     #[a] //~ ERROR: custom attributes cannot be applied to statements
+   |     ^^^^
+   |
+   = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable
+
+error[E0658]: custom attributes cannot be applied to expressions (see issue #54727)
+  --> $DIR/proc-macro-gates.rs:53:14
+   |
+LL |     let _x = #[a] 2; //~ ERROR: custom attributes cannot be applied to expressions
+   |              ^^^^
+   |
+   = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable
+
+error[E0658]: custom attributes cannot be applied to expressions (see issue #54727)
+  --> $DIR/proc-macro-gates.rs:56:15
+   |
+LL |     let _x = [#[a] 2]; //~ ERROR: custom attributes cannot be applied to expressions
+   |               ^^^^
+   |
+   = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable
+
+error[E0658]: custom attributes cannot be applied to expressions (see issue #54727)
+  --> $DIR/proc-macro-gates.rs:59:14
+   |
+LL |     let _x = #[a] println!(); //~ ERROR: custom attributes cannot be applied to expressions
+   |              ^^^^
+   |
+   = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable
+
+error[E0658]: procedural macros cannot be expanded to types (see issue #54727)
+  --> $DIR/proc-macro-gates.rs:63:13
+   |
+LL |     let _x: m!(u32) = 3; //~ ERROR: procedural macros cannot be expanded to types
+   |             ^^^^^^^
+   |
+   = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable
+
+error[E0658]: procedural macros cannot be expanded to patterns (see issue #54727)
+  --> $DIR/proc-macro-gates.rs:64:12
+   |
+LL |     if let m!(Some(_x)) = Some(3) {} //~ ERROR: procedural macros cannot be expanded to patterns
+   |            ^^^^^^^^^^^^
+   |
+   = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable
+
+error[E0658]: procedural macros cannot be expanded to statements (see issue #54727)
+  --> $DIR/proc-macro-gates.rs:66:5
+   |
+LL |     m!(struct S;); //~ ERROR: procedural macros cannot be expanded to statements
+   |     ^^^^^^^^^^^^^^
+   |
+   = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable
+
+error[E0658]: procedural macros cannot be expanded to statements (see issue #54727)
+  --> $DIR/proc-macro-gates.rs:67:5
+   |
+LL |     m!(let _x = 3;); //~ ERROR: procedural macros cannot be expanded to statements
+   |     ^^^^^^^^^^^^^^^^
+   |
+   = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable
+
+error[E0658]: procedural macros cannot be expanded to expressions (see issue #54727)
+  --> $DIR/proc-macro-gates.rs:69:14
+   |
+LL |     let _x = m!(3); //~ ERROR: procedural macros cannot be expanded to expressions
+   |              ^^^^^
+   |
+   = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable
+
+error[E0658]: procedural macros cannot be expanded to expressions (see issue #54727)
+  --> $DIR/proc-macro-gates.rs:70:15
+   |
+LL |     let _x = [m!(3)]; //~ ERROR: procedural macros cannot be expanded to expressions
+   |               ^^^^^
+   |
+   = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable
+
+error: aborting due to 17 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/proc-macro/proc-macro-gates2.rs b/src/test/ui/proc-macro/proc-macro-gates2.rs
new file mode 100644 (file)
index 0000000..dc18241
--- /dev/null
@@ -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 <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:proc-macro-gates.rs
+
+#![feature(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/ui/proc-macro/proc-macro-gates2.stderr b/src/test/ui/proc-macro/proc-macro-gates2.stderr
new file mode 100644 (file)
index 0000000..2c0f2b0
--- /dev/null
@@ -0,0 +1,19 @@
+error[E0658]: The attribute `a` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
+  --> $DIR/proc-macro-gates2.rs:23:11
+   |
+LL | fn _test6<#[a] T>() {}
+   |           ^^^^
+   |
+   = help: add #![feature(custom_attribute)] to the crate attributes to enable
+
+error[E0658]: The attribute `a` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
+  --> $DIR/proc-macro-gates2.rs:28:9
+   |
+LL |         #[a] //~ ERROR: unknown to the compiler
+   |         ^^^^
+   |
+   = help: add #![feature(custom_attribute)] to the crate attributes to enable
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/proc-macro/pub-at-crate-root.rs b/src/test/ui/proc-macro/pub-at-crate-root.rs
new file mode 100644 (file)
index 0000000..e995eb5
--- /dev/null
@@ -0,0 +1,32 @@
+// 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.
+
+// force-host
+// no-prefer-dynamic
+
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+
+pub mod a { //~ `proc-macro` crate types cannot export any items
+    use proc_macro::TokenStream;
+
+    #[proc_macro_derive(B)]
+    pub fn bar(a: TokenStream) -> TokenStream {
+    //~^ ERROR: must currently reside in the root of the crate
+        a
+    }
+}
+
+#[proc_macro_derive(B)]
+fn bar(a: proc_macro::TokenStream) -> proc_macro::TokenStream {
+//~^ ERROR: functions tagged with `#[proc_macro_derive]` must be `pub`
+    a
+}
diff --git a/src/test/ui/proc-macro/pub-at-crate-root.stderr b/src/test/ui/proc-macro/pub-at-crate-root.stderr
new file mode 100644 (file)
index 0000000..ba9a860
--- /dev/null
@@ -0,0 +1,32 @@
+error: `proc-macro` crate types cannot export any items other than functions tagged with `#[proc_macro_derive]` currently
+  --> $DIR/pub-at-crate-root.rs:18:1
+   |
+LL | / pub mod a { //~ `proc-macro` crate types cannot export any items
+LL | |     use proc_macro::TokenStream;
+LL | |
+LL | |     #[proc_macro_derive(B)]
+...  |
+LL | |     }
+LL | | }
+   | |_^
+
+error: functions tagged with `#[proc_macro_derive]` must currently reside in the root of the crate
+  --> $DIR/pub-at-crate-root.rs:22:5
+   |
+LL | /     pub fn bar(a: TokenStream) -> TokenStream {
+LL | |     //~^ ERROR: must currently reside in the root of the crate
+LL | |         a
+LL | |     }
+   | |_____^
+
+error: functions tagged with `#[proc_macro_derive]` must be `pub`
+  --> $DIR/pub-at-crate-root.rs:29:1
+   |
+LL | / fn bar(a: proc_macro::TokenStream) -> proc_macro::TokenStream {
+LL | | //~^ ERROR: functions tagged with `#[proc_macro_derive]` must be `pub`
+LL | |     a
+LL | | }
+   | |_^
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/ui/proc-macro/shadow-builtin.rs b/src/test/ui/proc-macro/shadow-builtin.rs
new file mode 100644 (file)
index 0000000..a5fcfde
--- /dev/null
@@ -0,0 +1,24 @@
+// 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.
+
+// force-host
+// no-prefer-dynamic
+
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+
+use proc_macro::TokenStream;
+
+#[proc_macro_derive(PartialEq)]
+//~^ ERROR: cannot override a built-in #[derive] mode
+pub fn foo(input: TokenStream) -> TokenStream {
+    input
+}
diff --git a/src/test/ui/proc-macro/shadow-builtin.stderr b/src/test/ui/proc-macro/shadow-builtin.stderr
new file mode 100644 (file)
index 0000000..6d04c90
--- /dev/null
@@ -0,0 +1,8 @@
+error: cannot override a built-in #[derive] mode
+  --> $DIR/shadow-builtin.rs:20:21
+   |
+LL | #[proc_macro_derive(PartialEq)]
+   |                     ^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/proc-macro/shadow.rs b/src/test/ui/proc-macro/shadow.rs
new file mode 100644 (file)
index 0000000..9bff1c5
--- /dev/null
@@ -0,0 +1,18 @@
+// 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;
+#[macro_use]
+extern crate derive_a; //~ ERROR the name `derive_a` is defined multiple times
+
+fn main() {}
diff --git a/src/test/ui/proc-macro/shadow.stderr b/src/test/ui/proc-macro/shadow.stderr
new file mode 100644 (file)
index 0000000..847fc73
--- /dev/null
@@ -0,0 +1,18 @@
+error[E0259]: the name `derive_a` is defined multiple times
+  --> $DIR/shadow.rs:16:1
+   |
+LL | extern crate derive_a;
+   | ---------------------- previous import of the extern crate `derive_a` here
+LL | #[macro_use]
+LL | extern crate derive_a; //~ ERROR the name `derive_a` is defined multiple times
+   | ^^^^^^^^^^^^^^^^^^^^^^ `derive_a` reimported here
+   |
+   = note: `derive_a` must be defined only once in the type namespace of this module
+help: you can use `as` to change the binding name of the import
+   |
+LL | extern crate derive_a as other_derive_a; //~ ERROR the name `derive_a` is defined multiple times
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0259`.
diff --git a/src/test/ui/proc-macro/two-crate-types-1.rs b/src/test/ui/proc-macro/two-crate-types-1.rs
new file mode 100644 (file)
index 0000000..06bd3f9
--- /dev/null
@@ -0,0 +1,17 @@
+// 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: cannot mix `proc-macro` crate type with others
+
+// force-host
+// no-prefer-dynamic
+
+#![crate_type = "proc-macro"]
+#![crate_type = "rlib"]
diff --git a/src/test/ui/proc-macro/two-crate-types-1.stderr b/src/test/ui/proc-macro/two-crate-types-1.stderr
new file mode 100644 (file)
index 0000000..deaba1c
--- /dev/null
@@ -0,0 +1,4 @@
+error: cannot mix `proc-macro` crate type with others
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/proc-macro/two-crate-types-2.rs b/src/test/ui/proc-macro/two-crate-types-2.rs
new file mode 100644 (file)
index 0000000..dd5e5ac
--- /dev/null
@@ -0,0 +1,13 @@
+// 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: cannot mix `proc-macro` crate type with others
+// compile-flags: --crate-type rlib --crate-type proc-macro
+// force-host
diff --git a/src/test/ui/proc-macro/two-crate-types-2.stderr b/src/test/ui/proc-macro/two-crate-types-2.stderr
new file mode 100644 (file)
index 0000000..deaba1c
--- /dev/null
@@ -0,0 +1,4 @@
+error: cannot mix `proc-macro` crate type with others
+
+error: aborting due to previous error
+