Specify proc-macro crate type for proc-macro hir_def test fixtures
This commit is contained in:
parent
3edc5dcea8
commit
5b9799bba4
1 changed files with 52 additions and 48 deletions
|
@ -809,6 +809,7 @@ pub macro derive($item:item) {}
|
|||
struct S;
|
||||
|
||||
//- /proc.rs crate:proc
|
||||
#![crate_type="proc-macro"]
|
||||
#[proc_macro_derive(Derive, attributes(helper))]
|
||||
fn derive() {}
|
||||
"#,
|
||||
|
@ -886,7 +887,8 @@ indirect_macro!();
|
|||
#[test]
|
||||
fn resolves_proc_macros() {
|
||||
check(
|
||||
r"
|
||||
r#"
|
||||
#![crate_type="proc-macro"]
|
||||
struct TokenStream;
|
||||
|
||||
#[proc_macro]
|
||||
|
@ -908,7 +910,7 @@ fn resolves_proc_macros() {
|
|||
pub fn derive_macro_2(_item: TokenStream) -> TokenStream {
|
||||
TokenStream
|
||||
}
|
||||
",
|
||||
"#,
|
||||
expect![[r#"
|
||||
crate
|
||||
AnotherTrait: m
|
||||
|
@ -927,11 +929,12 @@ fn proc_macro_censoring() {
|
|||
// Make sure that only proc macros are publicly exported from proc-macro crates.
|
||||
|
||||
check(
|
||||
r"
|
||||
r#"
|
||||
//- /main.rs crate:main deps:macros
|
||||
pub use macros::*;
|
||||
|
||||
//- /macros.rs crate:macros
|
||||
#![crate_type="proc-macro"]
|
||||
pub struct TokenStream;
|
||||
|
||||
#[proc_macro]
|
||||
|
@ -953,7 +956,7 @@ fn proc_macro_censoring() {
|
|||
macro_rules! mbe {
|
||||
() => {};
|
||||
}
|
||||
",
|
||||
"#,
|
||||
expect![[r#"
|
||||
crate
|
||||
DummyTrait: m
|
||||
|
@ -966,14 +969,15 @@ fn proc_macro_censoring() {
|
|||
#[test]
|
||||
fn collects_derive_helpers() {
|
||||
let def_map = compute_crate_def_map(
|
||||
r"
|
||||
r#"
|
||||
#![crate_type="proc-macro"]
|
||||
struct TokenStream;
|
||||
|
||||
#[proc_macro_derive(AnotherTrait, attributes(helper_attr))]
|
||||
pub fn derive_macro_2(_item: TokenStream) -> TokenStream {
|
||||
TokenStream
|
||||
}
|
||||
",
|
||||
"#,
|
||||
);
|
||||
|
||||
assert_eq!(def_map.exported_derives.len(), 1);
|
||||
|
|
Loading…
Add table
Reference in a new issue