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

add a normalizes-to fast path #125334

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

lcnr
Copy link
Contributor

@lcnr lcnr commented May 20, 2024

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

@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 labels May 20, 2024
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

Copy link
Member

@compiler-errors compiler-errors left a comment

Choose a reason for hiding this comment

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

also squash

@rust-cloud-vms rust-cloud-vms bot force-pushed the normalizes-to-rigid-fastpath branch from b416190 to 2322dff Compare May 21, 2024 19:06
@lcnr lcnr marked this pull request as ready for review May 21, 2024 19:09
@rustbot
Copy link
Collaborator

rustbot commented May 21, 2024

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
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// 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(..) => {
Copy link
Member

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.

Copy link
Member

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.

@compiler-errors
Copy link
Member

@rustbot author

@rustbot rustbot 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-review Status: Awaiting review from the assignee but also interested parties. labels May 25, 2024
@bors
Copy link
Contributor

bors commented May 28, 2024

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

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

5 participants