Skip to content

Add a more precise error message for issue #35976 #43600

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

Merged
merged 4 commits into from
Aug 4, 2017

Conversation

scalexm
Copy link
Member

@scalexm scalexm commented Aug 1, 2017

When trying to perform static dispatch on something which derefs to a trait object, and the target trait is not in scope, we had confusing error messages if the target method had a Self: Sized bound. We add a more precise error message in this case: "consider using trait ...".

Fixes #35976.

r? @nikomatsakis

@rust-highfive
Copy link
Contributor

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @nikomatsakis (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. Due to 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.

scalexm added 3 commits August 3, 2017 14:40
When trying to perform static dispatch on something which derefs
to a trait object, and the target trait is not in scope, we had
confusing error messages if the target method had a
`Self: Sized` bound. We add a more precise error message in this
case: "consider using trait ...".

Fixes rust-lang#35976.
@aidanhs
Copy link
Member

aidanhs commented Aug 3, 2017

Thanks for the PR! We'll check in now and again to make sure @nikomatsakis or another reviewer gets to this soon.

@aidanhs aidanhs added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 3, 2017
Copy link
Contributor

@nikomatsakis nikomatsakis left a comment

Choose a reason for hiding this comment

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

r=me modulo the nit about the variable name

@@ -38,6 +38,11 @@ impl<'a, 'gcx, 'tcx> Deref for ConfirmContext<'a, 'gcx, 'tcx> {
}
}

pub struct ConfirmResult<'tcx> {
pub callee: MethodCallee<'tcx>,
pub rerun: bool,
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: can we give this a more informative name? It seems that it actually means that there was an illegal sized bound, right?

@Mark-Simulacrum
Copy link
Member

@bors r=nikomatsakis

@bors
Copy link
Collaborator

bors commented Aug 4, 2017

📌 Commit e7e620d has been approved by nikomatsakis

@bors
Copy link
Collaborator

bors commented Aug 4, 2017

⌛ Testing commit e7e620d with merge dae8864...

bors added a commit that referenced this pull request Aug 4, 2017
Add a more precise error message for issue #35976

When trying to perform static dispatch on something which derefs to a trait object, and the target trait is not in scope, we had confusing error messages if the target method had a `Self: Sized` bound. We add a more precise error message in this case: "consider using trait ...".

Fixes #35976.

r? @nikomatsakis
@bors
Copy link
Collaborator

bors commented Aug 4, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: nikomatsakis
Pushing dae8864 to master...

@bors bors merged commit e7e620d into rust-lang:master Aug 4, 2017
@luser
Copy link
Contributor

luser commented Aug 4, 2017

Thanks for making this error better! I spent a lot of time puzzling over the current error message the last time I encountered it.

@scalexm scalexm deleted the issue-35976 branch August 9, 2017 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants