[let_chains, 1/6] Remove hir::ExprKind::If#59288
Conversation
This comment has been minimized.
This comment has been minimized.
|
IIRC, I got some lifetime issues after trying to desugar all |
|
This seems like a nice simplification even regardless of if-let chains, we only need to make sure that it doesn't regress 1) codegen 2) compile times, and 3) diagnostics. Similarly, desugaring (I'll try to review the code later today.) |
|
On the other hand, the desugaring for pattern matching expressions at the AST/HIR border turned out incredibly hacky, when I tried it. match thing {
PAT(y) if let Some(x) = y {
print(x); // Nope
}
}So it's a pretty real possibility that it's better done somewhere at HIR->MIR time. |
I think I fixed all diagnostics issues that I had... some even got improved. :) As for codegen there are issues in #59288 (comment) wrt. mir-opt tests (thus the WIP) that I don't really understand yet.
Yup, I'd like to do that as step 4 in the process after having done the
:)
When I tried it out with LBV + a fold in lowering it didn't feel so bad. Haven't thought about the implications of if-let-guards + if-let-chains tho wrt. lowering. :) |
35ac9ca to
b5613e3
Compare
This comment has been minimized.
This comment has been minimized.
|
(I believe @oli-obk is looking into the mir-opt stuff) |
Run branch cleanup after copy prop This is preliminary work for rust-lang#59288 (comment) which gets rid of `if` in the HIR. cc @rust-lang/wg-mir-opt @Centril
|
@bors try |
|
⌛ Trying commit db4452fab28c9374dd6676b702dc36b43e2a45b5 with merge bf82f43c83ada4fffaf93a633dfce5c7f55d57fe... |
This comment has been minimized.
This comment has been minimized.
|
☀️ Try build successful - checks-travis |
|
@rust-timer build |
|
@rust-timer build bf82f43c83ada4fffaf93a633dfce5c7f55d57fe |
|
Success: Queued bf82f43c83ada4fffaf93a633dfce5c7f55d57fe with parent ef4d1c4, comparison URL. |
|
Finished benchmarking try commit bf82f43c83ada4fffaf93a633dfce5c7f55d57fe |
772ab34 to
9a0d37d
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Filed FIXME issue, rebased, and did a minor cleanup after the @oli-obk Please take a look :) |
|
@bors r+ |
|
📌 Commit f9cc5a6 has been approved by |
[let_chains, 1/6] Remove hir::ExprKind::If Per #53667 (comment). r? @oli-obk
|
☀️ Test successful - checks-travis, status-appveyor |
|
📣 Toolstate changed by #59288! Tested on commit acc7e65. 💔 clippy-driver on windows: test-pass → build-fail (cc @Manishearth @llogiq @mcarton @oli-obk @phansch, @rust-lang/infra). |
|
Have you looked into how hard it will be to make clippy migrate to these? We have a lot of lints around ifs, and the lowering may lose some context necessary to make these work. Removing lints because they're no longer possible isn't an option. IMO for such changes where there's a good chance clippy lints will be unfixably broken we should be notified of this before it merges :/ |
|
I appreciate it being split up, though, it's easier to make this evaluation if one thing breaks at a time :) |
The lowering preserves information about the source; you can check @oli-obk thought it would work for clippy and as you know, he also works on clippy... |
|
Ah okay, thanks. I'll see how hard this is to fix.
For the later steps can you work with us to ensure stuff isn't broken
before landing? Mostly just pinging me when the PR is ready to merge so I
can work on a patch
…On Fri, May 10, 2019, 6:51 PM Mazdak Farrokhzad ***@***.***> wrote:
We have a lot of lints around ifs, and the lowering may lose some context
necessary to make these work.
The lowering preserves information about the source; you can check
MatchSource::IfDesugar to see whether it originated from an if.
@oli-obk <https://github.com/oli-obk> thought it would work for clippy
and as you know, he also works on clippy...
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#59288 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAMK6SFNF7Z4ALSPPWZJFZ3PUYRDVANCNFSM4G7NO2EQ>
.
|
Sure. Fwiw, I expected Oliver to be the "work with us" party... ;) The next steps will be to introduce |
|
That's fair, though it's better if more clippy folks know. I'm working on a
fix now.
…On Fri, May 10, 2019, 6:59 PM Mazdak Farrokhzad ***@***.***> wrote:
For the later steps can you work with us to ensure stuff isn't broken
before landing? Mostly just pinging me when the PR is ready to merge so I
can work on a patch
Sure. Fwiw, I expected Oliver to be the "work with us" party... ;)
The next steps will be to introduce ast::ExprKind::Let and then to use 'label:
{ ... break 'label value }. That will probably be less straightforward
but I think we can introduce similar desugaring info as needed. I could
introduce ast::ExprKind::Let in a separate intermediate step however
without connecting the parser (already done in a PR but I could probably
split things).
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#59288 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAMK6SEZ33ZJV22OE6W6LZ3PUYSAFANCNFSM4G7NO2EQ>
.
|
|
This ended up being a non-trivial perf regression. |
|
Yep; this was expected. #60730 will hopefully reduce some of those regressions. |
Per #53667 (comment).
r? @oli-obk