Change:
I've tried reducing this but wasn't really able to so far. I might try again some other time. The code below currently ICEs on Nightly (). When trying to reproduce locally for the backtrace, I had an older Nightly first () where this actually didn't crash the compiler, so it's apparently a regression. <details<summary<strongBacktrace</strong</summary<p</p</details
This is my first time using cargo-bisect-rustc and it's fantastic. It identified the regression as... searched nightlies: from nightly-2020-02-13 to nightly-2020-05-14 regressed nightly: nightly-2020-03-20 searched commits: from to regressed commit: <details<summarybisected with <a href=''cargo-bisect-rustc</av0.5.2</summaryHost triple: x86_64-unknown-linux-gnu Reproduce with: </details
is a rollup commit. The only PR which was part of that and (to me) looks like it could have caused this issue is .
Triage: the feature was removed by and the ICE no longer occurs with the latest nightly.

Discussion:
<ins> #![feature(const_generics)] #![allow(incomplete_features)] struct Test(*const usize); type PassArg = (); unsafe extern "C" fn pass(args: PassArg) { println!("Hello, world!"); } impl Test { pub fn call_me<Args: Sized, const IDX: usize, const FN: unsafe extern "C" fn(Args)>(&self) { //~^ ERROR: using function pointers as const generic parameters is forbidden self.0 = Self::trampiline::<Args, IDX, FN> as _ } unsafe extern "C" fn trampiline< Args: Sized, const IDX: usize, const FN: unsafe extern "C" fn(Args), //~^ ERROR: using function pointers as const generic parameters is forbidden >( args: Args, ) { FN(args) } } fn main() { let x = Test(); x.call_me::<PassArg, 30, pass>() } </ins>

<ins> error: using function pointers as const generic parameters is forbidden --> $DIR/issue-71381.rs:13:61 | LL |     pub fn call_me<Args: Sized, const IDX: usize, const FN: unsafe extern "C" fn(Args)>(&self) { |                                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: using function pointers as const generic parameters is forbidden --> $DIR/issue-71381.rs:21:19 | LL |         const FN: unsafe extern "C" fn(Args), |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors </ins>

<ins> #![feature(const_generics)] #![allow(incomplete_features)] struct Test(); fn pass() { println!("Hello, world!"); } impl Test { pub fn call_me(&self) { self.test::<pass>(); } fn test<const FN: fn()>(&self) { //~^ ERROR: using function pointers as const generic parameters is forbidden FN(); } } fn main() { let x = Test(); x.call_me() } </ins>

<ins> error: using function pointers as const generic parameters is forbidden --> $DIR/issue-71382.rs:15:23 | LL |     fn test<const FN: fn()>(&self) { |                       ^^^^ error: aborting due to previous error </ins>

<ins> #![feature(const_generics)] #![allow(incomplete_features)] fn func<A, const F: fn(inner: A)>(outer: A) { //~^ ERROR: using function pointers as const generic parameters is forbidden F(outer); } fn main() {} </ins>

<ins> error: using function pointers as const generic parameters is forbidden --> $DIR/issue-71611.rs:4:21 | LL | fn func<A, const F: fn(inner: A)>(outer: A) { |                     ^^^^^^^^^^^^ error: aborting due to previous error </ins>

<ins> #![feature(const_generics)] #![allow(incomplete_features)] use std::ffi::{CStr, CString}; unsafe fn unsafely_do_the_thing<const F: fn(&CStr) -> usize>(ptr: *const i8) -> usize { //~^ ERROR: using function pointers as const generic parameters is forbidden F(CStr::from_ptr(ptr)) } fn safely_do_the_thing(s: &CStr) -> usize { s.to_bytes().len() } fn main() { let baguette = CString::new("baguette").unwrap(); let ptr = baguette.as_ptr(); println!("{}", unsafe { unsafely_do_the_thing::<safely_do_the_thing>(ptr) }); } </ins>

<ins> error: using function pointers as const generic parameters is forbidden --> $DIR/issue-72352.rs:6:42 | LL | unsafe fn unsafely_do_the_thing<const F: fn(&CStr) -> usize>(ptr: *const i8) -> usize { |                                          ^^^^^^^^^^^^^^^^^^ error: aborting due to previous error </ins>