Skip to content

The struct parser does not like token trees, or maybe something weirder #29393

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

Closed
sorear opened this issue Oct 27, 2015 · 1 comment
Closed

Comments

@sorear
Copy link
Contributor

sorear commented Oct 27, 2015

I'm writing an FFI binding with a number of structs that have a fixed part and a variable part. I tried to factor it using a macro which takes the variable part as a sequence of token trees (to allow zero or more fields, possibly with #[cfg] modifiers), but I'm getting a strange parse error; golfed to:

macro_rules! bug1 {
    ($x:tt) => { struct _Bug2 { $x : i32, } }
}

bug1!(_abc);

fn main() {
}

(playpen: http://is.gd/i4195j)

If I change :tt to :ident the short example works, but that doesn't work for my real code which uses a repeated token tree.

Is this supposed to work with :tt ?

@huonw
Copy link
Member

huonw commented Oct 27, 2015

Dupe of #5846. Thanks for filing!

@huonw huonw closed this as completed Oct 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants