Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 863e408

Browse files
authoredJun 28, 2024
Rollup merge of #127058 - compiler-errors:tighten-async-spans, r=oli-obk
Tighten `fn_decl_span` for async blocks Tightens the span of `async {}` blocks in diagnostics, and subsequently async closures and async fns, by actually setting the `fn_decl_span` correctly. This is kinda a follow-up on #125078, but it fixes the problem in a more general way. I think the diagnostics are significantly improved, since we no longer have a bunch of overlapping spans. I'll point out one caveat where I think the diagnostic may get a bit more confusing, but where I don't think it matters. r? `@estebank` or `@oli-obk` or someone else on wg-diag or compiler i dont really care lol
2 parents 0c54d77 + 789ee88 commit 863e408

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+173
-204
lines changed
 

‎tests/ui/async-await/coroutine-desc.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ LL | fun(async {}, async {});
88
| | expected all arguments to be this `async` block type because they need to match the type of this parameter
99
| arguments to this function are incorrect
1010
|
11-
= note: expected `async` block `{async block@$DIR/coroutine-desc.rs:10:9: 10:17}`
12-
found `async` block `{async block@$DIR/coroutine-desc.rs:10:19: 10:27}`
11+
= note: expected `async` block `{async block@$DIR/coroutine-desc.rs:10:9: 10:14}`
12+
found `async` block `{async block@$DIR/coroutine-desc.rs:10:19: 10:24}`
1313
= note: no two async blocks, even if identical, have the same type
1414
= help: consider pinning your async block and casting it to a trait object
1515
note: function defined here

‎tests/ui/async-await/coroutine-not-future.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ note: required by a bound in `takes_coroutine`
2626
LL | fn takes_coroutine<ResumeTy>(_g: impl Coroutine<ResumeTy, Yield = (), Return = ()>) {}
2727
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_coroutine`
2828

29-
error[E0277]: the trait bound `{async block@$DIR/coroutine-not-future.rs:39:21: 39:29}: Coroutine<_>` is not satisfied
29+
error[E0277]: the trait bound `{async block@$DIR/coroutine-not-future.rs:39:21: 39:26}: Coroutine<_>` is not satisfied
3030
--> $DIR/coroutine-not-future.rs:39:21
3131
|
3232
LL | takes_coroutine(async {});
33-
| --------------- ^^^^^^^^ the trait `Coroutine<_>` is not implemented for `{async block@$DIR/coroutine-not-future.rs:39:21: 39:29}`
33+
| --------------- ^^^^^^^^ the trait `Coroutine<_>` is not implemented for `{async block@$DIR/coroutine-not-future.rs:39:21: 39:26}`
3434
| |
3535
| required by a bound introduced by this call
3636
|
There was a problem loading the remainder of the diff.

0 commit comments

Comments
 (0)
Failed to load comments.