2025-07-13 16:56:31 -04:00
|
|
|
// https://github.com/rust-lang/rust/issues/8727
|
2014-02-13 21:19:03 +01:00
|
|
|
// Verify the compiler fails with an error on infinite function
|
|
|
|
|
// recursions.
|
|
|
|
|
|
2019-12-14 04:28:32 +01:00
|
|
|
//@ build-fail
|
2025-07-29 01:13:50 +00:00
|
|
|
//@ compile-flags: --diagnostic-width=100 -Zwrite-long-types-to-disk=yes
|
2019-12-14 04:28:32 +01:00
|
|
|
|
2020-06-21 22:32:35 -04:00
|
|
|
fn generic<T>() { //~ WARN function cannot return without recursing
|
2015-02-12 10:29:52 -05:00
|
|
|
generic::<Option<T>>();
|
2014-02-14 08:42:23 -08:00
|
|
|
}
|
2020-09-02 10:40:56 +03:00
|
|
|
//~^^ ERROR reached the recursion limit while instantiating `generic::<Option<
|
2014-02-13 21:19:03 +01:00
|
|
|
|
|
|
|
|
fn main () {
|
|
|
|
|
// Use generic<T> at least once to trigger instantiation.
|
2015-02-12 10:29:52 -05:00
|
|
|
generic::<i32>();
|
2014-02-13 21:19:03 +01:00
|
|
|
}
|