-
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
resolve: report duplicate-module errors #7325
Conversation
@cmr Any idea what happened? The compile error seems to be completely unrelated to the change. |
@artagnon unfortunately the buildbot seems to be a bit eccentric right now. Only one build failed, and it was a test failure:
So, gotta go in and fix that one. |
add_child() is responsible for reporting errors about type, value, and module duplicate definitions. Although it checks for all three, it uses namespace_to_str() to convert a Namespace value into a string before printing an error like: error: duplicate definition of type `foo` ^^^^ note: first definition of type foo here: ^^^^ Unfortunately, this string can only be one of "type" or "value" (corresponding to TypeNS and ValueNS respectively), and it reports duplicate modules as duplicate types. To alleviate the problem, define a special NamespaceError enum to define more specialized errors, and use it instead of attempting to reuse the Namespace enum. Reported-by: Corey Richardson <[email protected]> Signed-off-by: Ramkumar Ramachandra <[email protected]>
The "first definition of ..." error string reported by add_child() looks different from similar messages reported by other functions. Fix this. Signed-off-by: Ramkumar Ramachandra <[email protected]>
@cmr Thanks for digging it out. But I still didn't understand what the failure is: it was expected to compile-fail, and it actually did compile-fail; or did it try to compare the actual error message with that comment (?) string? |
@artagnon Yes, it compares to the exact error message in the comment. It's a way to make sure we don't break or remove error messages. |
@cmr Okay, thanks. Can you re-approve the new version? |
Fix #7322. I started out with a band-aid approach to special-case the duplicate module error using `is_duplicate_module`, but thought this would be better in the long term.
Fix FP in `default_numeric_fallback` with external macro expansion fixes rust-lang#7304 changelog: Fix `default_numeric_fallback` FP with external macro expansion
Fix #7322.
I started out with a band-aid approach to special-case the duplicate module error using
is_duplicate_module
, but thought this would be better in the long term.