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

move get_ident and get_name free function onto the Ident and Name types #27234

Merged
merged 1 commit into from
Jul 28, 2015

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Jul 23, 2015

this has quite some fallout. but also made lots of stuff more readable imo

[breaking-change] for plugin authors

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @huonw (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way Github handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@eddyb
Copy link
Member

eddyb commented Jul 23, 2015

Do we need Ident::get_ident? Also, Name::get_name could be just Name::as_str - the current implementation for the latter is unsound anyway (the interning tables are not eternal nor thread-safe).

@@ -313,10 +313,10 @@ mod svh_visitor {
// Ad-hoc overloading between Ident and Name to their intern table lookups.
trait InternKey { fn get_content(self) -> token::InternedString; }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eddyb: I could implement something like this... maybe From<Ident/Name> for InternedString?

@alexcrichton
Copy link
Member

cc @rust-lang/compiler

@nikomatsakis
Copy link
Contributor

looks nice to me.

@oli-obk oli-obk force-pushed the move_get_name_get_ident_to_impl branch 2 times, most recently from 410abfa to cc476e9 Compare July 24, 2015 12:44
@bors
Copy link
Contributor

bors commented Jul 26, 2015

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

@oli-obk oli-obk force-pushed the move_get_name_get_ident_to_impl branch from d6d1e51 to 2f6d5dd Compare July 27, 2015 06:28
@oli-obk
Copy link
Contributor Author

oli-obk commented Jul 27, 2015

rebased and applied @eddyb's suggestion to make as_str sound and remove get_ident

caused additional fallout obviously.

@@ -166,12 +159,15 @@ pub const ILLEGAL_CTXT : SyntaxContext = 1;
RustcEncodable, RustcDecodable, Clone, Copy)]
pub struct Name(pub u32);

impl<T: AsRef<str>> PartialEq<T> for Name {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I figured this would make life a lot easier. sadly I cannot implement the commutative version of this.

The alternative was often &*ident.name.as_str() == "text" when it's now ident.name == "text"

@eddyb
Copy link
Member

eddyb commented Jul 27, 2015

@oli-obk Apart from the .into() calls (which I'm unsure about), it looks really good to me, great work!

@huonw
Copy link
Member

huonw commented Jul 27, 2015

r? @eddyb (seems to have it under control)

@rust-highfive rust-highfive assigned eddyb and unassigned huonw Jul 27, 2015
@oli-obk oli-obk force-pushed the move_get_name_get_ident_to_impl branch 3 times, most recently from cfd225b to abc3317 Compare July 28, 2015 10:38
@oli-obk
Copy link
Contributor Author

oli-obk commented Jul 28, 2015

removed into-impl, replaced all calls by to_str, rebased and squashed

@eddyb
Copy link
Member

eddyb commented Jul 28, 2015

@bors r+

@bors
Copy link
Contributor

bors commented Jul 28, 2015

📌 Commit abc3317 has been approved by eddyb

@bors
Copy link
Contributor

bors commented Jul 28, 2015

⌛ Testing commit abc3317 with merge 1232a4d...

@bors
Copy link
Contributor

bors commented Jul 28, 2015

💔 Test failed - auto-mac-64-nopt-t

@oli-obk oli-obk force-pushed the move_get_name_get_ident_to_impl branch from abc3317 to 00a5e66 Compare July 28, 2015 16:07
@oli-obk
Copy link
Contributor Author

oli-obk commented Jul 28, 2015

sorry about that. I had sporadic failures in test_process_mask and thought the rest went through...

now "make check" passed without a single complaint.

@eddyb
Copy link
Member

eddyb commented Jul 28, 2015

@bors r+

@bors
Copy link
Contributor

bors commented Jul 28, 2015

📌 Commit 00a5e66 has been approved by eddyb

@bors
Copy link
Contributor

bors commented Jul 28, 2015

⌛ Testing commit 00a5e66 with merge 55ede7e...

bors added a commit that referenced this pull request Jul 28, 2015
this has quite some fallout. but also made lots of stuff more readable imo

[breaking-change] for plugin authors
@bors bors merged commit 00a5e66 into rust-lang:master Jul 28, 2015
@oli-obk oli-obk deleted the move_get_name_get_ident_to_impl branch July 29, 2015 10:38
zsiciarz added a commit to zsiciarz/json_macros that referenced this pull request Jul 29, 2015
zsiciarz added a commit to zsiciarz/docopt.rs that referenced this pull request Jul 29, 2015
dgrunwald added a commit to dgrunwald/interpolate_idents that referenced this pull request Aug 2, 2015
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.

7 participants