about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/builder.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-01-05 03:59:31 +0000
committerbors <bors@rust-lang.org>2023-01-05 03:59:31 +0000
commit03b9e1d154ecf8e04656fdf0179a28cd8ef333c5 (patch)
tree8c1b70fb5f8b03c7d47813924f1f0ca8c09438f0 /compiler/rustc_codegen_llvm/src/builder.rs
parentd26242d35faf50aa9c873fa3c7c15e5564384baa (diff)
parentfa2f31b97178c3a66d6e5f91fa597711f585fd3b (diff)
downloadrust-03b9e1d154ecf8e04656fdf0179a28cd8ef333c5.tar.gz
rust-03b9e1d154ecf8e04656fdf0179a28cd8ef333c5.zip
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 'compiler/rustc_codegen_llvm/src/builder.rs')
0 files changed, 0 insertions, 0 deletions