diff options
| author | Nicholas Nethercote <nnethercote@mozilla.com> | 2016-10-21 10:42:30 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <nnethercote@mozilla.com> | 2016-10-21 12:58:14 +1100 |
| commit | e382267cfb9133ef12d59b66a2935ee45b546a61 (patch) | |
| tree | 36e75de631e59a8c13255a0b8cdd5496966cb80f /src/libsyntax/ext | |
| parent | a935481ae9052d42c39af1d71c8e8e64750c9e02 (diff) | |
| download | rust-e382267cfb9133ef12d59b66a2935ee45b546a61.tar.gz rust-e382267cfb9133ef12d59b66a2935ee45b546a61.zip | |
Avoid an unnecessary clone in `generic_extensions`.
This avoids ~800,000 allocations in html5ever.
Diffstat (limited to 'src/libsyntax/ext')
| -rw-r--r-- | src/libsyntax/ext/tt/macro_rules.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index a74d335d604..c585c66f9a2 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -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[..]) |
