Skip to content

Commit f517ed0

Browse files
committed
auto merge of #6686 : cmr/rust/fix-6596, r=catamorphism
The error message is extremely unideal.
2 parents b17b3f9 + 5118d2f commit f517ed0

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

src/libsyntax/ext/tt/transcribe.rs

+7-4
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,13 @@ fn lookup_cur_matched_by_matched(r: &mut TtReader,
118118
}
119119

120120
fn lookup_cur_matched(r: &mut TtReader, name: ident) -> @named_match {
121-
// FIXME (#3850): this looks a bit silly with an extra scope.
122-
let start;
123-
{ start = *r.interpolations.get(&name); }
124-
return lookup_cur_matched_by_matched(r, start);
121+
match r.interpolations.find_copy(&name) {
122+
Some(s) => lookup_cur_matched_by_matched(r, s),
123+
None => {
124+
r.sp_diag.span_fatal(r.cur_span, fmt!("unknown macro variable `%s`",
125+
*r.interner.get(name)));
126+
}
127+
}
125128
}
126129
enum lis {
127130
lis_unconstrained, lis_constraint(uint, ident), lis_contradiction(~str)

src/test/compile-fail/issue-6596.rs

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
macro_rules! e( //~ ERROR unknown macro variable `nonexistent`
2+
($inp:ident) => (
3+
$nonexistent
4+
);
5+
)
6+
7+
fn main() {
8+
e!(foo);
9+
}

0 commit comments

Comments
 (0)