diff options
| author | Masood Malekghassemi <atash@google.com> | 2016-04-06 00:20:59 -0700 |
|---|---|---|
| committer | Masood Malekghassemi <atash@google.com> | 2016-04-06 13:57:18 -0700 |
| commit | e45c7955e94fe55b7ca83dfb76b1bb50dfea74f6 (patch) | |
| tree | 6b7f4a94e6084f3eb6d2a0c58868a52ed33a55da /src/test | |
| parent | 57e5d43c770201d837298175a2d55818867bdb33 (diff) | |
| download | rust-e45c7955e94fe55b7ca83dfb76b1bb50dfea74f6.tar.gz rust-e45c7955e94fe55b7ca83dfb76b1bb50dfea74f6.zip | |
Replace consider_unification_despite_ambiguity with obligation variant
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/compile-fail/closure-wrong-kind.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/test/compile-fail/closure-wrong-kind.rs b/src/test/compile-fail/closure-wrong-kind.rs new file mode 100644 index 00000000000..4f06f56706b --- /dev/null +++ b/src/test/compile-fail/closure-wrong-kind.rs @@ -0,0 +1,23 @@ +// Copyright 2016 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 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +struct X; +fn foo<T>(_: T) {} +fn bar<T: Fn(u32)>(_: T) {} + +fn main() { + let x = X; + let closure = |_| foo(x); + //~^ ERROR the closure implements `FnOnce` but not `Fn` + bar(closure); +} |
