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

Unconditionally check sizedness of body in typeck to taint typeck results #137233

Closed
wants to merge 2 commits into from

Conversation

compiler-errors
Copy link
Member

Puts the sized check back into typeck (duplicated -- we still have it in wfcheck) so that we properly taint bodies. These duplicated diagnostics will all be deduplicated with -Zdeduplicate-diagnostics, so it's just UI test fallout and not an actual regression in user-facing diagnostics.

We could perhaps do this without duplicating all the diagnostics if we put this check into something like mir build 🤔 Ideally CTFE would just be more fallible to non-WF code but 🤷

Fixes #137186

@rustbot
Copy link
Collaborator

rustbot commented Feb 18, 2025

r? @fee1-dead

rustbot has assigned @fee1-dead.
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 Feb 18, 2025
@compiler-errors
Copy link
Member Author

r? lcnr, perhaps?

@rustbot rustbot assigned lcnr and unassigned fee1-dead Feb 19, 2025
@lcnr
Copy link
Contributor

lcnr commented Feb 19, 2025

r=me on the changes itself and think its fine to merge this 👍

I feel a bit unhappy with approach, both for its doing unnecessary work, but also because I feel like there's a more general fix which would likely be useful going forward.

We currently taint the MIR in mir_drops_elaborated_and_const_checked

if let Some(error_reported) = tainted_by_errors {
body.tainted_by_errors = Some(error_reported);
}

If we also check check_well_formed for the item here, do we use this tainted_by_errors to disable CTFE? and if not, we probably should

@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 Feb 19, 2025
@bors
Copy link
Contributor

bors commented Feb 19, 2025

⌛ Trying commit a0dbaf2 with merge 9183270...

bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 19, 2025
Unconditionally check sizedness of body in typeck to taint typeck results

Puts the sized check back into typeck (duplicated -- we still have it in wfcheck) so that we properly taint bodies. These duplicated diagnostics will all be deduplicated with `-Zdeduplicate-diagnostics`, so it's just UI test fallout and not an actual regression in user-facing diagnostics.

We could perhaps do this without duplicating all the diagnostics if we put this check into something like mir build 🤔 Ideally CTFE would just be more fallible to non-WF code but 🤷

Fixes rust-lang#137186
@bors
Copy link
Contributor

bors commented Feb 19, 2025

☀️ Try build successful - checks-actions
Build commit: 9183270 (918327092fd732f66cf417d90bc3ae2551e7c44b)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (9183270): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

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 the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.

mean range count
Regressions ❌
(primary)
0.3% [0.2%, 0.3%] 10
Regressions ❌
(secondary)
0.2% [0.2%, 0.2%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.0% [-0.0%, -0.0%] 1
All ❌✅ (primary) 0.3% [0.2%, 0.3%] 10

Max RSS (memory usage)

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

Cycles

Results (primary 3.8%, secondary 2.8%)

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)
3.8% [3.8%, 3.8%] 1
Regressions ❌
(secondary)
2.8% [2.1%, 4.0%] 8
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 3.8% [3.8%, 3.8%] 1

Binary size

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

Bootstrap: 773.598s -> 774.943s (0.17%)
Artifact size: 360.32 MiB -> 360.32 MiB (0.00%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Feb 19, 2025
@compiler-errors
Copy link
Member Author

#137298

workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Feb 20, 2025
Check signature WF when lowering MIR body

Alternative to rust-lang#137233.

rust-lang#137233 (comment)

Fixes rust-lang#137186

We do this check in `mir_drops_elaborated_and_const_checked` and not during `mir_promoted` because that may result in borrowck cycles if WF requires looking into an opaque hidden type. This causes some TAIT tests to fail unnecessarily.

r? lcnr
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 20, 2025
Check signature WF when lowering MIR body

Alternative to rust-lang#137233.

rust-lang#137233 (comment)

Fixes rust-lang#137186

We do this check in `mir_drops_elaborated_and_const_checked` and not during `mir_promoted` because that may result in borrowck cycles if WF requires looking into an opaque hidden type. This causes some TAIT tests to fail unnecessarily.

r? lcnr

try-job: test-various
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 21, 2025
Check signature WF when lowering MIR body

Alternative to rust-lang#137233.

rust-lang#137233 (comment)

Fixes rust-lang#137186

We do this check in `mir_drops_elaborated_and_const_checked` and not during `mir_promoted` because that may result in borrowck cycles if WF requires looking into an opaque hidden type. This causes some TAIT tests to fail unnecessarily.

r? lcnr

try-job: test-various
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 21, 2025
Check signature WF when lowering MIR body

Alternative to rust-lang#137233.

rust-lang#137233 (comment)

Fixes rust-lang#137186

We do this check in `mir_drops_elaborated_and_const_checked` and not during `mir_promoted` because that may result in borrowck cycles if WF requires looking into an opaque hidden type. This causes some TAIT tests to fail unnecessarily.

r? lcnr

try-job: test-various
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 21, 2025
Check signature WF when lowering MIR body

Alternative to rust-lang#137233.

rust-lang#137233 (comment)

Fixes rust-lang#137186

We do this check in `mir_drops_elaborated_and_const_checked` and not during `mir_promoted` because that may result in borrowck cycles if WF requires looking into an opaque hidden type. This causes some TAIT tests to fail unnecessarily.

r? lcnr

try-job: test-various
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 22, 2025
Check signature WF when lowering MIR body

Alternative to rust-lang#137233.

rust-lang#137233 (comment)

Fixes rust-lang#137186

We do this check in `mir_drops_elaborated_and_const_checked` and not during `mir_promoted` because that may result in borrowck cycles if WF requires looking into an opaque hidden type. This causes some TAIT tests to fail unnecessarily.

r? lcnr

try-job: test-various
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 22, 2025
Check signature WF when lowering MIR body

Alternative to rust-lang#137233.

rust-lang#137233 (comment)

Fixes rust-lang#137186

We do this check in `mir_drops_elaborated_and_const_checked` and not during `mir_promoted` because that may result in borrowck cycles if WF requires looking into an opaque hidden type. This causes some TAIT tests to fail unnecessarily.

r? lcnr

try-job: test-various
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
perf-regression Performance regression. 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ICE: assertion failed: layout.is_sized()
6 participants