| Age | Commit message (Collapse) | Author | Lines |
|
|
|
Move retokenize hack to save_analysis
closes #76046
|
|
|
|
Move doc comment parsing to rustc_lexer
Plain comments are trivia, while doc comments are not, so it feels
like this belongs to the rustc_lexer.
The specific reason to do this is the desire to use rustc_lexer in
rustdoc for syntax highlighting, without duplicating "is this a doc
comment?" logic there.
r? @ghost
|
|
All other tokens are named by the punctuation they use, rather than
by semantics operation they stand for. `!` is the only exception to
the rule, let's fix it.
|
|
Outer `if` is the fast path -- it calls into hyperoptimized memchr.
The inner loop is just the simplest code possible -- it doesn't
generated the tightest code, but that shouldn't matter if we are going
to error anyhow.
|
|
Plain comments are trivial, while doc comments are not, so it feels
like this belongs to the rustc_lexer.
The specific reason to do this is the desire to use rustc_lexer in
rustdoc for syntax highlighting, without duplicating "is this a doc
comment?" logic there.
|
|
|
|
|
|
Explicitly store their kind and style retrieved during lexing in the token
|
|
|
|
|
|
|
|
|
|
Fix more clippy warnings
Fixes more of:
clippy::unused_unit
clippy::op_ref
clippy::useless_format
clippy::needless_return
clippy::useless_conversion
clippy::bind_instead_of_map
clippy::into_iter_on_ref
clippy::redundant_clone
clippy::nonminimal_bool
clippy::redundant_closure
clippy::option_as_ref_deref
clippy::len_zero
clippy::iter_cloned_collect
clippy::filter_next
r? @Dylan-DPC
|
|
|
|
Fixes more of:
clippy::unused_unit
clippy::op_ref
clippy::useless_format
clippy::needless_return
clippy::useless_conversion
clippy::bind_instead_of_map
clippy::into_iter_on_ref
clippy::redundant_clone
clippy::nonminimal_bool
clippy::redundant_closure
clippy::option_as_ref_deref
clippy::len_zero
clippy::iter_cloned_collect
clippy::filter_next
|
|
|
|
an outdated FIXME.
|
|
This makes `UnvalidatedRawStr` and `ValidatedRawStr` unnecessary and removes 70 lines.
|
|
Julian-Wollersberger:literal_error_reporting_cleanup, r=petrochenkov
Literal error reporting cleanup
While doing some performance work, I noticed some code duplication in `librustc_parser/lexer/mod.rs`, so I cleaned it up.
This PR is probably best reviewed commit by commit.
I'm not sure what the API stability practices for `librustc_lexer` are. Four public methods in `unescape.rs` can be removed, but two are used by clippy, so I left them in for now.
I could open a PR for Rust-Analyzer when this one lands.
But how do I open a PR for clippy? (Git submodules are frustrating to work with)
|
|
|
|
method `validate_literal_escape` with a mode argument.
This enables simplifying the `match` in `cook_lexer_literal()`
and it eliminates 90 lines of repetition :)
|
|
|
|
Confusing suggestion on incorrect closing `}`
Compiler returns
```
error: unexpected closing delimiter: `}`
--> main.rs:20:1
|
9 | ErrorHandled::Reported => {}
| -- this block is empty, you might have not meant to close it temp
...
20 | }
| ^ unexpected closing delimiter
error: aborting due to previous error
```
|
|
|
|
|
|
|
|
|
|
properly closed block.
|
|
Improve error messages for raw strings (#60762)
This diff improves error messages around raw strings in a few ways:
- Catch extra trailing `#` in the parser. This can't be handled in the lexer because we could be in a macro that actually expects another # (see test)
- Refactor & unify error handling in the lexer between ByteStrings and RawByteStrings
- Detect potentially intended terminators (longest sequence of "#*" is suggested)
Fixes #60762
cc @estebank who reviewed the original (abandoned) PR for the same ticket.
r? @Centril
|
|
delimiter #70583"
This reverts commit 811d817eaf5d78522773ab9d21543629027e4ecb.
|
|
|
|
Made obsolete by b5e35b128efeed4bfdb4b1ee9d0697389ec9f164
|
|
|
|
This diff improves error messages around raw strings in a few ways:
- Catch extra trailing `#` in the parser. This can't be handled in the lexer because we could be in a macro that actually expects another # (see test)
- Refactor & unify error handling in the lexer between ByteStrings and RawByteStrings
- Detect potentially intended terminators (longest sequence of "#*" is suggested)
|
|
couple more clippy fixes (let_and_return, if_same_then_else)
* summarize if-else-code with identical blocks (clippy::if_same_then_else)
* don't create variable bindings just to return the bound value immediately (clippy::let_and_return)
|
|
(clippy::let_and_return)
|
|
|
|
|
|
|
|
|
|
Create E0747 error code for unterminated raw strings
Reopening of #66035.
r? @estebank
|
|
|
|
|
|
r=Mark-Simulacrum
don't use .into() to convert types into identical types.
This removes redundant `.into()` calls.
example: `let s: String = format!("hello").into();`
|
|
example:
let s: String = format!("hello").into();
|
|
|
|
Caller now passes in a `decorate` function, which is only run if the
lint is allowed.
|
|
|