rust/src/test/ui
Esteban Küber 87b6d38654 Don't hint to add lifetime on trait impl
Don't provide hint to add lifetime on impl items that implement a trait.

```rust
use std::str::FromStr;

pub struct Foo<'a> {
    field: &'a str,
}

impl<'a> FromStr for Foo<'a> {
    type Err = ();
    fn from_str(path: &str) -> Result<Self, ()> {
        Ok(Foo { field: path })
    }
}
```

would give the following hint:

```nocode
help: consider using an explicit lifetime parameter as shown: fn from_str(path: &'a str) -> Result<Self, ()>
  --> <anon>:9:5
   |
9  |     fn from_str(path: &str) -> Result<Self, ()> {
   |     ^
```

which is never correct, since then there will be a lifetime mismatch
between the impl and the trait.

Remove this hint for impl items that implement a trait.
2016-11-10 16:22:03 -08:00
..
check_match un-break the construct_witness logic 2016-10-26 22:41:17 +03:00
codemap_tests Point to type argument span when used as trait 2016-11-08 14:17:18 -08:00
compare-method move compile-fail tests to ui tests 2016-11-01 14:08:56 -04:00
cross-crate-macro-backtrace Fix wording for out-of-crate macro error 2016-09-15 10:12:56 -07:00
did_you_mean Improve error message and snippet for "did you mean x" 2016-10-02 15:57:39 +11:00
dropck improve "Doesn't live long enough" error 2016-10-20 22:51:51 +03:00
hello_world add UI testing framework 2016-05-13 15:22:45 -07:00
lifetimes Don't hint to add lifetime on trait impl 2016-11-10 16:22:03 -08:00
macros Improve error message and snippet for "did you mean x" 2016-10-02 15:57:39 +11:00
mismatched_types Specify when type parameter shadows primitive type 2016-09-15 20:06:29 -07:00
span Rollup merge of #37428 - estebank:generic-type-error-span, r=sanxiyn 2016-11-09 20:51:16 +02:00
README.md add UI testing framework 2016-05-13 15:22:45 -07:00
update-all-references.sh pacify the mercilous tidy 2016-05-16 16:48:48 -04:00
update-references.sh cleanup error reporting and add ui tests 2016-11-01 14:04:14 -04:00

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)