Unhelpful error message for `use` in case of missing `crate`

Currently, the compiler does not return the most helpful error message (*) if the crate keyword is missing in module imports, like this. Now I am not sure, if I should add an issue to the rust project page (**), since the final word on the path clarity topic is not spoken. How would the final decision influence this situation? I am a bit out of the loop on this one.

(*) At least to me… at first encounter. My fingers did not get used to the new rule yet and I make this mistake often still.
(**) And try to improve the error message on my own :stuck_out_tongue:

This is definitely bad diagnostics, and bad diagnostics should be issues in the rust repo. I’ve looked at existing issues and I can’t seem to find anything matching this? There are overarching issues with related topics, but I think making a separate issue would be more useful since this is a small diagnostics failure that can be fixed separately.

Whether you want to try and improve it is up to you! If you do make an issue, and note that you’d be willing to help, I’m sure people would be willing to mentor/give you some reference of where this would need to be changed. That is, if you aren’t already familiar with the area - if you are, I guess you could just submit an issue and pull request at the same time? Or just a pull request - I’m less familiar with the contributing requirements.

Regardless I think making an issue would be a good idea. If it ends up as “won’t fix” or “will fix some other way” (which I seriously doubt - this is a horrible message), then no harm is done, and anyone else having the same issue will be able to find it easier since it’ll be searchable in the rust repo.

Thank you for the reply. I opened an issue. I’m unfamiliar with the error reporting code in the compiler, I tinkered a bit with the type resolving part – not very successfully though. I added a note that I would like to improve the error message but would need some mentoring.

1 Like

Ok, it seems that the “uniform paths” variant of the path clarity effort will be stabilized in the next stable release, which allows uses without crate keywords. So my code example would compile and no confusing error message would be shown.