diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2023-10-10 18:44:44 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-10 18:44:44 +0200 |
| commit | 0e5e04b89aed7c692971f7e15bbff095f1eec5c7 (patch) | |
| tree | 2be06acabe91ff8fca0e7d2a5e5e02745bf3eda7 /tests/codegen/src-hash-algorithm/src-hash-algorithm-sha1.rs | |
| parent | 4be9cfabf22855ed431be5e286a2d768d5847673 (diff) | |
| parent | 7bb594f00ea563d19c23cb70382c66b35c182561 (diff) | |
| download | rust-0e5e04b89aed7c692971f7e15bbff095f1eec5c7.tar.gz rust-0e5e04b89aed7c692971f7e15bbff095f1eec5c7.zip | |
Rollup merge of #116250 - estebank:closure-arg-inference-span, r=petrochenkov
On type error of closure call argument, point at earlier calls that affected inference Mitigate part of https://github.com/rust-lang/rust/issues/71209. When we encounter a type error on a specific argument of a closure call argument, where the closure's definition doesn't have a type specified, look for other calls of the closure to try and find the specific call that cased that argument to be inferred of the expected type. ``` error[E0308]: mismatched types --> $DIR/unboxed-closures-type-mismatch.rs:30:18 | LL | identity(1u16); | -------- ^^^^ expected `u8`, found `u16` | | | arguments to this function are incorrect | note: expected because the closure was earlier called with an argument of type `u8` --> $DIR/unboxed-closures-type-mismatch.rs:29:18 | LL | identity(1u8); | -------- ^^^ expected because this argument is of type `u8` | | | in this closure call note: closure parameter defined here --> $DIR/unboxed-closures-type-mismatch.rs:28:25 | LL | let identity = |x| x; | ^ help: change the type of the numeric literal from `u16` to `u8` | LL | identity(1u8); | ~~ ```
Diffstat (limited to 'tests/codegen/src-hash-algorithm/src-hash-algorithm-sha1.rs')
0 files changed, 0 insertions, 0 deletions
