|
| 1 | +error[E0391]: cycle detected when computing type of `<impl at $DIR/const-fn-cycle.rs:12:1: 12:21>::many::{opaque#0}` |
| 2 | + --> $DIR/const-fn-cycle.rs:20:47 |
| 3 | + | |
| 4 | +LL | pub const fn many<'s>(&'s self) -> Parser<impl for<'a> Fn(&'a str) -> Vec<T> + 's> { |
| 5 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 6 | + | |
| 7 | +note: ...which requires borrow-checking `<impl at $DIR/const-fn-cycle.rs:12:1: 12:21>::many`... |
| 8 | + --> $DIR/const-fn-cycle.rs:20:5 |
| 9 | + | |
| 10 | +LL | pub const fn many<'s>(&'s self) -> Parser<impl for<'a> Fn(&'a str) -> Vec<T> + 's> { |
| 11 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 12 | +note: ...which requires promoting constants in MIR for `<impl at $DIR/const-fn-cycle.rs:12:1: 12:21>::many`... |
| 13 | + --> $DIR/const-fn-cycle.rs:20:5 |
| 14 | + | |
| 15 | +LL | pub const fn many<'s>(&'s self) -> Parser<impl for<'a> Fn(&'a str) -> Vec<T> + 's> { |
| 16 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 17 | +note: ...which requires const checking `<impl at $DIR/const-fn-cycle.rs:12:1: 12:21>::many`... |
| 18 | + --> $DIR/const-fn-cycle.rs:20:5 |
| 19 | + | |
| 20 | +LL | pub const fn many<'s>(&'s self) -> Parser<impl for<'a> Fn(&'a str) -> Vec<T> + 's> { |
| 21 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 22 | + = note: ...which requires computing whether `Parser<<impl at $DIR/const-fn-cycle.rs:12:1: 12:21>::many::{opaque#0}>` is freeze... |
| 23 | + = note: ...which requires evaluating trait selection obligation `Parser<<impl at $DIR/const-fn-cycle.rs:12:1: 12:21>::many::{opaque#0}>: core::marker::Freeze`... |
| 24 | + = note: ...which again requires computing type of `<impl at $DIR/const-fn-cycle.rs:12:1: 12:21>::many::{opaque#0}`, completing the cycle |
| 25 | +note: cycle used when checking item types in top-level module |
| 26 | + --> $DIR/const-fn-cycle.rs:1:1 |
| 27 | + | |
| 28 | +LL | / /// Discovered in https://github.com/rust-lang/rust/issues/112602. |
| 29 | +LL | | /// This caused a cycle error, which made no sense. |
| 30 | +LL | | /// Removing the `const` part of the `many` function would make the |
| 31 | +LL | | /// test pass again. |
| 32 | +... | |
| 33 | +LL | | println!("Hello, world!"); |
| 34 | +LL | | } |
| 35 | + | |_^ |
| 36 | + |
| 37 | +error: aborting due to previous error |
| 38 | + |
| 39 | +For more information about this error, try `rustc --explain E0391`. |
0 commit comments