diff --git a/src/test/compile-fail/issue-12187-1.rs b/src/test/compile-fail/issue-12187-1.rs new file mode 100644 index 0000000000000..ce21e33d807ea --- /dev/null +++ b/src/test/compile-fail/issue-12187-1.rs @@ -0,0 +1,18 @@ +// 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. + +fn new() -> &'static T { + fail!() +} + +fn main() { + let &v = new(); + //~^ ERROR cannot determine a type for this local variable: unconstrained type +} diff --git a/src/test/compile-fail/issue-12187-2.rs b/src/test/compile-fail/issue-12187-2.rs new file mode 100644 index 0000000000000..90da10959edd7 --- /dev/null +++ b/src/test/compile-fail/issue-12187-2.rs @@ -0,0 +1,18 @@ +// 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. + +fn new<'r, T>() -> &'r T { + fail!() +} + +fn main() { + let &v = new(); + //~^ ERROR cannot determine a type for this local variable: unconstrained type +}