Avoid an unnecessary clone in generic_extensions.

This avoids ~800,000 allocations in html5ever.
This commit is contained in:
Nicholas Nethercote 2016-10-21 10:42:30 +11:00
parent a935481ae9
commit e382267cfb

View File

@ -139,9 +139,9 @@ fn generic_extension<'cx>(cx: &'cx ExtCtxt,
macro_ident: name
})
}
Failure(sp, ref msg) => if sp.lo >= best_fail_spot.lo {
Failure(sp, msg) => if sp.lo >= best_fail_spot.lo {
best_fail_spot = sp;
best_fail_msg = (*msg).clone();
best_fail_msg = msg;
},
Error(err_sp, ref msg) => {
cx.span_fatal(err_sp.substitute_dummy(sp), &msg[..])