1
Fork 0

Use real try blocks

This commit is contained in:
Taiki Endo 2019-02-08 20:08:08 +09:00
parent 7815c9b1c8
commit d2514523db
3 changed files with 5 additions and 12 deletions

View file

@ -254,14 +254,14 @@ fn dump_mir_results<'a, 'gcx, 'tcx>(
);
// Also dump the inference graph constraints as a graphviz file.
let _: io::Result<()> = try_block! {
let _: io::Result<()> = try {
let mut file =
pretty::create_dump_file(infcx.tcx, "regioncx.all.dot", None, "nll", &0, source)?;
regioncx.dump_graphviz_raw_constraints(&mut file)?;
};
// Also dump the inference graph constraints as a graphviz file.
let _: io::Result<()> = try_block! {
let _: io::Result<()> = try {
let mut file =
pretty::create_dump_file(infcx.tcx, "regioncx.scc.dot", None, "nll", &0, source)?;
regioncx.dump_graphviz_scc_constraints(&mut file)?;

View file

@ -26,6 +26,7 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
#![feature(slice_concat_ext)]
#![feature(try_from)]
#![feature(reverse_bits)]
#![feature(try_blocks)]
#![recursion_limit="256"]
@ -43,14 +44,6 @@ extern crate serialize as rustc_serialize; // used by deriving
#[macro_use]
extern crate syntax;
// Once we can use edition 2018 in the compiler,
// replace this with real try blocks.
macro_rules! try_block {
($($inside:tt)*) => (
(||{ ::std::ops::Try::from_ok({ $($inside)* }) })()
)
}
mod diagnostics;
mod borrow_check;

View file

@ -131,7 +131,7 @@ fn dump_matched_mir_node<'a, 'gcx, 'tcx, F>(
) where
F: FnMut(PassWhere, &mut dyn Write) -> io::Result<()>,
{
let _: io::Result<()> = try_block! {
let _: io::Result<()> = try {
let mut file = create_dump_file(tcx, "mir", pass_num, pass_name, disambiguator, source)?;
writeln!(file, "// MIR for `{}`", node_path)?;
writeln!(file, "// source = {:?}", source)?;
@ -148,7 +148,7 @@ fn dump_matched_mir_node<'a, 'gcx, 'tcx, F>(
};
if tcx.sess.opts.debugging_opts.dump_mir_graphviz {
let _: io::Result<()> = try_block! {
let _: io::Result<()> = try {
let mut file =
create_dump_file(tcx, "dot", pass_num, pass_name, disambiguator, source)?;
write_mir_fn_graphviz(tcx, source.def_id, mir, &mut file)?;