about summary refs log tree commit diff
path: root/tests/ui/recursion/infinite-function-recursion-error-8727.rs
blob: a4037f761098e517213b110eeb8afd09d147083b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// https://github.com/rust-lang/rust/issues/8727
// 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>();
}