Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The ordinary lowering of thir::ExprKind::Let is unreachable #121892

Merged
merged 1 commit into from Mar 2, 2024

Conversation

Zalathar
Copy link
Contributor

@Zalathar Zalathar commented Mar 2, 2024

After desugaring, let expressions should only appear inside if expressions or match guards, possibly nested within a let-chain. In both cases they are specifically handled by the lowerings of those expressions, so this case is currently unreachable.


Context: https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Lowering.20of.20.60thir.3A.3AExprKind.3A.3ALet.60.20is.20unreachable

My conclusions are partly based on the observation that stubbing out this match arm doesn't cause any test failures. So either this really is unreachable, or it can be reached in some obscure circumstances that our test suite doesn't cover.

If we end up needing this code (or something like it) for an implementation of rust-lang/rfcs#3573, it should be easy enough to pull it back out of version control history.

I looked into having the if/match lowerings call back into expr_into_dest, but from what I can tell that won't work well, because there are extra scoping considerations that require some awareness of the enclosing if/match.

r? @Nadrieril

After desugaring, `let` expressions should only appear inside `if` expressions
or `match` guards, possibly nested within a let-chain. In both cases they are
specifically handled by the lowerings of those expressions, so this case is
currently unreachable.
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 2, 2024
@Nadrieril
Copy link
Contributor

LGTM!

@bors r+ rollup=always

@bors
Copy link
Contributor

bors commented Mar 2, 2024

📌 Commit 972d8da has been approved by Nadrieril

It is now in the queue for this repository.

@bors bors 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 Mar 2, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 2, 2024
The ordinary lowering of `thir::ExprKind::Let` is unreachable

After desugaring, `let` expressions should only appear inside `if` expressions or `match` guards, possibly nested within a let-chain. In both cases they are specifically handled by the lowerings of those expressions, so this case is currently unreachable.

---

Context: https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Lowering.20of.20.60thir.3A.3AExprKind.3A.3ALet.60.20is.20unreachable

My conclusions are partly based on the observation that stubbing out this match arm doesn't cause any test failures. So either this really is unreachable, or it can be reached in some obscure circumstances that our test suite doesn't cover.

If we end up needing this code (or something like it) for an implementation of rust-lang/rfcs#3573, it should be easy enough to pull it back out of version control history.

I looked into having the `if`/`match` lowerings call back into `expr_into_dest`, but from what I can tell that won't work well, because there are extra scoping considerations that require some awareness of the enclosing if/match.

r? `@Nadrieril`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 2, 2024
The ordinary lowering of `thir::ExprKind::Let` is unreachable

After desugaring, `let` expressions should only appear inside `if` expressions or `match` guards, possibly nested within a let-chain. In both cases they are specifically handled by the lowerings of those expressions, so this case is currently unreachable.

---

Context: https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Lowering.20of.20.60thir.3A.3AExprKind.3A.3ALet.60.20is.20unreachable

My conclusions are partly based on the observation that stubbing out this match arm doesn't cause any test failures. So either this really is unreachable, or it can be reached in some obscure circumstances that our test suite doesn't cover.

If we end up needing this code (or something like it) for an implementation of rust-lang/rfcs#3573, it should be easy enough to pull it back out of version control history.

I looked into having the `if`/`match` lowerings call back into `expr_into_dest`, but from what I can tell that won't work well, because there are extra scoping considerations that require some awareness of the enclosing if/match.

r? ``@Nadrieril``
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 2, 2024
…iaskrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang#121194 (Refactor pre-getopts command line argument handling)
 - rust-lang#121666 (Use the OS thread name by default if `THREAD_INFO` has not been initialized)
 - rust-lang#121758 (Move thread local implementation to `sys`)
 - rust-lang#121759 (attempt to further clarify addr_of docs)
 - rust-lang#121888 (style library/core/src/error.rs)
 - rust-lang#121892 (The ordinary lowering of `thir::ExprKind::Let` is unreachable)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 2, 2024
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#121666 (Use the OS thread name by default if `THREAD_INFO` has not been initialized)
 - rust-lang#121758 (Move thread local implementation to `sys`)
 - rust-lang#121759 (attempt to further clarify addr_of docs)
 - rust-lang#121855 (Correctly generate item info of trait items)
 - rust-lang#121888 (style library/core/src/error.rs)
 - rust-lang#121892 (The ordinary lowering of `thir::ExprKind::Let` is unreachable)
 - rust-lang#121895 (avoid collecting into vecs in some places)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 2, 2024
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#121666 (Use the OS thread name by default if `THREAD_INFO` has not been initialized)
 - rust-lang#121758 (Move thread local implementation to `sys`)
 - rust-lang#121759 (attempt to further clarify addr_of docs)
 - rust-lang#121855 (Correctly generate item info of trait items)
 - rust-lang#121888 (style library/core/src/error.rs)
 - rust-lang#121892 (The ordinary lowering of `thir::ExprKind::Let` is unreachable)
 - rust-lang#121895 (avoid collecting into vecs in some places)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 7bacfce into rust-lang:master Mar 2, 2024
11 checks passed
@rustbot rustbot added this to the 1.78.0 milestone Mar 2, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Mar 2, 2024
Rollup merge of rust-lang#121892 - Zalathar:expr-kind-let, r=Nadrieril

The ordinary lowering of `thir::ExprKind::Let` is unreachable

After desugaring, `let` expressions should only appear inside `if` expressions or `match` guards, possibly nested within a let-chain. In both cases they are specifically handled by the lowerings of those expressions, so this case is currently unreachable.

---

Context: https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Lowering.20of.20.60thir.3A.3AExprKind.3A.3ALet.60.20is.20unreachable

My conclusions are partly based on the observation that stubbing out this match arm doesn't cause any test failures. So either this really is unreachable, or it can be reached in some obscure circumstances that our test suite doesn't cover.

If we end up needing this code (or something like it) for an implementation of rust-lang/rfcs#3573, it should be easy enough to pull it back out of version control history.

I looked into having the `if`/`match` lowerings call back into `expr_into_dest`, but from what I can tell that won't work well, because there are extra scoping considerations that require some awareness of the enclosing if/match.

r? ```@Nadrieril```
@Zalathar Zalathar deleted the expr-kind-let branch March 2, 2024 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants