Skip to content
This repository was archived by the owner on May 23, 2024. It is now read-only.

ices/113326.rs: fixed with errors #1624

Merged
merged 1 commit into from
Oct 10, 2023
Merged

ices/113326.rs: fixed with errors #1624

merged 1 commit into from
Oct 10, 2023

Conversation

github-actions[bot]
Copy link
Contributor

Issue: rust-lang/rust#113326

#![allow(incomplete_features)]
#![feature(const_trait_impl)]
#![feature(const_closures)]
#![feature(const_refs_to_cell)]
#![feature(type_alias_impl_trait)]

pub type Diff = impl ~const std::marker::Destruct + ~const Fn(usize) -> usize;

pub const fn lift(n: usize) -> Diff {
    const move |m: usize| m + n
}

pub const fn reify(n: Diff) -> usize {
    n(0)
}

pub const fn add(n: Diff, m: Diff) -> Diff {
    const move |x: usize| m(n(x))
}

fn main() {}
=== stdout ===
=== stderr ===
error[E0391]: cycle detected when computing type of `Diff::{opaque#0}`
  --> /home/runner/work/glacier/glacier/ices/113326.rs:7:17
   |
7  | pub type Diff = impl ~const std::marker::Destruct + ~const Fn(usize) -> usize;
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
note: ...which requires borrow-checking `add`...
  --> /home/runner/work/glacier/glacier/ices/113326.rs:17:1
   |
17 | pub const fn add(n: Diff, m: Diff) -> Diff {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires promoting constants in MIR for `add`...
  --> /home/runner/work/glacier/glacier/ices/113326.rs:17:1
   |
17 | pub const fn add(n: Diff, m: Diff) -> Diff {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires const checking `add`...
  --> /home/runner/work/glacier/glacier/ices/113326.rs:17:1
   |
17 | pub const fn add(n: Diff, m: Diff) -> Diff {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   = note: ...which requires computing whether `Diff` is freeze...
   = note: ...which requires evaluating trait selection obligation `Diff: core::marker::Freeze`...
   = note: ...which again requires computing type of `Diff::{opaque#0}`, completing the cycle
note: cycle used when checking item types in top-level module
  --> /home/runner/work/glacier/glacier/ices/113326.rs:1:1
   |
1  | / #![allow(incomplete_features)]
2  | | #![feature(const_trait_impl)]
3  | | #![feature(const_closures)]
4  | | #![feature(const_refs_to_cell)]
...  |
20 | |
21 | | fn main() {}
   | |____________^

error: concrete type differs from previous defining opaque type use
  --> /home/runner/work/glacier/glacier/ices/113326.rs:18:5
   |
18 |     const move |x: usize| m(n(x))
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `[closure@/home/runner/work/glacier/glacier/ices/113326.rs:10:5: 10:26]`, got `[closure@/home/runner/work/glacier/glacier/ices/113326.rs:18:5: 18:26]`
   |
note: previous use here
  --> /home/runner/work/glacier/glacier/ices/113326.rs:10:5
   |
10 |     const move |m: usize| m + n
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0391`.
==============

=== stdout ===
=== stderr ===
error[E0391]: cycle detected when computing type of `Diff::{opaque#0}`
  --> /home/runner/work/glacier/glacier/ices/113326.rs:7:17
   |
7  | pub type Diff = impl ~const std::marker::Destruct + ~const Fn(usize) -> usize;
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
note: ...which requires borrow-checking `add`...
  --> /home/runner/work/glacier/glacier/ices/113326.rs:17:1
   |
17 | pub const fn add(n: Diff, m: Diff) -> Diff {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires promoting constants in MIR for `add`...
  --> /home/runner/work/glacier/glacier/ices/113326.rs:17:1
   |
17 | pub const fn add(n: Diff, m: Diff) -> Diff {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires const checking `add`...
  --> /home/runner/work/glacier/glacier/ices/113326.rs:17:1
   |
17 | pub const fn add(n: Diff, m: Diff) -> Diff {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   = note: ...which requires computing whether `Diff` is freeze...
   = note: ...which requires evaluating trait selection obligation `Diff: core::marker::Freeze`...
   = note: ...which again requires computing type of `Diff::{opaque#0}`, completing the cycle
note: cycle used when checking item types in top-level module
  --> /home/runner/work/glacier/glacier/ices/113326.rs:1:1
   |
1  | / #![allow(incomplete_features)]
2  | | #![feature(const_trait_impl)]
3  | | #![feature(const_closures)]
4  | | #![feature(const_refs_to_cell)]
...  |
20 | |
21 | | fn main() {}
   | |____________^

error: concrete type differs from previous defining opaque type use
  --> /home/runner/work/glacier/glacier/ices/113326.rs:18:5
   |
18 |     const move |x: usize| m(n(x))
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `[closure@/home/runner/work/glacier/glacier/ices/113326.rs:10:5: 10:26]`, got `[closure@/home/runner/work/glacier/glacier/ices/113326.rs:18:5: 18:26]`
   |
note: previous use here
  --> /home/runner/work/glacier/glacier/ices/113326.rs:10:5
   |
10 |     const move |m: usize| m + n
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0391`.
==============
@JohnTitor JohnTitor merged commit 99cd9ac into master Oct 10, 2023
@JohnTitor JohnTitor deleted the autofix/ices/113326.rs branch October 10, 2023 14:52
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants