diff options
| author | Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> | 2022-08-30 16:56:08 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-30 16:56:08 +0530 |
| commit | 15e2e5185a22207b18d2cbc47a48b39e63e84cd0 (patch) | |
| tree | 93ddc8c688b1caa448a6ebab2ea58d6b8f7c0aaa /compiler/rustc_codegen_gcc | |
| parent | 9cfd161cd5b2e3b53c488086f8000aea0c21b0b2 (diff) | |
| parent | e5602cb2a0e114729625cf27db819ef56a79d86e (diff) | |
| download | rust-15e2e5185a22207b18d2cbc47a48b39e63e84cd0.tar.gz rust-15e2e5185a22207b18d2cbc47a48b39e63e84cd0.zip | |
Rollup merge of #100473 - compiler-errors:normalize-the-fn-def-sig-plz, r=lcnr
Attempt to normalize `FnDef` signature in `InferCtxt::cmp`
Stashes a normalization callback in `InferCtxt` so that the signature we get from `tcx.fn_sig(..).subst(..)` in `InferCtxt::cmp` can be properly normalized, since we cannot expect for it to have normalized types since it comes straight from astconv.
This is kind of a hack, but I will say that `@jyn514` found the fact that we present unnormalized types to be very confusing in real life code, and I agree with that feeling. Though altogether I am still a bit unsure about whether this PR is worth the effort, so I'm open to alternatives and/or just closing it outright.
On the other hand, this isn't a ridiculously heavy implementation anyways -- it's less than a hundred lines of changes, and half of that is just miscellaneous cleanup.
This is stacked onto #100471 which is basically unrelated, and it can be rebased off of that when that lands or if needed.
---
The code:
```rust
trait Foo { type Bar; }
impl<T> Foo for T {
type Bar = i32;
}
fn foo<T>(_: <T as Foo>::Bar) {}
fn needs_i32_ref_fn(f: fn(&'static i32)) {}
fn main() {
needs_i32_ref_fn(foo::<()>);
}
```
Before:
```
= note: expected fn pointer `fn(&'static i32)`
found fn item `fn(<() as Foo>::Bar) {foo::<()>}`
```
After:
```
= note: expected fn pointer `fn(&'static i32)`
found fn item `fn(i32) {foo::<()>}`
```
Diffstat (limited to 'compiler/rustc_codegen_gcc')
0 files changed, 0 insertions, 0 deletions
