Skip to content

Make ItemModifier and ItemDecorator take trait objects #17162

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

Merged
merged 2 commits into from
Sep 13, 2014

Conversation

sfackler
Copy link
Member

The other extension types already worked this way and it can be useful to track some state along with the extension.

I also removed the BasicMacroExpander and BasicIdentMacroExpander since the span inside of them was never used. The expander function types now directly implement the relevant trait.

For convenience, the traits are implemented for the respective bare
functions. Change code from this:

```rust
ItemDecorator(some_function)
// or
ItemModifier(some_other_function)
```
to
```rust
ItemDecorator(box some_function)
// or
ItemModifier(box some_other_function)
```

[breaking-change]
The spans inside of these types were always None and never used. Pass
the expander function directly instead of wrapping it in one of these
types.

[breaking-change]
bors added a commit that referenced this pull request Sep 13, 2014
The other extension types already worked this way and it can be useful to track some state along with the extension.

I also removed the `BasicMacroExpander` and `BasicIdentMacroExpander` since the span inside of them was never used. The expander function types now directly implement the relevant trait.
@bors bors closed this Sep 13, 2014
@bors bors merged commit 200a08f into rust-lang:master Sep 13, 2014
@sfackler sfackler deleted the decorator-traits branch November 26, 2016 05:53
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