Skip to content
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

Avoid follow-up errors and ICEs after missing lifetime errors on data structures #127311

Merged
merged 1 commit into from
Jul 11, 2024

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Jul 4, 2024

Tuple struct constructors are functions, so when we call them typeck will use the signature tuple struct constructor function to provide type hints. Since typeck mostly ignores and erases lifetimes, we end up never seeing the error lifetime in writeback, thus not tainting the typeck result.

Now, we eagerly taint typeck results by tainting from resolve_vars_if_possible, which is called all over the place.

I did not carry over all the crashes test suite tests, as they are really all the same cause (missing or unknown lifetime names in tuple struct definitions or generic arg lists).

fixes #124262
fixes #124083
fixes #125155
fixes #125888
fixes #125992
fixes #126666
fixes #126648
fixes #127268
fixes #127266
fixes #127304

@rustbot
Copy link
Collaborator

rustbot commented Jul 4, 2024

r? @compiler-errors

rustbot has assigned @compiler-errors.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 4, 2024
@rust-log-analyzer

This comment has been minimized.

@matthiaskrgr
Copy link
Member

nice :D

Comment on lines +1276 to +1269
if let Err(guar) = value.error_reported() {
self.set_tainted_by_errors(guar);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this could be done in a more targeted location to just fix this one specific kind of ICE, as long as there is no perf impact, this seems like a good place to check a lot of types for errors

@oli-obk
Copy link
Contributor Author

oli-obk commented Jul 4, 2024

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jul 4, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 4, 2024
Avoid follow-up errors and ICEs after missing lifetime errors on data structures

Tuple struct constructors are functions, so when we call them typeck will use the signature tuple struct constructor function to provide type hints. Since typeck mostly ignores and erases lifetimes, we end up never seeing the error lifetime in writeback, thus not tainting the typeck result.

Now, we eagerly taint typeck results by tainting from `resolve_vars_if_possible`, which is called all over the place.

I did not carry over all the `crashes` test suite tests, as they are really all the same cause (missing or unknown lifetime names in tuple struct definitions or generic arg lists).

fixes rust-lang#124262
fixes rust-lang#124083
fixes rust-lang#125155
fixes rust-lang#125888
fixes rust-lang#125992
fixes rust-lang#126666
fixes rust-lang#126648
fixes rust-lang#127268
@bors
Copy link
Contributor

bors commented Jul 4, 2024

⌛ Trying commit 2d5b2d8 with merge 7b804d2...

@bors
Copy link
Contributor

bors commented Jul 4, 2024

☀️ Try build successful - checks-actions
Build commit: 7b804d2 (7b804d28645e4c9214d7967736a50a39847422ca)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (7b804d2): comparison URL.

Overall result: ❌ regressions - ACTION NEEDED

Benchmarking 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 @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.4% [0.4%, 0.4%] 2
Regressions ❌
(secondary)
0.7% [0.2%, 1.8%] 15
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.4% [0.4%, 0.4%] 2

Max RSS (memory usage)

Results (secondary 0.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.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.9% [0.7%, 1.3%] 4
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Cycles

Results (secondary 7.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.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
10.5% [9.9%, 11.0%] 6
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-1.9% [-3.4%, -0.5%] 2
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 718.904s -> 724.442s (0.77%)
Artifact size: 328.18 MiB -> 328.27 MiB (0.03%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Jul 4, 2024
@oli-obk
Copy link
Contributor Author

oli-obk commented Jul 5, 2024

While instruction counts go up, cycles do not (deeply nested multi is probably just noise in mono collection)

@rustbot ready

@compiler-errors
Copy link
Member

sure why not

@bors r+

@bors
Copy link
Contributor

bors commented Jul 9, 2024

📌 Commit 2d5b2d8 has been approved by compiler-errors

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 9, 2024
@bors
Copy link
Contributor

bors commented Jul 9, 2024

⌛ Testing commit 2d5b2d8 with merge 567809d...

bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 9, 2024
…ler-errors

Avoid follow-up errors and ICEs after missing lifetime errors on data structures

Tuple struct constructors are functions, so when we call them typeck will use the signature tuple struct constructor function to provide type hints. Since typeck mostly ignores and erases lifetimes, we end up never seeing the error lifetime in writeback, thus not tainting the typeck result.

Now, we eagerly taint typeck results by tainting from `resolve_vars_if_possible`, which is called all over the place.

I did not carry over all the `crashes` test suite tests, as they are really all the same cause (missing or unknown lifetime names in tuple struct definitions or generic arg lists).

fixes rust-lang#124262
fixes rust-lang#124083
fixes rust-lang#125155
fixes rust-lang#125888
fixes rust-lang#125992
fixes rust-lang#126666
fixes rust-lang#126648
fixes rust-lang#127268
@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Jul 9, 2024

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jul 9, 2024
@bors
Copy link
Contributor

bors commented Jul 10, 2024

☔ The latest upstream changes (presumably #127358) made this pull request unmergeable. Please resolve the merge conflicts.

@oli-obk
Copy link
Contributor Author

oli-obk commented Jul 10, 2024

-.- more crashes tests were added in the mean time

@oli-obk
Copy link
Contributor Author

oli-obk commented Jul 11, 2024

@bors r=compiler-errors

@bors
Copy link
Contributor

bors commented Jul 11, 2024

📌 Commit dce98c5 has been approved by compiler-errors

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 11, 2024
@bors
Copy link
Contributor

bors commented Jul 11, 2024

⌛ Testing commit dce98c5 with merge c92a8e4...

@bors
Copy link
Contributor

bors commented Jul 11, 2024

☀️ Test successful - checks-actions
Approved by: compiler-errors
Pushing c92a8e4 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jul 11, 2024
@bors bors merged commit c92a8e4 into rust-lang:master Jul 11, 2024
7 checks passed
@rustbot rustbot added this to the 1.81.0 milestone Jul 11, 2024
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (c92a8e4): comparison URL.

Overall result: ❌ regressions - ACTION NEEDED

Next Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please open an issue or create a new PR that fixes the regressions, add a comment linking to the newly created issue or PR, and then add the perf-regression-triaged label to this PR.

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.3% [0.2%, 0.4%] 8
Regressions ❌
(secondary)
0.3% [0.2%, 0.4%] 16
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.3% [0.2%, 0.4%] 8

Max RSS (memory usage)

This benchmark run did not return any relevant results for this metric.

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 703.866s -> 704.358s (0.07%)
Artifact size: 328.57 MiB -> 328.86 MiB (0.09%)

@oli-obk oli-obk deleted the do_not_count_errors branch July 11, 2024 15:49
@rylev
Copy link
Member

rylev commented Jul 17, 2024

Instruction counts go up, cycles do not (deeply nested multi is probably just noise in mono collection)

Seems like the performance after merge largely mirrors the pre-merge perf run so I think @oli-obk's analysis stands. In any case, this is a correctness fix so it seems like a small perf hit would be acceptable in any case.

@rustbot label: +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment