Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

const generics: cycle error due to a lack of lazy normalization #68249

Closed
JohnTitor opened this issue Jan 15, 2020 · 1 comment
Closed

const generics: cycle error due to a lack of lazy normalization #68249

JohnTitor opened this issue Jan 15, 2020 · 1 comment
Labels
A-const-generics Area: const generics (parameters and arguments) A-lazy-normalization Area: Lazy normalization (tracking issue: #60471) C-bug Category: This is a bug. F-const_generics `#![feature(const_generics)]` T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@JohnTitor
Copy link
Member

JohnTitor commented Jan 15, 2020

Consider this example:

#![feature(const_generics)]

fn foo<const N: usize, const A: [u8; N]>() {}

fn bar() {
    foo::<1, {[1]}>();
}

It causes a cycle error:

error[E0391]: cycle detected when processing `foo::A`
  --> $DIR/issue-62879.rs:4:30
   |
LL | fn foo<const N: usize, const A: [u8; N]>() {}
   |                              ^
   |
   = note: ...which again requires processing `foo::A`, completing the cycle
note: cycle used when processing `foo`
  --> $DIR/issue-62879.rs:4:1
   |
LL | fn foo<const N: usize, const A: [u8; N]>() {}
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

It should be compiled, but cycle error occurs due to a lack of lazy normalization.
It's added to ui test as a regression test of #62879 (src/test/ui/const-generics/issue-62879.rs) in #68236, but we should still improve current behavior.

@JohnTitor JohnTitor added A-const-generics Area: const generics (parameters and arguments) A-lazy-normalization Area: Lazy normalization (tracking issue: #60471) C-bug Category: This is a bug. F-const_generics `#![feature(const_generics)]` T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 15, 2020
@JohnTitor
Copy link
Member Author

It causes the ICE again in latest rustc, closing in favor of #62879

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-const-generics Area: const generics (parameters and arguments) A-lazy-normalization Area: Lazy normalization (tracking issue: #60471) C-bug Category: This is a bug. F-const_generics `#![feature(const_generics)]` T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

1 participant