Skip to content
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

Macro expansion in for trait items #34183

Closed
josephDunne opened this issue Jun 9, 2016 · 4 comments
Closed

Macro expansion in for trait items #34183

josephDunne opened this issue Jun 9, 2016 · 4 comments

Comments

@josephDunne
Copy link
Contributor

Hi, I see that in ast.rs there is no expectation for macro items inside a trait:

pub enum TraitItemKind {
    Const(P<Ty>, Option<P<Expr>>),
    Method(MethodSig, Option<P<Block>>),
    Type(TyParamBounds, Option<P<Ty>>),
}

Is there a reason for this? I would like to build up Trait definitions via macros the same way I would build a struct or impl items using macros.

@jseyfried
Copy link
Contributor

c.f. #5668
cc @nrc -- do you think we should support this?

@josephDunne
Copy link
Contributor Author

josephDunne commented Jun 10, 2016

My use case is generating trait extensions for a builder object for the Rust version of Flatbuffers: google/flatbuffers#3894
Would be nice to get rid of the boilerplate with macros.

@nrc
Copy link
Member

nrc commented Jun 14, 2016

I think we probably could, I'm in no great rush, but it seems like a good thing.

@jseyfried
Copy link
Contributor

This was fixed in #34213.

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

3 participants