Skip to content

Conversation

kylematsuda
Copy link
Contributor

fix some incorrect skip_binder()'s as identified in #112006 (review)

r? @compiler-errors @lcnr @jackh726

(hope it's alright to just tag everyone who commented 😅)

@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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Jun 2, 2023
@rustbot
Copy link
Collaborator

rustbot commented Jun 2, 2023

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@@ -104,7 +104,7 @@ impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> {
// the post-inference `trait_ref`, as it's more accurate.
trait_: Some(clean_trait_ref_with_bindings(
cx,
ty::Binder::dummy(trait_ref.skip_binder()),
ty::Binder::dummy(trait_ref.subst_identity()),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are some skip_binder lower down in this function too. Should those be subst_identity as well?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah I believe so

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks, just updated the commit to add those 👍

@@ -647,7 +647,7 @@ fn build_call_shim<'tcx>(
let mut sig = if let Some(sig_substs) = sig_substs {
sig.subst(tcx, &sig_substs)
} else {
sig.skip_binder()
sig.subst_identity()
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 remember a similar pattern in Instance::subst_mir that I used skip_binder for previously:

pub fn subst_mir<T>(&self, tcx: TyCtxt<'tcx>, v: EarlyBinder<&T>) -> T
where
T: TypeFoldable<TyCtxt<'tcx>> + Copy,
{
let v = v.map_bound(|v| *v);
if let Some(substs) = self.substs_for_mir_body() {
v.subst(tcx, substs)
} else {
v.skip_binder()
}
}

Should that one also be subst_identity()?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, probably

@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 Jun 5, 2023
@compiler-errors
Copy link
Member

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Jun 6, 2023

📌 Commit 57cbe25 has been approved by compiler-errors

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 6, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jun 6, 2023
…piler-errors

Cleanup some `EarlyBinder::skip_binder()` -> `EarlyBinder::subst_identity()`

fix some incorrect `skip_binder()`'s as identified in rust-lang#112006 (review)

r? `@compiler-errors` `@lcnr` `@jackh726`

(hope it's alright to just tag everyone who commented 😅)
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 6, 2023
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#111058 (Correct fortanix LVI test print function)
 - rust-lang#111369 (Added custom risc32-imac for esp-espidf target)
 - rust-lang#111962 (Make GDB Python Pretty Printers loadable after spawning GDB, avoiding required `rust-gdb`)
 - rust-lang#112019 (Don't suggest changing `&self` and `&mut self` in function signature to be mutable when taking `&mut self` in closure)
 - rust-lang#112199 (Fix suggestion for matching struct with `..` on both ends)
 - rust-lang#112220 (Cleanup some `EarlyBinder::skip_binder()` -> `EarlyBinder::subst_identity()`)
 - rust-lang#112325 (diagnostics: do not suggest type name tweaks on type-inferred closure args)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 7c76f3b into rust-lang:master Jun 6, 2023
@rustbot rustbot added this to the 1.72.0 milestone Jun 6, 2023
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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants