-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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: refactor away the field Module::external_module_children #31317
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,8 @@ | |
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
fn std() {} //~ ERROR the name `std` conflicts with an external crate | ||
fn std() {} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why does There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Right now, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, seems fine, thanks for the explanation |
||
mod std {} //~ ERROR the name `std` conflicts with an external crate | ||
|
||
fn main() { | ||
} |
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.
Hm, if a non-crate is defined first and a crate is defined second, the error message will be incorrect.
I think both the
else
cases above would be better moved from here and handled byresolve_struct_error
andResolutionError::DuplicateDefinition
.The error messages will have to be tweaked though, something along the lines:
"definition of {kind} {name} conflicts with existing definition of {kind} {name}" where
{kind}
is a precise item kind (including "external crate") and not just "type or module"/"value".multispans can be used to report spans of the both conflicting items at the same time.
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.
Agreed, I'm planning on cleaning up the duplicate errors in a separate PR so that it can be reviewed and discussed independently of this refactoring (unless you would like do that instead).
Thanks for the pointer to multispans -- this looks like a good use case for them.