Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #126215 - gurry:125737-bad-err-anon-futs, r=lcnr
Add explanatory note to async block type mismatch error The async block type mismatch error might leave the user wondering as to why it occurred. The new note should give them the needed context. Changes this diagnostic: ``` error[E0308]: mismatched types --> src/main.rs:5:23 | 2 | let a = async { 1 }; | ----------- the expected `async` block 3 | let b = async { 2 }; | ----------- the found `async` block 4 | 5 | let bad = vec![a, b]; | ^ expected `async` block, found a different `async` block | = note: expected `async` block `{async block@src/main.rs:2:13: 2:24}` found `async` block `{async block@src/main.rs:3:13: 3:24}` ``` to this: ``` error[E0308]: mismatched types --> src/main.rs:5:23 | 2 | let a = async { 1 }; | ----------- the expected `async` block 3 | let b = async { 2 }; | ----------- the found `async` block 4 | 5 | let bad = vec![a, b]; | ^ expected `async` block, found a different `async` block | = note: expected `async` block `{async block@src/main.rs:2:13: 2:24}` found `async` block `{async block@src/main.rs:3:13: 3:24}` = note: no two async blocks, even if identical, have the same type = help: consider pinning your async block and and casting it to a trait object ``` Fixes #125737
- Loading branch information