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

Extend #[deriving(...)] helpers to expose field attributes #17089

Closed
wants to merge 7 commits into from

Conversation

erickt
Copy link
Contributor

@erickt erickt commented Sep 7, 2014

This pull request adds field attribute support to the syntax::ext::deriving library. This allows #[deriving(...)] handlers to work with attributes. For example, this could enable the #[deriving(Encodable, Decodable)] to customize how a field name is serialized, which is useful if implementing a schema that uses a field name that is a rust keyword.

This also includes some minor cleanup of a couple bits of libsyntax.

@brson
Copy link
Contributor

brson commented Sep 12, 2014

cc @huonw @nikomatsakis Somebody should have an opinion on this.

pub attrs: &'a [ast::Attribute],
}

pub struct StaticFieldInfo<'a> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this get a docstring?

@lilyball
Copy link
Contributor

I like this. We still need to figure out a generic way of customizing deriving, but having access to field attributes is going to be necessary.

@erickt
Copy link
Contributor Author

erickt commented Sep 23, 2014

@kballard: thanks for checking it out. I'm going to close this now, because I think I found a better way to do this that should also simplify down how to write #[deriving(...)] syntax extensions. I'm hoping to push up that PR later on tonight.

@erickt erickt closed this Sep 23, 2014
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

Successfully merging this pull request may close these issues.

3 participants