Skip to content

Commit 7ccc97e

Browse files
committed
Fix ICE in macros
1 parent b6a0d40 commit 7ccc97e

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/libsyntax/ext/tt/transcribe.rs

Lines changed: 7 additions & 4 deletions
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)

0 commit comments

Comments
 (0)