Walk un-shifted nested impl Trait in trait when setting up default trait method assumptions#109240
Conversation
|
r? @wesleywiser (rustbot has picked a reviewer for you, use r? to override) |
compiler/rustc_ty_utils/src/ty.rs
Outdated
There was a problem hiding this comment.
When we turn alias_ty into shifted_alias_ty, we shift all the binders from self.depth to ty::INNERMOST so we have no escaping bound vars in the projection we collect at 285.
So when we walk the type's bounds on line 309, conceptually alias_ty's substs are technically only now one binder deep, so shifting any nested impl traits would result in us shifting to a negative de bruijn index.
|
☔ The latest upstream changes (presumably #109253) made this pull request unmergeable. Please resolve the merge conflicts. |
|
r? @oli-obk |
bc3ae85 to
239ec6c
Compare
| .tcx | ||
| .type_of(alias_ty.def_id) | ||
| .subst(self.tcx, alias_ty.substs) | ||
| self.tcx.type_of(shifted_alias_ty.def_id).subst(self.tcx, shifted_alias_ty.substs) |
There was a problem hiding this comment.
we really need a alias_ty.type_of(tcx) method, this code snippet exists way too often 😆
There was a problem hiding this comment.
I can add it :D
|
@bors r+ |
|
@bors rollup |
… r=oli-obk Walk un-shifted nested `impl Trait` in trait when setting up default trait method assumptions Fixes a double subtraction in some binder math in return-position `impl Trait` in trait handling code. Fixes rust-lang#109239
… r=oli-obk Walk un-shifted nested `impl Trait` in trait when setting up default trait method assumptions Fixes a double subtraction in some binder math in return-position `impl Trait` in trait handling code. Fixes rust-lang#109239
… r=oli-obk Walk un-shifted nested `impl Trait` in trait when setting up default trait method assumptions Fixes a double subtraction in some binder math in return-position `impl Trait` in trait handling code. Fixes rust-lang#109239
… r=oli-obk Walk un-shifted nested `impl Trait` in trait when setting up default trait method assumptions Fixes a double subtraction in some binder math in return-position `impl Trait` in trait handling code. Fixes rust-lang#109239
… r=oli-obk Walk un-shifted nested `impl Trait` in trait when setting up default trait method assumptions Fixes a double subtraction in some binder math in return-position `impl Trait` in trait handling code. Fixes rust-lang#109239
Rollup of 10 pull requests Successful merges: - rust-lang#106434 (Document `Iterator::sum/product` for Option/Result) - rust-lang#108326 (Implement read_buf for a few more types) - rust-lang#108842 (Enforce non-lifetime-binders in supertrait preds are not object safe) - rust-lang#108896 (new solver: make all goal evaluation able to be automatically rerun ) - rust-lang#109124 (Add `dist.compression-profile` option to control compression speed) - rust-lang#109240 (Walk un-shifted nested `impl Trait` in trait when setting up default trait method assumptions) - rust-lang#109385 (fix typo) - rust-lang#109386 (add myself to mailmap) - rust-lang#109390 (Custom MIR: Support aggregate expressions) - rust-lang#109408 (not *all* retags might be explicit in Runtime MIR) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Fixes a double subtraction in some binder math in return-position
impl Traitin trait handling code.Fixes #109239