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

Implement some more new solver candidates and fix some bugs #107061

Merged
merged 6 commits into from
Jan 21, 2023

Conversation

compiler-errors
Copy link
Member

First, fix some bugs:

  1. IndexVec::drain_enumerated(a..b) does not give us an iterator of index keys + items enumerated from a..b, but from 0..(b-a)... That caused a bug. See first commit for the fix.
  2. Implement the _: Trait ambiguity hack. I put it in assemble, let me know if it should live elsewhere. This is important, since we otherwise consider _: Sized to have no solutions, and nothing passes!
  3. Swap Ambiguity and Unimplemented cases for the new solver. Sorry for accidentally swapping them 😄
  4. Check GATs' own predicates during projection confirmation.

Then implement a few builtin traits:

  1. Implement PointerSized. Pretty independent.
  2. Implement Fn family of traits for fnptr, fndef, and closures. Closures are currently broken because FulfillCtxt::relationships is intentionally left unimplemented. See comment in the test.

r? @lcnr

@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 Jan 19, 2023
@rustbot
Copy link
Collaborator

rustbot commented Jan 19, 2023

Some changes occurred to the core trait solver

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

@rust-log-analyzer

This comment has been minimized.

Copy link
Contributor

@lcnr lcnr left a comment

Choose a reason for hiding this comment

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

nits, then r=me

compiler/rustc_trait_selection/src/solve/project_goals.rs Outdated Show resolved Hide resolved
compiler/rustc_trait_selection/src/solve/project_goals.rs Outdated Show resolved Hide resolved
tests/ui/traits/new-solver/gat-bound-fail.rs Outdated Show resolved Hide resolved
@compiler-errors
Copy link
Member Author

@bors r=lcnr

@bors
Copy link
Contributor

bors commented Jan 19, 2023

📌 Commit ed6aebb 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 Jan 19, 2023
@lcnr
Copy link
Contributor

lcnr commented Jan 20, 2023

@bors rollup (limited to new solver)

@lcnr lcnr changed the title Implement some more new solver goals and fix some bugs Implement some more new solver candidates and fix some bugs Jan 20, 2023
// HACK: `_: Trait` is ambiguous, because it may be satisfied via a builtin rule,
// object bound, alias bound, etc. We are unable to determine this until we can at
// least structually resolve the type one layer.
if goal.predicate.self_ty().is_ty_var() {
Copy link
Contributor

@lcnr lcnr Jan 20, 2023

Choose a reason for hiding this comment

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

assembly can now always ICE on Bound and Infer(TyVar) so that it's clearer why we don't have to consider stuff ambig for infer vars

compiler-errors added a commit to compiler-errors/rust that referenced this pull request Jan 20, 2023
…didates-3, r=lcnr

Implement some more new solver candidates and fix some bugs

First, fix some bugs:

1. `IndexVec::drain_enumerated(a..b)` does not give us an iterator of index keys + items enumerated from `a..b`, but from `0..(b-a)`... That caused a bug. See first commit for the fix.
2. Implement the `_: Trait` ambiguity hack. I put it in assemble, let me know if it should live elsewhere. This is important, since we otherwise consider `_: Sized` to have no solutions, and nothing passes!
3. Swap `Ambiguity` and `Unimplemented` cases for the new solver. Sorry for accidentally swapping them 😄
4. Check GATs' own predicates during projection confirmation.

Then implement a few builtin traits:

5. Implement `PointerSized`. Pretty independent.
6. Implement `Fn` family of traits for fnptr, fndef, and closures. Closures are currently broken because `FulfillCtxt::relationships` is intentionally left unimplemented. See comment in the test.

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

Implement some more new solver candidates and fix some bugs

First, fix some bugs:

1. `IndexVec::drain_enumerated(a..b)` does not give us an iterator of index keys + items enumerated from `a..b`, but from `0..(b-a)`... That caused a bug. See first commit for the fix.
2. Implement the `_: Trait` ambiguity hack. I put it in assemble, let me know if it should live elsewhere. This is important, since we otherwise consider `_: Sized` to have no solutions, and nothing passes!
3. Swap `Ambiguity` and `Unimplemented` cases for the new solver. Sorry for accidentally swapping them 😄
4. Check GATs' own predicates during projection confirmation.

Then implement a few builtin traits:

5. Implement `PointerSized`. Pretty independent.
6. Implement `Fn` family of traits for fnptr, fndef, and closures. Closures are currently broken because `FulfillCtxt::relationships` is intentionally left unimplemented. See comment in the test.

r? ``@lcnr``
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 21, 2023
…mpiler-errors

Rollup of 9 pull requests

Successful merges:

 - rust-lang#104154 (Change `bindings_with_variant_name` to deny-by-default)
 - rust-lang#104347 (diagnostics: suggest changing `s@self::{macro}`@::macro`` for exported)
 - rust-lang#104672 (Unify stable and unstable sort implementations in same core module)
 - rust-lang#107048 (check for x version updates)
 - rust-lang#107061 (Implement some more new solver candidates and fix some bugs)
 - rust-lang#107095 (rustdoc: remove redundant CSS selector `.sidebar .current`)
 - rust-lang#107112 (Fix typo in opaque_types.rs)
 - rust-lang#107124 (fix check macro expansion)
 - rust-lang#107131 (rustdoc: use CSS inline layout for radio line instead of flexbox)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 3452104 into rust-lang:master Jan 21, 2023
@rustbot rustbot added this to the 1.68.0 milestone Jan 21, 2023
@compiler-errors compiler-errors deleted the new-solver-new-candidates-3 branch August 11, 2023 20:09
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