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
Closed

Conversation

Diggsey
Copy link
Contributor

@Diggsey Diggsey commented May 16, 2015

Allows accepting a lifetime as a parameter to a macro.

Fixes #23956

@rust-highfive
Copy link
Collaborator

r? @huonw

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

@alexcrichton
Copy link
Member

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.

Allows accepting a lifetime as a parameter to a macro

Fix line wrapping.

Rename "lifetime" to "life" to avoid conflict with future keyword.
@Diggsey
Copy link
Contributor Author

Diggsey commented May 18, 2015

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

@Stebalien
Copy link
Contributor

Bump? @huonw

@huonw
Copy link
Member

huonw commented Jun 17, 2015

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

@huonw huonw added I-nominated T-lang Relevant to the language team, which will review and decide on the PR/issue. labels Jun 17, 2015
@nikomatsakis
Copy link
Contributor

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

@nikomatsakis
Copy link
Contributor

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
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
Copy link
Member

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

@durka
Copy link
Contributor

durka commented Nov 20, 2015

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

@durka
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
Copy link
Member

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
Labels
T-lang Relevant to the language team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't use externally defined lifetimes in macros due to hygiene
9 participants