rust/src/test/ui
bors f09576c4a4 Auto merge of #42443 - tommyip:better_closure_msg, r=nikomatsakis
Better closure error message

Use tracked data introduced in #42196 to provide a better closure
error message by showing why a closure implements `FnOnce`.

```
error[E0525]: expected a closure that implements the `Fn` trait, but
this closure only implements `FnOnce`
 --> $DIR/issue_26046.rs:4:19
  |
4 |       let closure = move || {
  |  ___________________^
5 | |         vec
6 | |     };
  | |_____^
  |
note: closure is `FnOnce` because it moves the variable `vec` out of
its environment
 --> $DIR/issue_26046.rs:5:9
  |
5 |         vec
  |         ^^^

error: aborting due to previous error(s)
```

Fixes #26046

r? @nikomatsakis
cc @doomrobo
2017-06-08 08:37:48 +00:00
..
borrowck Change error count messages 2017-05-24 16:14:38 +07:00
check_match Change error count messages 2017-05-24 16:14:38 +07:00
closure_context Cover all cases in closure errors 2017-06-07 21:26:28 +01:00
codemap_tests Add invalid unary operator usage error code 2017-05-27 21:34:59 +02:00
compare-method Change error count messages 2017-05-24 16:14:38 +07:00
cross-crate-macro-backtrace Change error count messages 2017-05-24 16:14:38 +07:00
did_you_mean Add new error codes and update tests 2017-05-27 19:58:52 +02:00
dropck Add new error codes and update tests 2017-05-27 19:58:52 +02:00
fmt Change error count messages 2017-05-24 16:14:38 +07:00
hello_world
impl-trait Auto merge of #42383 - estebank:candidate-newline, r=arielb1 2017-06-05 13:07:38 +00:00
interior-mutability Changing error message for interior mutability, adding ui test 2017-06-07 01:38:05 +05:30
invalid-module-declaration Change error count messages 2017-05-24 16:14:38 +07:00
issue-37311-type-length-limit Change error count messages 2017-05-24 16:14:38 +07:00
issue-40402-ref-hints Change error count messages 2017-05-24 16:14:38 +07:00
issue-41652 Add new error codes and update tests 2017-05-27 19:58:52 +02:00
lifetime-errors Change error count messages 2017-05-24 16:14:38 +07:00
lifetimes Add new error codes and update tests 2017-05-27 19:58:52 +02:00
lint Change error count messages 2017-05-24 16:14:38 +07:00
macros Auto merge of #42264 - GuillaumeGomez:new-error-codes, r=Susurrus 2017-05-29 21:55:57 +00:00
mismatched_types tests: fix fallout from changing the span of binop errors. 2017-06-01 08:59:47 +03:00
missing-items Add new error code 2017-05-30 19:19:34 +02:00
print_type_sizes Stabilize unions with Copy fields and no destructor 2017-05-27 00:52:20 +03:00
print-fuel UI test for -Z print-fuel=foo 2017-04-11 14:36:08 +03:00
pub Change error count messages 2017-05-24 16:14:38 +07:00
reachable Add invalid unary operator usage error code 2017-05-27 21:34:59 +02:00
resolve Add E0603 error code 2017-06-02 21:40:22 +02:00
span Auto merge of #42383 - estebank:candidate-newline, r=arielb1 2017-06-05 13:07:38 +00:00
suggestions Add new error codes and update tests 2017-05-27 19:58:52 +02:00
token Add new error code 2017-05-30 19:19:34 +02:00
type-check Change error count messages 2017-05-24 16:14:38 +07:00
coercion-missing-tail-expected-type.rs Fix error message for mismatched types 2017-04-25 18:28:08 -04:00
coercion-missing-tail-expected-type.stderr Change error count messages 2017-05-24 16:14:38 +07:00
deprecated-macro_escape-inner.rs Introduce 'run-pass' header to 'ui' tests in compiletest. Fix issue #36516. 2017-06-02 23:28:22 +08:00
deprecated-macro_escape-inner.stderr Introduce 'run-pass' header to 'ui' tests in compiletest. Fix issue #36516. 2017-06-02 23:28:22 +08:00
deprecated-macro_escape.rs Introduce 'run-pass' header to 'ui' tests in compiletest. Fix issue #36516. 2017-06-02 23:28:22 +08:00
deprecated-macro_escape.stderr Introduce 'run-pass' header to 'ui' tests in compiletest. Fix issue #36516. 2017-06-02 23:28:22 +08:00
deriving-meta-empty-trait-list.rs Introduce 'run-pass' header to 'ui' tests in compiletest. Fix issue #36516. 2017-06-02 23:28:22 +08:00
deriving-meta-empty-trait-list.stderr Introduce 'run-pass' header to 'ui' tests in compiletest. Fix issue #36516. 2017-06-02 23:28:22 +08:00
enum-size-variance.rs Introduce 'run-pass' header to 'ui' tests in compiletest. Fix issue #36516. 2017-06-02 23:28:22 +08:00
enum-size-variance.stderr Introduce 'run-pass' header to 'ui' tests in compiletest. Fix issue #36516. 2017-06-02 23:28:22 +08:00
issue-19100.rs Introduce 'run-pass' header to 'ui' tests in compiletest. Fix issue #36516. 2017-06-02 23:28:22 +08:00
issue-19100.stderr Introduce 'run-pass' header to 'ui' tests in compiletest. Fix issue #36516. 2017-06-02 23:28:22 +08:00
issue-26548.rs remove layout_cache and fix -Z print-type-sizes 2017-06-01 13:31:11 -04:00
issue-26548.stderr fix ui reference 2017-06-01 13:31:12 -04:00
loop-break-value-no-repeat.rs Stabilize the loop_break_value feature 2017-05-17 21:34:37 +02:00
loop-break-value-no-repeat.stderr Rollup merge of #42150 - citizen428:feature/error-count-messages, r=Mark-Simulacrum 2017-05-24 19:50:05 -06:00
path-lookahead.rs Introduce 'run-pass' header to 'ui' tests in compiletest. Fix issue #36516. 2017-06-02 23:28:22 +08:00
path-lookahead.stderr Introduce 'run-pass' header to 'ui' tests in compiletest. Fix issue #36516. 2017-06-02 23:28:22 +08:00
README.md
regions-fn-subtyping-return-static.rs make lifetimes that only appear in return type early-bound 2017-02-05 16:30:03 -05:00
regions-fn-subtyping-return-static.stderr Change error count messages 2017-05-24 16:14:38 +07:00
static-lifetime.rs Improve E0477 error message 2017-05-09 20:51:18 +02:00
static-lifetime.stderr Change error count messages 2017-05-24 16:14:38 +07:00
test-should-panic-attr.rs Introduce 'run-pass' header to 'ui' tests in compiletest. Fix issue #36516. 2017-06-02 23:28:22 +08:00
test-should-panic-attr.stderr Introduce 'run-pass' header to 'ui' tests in compiletest. Fix issue #36516. 2017-06-02 23:28:22 +08:00
update-all-references.sh
update-references.sh

Guide to the UI Tests

The UI tests are intended to capture the compiler's complete output, so that we can test all aspects of the presentation. They work by compiling a file (e.g., hello_world/main.rs), capturing the output, and then applying some normalization (see below). This normalized result is then compared against reference files named hello_world/main.stderr and hello_world/main.stdout. If either of those files doesn't exist, the output must be empty. If the test run fails, we will print out the current output, but it is also saved in build/<target-triple>/test/ui/hello_world/main.stdout (this path is printed as part of the test failure mesage), so you can run diff and so forth.

Editing and updating the reference files

If you have changed the compiler's output intentionally, or you are making a new test, you can use the script update-references.sh to update the references. When you run the test framework, it will report various errors: in those errors is a command you can use to run the update-references.sh script, which will then copy over the files from the build directory and use them as the new reference. You can also just run update-all-references.sh. In both cases, you can run the script with --help to get a help message.

Normalization

The normalization applied is aimed at filenames:

  • the test directory is replaced with $DIR
  • all backslashes () are converted to forward slashes (/) (for windows)