-
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
Fix double handling in collect_tokens
#129346
Fix double handling in collect_tokens
#129346
Conversation
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
7d65809
Compare
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.
…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.
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
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%) |
Which change is a source of the perf regression, 7d65809 probably? |
I'll start crater once #129346 (comment) is addressed and CI is green. |
7d65809
to
aeaa62b
Compare
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`
☀️ Try build successful - checks-actions |
@rust-timer build a70947b |
This comment has been minimized.
This comment has been minimized.
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%) |
☀️ Test successful - checks-actions |
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%) |
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This case stopped working?
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.
Fixed in #132587.
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.)
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
Double handling of AST nodes can occur in
collect_tokens
. This is when an inner call tocollect_tokens
produces an AST node, and then an outer call tocollect_tokens
produces the same AST node. This can happen in a few places, e.g. expression statements where the statement delegatesHasTokens
andHasAttrs
to the expression. It will also happen more after #124141.This PR fixes some double handling cases that cause problems, including #129166.
r? @petrochenkov