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

Add support for macro expansion inside trait items #34213

Merged
merged 1 commit into from Jun 28, 2016
Merged

Add support for macro expansion inside trait items #34213

merged 1 commit into from Jun 28, 2016

Conversation

josephDunne
Copy link
Contributor

@josephDunne josephDunne commented Jun 11, 2016

syntax-[breaking-change] cc #31645
New TraitItemKind::Macro variant

This change adds support for macro expansion inside trait items by adding the new TraitItemKind::Macro and associated parsing code. Please humbly consider this for inclusion in the next batch of breaking libsyntax changes. I would like to use it in one of my crates.

Also since this is my first commit please let me know if this commit is up to standards.

@nrc this is in relation to #34183 - I am not sure if the Rust team want to support this but it seems to work out just fine.

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @pnkfelix (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@jseyfried
Copy link
Contributor

@josephDunne Nice!
Reviewed everything but the changes in the parser, looks good. Travis is failing from trailing whitespace.

@josephDunne
Copy link
Contributor Author

@jseyfried thanks for reviewing. I have fixed the formatting errors. Will wait to see if travis completes to see if I got them all.

@nrc
Copy link
Member

nrc commented Jun 16, 2016

cc @Manishearth (syntax breaking batch)

@Manishearth
Copy link
Member

is there a desire to merge this now, or can we wait for more breaking PRs?

@petrochenkov if you still have planned breaking changes, might want to get ready to make them 😄

@petrochenkov
Copy link
Contributor

@Manishearth

if you still have planned breaking changes, might want to get ready to make them

Surpisingly, I don't have any.

@Manishearth
Copy link
Member

😆

@bors
Copy link
Contributor

bors commented Jun 16, 2016

☔ The latest upstream changes (presumably #34239) made this pull request unmergeable. Please resolve the merge conflicts.

@josephDunne
Copy link
Contributor Author

@Manishearth no rush from my side. will fix merge conflicts

jseyfried added a commit to jseyfried/rust that referenced this pull request Jun 25, 2016
…eyfried

**syntax-[breaking-change]** cc rust-lang#31645
New `TraitItemKind::Macro` variant

This change adds support for macro expansion inside trait items by adding the new `TraitItemKind::Macro` and associated parsing code.
bors added a commit that referenced this pull request Jun 26, 2016
Batch up libsyntax breaking changes

Batch of the following syntax-[breaking-change] changes:
 - #34213: Add a variant `Macro` to `TraitItemKind`
 - #34368: Merge the variant `QPath` of `PatKind` into the variant `PatKind::Path`
 - #34385: Move `syntax::ast::TokenTree` into a new module `syntax::tokenstream`
 - #33943:
  - Remove the type parameter from `visit::Visitor`
  - Remove `attr::WithAttrs` -- use `attr::HasAttrs` instead.
  - Change `fold_tt`/`fold_tts` to take token trees by value and avoid wrapping token trees in `Rc`.
  - Remove the field `ctxt` of `ast::Mac_`
  - Remove inherent method `attrs()` of types -- use the method `attrs` of `HasAttrs` instead.
 - #34316:
  - Remove `ast::Decl`/`ast::DeclKind` and add variants `Local` and `Item` to `StmtKind`.
  - Move the node id for statements from the `StmtKind` variants to a field of `Stmt` (making `Stmt` a struct instead of an alias for `Spanned<StmtKind>`)
  - Rename `ast::ExprKind::Again` to `Continue`.
 - #34339: Generalize and abstract `ThinAttributes` to `ThinVec<Attribute>`
  - Use `.into()` in convert between `Vec<Attribute>` and `ThinVec<Attribute>`
  - Use autoderef instead of `.as_attr_slice()`
 - #34436: Remove the optional expression from `ast::Block` and instead use a `StmtKind::Expr` at the end of the statement list.
 - #34403: Move errors into a separate crate (unlikely to cause breakage)
bors added a commit that referenced this pull request Jun 27, 2016
Batch up libsyntax breaking changes

Batch of the following syntax-[breaking-change] changes:
 - #34213: Add a variant `Macro` to `TraitItemKind`
 - #34368: Merge the variant `QPath` of `PatKind` into the variant `PatKind::Path`
 - #34385: Move `syntax::ast::TokenTree` into a new module `syntax::tokenstream`
 - #33943:
  - Remove the type parameter from `visit::Visitor`
  - Remove `attr::WithAttrs` -- use `attr::HasAttrs` instead.
  - Change `fold_tt`/`fold_tts` to take token trees by value and avoid wrapping token trees in `Rc`.
  - Remove the field `ctxt` of `ast::Mac_`
  - Remove inherent method `attrs()` of types -- use the method `attrs` of `HasAttrs` instead.
 - #34316:
  - Remove `ast::Decl`/`ast::DeclKind` and add variants `Local` and `Item` to `StmtKind`.
  - Move the node id for statements from the `StmtKind` variants to a field of `Stmt` (making `Stmt` a struct instead of an alias for `Spanned<StmtKind>`)
  - Rename `ast::ExprKind::Again` to `Continue`.
 - #34339: Generalize and abstract `ThinAttributes` to `ThinVec<Attribute>`
  - Use `.into()` in convert between `Vec<Attribute>` and `ThinVec<Attribute>`
  - Use autoderef instead of `.as_attr_slice()`
 - #34436: Remove the optional expression from `ast::Block` and instead use a `StmtKind::Expr` at the end of the statement list.
 - #34403: Move errors into a separate crate (unlikely to cause breakage)
@bors bors merged commit dc3d878 into rust-lang:master Jun 28, 2016
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.

None yet

8 participants