-
-
Notifications
You must be signed in to change notification settings - Fork 115
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 "impl PartialEq<&str> for Ident" #186
Comments
Probably we could use |
This impl already exists. Playground |
Oooh... now I'm really curious why my code wasn't working. So what about |
Idents are stored in a thread local interner -- rust-lang/rust#38356. That's why they are not Send. Exposing a conversion from &'a Ident to &'a str would be unsound because you could do |
@dtolnay Thank's for clarification, I believe this issue should be closed |
Currently there's only one way to examine contents of an
Ident
-&*ident.to_string() == "foo"
. I'd say this is kind of cumbersome and the more direct approach would be useful -ident == "foo"
.By the way, I had encountered some people from the core team claim it's not safe to expose an a
str
reference from Ident - I don't know why and I would really love to be given an explanation. But keeping this in mind, still, proposedimpl
doesn't expose anything so it's should be safe anyway.The text was updated successfully, but these errors were encountered: