From 57a53f0dfbaf800176578587fd0bbe8f60e38e53 Mon Sep 17 00:00:00 2001 From: Johannes Oertel Date: Wed, 6 May 2015 00:01:11 +0200 Subject: [PATCH] Add regression test for #21701 Closes #21701. --- src/test/compile-fail/issue-21701.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/test/compile-fail/issue-21701.rs diff --git a/src/test/compile-fail/issue-21701.rs b/src/test/compile-fail/issue-21701.rs new file mode 100644 index 0000000000000..f24de2ffe6b5f --- /dev/null +++ b/src/test/compile-fail/issue-21701.rs @@ -0,0 +1,25 @@ +// Copyright 2015 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 foo(t: U) { + let y = t(); +//~^ ERROR: expected function, found `U` +} + +struct Bar; + +pub fn some_func() { + let f = Bar(); +//~^ ERROR: expected function, found `Bar` +} + +fn main() { + foo(|| { 1 }); +}