Files
rust/tests/ui/issues/issue-8727.rs
T
Esteban Küber 025fbe8f69 Add support for shortening Instance and use it
Replace ad-hoc type path shortening logic for recursive mono instantiation errors to use `tcx.short_string()` instead.
2025-08-06 22:21:49 +00:00

17 lines
447 B
Rust

// Verify the compiler fails with an error on infinite function
// recursions.
//@ build-fail
//@ compile-flags: --diagnostic-width=100 -Zwrite-long-types-to-disk=yes
fn generic<T>() { //~ WARN function cannot return without recursing
generic::<Option<T>>();
}
//~^^ ERROR reached the recursion limit while instantiating `generic::<Option<
fn main () {
// Use generic<T> at least once to trigger instantiation.
generic::<i32>();
}