-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Recursive fn with varying const generic parameter causes ICE. #64048
Comments
Even smaller example: #![feature(const_generics)]
fn uperms<const DICE_NUM: usize>() -> Vec<[u8; DICE_NUM]> {
if DICE_NUM <= 1 {
panic!();
} else {
let pperms = uperms::<{ DICE_NUM - 1 }>();
panic!();
}
}
fn main() {
let perms1 = uperms::<{ 1 }>();
} And the smallest of course: #![feature(const_generics)]
fn uperms<const DICE_NUM: usize>() -> Vec<[u8; DICE_NUM]> {
let pperms = uperms::<{ DICE_NUM - 1 }>();
}
fn main() {
let perms1 = uperms::<{ 1 }>();
} |
goddessfreya
changed the title
Recursive const generic array of decreasing length causes ICE.
Recursive fn that requires const generic array of decreasing length causes ICE.
Aug 31, 2019
This isn't bound to subtraction or number literals, but to every modification to the generic parameter, e.g. #![feature(const_generics)]
pub fn uperms<const DICE_NUM: usize, const BAR: usize>() {
uperms::<{ DICE_NUM + BAR }, { BAR }>();
}
fn main() {} |
goddessfreya
changed the title
Recursive fn that requires const generic array of decreasing length causes ICE.
Recursive fn with varying const generic parameter causes ICE.
Sep 2, 2019
Looks to be a dupe of #58987. Closing. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Play link
Backtrace:
The text was updated successfully, but these errors were encountered: