]> git.proxmox.com Git - rustc.git/blame - src/test/mir-opt/README.md
New upstream version 1.13.0+dfsg1
[rustc.git] / src / test / mir-opt / README.md
CommitLineData
5bcae85e
SL
1This folder contains tests for MIR optimizations.
2
3The test format is:
4
5```
6(arbitrary rust code)
7// END RUST SOURCE
8// START $file_name_of_some_mir_dump_0
9// $expected_line_0
10// ...
11// $expected_line_N
12// END $file_name_of_some_mir_dump_0
13// ...
14// START $file_name_of_some_mir_dump_N
15// $expected_line_0
16// ...
17// $expected_line_N
18// END $file_name_of_some_mir_dump_N
19```
20
21All the test information is in comments so the test is runnable.
22
23For each $file_name, compiletest expects [$expected_line_0, ...,
24$expected_line_N] to appear in the dumped MIR in order. Currently it allows
25other non-matched lines before, after and in-between.
26
27Lines match ignoring whitespace, and the prefix "//" is removed.
28
29It also currently strips trailing comments -- partly because the full file path
30in "scope comments" is unpredictable and partly because tidy complains about
31the lines being too long.
32
33compiletest handles dumping the MIR before and after every pass for you. The
34test writer only has to specify the file names of the dumped files (not the
35full path to the file) and what lines to expect. I added an option to rustc
36that tells it to dump the mir into some directly (rather then always dumping to
37the current directory).
38
39Lines match ignoring whitespace, and the prefix "//" is removed of course.
40
41It also currently strips trailing comments -- partly because the full file path
42in "scope comments" is unpredictable and partly because tidy complains about
43the lines being too long.
44