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

Replace tcx.mk_trait_ref with TraitRef::new #110806

Merged
merged 13 commits into from
May 4, 2023
Merged

Conversation

WaffleLapkin
Copy link
Member

First step in implementing rust-lang/compiler-team#616
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 Apr 25, 2023
@rustbot
Copy link
Collaborator

rustbot commented Apr 25, 2023

Some changes occurred to the core trait solver

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

Some changes occurred in engine.rs, potentially modifying the public API of ObligationCtxt.

cc @lcnr, @compiler-errors

@rust-log-analyzer

This comment has been minimized.

@rustbot
Copy link
Collaborator

rustbot commented Apr 25, 2023

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

ty::Binder::dummy(
tcx.mk_trait_ref(goal.predicate.def_id(), [self_ty, generator.resume_ty()]),
)
ty::Binder::dummy(ty::TraitRef::new(
Copy link
Member

Choose a reason for hiding this comment

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

ty::TraitRef::new starts getting pretty verbose, maybe we should start with some use ty::TraitRef;? unsure about the types opinion on that

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't have an opinion here and expect the same for most (if not all) types members 😁 afaik we tend to already not have a consistent approach to which parts of ty to import

@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.

some nits and further cleanup ideas

feel free to implement whichever ones you want

after that r=me

compiler/rustc_borrowck/src/type_check/mod.rs Outdated Show resolved Hide resolved
compiler/rustc_hir_typeck/src/coercion.rs Outdated Show resolved Hide resolved
compiler/rustc_middle/src/ty/sty.rs Outdated Show resolved Hide resolved
compiler/rustc_trait_selection/src/traits/project.rs Outdated Show resolved Hide resolved
@lcnr
Copy link
Contributor

lcnr commented Apr 25, 2023

please relabel once this is ready for the final review + merge 😁

@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 Apr 25, 2023
@lcnr
Copy link
Contributor

lcnr commented Apr 25, 2023

(or just r+ it yourself 😁 )

@WaffleLapkin
Copy link
Member Author

I've substantially changed everything with the review suggestions, so @rustbot ready

@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Apr 26, 2023
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 26, 2023
@rust-log-analyzer

This comment has been minimized.

@WaffleLapkin
Copy link
Member Author

One day I'll stop forgetting to fix {rustdoc, clippy, miri} after my compiler changes... One day... But not today it seems

@jackh726
Copy link
Member

Please don't land, see comment.

@@ -1207,6 +1207,18 @@ impl<'tcx> ToPredicate<'tcx, PolyTraitPredicate<'tcx>> for Binder<'tcx, TraitRef
}
}

impl<'tcx> ToPredicate<'tcx, PolyTraitPredicate<'tcx>> for TraitRef<'tcx> {
fn to_predicate(self, tcx: TyCtxt<'tcx>) -> PolyTraitPredicate<'tcx> {
ty::Binder::dummy(self).to_predicate(tcx)
Copy link
Member

Choose a reason for hiding this comment

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

Nope, this is not a change we should merge (or the impl below).

In fact, I would be in favor of some explicit negative impl here just so we can slap a big comment on this so nobody tries to make the positive impl again.

Copy link
Member Author

Choose a reason for hiding this comment

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

Can you explain what is wrong in this impl?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, I see: #110806 (comment)

@lcnr
Copy link
Contributor

lcnr commented May 3, 2023

@bors r+ rollup=iffy

@bors
Copy link
Contributor

bors commented May 3, 2023

📌 Commit 689721d 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 May 3, 2023
@bors
Copy link
Contributor

bors commented May 4, 2023

⌛ Testing commit 689721d with merge 6f8c055...

@bors
Copy link
Contributor

bors commented May 4, 2023

☀️ Test successful - checks-actions
Approved by: lcnr
Pushing 6f8c055 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label May 4, 2023
@bors bors merged commit 6f8c055 into rust-lang:master May 4, 2023
@rustbot rustbot added this to the 1.71.0 milestone May 4, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (6f8c055): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
1.2% [1.0%, 1.3%] 2
Regressions ❌
(secondary)
2.3% [2.3%, 2.3%] 1
Improvements ✅
(primary)
-2.4% [-2.4%, -2.4%] 1
Improvements ✅
(secondary)
-1.3% [-2.2%, -1.0%] 5
All ❌✅ (primary) -0.0% [-2.4%, 1.3%] 3

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-11.3% [-14.2%, -8.5%] 6
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 656.223s -> 655.069s (-0.18%)

flip1995 pushed a commit to flip1995/rust that referenced this pull request May 5, 2023
Replace `tcx.mk_trait_ref` with `TraitRef::new`

First step in implementing rust-lang/compiler-team#616
r? `@lcnr`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. 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.

8 participants