Skip to content

Commit

Permalink
Fix unreachable code in libsyntax
Browse files Browse the repository at this point in the history
  • Loading branch information
Manishearth committed Nov 24, 2015
1 parent 2eca64d commit 7fbcb51
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/libsyntax/ext/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -678,9 +678,9 @@ impl<'a> ExtCtxt<'a> {
pub fn bt_push(&mut self, ei: ExpnInfo) {
self.recursion_count += 1;
if self.recursion_count > self.ecfg.recursion_limit {
panic!(self.span_fatal(ei.call_site,
self.span_fatal(ei.call_site,
&format!("recursion limit reached while expanding the macro `{}`",
ei.callee.name())));
ei.callee.name()));
}

let mut call_site = ei.call_site;
Expand Down
4 changes: 2 additions & 2 deletions src/libsyntax/ext/tt/macro_rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,12 @@ fn generic_extension<'cx>(cx: &'cx ExtCtxt,
best_fail_msg = (*msg).clone();
},
Error(err_sp, ref msg) => {
panic!(cx.span_fatal(err_sp.substitute_dummy(sp), &msg[..]))
cx.span_fatal(err_sp.substitute_dummy(sp), &msg[..])
}
}
}

panic!(cx.span_fatal(best_fail_spot.substitute_dummy(sp), &best_fail_msg[..]));
cx.span_fatal(best_fail_spot.substitute_dummy(sp), &best_fail_msg[..]);
}

// Note that macro-by-example's input is also matched against a token tree:
Expand Down
5 changes: 0 additions & 5 deletions src/test/compile-fail/unreachable-in-call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// Test that the unboxed closure sugar can be used with an arbitrary
// struct type and that it is equivalent to the same syntax using
// angle brackets. This test covers only simple types and in
// particular doesn't test bound regions.

#![allow(dead_code)]
#![deny(unreachable_code)]

Expand Down

0 comments on commit 7fbcb51

Please sign in to comment.