Auto merge of #37318 - nnethercote:html5ever-more, r=nrc,eddyb
Avoid some allocations in the macro parser These three commits reduce the number of heap allocations done when compiling rustc-benchmarks/html5ever-2016-08-25 by 20%, from 16.5M to 13.3M. This speeds up (debug) compilation of it with a stage1 compiler by about 7%.
This commit is contained in:
commit
a117bba125
3 changed files with 32 additions and 16 deletions
|
|
@ -25,6 +25,7 @@ use syntax::ext::base::{ExtCtxt, MacResult, DummyResult, MacEager};
|
|||
use syntax::ext::build::AstBuilder;
|
||||
use syntax::ext::tt::macro_parser::{MatchedSeq, MatchedNonterminal};
|
||||
use syntax::ext::tt::macro_parser::{Success, Failure, Error};
|
||||
use syntax::ext::tt::macro_parser::parse_failure_msg;
|
||||
use syntax::ptr::P;
|
||||
use syntax_pos::Span;
|
||||
use rustc_plugin::Registry;
|
||||
|
|
@ -58,8 +59,11 @@ fn expand_mbe_matches(cx: &mut ExtCtxt, sp: Span, args: &[TokenTree])
|
|||
_ => unreachable!()
|
||||
}
|
||||
}
|
||||
Failure(_, s) | Error(_, s) => {
|
||||
panic!("expected Success, but got Error/Failure: {}", s);
|
||||
Failure(_, tok) => {
|
||||
panic!("expected Success, but got Failure: {}", parse_failure_msg(tok));
|
||||
}
|
||||
Error(_, s) => {
|
||||
panic!("expected Success, but got Error: {}", s);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue