-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Fixes regression caused by enum and struct callpaths. #4007
Fixes regression caused by enum and struct callpaths. #4007
Conversation
The issue is that the module in which a struct or enum is can be imported with different callpaths. For instance we could have a struct with callpath `my_script::data_structures::SomeStruct` in a module and in another module as `my_script::eq_impls::data_structures::SomeStruct`. This makes callpaths unreliable to compare declarations. Closes #3998 Reopens #418 Disables tests multiple_enums_with_the_same_name and multiple_structs_with_the_same_name.
Thanks for the quick fix @esdrubal Is the issue here that the call path used in type unification does not always refer to actual struct/enum declaration? I would have assumed that there is a unique path for the struct/enum declaration. Where is the other path coming from? Is it from the |
Hi @esdrubal, I think what you are saying is that even though two If so, you might be interested in taking a look at #3744, among other things this PR changes |
Oh excellent. In that case, I suggest we merge this PR to fix the regression until #3744 is complete. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of the temporary approaches we could take would be to add "unimplemented" compile errors for using types with a call path. i.e. the case defined here #1644. But if my hunch is right, then this unimplemented error will catch the case in #418, thereby disallowing any syntax like module0::Thing::new()
, which is a breaking change and undesirable.
I can think of some temporary hacks to prevent #418, but I'm more inclined to block that bug behind #3744 instead. Approving this patch right now though.
Yes that's exactly the problem. If we have two modules A and B using an enum in module C, in module A we will have the enum declaration with call path |
Description
The issue is that struct or enum can be imported with different callpaths depending the module they are imported from.
For instance we could have a struct with callpath
my_script::data_structures::SomeStruct
in a module and in another module asmy_script::eq_impls::data_structures::SomeStruct
. This makes callpaths unreliable to compare declarations.Closes #3998
Reopens #418
Disables tests multiple_enums_with_the_same_name and multiple_structs_with_the_same_name because they relied in callpath comparisons to work.
Checklist
Breaking*
orNew Feature
labels where relevant.