Auto merge of #91945 - matthiaskrgr:rollup-jszf9zp, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #90939 (Tweak errors coming from `for`-loop, `?` and `.await` desugaring) - #91859 (Iterator::cycle() — document empty iterator special case) - #91868 (Use `OutputFilenames` to generate output file for `-Zllvm-time-trace`) - #91870 (Revert setting a default for the MACOSX_DEPLOYMENT_TARGET env var for linking) - #91881 (Stabilize `iter::zip`) - #91882 (Remove `in_band_lifetimes` from `rustc_typeck`) - #91940 (Update cargo) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
195e931b02
126 changed files with 543 additions and 492 deletions
|
|
@ -41,9 +41,9 @@
|
|||
41| 1| // executed asynchronously.
|
||||
42| 1| match x {
|
||||
43| 1| y if c(x).await == y + 1 => { d().await; }
|
||||
^0 ^0
|
||||
^0 ^0 ^0 ^0
|
||||
44| 1| y if f().await == y + 1 => (),
|
||||
^0 ^0
|
||||
^0 ^0 ^0
|
||||
45| 1| _ => (),
|
||||
46| | }
|
||||
47| 1|}
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ impl CodegenBackend for TheBackend {
|
|||
&self,
|
||||
ongoing_codegen: Box<dyn Any>,
|
||||
_sess: &Session,
|
||||
_outputs: &OutputFilenames,
|
||||
) -> Result<(CodegenResults, FxHashMap<WorkProductId, WorkProduct>), ErrorReported> {
|
||||
let codegen_results = ongoing_codegen
|
||||
.downcast::<CodegenResults>()
|
||||
|
|
|
|||
|
|
@ -14,10 +14,10 @@ LL | let a;
|
|||
| ^ cannot infer type
|
||||
|
|
||||
note: the type is part of the `async fn` body because of this `await`
|
||||
--> $DIR/async-error-span.rs:14:5
|
||||
--> $DIR/async-error-span.rs:14:17
|
||||
|
|
||||
LL | get_future().await;
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
| ^^^^^^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -6,13 +6,13 @@ LL | assert_send(local_dropped_before_await());
|
|||
|
|
||||
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
|
||||
note: future is not `Send` as this value is used across an await
|
||||
--> $DIR/async-fn-nonsend.rs:24:5
|
||||
--> $DIR/async-fn-nonsend.rs:24:10
|
||||
|
|
||||
LL | let x = non_send();
|
||||
| - has type `impl Debug` which is not `Send`
|
||||
LL | drop(x);
|
||||
LL | fut().await;
|
||||
| ^^^^^^^^^^^ await occurs here, with `x` maybe used later
|
||||
| ^^^^^^ await occurs here, with `x` maybe used later
|
||||
LL | }
|
||||
| - `x` is later dropped here
|
||||
note: required by a bound in `assert_send`
|
||||
|
|
@ -29,12 +29,12 @@ LL | assert_send(non_send_temporary_in_match());
|
|||
|
|
||||
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
|
||||
note: future is not `Send` as this value is used across an await
|
||||
--> $DIR/async-fn-nonsend.rs:33:20
|
||||
--> $DIR/async-fn-nonsend.rs:33:25
|
||||
|
|
||||
LL | match Some(non_send()) {
|
||||
| ---------- has type `impl Debug` which is not `Send`
|
||||
LL | Some(_) => fut().await,
|
||||
| ^^^^^^^^^^^ await occurs here, with `non_send()` maybe used later
|
||||
| ^^^^^^ await occurs here, with `non_send()` maybe used later
|
||||
...
|
||||
LL | }
|
||||
| - `non_send()` is later dropped here
|
||||
|
|
@ -52,13 +52,13 @@ LL | assert_send(non_sync_with_method_call());
|
|||
|
|
||||
= help: the trait `Send` is not implemented for `dyn std::fmt::Write`
|
||||
note: future is not `Send` as this value is used across an await
|
||||
--> $DIR/async-fn-nonsend.rs:42:9
|
||||
--> $DIR/async-fn-nonsend.rs:42:14
|
||||
|
|
||||
LL | let f: &mut std::fmt::Formatter = panic!();
|
||||
| - has type `&mut Formatter<'_>` which is not `Send`
|
||||
LL | if non_sync().fmt(f).unwrap() == () {
|
||||
LL | fut().await;
|
||||
| ^^^^^^^^^^^ await occurs here, with `f` maybe used later
|
||||
| ^^^^^^ await occurs here, with `f` maybe used later
|
||||
LL | }
|
||||
LL | }
|
||||
| - `f` is later dropped here
|
||||
|
|
|
|||
|
|
@ -162,68 +162,68 @@ LL | let _ = (await bar())?;
|
|||
| ^^^^^^^^^^^ only allowed inside `async` functions and blocks
|
||||
|
||||
error[E0728]: `await` is only allowed inside `async` functions and blocks
|
||||
--> $DIR/incorrect-syntax-suggestions.rs:71:13
|
||||
--> $DIR/incorrect-syntax-suggestions.rs:71:18
|
||||
|
|
||||
LL | fn foo13() -> Result<(), ()> {
|
||||
| ----- this is not `async`
|
||||
LL | let _ = bar().await();
|
||||
| ^^^^^^^^^^^ only allowed inside `async` functions and blocks
|
||||
| ^^^^^^ only allowed inside `async` functions and blocks
|
||||
|
||||
error[E0728]: `await` is only allowed inside `async` functions and blocks
|
||||
--> $DIR/incorrect-syntax-suggestions.rs:76:13
|
||||
--> $DIR/incorrect-syntax-suggestions.rs:76:18
|
||||
|
|
||||
LL | fn foo14() -> Result<(), ()> {
|
||||
| ----- this is not `async`
|
||||
LL | let _ = bar().await()?;
|
||||
| ^^^^^^^^^^^ only allowed inside `async` functions and blocks
|
||||
| ^^^^^^ only allowed inside `async` functions and blocks
|
||||
|
||||
error[E0728]: `await` is only allowed inside `async` functions and blocks
|
||||
--> $DIR/incorrect-syntax-suggestions.rs:81:13
|
||||
--> $DIR/incorrect-syntax-suggestions.rs:81:18
|
||||
|
|
||||
LL | fn foo15() -> Result<(), ()> {
|
||||
| ----- this is not `async`
|
||||
LL | let _ = bar().await;
|
||||
| ^^^^^^^^^^^ only allowed inside `async` functions and blocks
|
||||
| ^^^^^^ only allowed inside `async` functions and blocks
|
||||
|
||||
error[E0728]: `await` is only allowed inside `async` functions and blocks
|
||||
--> $DIR/incorrect-syntax-suggestions.rs:85:13
|
||||
--> $DIR/incorrect-syntax-suggestions.rs:85:18
|
||||
|
|
||||
LL | fn foo16() -> Result<(), ()> {
|
||||
| ----- this is not `async`
|
||||
LL | let _ = bar().await?;
|
||||
| ^^^^^^^^^^^ only allowed inside `async` functions and blocks
|
||||
| ^^^^^^ only allowed inside `async` functions and blocks
|
||||
|
||||
error[E0728]: `await` is only allowed inside `async` functions and blocks
|
||||
--> $DIR/incorrect-syntax-suggestions.rs:90:17
|
||||
--> $DIR/incorrect-syntax-suggestions.rs:90:22
|
||||
|
|
||||
LL | fn foo() -> Result<(), ()> {
|
||||
| --- this is not `async`
|
||||
LL | let _ = bar().await?;
|
||||
| ^^^^^^^^^^^ only allowed inside `async` functions and blocks
|
||||
| ^^^^^^ only allowed inside `async` functions and blocks
|
||||
|
||||
error[E0728]: `await` is only allowed inside `async` functions and blocks
|
||||
--> $DIR/incorrect-syntax-suggestions.rs:97:17
|
||||
--> $DIR/incorrect-syntax-suggestions.rs:97:22
|
||||
|
|
||||
LL | let foo = || {
|
||||
| -- this is not `async`
|
||||
LL | let _ = bar().await?;
|
||||
| ^^^^^^^^^^^ only allowed inside `async` functions and blocks
|
||||
| ^^^^^^ only allowed inside `async` functions and blocks
|
||||
|
||||
error[E0728]: `await` is only allowed inside `async` functions and blocks
|
||||
--> $DIR/incorrect-syntax-suggestions.rs:113:17
|
||||
--> $DIR/incorrect-syntax-suggestions.rs:113:29
|
||||
|
|
||||
LL | fn foo() -> Result<(), ()> {
|
||||
| --- this is not `async`
|
||||
LL | let _ = await!(bar())?;
|
||||
| ^^^^^^^^^^^^^ only allowed inside `async` functions and blocks
|
||||
| ^ only allowed inside `async` functions and blocks
|
||||
|
||||
error[E0728]: `await` is only allowed inside `async` functions and blocks
|
||||
--> $DIR/incorrect-syntax-suggestions.rs:121:17
|
||||
--> $DIR/incorrect-syntax-suggestions.rs:121:29
|
||||
|
|
||||
LL | let foo = || {
|
||||
| -- this is not `async`
|
||||
LL | let _ = await!(bar())?;
|
||||
| ^^^^^^^^^^^^^ only allowed inside `async` functions and blocks
|
||||
| ^ only allowed inside `async` functions and blocks
|
||||
|
||||
error: aborting due to 33 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -6,12 +6,12 @@ LL | is_sync(bar());
|
|||
|
|
||||
= help: within `impl Future<Output = ()>`, the trait `Sync` is not implemented for `Foo`
|
||||
note: future is not `Sync` as this value is used across an await
|
||||
--> $DIR/issue-64130-1-sync.rs:15:5
|
||||
--> $DIR/issue-64130-1-sync.rs:15:10
|
||||
|
|
||||
LL | let x = Foo;
|
||||
| - has type `Foo` which is not `Sync`
|
||||
LL | baz().await;
|
||||
| ^^^^^^^^^^^ await occurs here, with `x` maybe used later
|
||||
| ^^^^^^ await occurs here, with `x` maybe used later
|
||||
LL | }
|
||||
| - `x` is later dropped here
|
||||
note: required by a bound in `is_sync`
|
||||
|
|
|
|||
|
|
@ -6,12 +6,12 @@ LL | is_send(bar());
|
|||
|
|
||||
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Foo`
|
||||
note: future is not `Send` as this value is used across an await
|
||||
--> $DIR/issue-64130-2-send.rs:15:5
|
||||
--> $DIR/issue-64130-2-send.rs:15:10
|
||||
|
|
||||
LL | let x = Foo;
|
||||
| - has type `Foo` which is not `Send`
|
||||
LL | baz().await;
|
||||
| ^^^^^^^^^^^ await occurs here, with `x` maybe used later
|
||||
| ^^^^^^ await occurs here, with `x` maybe used later
|
||||
LL | }
|
||||
| - `x` is later dropped here
|
||||
note: required by a bound in `is_send`
|
||||
|
|
|
|||
|
|
@ -8,12 +8,12 @@ LL | is_qux(bar());
|
|||
| ^^^^^ within `impl Future<Output = ()>`, the trait `Qux` is not implemented for `Foo`
|
||||
|
|
||||
note: future does not implement `Qux` as this value is used across an await
|
||||
--> $DIR/issue-64130-3-other.rs:18:5
|
||||
--> $DIR/issue-64130-3-other.rs:18:10
|
||||
|
|
||||
LL | let x = Foo;
|
||||
| - has type `Foo` which does not implement `Qux`
|
||||
LL | baz().await;
|
||||
| ^^^^^^^^^^^ await occurs here, with `x` maybe used later
|
||||
| ^^^^^^ await occurs here, with `x` maybe used later
|
||||
LL | }
|
||||
| - `x` is later dropped here
|
||||
note: required by a bound in `is_qux`
|
||||
|
|
|
|||
|
|
@ -6,13 +6,13 @@ LL | pub fn foo() -> impl Future + Send {
|
|||
|
|
||||
= help: the trait `Sync` is not implemented for `(dyn Any + Send + 'static)`
|
||||
note: future is not `Send` as this value is used across an await
|
||||
--> $DIR/issue-64130-4-async-move.rs:21:26
|
||||
--> $DIR/issue-64130-4-async-move.rs:21:31
|
||||
|
|
||||
LL | match client.status() {
|
||||
| ------ has type `&Client` which is not `Send`
|
||||
LL | 200 => {
|
||||
LL | let _x = get().await;
|
||||
| ^^^^^^^^^^^ await occurs here, with `client` maybe used later
|
||||
| ^^^^^^ await occurs here, with `client` maybe used later
|
||||
...
|
||||
LL | }
|
||||
| - `client` is later dropped here
|
||||
|
|
|
|||
|
|
@ -6,12 +6,12 @@ LL | is_send(foo());
|
|||
|
|
||||
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `MutexGuard<'_, u32>`
|
||||
note: future is not `Send` as this value is used across an await
|
||||
--> $DIR/issue-64130-non-send-future-diags.rs:17:5
|
||||
--> $DIR/issue-64130-non-send-future-diags.rs:17:10
|
||||
|
|
||||
LL | let g = x.lock().unwrap();
|
||||
| - has type `MutexGuard<'_, u32>` which is not `Send`
|
||||
LL | baz().await;
|
||||
| ^^^^^^^^^^^ await occurs here, with `g` maybe used later
|
||||
| ^^^^^^ await occurs here, with `g` maybe used later
|
||||
LL | }
|
||||
| - `g` is later dropped here
|
||||
note: required by a bound in `is_send`
|
||||
|
|
|
|||
|
|
@ -6,12 +6,12 @@ LL | spawn(async {
|
|||
|
|
||||
= help: within `impl Future<Output = [async output]>`, the trait `Send` is not implemented for `*mut ()`
|
||||
note: future is not `Send` as this value is used across an await
|
||||
--> $DIR/issue-67252-unnamed-future.rs:20:9
|
||||
--> $DIR/issue-67252-unnamed-future.rs:20:16
|
||||
|
|
||||
LL | let _a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send`
|
||||
| -- has type `*mut ()` which is not `Send`
|
||||
LL | AFuture.await;
|
||||
| ^^^^^^^^^^^^^ await occurs here, with `_a` maybe used later
|
||||
| ^^^^^^ await occurs here, with `_a` maybe used later
|
||||
LL | });
|
||||
| - `_a` is later dropped here
|
||||
note: required by a bound in `spawn`
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
error[E0728]: `await` is only allowed inside `async` functions and blocks
|
||||
--> $DIR/issue-70594.rs:4:9
|
||||
--> $DIR/issue-70594.rs:4:11
|
||||
|
|
||||
LL | async fn fun() {
|
||||
| --- this is not `async`
|
||||
LL | [1; ().await];
|
||||
| ^^^^^^^^ only allowed inside `async` functions and blocks
|
||||
| ^^^^^^ only allowed inside `async` functions and blocks
|
||||
|
||||
error[E0744]: `.await` is not allowed in a `const`
|
||||
--> $DIR/issue-70594.rs:4:9
|
||||
|
|
@ -13,20 +13,25 @@ LL | [1; ().await];
|
|||
| ^^^^^^^^
|
||||
|
||||
error[E0744]: `.await` is not allowed in a `const`
|
||||
--> $DIR/issue-70594.rs:4:9
|
||||
--> $DIR/issue-70594.rs:4:11
|
||||
|
|
||||
LL | [1; ().await];
|
||||
| ^^^^^^^^
|
||||
| ^^^^^^
|
||||
|
||||
error[E0277]: `()` is not a future
|
||||
--> $DIR/issue-70594.rs:4:9
|
||||
--> $DIR/issue-70594.rs:4:11
|
||||
|
|
||||
LL | [1; ().await];
|
||||
| ^^^^^^^^ `()` is not a future
|
||||
| ^^^^^^ `()` is not a future
|
||||
|
|
||||
= help: the trait `Future` is not implemented for `()`
|
||||
= note: () must be a future or must implement `IntoFuture` to be awaited
|
||||
= note: required because of the requirements on the impl of `IntoFuture` for `()`
|
||||
help: remove the `.await`
|
||||
|
|
||||
LL - [1; ().await];
|
||||
LL + [1; ()];
|
||||
|
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -6,25 +6,20 @@ LL | fn foo(tx: std::sync::mpsc::Sender<i32>) -> impl Future + Send {
|
|||
|
|
||||
= help: the trait `Sync` is not implemented for `Sender<i32>`
|
||||
note: future is not `Send` as this value is used across an await
|
||||
--> $DIR/issue-70935-complex-spans.rs:13:9
|
||||
--> $DIR/issue-70935-complex-spans.rs:15:11
|
||||
|
|
||||
LL | / baz(|| async{
|
||||
LL | baz(|| async{
|
||||
| _____________-
|
||||
LL | | foo(tx.clone());
|
||||
LL | | }).await;
|
||||
| |________________^ first, await occurs here, with the value maybe used later...
|
||||
| | - ^^^^^^ await occurs here, with the value maybe used later
|
||||
| |_________|
|
||||
| has type `[closure@$DIR/issue-70935-complex-spans.rs:13:13: 15:10]` which is not `Send`
|
||||
note: the value is later dropped here
|
||||
--> $DIR/issue-70935-complex-spans.rs:15:17
|
||||
|
|
||||
LL | }).await;
|
||||
| ^
|
||||
note: this has type `[closure@$DIR/issue-70935-complex-spans.rs:13:13: 15:10]` which is not `Send`
|
||||
--> $DIR/issue-70935-complex-spans.rs:13:13
|
||||
|
|
||||
LL | baz(|| async{
|
||||
| _____________^
|
||||
LL | | foo(tx.clone());
|
||||
LL | | }).await;
|
||||
| |_________^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -6,12 +6,12 @@ LL | fake_spawn(wrong_mutex());
|
|||
|
|
||||
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `MutexGuard<'_, i32>`
|
||||
note: future is not `Send` as this value is used across an await
|
||||
--> $DIR/issue-71137.rs:14:5
|
||||
--> $DIR/issue-71137.rs:14:25
|
||||
|
|
||||
LL | let mut guard = m.lock().unwrap();
|
||||
| --------- has type `MutexGuard<'_, i32>` which is not `Send`
|
||||
LL | (async { "right"; }).await;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ await occurs here, with `mut guard` maybe used later
|
||||
| ^^^^^^ await occurs here, with `mut guard` maybe used later
|
||||
LL | *guard += 1;
|
||||
LL | }
|
||||
| - `mut guard` is later dropped here
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
error[E0728]: `await` is only allowed inside `async` functions and blocks
|
||||
--> $DIR/issue-51719.rs:8:19
|
||||
--> $DIR/issue-51719.rs:8:24
|
||||
|
|
||||
LL | let _gen = || foo().await;
|
||||
| -- ^^^^^^^^^^^ only allowed inside `async` functions and blocks
|
||||
| -- ^^^^^^ only allowed inside `async` functions and blocks
|
||||
| |
|
||||
| this is not `async`
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
error[E0728]: `await` is only allowed inside `async` functions and blocks
|
||||
--> $DIR/issue-51751.rs:9:20
|
||||
--> $DIR/issue-51751.rs:9:26
|
||||
|
|
||||
LL | fn main() {
|
||||
| ---- this is not `async`
|
||||
LL | let result = inc(10000);
|
||||
LL | let finished = result.await;
|
||||
| ^^^^^^^^^^^^ only allowed inside `async` functions and blocks
|
||||
| ^^^^^^ only allowed inside `async` functions and blocks
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@ fn main() {
|
|||
async { let (); }.await;
|
||||
//~^ ERROR `await` is only allowed inside `async` functions and blocks
|
||||
async {
|
||||
//~^ ERROR `await` is only allowed inside `async` functions and blocks
|
||||
let task1 = print_dur().await;
|
||||
}.await;
|
||||
//~^ ERROR `await` is only allowed inside `async` functions and blocks
|
||||
(|_| 2333).await;
|
||||
//~^ ERROR `await` is only allowed inside `async` functions and blocks
|
||||
//~^^ ERROR
|
||||
//~| ERROR is not a future
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,41 +1,43 @@
|
|||
error[E0728]: `await` is only allowed inside `async` functions and blocks
|
||||
--> $DIR/issue-62009-1.rs:6:5
|
||||
--> $DIR/issue-62009-1.rs:6:22
|
||||
|
|
||||
LL | fn main() {
|
||||
| ---- this is not `async`
|
||||
LL | async { let (); }.await;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ only allowed inside `async` functions and blocks
|
||||
| ^^^^^^ only allowed inside `async` functions and blocks
|
||||
|
||||
error[E0728]: `await` is only allowed inside `async` functions and blocks
|
||||
--> $DIR/issue-62009-1.rs:8:5
|
||||
--> $DIR/issue-62009-1.rs:10:6
|
||||
|
|
||||
LL | fn main() {
|
||||
| ---- this is not `async`
|
||||
LL | fn main() {
|
||||
| ---- this is not `async`
|
||||
...
|
||||
LL | / async {
|
||||
LL | |
|
||||
LL | | let task1 = print_dur().await;
|
||||
LL | | }.await;
|
||||
| |___________^ only allowed inside `async` functions and blocks
|
||||
LL | }.await;
|
||||
| ^^^^^^ only allowed inside `async` functions and blocks
|
||||
|
||||
error[E0728]: `await` is only allowed inside `async` functions and blocks
|
||||
--> $DIR/issue-62009-1.rs:12:5
|
||||
--> $DIR/issue-62009-1.rs:12:15
|
||||
|
|
||||
LL | fn main() {
|
||||
| ---- this is not `async`
|
||||
...
|
||||
LL | (|_| 2333).await;
|
||||
| ^^^^^^^^^^^^^^^^ only allowed inside `async` functions and blocks
|
||||
| ^^^^^^ only allowed inside `async` functions and blocks
|
||||
|
||||
error[E0277]: `[closure@$DIR/issue-62009-1.rs:12:5: 12:15]` is not a future
|
||||
--> $DIR/issue-62009-1.rs:12:5
|
||||
--> $DIR/issue-62009-1.rs:12:15
|
||||
|
|
||||
LL | (|_| 2333).await;
|
||||
| ^^^^^^^^^^^^^^^^ `[closure@$DIR/issue-62009-1.rs:12:5: 12:15]` is not a future
|
||||
| ^^^^^^ `[closure@$DIR/issue-62009-1.rs:12:5: 12:15]` is not a future
|
||||
|
|
||||
= help: the trait `Future` is not implemented for `[closure@$DIR/issue-62009-1.rs:12:5: 12:15]`
|
||||
= note: [closure@$DIR/issue-62009-1.rs:12:5: 12:15] must be a future or must implement `IntoFuture` to be awaited
|
||||
= note: required because of the requirements on the impl of `IntoFuture` for `[closure@$DIR/issue-62009-1.rs:12:5: 12:15]`
|
||||
help: remove the `.await`
|
||||
|
|
||||
LL - (|_| 2333).await;
|
||||
LL + (|_| 2333);
|
||||
|
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
error[E0728]: `await` is only allowed inside `async` functions and blocks
|
||||
--> $DIR/issue-62009-2.rs:8:5
|
||||
--> $DIR/issue-62009-2.rs:8:22
|
||||
|
|
||||
LL | fn main() {
|
||||
| ---- this is not `async`
|
||||
LL | (async || 2333)().await;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ only allowed inside `async` functions and blocks
|
||||
| ^^^^^^ only allowed inside `async` functions and blocks
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -6,17 +6,17 @@ LL | assert_send(async {
|
|||
|
|
||||
= help: within `impl Future<Output = [async output]>`, the trait `Send` is not implemented for `*const u8`
|
||||
note: future is not `Send` as this value is used across an await
|
||||
--> $DIR/issue-65436-raw-ptr-not-send.rs:14:9
|
||||
--> $DIR/issue-65436-raw-ptr-not-send.rs:14:35
|
||||
|
|
||||
LL | bar(Foo(std::ptr::null())).await;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ first, await occurs here, with `std::ptr::null()` maybe used later...
|
||||
| ---------------- ^^^^^^ await occurs here, with `std::ptr::null()` maybe used later
|
||||
| |
|
||||
| has type `*const u8` which is not `Send`
|
||||
note: `std::ptr::null()` is later dropped here
|
||||
--> $DIR/issue-65436-raw-ptr-not-send.rs:14:41
|
||||
|
|
||||
LL | bar(Foo(std::ptr::null())).await;
|
||||
| ---------------- ^
|
||||
| |
|
||||
| has type `*const u8` which is not `Send`
|
||||
| ^
|
||||
help: consider moving this into a `let` binding to create a shorter lived borrow
|
||||
--> $DIR/issue-65436-raw-ptr-not-send.rs:14:13
|
||||
|
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
error[E0728]: `await` is only allowed inside `async` functions and blocks
|
||||
--> $DIR/non-async-enclosing-span.rs:9:13
|
||||
--> $DIR/non-async-enclosing-span.rs:9:27
|
||||
|
|
||||
LL | fn main() {
|
||||
| ---- this is not `async`
|
||||
LL | let x = move || {};
|
||||
LL | let y = do_the_thing().await;
|
||||
| ^^^^^^^^^^^^^^^^^^^^ only allowed inside `async` functions and blocks
|
||||
| ^^^^^^ only allowed inside `async` functions and blocks
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
14
src/test/ui/async-await/unnecessary-await.rs
Normal file
14
src/test/ui/async-await/unnecessary-await.rs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
// edition:2018
|
||||
|
||||
async fn foo () { }
|
||||
fn bar() -> impl std::future::Future { async {} }
|
||||
fn boo() {}
|
||||
|
||||
async fn baz() -> std::io::Result<()> {
|
||||
foo().await;
|
||||
boo().await; //~ ERROR `()` is not a future
|
||||
bar().await;
|
||||
std::io::Result::Ok(())
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
24
src/test/ui/async-await/unnecessary-await.stderr
Normal file
24
src/test/ui/async-await/unnecessary-await.stderr
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
error[E0277]: `()` is not a future
|
||||
--> $DIR/unnecessary-await.rs:9:10
|
||||
|
|
||||
LL | boo().await;
|
||||
| -----^^^^^^ `()` is not a future
|
||||
| |
|
||||
| this call returns `()`
|
||||
|
|
||||
= help: the trait `Future` is not implemented for `()`
|
||||
= note: () must be a future or must implement `IntoFuture` to be awaited
|
||||
= note: required because of the requirements on the impl of `IntoFuture` for `()`
|
||||
help: remove the `.await`
|
||||
|
|
||||
LL - boo().await;
|
||||
LL + boo();
|
||||
|
|
||||
help: alternatively, consider making `fn boo` asynchronous
|
||||
|
|
||||
LL | async fn boo() {}
|
||||
| +++++
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
|
|
@ -5,10 +5,10 @@ LL | bar().await;
|
|||
| ^^^ cannot infer type for type parameter `T` declared on the function `bar`
|
||||
|
|
||||
note: the type is part of the `async fn` body because of this `await`
|
||||
--> $DIR/unresolved_type_param.rs:9:5
|
||||
--> $DIR/unresolved_type_param.rs:9:10
|
||||
|
|
||||
LL | bar().await;
|
||||
| ^^^^^^^^^^^
|
||||
| ^^^^^^
|
||||
|
||||
error[E0698]: type inside `async fn` body must be known in this context
|
||||
--> $DIR/unresolved_type_param.rs:9:5
|
||||
|
|
@ -17,10 +17,10 @@ LL | bar().await;
|
|||
| ^^^ cannot infer type for type parameter `T` declared on the function `bar`
|
||||
|
|
||||
note: the type is part of the `async fn` body because of this `await`
|
||||
--> $DIR/unresolved_type_param.rs:9:5
|
||||
--> $DIR/unresolved_type_param.rs:9:10
|
||||
|
|
||||
LL | bar().await;
|
||||
| ^^^^^^^^^^^
|
||||
| ^^^^^^
|
||||
|
||||
error[E0698]: type inside `async fn` body must be known in this context
|
||||
--> $DIR/unresolved_type_param.rs:9:5
|
||||
|
|
@ -29,10 +29,10 @@ LL | bar().await;
|
|||
| ^^^ cannot infer type for type parameter `T` declared on the function `bar`
|
||||
|
|
||||
note: the type is part of the `async fn` body because of this `await`
|
||||
--> $DIR/unresolved_type_param.rs:9:5
|
||||
--> $DIR/unresolved_type_param.rs:9:10
|
||||
|
|
||||
LL | bar().await;
|
||||
| ^^^^^^^^^^^
|
||||
| ^^^^^^
|
||||
|
||||
error[E0698]: type inside `async fn` body must be known in this context
|
||||
--> $DIR/unresolved_type_param.rs:9:5
|
||||
|
|
@ -41,10 +41,10 @@ LL | bar().await;
|
|||
| ^^^ cannot infer type for type parameter `T` declared on the function `bar`
|
||||
|
|
||||
note: the type is part of the `async fn` body because of this `await`
|
||||
--> $DIR/unresolved_type_param.rs:9:5
|
||||
--> $DIR/unresolved_type_param.rs:9:10
|
||||
|
|
||||
LL | bar().await;
|
||||
| ^^^^^^^^^^^
|
||||
| ^^^^^^
|
||||
|
||||
error[E0698]: type inside `async fn` body must be known in this context
|
||||
--> $DIR/unresolved_type_param.rs:9:5
|
||||
|
|
@ -53,10 +53,10 @@ LL | bar().await;
|
|||
| ^^^ cannot infer type for type parameter `T` declared on the function `bar`
|
||||
|
|
||||
note: the type is part of the `async fn` body because of this `await`
|
||||
--> $DIR/unresolved_type_param.rs:9:5
|
||||
--> $DIR/unresolved_type_param.rs:9:10
|
||||
|
|
||||
LL | bar().await;
|
||||
| ^^^^^^^^^^^
|
||||
| ^^^^^^
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@ error[E0271]: type mismatch resolving `<std::collections::hash_map::Iter<'_, _,
|
|||
--> $DIR/issue-33941.rs:4:14
|
||||
|
|
||||
LL | for _ in HashMap::new().iter().cloned() {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected reference, found tuple
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected tuple, found reference
|
||||
|
|
||||
= note: expected reference `&_`
|
||||
found tuple `(&_, &_)`
|
||||
= note: expected tuple `(&_, &_)`
|
||||
found reference `&_`
|
||||
= note: required because of the requirements on the impl of `Iterator` for `Cloned<std::collections::hash_map::Iter<'_, _, _>>`
|
||||
= note: required because of the requirements on the impl of `IntoIterator` for `Cloned<std::collections::hash_map::Iter<'_, _, _>>`
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ error: boxed `Umm` held across a suspend point, but should not be
|
|||
LL | let _guard = bar();
|
||||
| ^^^^^^
|
||||
LL | other().await;
|
||||
| ------------- the value is held across this suspend point
|
||||
| ------ the value is held across this suspend point
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/boxed.rs:3:9
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ error: `No` held across a suspend point, but should not be
|
|||
--> $DIR/dedup.rs:16:12
|
||||
|
|
||||
LL | wheeee(No {}).await;
|
||||
| -------^^^^^------- the value is held across this suspend point
|
||||
| ^^^^^ ------ the value is held across this suspend point
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/dedup.rs:3:9
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ error: `MutexGuard` held across a suspend point, but should not be
|
|||
LL | let _guard = m.lock().unwrap();
|
||||
| ^^^^^^
|
||||
LL | other().await;
|
||||
| ------------- the value is held across this suspend point
|
||||
| ------ the value is held across this suspend point
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/gated.rs:2:9
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ error: `MutexGuard` held across a suspend point, but should not be
|
|||
LL | let _guard = m.lock().unwrap();
|
||||
| ^^^^^^
|
||||
LL | other().await;
|
||||
| ------------- the value is held across this suspend point
|
||||
| ------ the value is held across this suspend point
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/mutex.rs:3:9
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ LL | let guard = &mut self.u;
|
|||
| ^^^^^^
|
||||
LL |
|
||||
LL | other().await;
|
||||
| ------------- the value is held across this suspend point
|
||||
| ------ the value is held across this suspend point
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/ref.rs:3:9
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ LL | let _guard1 = r#impl();
|
|||
| ^^^^^^^
|
||||
...
|
||||
LL | other().await;
|
||||
| ------------- the value is held across this suspend point
|
||||
| ------ the value is held across this suspend point
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/trait.rs:3:9
|
||||
|
|
@ -25,7 +25,7 @@ LL | let _guard2 = r#dyn();
|
|||
| ^^^^^^^
|
||||
LL |
|
||||
LL | other().await;
|
||||
| ------------- the value is held across this suspend point
|
||||
| ------ the value is held across this suspend point
|
||||
|
|
||||
help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
|
||||
--> $DIR/trait.rs:22:9
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ error: `Umm` held across a suspend point, but should not be
|
|||
LL | let _guard = bar();
|
||||
| ^^^^^^
|
||||
LL | other().await;
|
||||
| ------------- the value is held across this suspend point
|
||||
| ------ the value is held across this suspend point
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/unit.rs:3:9
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ warning: `Umm` held across a suspend point, but should not be
|
|||
LL | let _guard = bar();
|
||||
| ^^^^^^
|
||||
LL | other().await;
|
||||
| ------------- the value is held across this suspend point
|
||||
| ------ the value is held across this suspend point
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/warn.rs:4:9
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue