Make the verifier output even prettier (#599)

* Fix verifier printing to print instruction encodings consistently.

Use `FuncWriter::write_instruction` for all instructions so that
encodings are printed consistently.

* Make use-before-def errors mention the relevant value.

* When there are verifier errors, print a message at the end.

* Make verifier errors prettier.

Fix the length of the "^~~~~" to match the printed entity, and print the
error messsage on its own line.

* Clean up "test verifier" failure messages.

* Tidy the uses-value-from-itself error.

The use instruction is the same as the def instruction, so don't print
both. Also, the use instruction is already being printed at the
beginning, so don't print it again at the end.
This commit is contained in:
Dan Gohman
2018-11-26 22:18:18 -08:00
committed by GitHub
parent 737fde04a8
commit 54c388d870
4 changed files with 74 additions and 61 deletions

View File

@@ -861,18 +861,13 @@ impl<'a> Verifier<'a> {
return fatal!(
errors,
loc_inst,
"uses value from non-dominating {}",
"uses value {} from non-dominating {}",
v,
def_inst
);
}
if def_inst == loc_inst {
return fatal!(
errors,
loc_inst,
"uses value from itself {}, {}",
def_inst,
loc_inst
);
return fatal!(errors, loc_inst, "uses value {} from itself", v);
}
}
}