| Age | Commit message (Collapse) | Author | Lines |
|
|
|
Account for `maybe_whole_expr` in range patterns
Fixes https://github.com/rust-lang/rust/issues/63115 (fallout from https://github.com/rust-lang/rust/pull/62550).
r? @petrochenkov
|
|
Syntax: Recover on `for ( $pat in $expr ) $block`
Fixes #62724 by adding some recovery:
```
error: unexpected closing `)`
--> $DIR/recover-for-loop-parens-around-head.rs:10:23
|
LL | for ( elem in vec ) {
| --------------^
| |
| opening `(`
| help: remove parenthesis in `for` loop: `elem in vec`
```
The last 2 commits are drive-by cleanups.
r? @estebank
|
|
|
|
Avoid ICE when suggestion span is at Eof
Fix #62973.
|
|
|
|
Implement RFC 2707 + Parser recovery for range patterns
Implement https://github.com/rust-lang/rfcs/pull/2707.
- Add a new basic syntactic pattern form `ast::PatKind::Rest` (parsed as `..` or `DOTDOT`) and simplify `ast::PatKind::{Slice, Tuple, TupleStruct}` as a result.
- Lower `ast::PatKind::Rest` in combination with the aforementioned `PatKind` variants as well as `PatKind::Ident`. The HIR remains unchanged for now (may be advisable to make slight adjustments later).
- Refactor `parser.rs` wrt. parsing sequences and lists of things in the process.
- Add parser recovery for range patterns of form `X..`, `X..=`, `X...`, `..Y`, `..=Y`, and `...Y`.
This should make it easy to actually support these patterns semantically later if we so desire.
cc https://github.com/rust-lang/rust/issues/62254
r? @petrochenkov
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Allow lexer to recover from some homoglyphs
|
|
|
|
Make the parser TokenStream more resilient after mismatched delimiter recovery
Fix #62881, fix #62895.
|
|
|
|
Always emit trailing slash error
Fix #62913.
r? @petrochenkov
|
|
|
|
|
|
Handle more cases of typos misinterpreted as type ascription
Fix #60933, #54516.
CC #47666, #34255, #48016.
|
|
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
|
|
fakenine:normalize_use_of_backticks_compiler_messages_p6, r=eddyb
normalize use of backticks in compiler messages for libsyntax/parse
https://github.com/rust-lang/rust/issues/60532
|
|
Fix #62660
If the explicitly given type of a `self` parameter fails to parse correctly, we need to propagate the error rather than dropping it and causing an ICE.
Fixes #62660.
|
|
https://github.com/rust-lang/rust/issues/60532
|
|
Do not emit type errors after parse error in last statement of block
When recovering from a parse error inside a block, do not emit type
errors generating on that block's recovered return expression.
Fix #57383.
|
|
If the explicitly given type of a `self` parameter fails to parse correctly,
we need to propagate the error rather than dropping it and causing an ICE.
Fixes #62660.
|
|
When recovering from a parse error inside a block, do not emit type
errors generating on that block's recovered return expression.
Fix #57383.
|
|
|
|
https://github.com/rust-lang/rust/issues/60532
|
|
Migrate `compile-pass` annotations to `build-pass`
This is a part of #62277.
As a first step, the `compile-pass` tests are migrated to `build-pass`.
r? @cramertj
cc @Centril
|
|
|
|
Unreserve `macro_rules` as a macro name
|
|
|
|
Stabilize underscore_const_names in 1.37.0
You are now permitted to write:
```rust
const _: $type_expression = $term_expression;
```
That is, we change the [grammar of items](https://github.com/rust-lang-nursery/wg-grammar/blob/9d1984d7ae8d6576f943566539a31a5800644c57/grammar/item.lyg#L3-L42), as written in [the *`.lyg`* notation](https://github.com/rust-lang/gll/tree/263bf161dad903e67aa65fc591ced3cab18afa2a#grammar), from:
```java
Item = attrs:OuterAttr* vis:Vis? kind:ItemKind;
ItemKind =
| ...
| Const:{ "const" name:IDENT ":" ty:Type "=" value:Expr ";" }
| ...
;
```
into:
```java
Item = attrs:OuterAttr* vis:Vis? kind:ItemKind;
ItemKind =
| ...
| Const:{ "const" name:IdentOrUnderscore ":" ty:Type "=" value:Expr ";" }
| ...
;
IdentOrUnderscore =
| Named:IDENT
| NoName:"_"
;
```
r? @petrochenkov
|
|
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?
|
|
|