-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Cleanup some EarlyBinder::skip_binder()
-> EarlyBinder::subst_identity()
#112220
Conversation
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()), |
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.
There are some skip_binder
lower down in this function too. Should those be subst_identity
as well?
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.
Yeah I believe so
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.
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() |
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.
I remember a similar pattern in Instance::subst_mir
that I used skip_binder
for previously:
rust/compiler/rustc_middle/src/ty/instance.rs
Lines 581 to 591 in a9baa16
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()
?
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.
Yes, probably
@rustbot author |
8bdd3c4
to
57cbe25
Compare
@bors r+ rollup |
…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 😅)
…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
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 😅)