// a.rs
#![feature(const_fn)]
pub const fn foo() -> fn() {
fn bar() {}
bar
}
// b.rs
extern crate a;
fn main() {
a::foo()();
}
error: internal compiler error: librustc_mir/monomorphize/collector.rs:757:
Cannot create local mono-item for DefId(10/0:4 ~ a[8787]::foo[0]::bar[0])
Adding #[inline] to bar's definition works around the ICE.
Also, the bug doesn't trigger if foo is an #[inline] non-const fn, so it's not just that foo is inlined cross-crate, but const fn-specific behavior is also involved.
cc @oli-obk @michaelwoerister
Adding
#[inline]tobar's definition works around the ICE.Also, the bug doesn't trigger if
foois an#[inline]non-constfn, so it's not just thatfoois inlined cross-crate, butconst fn-specific behavior is also involved.cc @oli-obk @michaelwoerister