-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
#[derive(...)]
doesn't invalidate tokens for nested items
#81099
Comments
The part about #[derive(MyTrait)]
#[my_attr]
struct S { ... } should be ready to receive an item with invalidated tokens as an input. |
I'm going to feature-gate macro attributes on nested nodes in #79078 because they are very similar to attribute macros after derive in the sense that they allow macros to observe derive's output, and the lang team's position is that it shouldn't be allowed on stable yet. |
#80689 will automatically fix the |
|
@nnethercote This was probably addressed by your recent fixes to token collection? |
Has the behaviour changed? If so, I guess those fixes are responsible. |
tests: Add regression test for derive token invalidation (rust-lang#81099) Closes rust-lang#81099.
Rollup of 13 pull requests Successful merges: - rust-lang#136576 (pass optimization level to llvm-bitcode-linker) - rust-lang#137320 (fix(rustdoc): Fixed stability version in rustdoc) - rust-lang#137502 (Don't include global asm in `mir_keys`, fix error body synthesis) - rust-lang#137529 (remove few unused args) - rust-lang#137544 (tests: Add regression test for derive token invalidation (rust-lang#81099)) - rust-lang#137559 (run some tests on emscripten again) - rust-lang#137601 (ssa/mono: deduplicate `type_has_metadata`) - rust-lang#137603 (codegen_llvm: avoid `Deref` impls w/ extern type) - rust-lang#137604 (trait_sel: resolve vars in host effects) - rust-lang#137609 (Complete the list of resources used in rustdoc output) - rust-lang#137613 (hir_analysis: skip self type of host effect preds in variances_of) - rust-lang#137614 (fix doc in library/core/src/pin.rs) - rust-lang#137622 (fix attribute-related ICE when parsing macro on the rhs of a name-value attribute) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 14 pull requests Successful merges: - rust-lang#136576 (pass optimization level to llvm-bitcode-linker) - rust-lang#137154 (Add UTF-8 validation fast paths in `Wtf8Buf`) - rust-lang#137311 (Enable `f16` for MIPS) - rust-lang#137320 (fix(rustdoc): Fixed stability version in rustdoc) - rust-lang#137529 (remove few unused args) - rust-lang#137544 (tests: Add regression test for derive token invalidation (rust-lang#81099)) - rust-lang#137559 (run some tests on emscripten again) - rust-lang#137601 (ssa/mono: deduplicate `type_has_metadata`) - rust-lang#137603 (codegen_llvm: avoid `Deref` impls w/ extern type) - rust-lang#137604 (trait_sel: resolve vars in host effects) - rust-lang#137609 (Complete the list of resources used in rustdoc output) - rust-lang#137613 (hir_analysis: skip self type of host effect preds in variances_of) - rust-lang#137614 (fix doc in library/core/src/pin.rs) - rust-lang#137622 (fix attribute-related ICE when parsing macro on the rhs of a name-value attribute) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#137544 - petrochenkov:deritest, r=fmease tests: Add regression test for derive token invalidation (rust-lang#81099) Closes rust-lang#81099.
Reproduction:
#[derive]
will fully configure the itemS
and remove#[cfg(FALSE)] { 10 }
before outputting the item or passing it toPartialEq
andEq
.#[print_attr]
however will print tokens for bothcfg
cases because its input tokens are not invalidated and are stale.Fix:
#[derive]
should walk the whole input item and invalidate tokens for all nested nodes, not only for the item itself.CanSynthesizeMissingTokens::Yes
.cc @Aaron1011
The text was updated successfully, but these errors were encountered: