-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Bogus error when creating for an impl for a nonexistent type #8767
Comments
@owaspjocur I don't understand your question, and that's not valid syntax. You can only create an impl for a type in the same module. |
definitely I'm confused :-P. Im trying to determine how to fix this issue.Has been a while I didnt work with C like language(last 5 years have been working with C# and Java) ;-) |
Yes, your assumption is correct. The goal is to provide an error message that makes sense when a program tries to create an impl for a type that is not in scope (ie. does not exist). |
The code I provided is a Rust compiler file (which i changed), not a new one. Im trying to understand where in the code can I implement this fix |
Find the place that generates the error message, and follow the code backwards until it's clear where you could modify it to produce a better error message for this case. |
Someone gave me a good tip on how to debug Rust http://michaelwoerister.github.io/2013/09/27/what-you-call-the-present.html. I will try this. The terminal is quite archaic ;-P |
@owaspjocur I think @jdm's point was essentially "grep for the error message, and look at the code there", using a full debugger to find out where it is is probably still quite hard at the moment. In any case, running |
@huonw I used Eclipse as explained by Michael and did a search and found that file. Now correct me if I'm wrong but the it seems that there is no I'm going to attempt to add a case and test |
@jdm in ast.rs there is an enumeration, I dont see one for 'impl' (such as DefTrait for example) |
No, because the name we are creating an impl for is not itself an impl; the compiler seems to think that it is a module instead. Figuring out why this is the case would be a good start. |
@jdm seems like astriranna solved the issue by adding:
|
I just tested but this does not work for 'impl' (still get the same error message) |
Yes, that is not a solution, just a slightly clearer (but still incorrect) error message. |
Issue #8763 is about improving a particular error message. * added case & better error message for "impl trait for module" * added compile-fail test trait-impl-for-module.rs * updated copyright dates * revised compile-fail test trait-or-new-type-instead (the error message for the modified test is still unclear, but that's a different bug #8767)
…he current module Followup to RFC 57. Fixes rust-lang#7607 Fixes rust-lang#8767 Fixes rust-lang#12729 Fixes rust-lang#15060
…effen Add missing quite in `large_include_file` example Roses are red, violets are blue, this fix, was simple to do Closes: rust-lang/rust-clippy#8765 changelog: None
The text was updated successfully, but these errors were encountered: