| Age | Commit message (Collapse) | Author | Lines |
|
|
|
|
|
expand: misc cleanups and simplifications
Some work I did while trying to understand expand for the purposes of https://github.com/rust-lang/rust/issues/64197.
r? @petrochenkov
|
|
as a consequence, `trait X { #![attr] }` becomes legal.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use new span for better diagnostics.
|
|
Hasten macro parsing
r? @eddyb
|
|
|
|
Caller now passes in a `decorate` function, which is only run if the
lint is allowed.
|
|
Towards unified `fn` grammar
Part of https://github.com/rust-lang/rust/pull/68728.
- Syntactically, `fn` items in `extern { ... }` blocks can now have bodies (`fn foo() { ... }` as opposed to `fn foo();`). As above, we use semantic restrictions instead.
- Syntactically, `fn` items in free contexts (directly in a file or a module) can now be without bodies (`fn foo();` as opposed to `fn foo() { ... }`. As above, we use semantic restrictions instead, including for non-ident parameter patterns.
- We move towards unifying the `fn` front matter; this is fully realized in https://github.com/rust-lang/rust/pull/68728.
r? @petrochenkov
|
|
This is a small win, because `Failure` is much more common than
`Success`.
|
|
The previous commit wrapped `Parser` within a `Cow` for the hot macro
parsing path. As a result, there's no need for the `Cow` within
`Directory`, because it lies within `Parser`.
|
|
Currently, every iteration of the main loop in `generic_extension`
instantiates a `Parser`, which is expensive because `Parser` is a large
type. Many of those instantiations are only used immutably, particularly
for simple-but-repetitive macros of the sort seen in `html5ever` and PR
68836.
This commit initializes a single "base" parser outside the loop, and
then uses `Cow` to avoid cloning it except for the mutating iterations.
This speeds up `html5ever` runs by up to 15%.
|
|
On suggesting `#![recursion_limit = "X"]`, note current crate name
This would have saved me much confusion e.g. when reading the log output in https://github.com/rust-lang/rust/pull/68788#issuecomment-581852191.
r? @estebank
|
|
|
|
also refactor `FnKind` and `visit_assoc_item` visitors
|
|
Fix 59191 - ICE when macro replaces crate root with non-module item
Hi,
This should fix #59191! My friend and I are working on learning the rustc codebase through contributions, so please feel free to mention anything amiss or that could be done better.
The code adds an explicit case for when a macro applied to the crate root (via an inner attribute) replaces it with something nonsensical, like a function. The crate root must be a module, and the error message reflects this.
---
I should note that there are a few other weird edge cases here, like if they do output a module, it succeeds but uses that module's name as a prefix for all names in the crate. I'm assuming that's an issue for stabilizing #54726, though.
|
|
Changes the error handler for inner attributes that replace the root
with a non-module. Previously it would emit a fatal error. It now emits
an empty expasion and a non-fatal error like the existing handler for a
failed expansion.
|
|
This adds an explicit error for when macros replace the crate root with
a non-module item.
|
|
|
|
|
|
2. invert rustc_session & syntax deps
3. drop rustc_session dep in rustc_hir
|
|
For now, this is all the crate contains, but more
attribute logic & types will be moved there over time.
|
|
|
|
|
|
This commit reduces the size of `Nonterminal` from a 72 bytes to 40 bytes (on
x86-64).
|
|
This commit reduces the size of `Nonterminal` from a whopping 240 bytes
to 72 bytes (on x86-64), which gets it below the `memcpy` threshold.
It also removes some impedance mismatches with `Annotatable`, which
already uses `P` for these variants.
|
|
|
|
This reverts commit fd4a6a12136c5b5d6bce4081e95890df1fd1febd.
|
|
Do not ICE on unicode next point
Use `shrink_to_hi` instead of `next_point` and fix `next_point`.
Fix #68000, fix #68091, fix #68092.
|
|
|
|
|
|
|
|
|
|
|
|
This is used for both the `?const` syntax in bounds as well as the `impl
const Trait` syntax. I also considered handling these separately by
adding a variant of `TraitBoundModifier` and a field to
`ItemKind::Impl`, but this approach was less intrusive.
|
|
libstd uses `core::panic::Location` where possible.
cc @eddyb
|
|
|
|
|
|
|
|
|
|
|
|
parser: reduce diversity in error handling mechanisms
Instead of having e.g. `span_err`, `fatal`, etc., we prefer to move towards uniformly using `struct_span_err` thus making it harder to emit fatal and/or unstructured diagnostics.
This PR also de-fatalizes some diagnostics.
r? @estebank
|
|
|