-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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 Span::unique_site #60106
Add Span::unique_site #60106
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
I need to think how to do this properly, so it may take some time. Adding a new |
I'm going to close this, I think. How to approach writing such an RFC.
The motivation for introducing |
@petrochenkov Sorry, I'm not sure I fully understand your comment. I'm not sure if I can write an RFC, but I'm kinda surprised you want a whole RFC for a single method on a type that is already 90% unstable. But sure, I'll write an RFC. |
For generating unique identifiers, for various purposes.
It would be great to describe those use cases in the RFC.
I wouldn't underestimate how tricky and complex this single method is. |
A little bit of background: Feedback on Span::def_site
Span::def_site
is useful in that call-site code cannot access identifiers which use it. But it doesn't prevent identifier clashes within the macro, particularly when the macro is implemented using several subcomponents, each of which generates a portion of the macro. These subcomponents may use conflicting identifiers.The new
Span::unique_site
solves this problem. Each call toSpan::unique_site
generates a new span that resolves at a unique site. It allows a macro to isolate parts of its expansion from each other.