Uh oh!
There was an error while loading. Please reload this page.
syntax: Treat error literals in more principled way - #61615
Conversation
rust-highfive
commented
Jun 7, 2019
r? @eddyb (rust_highfive has picked a reviewer for you, use r? to override) |
petrochenkov
commented
Jun 7, 2019
bors
commented
Jun 7, 2019
✌️ @matklad can now approve this pull request |
matklad
commented
Jun 7, 2019
Than maybe there shouldn't be an error literal token, and just an error token? |
Uh oh!
There was an error while loading. Please reload this page.
petrochenkov
commented
Jun 7, 2019
Well, maybe yes in theory, but it may be more convenient to make that token a literal due to various circumstances.
|
Uh oh!
There was an error while loading. Please reload this page.
matklad
commented
Jun 7, 2019
not sure about #61615 (comment), but r=me |
petrochenkov
commented
Jun 7, 2019
Added a test for #61615 (comment). |
bors
commented
Jun 7, 2019
📌 Commit 2af47fa has been approved by |
syntax: Treat error literals in more principled way Free them from their character literal origins. I actually tried to remove `LitKind::Err` entirely (by converting it into `ExprKind::Err` immediately), and it caused no diagnostic regressions in the test suite. However, I'd still want to use error literals as general purpose error tokens some day, so I kept them. The downside of having `LitKind::Err` in addition to `ExprKind::Err` is that every time you want to do something with `ExprKind::Err` you need to make sure that `ExprKind::Lit(LitKind::Err)` is treated in the same way. Fortunately, this usually happens automatically because both literals and errors are "leaf" expressions, however this PR does fix a couple of inconsistencies between them. Addresses rust-lang#60679 (comment) in a way
syntax: Treat error literals in more principled way Free them from their character literal origins. I actually tried to remove `LitKind::Err` entirely (by converting it into `ExprKind::Err` immediately), and it caused no diagnostic regressions in the test suite. However, I'd still want to use error literals as general purpose error tokens some day, so I kept them. The downside of having `LitKind::Err` in addition to `ExprKind::Err` is that every time you want to do something with `ExprKind::Err` you need to make sure that `ExprKind::Lit(LitKind::Err)` is treated in the same way. Fortunately, this usually happens automatically because both literals and errors are "leaf" expressions, however this PR does fix a couple of inconsistencies between them. Addresses rust-lang#60679 (comment) in a way
syntax: Treat error literals in more principled way Free them from their character literal origins. I actually tried to remove `LitKind::Err` entirely (by converting it into `ExprKind::Err` immediately), and it caused no diagnostic regressions in the test suite. However, I'd still want to use error literals as general purpose error tokens some day, so I kept them. The downside of having `LitKind::Err` in addition to `ExprKind::Err` is that every time you want to do something with `ExprKind::Err` you need to make sure that `ExprKind::Lit(LitKind::Err)` is treated in the same way. Fortunately, this usually happens automatically because both literals and errors are "leaf" expressions, however this PR does fix a couple of inconsistencies between them. Addresses rust-lang#60679 (comment) in a way
syntax: Treat error literals in more principled way Free them from their character literal origins. I actually tried to remove `LitKind::Err` entirely (by converting it into `ExprKind::Err` immediately), and it caused no diagnostic regressions in the test suite. However, I'd still want to use error literals as general purpose error tokens some day, so I kept them. The downside of having `LitKind::Err` in addition to `ExprKind::Err` is that every time you want to do something with `ExprKind::Err` you need to make sure that `ExprKind::Lit(LitKind::Err)` is treated in the same way. Fortunately, this usually happens automatically because both literals and errors are "leaf" expressions, however this PR does fix a couple of inconsistencies between them. Addresses rust-lang#60679 (comment) in a way
Rollup of 7 pull requests Successful merges: - #61223 (Document tuple's Ord behavior as sequential) - #61615 (syntax: Treat error literals in more principled way) - #61616 (parser: Remove `Deref` impl from `Parser`) - #61621 (Clarify when we run steps with ONLY_HOSTS) - #61627 (Add regression test for #61452.) - #61641 (Revert "Make LocalAnalizer visitor iterate instead of recurse") - #61647 (Use stable wrappers in f32/f64::signum) Failed merges: r? @ghost
Free them from their character literal origins.
I actually tried to remove
LitKind::Errentirely (by converting it intoExprKind::Errimmediately), and it caused no diagnostic regressions in the test suite.However, I'd still want to use error literals as general purpose error tokens some day, so I kept them.
The downside of having
LitKind::Errin addition toExprKind::Erris that every time you want to do something withExprKind::Erryou need to make sure thatExprKind::Lit(LitKind::Err)is treated in the same way.Fortunately, this usually happens automatically because both literals and errors are "leaf" expressions, however this PR does fix a couple of inconsistencies between them.
Addresses #60679 (comment) in a way