rust/src/test
bors 4b8bf391fd Auto merge of #44735 - tirr-c:issue-42143, r=arielb1
Friendlier error message for closure argument type mismatch

Rebased #42270.
Fixes #42143.

---

`test.rs`:

```rust
fn main() {
    foo(|_: i32, _: usize| ());
}

fn foo<F>(_: F) where F: Fn(&str, usize) {}
```

Before:

```
error[E0281]: type mismatch: `[closure@test.rs:2:9: 2:30]` implements the trait `std::ops::Fn<(i32, usize)>`, but the trait `for<'r> std::ops::Fn<(&'r str, usize)>` is required
 --> test.rs:2:5
  |
2 |     foo(|_: i32, _: usize| ());
  |     ^^^ --------------------- implements `std::ops::Fn<(i32, usize)>`
  |     |
  |     expected &str, found i32
  |     requires `for<'r> std::ops::Fn<(&'r str, usize)>`
  |
  = note: required by `foo`
```

After (early):

```
error[E0631]: type mismatch in closure arguments
 --> test.rs:2:5
  |
2 |     foo(|_: i32, _: usize| ());
  |     ^^^ --------------------- takes arguments of type `i32` and `usize`
  |     |
  |     expected arguments of type `&str` and `usize`
  |
  = note: required by `foo`
```

After (current):

```
error[E0631]: type mismatch in closure arguments
 --> test.rs:2:5
  |
2 |     foo(|_: i32, _: usize| ());
  |     ^^^ --------------------- found signature of `fn(i32, usize) -> _`
  |     |
  |     expected signature of `for<'r> fn(&'r str, usize) -> _`
  |
  = note: required by `foo`
```

~~Compiler output has been changed, and a few tests are failing. Help me writing/fixing tests!~~

r? @nikomatsakis
2017-09-26 05:02:03 +00:00
..
codegen add test for not optimized pow with constant power 2017-09-02 19:10:00 +03:00
codegen-units Adapt cgu-partitioning tests to pre-trans symbol internalization. 2017-07-13 13:29:25 +02:00
compile-fail Auto merge of #44279 - smaeul:crt_static-deps, r=alexcrichton 2017-09-25 20:37:02 +00:00
compile-fail-fulldeps change #![feature(const_fn)] to specific gates 2017-09-16 15:53:02 +00:00
debuginfo change #![feature(const_fn)] to specific gates 2017-09-16 15:53:02 +00:00
incremental incr.comp.: Make #[rustc_dirty/clean] test for fingerprint equality instead of DepNode existence. 2017-09-23 19:47:46 +02:00
mir-opt Test case illustrating some destruction code extent stuff. 2017-09-13 12:55:03 +02:00
parse-fail Auto merge of #43716 - MaloJaffre:_-in-literals, r=petrochenkov 2017-09-12 01:25:23 +00:00
pretty Use rvalue promotion to 'static instead of static items. 2017-09-10 11:20:27 +03:00
run-fail Relaxed error pattern, and add test for SystemTime as well. 2017-09-10 12:35:47 +08:00
run-fail-fulldeps
run-make rustc: Remove Session::dep_graph 2017-09-14 10:40:50 -07:00
run-pass Rollup merge of #44770 - dtolnay:borrowed, r=sfackler 2017-09-23 00:29:20 -04:00
run-pass-fulldeps Remove the cstore reference from Session in order to prepare encapsulating CrateStore access in tcx. 2017-09-12 07:19:06 -07:00
run-pass-valgrind change #![feature(const_fn)] to specific gates 2017-09-16 15:53:02 +00:00
rustdoc Rollup merge of #44554 - GuillaumeGomez:add-missing-pub, r=QuietMisdreavus 2017-09-23 00:29:09 -04:00
ui Auto merge of #44735 - tirr-c:issue-42143, r=arielb1 2017-09-26 05:02:03 +00:00
ui-fulldeps Initial diagnostic API for proc-macros. 2017-08-28 02:58:22 -07:00
COMPILER_TESTS.md Merge ui/README.md into COMPILER_TESTS.md and describe how custom UI normalization works. 2017-07-11 16:57:53 +08:00