Uh oh!
There was an error while loading. Please reload this page.
Fix double handling in collect_tokens - #129346
Conversation
nnethercote
commented
Aug 21, 2024
The last three commits are tricky and hard to review. Even after multiple weeks of working with this code, I still find it hard to understand and reason about, and I wish it could be made simpler. But the good news is that these commits are enough to the get final failing test ( |
This comment has been minimized.
This comment has been minimized.
a0f9bfd to
7d65809Comparennethercote
commented
Aug 21, 2024
I think this should get a crater run, just because I don't fully trust that the test suite is thoroughly testing And why not do a perf run, just to check there's no regressions. @bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
bors
commented
Aug 21, 2024
…ollect_tokens, r=<try> Fix double handling in `collect_tokens` Double handling of AST nodes can occur in `collect_tokens`. This is when an inner call to `collect_tokens` produces an AST node, and then an outer call to `collect_tokens` produces the same AST node. This can happen in a few places, e.g. expression statements where the statement delegates `HasTokens` and `HasAttrs` to the expression. It will also happen more after rust-lang#124141. This PR fixes some double handling cases that cause problems, including rust-lang#129166. r? `@petrochenkov`
This comment has been minimized.
This comment has been minimized.
bors
commented
Aug 21, 2024
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
rust-timer
commented
Aug 21, 2024
Finished benchmarking commit (8b22b49): comparison URL. Overall result: ❌ regressions - ACTION NEEDEDBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)Results (secondary -2.7%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResults (secondary -2.3%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeResults (secondary 0.0%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Bootstrap: 748.876s -> 749.555s (0.09%) |
Uh oh!
There was an error while loading. Please reload this page.
petrochenkov
commented
Aug 21, 2024
Which change is a source of the perf regression, 7d65809 probably? |
petrochenkov
commented
Aug 21, 2024
I'll start crater once #129346 (comment) is addressed and CI is green. |
7d65809 to
aeaa62bComparennethercote
commented
Aug 22, 2024
I have adding a commit that avoids cloning Let's see what the new status is: |
…ollect_tokens, r=<try> Fix double handling in `collect_tokens` Double handling of AST nodes can occur in `collect_tokens`. This is when an inner call to `collect_tokens` produces an AST node, and then an outer call to `collect_tokens` produces the same AST node. This can happen in a few places, e.g. expression statements where the statement delegates `HasTokens` and `HasAttrs` to the expression. It will also happen more after rust-lang#124141. This PR fixes some double handling cases that cause problems, including rust-lang#129166. r? `@petrochenkov`
bors
commented
Aug 22, 2024
bors
commented
Aug 22, 2024
☀️ Try build successful - checks-actions |
lqd
commented
Aug 22, 2024
@rust-timer build a70947b |
This comment has been minimized.
This comment has been minimized.
rust-timer
commented
Aug 22, 2024
Finished benchmarking commit (a70947b): comparison URL. Overall result: ❌ regressions - ACTION NEEDEDBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)Results (primary -0.8%, secondary 2.4%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResults (secondary 2.3%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeResults (secondary -0.1%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Bootstrap: 750.761s -> 751.313s (0.07%) |
rust-timer
commented
Sep 8, 2024
Finished benchmarking commit (6d05f12): comparison URL. Overall result: ❌✅ regressions and improvements - no action needed@rustbot label: -perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)Results (primary -1.9%, secondary 1.9%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 754.658s -> 756.515s (0.25%) |
danielhenrymantilla
commented
Oct 18, 2024
FWIW, this did regress the following test: https://docs.rs/crate/cfg_eval/0.1.2/source/tests/item.rs I don't know why crater did not see it 😔 |
| struct Foo { | ||
| val: [bool; { | ||
| let a = #[cfg_attr(not(FALSE), rustc_dummy(first))] $expr; | ||
| 0 | ||
| }] | ||
| } |
There was a problem hiding this comment.
This case stopped working?
Noratrieb
commented
Oct 18, 2024
even if crater found your crate, it was only a check run |
It caused a test regression in the `cfg_eval.rs` crate. (The bugfix in rust-lang#129346 was in a different commit; this commit was just a code simplification.)
It caused a test regression in the `cfg_eval.rs` crate. (The bugfix in rust-lang#129346 was in a different commit; this commit was just a code simplification.)
lqd
commented
Nov 4, 2024
and since beta runs are test runs, the regression is indeed present in the 1.83 unexpected test failures: https://crater-reports.s3.amazonaws.com/beta-1.83-1/beta-2024-10-19/gh/danielhenrymantilla.cfg_eval.rs/log.txt |
…placement-ranges, r=petrochenkov Revert "Avoid nested replacement ranges" from rust-lang#129346. It caused a test regression in the `cfg_eval.rs` crate. (The bugfix in rust-lang#129346 was in a different commit; this commit was just a code simplification.) r? `@petrochenkov`
…kingjubilee Rollup of 10 pull requests Successful merges: - rust-lang#129884 (mark some target features as 'forbidden' so they cannot be (un)set with -Ctarget-feature) - rust-lang#132153 (Stabilise `const_char_encode_utf16`.) - rust-lang#132473 ([core/fmt] Replace checked slice indexing by unchecked to support panic-free code) - rust-lang#132571 (add const_eval_select macro to reduce redundancy) - rust-lang#132587 (Revert "Avoid nested replacement ranges" from rust-lang#129346.) - rust-lang#132596 ([rustdoc] Fix `--show-coverage` when JSON output format is used) - rust-lang#132598 (Clippy: Move some attribute lints to be early pass (post expansion)) - rust-lang#132601 (Update books) - rust-lang#132606 (Improve example of `impl Pattern for &[char]`) - rust-lang#132609 (docs: fix grammar in doc comment at unix/process.rs) r? `@ghost` `@rustbot` modify labels: rollup
…placement-ranges, r=petrochenkov Revert "Avoid nested replacement ranges" from rust-lang#129346. It caused a test regression in the `cfg_eval.rs` crate. (The bugfix in rust-lang#129346 was in a different commit; this commit was just a code simplification.) r? `@petrochenkov`
…kingjubilee Rollup of 11 pull requests Successful merges: - rust-lang#131153 (Improve duplicate derive Copy/Clone diagnostics) - rust-lang#132025 (fix suggestion for diagnostic error E0027) - rust-lang#132303 (More tests for non-exhaustive C-like enums in FFI) - rust-lang#132492 (remove support for extern-block const intrinsics) - rust-lang#132587 (Revert "Avoid nested replacement ranges" from rust-lang#129346.) - rust-lang#132596 ([rustdoc] Fix `--show-coverage` when JSON output format is used) - rust-lang#132598 (Clippy: Move some attribute lints to be early pass (post expansion)) - rust-lang#132601 (Update books) - rust-lang#132606 (Improve example of `impl Pattern for &[char]`) - rust-lang#132608 (document `type_implements_trait`) - rust-lang#132609 (docs: fix grammar in doc comment at unix/process.rs) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#132587 - nnethercote:revert-avoid-nested-replacement-ranges, r=petrochenkov Revert "Avoid nested replacement ranges" from rust-lang#129346. It caused a test regression in the `cfg_eval.rs` crate. (The bugfix in rust-lang#129346 was in a different commit; this commit was just a code simplification.) r? `@petrochenkov`
It caused a test regression in the `cfg_eval.rs` crate. (The bugfix in rust-lang#129346 was in a different commit; this commit was just a code simplification.) (cherry picked from commit 981dc02)
[beta] backports - rustdoc: skip stability inheritance for some item kinds rust-lang#132481 - Avoid use imports in thread_local_inner! in static rust-lang#132101 - Also treat `impl` definition parent as transparent regarding modules rust-lang#132453 - Revert "Avoid nested replacement ranges" from rust-lang#129346. rust-lang#132587 r? cuviper
[beta] backports - rustdoc: skip stability inheritance for some item kinds rust-lang#132481 - Avoid use imports in thread_local_inner! in static rust-lang#132101 - Also treat `impl` definition parent as transparent regarding modules rust-lang#132453 - Revert "Avoid nested replacement ranges" from rust-lang#129346. rust-lang#132587 r? cuviper
…s-test, r=nnethercote Add regression test for nested replacement ranges in `collect_tokens` rust-lang#129346 removed support for nested replacement ranges in `collect_tokens`, and simplified the nesting out of `tests/ui/proc-macro/macro-rules-derive-cfg.rs` accordingly. That removal turned out to break real-world code, so it was reverted in rust-lang#132587 — but the revert only restored the compiler code, not the original nested shape of the test, leaving the nested case uncovered ever since. This reinstates the nested case as a separate test: the pre-rust-lang/rust#129346 shape of `macro-rules-derive-cfg.rs` (a `cfg_attr` expansion nested inside a `let` statement, nested inside an anonymous constant), combined with the extra inner attributes that rust-lang#129346 added to the simplified version. If nested replacement range support regresses again, this test fails. The expected stdout was verified against current nightly; the sibling test's checked-in stdout reproduces byte-for-byte under the same setup. Closesrust-lang#132727
…s-test, r=nnethercote Add regression test for nested replacement ranges in `collect_tokens` rust-lang#129346 removed support for nested replacement ranges in `collect_tokens`, and simplified the nesting out of `tests/ui/proc-macro/macro-rules-derive-cfg.rs` accordingly. That removal turned out to break real-world code, so it was reverted in rust-lang#132587 — but the revert only restored the compiler code, not the original nested shape of the test, leaving the nested case uncovered ever since. This reinstates the nested case as a separate test: the pre-rust-lang/rust#129346 shape of `macro-rules-derive-cfg.rs` (a `cfg_attr` expansion nested inside a `let` statement, nested inside an anonymous constant), combined with the extra inner attributes that rust-lang#129346 added to the simplified version. If nested replacement range support regresses again, this test fails. The expected stdout was verified against current nightly; the sibling test's checked-in stdout reproduces byte-for-byte under the same setup. Closesrust-lang#132727
Rollup merge of #159529 - UditDewan:nested-replacement-ranges-test, r=nnethercote Add regression test for nested replacement ranges in `collect_tokens` #129346 removed support for nested replacement ranges in `collect_tokens`, and simplified the nesting out of `tests/ui/proc-macro/macro-rules-derive-cfg.rs` accordingly. That removal turned out to break real-world code, so it was reverted in #132587 — but the revert only restored the compiler code, not the original nested shape of the test, leaving the nested case uncovered ever since. This reinstates the nested case as a separate test: the pre-rust-lang/rust#129346 shape of `macro-rules-derive-cfg.rs` (a `cfg_attr` expansion nested inside a `let` statement, nested inside an anonymous constant), combined with the extra inner attributes that #129346 added to the simplified version. If nested replacement range support regresses again, this test fails. The expected stdout was verified against current nightly; the sibling test's checked-in stdout reproduces byte-for-byte under the same setup. Closes#132727
…=nnethercote Add regression test for nested replacement ranges in `collect_tokens` rust-lang/rust#129346 removed support for nested replacement ranges in `collect_tokens`, and simplified the nesting out of `tests/ui/proc-macro/macro-rules-derive-cfg.rs` accordingly. That removal turned out to break real-world code, so it was reverted in rust-lang/rust#132587 — but the revert only restored the compiler code, not the original nested shape of the test, leaving the nested case uncovered ever since. This reinstates the nested case as a separate test: the pre-rust-lang/rust#129346 shape of `macro-rules-derive-cfg.rs` (a `cfg_attr` expansion nested inside a `let` statement, nested inside an anonymous constant), combined with the extra inner attributes that rust-lang/rust#129346 added to the simplified version. If nested replacement range support regresses again, this test fails. The expected stdout was verified against current nightly; the sibling test's checked-in stdout reproduces byte-for-byte under the same setup. Closesrust-lang/rust#132727
Double handling of AST nodes can occur in
collect_tokens. This is when an inner call tocollect_tokensproduces an AST node, and then an outer call tocollect_tokensproduces the same AST node. This can happen in a few places, e.g. expression statements where the statement delegatesHasTokensandHasAttrsto the expression. It will also happen more after #124141.This PR fixes some double handling cases that cause problems, including #129166.
r? @petrochenkov