Resolve $crates for pretty-printing at more appropriate time

This commit is contained in:
Vadim Petrochenkov 2018-12-28 00:31:28 +03:00
parent 24af9f88a5
commit e40d7d9643
7 changed files with 53 additions and 40 deletions

View file

@ -1,3 +1,4 @@
// compile-pass
// edition:2018
// aux-build:dollar-crate.rs
@ -15,7 +16,7 @@ macro_rules! m {
struct M($crate::S);
}
#[dollar_crate::a] //~ ERROR expected type, found `$`
#[dollar_crate::a]
struct A($crate::S);
};
}

View file

@ -1,11 +0,0 @@
error: expected type, found `$`
--> $DIR/dollar-crate-in-tokens.rs:18:9
|
LL | #[dollar_crate::a] //~ ERROR expected type, found `$`
| ^^^^^^^^^^^^^^^^^^
...
LL | m!();
| ----- in this macro invocation
error: aborting due to previous error

View file

@ -38,48 +38,43 @@ PROC MACRO INPUT: TokenStream [
span: #2 bytes(LO..HI)
}
]
ATTRIBUTE INPUT (PRETTY-PRINTED): struct A($crate::S);
ATTRIBUTE INPUT (PRETTY-PRINTED): struct A(crate::S);
ATTRIBUTE INPUT: TokenStream [
Ident {
ident: "struct",
span: #0 bytes(0..0)
span: #2 bytes(LO..HI)
},
Ident {
ident: "A",
span: #0 bytes(0..0)
span: #2 bytes(LO..HI)
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Punct {
ch: '$',
spacing: Alone,
span: #0 bytes(0..0)
},
Ident {
ident: "crate",
span: #0 bytes(0..0)
ident: "$crate",
span: #2 bytes(LO..HI)
},
Punct {
ch: ':',
spacing: Joint,
span: #0 bytes(0..0)
span: #2 bytes(LO..HI)
},
Punct {
ch: ':',
spacing: Alone,
span: #0 bytes(0..0)
span: #2 bytes(LO..HI)
},
Ident {
ident: "S",
span: #0 bytes(0..0)
span: #2 bytes(LO..HI)
}
],
span: #0 bytes(0..0)
span: #2 bytes(LO..HI)
},
Punct {
ch: ';',
spacing: Alone,
span: #0 bytes(0..0)
span: #2 bytes(LO..HI)
}
]