Skip to content

Commit d251452

Browse files
committed
Use real try blocks
1 parent 7815c9b commit d251452

File tree

3 files changed

+5
-12
lines changed

3 files changed

+5
-12
lines changed

src/librustc_mir/borrow_check/nll/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,14 +254,14 @@ fn dump_mir_results<'a, 'gcx, 'tcx>(
254254
);
255255

256256
// Also dump the inference graph constraints as a graphviz file.
257-
let _: io::Result<()> = try_block! {
257+
let _: io::Result<()> = try {
258258
let mut file =
259259
pretty::create_dump_file(infcx.tcx, "regioncx.all.dot", None, "nll", &0, source)?;
260260
regioncx.dump_graphviz_raw_constraints(&mut file)?;
261261
};
262262

263263
// Also dump the inference graph constraints as a graphviz file.
264-
let _: io::Result<()> = try_block! {
264+
let _: io::Result<()> = try {
265265
let mut file =
266266
pretty::create_dump_file(infcx.tcx, "regioncx.scc.dot", None, "nll", &0, source)?;
267267
regioncx.dump_graphviz_scc_constraints(&mut file)?;

src/librustc_mir/lib.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
2626
#![feature(slice_concat_ext)]
2727
#![feature(try_from)]
2828
#![feature(reverse_bits)]
29+
#![feature(try_blocks)]
2930

3031
#![recursion_limit="256"]
3132

@@ -43,14 +44,6 @@ extern crate serialize as rustc_serialize; // used by deriving
4344
#[macro_use]
4445
extern crate syntax;
4546

46-
// Once we can use edition 2018 in the compiler,
47-
// replace this with real try blocks.
48-
macro_rules! try_block {
49-
($($inside:tt)*) => (
50-
(||{ ::std::ops::Try::from_ok({ $($inside)* }) })()
51-
)
52-
}
53-
5447
mod diagnostics;
5548

5649
mod borrow_check;

src/librustc_mir/util/pretty.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ fn dump_matched_mir_node<'a, 'gcx, 'tcx, F>(
131131
) where
132132
F: FnMut(PassWhere, &mut dyn Write) -> io::Result<()>,
133133
{
134-
let _: io::Result<()> = try_block! {
134+
let _: io::Result<()> = try {
135135
let mut file = create_dump_file(tcx, "mir", pass_num, pass_name, disambiguator, source)?;
136136
writeln!(file, "// MIR for `{}`", node_path)?;
137137
writeln!(file, "// source = {:?}", source)?;
@@ -148,7 +148,7 @@ fn dump_matched_mir_node<'a, 'gcx, 'tcx, F>(
148148
};
149149

150150
if tcx.sess.opts.debugging_opts.dump_mir_graphviz {
151-
let _: io::Result<()> = try_block! {
151+
let _: io::Result<()> = try {
152152
let mut file =
153153
create_dump_file(tcx, "dot", pass_num, pass_name, disambiguator, source)?;
154154
write_mir_fn_graphviz(tcx, source.def_id, mir, &mut file)?;

0 commit comments

Comments
 (0)