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

Fix some simple associated const issues. #25065

Merged

Conversation

quantheory
Copy link
Contributor

This fixes #24922 and #25017, and reduces the number of error messages that talk about "methods" when associated constants rather than methods are involved.

I will admit that I haven't thought very carefully about the error messages. My goal has been to make more of the messages technically correct in all situations, and to avoid ICEs. But in some cases we could probably talk specifically about "methods" rather than "items".

@rust-highfive
Copy link
Collaborator

r? @alexcrichton

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

@alexcrichton
Copy link
Member

r? @nikomatsakis

@nikomatsakis
Copy link
Contributor

This all seems good to me modulo that one error message (which also happens to be pretty frequent). I think we should ensure it's phrased in as comprehensible a way as possible. I'm now thinking:

No method {} found for type {} in the current scope

or, when not doing a method lookup,

No item {} found for type {} in the current scope

@quantheory
Copy link
Contributor Author

@nikomatsakis Better?

@nikomatsakis
Copy link
Contributor

@quantheory much. Sorry for being slow, was on partial vacation last week.

@bors r+

@bors
Copy link
Contributor

bors commented May 11, 2015

📌 Commit a5e6075 has been approved by nikomatsakis

@bors
Copy link
Contributor

bors commented May 11, 2015

⌛ Testing commit a5e6075 with merge 1eb21ca...

@bors
Copy link
Contributor

bors commented May 11, 2015

💔 Test failed - auto-linux-64-x-android-t

@alexcrichton
Copy link
Member

Perhaps a rebase for this PR is in order? Failures like that generally don't turn out to be false negatives unfortunately.

@oli-obk
Copy link
Contributor

oli-obk commented May 11, 2015

i tried it locally, even with the rebase that line has to go.

@quantheory quantheory force-pushed the fix_associated_const_ambiguity_message branch 2 times, most recently from 94c3e8a to 5beaeab Compare May 11, 2015 19:23
@quantheory
Copy link
Contributor Author

I haven't had the chance to do a full make check, but I tried just rebasing and fixing the one line, if you want to give it another go.

@quantheory
Copy link
Contributor Author

The version here passed make check as well.

@alexcrichton
Copy link
Member

@bors: r=nikomatsakis 5beaeab

@bors
Copy link
Contributor

bors commented May 12, 2015

⌛ Testing commit 5beaeab with merge b5277ba...

@bors
Copy link
Contributor

bors commented May 12, 2015

⛄ The build was interrupted to prioritize another pull request.

@bors
Copy link
Contributor

bors commented May 12, 2015

⌛ Testing commit 5beaeab with merge 543ef45...

@bors
Copy link
Contributor

bors commented May 12, 2015

⛄ The build was interrupted to prioritize another pull request.

@bors
Copy link
Contributor

bors commented May 13, 2015

⌛ Testing commit 5beaeab with merge 4a5e4cd...

@bors
Copy link
Contributor

bors commented May 13, 2015

⛄ The build was interrupted to prioritize another pull request.

@bors
Copy link
Contributor

bors commented May 13, 2015

⌛ Testing commit 5beaeab with merge 65ea478...

@bors
Copy link
Contributor

bors commented May 13, 2015

⛄ The build was interrupted to prioritize another pull request.

@bors
Copy link
Contributor

bors commented May 13, 2015

⌛ Testing commit 5beaeab with merge bcc76d4...

@bors
Copy link
Contributor

bors commented May 13, 2015

⛄ The build was interrupted to prioritize another pull request.

@bors
Copy link
Contributor

bors commented May 13, 2015

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

@quantheory quantheory force-pushed the fix_associated_const_ambiguity_message branch from 5beaeab to 29b31d0 Compare May 14, 2015 00:08
Also change several error messages to refer to "items" rather than
"methods", since associated items that require resolution during type
checking are not always methods.
@quantheory quantheory force-pushed the fix_associated_const_ambiguity_message branch from 29b31d0 to b4bbf3a Compare May 14, 2015 00:10
@quantheory
Copy link
Contributor Author

Rebased, passes make check.

@alexcrichton
Copy link
Member

@bors: r=nikomatsakis b4bbf3a

@bors
Copy link
Contributor

bors commented May 14, 2015

⌛ Testing commit b4bbf3a with merge 1b5b639...

bors added a commit that referenced this pull request May 14, 2015
…age, r=nikomatsakis

This fixes #24922 and #25017, and reduces the number of error messages that talk about "methods" when associated constants rather than methods are involved.

I will admit that I haven't thought very carefully about the error messages. My goal has been to make more of the messages technically correct in all situations, and to avoid ICEs. But in some cases we could probably talk specifically about "methods" rather than "items".
@bors bors merged commit b4bbf3a into rust-lang:master May 14, 2015
bors added a commit that referenced this pull request May 26, 2015
…omatsakis

Closes #25046 (by rejecting the code that causes the ICE) and #24946. I haven't been able to deal with the array size or recursion issues yet for associated consts, though my hope was that the change I made for range match patterns might help with array sizes, too.

This PR is pretty much orthogonal to #25065.
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.

ICE on ambiguous associated const reference
6 participants