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 9d959ea

Browse files
authoredFeb 2, 2023
Rollup merge of rust-lang#107201 - compiler-errors:confusing-async-fn-note, r=estebank
Remove confusing 'while checking' note from opaque future type mismatches Maybe I'm just misinterpreting the wording of the note. The only value I can see in this note is that it points out where the async's opaque future is coming from, but the way it's doing it is misleading IMO. For example: ```rust note: while checking the return type of the `async fn` --> $DIR/dont-suggest-missing-await.rs:7:24 | LL | async fn make_u32() -> u32 { | ^^^ checked the `Output` of this `async fn`, found opaque type ``` We point at the type `u32` in the HIR, but then say "found opaque type". We also say "while checking"... but we're typechecking a totally different function when we get this type mismatch! r? `@estebank` but feel free to reassign and/or take your time reviewing this. I'd be inclined to also discuss reworking the presentation of this type mismatch to restore some of these labels in a way that makes it more clear what it's trying to point out.
2 parents a6b171d + a63f5dc commit 9d959ea

18 files changed

+35
-236
lines changed
 

‎compiler/rustc_infer/src/infer/error_reporting/mod.rs

Lines changed: 16 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ use crate::traits::{
6060

6161
use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
6262
use rustc_errors::{pluralize, struct_span_err, Diagnostic, ErrorGuaranteed, IntoDiagnosticArg};
63-
use rustc_errors::{Applicability, DiagnosticBuilder, DiagnosticStyledString, MultiSpan};
63+
use rustc_errors::{Applicability, DiagnosticBuilder, DiagnosticStyledString};
6464
use rustc_hir as hir;
6565
use rustc_hir::def::DefKind;
6666
use rustc_hir::def_id::{DefId, LocalDefId};
@@ -1470,51 +1470,17 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
14701470
for (key, values) in types.iter() {
14711471
let count = values.len();
14721472
let kind = key.descr();
1473-
let mut returned_async_output_error = false;
14741473
for &sp in values {
1475-
if sp.is_desugaring(DesugaringKind::Async) && !returned_async_output_error {
1476-
if [sp] != err.span.primary_spans() {
1477-
let mut span: MultiSpan = sp.into();
1478-
span.push_span_label(
1479-
sp,
1480-
format!(
1481-
"checked the `Output` of this `async fn`, {}{} {}{}",
1482-
if count > 1 { "one of the " } else { "" },
1483-
target,
1484-
kind,
1485-
pluralize!(count),
1486-
),
1487-
);
1488-
err.span_note(
1489-
span,
1490-
"while checking the return type of the `async fn`",
1491-
);
1492-
} else {
1493-
err.span_label(
1494-
sp,
1495-
format!(
1496-
"checked the `Output` of this `async fn`, {}{} {}{}",
1497-
if count > 1 { "one of the " } else { "" },
1498-
target,
1499-
kind,
1500-
pluralize!(count),
1501-
),
1502-
);
1503-
err.note("while checking the return type of the `async fn`");
1504-
}
1505-
returned_async_output_error = true;
1506-
} else {
1507-
err.span_label(
1508-
sp,
1509-
format!(
1510-
"{}{} {}{}",
1511-
if count == 1 { "the " } else { "one of the " },
1512-
target,
1513-
kind,
1514-
pluralize!(count),
1515-
),
1516-
);
1517-
}
1474+
err.span_label(
1475+
sp,
1476+
format!(
1477+
"{}{} {}{}",
1478+
if count == 1 { "the " } else { "one of the " },
1479+
target,
1480+
kind,
1481+
pluralize!(count),
1482+
),
1483+
);
15181484
}
15191485
}
15201486
}
@@ -1537,7 +1503,11 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
15371503
// |
15381504
// = note: expected unit type `()`
15391505
// found closure `[closure@$DIR/issue-20862.rs:2:5: 2:14 x:_]`
1540-
if !self.ignore_span.overlaps(span) {
1506+
//
1507+
// Also ignore opaque `Future`s that come from async fns.
1508+
if !self.ignore_span.overlaps(span)
1509+
&& !span.is_desugaring(DesugaringKind::Async)
1510+
{
15411511
self.types.entry(kind).or_default().insert(span);
15421512
}
15431513
}

‎tests/ui/async-await/dont-suggest-missing-await.stderr

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@ LL | take_u32(x)
66
| |
77
| arguments to this function are incorrect
88
|
9-
note: while checking the return type of the `async fn`
10-
--> $DIR/dont-suggest-missing-await.rs:7:24
11-
|
12-
LL | async fn make_u32() -> u32 {
13-
| ^^^ checked the `Output` of this `async fn`, found opaque type
149
= note: expected type `u32`
1510
found opaque type `impl Future<Output = u32>`
1611
note: function defined here

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

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,6 @@ LL | fun(one(), two());
2121
| |
2222
| arguments to this function are incorrect
2323
|
24-
note: while checking the return type of the `async fn`
25-
--> $DIR/generator-desc.rs:5:16
26-
|
27-
LL | async fn one() {}
28-
| ^ checked the `Output` of this `async fn`, expected opaque type
29-
note: while checking the return type of the `async fn`
30-
--> $DIR/generator-desc.rs:6:16
31-
|
32-
LL | async fn two() {}
33-
| ^ checked the `Output` of this `async fn`, found opaque type
3424
= note: expected opaque type `impl Future<Output = ()>` (opaque type at <$DIR/generator-desc.rs:5:16>)
3525
found opaque type `impl Future<Output = ()>` (opaque type at <$DIR/generator-desc.rs:6:16>)
3626
= help: consider `await`ing on both `Future`s

‎tests/ui/async-await/issue-61076.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@ async fn struct_() -> Struct {
5454
}
5555

5656
async fn tuple() -> Tuple {
57-
//~^ NOTE checked the `Output` of this `async fn`, expected opaque type
58-
//~| NOTE while checking the return type of the `async fn`
59-
//~| NOTE in this expansion of desugaring of `async` block or function
6057
Tuple(1i32)
6158
}
6259

‎tests/ui/async-await/issue-61076.stderr

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ LL | foo().await?;
1111
| ++++++
1212

1313
error[E0277]: the `?` operator can only be applied to values that implement `Try`
14-
--> $DIR/issue-61076.rs:65:5
14+
--> $DIR/issue-61076.rs:62:5
1515
|
1616
LL | t?;
1717
| ^^ the `?` operator cannot be applied to type `T`
@@ -23,7 +23,7 @@ LL | t.await?;
2323
| ++++++
2424

2525
error[E0609]: no field `0` on type `impl Future<Output = Tuple>`
26-
--> $DIR/issue-61076.rs:74:26
26+
--> $DIR/issue-61076.rs:71:26
2727
|
2828
LL | let _: i32 = tuple().0;
2929
| ^ field not available in `impl Future`, but it is available in its `Output`
@@ -34,7 +34,7 @@ LL | let _: i32 = tuple().await.0;
3434
| ++++++
3535

3636
error[E0609]: no field `a` on type `impl Future<Output = Struct>`
37-
--> $DIR/issue-61076.rs:78:28
37+
--> $DIR/issue-61076.rs:75:28
3838
|
3939
LL | let _: i32 = struct_().a;
4040
| ^ field not available in `impl Future`, but it is available in its `Output`
@@ -45,7 +45,7 @@ LL | let _: i32 = struct_().await.a;
4545
| ++++++
4646

4747
error[E0599]: no method named `method` found for opaque type `impl Future<Output = Struct>` in the current scope
48-
--> $DIR/issue-61076.rs:82:15
48+
--> $DIR/issue-61076.rs:79:15
4949
|
5050
LL | struct_().method();
5151
| ^^^^^^ method not found in `impl Future<Output = Struct>`
@@ -56,19 +56,14 @@ LL | struct_().await.method();
5656
| ++++++
5757

5858
error[E0308]: mismatched types
59-
--> $DIR/issue-61076.rs:91:9
59+
--> $DIR/issue-61076.rs:88:9
6060
|
6161
LL | match tuple() {
6262
| ------- this expression has type `impl Future<Output = Tuple>`
6363
LL |
6464
LL | Tuple(_) => {}
6565
| ^^^^^^^^ expected opaque type, found `Tuple`
6666
|
67-
note: while checking the return type of the `async fn`
68-
--> $DIR/issue-61076.rs:56:21
69-
|
70-
LL | async fn tuple() -> Tuple {
71-
| ^^^^^ checked the `Output` of this `async fn`, expected opaque type
7267
= note: expected opaque type `impl Future<Output = Tuple>`
7368
found struct `Tuple`
7469
help: consider `await`ing on the `Future`

‎tests/ui/async-await/issue-98634.stderr

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ error[E0271]: expected `callback` to be a fn item that returns `Pin<Box<dyn Futu
44
LL | StructAsync { callback }.await;
55
| ^^^^^^^^ expected `Pin<Box<dyn Future<Output = ()>>>`, found opaque type
66
|
7-
note: while checking the return type of the `async fn`
8-
--> $DIR/issue-98634.rs:24:21
9-
|
10-
LL | async fn callback() {}
11-
| ^ checked the `Output` of this `async fn`, found opaque type
127
= note: expected struct `Pin<Box<(dyn Future<Output = ()> + 'static)>>`
138
found opaque type `impl Future<Output = ()>`
149
note: required by a bound in `StructAsync`
@@ -23,11 +18,6 @@ error[E0271]: expected `callback` to be a fn item that returns `Pin<Box<dyn Futu
2318
LL | StructAsync { callback }.await;
2419
| ^^^^^^^^^^^^^^^^^^^^^^^^ expected `Pin<Box<dyn Future<Output = ()>>>`, found opaque type
2520
|
26-
note: while checking the return type of the `async fn`
27-
--> $DIR/issue-98634.rs:24:21
28-
|
29-
LL | async fn callback() {}
30-
| ^ checked the `Output` of this `async fn`, found opaque type
3121
= note: expected struct `Pin<Box<(dyn Future<Output = ()> + 'static)>>`
3222
found opaque type `impl Future<Output = ()>`
3323
note: required by a bound in `StructAsync`
@@ -42,11 +32,6 @@ error[E0271]: expected `callback` to be a fn item that returns `Pin<Box<dyn Futu
4232
LL | StructAsync { callback }.await;
4333
| ^^^^^^ expected `Pin<Box<dyn Future<Output = ()>>>`, found opaque type
4434
|
45-
note: while checking the return type of the `async fn`
46-
--> $DIR/issue-98634.rs:24:21
47-
|
48-
LL | async fn callback() {}
49-
| ^ checked the `Output` of this `async fn`, found opaque type
5035
= note: expected struct `Pin<Box<(dyn Future<Output = ()> + 'static)>>`
5136
found opaque type `impl Future<Output = ()>`
5237
note: required by a bound in `StructAsync`

‎tests/ui/async-await/issues/issue-102206.stderr

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@ LL | std::mem::size_of_val(foo());
88
| | help: consider borrowing here: `&foo()`
99
| arguments to this function are incorrect
1010
|
11-
note: while checking the return type of the `async fn`
12-
--> $DIR/issue-102206.rs:3:16
13-
|
14-
LL | async fn foo() {}
15-
| ^ checked the `Output` of this `async fn`, found opaque type
1611
= note: expected reference `&_`
1712
found opaque type `impl Future<Output = ()>`
1813
note: function defined here

‎tests/ui/async-await/suggest-missing-await-closure.stderr

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@ LL | take_u32(x)
66
| |
77
| arguments to this function are incorrect
88
|
9-
note: while checking the return type of the `async fn`
10-
--> $DIR/suggest-missing-await-closure.rs:8:24
11-
|
12-
LL | async fn make_u32() -> u32 {
13-
| ^^^ checked the `Output` of this `async fn`, found opaque type
149
= note: expected type `u32`
1510
found opaque type `impl Future<Output = u32>`
1611
note: function defined here

‎tests/ui/async-await/suggest-missing-await.stderr

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@ LL | take_u32(x)
66
| |
77
| arguments to this function are incorrect
88
|
9-
note: while checking the return type of the `async fn`
10-
--> $DIR/suggest-missing-await.rs:5:24
11-
|
12-
LL | async fn make_u32() -> u32 {
13-
| ^^^ checked the `Output` of this `async fn`, found opaque type
149
= note: expected type `u32`
1510
found opaque type `impl Future<Output = u32>`
1611
note: function defined here
@@ -29,11 +24,6 @@ error[E0308]: mismatched types
2924
LL | dummy()
3025
| ^^^^^^^ expected `()`, found opaque type
3126
|
32-
note: while checking the return type of the `async fn`
33-
--> $DIR/suggest-missing-await.rs:18:18
34-
|
35-
LL | async fn dummy() {}
36-
| ^ checked the `Output` of this `async fn`, found opaque type
3727
= note: expected unit type `()`
3828
found opaque type `impl Future<Output = ()>`
3929
help: consider `await`ing on the `Future`
@@ -60,11 +50,6 @@ LL | |
6050
LL | | };
6151
| |_____- `if` and `else` have incompatible types
6252
|
63-
note: while checking the return type of the `async fn`
64-
--> $DIR/suggest-missing-await.rs:18:18
65-
|
66-
LL | async fn dummy() {}
67-
| ^ checked the `Output` of this `async fn`, expected opaque type
6853
= note: expected opaque type `impl Future<Output = ()>`
6954
found unit type `()`
7055
help: consider `await`ing on the `Future`
@@ -87,11 +72,6 @@ LL | |
8772
LL | | };
8873
| |_____- `match` arms have incompatible types
8974
|
90-
note: while checking the return type of the `async fn`
91-
--> $DIR/suggest-missing-await.rs:18:18
92-
|
93-
LL | async fn dummy() {}
94-
| ^ checked the `Output` of this `async fn`, expected opaque type
9575
= note: expected opaque type `impl Future<Output = ()>`
9676
found unit type `()`
9777
help: consider `await`ing on the `Future`
@@ -108,11 +88,6 @@ LL | let _x = match dummy() {
10888
LL | () => {}
10989
| ^^ expected opaque type, found `()`
11090
|
111-
note: while checking the return type of the `async fn`
112-
--> $DIR/suggest-missing-await.rs:18:18
113-
|
114-
LL | async fn dummy() {}
115-
| ^ checked the `Output` of this `async fn`, expected opaque type
11691
= note: expected opaque type `impl Future<Output = ()>`
11792
found unit type `()`
11893
help: consider `await`ing on the `Future`
@@ -129,11 +104,6 @@ LL | match dummy_result() {
129104
LL | Ok(_) => {}
130105
| ^^^^^ expected opaque type, found `Result<_, _>`
131106
|
132-
note: while checking the return type of the `async fn`
133-
--> $DIR/suggest-missing-await.rs:57:28
134-
|
135-
LL | async fn dummy_result() -> Result<(), ()> {
136-
| ^^^^^^^^^^^^^^ checked the `Output` of this `async fn`, expected opaque type
137107
= note: expected opaque type `impl Future<Output = Result<(), ()>>`
138108
found enum `Result<_, _>`
139109
help: consider `await`ing on the `Future`
@@ -150,11 +120,6 @@ LL | match dummy_result() {
150120
LL | Err(_) => {}
151121
| ^^^^^^ expected opaque type, found `Result<_, _>`
152122
|
153-
note: while checking the return type of the `async fn`
154-
--> $DIR/suggest-missing-await.rs:57:28
155-
|
156-
LL | async fn dummy_result() -> Result<(), ()> {
157-
| ^^^^^^^^^^^^^^ checked the `Output` of this `async fn`, expected opaque type
158123
= note: expected opaque type `impl Future<Output = Result<(), ()>>`
159124
found enum `Result<_, _>`
160125
help: consider `await`ing on the `Future`

‎tests/ui/impl-trait/in-trait/method-signature-matches.stderr

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,6 @@ LL | async fn owo(_: u8) {}
2424
| expected `()`, found `u8`
2525
| help: change the parameter type to match the trait: `()`
2626
|
27-
note: while checking the return type of the `async fn`
28-
--> $DIR/method-signature-matches.rs:20:25
29-
|
30-
LL | async fn owo(_: u8) {}
31-
| ^ checked the `Output` of this `async fn`, expected opaque type
32-
note: while checking the return type of the `async fn`
33-
--> $DIR/method-signature-matches.rs:20:25
34-
|
35-
LL | async fn owo(_: u8) {}
36-
| ^ checked the `Output` of this `async fn`, found opaque type
3727
note: type in trait
3828
--> $DIR/method-signature-matches.rs:16:21
3929
|

‎tests/ui/impl-trait/issue-102605.stderr

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@ LL | convert_result(foo())
66
| |
77
| arguments to this function are incorrect
88
|
9-
note: while checking the return type of the `async fn`
10-
--> $DIR/issue-102605.rs:3:19
11-
|
12-
LL | async fn foo() -> Result<(), String> {
13-
| ^^^^^^^^^^^^^^^^^^ checked the `Output` of this `async fn`, found opaque type
149
= note: expected enum `Result<(), _>`
1510
found opaque type `impl Future<Output = Result<(), String>>`
1611
note: function defined here

‎tests/ui/impl-trait/issue-99914.stderr

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ error[E0308]: mismatched types
44
LL | t.and_then(|t| -> _ { bar(t) });
55
| ^^^^^^ expected `Result<_, Error>`, found opaque type
66
|
7-
note: while checking the return type of the `async fn`
8-
--> $DIR/issue-99914.rs:13:23
9-
|
10-
LL | async fn bar(t: Okay) {}
11-
| ^ checked the `Output` of this `async fn`, found opaque type
127
= note: expected enum `Result<_, Error>`
138
found opaque type `impl Future<Output = ()>`
149
help: try wrapping the expression in `Ok`

‎tests/ui/suggestions/if-then-neeing-semi.rs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,9 @@ fn extra_semicolon() {
1515
};
1616
}
1717

18-
async fn async_dummy() {} //~ NOTE checked the `Output` of this `async fn`, found opaque type
19-
//~| NOTE while checking the return type of the `async fn`
20-
//~| NOTE in this expansion of desugaring of `async` block or function
21-
//~| NOTE checked the `Output` of this `async fn`, expected opaque type
22-
//~| NOTE while checking the return type of the `async fn`
23-
//~| NOTE in this expansion of desugaring of `async` block or function
24-
async fn async_dummy2() {} //~ NOTE checked the `Output` of this `async fn`, found opaque type
25-
//~| NOTE checked the `Output` of this `async fn`, found opaque type
26-
//~| NOTE while checking the return type of the `async fn`
27-
//~| NOTE in this expansion of desugaring of `async` block or function
28-
//~| NOTE while checking the return type of the `async fn`
29-
//~| NOTE in this expansion of desugaring of `async` block or function
18+
async fn async_dummy() {}
19+
20+
async fn async_dummy2() {}
3021

3122
async fn async_extra_semicolon_same() {
3223
let _ = if true {

‎tests/ui/suggestions/if-then-neeing-semi.stderr

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0308]: `if` and `else` have incompatible types
2-
--> $DIR/if-then-neeing-semi.rs:37:9
2+
--> $DIR/if-then-neeing-semi.rs:28:9
33
|
44
LL | let _ = if true {
55
| _____________-
@@ -15,11 +15,6 @@ LL | |
1515
LL | | };
1616
| |_____- `if` and `else` have incompatible types
1717
|
18-
note: while checking the return type of the `async fn`
19-
--> $DIR/if-then-neeing-semi.rs:18:24
20-
|
21-
LL | async fn async_dummy() {}
22-
| ^ checked the `Output` of this `async fn`, found opaque type
2318
= note: expected unit type `()`
2419
found opaque type `impl Future<Output = ()>`
2520
help: consider `await`ing on the `Future`
@@ -33,7 +28,7 @@ LL + async_dummy()
3328
|
3429

3530
error[E0308]: `if` and `else` have incompatible types
36-
--> $DIR/if-then-neeing-semi.rs:50:9
31+
--> $DIR/if-then-neeing-semi.rs:41:9
3732
|
3833
LL | let _ = if true {
3934
| _____________-
@@ -49,11 +44,6 @@ LL | |
4944
LL | | };
5045
| |_____- `if` and `else` have incompatible types
5146
|
52-
note: while checking the return type of the `async fn`
53-
--> $DIR/if-then-neeing-semi.rs:24:25
54-
|
55-
LL | async fn async_dummy2() {}
56-
| ^ checked the `Output` of this `async fn`, found opaque type
5747
= note: expected unit type `()`
5848
found opaque type `impl Future<Output = ()>`
5949
help: consider `await`ing on the `Future`
@@ -69,7 +59,7 @@ LL ~ Box::new(async_dummy2())
6959
|
7060

7161
error[E0308]: `if` and `else` have incompatible types
72-
--> $DIR/if-then-neeing-semi.rs:63:9
62+
--> $DIR/if-then-neeing-semi.rs:54:9
7363
|
7464
LL | let _ = if true {
7565
| _____________-
@@ -85,18 +75,8 @@ LL | |
8575
LL | | };
8676
| |_____- `if` and `else` have incompatible types
8777
|
88-
note: while checking the return type of the `async fn`
89-
--> $DIR/if-then-neeing-semi.rs:18:24
90-
|
91-
LL | async fn async_dummy() {}
92-
| ^ checked the `Output` of this `async fn`, expected opaque type
93-
note: while checking the return type of the `async fn`
94-
--> $DIR/if-then-neeing-semi.rs:24:25
95-
|
96-
LL | async fn async_dummy2() {}
97-
| ^ checked the `Output` of this `async fn`, found opaque type
9878
= note: expected opaque type `impl Future<Output = ()>` (opaque type at <$DIR/if-then-neeing-semi.rs:18:24>)
99-
found opaque type `impl Future<Output = ()>` (opaque type at <$DIR/if-then-neeing-semi.rs:24:25>)
79+
found opaque type `impl Future<Output = ()>` (opaque type at <$DIR/if-then-neeing-semi.rs:20:25>)
10080
= note: distinct uses of `impl Trait` result in different opaque types
10181
help: consider `await`ing on both `Future`s
10282
|

‎tests/ui/suggestions/issue-81839.stderr

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@ LL | | _ => cx.answer_str("hi"),
1414
LL | | }
1515
| |_____- `match` arms have incompatible types
1616
|
17-
note: while checking the return type of the `async fn`
18-
--> $DIR/auxiliary/issue-81839.rs:6:49
19-
|
20-
LL | pub async fn answer_str(&self, _s: &str) -> Test {
21-
| ^^^^ checked the `Output` of this `async fn`, found opaque type
2217
= note: expected unit type `()`
2318
found opaque type `impl Future<Output = Test>`
2419

‎tests/ui/suggestions/match-prev-arm-needing-semi.rs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,9 @@ fn extra_semicolon() {
1313
};
1414
}
1515

16-
async fn async_dummy() {} //~ NOTE checked the `Output` of this `async fn`, found opaque type
17-
//~| NOTE while checking the return type of the `async fn`
18-
//~| NOTE in this expansion of desugaring of `async` block or function
19-
//~| NOTE checked the `Output` of this `async fn`, expected opaque type
20-
//~| NOTE while checking the return type of the `async fn`
21-
//~| NOTE in this expansion of desugaring of `async` block or function
22-
async fn async_dummy2() {} //~ NOTE checked the `Output` of this `async fn`, found opaque type
23-
//~| NOTE checked the `Output` of this `async fn`, found opaque type
24-
//~| NOTE while checking the return type of the `async fn`
25-
//~| NOTE in this expansion of desugaring of `async` block or function
26-
//~| NOTE while checking the return type of the `async fn`
27-
//~| NOTE in this expansion of desugaring of `async` block or function
16+
async fn async_dummy() {}
17+
18+
async fn async_dummy2() {}
2819

2920
async fn async_extra_semicolon_same() {
3021
let _ = match true { //~ NOTE `match` arms have incompatible types

‎tests/ui/suggestions/match-prev-arm-needing-semi.stderr

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0308]: `match` arms have incompatible types
2-
--> $DIR/match-prev-arm-needing-semi.rs:35:18
2+
--> $DIR/match-prev-arm-needing-semi.rs:26:18
33
|
44
LL | let _ = match true {
55
| _____________-
@@ -15,11 +15,6 @@ LL | |
1515
LL | | };
1616
| |_____- `match` arms have incompatible types
1717
|
18-
note: while checking the return type of the `async fn`
19-
--> $DIR/match-prev-arm-needing-semi.rs:16:24
20-
|
21-
LL | async fn async_dummy() {}
22-
| ^ checked the `Output` of this `async fn`, found opaque type
2318
= note: expected unit type `()`
2419
found opaque type `impl Future<Output = ()>`
2520
help: consider `await`ing on the `Future`
@@ -33,7 +28,7 @@ LL + async_dummy()
3328
|
3429

3530
error[E0308]: `match` arms have incompatible types
36-
--> $DIR/match-prev-arm-needing-semi.rs:48:18
31+
--> $DIR/match-prev-arm-needing-semi.rs:39:18
3732
|
3833
LL | let _ = match true {
3934
| _____________-
@@ -49,11 +44,6 @@ LL | |
4944
LL | | };
5045
| |_____- `match` arms have incompatible types
5146
|
52-
note: while checking the return type of the `async fn`
53-
--> $DIR/match-prev-arm-needing-semi.rs:22:25
54-
|
55-
LL | async fn async_dummy2() {}
56-
| ^ checked the `Output` of this `async fn`, found opaque type
5747
= note: expected unit type `()`
5848
found opaque type `impl Future<Output = ()>`
5949
help: consider `await`ing on the `Future`
@@ -69,7 +59,7 @@ LL ~ false => Box::new(async_dummy2()),
6959
|
7060

7161
error[E0308]: `match` arms have incompatible types
72-
--> $DIR/match-prev-arm-needing-semi.rs:59:18
62+
--> $DIR/match-prev-arm-needing-semi.rs:50:18
7363
|
7464
LL | let _ = match true {
7565
| _____________-
@@ -83,18 +73,8 @@ LL | |
8373
LL | | };
8474
| |_____- `match` arms have incompatible types
8575
|
86-
note: while checking the return type of the `async fn`
87-
--> $DIR/match-prev-arm-needing-semi.rs:16:24
88-
|
89-
LL | async fn async_dummy() {}
90-
| ^ checked the `Output` of this `async fn`, expected opaque type
91-
note: while checking the return type of the `async fn`
92-
--> $DIR/match-prev-arm-needing-semi.rs:22:25
93-
|
94-
LL | async fn async_dummy2() {}
95-
| ^ checked the `Output` of this `async fn`, found opaque type
9676
= note: expected opaque type `impl Future<Output = ()>` (opaque type at <$DIR/match-prev-arm-needing-semi.rs:16:24>)
97-
found opaque type `impl Future<Output = ()>` (opaque type at <$DIR/match-prev-arm-needing-semi.rs:22:25>)
77+
found opaque type `impl Future<Output = ()>` (opaque type at <$DIR/match-prev-arm-needing-semi.rs:18:25>)
9878
= note: distinct uses of `impl Trait` result in different opaque types
9979
help: consider `await`ing on both `Future`s
10080
|

‎tests/ui/type-alias-impl-trait/issue-98604.stderr

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ error[E0271]: expected `test` to be a fn item that returns `Pin<Box<dyn Future<O
44
LL | Box::new(test) as AsyncFnPtr;
55
| ^^^^^^^^^^^^^^ expected `Pin<Box<dyn Future<Output = ()>>>`, found opaque type
66
|
7-
note: while checking the return type of the `async fn`
8-
--> $DIR/issue-98604.rs:5:17
9-
|
10-
LL | async fn test() {}
11-
| ^ checked the `Output` of this `async fn`, found opaque type
127
= note: expected struct `Pin<Box<(dyn Future<Output = ()> + 'static)>>`
138
found opaque type `impl Future<Output = ()>`
149
= note: required for the cast from `fn() -> impl Future<Output = ()> {test}` to the object type `dyn Fn() -> Pin<Box<(dyn Future<Output = ()> + 'static)>>`

0 commit comments

Comments
 (0)
Please sign in to comment.