-
Notifications
You must be signed in to change notification settings - Fork 14k
Closed
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Description
// 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.
Metadata
Metadata
Assignees
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️