diff options
| author | bors <bors@rust-lang.org> | 2015-04-12 16:37:29 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-04-12 16:37:29 +0000 |
| commit | 37cb1d455e77fbdb132c920e523eb4845f6b4fb9 (patch) | |
| tree | 5bb7a7a76b4e46274350fc43871bde14cc834117 /src/test/compile-fail | |
| parent | a1e3c25a2688664e85052b6205187b62410c0df0 (diff) | |
| parent | 3308c06e33855f89627b417fd6b57f76d9df50a1 (diff) | |
| download | rust-37cb1d455e77fbdb132c920e523eb4845f6b4fb9.tar.gz rust-37cb1d455e77fbdb132c920e523eb4845f6b4fb9.zip | |
Auto merge of #24072 - ebfull:explain_closure_type_err, r=pnkfelix
Also fixed bug calling .note() instead of .help() See #24036
Diffstat (limited to 'src/test/compile-fail')
| -rw-r--r-- | src/test/compile-fail/issue-24036.rs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/test/compile-fail/issue-24036.rs b/src/test/compile-fail/issue-24036.rs new file mode 100644 index 00000000000..3c8a64eaf7d --- /dev/null +++ b/src/test/compile-fail/issue-24036.rs @@ -0,0 +1,30 @@ +// 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 <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. + +fn closure_to_loc() { + let mut x = |c| c + 1; + x = |c| c + 1; + //~^ ERROR mismatched types + //~| NOTE no two closures, even if identical, have the same type + //~| HELP consider boxing your closure and/or using it as a trait object +} + +fn closure_from_match() { + let x = match 1usize { + 1 => |c| c + 1, + 2 => |c| c - 1, + _ => |c| c - 1 + }; + //~^^^^^ ERROR match arms have incompatible types + //~| NOTE no two closures, even if identical, have the same type + //~| HELP consider boxing your closure and/or using it as a trait object +} + +fn main() { } |
