diff options
author | bors <bors@rust-lang.org> | 2023-01-05 03:59:31 +0000 |
---|---|---|
committer | bors <bors@rust-lang.org> | 2023-01-05 03:59:31 +0000 |
commit | 03b9e1d154ecf8e04656fdf0179a28cd8ef333c5 (patch) | |
tree | 8c1b70fb5f8b03c7d47813924f1f0ca8c09438f0 /tests/rustdoc-js-std/parser-errors.js | |
parent | d26242d35faf50aa9c873fa3c7c15e5564384baa (diff) | |
parent | fa2f31b97178c3a66d6e5f91fa597711f585fd3b (diff) | |
download | rust-03b9e1d154ecf8e04656fdf0179a28cd8ef333c5.tar.gz |
Auto merge of #105409 - compiler-errors:closure-infer-cycle, r=jackh726
Don't deduce a signature that makes a closure cyclic
Sometimes when elaborating supertrait bounds for closure signature inference, we end up deducing a closure signature that is cyclical because either a parameter or the return type references a projection mentioning `Self` that also has escaping bound vars, which means that it's not eagerly replaced with an inference variable.
Interestingly, this is not *just* related to my PR that elaborates supertrait bounds for closure signature deduction. The committed test `supertrait-hint-cycle-3.rs` shows **stable** code that is fixed by this PR:
```rust
trait Foo<'a> {
type Input;
}
impl<F: Fn(u32)> Foo<'_> for F {
type Input = u32;
}
fn needs_super<F: for<'a> Fn(<F as Foo<'a>>::Input) + for<'a> Foo<'a>>(_: F) {}
fn main() {
needs_super(|_: u32| {});
}
```
Fixes #105401
Fixes #105396
r? types
Diffstat (limited to 'tests/rustdoc-js-std/parser-errors.js')
0 files changed, 0 insertions, 0 deletions