| Age | Commit message (Collapse) | Author | Lines |
|
Clean up span in non-trailing `..` suggestion
|
|
Suggest appropriate place for lifetime when declared after type arguments
|
|
`Printer::word` takes a `&str` and converts it into a `String`, which
causes an allocation. But that allocation is rarely necessary, because
`&str` is almost always a `&'static str` or a `String` that won't be
used again.
This commit changes `Token::String` so it holds a `Cow<'static, str>`
instead of a `String`, which avoids a lot of allocations.
|
|
|
|
|
|
Use per-span hygiene in a few other places in resolve
Prefer `rust_2015`/`rust_2018` helpers to comparing editions
|
|
|
|
|
|
|
|
fix #55972: Erroneous self arguments on bare functions emit subpar compilation error
#55972
r? @estebank
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This avoids a moderately hot allocation in `parse_lit_token`.
|
|
Use `Lit` rather than `P<Lit>` in `ast::ExprKind`.
Because it results in fewer allocations and small speedups on some
benchmarks.
|
|
Because it results in fewer allocations and small speedups on some
benchmarks.
|
|
refactor: use shorthand fields
refactor: use shorthand for single fields everywhere (excluding tests).
|
|
|
|
Custom diagnostic when trying to doc comment argument
When writing
```
pub fn f(
/// Comment
id: u8,
) {}
```
Produce a targeted diagnostic
```
error: documentation comments cannot be applied to method arguments
--> $DIR/fn-arg-doc-comment.rs:2:5
|
LL | /// Comment
| ^^^^^^^^^^^ doc comments are not allowed here
```
Fix #54801.
|
|
Use token description in "expected/found" parse messages
Fix #54309.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Before parsing argument names and types, try to consume an incorrectly
included doc comment or attribute in order to recover and continue
parsing the rest of the fn definition.
|
|
Fix ordering of nested modules in non-mod.rs mods
Flatten relative offset into directory path before adding inline
(mod x { ... }) module names to the current directory path.
Fix #55094
|
|
Primarily refactoring `(Ident, Option<NodeId>)` to `Segment`
|
|
|
|
|
|
Flatten relative offset into directory path before adding inline
(mod x { ... }) module names to the current directory path.
Fix #55094
|
|
Issue: 54912
|
|
Remove incorrect span for second label inner macro invocation
A fix for issue #54841
|
|
r=nikomatsakis
Fix #54707 - parse_trait_item_ now handles interpolated blocks as function body decls
Fix #54707 - parse_trait_item_ now handles interpolated blocks as function body decls
Previously parsing trait items only handled opening brace token and semicolon, I added a branch to the match statement that will also handle interpolated blocks.
|
|
Fixes #47311.
r? @nrc
|
|
Fixes #47311.
r? @nrc
|
|
|
|
|
|
Issue: 54379
|
|
Does not implement the warning or a feature flag.
|
|
make `Parser::parse_foreign_item()` return a foreign item or error
Fixes `Parser::parse_foreign_item()` to follow the convention of `parse_trait_item()` and `parse_impl_item()` in that it *must* parse an item or return an error, and then the caller is responsible for detecting the closing delimiter.
This prevents it from looping endlessly on an unexpected token in `ext/expand.rs` where it was also leaking memory by continually pushing to `Parser::expected_tokens` via `Parser::check_keyword()`.
closes #54441
r? @petrochenkov
cc @dtolnay
|
|
Fixes #54065.
|
|
closes #54441
|
|
Track whether module declarations are inline (fixes #12590)
To track whether module declarations are inline I added a field `inline: bool` to `ast::Mod`. The main use case is for pretty to know whether it should render the items associated with the module, but perhaps there are use cases for this information to not be forgotten in the AST.
|
|
Fixes the off-by-one span issue where closure argument spans were
pointing to the token after the argument.
|
|
parser: Tweak function parameter parsing to avoid rollback on succesfull path
Since rollback is not perfect and may e.g. leave non-fatal errors after it, we need to make sure compilation fails if it happens.
So in particular case of `fn parse_arg_general` we need to parse the "good" `TYPE` first and only then rollback and recover erroneous `PAT: TYPE` if necessary.
Found when working on https://github.com/rust-lang/rfcs/pull/2544#issuecomment-423293222.
r? @ghost
|