| Age | Commit message (Collapse) | Author | Lines |
|
r=michaelwoerister
Add stream_to_parser_with_base_dir
This PR adds `stream_to_parser_with_base_dir`, which creates a parser from a token stream and a base directory.
Context: I would like to parse `cfg_if!` macro and get a list of modules defined inside it from rustfmt so that rustfmt can format those modules (cc https://github.com/rust-lang/rustfmt/issues/3253). To do so, I need to create a parser from `TokenStream` and set the directory of `Parser` to the same directory as the parent directory of a file which contains `cfg_if!` invocation. AFAIK there is no way to achieve this, and hence this PR.
Alternatively, I could change the visibility of `Parser.directory` from `crate` to `pub` so that the value can be modified after initializing a parser. I don't have a preference over either approach (or others, as long as it works).
|
|
|
|
|
|
|
|
r=petrochenkov
Move gensym operations from `Symbol` to `Ident`
Gensyms are always at the `Ident` level, and long-term we probably want to record gensym-ness in hygiene data.
r? @petrochenkov
|
|
|
|
rustc: Improve type size assertions
Now they
- Tell what the new size is, when it changes
- Do not require passing an identifier
```
::: src\libsyntax\parse\token.rs:223:1
|
223 | static_assert_size!(Token, 123);
| -------------------------------- in this macro invocation
|
= note: expected type `[(); 123]`
found type `[(); 16]`
```
|
|
Fix incremental compilation of cdylib emitting spurious unused_attributes lint
fixes #60050
|
|
|
|
|
|
Note that the `is_gensymed` call on `primitive_types` is unnecessary
because that table only contains the name of primitive types (e.g.
`i32`) and never contains gensyms.
|
|
Now they
- Tell what the new size is, when it changes
- Do not require passing an identifier
|
|
r=petrochenkov
Avoid some unnecessary interning
r? @petrochenkov
|
|
Handle more string addition cases with appropriate suggestions
|
|
A lot of these static symbols are pre-interned.
|
|
|
|
|
|
|
|
|
|
- Change wording of suggestion
- Move recovery logic to `diagnostics.rs`
- Reduce ammount of code duplication
|
|
|
|
|
|
|
|
Include expression to wait for to the span of Await
Currently the span of `await!` only includes itself:
```rust
await!(3);
// ^^^^^
```
This PR changes it so that the span holds the whole `await!` expression:
```rust
await!(3);
// ^^^^^^^^^
|
|
Move token tree related lexer state to a separate struct
Just a types-based refactoring.
We only used a bunch of fields when tokenizing into a token tree, so let's move them out of the base lexer
|
|
|
|
impl_trait_in_bindings is not yet complete and can lead to compiler crashes.
Fixes #60764.
|
|
See https://github.com/rust-lang/rust/pull/50838/files#r283296243 for
explanation how jointness checking works with *next* pair
|
|
|
|
We only used a bunch of fields when tokenizing into a token tree,
so let's move them out of the base lexer
|
|
Use `Symbol` more
A `Symbol` can be equated with a string (e.g. `&str`). This involves a
TLS lookup to get the chars (and a Mutex lock in a parallel compiler)
and then a char-by-char comparison. This functionality is convenient but
avoids one of the main benefits of `Symbol`s, which is fast equality
comparisons.
This PR removes the `Symbol`/string equality operations, forcing a lot
of existing string occurrences to become `Symbol`s. Fortunately, these
are almost all static strings (many are attribute names) and we can add
static `Symbol`s as necessary, and very little extra interning occurs.
The benefits are (a) a slight speedup (possibly greater in a parallel
compiler), and (b) the code is a lot more principled about `Symbol` use.
The main downside is verbosity, particularly with more `use
syntax::symbol::symbols` items.
r? @Zoxc
|
|
|
|
And also the equality between `Path` and strings, because `Path` is made
up of `Symbol`s.
|
|
|
|
Because it's going to be used a lot.
|
|
Rollup of 4 pull requests
Successful merges:
- #60694 (Fix HIR printing of existential type #60662)
- #60750 (syntax: Remove some legacy nonterminal tokens)
- #60751 (Assorted cleanup in parser & AST validation)
- #60752 (Fix minor typos for ItemLocalId)
Failed merges:
r? @ghost
|
|
Assorted cleanup in parser & AST validation
r? @petrochenkov
Extracted out of a larger PR.
|
|
|
|
|
|
|
|
|
|
|
|
Remove some dead code
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|