Uh oh!
There was an error while loading. Please reload this page.
Add deprecation lint for duplicated macro_exports - #50143
Conversation
rust-highfive
commented
Apr 21, 2018
(rust_highfive has picked a reviewer for you, use r? to override) |
petrochenkov
commented
Apr 21, 2018
cc @rust-lang/lang Needs check-only crater run before proceeding. |
kennytm
commented
Apr 21, 2018
@bors try |
bors
commented
Apr 21, 2018
Prohibit duplicated `macro_export`s cc #35896 (comment)
bors
commented
Apr 21, 2018
☀️ Test successful - status-travis |
Mark-Simulacrum
commented
Apr 21, 2018
Crater run commenced, check-only, ETA ~3 days. |
nikomatsakis
left a comment
There was a problem hiding this comment.
r=me from the technical perspective. I'm not 100% sure about the policy decision, but I guess let's see what the crater run has to say.
| let report_already_exported = |this: &mut Self, ident, span, prev_span| { | ||
| let msg = format!("a macro named `{}` has already been exported", ident); | ||
| this.session.struct_span_err(span, &msg) |
There was a problem hiding this comment.
I'm ok with a hard error, but it seems like there is a defined semantics, right? (Shadowing) We could always issue warnings, in other words.
Mark-Simulacrum
commented
Apr 25, 2018
Crater results: http://cargobomb-reports.s3.amazonaws.com/pr-50143/index.html |
alexcrichton
commented
Apr 25, 2018
Legitimate regressions
The Sounds like this may want to start out as a warning? |
durka
commented
Apr 25, 2018
What would be the motivation for a break here? The whole |
The exact problem is that there's no defined semantics. @durka Since there's breakage, I'd prefer to turn this into a preferably deny-by-default lint so dependent crates are not affected and send PRs to crates with root regressions. |
durka
commented
Apr 26, 2018
I realize that it got accidentally "defined" to work the way it does, but since it does work and it's not unsound or anything, it seems unfortunate to do the breaking change. |
nikomatsakis
commented
Apr 27, 2018
@petrochenkov I would have expected the order to be DFS, since that is significant to other parts of macro expansion. I'm surprised that is complex to achieve, but I'm probably not thinking especially clearly about it. Do you have an example where a problem might arise, or just a bad feeling? I see you wrote this:
Can you point at the relevant code? (This walk is occurring at the end of expansion.) |
nikomatsakis
commented
Apr 27, 2018
(At minimum, some kind of active deprecation definitely makes sense -- and perhaps a hard error in Edition 2018.) |
petrochenkov
commented
Apr 29, 2018
Here, for example, macro_rules! generate_foo {() => {
#[macro_export]
macro_rules! foo {(1) => {}}}}generate_foo!();#[macro_export]macro_rules! foo {(2) => {}}foo!(2);// Local use, OK |
petrochenkov
commented
Apr 29, 2018
I've replaced the error with a deprecation lint. |
bors
commented
May 19, 2018
☔ The latest upstream changes (presumably #50763) made this pull request unmergeable. Please resolve the merge conflicts. |
rfcbot
commented
May 21, 2018
🔔 This is now entering its final comment period, as per the review above. 🔔 |
petrochenkov
commented
May 30, 2018
Rebased. |
rfcbot
commented
May 31, 2018
The final comment period, with a disposition to merge, as per the review above, is now complete. |
nikomatsakis
commented
Jun 8, 2018
@bors r+ |
bors
commented
Jun 8, 2018
📌 Commit 11c283c has been approved by |
bors
commented
Jun 8, 2018
🌲 The tree is currently closed for pull requests below priority 1, this pull request will be tested once the tree is reopened |
Add deprecation lint for duplicated `macro_export`s cc rust-lang#35896 (comment)
bors
commented
Jun 8, 2018
🔒 Merge conflict |
Rollup of 13 pull requests Successful merges: - #50143 (Add deprecation lint for duplicated `macro_export`s) - #51099 (Fix Issue 38777) - #51276 (Dedup auto traits in trait objects.) - #51298 (Stabilize unit tests with non-`()` return type) - #51360 (Suggest parentheses when a struct literal needs them) - #51391 (Use spans pointing at the inside of a rustdoc attribute) - #51394 (Use scope tree depths to speed up `nearest_common_ancestor`.) - #51396 (Make the size of Option<NonZero*> a documented guarantee.) - #51401 (Warn on `repr` without hints) - #51412 (Avoid useless Vec clones in pending_obligations().) - #51427 (compiletest: autoremove duplicate .nll.* files (#51204)) - #51436 (Do not require stage 2 compiler for rustdoc) - #51437 (rustbuild: generate full list of dependencies for metadata) Failed merges:
cc #35896 (comment)