Skip to content

expected expression, found .. #105634

@CAD97

Description

@CAD97

Given the following code:

let _ = &..;

The current output is:

error: expected expression, found `..`
 --> src/main.rs:2:14
  |
2 |     let _ = &..;
  |              ^^ expected expression

.. is a valid expression (a RangeFull literal), so this error is misleading. It should at a minimum have a suggestion to replace with the valid version &(..), and probably should just work. It also imho ideally shouldn't be a hard parser error blocking semantic passes; the parse of &(..) is fairly unambiguously intended, even if we decide we should still require the parenthesis.

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.relnotesMarks issues that should be documented in the release notes of the next release.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions