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

Constexpr evaluation in impl methods doesn't always work #1771

Open
grebe opened this issue Dec 5, 2024 · 0 comments
Open

Constexpr evaluation in impl methods doesn't always work #1771

grebe opened this issue Dec 5, 2024 · 0 comments
Labels
dslx DSLX (domain specific language) implementation / front-end

Comments

@grebe
Copy link
Collaborator

grebe commented Dec 5, 2024

Describe the bug
const_assert!() doesn't seem to be able to constexpr-evaluate function parametrics.

To Reproduce

pub struct A {}
impl A {
  fn B<C:u32>() -> bool {
      const_assert!(C >= u32:4);
      true
  }
}

Expected behavior
It should typecheck and the assertion should pass or fail base on invocation.

Instead, I get TypeInferenceError: const_assert! expression is not constexpr regardless of the invocations of A::B<...>().

@grebe grebe added the dslx DSLX (domain specific language) implementation / front-end label Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dslx DSLX (domain specific language) implementation / front-end
Projects
Status: No status
Development

No branches or pull requests

1 participant