diff options
| author | bors <bors@rust-lang.org> | 2021-05-17 04:53:30 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-05-17 04:53:30 +0000 |
| commit | 44ec846f4ea68ffa6d06e7d68f078bd3cc59d4ec (patch) | |
| tree | 43a9fcb66e4f865b1cb5358868b43867f27f7832 /src | |
| parent | 3396a383bb1d1fdad8ceeb74f16cf08e0bd62a1b (diff) | |
| parent | 014e8d46f87e746bf9cb9b78c0bcf7e57c2cbc8c (diff) | |
| download | rust-44ec846f4ea68ffa6d06e7d68f078bd3cc59d4ec.tar.gz rust-44ec846f4ea68ffa6d06e7d68f078bd3cc59d4ec.zip | |
Auto merge of #85353 - jonas-schievink:async-blocks-in-ctfe, r=oli-obk
Allow `async {}` expressions in const contexts
Gated behind a new `const_async_blocks` feature.
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/consts/async-block.rs | 17 | ||||
| -rw-r--r-- | src/test/ui/consts/async-block.stderr | 8 | ||||
| -rw-r--r-- | src/test/ui/consts/async-block.with_feature.stderr | 8 | ||||
| -rw-r--r-- | src/test/ui/consts/async-block.without_feature.stderr | 21 | ||||
| -rw-r--r-- | src/test/ui/impl-trait/issues/issue-78721.stderr | 8 | ||||
| -rw-r--r-- | src/test/ui/impl-trait/issues/issue-78722.full_tait.stderr | 8 | ||||
| -rw-r--r-- | src/test/ui/impl-trait/issues/issue-78722.min_tait.stderr | 8 |
7 files changed, 61 insertions, 17 deletions
diff --git a/src/test/ui/consts/async-block.rs b/src/test/ui/consts/async-block.rs index 1fa2a616091..78ec8aea724 100644 --- a/src/test/ui/consts/async-block.rs +++ b/src/test/ui/consts/async-block.rs @@ -1,8 +1,19 @@ -// From <https://github.com/rust-lang/rust/issues/77361> +// gate-test-const_async_blocks // edition:2018 +// revisions: with_feature without_feature + +#![feature(rustc_attrs)] +#![cfg_attr(with_feature, feature(const_async_blocks))] + +use std::future::Future; +// From <https://github.com/rust-lang/rust/issues/77361> const _: i32 = { core::mem::ManuallyDrop::new(async { 0 }); 4 }; -//~^ `async` block +//[without_feature]~^ `async` block + +static _FUT: &(dyn Future<Output = ()> + Sync) = &async {}; +//[without_feature]~^ `async` block -fn main() {} +#[rustc_error] +fn main() {} //[with_feature]~ fatal error triggered by #[rustc_error] diff --git a/src/test/ui/consts/async-block.stderr b/src/test/ui/consts/async-block.stderr deleted file mode 100644 index 99f470623ac..00000000000 --- a/src/test/ui/consts/async-block.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: `async` blocks are not allowed in constants - --> $DIR/async-block.rs:5:47 - | -LL | const _: i32 = { core::mem::ManuallyDrop::new(async { 0 }); 4 }; - | ^^^^^^^^^^^ - -error: aborting due to previous error - diff --git a/src/test/ui/consts/async-block.with_feature.stderr b/src/test/ui/consts/async-block.with_feature.stderr new file mode 100644 index 00000000000..8c6364aeca6 --- /dev/null +++ b/src/test/ui/consts/async-block.with_feature.stderr @@ -0,0 +1,8 @@ +error: fatal error triggered by #[rustc_error] + --> $DIR/async-block.rs:19:1 + | +LL | fn main() {} + | ^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/consts/async-block.without_feature.stderr b/src/test/ui/consts/async-block.without_feature.stderr new file mode 100644 index 00000000000..751627c5226 --- /dev/null +++ b/src/test/ui/consts/async-block.without_feature.stderr @@ -0,0 +1,21 @@ +error[E0658]: `async` blocks are not allowed in constants + --> $DIR/async-block.rs:12:47 + | +LL | const _: i32 = { core::mem::ManuallyDrop::new(async { 0 }); 4 }; + | ^^^^^^^^^^^ + | + = note: see issue #85368 <https://github.com/rust-lang/rust/issues/85368> for more information + = help: add `#![feature(const_async_blocks)]` to the crate attributes to enable + +error[E0658]: `async` blocks are not allowed in statics + --> $DIR/async-block.rs:15:51 + | +LL | static _FUT: &(dyn Future<Output = ()> + Sync) = &async {}; + | ^^^^^^^^ + | + = note: see issue #85368 <https://github.com/rust-lang/rust/issues/85368> for more information + = help: add `#![feature(const_async_blocks)]` to the crate attributes to enable + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/impl-trait/issues/issue-78721.stderr b/src/test/ui/impl-trait/issues/issue-78721.stderr index 353e882b1af..d5712dd9200 100644 --- a/src/test/ui/impl-trait/issues/issue-78721.stderr +++ b/src/test/ui/impl-trait/issues/issue-78721.stderr @@ -7,11 +7,14 @@ LL | #![feature(impl_trait_in_bindings)] = note: `#[warn(incomplete_features)]` on by default = note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information -error: `async` blocks are not allowed in constants +error[E0658]: `async` blocks are not allowed in constants --> $DIR/issue-78721.rs:8:57 | LL | let f: impl core::future::Future<Output = u8> = async { 1 }; | ^^^^^^^^^^^ + | + = note: see issue #85368 <https://github.com/rust-lang/rust/issues/85368> for more information + = help: add `#![feature(const_async_blocks)]` to the crate attributes to enable error[E0493]: destructors cannot be evaluated at compile-time --> $DIR/issue-78721.rs:8:13 @@ -24,4 +27,5 @@ LL | }], error: aborting due to 2 previous errors; 1 warning emitted -For more information about this error, try `rustc --explain E0493`. +Some errors have detailed explanations: E0493, E0658. +For more information about an error, try `rustc --explain E0493`. diff --git a/src/test/ui/impl-trait/issues/issue-78722.full_tait.stderr b/src/test/ui/impl-trait/issues/issue-78722.full_tait.stderr index d7327aa46bc..7a4be1d5f6d 100644 --- a/src/test/ui/impl-trait/issues/issue-78722.full_tait.stderr +++ b/src/test/ui/impl-trait/issues/issue-78722.full_tait.stderr @@ -15,11 +15,14 @@ LL | #![feature(impl_trait_in_bindings)] | = note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information -error: `async` blocks are not allowed in constants +error[E0658]: `async` blocks are not allowed in constants --> $DIR/issue-78722.rs:17:20 | LL | let f: F = async { 1 }; | ^^^^^^^^^^^ + | + = note: see issue #85368 <https://github.com/rust-lang/rust/issues/85368> for more information + = help: add `#![feature(const_async_blocks)]` to the crate attributes to enable error[E0493]: destructors cannot be evaluated at compile-time --> $DIR/issue-78722.rs:17:13 @@ -32,4 +35,5 @@ LL | }], error: aborting due to 2 previous errors; 2 warnings emitted -For more information about this error, try `rustc --explain E0493`. +Some errors have detailed explanations: E0493, E0658. +For more information about an error, try `rustc --explain E0493`. diff --git a/src/test/ui/impl-trait/issues/issue-78722.min_tait.stderr b/src/test/ui/impl-trait/issues/issue-78722.min_tait.stderr index 01ec71e7a50..131033063d2 100644 --- a/src/test/ui/impl-trait/issues/issue-78722.min_tait.stderr +++ b/src/test/ui/impl-trait/issues/issue-78722.min_tait.stderr @@ -7,11 +7,14 @@ LL | #![feature(impl_trait_in_bindings)] = note: `#[warn(incomplete_features)]` on by default = note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information -error: `async` blocks are not allowed in constants +error[E0658]: `async` blocks are not allowed in constants --> $DIR/issue-78722.rs:17:20 | LL | let f: F = async { 1 }; | ^^^^^^^^^^^ + | + = note: see issue #85368 <https://github.com/rust-lang/rust/issues/85368> for more information + = help: add `#![feature(const_async_blocks)]` to the crate attributes to enable error[E0493]: destructors cannot be evaluated at compile-time --> $DIR/issue-78722.rs:17:13 @@ -24,4 +27,5 @@ LL | }], error: aborting due to 2 previous errors; 1 warning emitted -For more information about this error, try `rustc --explain E0493`. +Some errors have detailed explanations: E0493, E0658. +For more information about an error, try `rustc --explain E0493`. |
