diff options
Diffstat (limited to 'src/test')
13 files changed, 80 insertions, 74 deletions
diff --git a/src/test/codegen/async-fn-debug-awaitee-field.rs b/src/test/codegen/async-fn-debug-awaitee-field.rs index 909cd0062a6..bc268615814 100644 --- a/src/test/codegen/async-fn-debug-awaitee-field.rs +++ b/src/test/codegen/async-fn-debug-awaitee-field.rs @@ -11,12 +11,14 @@ async fn async_fn_test() { foo().await; } -// NONMSVC: [[GEN:!.*]] = !DICompositeType(tag: DW_TAG_structure_type, name: "{async_fn_env#0}", +// NONMSVC: [[GEN:!.*]] = !DICompositeType(tag: DW_TAG_structure_type, name: "{async_fn_env#0}", scope: [[GEN_SCOPE:![0-9]*]], // MSVC: [[GEN:!.*]] = !DICompositeType(tag: DW_TAG_union_type, name: "enum2$<async_fn_debug_awaitee_field::async_fn_test::async_fn_env$0>", +// NONMSVC: [[GEN_SCOPE:!.*]] = !DINamespace(name: "async_fn_test", // CHECK: [[SUSPEND_STRUCT:!.*]] = !DICompositeType(tag: DW_TAG_structure_type, name: "Suspend0", scope: [[GEN]], // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "__awaitee", scope: [[SUSPEND_STRUCT]], {{.*}}, baseType: [[AWAITEE_TYPE:![0-9]*]], -// NONMSVC: [[AWAITEE_TYPE]] = !DICompositeType(tag: DW_TAG_structure_type, name: "GenFuture<async_fn_debug_awaitee_field::foo::{async_fn_env#0}>", -// MSVC: [[AWAITEE_TYPE]] = !DICompositeType(tag: DW_TAG_structure_type, name: "GenFuture<enum2$<async_fn_debug_awaitee_field::foo::async_fn_env$0> >", +// NONMSVC: [[AWAITEE_TYPE]] = !DICompositeType(tag: DW_TAG_structure_type, name: "{async_fn_env#0}", scope: [[AWAITEE_SCOPE:![0-9]*]], +// MSVC: [[AWAITEE_TYPE]] = !DICompositeType(tag: DW_TAG_union_type, name: "enum2$<async_fn_debug_awaitee_field::foo::async_fn_env$0>", +// NONMSVC: [[AWAITEE_SCOPE]] = !DINamespace(name: "foo", fn main() { let _fn = async_fn_test(); diff --git a/src/test/run-make/coverage-reports/expected_show_coverage.async2.txt b/src/test/run-make/coverage-reports/expected_show_coverage.async2.txt index dc06a485a8f..500dde1f269 100644 --- a/src/test/run-make/coverage-reports/expected_show_coverage.async2.txt +++ b/src/test/run-make/coverage-reports/expected_show_coverage.async2.txt @@ -72,7 +72,7 @@ 67| | } 68| 2| } ------------------ - | async2::executor::block_on::<core::future::from_generator::GenFuture<async2::async_func::{closure#0}>>: + | async2::executor::block_on::<async2::async_func::{closure#0}>: | 51| 1| pub fn block_on<F: Future>(mut future: F) -> F::Output { | 52| 1| let mut future = unsafe { Pin::new_unchecked(&mut future) }; | 53| 1| use std::hint::unreachable_unchecked; @@ -92,7 +92,7 @@ | 67| | } | 68| 1| } ------------------ - | async2::executor::block_on::<core::future::from_generator::GenFuture<async2::async_func_just_println::{closure#0}>>: + | async2::executor::block_on::<async2::async_func_just_println::{closure#0}>: | 51| 1| pub fn block_on<F: Future>(mut future: F) -> F::Output { | 52| 1| let mut future = unsafe { Pin::new_unchecked(&mut future) }; | 53| 1| use std::hint::unreachable_unchecked; diff --git a/src/test/ui/async-await/async-block-control-flow-static-semantics.stderr b/src/test/ui/async-await/async-block-control-flow-static-semantics.stderr index 2a08d5d6ce5..b8ca64fae83 100644 --- a/src/test/ui/async-await/async-block-control-flow-static-semantics.stderr +++ b/src/test/ui/async-await/async-block-control-flow-static-semantics.stderr @@ -1,8 +1,7 @@ error[E0267]: `break` inside of an `async` block --> $DIR/async-block-control-flow-static-semantics.rs:32:9 | -LL | async { - | ___________- +LL | / async { LL | | break 0u8; | | ^^^^^^^^^ cannot `break` inside of an `async` block LL | | }; @@ -11,8 +10,7 @@ LL | | }; error[E0267]: `break` inside of an `async` block --> $DIR/async-block-control-flow-static-semantics.rs:39:13 | -LL | async { - | _______________- +LL | / async { LL | | break 0u8; | | ^^^^^^^^^ cannot `break` inside of an `async` block LL | | }; diff --git a/src/test/ui/async-await/async-borrowck-escaping-block-error.stderr b/src/test/ui/async-await/async-borrowck-escaping-block-error.stderr index f21c8115124..190c59e32eb 100644 --- a/src/test/ui/async-await/async-borrowck-escaping-block-error.stderr +++ b/src/test/ui/async-await/async-borrowck-escaping-block-error.stderr @@ -1,11 +1,11 @@ error[E0373]: async block may outlive the current function, but it borrows `x`, which is owned by the current function - --> $DIR/async-borrowck-escaping-block-error.rs:6:20 + --> $DIR/async-borrowck-escaping-block-error.rs:6:14 | LL | Box::new(async { x } ) - | ^^-^^ - | | | - | | `x` is borrowed here - | may outlive borrowed value `x` + | ^^^^^^^^-^^ + | | | + | | `x` is borrowed here + | may outlive borrowed value `x` | note: async block is returned here --> $DIR/async-borrowck-escaping-block-error.rs:6:5 @@ -18,13 +18,13 @@ LL | Box::new(async move { x } ) | ++++ error[E0373]: async block may outlive the current function, but it borrows `x`, which is owned by the current function - --> $DIR/async-borrowck-escaping-block-error.rs:11:11 + --> $DIR/async-borrowck-escaping-block-error.rs:11:5 | LL | async { *x } - | ^^--^^ - | | | - | | `x` is borrowed here - | may outlive borrowed value `x` + | ^^^^^^^^--^^ + | | | + | | `x` is borrowed here + | may outlive borrowed value `x` | note: async block is returned here --> $DIR/async-borrowck-escaping-block-error.rs:11:5 diff --git a/src/test/ui/async-await/generator-desc.stderr b/src/test/ui/async-await/generator-desc.stderr index 2494c3feb2a..774c97966b1 100644 --- a/src/test/ui/async-await/generator-desc.stderr +++ b/src/test/ui/async-await/generator-desc.stderr @@ -1,20 +1,20 @@ error[E0308]: mismatched types - --> $DIR/generator-desc.rs:10:25 + --> $DIR/generator-desc.rs:10:19 | LL | fun(async {}, async {}); - | -- ^^ - | | | - | | expected `async` block, found a different `async` block - | | arguments to this function are incorrect - | the expected `async` block + | -------- ^^^^^^^^ + | | | + | | expected `async` block, found a different `async` block + | | arguments to this function are incorrect + | the expected `async` block | - = note: expected `async` block `[static generator@$DIR/generator-desc.rs:10:15: 10:17]` - found `async` block `[static generator@$DIR/generator-desc.rs:10:25: 10:27]` + = note: expected `async` block `impl Future<Output = ()>` (`async` block) + found `async` block `impl Future<Output = ()>` (`async` block) note: function defined here --> $SRC_DIR/core/src/future/mod.rs:LL:COL | -LL | pub const fn from_generator<T>(gen: T) -> impl Future<Output = T::Return> - | ^^^^^^^^^^^^^^ +LL | pub const fn identity_future<O, Fut: Future<Output = O>>(f: Fut) -> Fut { + | ^^^^^^^^^^^^^^^ error[E0308]: mismatched types --> $DIR/generator-desc.rs:12:16 @@ -53,16 +53,8 @@ LL | fun((async || {})(), (async || {})()); | | the expected `async` closure body | arguments to this function are incorrect | - ::: $SRC_DIR/core/src/future/mod.rs:LL:COL - | -LL | pub const fn from_generator<T>(gen: T) -> impl Future<Output = T::Return> - | ------------------------------- - | | - | the expected opaque type - | the found opaque type - | - = note: expected opaque type `impl Future<Output = ()>` (`async` closure body) - found opaque type `impl Future<Output = ()>` (`async` closure body) + = note: expected `async` closure body `impl Future<Output = ()>` (`async` closure body) + found `async` closure body `impl Future<Output = ()>` (`async` closure body) note: function defined here --> $DIR/generator-desc.rs:8:4 | diff --git a/src/test/ui/async-await/issue-68112.drop_tracking.stderr b/src/test/ui/async-await/issue-68112.drop_tracking.stderr index c915164cfce..f2802698fd5 100644 --- a/src/test/ui/async-await/issue-68112.drop_tracking.stderr +++ b/src/test/ui/async-await/issue-68112.drop_tracking.stderr @@ -59,10 +59,10 @@ LL | fn make_non_send_future2() -> impl Future<Output = Arc<RefCell<i32>>> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: required because it captures the following types: `ResumeTy`, `impl Future<Output = Arc<RefCell<i32>>>`, `()`, `Ready<i32>` note: required because it's used within this `async` block - --> $DIR/issue-68112.rs:60:26 + --> $DIR/issue-68112.rs:60:20 | LL | let send_fut = async { - | __________________________^ + | ____________________^ LL | | let non_send_fut = make_non_send_future2(); LL | | let _ = non_send_fut.await; LL | | ready(0).await; diff --git a/src/test/ui/async-await/issue-68112.no_drop_tracking.stderr b/src/test/ui/async-await/issue-68112.no_drop_tracking.stderr index 11b7d1aaaa6..38eb85b302f 100644 --- a/src/test/ui/async-await/issue-68112.no_drop_tracking.stderr +++ b/src/test/ui/async-await/issue-68112.no_drop_tracking.stderr @@ -59,10 +59,10 @@ LL | fn make_non_send_future2() -> impl Future<Output = Arc<RefCell<i32>>> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: required because it captures the following types: `ResumeTy`, `impl Future<Output = Arc<RefCell<i32>>>`, `()`, `i32`, `Ready<i32>` note: required because it's used within this `async` block - --> $DIR/issue-68112.rs:60:26 + --> $DIR/issue-68112.rs:60:20 | LL | let send_fut = async { - | __________________________^ + | ____________________^ LL | | let non_send_fut = make_non_send_future2(); LL | | let _ = non_send_fut.await; LL | | ready(0).await; diff --git a/src/test/ui/async-await/issue-70935-complex-spans.drop_tracking.stderr b/src/test/ui/async-await/issue-70935-complex-spans.drop_tracking.stderr index 7fb88116665..721234aa4a7 100644 --- a/src/test/ui/async-await/issue-70935-complex-spans.drop_tracking.stderr +++ b/src/test/ui/async-await/issue-70935-complex-spans.drop_tracking.stderr @@ -20,10 +20,9 @@ LL | | } | |_^ = note: required because it captures the following types: `ResumeTy`, `impl Future<Output = ()>`, `()` note: required because it's used within this `async` block - --> $DIR/issue-70935-complex-spans.rs:16:16 + --> $DIR/issue-70935-complex-spans.rs:16:5 | -LL | async move { - | ________________^ +LL | / async move { LL | | baz(|| async{ LL | | foo(tx.clone()); LL | | }).await; diff --git a/src/test/ui/async-await/issues/issue-78938-async-block.stderr b/src/test/ui/async-await/issues/issue-78938-async-block.stderr index 29aa8372f87..c1a4b467f10 100644 --- a/src/test/ui/async-await/issues/issue-78938-async-block.stderr +++ b/src/test/ui/async-await/issues/issue-78938-async-block.stderr @@ -1,8 +1,8 @@ error[E0373]: async block may outlive the current function, but it borrows `room_ref`, which is owned by the current function - --> $DIR/issue-78938-async-block.rs:8:39 + --> $DIR/issue-78938-async-block.rs:8:33 | LL | let gameloop_handle = spawn(async { - | _______________________________________^ + | _________________________________^ LL | | game_loop(Arc::clone(&room_ref)) | | -------- `room_ref` is borrowed here LL | | }); diff --git a/src/test/ui/async-await/try-on-option-in-async.stderr b/src/test/ui/async-await/try-on-option-in-async.stderr index a55850d76c3..4c7b4fa41fa 100644 --- a/src/test/ui/async-await/try-on-option-in-async.stderr +++ b/src/test/ui/async-await/try-on-option-in-async.stderr @@ -1,8 +1,7 @@ error[E0277]: the `?` operator can only be used in an async block that returns `Result` or `Option` (or another type that implements `FromResidual`) --> $DIR/try-on-option-in-async.rs:8:10 | -LL | async { - | ___________- +LL | / async { LL | | let x: Option<u32> = None; LL | | x?; | | ^ cannot use the `?` operator in an async block that returns `{integer}` diff --git a/src/test/ui/chalkify/bugs/async.stderr b/src/test/ui/chalkify/bugs/async.stderr index f53ed53f73c..6f22d2c593a 100644 --- a/src/test/ui/chalkify/bugs/async.stderr +++ b/src/test/ui/chalkify/bugs/async.stderr @@ -1,32 +1,47 @@ -error[E0277]: the trait bound `[static generator@$DIR/async.rs:7:29: 9:2]: Generator<ResumeTy>` is not satisfied +error[E0277]: `impl Future<Output = u32>` is not a future --> $DIR/async.rs:7:29 | LL | async fn foo(x: u32) -> u32 { - | _____________________________^ + | _____________________________- LL | | x LL | | } - | |_^ the trait `Generator<ResumeTy>` is not implemented for `[static generator@$DIR/async.rs:7:29: 9:2]` + | | ^ + | | | + | |_`impl Future<Output = u32>` is not a future + | required by a bound introduced by this call | -note: required by a bound in `std::future::from_generator` + = help: the trait `Future` is not implemented for `impl Future<Output = u32>` + = note: impl Future<Output = u32> must be a future or must implement `IntoFuture` to be awaited +note: required by a bound in `identity_future` --> $SRC_DIR/core/src/future/mod.rs:LL:COL | -LL | T: Generator<ResumeTy, Yield = ()>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `std::future::from_generator` +LL | pub const fn identity_future<O, Fut: Future<Output = O>>(f: Fut) -> Fut { + | ^^^^^^^^^^^^^^^^^^ required by this bound in `identity_future` -error[E0280]: the requirement `<[static generator@$DIR/async.rs:7:29: 9:2] as Generator<ResumeTy>>::Yield == ()` is not satisfied +error[E0277]: the size for values of type `<impl Future<Output = u32> as Future>::Output` cannot be known at compilation time --> $DIR/async.rs:7:29 | LL | async fn foo(x: u32) -> u32 { | _____________________________^ LL | | x LL | | } - | |_^ + | |_^ doesn't have a size known at compile-time | -note: required by a bound in `std::future::from_generator` + = help: the trait `Sized` is not implemented for `<impl Future<Output = u32> as Future>::Output` +note: required by a bound in `identity_future` --> $SRC_DIR/core/src/future/mod.rs:LL:COL | -LL | T: Generator<ResumeTy, Yield = ()>, - | ^^^^^^^^^^ required by this bound in `std::future::from_generator` +LL | pub const fn identity_future<O, Fut: Future<Output = O>>(f: Fut) -> Fut { + | ^ required by this bound in `identity_future` + +error[E0277]: `impl Future<Output = u32>` is not a future + --> $DIR/async.rs:7:25 + | +LL | async fn foo(x: u32) -> u32 { + | ^^^ `impl Future<Output = u32>` is not a future + | + = help: the trait `Future` is not implemented for `impl Future<Output = u32>` + = note: impl Future<Output = u32> must be a future or must implement `IntoFuture` to be awaited error[E0280]: the requirement `<impl Future<Output = u32> as Future>::Output == u32` is not satisfied --> $DIR/async.rs:7:25 @@ -34,6 +49,6 @@ error[E0280]: the requirement `<impl Future<Output = u32> as Future>::Output == LL | async fn foo(x: u32) -> u32 { | ^^^ -error: aborting due to 3 previous errors +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/lazy-type-alias-impl-trait/freeze_cycle.rs b/src/test/ui/lazy-type-alias-impl-trait/freeze_cycle.rs index 10f6bd74031..f02a93ed41b 100644 --- a/src/test/ui/lazy-type-alias-impl-trait/freeze_cycle.rs +++ b/src/test/ui/lazy-type-alias-impl-trait/freeze_cycle.rs @@ -1,6 +1,6 @@ // check-pass -#![feature(gen_future, generator_trait, negative_impls)] +#![feature(generator_trait, negative_impls)] use std::ops::{Generator, GeneratorState}; use std::task::{Poll, Context}; diff --git a/src/test/ui/suggestions/expected-boxed-future-isnt-pinned.stderr b/src/test/ui/suggestions/expected-boxed-future-isnt-pinned.stderr index 77cef485f30..918d37e6559 100644 --- a/src/test/ui/suggestions/expected-boxed-future-isnt-pinned.stderr +++ b/src/test/ui/suggestions/expected-boxed-future-isnt-pinned.stderr @@ -78,20 +78,21 @@ LL | impl<P: Deref<Target: Unpin>> Pin<P> { error[E0308]: mismatched types --> $DIR/expected-boxed-future-isnt-pinned.rs:28:5 | -LL | fn zap() -> BoxFuture<'static, i32> { - | ----------------------- expected `Pin<Box<(dyn Future<Output = i32> + Send + 'static)>>` because of return type LL | / async { LL | | 42 LL | | } - | |_____^ expected struct `Pin`, found opaque type - | - ::: $SRC_DIR/core/src/future/mod.rs:LL:COL - | -LL | pub const fn from_generator<T>(gen: T) -> impl Future<Output = T::Return> - | ------------------------------- the found opaque type - | - = note: expected struct `Pin<Box<(dyn Future<Output = i32> + Send + 'static)>>` - found opaque type `impl Future<Output = {integer}>` + | | ^ + | | | + | |_____expected struct `Pin`, found `async` block + | arguments to this function are incorrect + | + = note: expected struct `Pin<Box<dyn Future<Output = i32> + Send>>` + found `async` block `impl Future<Output = {integer}>` +note: function defined here + --> $SRC_DIR/core/src/future/mod.rs:LL:COL + | +LL | pub const fn identity_future<O, Fut: Future<Output = O>>(f: Fut) -> Fut { + | ^^^^^^^^^^^^^^^ help: you need to pin and box this expression | LL ~ Box::pin(async { |
