README.md
1This directory contains snippets of code that should yield a
2warning/note/help/error at compilation. Syntax of annotations is described in
3[rust documentation](https://github.com/rust-lang/rust/blob/master/src/test/COMPILER_TESTS.md).
4For more information check out [`compiletest` crate](https://github.com/laumann/compiletest-rs).
5
6To run compile tests issue `cargo +nightly --test`.
7
8## Notes on working with `compiletest` crate
9
10* Currently code that is inside macro should not be annotated, as `compiletest`
11 crate cannot deal with the fact that macro invocations effectively changes
12 line numbering. To prevent this add a `// error-pattern:<your error message here>`
13 on the top of the file and make sure that you set `deny` lint level
14 if you want to test compiler message different than error.
15* `compiletest` crate by default sets `allow(dead_code)` lint level so make sure
16 that you change it to something suiting your needs even if the warning is
17 issued prior to any macro invocation.
18* If you get a message `error: 0 unexpected errors found, 1 expected errors not found`
19 despite the fact that some error was bound to occur don't worry - it's a known
20 issue in the `compiletest` crate and your error was probably not registered -
21 make sure that your annotations are correct and that you are setting correct
22 lint levels.
23