about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2016-10-25Use `SmallVector` for the stack in `macro_parser::parse`.Nicholas Nethercote-6/+4
This avoids 800,000 heap allocations when compiling html5ever.
2016-10-24check target abi supportTim Neumann-28/+22
2016-10-24Refactor away fields `MacroDef::{use_locally, export}`.Jeffrey Seyfried-7/+4
2016-10-23Support `use *;` and `use ::*;`.Jeffrey Seyfried-4/+9
2016-10-22Auto merge of #37318 - nnethercote:html5ever-more, r=nrc,eddybbors-14/+26
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%.
2016-10-21Replace the `String` in `ParseResult::Failure` with `Token`.Nicholas Nethercote-13/+25
This lets us delay creation of failure messages until they are needed, which avoids ~1.6M allocations in html5ever.
2016-10-21Avoid an unnecessary clone in `generic_extensions`.Nicholas Nethercote-2/+2
This avoids ~800,000 allocations in html5ever.
2016-10-21Avoid an unnecessary clone in `macro_parser::parse`.Nicholas Nethercote-1/+1
This avoids ~800,000 allocations in html5ever.
2016-10-20Tweak path parsing logicVadim Petrochenkov-19/+30
2016-10-20Refactor parser lookahead buffer and increase its sizeVadim Petrochenkov-38/+41
2016-10-19Rollup merge of #37241 - zackmdavis:if_let_over_none_spaced_empty_block_arm, ↵Guillaume Gomez-7/+4
r=nikomatsakis prefer `if let` to match with `None => { }` arm in some places In #34268 (8531d581), we replaced matches of None to the unit value `()` with `if let`s in places where it was deemed that this made the code unambiguously clearer and more idiomatic. In #34638 (d37edef9), we did the same for matches of None to the empty block `{}`. A casual observer, upon seeing these commits fly by, might suppose that the matter was then settled, that no further pull requests on this utterly trivial point of style could or would be made. Unless ... It turns out that sometimes people write the empty block with a space in between the braces. Who knew?
2016-10-19Improve `$crate`.Jeffrey Seyfried-69/+13
2016-10-19Rollup merge of #37265 - brson:bootstrap, r=alexcrichtonEduard-Mihai Burtescu-9/+6
Allow bootstrapping without a key. Fixes #36548 This will make it easier for packagers to bootstrap rustc when they happen to have a bootstrap compiler with a slightly different version number. It's not ok for anything other than the build system to set this environment variable. r? @alexcrichton
2016-10-19Rollup merge of #37208 - jseyfried:fix_partially_consumed_tokens_in_macros, ↵Eduard-Mihai Burtescu-15/+38
r=nrc macros: fix partially consumed tokens in macro matchers Fixes #37175. This PR also avoids re-transcribing the tokens consumed by a matcher (and cloning the `TtReader` once per matcher), which improves expansion performance of the test case from #34630 by ~8%. r? @nrc
2016-10-19Rollup merge of #37202 - petrochenkov:pretty, r=nrcEduard-Mihai Burtescu-34/+45
Fix some pretty printing tests Many pretty-printing tests are un-ignored. Some issues in classification of comments (trailing/isolated) and blank line counting are fixed. Some comments are printed more carefully. Some minor refactoring in pprust.rs `no-pretty-expanded` annotations are removed because this is the default now. `pretty-expanded` annotations are removed from compile-fail tests, they are not tested with pretty-printer. Closes https://github.com/rust-lang/rust/issues/23623 in favor of more specific https://github.com/rust-lang/rust/issues/37201 and https://github.com/rust-lang/rust/issues/37199 r? @nrc
2016-10-19Rollup merge of #37198 - jseyfried:future_proof_macros_11, r=nrcEduard-Mihai Burtescu-7/+30
macros 1.1: future proofing and cleanup This PR - uses the macro namespace for custom derives (instead of a dedicated custom derive namespace), - relaxes the shadowing rules for `#[macro_use]`-imported custom derives to match the shadowing rules for ordinary `#[macro_use]`-imported macros, and - treats custom derive `extern crate`s like empty modules so that we can eventually allow, for example, `extern crate serde_derive; use serde_derive::Serialize;` backwards compatibly. r? @alexcrichton
2016-10-19Rollup merge of #37161 - nnethercote:no-cfg-cloning, r=nrcEduard-Mihai Burtescu-11/+15
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
2016-10-19Rollup merge of #37117 - pnkfelix:may-dangle-attr, r=nikomatsakisEduard-Mihai Burtescu-0/+11
`#[may_dangle]` attribute `#[may_dangle]` attribute Second step of #34761. Last big hurdle before we can work in earnest towards Allocator integration (#32838) Note: I am not clear if this is *also* a syntax-breaking change that needs to be part of a breaking-batch.
2016-10-19Allow bootstrapping without a key. Fixes #36548Brian Anderson-9/+6
This will make it easier for packagers to bootstrap rustc when they happen to have a bootstrap compiler with a slightly different version number. It's not ok for anything other than the build system to set this environment variable.
2016-10-18Add invalid doc comment help messageGuillaume Gomez-8/+17
2016-10-18Fix some pretty printing testsVadim Petrochenkov-34/+45
2016-10-17Auto merge of #36969 - nnethercote:rename-Parser-fields, r=eddybbors-403/+402
Clarify the positions of the lexer and parser The lexer and parser use unclear names to indicate their positions in the source code. I propose the following renamings. Lexer: ``` pos -> next_pos # it's actually the next pos! last_pos -> pos # it's actually the current pos! curr -> ch # the current char curr_is -> ch_is # tests the current char col (unchanged) # the current column ``` parser ``` - last_span -> prev_span # the previous token's span - last_token_kind -> prev_token_kind # the previous token's kind - LastTokenKind -> PrevTokenKind # ditto (but the type) - token (unchanged) # the current token - span (unchanged) # the current span ``` Things to note: - This proposal removes all uses of "last", which is an unclear word because it could mean (a) previous, (b) final, or (c) most recent, i.e. current. - The "current" things (ch, col, token, span) consistently lack a prefix. The "previous" and "next" things consistently have a prefix.
2016-10-17prefer `if let` to match with `None => { }` arm in some placesZack M. Davis-7/+4
In #34268 (8531d581), we replaced matches of None to the unit value `()` with `if let`s in places where it was deemed that this made the code unambiguously clearer and more idiomatic. In #34638 (d37edef9), we did the same for matches of None to the empty block `{}`. A casual observer, upon seeing these commits fly by, might suppose that the matter was then settled, that no further pull requests on this utterly trivial point of style could or would be made. Unless ... It turns out that sometimes people write the empty block with a space in between the braces. Who knew?
2016-10-17Fix partially consumed tokens in macro matchers.Jeffrey Seyfried-15/+38
2016-10-15Use the macro namespace for custom derives.Jeffrey Seyfried-3/+16
2016-10-15Refactor `syntax::ext::base::Resolver::resolve_invoc`.Jeffrey Seyfried-4/+14
2016-10-15Auto merge of #37132 - petrochenkov:intern, r=alexcrichtonbors-35/+18
Get rid of double indirection in string interner
2016-10-14Avoid many CrateConfig clones.Nicholas Nethercote-11/+15
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.
2016-10-13Get rid of double indirection in string interner by using `Rc<str>`Vadim Petrochenkov-35/+18
2016-10-12Rollup merge of #37084 - jseyfried:cleanup_expanded_macro_use_scopes, r=nrcAlex Crichton-71/+71
macros: clean up scopes of expanded `#[macro_use]` imports This PR changes the scope of macro-expanded `#[macro_use]` imports to match that of unexpanded `#[macro_use]` imports. For example, this would be allowed: ```rust example!(); macro_rules! m { () => { #[macro_use(example)] extern crate example_crate; } } m!(); ``` This PR also enforces the full shadowing restrictions from RFC 1560 on `#[macro_use]` imports (currently, we only enforce the weakened restrictions from #36767). This is a [breaking-change], but I believe it is highly unlikely to cause breakage in practice. r? @nrc
2016-10-12Rollup merge of #37064 - nnethercote:read_str, r=eddybAlex Crichton-2/+2
Avoid allocations in `Decoder::read_str`. `opaque::Decoder::read_str` is very hot within `rustc` due to its use in the reading of crate metadata, and it currently returns a `String`. This commit changes it to instead return a `Cow<str>`, which avoids a heap allocation. This change reduces the number of calls to `malloc` by almost 10% in some benchmarks. This is a [breaking-change] to libserialize.
2016-10-12Rollup merge of #36995 - nrc:stable, r=@nikomatsakisAlex Crichton-10/+5
stabilise ?, attributes on stmts, deprecate Reflect r? @nikomatsakis
2016-10-12Stabilise attributes on statements.Nick Cameron-3/+2
Note that attributes on expressions are still unstable and are behind the `stmt_expr_attributes` flag. cc [Tracking issue](https://github.com/rust-lang/rust/issues/15701)
2016-10-12Stabilise `?`Nick Cameron-7/+3
cc [`?` tracking issue](https://github.com/rust-lang/rust/issues/31436)
2016-10-11Rollup merge of #37065 - nnethercote:opt-mk_printer, r=nikomatsakisGuillaume Gomez-38/+31
Merge `Printer::token` and `Printer::size`. Logically, it's a vector of pairs, so might as well represent it that way. The commit also changes `scan_stack` so that it is initialized with the default size, instead of the excessive `55 * linewidth` size, which it usually doesn't get even close to reaching.
2016-10-11Add feature gate for `dropck_eyepatch` feature (RFC 1327).Felix S. Klock II-0/+8
2016-10-11Add support for undetermined macro invocations.Jeffrey Seyfried-6/+37
2016-10-11Merge branch 'persistent_macro_scopes' into cleanup_expanded_macro_use_scopesJeffrey Seyfried-65/+34
2016-10-10Include attributes on generic parameter bindings in pretty printer.Felix S. Klock II-0/+3
2016-10-10Merge `Printer::token` and `Printer::size`.Nicholas Nethercote-38/+31
Logically, it's a vector of pairs, so might as well represent it that way. The commit also changes `scan_stack` so that it is initialized with the default size, instead of the excessive `55 * linewidth` size, which it usually doesn't get even close to reaching.
2016-10-10Avoid allocations in `Decoder::read_str`.Nicholas Nethercote-2/+2
`opaque::Decoder::read_str` is very hot within `rustc` due to its use in the reading of crate metadata, and it currently returns a `String`. This commit changes it to instead return a `Cow<str>`, which avoids a heap allocation. This change reduces the number of calls to `malloc` by almost 10% in some benchmarks. This is a [breaking-change] to libserialize.
2016-10-07Cleanup `depth`s.Jeffrey Seyfried-8/+11
2016-10-07Refactor away `ext::expand::{expand_crate, expand_crate_with_expander}`.Jeffrey Seyfried-31/+10
2016-10-07Add macros from plugins in `libsyntax_ext::register_builtins`.Jeffrey Seyfried-14/+5
2016-10-07Combine `std_inject::{no_core, no_std}` into `std_inject::injected_crate_name`.Jeffrey Seyfried-18/+14
2016-10-07Auto merge of #36945 - alexcrichton:proc-macro-rename, r=nrcbors-7/+7
rustc: Rename rustc_macro to proc_macro This commit blanket renames the `rustc_macro` infrastructure to `proc_macro`, which reflects the general consensus of #35900. A follow up PR to Cargo will be required to purge the `rustc-macro` name as well.
2016-10-06rustc: Rename rustc_macro to proc_macroAlex Crichton-7/+7
This commit blanket renames the `rustc_macro` infrastructure to `proc_macro`, which reflects the general consensus of #35900. A follow up PR to Cargo will be required to purge the `rustc-macro` name as well.
2016-10-05Clarify StringReader::bump.Nicholas Nethercote-13/+16
This commit renames the variables to make it clearer which char each one refers to. It also slightly reorders and rearranges some statements.
2016-10-05Rename StringReader::curr as ch.Nicholas Nethercote-99/+99
Likewise, rename StringReader::curr_is as ch_is. This is a [breaking-change] for libsyntax.
2016-10-05Rename StringReader::last_pos as pos.Nicholas Nethercote-100/+100
This is a [breaking-change] for libsyntax.