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 macro lifetime specifier #25509

Closed
wants to merge 1 commit into from

Conversation

Projects
None yet
9 participants
@Diggsey
Copy link
Contributor

Diggsey commented May 16, 2015

Allows accepting a lifetime as a parameter to a macro.

Fixes #23956

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented May 16, 2015

r? @huonw

(rust_highfive has picked a reviewer for you, use r? to override)

@Diggsey Diggsey force-pushed the Diggsey:issue-23956 branch from 68c41a1 to 2e91fb8 May 16, 2015

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented May 18, 2015

One point of possible worry is that lifetime is perhaps slated to become a keyword one day in accordance with the associated types RFC, it just has yet to be implemented.

Add macro lifetime specifier
Allows accepting a lifetime as a parameter to a macro

Fix line wrapping.

Rename "lifetime" to "life" to avoid conflict with future keyword.

@Diggsey Diggsey force-pushed the Diggsey:issue-23956 branch from 2e91fb8 to 9b0be24 May 18, 2015

@Diggsey

This comment has been minimized.

Copy link
Contributor Author

Diggsey commented May 18, 2015

I renamed it to use "life" instead of "lifetime" to avoid the conflict.

@Stebalien

This comment has been minimized.

Copy link
Contributor

Stebalien commented Jun 17, 2015

Bump? @huonw

@huonw

This comment has been minimized.

Copy link
Member

huonw commented Jun 17, 2015

Hm, I think this needs a few more pairs of eyes.

@nikomatsakis

This comment has been minimized.

Copy link
Contributor

nikomatsakis commented Jul 23, 2015

Seems like an RFC would make sense to work out naming etc. But also, this should be feature-gated.

@nikomatsakis

This comment has been minimized.

Copy link
Contributor

nikomatsakis commented Jul 23, 2015

During lang subteam mtg, we decided this should have an RFC, since it is a language extension, albeit a minor one. Removing nomination since we've taken a look (no priority needed).

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Aug 19, 2015

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

@steveklabnik

This comment has been minimized.

Copy link
Member

steveklabnik commented Sep 27, 2015

@Diggsey any interest in pursuing an RFC for this, like @nikomatsakis suggested?

@durka

This comment has been minimized.

Copy link
Contributor

durka commented Nov 20, 2015

I'd be interested in helping with an RFC for this.

@durka

This comment has been minimized.

Copy link
Contributor

durka commented Dec 24, 2015

It occurs to me that adding a fragment specifier for lifetimes doesn't actually fix significant situations where you might want to parse a lifetime specifier, for example in a list of generic parameters. In such a situation you would have to differentiate a lifetime specifier from an identifier, and in general a macro can't alternate on one fragment specifier vs another, unless this is actually a bug (cf #27832).

A design which could allow such alternation is not a new fragment specifier, but a (hopefully minor) modification to the lexer to allow '$ to parse. Then you could have a macro like this, using the apostrophe to differentiate. On the other hand this might be a terrible idea. Thoughts?

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Jan 27, 2016

Closing due to inactivity (and sounds like an RFC is desired)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.