forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#110255 - clubby789:proc-macro-test-help, r=…
…jackh726 Suggest using integration tests for test crate using own proc-macro cc rust-lang#110247
- Loading branch information
Showing
5 changed files
with
43 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// compile-flags: --test | ||
#![crate_type = "proc-macro"] | ||
|
||
extern crate proc_macro; | ||
use proc_macro::TokenStream; | ||
|
||
#[proc_macro] | ||
pub fn mac(input: TokenStream) -> TokenStream { loop {} } | ||
|
||
#[cfg(test)] | ||
mod test { | ||
#[test] | ||
fn t() { crate::mac!(A) } | ||
//~^ ERROR can't use a procedural macro from the same crate that defines it | ||
//~| HELP you can define integration tests in a directory named `tests` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
error: can't use a procedural macro from the same crate that defines it | ||
--> $DIR/test-same-crate.rs:13:14 | ||
| | ||
LL | fn t() { crate::mac!(A) } | ||
| ^^^^^^^^^^ | ||
| | ||
= help: you can define integration tests in a directory named `tests` | ||
|
||
error: aborting due to previous error | ||
|