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

finish trait solver skeleton work #106718

Merged
merged 7 commits into from
Jan 18, 2023
Merged

finish trait solver skeleton work #106718

merged 7 commits into from
Jan 18, 2023

Conversation

lcnr
Copy link
Contributor

@lcnr lcnr commented Jan 11, 2023

648d661b4e0fcf55f7082894f577377eb451db4b

The previous implementation didn't remove provisional entries which depended on the current goal if we're forced to rerun in case the provisional result of that entry is different from the new result. For reference, see https://rust-lang.github.io/chalk/book/recursive/search_graph.html.

We should also treat inductive cycles as overflow, not ordinary ambiguity.

219a5de2517cebfe20a2c3417bd302f7c12db70c 6a1912be539dd5a3b3c10be669787c4bf0c1868a

These two commits move canonicalization to the start of the queries which simplifies a bunch of stuff. I originally intended to keep stuff canonicalized for a while because I expected us to add a additional caches the trait solver, either for candidate assembly or for projections. We ended up not adding (and expect to not need) any of them so this just ends up being easier to understand.

d78d5ad0979e965afde6500bccfa119b47063506

adds a special eq for the solver which doesn't care about obligations or spans

18704e6a78b7703e1bbb3856f015cb76c0a07a06

implements https://rust-lang.zulipchat.com/#narrow/stream/364551-t-types.2Ftrait-system-refactor/topic/projection.20cache

r? @compiler-errors

@rustbot rustbot added T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) 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 Jan 11, 2023
@rustbot
Copy link
Collaborator

rustbot commented Jan 11, 2023

Some changes occurred to the core trait solver

cc @lcnr, @compiler-errors

@lcnr lcnr added the WG-trait-system-refactor The Rustc Trait System Refactor Initiative label Jan 11, 2023
@bors
Copy link
Contributor

bors commented Jan 15, 2023

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

@rust-log-analyzer

This comment has been minimized.

@lcnr lcnr force-pushed the solver-cycles branch 3 times, most recently from b003e9c to 6a1912b Compare January 17, 2023 10:47
@lcnr lcnr changed the title update provisional cache cycle handling finish trait solver skeleton work Jan 17, 2023
@rust-log-analyzer

This comment has been minimized.

@lcnr lcnr force-pushed the solver-cycles branch 4 times, most recently from 4fa544e to 98700cf Compare January 17, 2023 15:55
@compiler-errors
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Jan 17, 2023

📌 Commit 98700cf481bce946bff316b56836cfffd885127b 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 Jan 17, 2023
@@ -19,6 +19,7 @@ rustc_infer = { path = "../rustc_infer" }
rustc_lint_defs = { path = "../rustc_lint_defs" }
rustc_macros = { path = "../rustc_macros" }
rustc_query_system = { path = "../rustc_query_system" }
rustc_serialize = { path = "../rustc_serialize" }
Copy link
Member

Choose a reason for hiding this comment

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

Not blocking, but but what's this crate dependency for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

for rustc_index::newtype_index!

@bors
Copy link
Contributor

bors commented Jan 18, 2023

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

@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 Jan 18, 2023
@lcnr
Copy link
Contributor Author

lcnr commented Jan 18, 2023

@bors r=compiler-errors rollup=always

@bors
Copy link
Contributor

bors commented Jan 18, 2023

📌 Commit 369f9aa 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 18, 2023
@albertlarsan68

This comment was marked as off-topic.

@rustbot rustbot removed the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label Jan 18, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 18, 2023
Rollup of 5 pull requests

Successful merges:

 - rust-lang#103702 (Lift `T: Sized` bounds from some `strict_provenance` pointer methods)
 - rust-lang#106441 (relax reference requirement on SocketAddrExt::from_abstract_name)
 - rust-lang#106718 (finish trait solver skeleton work)
 - rust-lang#106950 (Don't do pointer arithmetic on pointers to deallocated memory)
 - rust-lang#107014 (rustdoc: remove deprecated / unused code from main.js)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

impl<'tcx> EvalCtxt<'_, 'tcx> {
pub(super) fn compute_projection_goal(
&mut self,
goal: Goal<'tcx, ProjectionPredicate<'tcx>>,
) -> QueryResult<'tcx> {
let candidates = self.assemble_and_evaluate_candidates(goal);
self.merge_project_candidates(candidates)
// To only compute normalization ones for each projection we only
Copy link
Contributor Author

Choose a reason for hiding this comment

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

"to only compute ones", fixme: once.

@bors
Copy link
Contributor

bors commented Jan 18, 2023

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

@bors bors merged commit 6f5c3c9 into rust-lang:master Jan 18, 2023
@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 Jan 18, 2023
@rustbot rustbot added this to the 1.68.0 milestone Jan 18, 2023
@lcnr lcnr deleted the solver-cycles branch January 18, 2023 13:08
@albertlarsan68 albertlarsan68 mentioned this pull request Jan 18, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 18, 2023
…didates-2, r=lcnr

Implement some candidates for the new solver (redux)

Based on rust-lang#106718, so the diff is hard to read without it. See [here](rust-lang/rust@98700cf...compiler-errors:rust:new-solver-new-candidates-2) for an easier view until that one lands.

Of note:
* 44af916020fb43c12070125c45b6dee4ec303bbc fixes a bug where we need to make the query response *inside* of a probe, or else we make no inference progress (I think)
* 50daad5acd2f163d03e7ffab942534f09bc36e2e implements `consider_assumption` for traits and predicates. I'm not sure if using `sup` here is necessary or if `eq` is fine.
* We decided that all of the `instantiate_constituent_tys_for_*` functions are verbose but ok, since they need to be exhaustive and the logic between each of them is not similar enough, right?

r? `@lcnr`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 18, 2023
compiler-errors added a commit to compiler-errors/rust that referenced this pull request Jan 18, 2023
…didates-2, r=lcnr

Implement some candidates for the new solver (redux)

Based on rust-lang#106718, so the diff is hard to read without it. See [here](rust-lang/rust@98700cf...compiler-errors:rust:new-solver-new-candidates-2) for an easier view until that one lands.

Of note:
* 44af916020fb43c12070125c45b6dee4ec303bbc fixes a bug where we need to make the query response *inside* of a probe, or else we make no inference progress (I think)
* 50daad5acd2f163d03e7ffab942534f09bc36e2e implements `consider_assumption` for traits and predicates. I'm not sure if using `sup` here is necessary or if `eq` is fine.
* We decided that all of the `instantiate_constituent_tys_for_*` functions are verbose but ok, since they need to be exhaustive and the logic between each of them is not similar enough, right?

r? ``@lcnr``
compiler-errors added a commit to compiler-errors/rust that referenced this pull request Jan 18, 2023
JohnTitor added a commit to JohnTitor/rustc-dev-guide that referenced this pull request Feb 2, 2023
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
tshepang pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Feb 3, 2023
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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. WG-trait-system-refactor The Rustc Trait System Refactor Initiative
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants