Closed
Description
fn main() {
const async fn a() {}
}
Seems a bit surprising that we don't bail out immediately when jumping from a function to itself? 🤔
rustc 1.66.0-nightly (0ca356586 2022-10-06)
error: functions cannot be both `const` and `async`
--> src/main.rs:2:3
|
2 | const async fn a() {}
| ^^^^^-^^^^^----------
| | |
| | `async` because of this
| `const` because of this
error[[E0391]](https://doc.rust-lang.org/stable/error-index.html#E0391): cycle detected when computing type of `main::a::{opaque#0}`
--> src/main.rs:2:22
|
2 | const async fn a() {}
| ^
|
note: ...which requires borrow-checking `main::a`...
--> src/main.rs:2:3
|
2 | const async fn a() {}
| ^^^^^^^^^^^^^^^^^^
note: ...which requires processing `main::a`...
--> src/main.rs:2:3
|
2 | const async fn a() {}
| ^^^^^^^^^^^^^^^^^^
note: ...which requires const checking `main::a`...
--> src/main.rs:2:3
|
2 | const async fn a() {}
| ^^^^^^^^^^^^^^^^^^
= note: ...which requires computing whether `impl core::future::future::Future<Output = ()>` is freeze...
= note: ...which requires evaluating trait selection obligation `impl core::future::future::Future<Output = ()>: core::marker::Freeze`...
= note: ...which again requires computing type of `main::a::{opaque#0}`, completing the cycle
note: cycle used when checking item types in top-level module
--> src/main.rs:1:1
|
1 | / fn main() {
2 | | const async fn a() {}
3 | | }
| |_^