diff options
| author | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2016-10-19 07:59:59 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-10-19 07:59:59 +0300 |
| commit | aaed275a49ccc90eec4b2cbd8fc5d29c8f2115f7 (patch) | |
| tree | 3fa84ab51170df2f7e5706d6030f254b9ef9c5af /src/test | |
| parent | a88ca4bf8ec0775cf517b1b3eaf0ec116194a4fd (diff) | |
| parent | 029dceedb9719ae5dbdbf2c033c920017e3d786e (diff) | |
| download | rust-aaed275a49ccc90eec4b2cbd8fc5d29c8f2115f7.tar.gz rust-aaed275a49ccc90eec4b2cbd8fc5d29c8f2115f7.zip | |
Rollup merge of #37161 - nnethercote:no-cfg-cloning, r=nrc
Avoid many CrateConfig clones. This commit changes `ExtCtx::cfg()` so it returns a `CrateConfig` reference instead of a clone. As a result, it also changes all of the `cfg()` callsites to explicitly clone... except one, because the commit also changes `macro_parser::parse()` to take `&CrateConfig`. This is good, because that function can be hot, and `CrateConfig` is expensive to clone. This change almost halves the number of heap allocations done by rustc for `html5ever` in rustc-benchmarks suite, which makes compilation 1.20x faster. r? @nrc
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/compile-fail-fulldeps/auxiliary/macro_crate_test.rs | 2 | ||||
| -rw-r--r-- | src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/test/compile-fail-fulldeps/auxiliary/macro_crate_test.rs b/src/test/compile-fail-fulldeps/auxiliary/macro_crate_test.rs index 5b1ecfed242..2041abcf82c 100644 --- a/src/test/compile-fail-fulldeps/auxiliary/macro_crate_test.rs +++ b/src/test/compile-fail-fulldeps/auxiliary/macro_crate_test.rs @@ -57,7 +57,7 @@ fn expand_identity(cx: &mut ExtCtxt, _span: Span, tts: &[TokenTree]) -> Box<MacResult+'static> { // Parse an expression and emit it unchanged. let mut parser = parse::new_parser_from_tts(cx.parse_sess(), - cx.cfg(), tts.to_vec()); + cx.cfg().clone(), tts.to_vec()); let expr = parser.parse_expr().unwrap(); MacEager::expr(quote_expr!(&mut *cx, $expr)) } diff --git a/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs b/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs index 4885863122c..2c814a5433b 100644 --- a/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs +++ b/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs @@ -60,7 +60,7 @@ fn expand_make_a_1(cx: &mut ExtCtxt, sp: Span, tts: &[TokenTree]) -> Box<MacResu // See Issue #15750 fn expand_identity(cx: &mut ExtCtxt, _span: Span, tts: &[TokenTree]) -> Box<MacResult + 'static> { // Parse an expression and emit it unchanged. - let mut parser = parse::new_parser_from_tts(cx.parse_sess(), cx.cfg(), tts.to_vec()); + let mut parser = parse::new_parser_from_tts(cx.parse_sess(), cx.cfg().clone(), tts.to_vec()); let expr = parser.parse_expr().unwrap(); MacEager::expr(quote_expr!(&mut *cx, $expr)) } |
