Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
c28f2a8
Stabilize str_split_once
jhpratt Feb 9, 2021
4c70372
Make ItemKind::ExternCrate looks like hir::ItemKind::ExternCrate to m…
GuillaumeGomez Feb 15, 2021
5ff1be1
replaced some unwrap_or with unwrap_or_else
klensy Feb 23, 2021
c75c4a5
replaced some map_or with map_or_else
klensy Feb 23, 2021
6d5c0c1
Consider inexpensive inlining criteria first
tmiasko Feb 24, 2021
08b1e80
fix review
klensy Feb 25, 2021
fb24a10
Properly account for non-shorthand pattern field in unused variable lint
estebank Feb 25, 2021
356beb3
clarifies error when finding mismatched returned types for async func…
nellshamrell Feb 15, 2021
e130e9c
Update measureme dependency to the latest version
wesleywiser Feb 25, 2021
9d3739d
Set codegen thread names
wesleywiser Feb 18, 2021
c47903f
Add optional woff2 versions of FiraSans.
jsha Feb 26, 2021
ad7ed13
Embed woff2 files in rustdoc binary.
jsha Feb 26, 2021
91c246b
Rollup merge of #80845 - GuillaumeGomez:item-kind-transition, r=jyn514
GuillaumeGomez Feb 26, 2021
dc34ead
Rollup merge of #81940 - jhpratt:stabilize-str_split_once, r=m-ou-se
GuillaumeGomez Feb 26, 2021
3ddc7d4
Rollup merge of #82165 - nellshamrell:nell/fix-80658-B, r=estebank
GuillaumeGomez Feb 26, 2021
e11393a
Rollup merge of #82456 - klensy:or-else, r=estebank
GuillaumeGomez Feb 26, 2021
443c483
Rollup merge of #82491 - tmiasko:i, r=lcnr
GuillaumeGomez Feb 26, 2021
f6e77e8
Rollup merge of #82506 - estebank:unused_variable_lint, r=lcnr
GuillaumeGomez Feb 26, 2021
5964b43
Rollup merge of #82535 - wesleywiser:wip_codegen_thread_names, r=nagisa
GuillaumeGomez Feb 26, 2021
812d78f
Rollup merge of #82537 - wesleywiser:update_measureme, r=oli-obk
GuillaumeGomez Feb 26, 2021
65f3751
Rollup merge of #82545 - jsha:woff2, r=GuillaumeGomez
GuillaumeGomez Feb 26, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions compiler/rustc_infer/src/infer/error_reporting/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1484,13 +1484,16 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
for (key, values) in types.iter() {
let count = values.len();
let kind = key.descr();
let mut returned_async_output_error = false;
for sp in values {
err.span_label(
*sp,
format!(
"{}{}{} {}{}",
if sp.is_desugaring(DesugaringKind::Async) {
"the `Output` of this `async fn`'s "
if sp.is_desugaring(DesugaringKind::Async)
&& !returned_async_output_error
{
"checked the `Output` of this `async fn`, "
} else if count == 1 {
"the "
} else {
Expand All @@ -1502,6 +1505,12 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
pluralize!(count),
),
);
if sp.is_desugaring(DesugaringKind::Async)
&& returned_async_output_error == false
{
err.note("while checking the return type of the `async fn`");
returned_async_output_error = true;
}
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/test/ui/async-await/dont-suggest-missing-await.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ error[E0308]: mismatched types
--> $DIR/dont-suggest-missing-await.rs:14:18
|
LL | async fn make_u32() -> u32 {
| --- the `Output` of this `async fn`'s found opaque type
| --- checked the `Output` of this `async fn`, found opaque type
...
LL | take_u32(x)
| ^ expected `u32`, found opaque type
|
= note: while checking the return type of the `async fn`
= note: expected type `u32`
found opaque type `impl Future`
help: consider `await`ing on the `Future`
Expand Down
6 changes: 4 additions & 2 deletions src/test/ui/async-await/generator-desc.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ error[E0308]: mismatched types
--> $DIR/generator-desc.rs:12:16
|
LL | async fn one() {}
| - the `Output` of this `async fn`'s expected opaque type
| - checked the `Output` of this `async fn`, expected opaque type
LL | async fn two() {}
| - the `Output` of this `async fn`'s found opaque type
| - checked the `Output` of this `async fn`, found opaque type
...
LL | fun(one(), two());
| ^^^^^ expected opaque type, found a different opaque type
|
= note: while checking the return type of the `async fn`
= note: while checking the return type of the `async fn`
= note: expected opaque type `impl Future` (opaque type at <$DIR/generator-desc.rs:5:16>)
found opaque type `impl Future` (opaque type at <$DIR/generator-desc.rs:6:16>)
= help: consider `await`ing on both `Future`s
Expand Down
3 changes: 2 additions & 1 deletion src/test/ui/async-await/issue-61076.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ async fn struct_() -> Struct {
}

async fn tuple() -> Tuple {
//~^ NOTE the `Output` of this `async fn`'s expected opaque type
//~^ NOTE checked the `Output` of this `async fn`, expected opaque type
Tuple(1i32)
}

Expand Down Expand Up @@ -92,6 +92,7 @@ async fn match_() {
Tuple(_) => {} //~ ERROR mismatched types
//~^ NOTE expected opaque type, found struct `Tuple`
//~| NOTE expected opaque type `impl Future`
//~| NOTE while checking the return type of the `async fn`
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/test/ui/async-await/issue-61076.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,12 @@ error[E0308]: mismatched types
--> $DIR/issue-61076.rs:92:9
|
LL | async fn tuple() -> Tuple {
| ----- the `Output` of this `async fn`'s expected opaque type
| ----- checked the `Output` of this `async fn`, expected opaque type
...
LL | Tuple(_) => {}
| ^^^^^^^^ expected opaque type, found struct `Tuple`
|
= note: while checking the return type of the `async fn`
= note: expected opaque type `impl Future`
found struct `Tuple`
help: consider `await`ing on the `Future`
Expand Down
3 changes: 2 additions & 1 deletion src/test/ui/async-await/suggest-missing-await-closure.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ error[E0308]: mismatched types
--> $DIR/suggest-missing-await-closure.rs:16:18
|
LL | async fn make_u32() -> u32 {
| --- the `Output` of this `async fn`'s found opaque type
| --- checked the `Output` of this `async fn`, found opaque type
...
LL | take_u32(x)
| ^ expected `u32`, found opaque type
|
= note: while checking the return type of the `async fn`
= note: expected type `u32`
found opaque type `impl Future`
help: consider `await`ing on the `Future`
Expand Down
6 changes: 4 additions & 2 deletions src/test/ui/async-await/suggest-missing-await.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ error[E0308]: mismatched types
--> $DIR/suggest-missing-await.rs:12:14
|
LL | async fn make_u32() -> u32 {
| --- the `Output` of this `async fn`'s found opaque type
| --- checked the `Output` of this `async fn`, found opaque type
...
LL | take_u32(x)
| ^ expected `u32`, found opaque type
|
= note: while checking the return type of the `async fn`
= note: expected type `u32`
found opaque type `impl Future`
help: consider `await`ing on the `Future`
Expand All @@ -18,11 +19,12 @@ error[E0308]: mismatched types
--> $DIR/suggest-missing-await.rs:22:5
|
LL | async fn dummy() {}
| - the `Output` of this `async fn`'s found opaque type
| - checked the `Output` of this `async fn`, found opaque type
...
LL | dummy()
| ^^^^^^^ expected `()`, found opaque type
|
= note: while checking the return type of the `async fn`
= note: expected unit type `()`
found opaque type `impl Future`
help: consider `await`ing on the `Future`
Expand Down
6 changes: 4 additions & 2 deletions src/test/ui/parser/fn-header-semantic-fail.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,10 @@ LL | async fn ft1();
LL | async fn ft1() {}
| ^
| |
| the `Output` of this `async fn`'s found opaque type
| checked the `Output` of this `async fn`, found opaque type
| expected `()`, found opaque type
|
= note: while checking the return type of the `async fn`
= note: expected fn pointer `fn()`
found fn pointer `fn() -> impl Future`

Expand All @@ -204,9 +205,10 @@ LL | const async unsafe extern "C" fn ft5();
LL | const async unsafe extern "C" fn ft5() {}
| ^
| |
| the `Output` of this `async fn`'s found opaque type
| checked the `Output` of this `async fn`, found opaque type
| expected `()`, found opaque type
|
= note: while checking the return type of the `async fn`
= note: expected fn pointer `unsafe extern "C" fn()`
found fn pointer `unsafe extern "C" fn() -> impl Future`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ LL | async fn associated();
LL | async fn associated();
| ^
| |
| the `Output` of this `async fn`'s found opaque type
| checked the `Output` of this `async fn`, found opaque type
| expected `()`, found opaque type
|
= note: while checking the return type of the `async fn`
= note: expected fn pointer `fn()`
found fn pointer `fn() -> impl Future`

Expand Down
3 changes: 2 additions & 1 deletion src/test/ui/suggestions/issue-81839.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ LL | | }
::: $DIR/auxiliary/issue-81839.rs:6:49
|
LL | pub async fn answer_str(&self, _s: &str) -> Test {
| ---- the `Output` of this `async fn`'s found opaque type
| ---- checked the `Output` of this `async fn`, found opaque type
|
= note: while checking the return type of the `async fn`
= note: expected type `()`
found opaque type `impl Future`

Expand Down
9 changes: 6 additions & 3 deletions src/test/ui/suggestions/match-prev-arm-needing-semi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ fn extra_semicolon() {
};
}

async fn async_dummy() {} //~ NOTE the `Output` of this `async fn`'s found opaque type
async fn async_dummy2() {} //~ NOTE the `Output` of this `async fn`'s found opaque type
//~^ NOTE the `Output` of this `async fn`'s found opaque type
async fn async_dummy() {} //~ NOTE checked the `Output` of this `async fn`, found opaque type
async fn async_dummy2() {} //~ NOTE checked the `Output` of this `async fn`, found opaque type
//~| NOTE checked the `Output` of this `async fn`, found opaque type

async fn async_extra_semicolon_same() {
let _ = match true { //~ NOTE `match` arms have incompatible types
Expand All @@ -26,6 +26,7 @@ async fn async_extra_semicolon_same() {
false => async_dummy(), //~ ERROR `match` arms have incompatible types
//~^ NOTE expected `()`, found opaque type
//~| NOTE expected type `()`
//~| NOTE while checking the return type of the `async fn`
//~| HELP consider `await`ing on the `Future`
};
}
Expand All @@ -39,6 +40,7 @@ async fn async_extra_semicolon_different() {
false => async_dummy2(), //~ ERROR `match` arms have incompatible types
//~^ NOTE expected `()`, found opaque type
//~| NOTE expected type `()`
//~| NOTE while checking the return type of the `async fn`
//~| HELP consider `await`ing on the `Future`
};
}
Expand All @@ -51,6 +53,7 @@ async fn async_different_futures() {
//~^ NOTE expected opaque type, found a different opaque type
//~| NOTE expected type `impl Future`
//~| NOTE distinct uses of `impl Trait` result in different opaque types
//~| NOTE while checking the return type of the `async fn`
};
}

Expand Down
13 changes: 8 additions & 5 deletions src/test/ui/suggestions/match-prev-arm-needing-semi.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0308]: `match` arms have incompatible types
--> $DIR/match-prev-arm-needing-semi.rs:26:18
|
LL | async fn async_dummy() {}
| - the `Output` of this `async fn`'s found opaque type
| - checked the `Output` of this `async fn`, found opaque type
...
LL | let _ = match true {
| _____________-
Expand All @@ -18,6 +18,7 @@ LL | |
LL | | };
| |_____- `match` arms have incompatible types
|
= note: while checking the return type of the `async fn`
= note: expected type `()`
found opaque type `impl Future`
help: consider `await`ing on the `Future`
Expand All @@ -30,10 +31,10 @@ LL | async_dummy()
| --

error[E0308]: `match` arms have incompatible types
--> $DIR/match-prev-arm-needing-semi.rs:39:18
--> $DIR/match-prev-arm-needing-semi.rs:40:18
|
LL | async fn async_dummy2() {}
| - the `Output` of this `async fn`'s found opaque type
| - checked the `Output` of this `async fn`, found opaque type
...
LL | let _ = match true {
| _____________-
Expand All @@ -49,6 +50,7 @@ LL | |
LL | | };
| |_____- `match` arms have incompatible types
|
= note: while checking the return type of the `async fn`
= note: expected type `()`
found opaque type `impl Future`
help: consider `await`ing on the `Future`
Expand All @@ -64,10 +66,10 @@ LL | false => Box::new(async_dummy2()),
|

error[E0308]: `match` arms have incompatible types
--> $DIR/match-prev-arm-needing-semi.rs:50:18
--> $DIR/match-prev-arm-needing-semi.rs:52:18
|
LL | async fn async_dummy2() {}
| - the `Output` of this `async fn`'s found opaque type
| - checked the `Output` of this `async fn`, found opaque type
...
LL | let _ = match true {
| _____________-
Expand All @@ -81,6 +83,7 @@ LL | |
LL | | };
| |_____- `match` arms have incompatible types
|
= note: while checking the return type of the `async fn`
= note: expected type `impl Future` (opaque type at <$DIR/match-prev-arm-needing-semi.rs:16:24>)
found opaque type `impl Future` (opaque type at <$DIR/match-prev-arm-needing-semi.rs:17:25>)
= note: distinct uses of `impl Trait` result in different opaque types
Expand Down