Closed
Description
Pretty straightforward. The idea is to plug logic into a template. This seems like something that should/could work.
#![feature(const_generics)]
fn test<const F: &'static dyn Fn(u32) -> u32>(i: u32) -> u32 {
F(i)
}
const F: &'static dyn Fn(u32) -> u32 = &|x| x*x;
fn main () {
println!("{}", test::<{F}>(5));
}
Playground link: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=7eefeb472380da1061af1be06967d30a
Metadata
Metadata
Assignees
Labels
Area: Closures (`|…| { … }`)Area: const generics (parameters and arguments)Category: This is a bug.`#![feature(const_generics)]`Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Relevant to the compiler team, which will review and decide on the PR/issue.ICE tracked in rust-lang/glacier.This issue requires a nightly compiler in some way.