| Age | Commit message (Collapse) | Author | Lines |
|
also move MACRO_ARGUMENTS -> librustc_parse
|
|
|
|
|
|
|
|
|
|
`Span` cannot represent `span.hi < span.lo`
So we can remove the corresponding checks from various code
|
|
So we can remove the corresponding checks from various code
|
|
When in a file with a non-terminated item, catch the error and consume
the block instead of trying to recover it more granularly in order to
reduce the amount of unrelated errors that would be fixed after adding
the missing closing brace. Also point out the possible location of the
missing closing brace.
|
|
|
|
|
|
|
|
Normalize newlines when loading files
Fixes #62865
|
|
For consistency with `ExpnId::root`.
Also introduce a helper `Span::with_root_ctxt` for creating spans with `SyntaxContext::root()` context
|
|
|
|
|
|
|
|
|
|
|
|
Few other minor renamings for consistency.
Remove one unused dependency from `rustc_passes`.
Fix libsyntax tests.
Fix rebase.
|
|
|
|
|
|
move unescape module to rustc_lexer
It makes sense to keep the definition of escape sequences closer to the lexer itself, and it is also a bit of code that I would like to share with rust-analyzer.
r? @petrochenkov
|
|
closes #62863
|
|
|
|
The idea here is to make a reusable library out of the existing
rust-lexer, by separating out pure lexing and rustc-specific concerns,
like spans, error reporting an interning.
So, rustc_lexer operates directly on `&str`, produces simple tokens
which are a pair of type-tag and a bit of original text, and does not
report errors, instead storing them as flags on the token.
|
|
https://github.com/rust-lang/rust/issues/60532
|
|
They always end up interned anyway
|
|
Remove support for 1-token lookahead from the lexer
`StringReader` maintained `peek_token` and `peek_span_src_raw` for look ahead.
`peek_token` was used only by rustdoc syntax coloring. After moving peeking logic into highlighter, I was able to remove `peek_token` from the lexer. I tried to use `iter::Peekable`, but that wasn't as pretty as I hoped, due to buffered fatal errors. So I went with hand-rolled peeking.
After that I've noticed that the only peeking behavior left was for raw tokens to test tt jointness. I've rewritten it in terms of trivia tokens, and not just spans.
After that it became possible to simplify the awkward constructor of the lexer, which could return `Err` if the first peeked token contained error.
|
|
Move `async || ...` closures into `#![feature(async_closure)]`
The `async || expr` syntax is moved out from `#![feature(async_await)]` into its own gate `#![feature(async_closure)]`.
New tracking issue: https://github.com/rust-lang/rust/issues/62290
Closes https://github.com/rust-lang/rust/issues/62214.
cc https://github.com/rust-lang/rust/issues/62149
r? @varkor
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The reader itself doesn't need ability to peek tokens, so it's better
if clients implement this functionality.
This hopefully becomes especially easy once we use iterator interface
for lexer, but this is not too easy at the moment, because of buffered
errors.
|
|
refactor check_for_substitution
No behavior change, just flatter and simpler code.
r? @petrochenkov
|
|
|
|
No behavior change, just flatter and simpler code
|
|
Lexer uses Symbols for a lot of stuff, not only for identifiers, so
the "name" terminology is just confusing.
|
|
|
|
|
|
Allow attributes in formal function parameters
Implements https://github.com/rust-lang/rust/issues/60406.
This is my first contribution to the compiler and since this is a large and complex project, I am not fully aware of the consequences of the changes I have made.
**TODO**
- [x] Forbid some built-in attributes.
- [x] Expand cfg/cfg_attr
|
|
lexer: Disallow bare CR in raw byte strings
Handles bare CR ~but doesn't translate `\r\n` to `\n` yet in raw strings yet~ and translates CRLF to LF in raw strings.
As a side-note I think it'd be good to change the `unescape_` to return plain iterators to reduce some boilerplate (e.g. `has_error` could benefit from collecting `Result<T>` and aborting early on errors) but will do that separately, unless I missed something here that prevents it.
@matklad @petrochenkov thoughts?
|
|
|
|
|
|
|
|
|