Skip to content

clean up unneeded ToPredicate impls #115566

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged

Conversation

zirconium-n
Copy link
Contributor

Part of #107250.
Removed all totally unused impls. And inlined two impls not need to satisify trait bound.

r? @oli-obk

@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 Sep 5, 2023
@rustbot
Copy link
Collaborator

rustbot commented Sep 5, 2023

Some changes occurred to the core trait solver

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

Comment on lines 2192 to 2201
let pred: ty::Predicate<'_> = ty::Binder::bind_with_vars(
ty::ProjectionPredicate {
projection_ty: tcx.mk_alias_ty(trait_ty.def_id, rebased_args),
term: normalize_impl_ty.into(),
},
bound_vars,
)
.to_predicate(tcx),
),
.to_predicate(tcx);

predicates.push(pred.expect_clause())
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a bit roundabout. We should probably add a way to create clauses directly

Copy link
Contributor

Choose a reason for hiding this comment

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

yea, considering all the uses work like that, adding a new method to Clause seems best.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I suppose it's something like this?

impl Clause {
   fn new(tcx: TyCtxt<'tcx>, pred: impl ToPredicate<'tcx>) -> Clause<'tcx> {
       // ...
   }
}

Copy link
Contributor

Choose a reason for hiding this comment

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

just a ClauseKind as the argument. Even if internally you go through ToPredicate, there's nothing that can fail if the argument is ClauseKind

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ohhh. nice.

@zirconium-n zirconium-n force-pushed the issue-107250-clean-up-unused-to-predicate branch from d263dc3 to b62141e Compare September 19, 2023 17:44
@zirconium-n
Copy link
Contributor Author

Just realized I forgot to push the commit. Can't use ClauseKind as the argument since it's insufficient in some cases.

@rust-log-analyzer

This comment has been minimized.

@zirconium-n zirconium-n force-pushed the issue-107250-clean-up-unused-to-predicate branch from b62141e to 3c69a10 Compare September 19, 2023 20:06
@oli-obk
Copy link
Contributor

oli-obk commented Sep 20, 2023

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Sep 20, 2023

📌 Commit 3c69a10 has been approved by oli-obk

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 Sep 20, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 20, 2023
…llaumeGomez

Rollup of 5 pull requests

Successful merges:

 - rust-lang#115566 (clean up unneeded `ToPredicate` impls)
 - rust-lang#115962 (coverage: Remove debug code from the instrumentor)
 - rust-lang#115988 (rustdoc: add test cases, and fix, search tabs layout jank)
 - rust-lang#115991 (Ensure `build/tmp` exists in `rustdoc_themes::get_themes`)
 - rust-lang#115997 (RELEASES.md: Add missing patch releases)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 4e8f637 into rust-lang:master Sep 20, 2023
@rustbot rustbot added this to the 1.74.0 milestone Sep 20, 2023
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Sep 20, 2023
Rollup merge of rust-lang#115566 - zirconium-n:issue-107250-clean-up-unused-to-predicate, r=oli-obk

clean up unneeded `ToPredicate` impls

Part of rust-lang#107250.
Removed all totally unused impls. And inlined two impls not need to satisify trait bound.

r? `@oli-obk`
# for free to join this conversation on GitHub. Already have an account? # 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