Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: Centralize proc macros commonly used for testing #61024

Merged
merged 1 commit into from
May 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 0 additions & 28 deletions src/test/ui/custom-derive/auxiliary/plugin.rs

This file was deleted.

13 changes: 0 additions & 13 deletions src/test/ui/custom-derive/derive-in-mod.rs

This file was deleted.

12 changes: 0 additions & 12 deletions src/test/ui/custom-derive/helper-attr-blocked-by-import-ambig.rs

This file was deleted.

This file was deleted.

28 changes: 0 additions & 28 deletions src/test/ui/custom-derive/helper-attr-blocked-by-import.rs

This file was deleted.

12 changes: 0 additions & 12 deletions src/test/ui/custom-derive/issue-36935.rs

This file was deleted.

10 changes: 0 additions & 10 deletions src/test/ui/custom-derive/issue-36935.stderr

This file was deleted.

10 changes: 5 additions & 5 deletions src/test/ui/proc-macro/attribute-order-restricted.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// aux-build:attr_proc_macro.rs
// aux-build:test-macros.rs

extern crate attr_proc_macro;
use attr_proc_macro::*;
#[macro_use]
extern crate test_macros;

#[attr_proc_macro] // OK
#[identity_attr] // OK
#[derive(Clone)]
struct Before;

#[derive(Clone)]
#[attr_proc_macro] //~ ERROR macro attributes must be placed before `#[derive]`
#[identity_attr] //~ ERROR macro attributes must be placed before `#[derive]`
struct After;

fn main() {}
4 changes: 2 additions & 2 deletions src/test/ui/proc-macro/attribute-order-restricted.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error: macro attributes must be placed before `#[derive]`
--> $DIR/attribute-order-restricted.rs:11:1
|
LL | #[attr_proc_macro]
| ^^^^^^^^^^^^^^^^^^
LL | #[identity_attr]
| ^^^^^^^^^^^^^^^^

error: aborting due to previous error

17 changes: 8 additions & 9 deletions src/test/ui/proc-macro/attribute-with-error.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
// aux-build:attribute-with-error.rs
// aux-build:test-macros.rs

#![feature(custom_inner_attributes)]

extern crate attribute_with_error;
#[macro_use]
extern crate test_macros;

use attribute_with_error::foo;

#[foo]
#[recollect_attr]
fn test1() {
let a: i32 = "foo";
//~^ ERROR: mismatched types
Expand All @@ -15,13 +14,13 @@ fn test1() {
}

fn test2() {
#![foo]
#![recollect_attr]

// 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
// FIXME: should have a #[recollect_attr] attribute here and assert that it works
fn foo(&self) {
let a: i32 = "foo";
//~^ ERROR: mismatched types
Expand All @@ -31,13 +30,13 @@ trait A {
struct B;

impl A for B {
#[foo]
#[recollect_attr]
fn foo(&self) {
let a: i32 = "foo";
//~^ ERROR: mismatched types
}
}

#[foo]
#[recollect_attr]
fn main() {
}
8 changes: 4 additions & 4 deletions src/test/ui/proc-macro/attribute-with-error.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/attribute-with-error.rs:11:18
--> $DIR/attribute-with-error.rs:10:18
|
LL | let a: i32 = "foo";
| ^^^^^ expected i32, found reference
Expand All @@ -8,7 +8,7 @@ LL | let a: i32 = "foo";
found type `&'static str`

error[E0308]: mismatched types
--> $DIR/attribute-with-error.rs:13:18
--> $DIR/attribute-with-error.rs:12:18
|
LL | let b: i32 = "f'oo";
| ^^^^^^ expected i32, found reference
Expand All @@ -17,7 +17,7 @@ LL | let b: i32 = "f'oo";
found type `&'static str`

error[E0308]: mismatched types
--> $DIR/attribute-with-error.rs:26:22
--> $DIR/attribute-with-error.rs:25:22
|
LL | let a: i32 = "foo";
| ^^^^^ expected i32, found reference
Expand All @@ -26,7 +26,7 @@ LL | let a: i32 = "foo";
found type `&'static str`

error[E0308]: mismatched types
--> $DIR/attribute-with-error.rs:36:22
--> $DIR/attribute-with-error.rs:35:22
|
LL | let a: i32 = "foo";
| ^^^^^ expected i32, found reference
Expand Down
13 changes: 0 additions & 13 deletions src/test/ui/proc-macro/auxiliary/attr_proc_macro.rs

This file was deleted.

13 changes: 0 additions & 13 deletions src/test/ui/proc-macro/auxiliary/attribute-with-error.rs

This file was deleted.

13 changes: 0 additions & 13 deletions src/test/ui/proc-macro/auxiliary/bang_proc_macro.rs

This file was deleted.

17 changes: 0 additions & 17 deletions src/test/ui/proc-macro/auxiliary/derive-a-b.rs

This file was deleted.

13 changes: 0 additions & 13 deletions src/test/ui/proc-macro/auxiliary/derive-a.rs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#[macro_export]
macro_rules! my_attr { () => () }
macro_rules! empty_helper { () => () }
12 changes: 0 additions & 12 deletions src/test/ui/proc-macro/auxiliary/derive-helper-shadowed.rs

This file was deleted.

17 changes: 0 additions & 17 deletions src/test/ui/proc-macro/auxiliary/derive-helper-shadowing.rs

This file was deleted.

13 changes: 0 additions & 13 deletions src/test/ui/proc-macro/auxiliary/derive-panic.rs

This file was deleted.

6 changes: 3 additions & 3 deletions src/test/ui/proc-macro/auxiliary/dollar-crate-external.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ pub type S = u8;
#[macro_export]
macro_rules! external {
() => {
dollar_crate::m! {
print_bang! {
struct M($crate::S);
}

#[dollar_crate::a]
#[print_attr]
struct A($crate::S);

#[derive(dollar_crate::d)]
#[derive(Print)]
struct D($crate::S);
};
}
Loading