about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src/errors.rs
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-04-20 11:10:31 +0200
committerGitHub <noreply@github.com>2024-04-20 11:10:31 +0200
commitff9a0b19ff97711499b525ea281f380889274466 (patch)
tree7d9d54408b11f068a370a9ffd9c214c13427e778 /compiler/rustc_trait_selection/src/errors.rs
parentefb264fa78c48907046ad3119ba6f6b4d67207e1 (diff)
parent5daf58ffc1d46a63d33652cc953a3a801b8d1265 (diff)
downloadrust-ff9a0b19ff97711499b525ea281f380889274466.tar.gz
rust-ff9a0b19ff97711499b525ea281f380889274466.zip
Rollup merge of #124104 - compiler-errors:parent-generic-use, r=oli-obk
Fix capturing duplicated lifetimes via parent in `precise_captures` (`impl use<'...>`)

For technical reasons related to the way that `Self` and `T::Assoc` are lowered from HIR -> `rustc_middle::ty`, an opaque may mention in its bounds both the original early-bound lifetime from the parent `impl`/`fn`, *and* the *duplicated* early-bound lifetime on the opaque.

This is fine -- and has been fine since `@cjgillot` rewrote the way we handled opaque lifetime captures, and we went further to allow this behavior explicitly in https://github.com/rust-lang/rust/pull/115659. It's worthwhile to read this PR's technical section to recall how this duplication works and when it acts surprisingly.

The problem here is that the check that make sure that `impl use<'a, 'b>` lists all of the opaque's captured lifetimes wasn't smart enough to consider both these captured lifetimes and the original lifetimes they're duplicated from to be equal. This PR fixes that.

r? oli-obk
Diffstat (limited to 'compiler/rustc_trait_selection/src/errors.rs')
0 files changed, 0 insertions, 0 deletions