diff options
| author | bors <bors@rust-lang.org> | 2013-05-22 16:22:35 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-05-22 16:22:35 -0700 |
| commit | f517ed0b08f5a1cc9b65ac0e57dbfaaefcbf002a (patch) | |
| tree | c0f2a824327a4cac01d6a3fae7f4ffc2c7ad7293 /src | |
| parent | b17b3f95762e7ca368dfce6d2bb00e820e503296 (diff) | |
| parent | 5118d2f84a4c4a8bf00d7fb9e06609877bf821e7 (diff) | |
| download | rust-f517ed0b08f5a1cc9b65ac0e57dbfaaefcbf002a.tar.gz rust-f517ed0b08f5a1cc9b65ac0e57dbfaaefcbf002a.zip | |
auto merge of #6686 : cmr/rust/fix-6596, r=catamorphism
The error message is extremely unideal.
Diffstat (limited to 'src')
| -rw-r--r-- | src/libsyntax/ext/tt/transcribe.rs | 11 | ||||
| -rw-r--r-- | src/test/compile-fail/issue-6596.rs | 9 |
2 files changed, 16 insertions, 4 deletions
diff --git a/src/libsyntax/ext/tt/transcribe.rs b/src/libsyntax/ext/tt/transcribe.rs index d806801b7d1..b13dc3f3c0f 100644 --- a/src/libsyntax/ext/tt/transcribe.rs +++ b/src/libsyntax/ext/tt/transcribe.rs @@ -118,10 +118,13 @@ fn lookup_cur_matched_by_matched(r: &mut TtReader, } fn lookup_cur_matched(r: &mut TtReader, name: ident) -> @named_match { - // FIXME (#3850): this looks a bit silly with an extra scope. - let start; - { start = *r.interpolations.get(&name); } - return lookup_cur_matched_by_matched(r, start); + match r.interpolations.find_copy(&name) { + Some(s) => lookup_cur_matched_by_matched(r, s), + None => { + r.sp_diag.span_fatal(r.cur_span, fmt!("unknown macro variable `%s`", + *r.interner.get(name))); + } + } } enum lis { lis_unconstrained, lis_constraint(uint, ident), lis_contradiction(~str) diff --git a/src/test/compile-fail/issue-6596.rs b/src/test/compile-fail/issue-6596.rs new file mode 100644 index 00000000000..3c952dbc590 --- /dev/null +++ b/src/test/compile-fail/issue-6596.rs @@ -0,0 +1,9 @@ +macro_rules! e( //~ ERROR unknown macro variable `nonexistent` + ($inp:ident) => ( + $nonexistent + ); +) + +fn main() { + e!(foo); +} |
