| Age | Commit message (Collapse) | Author | Lines |
|
|
|
Change multiple functions to be non-public.
Change nameize to accept an iterator so as to avoid an allocation.
|
|
|
|
|
|
|
|
|
|
Also makes nameize non-public since it's only locally used.
|
|
|
|
data_structures::SmallVec.
|
|
Don't spin expanding stmt macros.
If we can't make progress when parsing a macro expansion as a statement then we should just bail.
This alleviates the symptoms shown in e.g. #37113 and #37234 but it doesn't fix the problem that parsing invalid enum bodies (and others) leaves the parser in a crappy state.
I'm not sold on this strategy (checking `tokens_consumed`), so if anyone has a better idea, I'm all ears!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This reverts commit 41745f30f751364bdce14428b7d3ffa5dd028903.
|
|
`Token::Interpolated(Nonterminal)` -> `Token::Interpolated(Rc<Nonterminal>)`.
|
|
Most of the Rust community agrees that the vec! macro is clearer when
called using square brackets [] instead of regular brackets (). Most of
these ocurrences are from before macros allowed using different types of
brackets.
There is one left unchanged in a pretty-print test, as the pretty
printer still wants it to have regular brackets.
|
|
|
|
Avoid more allocations when compiling html5ever
These three commits reduce the number of allocations performed when compiling html5ever from 13.2M to 10.8M, which speeds up compilation by about 2%.
r? @nrc
|
|
If we can't make progress when parsing a macro expansion as a statement
then we should just bail.
This alleviates the symptoms shown in e.g. #37113 but it doesn't fix the
problem that parsing invalid enum bodies (and others) leaves the parser
in a crappy state.
|
|
|
|
This avoids 800,000 allocations when compiling html5ever.
|
|
This avoids 800,000 heap allocations when compiling html5ever. It
requires tweaking `SmallVector` a little.
|
|
This avoids 800,000 heap allocations when compiling html5ever.
|
|
|
|
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 lets us delay creation of failure messages until they are needed,
which avoids ~1.6M allocations in html5ever.
|
|
This avoids ~800,000 allocations in html5ever.
|
|
This avoids ~800,000 allocations in html5ever.
|
|
|
|
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
|
|
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
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.
|
|
Enforce the shadowing restrictions from RFC 1560 for today's macros
This PR enforces a weakened version of the shadowing restrictions from RFC 1560. More specifically,
- If a macro expansion contains a `macro_rules!` macro definition that is used outside of the expansion, the defined macro may not shadow an existing macro.
- If a macro expansion contains a `#[macro_use] extern crate` macro import that is used outside of the expansion, the imported macro may not shadow an existing macro.
This is a [breaking-change]. For example,
```rust
macro_rules! m { () => {} }
macro_rules! n { () => {
macro_rules! m { () => {} } //< This shadows an existing macro.
m!(); //< This is inside the expansion that generated `m`'s definition, so it is OK.
} }
n!();
m!(); //< This use of `m` is outside the expansion, so it causes the shadowing to be an error.
```
r? @nrc
|
|
|
|
`u32`.
|
|
First step for #34761
|
|
This commit makes the return type of AstBuilder.stmt_let_typed match the return type of other AstBuilder.stmt* functions. This avoids unnecessary boxing/unboxing whenever Stmt's are stored in a Vec, which is the default use case.nnThis is a potentially plugin breaking change.
|