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

do not attempt to prove unknowable goals #129896

Merged
merged 1 commit into from
Sep 5, 2024

Conversation

lcnr
Copy link
Contributor

@lcnr lcnr commented Sep 2, 2024

In case a goal is unknowable, we previously still checked all other possible ways to prove this goal, even though its final result is already guaranteed to be ambiguous. By ignoring all other candidates in that case we can avoid a lot of unnecessary work, fixing the performance regression in typenum found in #121848.

This is already the behavior in the old solver. This could in theory cause future-compatability issues as considering fewer goals unknowable may end up causing performance regressions/hangs. I am quite confident that this will not be an issue.

r? @compiler-errors

@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. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Sep 2, 2024
Copy link
Member

@jackh726 jackh726 left a comment

Choose a reason for hiding this comment

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

Seems reasonable to me. r=me if you'd like, with or without my one comment

Comment on lines +671 to +672
// We also look for unknowable candidates. In case a goal is unknowable, there's
// always exactly 1 candidate.
Copy link
Member

Choose a reason for hiding this comment

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

It could be good to add an assert below for this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

there are two possible asserts, both feel quite meh, so I didn't add any:

  • if we found a coherence unknowable candidate, assert that there are no other candidates
  • if we didn't find one, there is no coherence unknowable candidate in the remaining candidates

@bors
Copy link
Contributor

bors commented Sep 3, 2024

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

@lcnr
Copy link
Contributor Author

lcnr commented Sep 3, 2024

r? @jackh726

@bors r=jackh726 rollup=always

@bors
Copy link
Contributor

bors commented Sep 3, 2024

📌 Commit 6188aae has been approved by jackh726

It is now in the queue for this repository.

@rustbot rustbot assigned jackh726 and unassigned compiler-errors Sep 3, 2024
@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 Sep 3, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Sep 3, 2024
do not attempt to prove unknowable goals

In case a goal is unknowable, we previously still checked all other possible ways to prove this goal, even though its final result is already guaranteed to be ambiguous. By ignoring all other candidates in that case we can avoid a lot of unnecessary work, fixing the performance regression in typenum found in rust-lang#121848.

This is already the behavior in the old solver. This could in theory cause future-compatability issues as considering fewer goals unknowable may end up causing performance regressions/hangs. I am quite confident that this will not be an issue.

r? `@compiler-errors`
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 3, 2024
…iaskrgr

Rollup of 9 pull requests

Successful merges:

 - rust-lang#127692 (Suggest `impl Trait` for References to Bare Trait in Function Header)
 - rust-lang#128701 (Don't Suggest Labeling `const` and `unsafe` Blocks )
 - rust-lang#128934 (Non-exhaustive structs may be empty)
 - rust-lang#129630 (Document the broken C ABI of `wasm32-unknown-unknown`)
 - rust-lang#129706 (Rename dump of coroutine by-move-body to be more consistent, fix ICE in dump_mir)
 - rust-lang#129896 (do not attempt to prove unknowable goals)
 - rust-lang#129926 (Move `SanityCheck` and `MirPass`)
 - rust-lang#129928 (rustc_driver_impl: remove some old dead logic)
 - rust-lang#129930 (include 1.80.1 release notes on master)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 3, 2024
…iaskrgr

Rollup of 9 pull requests

Successful merges:

 - rust-lang#127692 (Suggest `impl Trait` for References to Bare Trait in Function Header)
 - rust-lang#128701 (Don't Suggest Labeling `const` and `unsafe` Blocks )
 - rust-lang#128934 (Non-exhaustive structs may be empty)
 - rust-lang#129630 (Document the broken C ABI of `wasm32-unknown-unknown`)
 - rust-lang#129863 (update comment regarding TargetOptions.features)
 - rust-lang#129896 (do not attempt to prove unknowable goals)
 - rust-lang#129926 (Move `SanityCheck` and `MirPass`)
 - rust-lang#129928 (rustc_driver_impl: remove some old dead logic)
 - rust-lang#129930 (include 1.80.1 release notes on master)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 3, 2024
…iaskrgr

Rollup of 9 pull requests

Successful merges:

 - rust-lang#127692 (Suggest `impl Trait` for References to Bare Trait in Function Header)
 - rust-lang#128701 (Don't Suggest Labeling `const` and `unsafe` Blocks )
 - rust-lang#128934 (Non-exhaustive structs may be empty)
 - rust-lang#129630 (Document the broken C ABI of `wasm32-unknown-unknown`)
 - rust-lang#129863 (update comment regarding TargetOptions.features)
 - rust-lang#129896 (do not attempt to prove unknowable goals)
 - rust-lang#129926 (Move `SanityCheck` and `MirPass`)
 - rust-lang#129928 (rustc_driver_impl: remove some old dead logic)
 - rust-lang#129930 (include 1.80.1 release notes on master)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 4, 2024
…iaskrgr

Rollup of 9 pull requests

Successful merges:

 - rust-lang#127692 (Suggest `impl Trait` for References to Bare Trait in Function Header)
 - rust-lang#128701 (Don't Suggest Labeling `const` and `unsafe` Blocks )
 - rust-lang#128934 (Non-exhaustive structs may be empty)
 - rust-lang#129630 (Document the broken C ABI of `wasm32-unknown-unknown`)
 - rust-lang#129863 (update comment regarding TargetOptions.features)
 - rust-lang#129896 (do not attempt to prove unknowable goals)
 - rust-lang#129926 (Move `SanityCheck` and `MirPass`)
 - rust-lang#129928 (rustc_driver_impl: remove some old dead logic)
 - rust-lang#129930 (include 1.80.1 release notes on master)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 4, 2024
…iaskrgr

Rollup of 9 pull requests

Successful merges:

 - rust-lang#127692 (Suggest `impl Trait` for References to Bare Trait in Function Header)
 - rust-lang#128701 (Don't Suggest Labeling `const` and `unsafe` Blocks )
 - rust-lang#128934 (Non-exhaustive structs may be empty)
 - rust-lang#129630 (Document the broken C ABI of `wasm32-unknown-unknown`)
 - rust-lang#129863 (update comment regarding TargetOptions.features)
 - rust-lang#129896 (do not attempt to prove unknowable goals)
 - rust-lang#129926 (Move `SanityCheck` and `MirPass`)
 - rust-lang#129928 (rustc_driver_impl: remove some old dead logic)
 - rust-lang#129930 (include 1.80.1 release notes on master)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 4, 2024
…iaskrgr

Rollup of 9 pull requests

Successful merges:

 - rust-lang#127692 (Suggest `impl Trait` for References to Bare Trait in Function Header)
 - rust-lang#128701 (Don't Suggest Labeling `const` and `unsafe` Blocks )
 - rust-lang#128934 (Non-exhaustive structs may be empty)
 - rust-lang#129630 (Document the broken C ABI of `wasm32-unknown-unknown`)
 - rust-lang#129863 (update comment regarding TargetOptions.features)
 - rust-lang#129896 (do not attempt to prove unknowable goals)
 - rust-lang#129926 (Move `SanityCheck` and `MirPass`)
 - rust-lang#129928 (rustc_driver_impl: remove some old dead logic)
 - rust-lang#129930 (include 1.80.1 release notes on master)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 4, 2024
…iaskrgr

Rollup of 9 pull requests

Successful merges:

 - rust-lang#127692 (Suggest `impl Trait` for References to Bare Trait in Function Header)
 - rust-lang#128701 (Don't Suggest Labeling `const` and `unsafe` Blocks )
 - rust-lang#128934 (Non-exhaustive structs may be empty)
 - rust-lang#129630 (Document the broken C ABI of `wasm32-unknown-unknown`)
 - rust-lang#129863 (update comment regarding TargetOptions.features)
 - rust-lang#129896 (do not attempt to prove unknowable goals)
 - rust-lang#129926 (Move `SanityCheck` and `MirPass`)
 - rust-lang#129928 (rustc_driver_impl: remove some old dead logic)
 - rust-lang#129930 (include 1.80.1 release notes on master)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 4, 2024
…iaskrgr

Rollup of 9 pull requests

Successful merges:

 - rust-lang#127692 (Suggest `impl Trait` for References to Bare Trait in Function Header)
 - rust-lang#128701 (Don't Suggest Labeling `const` and `unsafe` Blocks )
 - rust-lang#128934 (Non-exhaustive structs may be empty)
 - rust-lang#129630 (Document the broken C ABI of `wasm32-unknown-unknown`)
 - rust-lang#129863 (update comment regarding TargetOptions.features)
 - rust-lang#129896 (do not attempt to prove unknowable goals)
 - rust-lang#129926 (Move `SanityCheck` and `MirPass`)
 - rust-lang#129928 (rustc_driver_impl: remove some old dead logic)
 - rust-lang#129930 (include 1.80.1 release notes on master)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 485fd38 into rust-lang:master Sep 5, 2024
6 checks passed
@rustbot rustbot added this to the 1.83.0 milestone Sep 5, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Sep 5, 2024
Rollup merge of rust-lang#129896 - lcnr:bail-on-unknowable, r=jackh726

do not attempt to prove unknowable goals

In case a goal is unknowable, we previously still checked all other possible ways to prove this goal, even though its final result is already guaranteed to be ambiguous. By ignoring all other candidates in that case we can avoid a lot of unnecessary work, fixing the performance regression in typenum found in rust-lang#121848.

This is already the behavior in the old solver. This could in theory cause future-compatability issues as considering fewer goals unknowable may end up causing performance regressions/hangs. I am quite confident that this will not be an issue.

r? ``@compiler-errors``
@lcnr lcnr deleted the bail-on-unknowable branch September 5, 2024 07:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants