From 316474f51028e1f51314743e1d1a255d4a38e732 Mon Sep 17 00:00:00 2001 From: Flavio Percoco Date: Thu, 13 Feb 2014 21:19:03 +0100 Subject: [PATCH] Ensure an error is raised on infinite recursion --- src/test/compile-fail/issue-8727.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/test/compile-fail/issue-8727.rs diff --git a/src/test/compile-fail/issue-8727.rs b/src/test/compile-fail/issue-8727.rs new file mode 100644 index 0000000000000..7088c4df6b7fc --- /dev/null +++ b/src/test/compile-fail/issue-8727.rs @@ -0,0 +1,24 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + +// Verify the compiler fails with an error on infinite function +// recursions. + +struct Data(~Option); + +fn generic( _ : ~[(Data,T)] ) {let rec : ~[(Data,(bool,T))] = ~[]; generic( rec ); } //~ ERROR overly deep expansion of inlined function + + +fn main () { + // Use generic at least once to trigger instantiation. + let input : ~[(Data,())] = ~[]; + generic(input); +}