Skip to content

Files

Latest commit

84d1f6a · Mar 9, 2017

History

History
This branch is 225735 commits behind rust-lang/rust:master.

mir-opt

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Jul 21, 2016
Mar 3, 2017
Dec 11, 2016
Oct 4, 2016
Oct 4, 2016
Dec 9, 2016
Dec 9, 2016
Mar 9, 2017
Jul 21, 2016
Feb 25, 2017
Mar 3, 2017

This folder contains tests for MIR optimizations.

The test format is:

(arbitrary rust code)
// END RUST SOURCE
// START $file_name_of_some_mir_dump_0
//  $expected_line_0
// ...
// $expected_line_N
// END $file_name_of_some_mir_dump_0
// ...
// START $file_name_of_some_mir_dump_N
//  $expected_line_0
// ...
// $expected_line_N
// END $file_name_of_some_mir_dump_N

All the test information is in comments so the test is runnable.

For each $file_name, compiletest expects [$expected_line_0, ..., $expected_line_N] to appear in the dumped MIR in order. Currently it allows other non-matched lines before, after and in-between.

Lines match ignoring whitespace, and the prefix "//" is removed.

It also currently strips trailing comments -- partly because the full file path in "scope comments" is unpredictable and partly because tidy complains about the lines being too long.

compiletest handles dumping the MIR before and after every pass for you. The test writer only has to specify the file names of the dumped files (not the full path to the file) and what lines to expect. I added an option to rustc that tells it to dump the mir into some directly (rather then always dumping to the current directory).

Lines match ignoring whitespace, and the prefix "//" is removed of course.

It also currently strips trailing comments -- partly because the full file path in "scope comments" is unpredictable and partly because tidy complains about the lines being too long.