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

Improve diagnostics for HostEffectPredicate in the new solver #132345

Merged
merged 2 commits into from
Jan 7, 2025

Conversation

compiler-errors
Copy link
Member

@compiler-errors compiler-errors commented Oct 30, 2024

Adds derived cause for host effect predicates. Some diagnostics regress, but that's connected to the fact that our predicate visitor doesn't play well with aliases just yet.

@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 Oct 30, 2024
@compiler-errors compiler-errors changed the title Improve diagnostics for HostEffectPredicate in the new solver Improve diagnostics for HostEffectPredicate in the new solver Oct 30, 2024
@bors
Copy link
Contributor

bors commented Oct 31, 2024

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

@bors
Copy link
Contributor

bors commented Nov 3, 2024

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

@compiler-errors compiler-errors marked this pull request as ready for review December 10, 2024 22:10
@rustbot
Copy link
Collaborator

rustbot commented Dec 10, 2024

Some changes occurred to the core trait solver

cc @rust-lang/initiative-trait-system-refactor

@compiler-errors
Copy link
Member Author

r? lcnr 

@@ -16,6 +16,11 @@ error[E0277]: the trait bound `T: ~const Bar` is not satisfied
LL | type Assoc<T> = C<T>
| ^^^^
|
note: required for `C<T>` to implement `~const Bar`
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the net effect of the change.

@@ -14,9 +14,9 @@ trait Trait {

const fn unqualified<T: Trait>() {
T::Assoc::func();
//~^ ERROR the trait bound `T: ~const Trait` is not satisfied
//~^ ERROR the trait bound `<T as Trait>::Assoc: ~const Trait` is not satisfied
Copy link
Member Author

@compiler-errors compiler-errors Dec 10, 2024

Choose a reason for hiding this comment

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

We don't treat the GAT where clauses as where clauses for a goal source... should we?

Copy link
Contributor

Choose a reason for hiding this comment

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

depends on where and how we prove them. I think for diagnostics, the answer should be yes, for cycle handling maybe no?

impl_const_condition_bound_count,
parent_host_pred,
));
impl_const_condition_bound_count += 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

why use a separate counter here? We should only ever track one of the two, shouldn't we?

@lcnr
Copy link
Contributor

lcnr commented Dec 17, 2024

r=me after nit

@@ -1,10 +1,10 @@
error[E0277]: the trait bound `<T as Trait>::Assoc<U>: ~const Trait` is not satisfied
error[E0277]: the trait bound `U: ~const Other` is not satisfied
Copy link
Member Author

Choose a reason for hiding this comment

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

Ideally these would be reported as derived causes, i.e. U: ~const Other must hold for <T as Trait>::Assoc<U>: ~const Trait to hold. I'm not going to touch the obligation cause code further in this PR though.

@compiler-errors
Copy link
Member Author

Needs another review for the last commit, cc @lcnr

@lcnr
Copy link
Contributor

lcnr commented Dec 23, 2024

👍

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Dec 23, 2024

📌 Commit 360bd32 has been approved by lcnr

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 Dec 23, 2024
@compiler-errors
Copy link
Member Author

Conflicts w/ that other PR, so I'm gonna r- this for now.

@bors r-

@bors bors 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Dec 23, 2024
@bors
Copy link
Contributor

bors commented Dec 24, 2024

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

@compiler-errors
Copy link
Member Author

Rebased

@bors r=lcnr

@bors
Copy link
Contributor

bors commented Jan 6, 2025

📌 Commit ebdf19a has been approved by lcnr

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 6, 2025
jhpratt added a commit to jhpratt/rust that referenced this pull request Jan 7, 2025
Improve diagnostics for `HostEffectPredicate` in the new solver

Adds derived cause for host effect predicates. Some diagnostics regress, but that's connected to the fact that our predicate visitor doesn't play well with aliases just yet.
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 7, 2025
Rollup of 9 pull requests

Successful merges:

 - rust-lang#131830 (Add support for wasm exception handling to Emscripten target)
 - rust-lang#132345 (Improve diagnostics for `HostEffectPredicate` in the new solver)
 - rust-lang#134568 (Release notes for 1.84.0)
 - rust-lang#134744 (Don't ice on bad transmute in typeck in new solver)
 - rust-lang#135090 (Suggest to replace tuple constructor through projection)
 - rust-lang#135116 (rustdoc: Fix mismatched capitalization in sidebar)
 - rust-lang#135126 (mark deprecated option as deprecated in rustc_session to remove copypasta and small refactor)
 - rust-lang#135139 ([generic_assert] Constify methods used by the formatting system)
 - rust-lang#135170 (Update triagebot.toml: celinval vacation is over)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit b642740 into rust-lang:master Jan 7, 2025
6 checks passed
@rustbot rustbot added this to the 1.86.0 milestone Jan 7, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Jan 7, 2025
Rollup merge of rust-lang#132345 - compiler-errors:fx-diag, r=lcnr

Improve diagnostics for `HostEffectPredicate` in the new solver

Adds derived cause for host effect predicates. Some diagnostics regress, but that's connected to the fact that our predicate visitor doesn't play well with aliases just yet.
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.

4 participants