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

cargo build needed for panics in constant expressions #230

Closed
Jarcho opened this issue Apr 4, 2023 · 1 comment
Closed

cargo build needed for panics in constant expressions #230

Jarcho opened this issue Apr 4, 2023 · 1 comment

Comments

@Jarcho
Copy link

Jarcho commented Apr 4, 2023

Currently cargo check will not evaluate associated constants or const blocks. This results in cargo check succeeding while cargo build fails to compile when it evaluates the constant.

Example

trait A { const A: (); }
impl A for () { const A: () = panic!(); }

fn main() {
    <() as A>::A;
}

This s probably best done with a force_eval_constants flag which would switch to using cargo build for any rust version (currently all of them) for which cargo check will miss constant panics.

@dtolnay
Copy link
Owner

dtolnay commented Apr 4, 2023

This is a duplicate of #225.

@dtolnay dtolnay closed this as completed Apr 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants