-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
add a normalizes-to fast path #125334
base: master
Are you sure you want to change the base?
add a normalizes-to fast path #125334
Conversation
This comment has been minimized.
This comment has been minimized.
compiler/rustc_trait_selection/src/solve/normalizes_to/fast_reject.rs
Outdated
Show resolved
Hide resolved
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also squash
compiler/rustc_trait_selection/src/solve/normalizes_to/fast_reject.rs
Outdated
Show resolved
Hide resolved
b416190
to
2322dff
Compare
Some changes occurred to the core trait solver cc @rust-lang/initiative-trait-system-refactor |
#[instrument(level = "trace", skip(tcx), ret)] | ||
fn no_applicable_blanket_impls<'tcx>(tcx: TyCtxt<'tcx>, trait_def_id: DefId) -> bool { | ||
// FIXME(ptr_metadata): There's currently a builtin impl for `Pointee` which | ||
// applies for all `T` as long as `T: Sized` holds. THis impl should |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// applies for all `T` as long as `T: Sized` holds. THis impl should | |
// applies for all `T` as long as `T: Sized` holds. This impl should |
// pretty much everything. Just return `true` in that case. | ||
ty::Param(_) | ty::Error(_) | ty::Alias(..) => return true, | ||
ty::Param(_) | ty::Error(_) | ty::Alias(..) | ty::Infer(_) | ty::Placeholder(..) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This treats params always as bound vars (which is true for unsubstituted impl headers), vs when they come from the environment they should be treated as placeholders (param-env candidate matching).
I think drcx should be reworked to make this distinction, so we don't return true
more than we need to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally this could then be used when matching param-env candidates in the new and old solvers, so we can avoid instantiating binders and doing type equality when it's useless.
@rustbot author |
☔ The latest upstream changes (presumably #125665) made this pull request unmergeable. Please resolve the merge conflicts. |
@lcnr still interested in working on this? |
This PR should stay open for now |
[DO NOT MERGE] bootstrap with `-Znext-solver=globally` A revival of rust-lang#124812. Current status, we're failing in: - failing in `rustc_next_trait_solver` with 126 instances of the following error ``` error[E0311]: the parameter type `I` may not live long enough | help: consider adding an explicit lifetime bound --> compiler/rustc_next_trait_solver/src/solve/trait_goals.rs:624:53 | 624 ~ fn consider_structural_builtin_unsize_candidates<'a>( 625 ~ ecx: &mut EvalCtxt<'a, D>, 626 | goal: Goal<I, Self>, 627 ~ ) -> Vec<Candidate<I>> where I: 'a { ``` - `itertools` hangs, we're already encountered this hang in our previous attempt due to large type sizes. I believe that it's simply caused by a missing cache somewhere, potentially in `wf.rs`, but other visitors may also be responsible. See rust-itertools/itertools#945 for more details ### commits - rust-lang#133501 - rust-lang#133493 - 9456bfe and b21b116 reimplement candidate preference based on rust-lang#132325, not yet a separate PR - c3ef9cd is a rebased version of rust-lang#125334, unsure whether I actually want to land this PR for now r? `@ghost`
[DO NOT MERGE] bootstrap with `-Znext-solver=globally` A revival of rust-lang#124812. Current status: `./x.py b --stage 2` passes 🎉 ### commits - rust-lang#133501 - rust-lang#133493 - 9456bfe and b21b116 reimplement candidate preference based on rust-lang#132325, not yet a separate PR - c3ef9cd is a rebased version of rust-lang#125334, unsure whether I actually want to land this PR for now - rust-lang#133517 * rust-lang#133518 * rust-lang#133519 * rust-lang#133520 * rust-lang#133521 * rust-lang#133524 r? `@ghost`
[DO NOT MERGE] bootstrap with `-Znext-solver=globally` A revival of rust-lang#124812. Current status: `./x.py b --stage 2` passes 🎉 ### commits - rust-lang#133501 - rust-lang#133493 - 9456bfe and b21b116 reimplement candidate preference based on rust-lang#132325, not yet a separate PR - c3ef9cd is a rebased version of rust-lang#125334, unsure whether I actually want to land this PR for now - rust-lang#133517 * rust-lang#133518 * rust-lang#133519 * rust-lang#133520 * rust-lang#133521 * rust-lang#133524 r? `@ghost`
[DO NOT MERGE] bootstrap with `-Znext-solver=globally` A revival of rust-lang#124812. Current status: `./x.py b --stage 2` passes 🎉 ### commits - rust-lang#133501 - rust-lang#133493 - 9456bfe and b21b116 reimplement candidate preference based on rust-lang#132325, not yet a separate PR - c3ef9cd is a rebased version of rust-lang#125334, unsure whether I actually want to land this PR for now - rust-lang#133517 * rust-lang#133518 * rust-lang#133519 * rust-lang#133520 * rust-lang#133521 * rust-lang#133524 r? `@ghost`
[DO NOT MERGE] bootstrap with `-Znext-solver=globally` A revival of rust-lang#124812. Current status: ~~`./x.py b --stage 2` passes 🎉~~ `try` builds succeed 🎉 🎉 🎉 ### commits - rust-lang#133643 - ce66d92 is a rebased version of rust-lang#125334, unsure whether I actually want to land this PR for now * rust-lang#133559 * rust-lang#133558 r? `@ghost`
Fixes the minimization in rust-lang/trait-system-refactor-initiative#109. It does not fix rayon as rayon has a blanket impl of
ParallelIterator
.r? @compiler-errors