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

typeck: taint if errors found during writeback #113125

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

davidtwco
Copy link
Member

@davidtwco davidtwco commented Jun 28, 2023

Fixes #112824.
Fixes #112630.

If any type added to the TypeckResults references an error then set tainted by errors. By doing this, const eval can be skipped on bodies that reference errors which would make const eval ICE.

@rustbot
Copy link
Collaborator

rustbot commented Jun 28, 2023

r? @compiler-errors

(rustbot has picked a reviewer for you, use r? to override)

@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 Jun 28, 2023
@rustbot
Copy link
Collaborator

rustbot commented Jun 28, 2023

Some changes occurred to the CTFE / Miri engine

cc @rust-lang/miri

@compiler-errors
Copy link
Member

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 29, 2023
@bors

This comment was marked as resolved.

Just a missing space between arguments.

Signed-off-by: David Wood <[email protected]>
@davidtwco davidtwco force-pushed the issue-112824-ctfe-type-mismatch-with-type-error branch from d77b110 to 1c3a4bf Compare July 12, 2023 13:17
@davidtwco davidtwco changed the title const_eval: don't bug on assignment w/ type error typeck: taint if errors found during writeback Jul 12, 2023
@davidtwco
Copy link
Member Author

Okay - I've taken a different approach to this after discussions on Zulip and some thinking. I'm not sure it's ideal but haven't thought of anything better at the moment.

@rust-log-analyzer

This comment was marked as resolved.

@davidtwco
Copy link
Member Author

I can't reproduce these failures locally.

@lqd
Copy link
Member

lqd commented Jul 12, 2023

(it's just #113585)

@oli-obk
Copy link
Contributor

oli-obk commented Jul 12, 2023

Okay - I've taken a different approach to this after discussions on Zulip and some thinking. I'm not sure it's ideal but haven't thought of anything better at the moment.

I think it seems like an ok fix for now if it doesn't cause us any cycle errors in otherwise fine code. It shouldn't, as the second level isn't using the deep references error check, so only immediately recursive data structures will get hit, which seems fine.

If any type added to the `TypeckResults` references an error then set
tainted by errors. By doing this, const eval can be skipped on bodies
that reference errors which would make const eval ICE.

Signed-off-by: David Wood <[email protected]>
@davidtwco davidtwco force-pushed the issue-112824-ctfe-type-mismatch-with-type-error branch from 40ec8d9 to dc85120 Compare July 12, 2023 15:16
@oli-obk
Copy link
Contributor

oli-obk commented Jul 17, 2023

@bors try @rust-timer queue

@bors
Copy link
Contributor

bors commented Jul 17, 2023

⌛ Trying commit dc85120 with merge 4296df04a725855fece448e5e4532195b8577909...

@davidtwco davidtwco added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 17, 2023
@bors
Copy link
Contributor

bors commented Jul 17, 2023

☀️ Try build successful - checks-actions
Build commit: 4296df04a725855fece448e5e4532195b8577909 (4296df04a725855fece448e5e4532195b8577909)

@oli-obk
Copy link
Contributor

oli-obk commented Jul 17, 2023

@rust-timer build 4296df04a725855fece448e5e4532195b8577909

@oli-obk
Copy link
Contributor

oli-obk commented Jul 17, 2023

@rust-timer build 4296df0

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (4296df04a725855fece448e5e4532195b8577909): 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.8% [0.5%, 1.0%] 4
Regressions ❌
(secondary)
14.0% [3.2%, 22.0%] 9
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.2% [-0.2%, -0.2%] 1
All ❌✅ (primary) 0.8% [0.5%, 1.0%] 4

Max RSS (memory usage)

Results

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

Cycles

Results

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)
2.2% [1.0%, 3.4%] 2
Regressions ❌
(secondary)
10.7% [1.2%, 20.8%] 10
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 2.2% [1.0%, 3.4%] 2

Binary size

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

Bootstrap: 656.437s -> 657.475s (0.16%)

@rustbot rustbot added the perf-regression Performance regression. label Jul 17, 2023
@oli-obk
Copy link
Contributor

oli-obk commented Jul 17, 2023

Hmm... I guess we could try caching the error flag in AdtFlags and making TypeFlags fetch that for the error TypeFlag instead of actually getting the field types during typeck.

@davidtwco
Copy link
Member Author

davidtwco commented Jul 19, 2023

Hmm... I guess we could try caching the error flag in AdtFlags and making TypeFlags fetch that for the error TypeFlag instead of actually getting the field types during typeck.

An update to what we've been trying:

  • It isn't possible to do what @oli-obk has suggested above, we can't know the types of the fields when AdtFlags is being computed without running into cycle errors.
    • Just as with the current approach, calls to <ItemCtxt as AstConv>::set_tainted_by_errors would still just be ignored, so there could be other issues being missed.
  • We've also tried changing EarlyBinder to contain a tainted: Option<ErrorGuaranteed> field, and require handling that error to access the type bound by EarlyBinder - this, unsurprisingly, requires an ungodly number of changes to the compiler. Just adding additional functions which do substitution and error handling, then threading that up where required to solve the current issue, results in a large number of changes.

@compiler-errors
Copy link
Member

this still needs work, perhaps even a more hands-on discussion? idk

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 26, 2023
@Dylan-DPC
Copy link
Member

@davidtwco any updates on this? thanks

@JohnCSimon
Copy link
Member

@davidtwco ping from triage: any updates on this? thanks

@davidtwco
Copy link
Member Author

No updates, this still needs fixed but we don't have a path forward at the moment.

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-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
Status: In Progress