-
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
Check that the bounds of impl are implied by trait in a more general way #20020
Labels
Milestone
Comments
nikomatsakis
changed the title
Checking that the bounds on an impl are consistent with the trait should be done with where clauses
Check that the bounds of impl are implied by trait in a more general way
Dec 19, 2014
When fixing this, be sure that #20107 is fixed too. |
Putting this on 1.0 alpha as a (very) nice to have. @jroesch is working on it. |
Motivation is that it will help guide people to not write illegal programs :) |
bors
added a commit
that referenced
this issue
Jan 15, 2015
…sakis This should fix both #20020 and #20107. This moves out the code into its own file. I have a couple concerns that can either be addressed in this PR or in a future one. - The error reporting for the fulfillment context should be span aware because currently it is attached to the top of the file which is less then desirable. - There is a failure in the test file: run-pass/issue-2611-3.rs, this seems like it should be a failure to me, but I am not sure. As a nit I'm not enthused about the file name, and am open to better suggestions. r? @nikomatsakis
kmcallister
added
A-type-system
Area: Type system
A-trait-system
Area: Trait system
labels
Jan 16, 2015
I believe this has been fixed by #20290 closing |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently we check that the where clauses on an impl are consistent with a trait by examining the
TypeParameterDefs
, and also with some specialized code around regions. This is not consistent with generalized where clauses. Probably the right approach is to:ParameterEnvironment
that contains the bounds from the trait method, substituted appropriately so that they are in the namespace of the impl.select_all_or_error()
. If any errors result, that indicates a bound in the impl that does not appear in the trait.resolve_regions_and_report_errors()
as well to check for region obligations that are not satisfiable.We may want to take some care here with respect to error messages; we probably want to print something more helpful about how there is a mismatch between the trait and impl.
The text was updated successfully, but these errors were encountered: