rust icon indicating copy to clipboard operation
rust copied to clipboard

Make PROC_MACRO_DERIVE_RESOLUTION_FALLBACK a hard error

Open Aaron1011 opened this issue 3 years ago • 24 comments

r? @ghost

Aaron1011 avatar Apr 09 '21 00:04 Aaron1011

@bors try

Aaron1011 avatar Apr 09 '21 00:04 Aaron1011

:hourglass: Trying commit 191f8a971b06684f802fcc33a2398bd15df8a3ab with merge 96e388c3ccda74650413d435528d8e0ed2872a21...

bors avatar Apr 09 '21 00:04 bors

:sunny: Try build successful - checks-actions Build commit: 96e388c3ccda74650413d435528d8e0ed2872a21 (96e388c3ccda74650413d435528d8e0ed2872a21)

bors avatar Apr 09 '21 00:04 bors

@craterbot check

Aaron1011 avatar Apr 09 '21 01:04 Aaron1011

:ok_hand: Experiment pr-84022 created and queued. :robot: Automatically detected try build 96e388c3ccda74650413d435528d8e0ed2872a21 :warning: Try build based on commit 2e495d2e845cf27740e3665f718acfd3aa17253e, but latest commit is 191f8a971b06684f802fcc33a2398bd15df8a3ab. Did you forget to make a new try build? :mag: You can check out the queue and this experiment's details.

:information_source: Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

craterbot avatar Apr 09 '21 01:04 craterbot

:construction: Experiment pr-84022 is now running

:information_source: Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

craterbot avatar Apr 25 '21 23:04 craterbot

:tada: Experiment pr-84022 is completed! :bar_chart: 90 regressed and 8 fixed (155930 total) :newspaper: Open the full report.

:warning: If you notice any spurious failure please add them to the blacklist! :information_source: Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

craterbot avatar Apr 29 '21 10:04 craterbot

Unfortunately, one of the regressions is in the unmaintained crate https://github.com/MaikKlein/enumflags

Aaron1011 avatar Apr 29 '21 14:04 Aaron1011

cc @petrochenkov - I'm not sure how you'd like to move forward with this. We could try to move people off https://github.com/MaikKlein/enumflags before we remove the hack, but that would still result in the crate become unusable (the last update was in 2019, and the repository has been archived).

Aaron1011 avatar May 18 '21 18:05 Aaron1011

I'm not sure how you'd like to move forward with this.

Leave it as is for a couple more years? There's no pressure to remove deprecation lints urgently. It can also be turned into an error on 2021 edition only in the meantime.

petrochenkov avatar May 18 '21 20:05 petrochenkov

@Aaron1011 Do you want to turn this into an error on 2021 and later editions only? Or do you prefer this be closed?

crlf0710 avatar Jul 09 '21 11:07 crlf0710

@crlf0710 I think that would be reasonable. While this could theoretically break some 2018 edition code in the presence of a sufficiently weird proc-macro (e.g. a proc-macro which marks the input tokens with a 2021 edition span), I think it would be good to make progress on this issue.

Aaron1011 avatar Aug 07 '21 18:08 Aaron1011

triage: @Aaron1011 - what is the status of this PR? Thanks.

JohnCSimon avatar Dec 05 '21 00:12 JohnCSimon

@bors try

Aaron1011 avatar Oct 05 '22 00:10 Aaron1011

:hourglass: Trying commit 36066293017525460ed9946570f9d819805c7ab5 with merge 5fe169892b3912c8118f59c03c27c622bbade2b5...

bors avatar Oct 05 '22 00:10 bors

:sunny: Try build successful - checks-actions Build commit: 5fe169892b3912c8118f59c03c27c622bbade2b5 (5fe169892b3912c8118f59c03c27c622bbade2b5)

bors avatar Oct 05 '22 02:10 bors

@craterbot check

Aaron1011 avatar Oct 05 '22 02:10 Aaron1011

:ok_hand: Experiment pr-84022 created and queued. :robot: Automatically detected try build 5fe169892b3912c8118f59c03c27c622bbade2b5 :mag: You can check out the queue and this experiment's details.

:information_source: Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

craterbot avatar Oct 05 '22 02:10 craterbot

:construction: Experiment pr-84022 is now running

:information_source: Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

craterbot avatar Oct 06 '22 12:10 craterbot

:tada: Experiment pr-84022 is completed! :bar_chart: 69 regressed and 9 fixed (244852 total) :newspaper: Open the full report.

:warning: If you notice any spurious failure please add them to the blacklist! :information_source: Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

craterbot avatar Oct 07 '22 15:10 craterbot

cc @rust-lang/compiler

This PR removes a backwards-compatibility hack that was added four years ago in https://github.com/rust-lang/rust/pull/51952. Currently, we accept code like this:

// proc-macro crate
#[proc_macro_derive(AnswerFn)]
pub fn derive_answer_fn(_item: TokenStream) -> TokenStream {
	quote ! { mod generated_mod { struct Generated(TypeFromParent); }
}

// other crate
struct TypeFromParent;

#[derive(MyDeriveMacro)]
struct SomeOtherType;

Normally, this code would fail to compile, since TypeFromParent has not been imported into generate_mod. However, we currently detect this kind of usage in derive-macros only, and let it compile with a warning. (Note - this is about path resolution, not hygiene).

Now that https://crates.io/crates/enumflags-derive/0.4.2 has been released, all affected crates should have an upgrade path.

This has been part of cargo report-future-incompat since feature the future-incompat report feature was stabilized (https://github.com/rust-lang/rust/pull/89523), and has been deny-by-default since https://github.com/rust-lang/rust/pull/88041. There have been zero issues opened on rust-lang/rust mentioning either of these decisions.

This PR removes all of the backwards-compatibility code (along with the lint), simplifying rustc_resolve in the process. Any crates broken by this change are almost certainly unmaintained, and have an upgrade path if they use a dependency that's tested by Crater.

Aaron1011 avatar Oct 09 '22 21:10 Aaron1011

@rfcbot fcp merge

lcnr avatar Oct 10 '22 04:10 lcnr

Team member @lcnr has proposed to merge this. The next step is review by the rest of the tagged team members:

  • [x] @Aaron1011
  • [x] @cjgillot
  • [x] @davidtwco
  • [x] @eddyb
  • [x] @estebank
  • [x] @lcnr
  • [x] @matthewjasper
  • [x] @michaelwoerister
  • [ ] @nagisa
  • [ ] @nikomatsakis
  • [x] @oli-obk
  • [x] @petrochenkov
  • [x] @pnkfelix
  • [x] @wesleywiser

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

rfcbot avatar Oct 10 '22 04:10 rfcbot

cc @nagisa @estebank @nikomatsakis @pnkfelix for review and checkboxes

Aaron1011 avatar Oct 16 '22 20:10 Aaron1011

:bell: This is now entering its final comment period, as per the review above. :bell:

rfcbot avatar Oct 20 '22 18:10 rfcbot

The final comment period, with a disposition to merge, as per the review above, is now complete.

As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

This will be merged soon.

rfcbot avatar Oct 30 '22 18:10 rfcbot

r? @petrochenkov

Aaron1011 avatar Oct 30 '22 18:10 Aaron1011

@bors r+

petrochenkov avatar Oct 31 '22 11:10 petrochenkov

:pushpin: Commit 7d82cadd97acc66993b69304c5a1a04ef7d1fa36 has been approved by petrochenkov

It is now in the queue for this repository.

bors avatar Oct 31 '22 11:10 bors

this probably should have been marked as rollup=never

pnkfelix avatar Jan 20 '23 04:01 pnkfelix