-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Diagnostics for E0364 and E0365 #27071
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way Github handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
Part of #24407. r? @Manishearth |
re-exporting are themselves marked with 'pub': | ||
|
||
``` | ||
mod foo { |
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.
Shouldn't this be pub mod
?
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.
Nevermind, it doesn't need to be.
This looks great! Just some nits and we should be good to go. Thanks! |
Oh, also, the inline error messages could do with some love. A more verbose message, and a |
|
||
E0364: r##" | ||
Private items cannot be publicly re-exported. This error indicates | ||
that you attempted to write a 'pub use' against a type or value that was |
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.
attempted to
pub use
an item that was
Since these diagnostic messages eventually get parsed as markdown, inline code must be delimited by ` (U+0060 GRAVE ACCENT), not ' (U+0027 APOSTROPHE).
Thanks for the comments, I think that should address them! |
I think something like
sounds much more natural than
but that’s mostly up to you if you really want to keep the current version. |
Good point - also apologies, forgot to make tidy before the second commit. I'll fix it up in the morning! |
Actually I just squeezed it in tonight :-) |
☔ The latest upstream changes (presumably #27066) made this pull request unmergeable. Please resolve the merge conflicts. |
Might want to rebase to master and squash your commits into one (let me know if you need help with that 😄 ) |
That should do it I think! |
@bors r+ rollup Thanks! |
📌 Commit 94b1ca8 has been approved by |
If you want a good next bug to work on, try the stuff I mentioned here 😄 |
Added some detailed diagnostics for E0364 and E0365.
@Manishearth : I already included those in this PR I think :) |
let msg = format!("`{}` is private", source); | ||
let msg = format!("`{}` is private, and cannot be reexported", | ||
token::get_name(source)); | ||
let note_msg = format!("Consider declaring module {} as `pub mod`", |
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.
"module {}
as a pub mod
"
Oh wow I totally missed that in my second read-through because I stopped when I reached the bottom of the first file :) nice work! small nit, but I'll fix it in my rollup branch |
Fab, thanks :) |
Added some detailed diagnostics for E0364 and E0365.