mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 15:23:46 +00:00
Add a test for $crate
inside macro invocation
This commit is contained in:
parent
b8ec4c4d11
commit
7aaf0de700
24
src/test/ui/proc-macro/dollar-crate-issue-62325.rs
Normal file
24
src/test/ui/proc-macro/dollar-crate-issue-62325.rs
Normal file
@ -0,0 +1,24 @@
|
||||
//~ ERROR expected type, found `$`
|
||||
|
||||
// edition:2018
|
||||
// aux-build:test-macros.rs
|
||||
|
||||
// Anonymize unstable non-dummy spans while still showing dummy spans `0..0`.
|
||||
// normalize-stdout-test "bytes\([^0]\w*\.\.(\w+)\)" -> "bytes(LO..$1)"
|
||||
// normalize-stdout-test "bytes\((\w+)\.\.[^0]\w*\)" -> "bytes($1..HI)"
|
||||
|
||||
#![feature(proc_macro_hygiene)]
|
||||
|
||||
#[macro_use]
|
||||
extern crate test_macros;
|
||||
|
||||
type S = u8;
|
||||
|
||||
macro_rules! m { () => {
|
||||
#[print_attr]
|
||||
struct A(identity!($crate::S));
|
||||
}}
|
||||
|
||||
m!();
|
||||
|
||||
fn main() {}
|
4
src/test/ui/proc-macro/dollar-crate-issue-62325.stderr
Normal file
4
src/test/ui/proc-macro/dollar-crate-issue-62325.stderr
Normal file
@ -0,0 +1,4 @@
|
||||
error: expected type, found `$`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
61
src/test/ui/proc-macro/dollar-crate-issue-62325.stdout
Normal file
61
src/test/ui/proc-macro/dollar-crate-issue-62325.stdout
Normal file
@ -0,0 +1,61 @@
|
||||
PRINT-ATTR INPUT (DISPLAY): struct A(identity!($crate :: S));
|
||||
PRINT-ATTR RE-COLLECTED (DISPLAY): struct A ( identity ! ( $ crate :: S ) ) ;
|
||||
PRINT-ATTR INPUT (DEBUG): TokenStream [
|
||||
Ident {
|
||||
ident: "struct",
|
||||
span: #0 bytes(0..0),
|
||||
},
|
||||
Ident {
|
||||
ident: "A",
|
||||
span: #0 bytes(0..0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "identity",
|
||||
span: #0 bytes(0..0),
|
||||
},
|
||||
Punct {
|
||||
ch: '!',
|
||||
spacing: Alone,
|
||||
span: #0 bytes(0..0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Parenthesis,
|
||||
stream: TokenStream [
|
||||
Punct {
|
||||
ch: '$',
|
||||
spacing: Alone,
|
||||
span: #0 bytes(0..0),
|
||||
},
|
||||
Ident {
|
||||
ident: "crate",
|
||||
span: #0 bytes(0..0),
|
||||
},
|
||||
Punct {
|
||||
ch: ':',
|
||||
spacing: Joint,
|
||||
span: #0 bytes(0..0),
|
||||
},
|
||||
Punct {
|
||||
ch: ':',
|
||||
spacing: Alone,
|
||||
span: #0 bytes(0..0),
|
||||
},
|
||||
Ident {
|
||||
ident: "S",
|
||||
span: #0 bytes(0..0),
|
||||
},
|
||||
],
|
||||
span: #0 bytes(0..0),
|
||||
},
|
||||
],
|
||||
span: #0 bytes(0..0),
|
||||
},
|
||||
Punct {
|
||||
ch: ';',
|
||||
spacing: Alone,
|
||||
span: #0 bytes(0..0),
|
||||
},
|
||||
]
|
Loading…
Reference in New Issue
Block a user