mirror of
https://github.com/rust-lang/rust
synced 2024-11-05 20:45:15 +00:00
16 lines
416 B
Rust
16 lines
416 B
Rust
// Verify the compiler fails with an error on infinite function
|
|
// recursions.
|
|
|
|
//@ build-fail
|
|
//@ normalize-stderr-test: ".nll/" -> "/"
|
|
|
|
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>();
|
|
}
|