Skip to content

Provide suggestion on missing let in binding statement - #100111

Merged
bors merged 1 commit into
rust-lang:masterfrom
estebank:missing-let
Aug 4, 2022
Merged

Provide suggestion on missing let in binding statement#100111
bors merged 1 commit into
rust-lang:masterfrom
estebank:missing-let

Conversation

@estebank

@estebankestebank commented Aug 3, 2022

Copy link
Copy Markdown
Contributor

Fix#78907.

Fallout from the type ascription syntax.

@rust-highfive

Copy link
Copy Markdown
Contributor

r? @petrochenkov

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfiverust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 3, 2022
@estebank

Copy link
Copy Markdown
ContributorAuthor

r? @compiler-errors

@compiler-errors

Copy link
Copy Markdown
Contributor

Only side-effect is that now type ascription in LHS will fail during AST validation phase instead of later (I'm guessing AST lowering?). But that's fine, an error will be emitted regardless.

I wonder if we should just gate all type ascription behind a feature error during ast validation, but that might have some strange consequences on diagnostics.

@bors r+

@bors

bors commented Aug 3, 2022

Copy link
Copy Markdown
Collaborator

📌 Commit 939c2b6 has been approved by compiler-errors

It is now in the queue for this repository.

@borsbors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 3, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Aug 3, 2022
…rrors
Provide suggestion on missing `let` in binding statement
Fixrust-lang#78907.
Fallout from the type ascription syntax.
This was referenced Aug 3, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 4, 2022
…iaskrgr
Rollup of 9 pull requests
Successful merges:
- rust-lang#98877 (Set llvm configs when building lld)
- rust-lang#100068 (Fix backwards-compatibility check for tests with `+whole-archive`)
- rust-lang#100083 (rustdoc: use a more compact encoding for source-files.js)
- rust-lang#100102 (Fix typo)
- rust-lang#100104 (Remove more Clean trait implementations)
- rust-lang#100105 (Add regression test for rust-lang#90871)
- rust-lang#100107 (fix trailing whitespace in error message)
- rust-lang#100111 (Provide suggestion on missing `let` in binding statement)
- rust-lang#100119 (FilesTimes support does not build for ESP-IDF)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
@bors
bors merged commit d4bd4ae into rust-lang:masterAug 4, 2022
@rustbotrustbot added this to the 1.64.0 milestone Aug 4, 2022
@estebank

Copy link
Copy Markdown
ContributorAuthor

Only side-effect is that now type ascription in LHS will fail during AST validation phase instead of later (I'm guessing AST lowering?). But that's fine, an error will be emitted regardless.

This is already the case, in fn check_expr the same check already exists, this precludes it (due to the check for prior errors) by emitting earlier, while evaluating the statement.

I wonder if we should just gate all type ascription behind a feature error during ast validation, but that might have some strange consequences on diagnostics.

I've thought about doing so. The problem with doing that for features that affect the syntax is that then we'd never exercise those codepaths as much as we have these, which would make the stabilization process much more traumatic in the regressions caused. That being said, type ascription has no quick path to stabilization, so that's what we should have done back in 2015. Now, I feel we've sunk enough resources in handling most of these that I'm ok with it remaining as is (and even try to stabilize it!), but damn if I don't hate this syntax for its proximity to other valid syntax!.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Detect type ascription use that should be let assignment

6 participants

@estebank@rust-highfive@compiler-errors@bors@petrochenkov@rustbot