rust/crates
bors[bot] 67351a011b
Merge #3805
3805: lower literal patterns r=JoshMcguigan a=JoshMcguigan

While working on #3706 I discovered literal patterns weren't being lowered. This PR implements that lowering.

Questions for reviewers:

1. This re-uses the existing conversion from `ast::LiteralKind` to `Literal`, but `ast::LiteralKind` doesn't include information about the actual value of the literal, which causes `Literal` to be created with the default value for the type (rather than the actual value in the source code). Am I correct in thinking that we'd eventually want to change things in such a way that we could initialize the `Literal` with the actual literal value? Is there an existing issue for this, or else perhaps I should create one to discuss how it should be implemented? My main question would be whether `ast::LiteralKind` should be extended to hold the actual value, or if we should provide some other way to get that information from `ast::Literal`?
2. I couldn't find tests which directly cover this, but it does seem to work in #3706. Do we have unit tests for this lowering code?
3. I'm not sure why `lit.literal()` returns an `Option`. Is returning a `Pat::Missing` in the `None` case the right thing to do? 
4. I was basically practicing type-system driven development to figure out the transformation from `ast::Pat::LiteralPat` to `Pat::Lit`. I don't have an immediate question here, but I just wanted to ensure this section is looked at closely during review. 

Co-authored-by: Josh Mcguigan <joshmcg88@gmail.com>
2020-04-01 11:22:31 +00:00
..
ra_arena Use resize_with 2020-03-31 09:02:12 -04:00
ra_assists When adding match arm, don't let the floating comma 2020-03-31 14:52:20 +02:00
ra_cfg Update versions 2020-02-18 16:12:40 +02:00
ra_db Merge #3727 2020-03-26 17:09:32 +00:00
ra_flycheck Simplify error handing 2020-04-01 13:14:38 +02:00
ra_fmt update itertools version to 0.9.0 2020-03-23 16:22:46 -07:00
ra_hir Cleanup memory usage stats 2020-03-25 19:35:46 +01:00
ra_hir_def lower literal patterns 2020-04-01 04:18:46 -07:00
ra_hir_expand Implement ra_proc_macro client logic 2020-03-31 22:20:18 +08:00
ra_hir_ty Simplify 2020-03-31 19:00:23 +03:00
ra_ide Merge #3779 2020-04-01 10:41:46 +00:00
ra_ide_db Reload only the properties that do not affect vfs 2020-03-30 13:39:14 +03:00
ra_mbe Remove deps on tt_mbe 2020-03-27 00:46:40 +08:00
ra_parser Fix parsing lambdas with return type 2020-03-25 17:01:28 +01:00
ra_proc_macro Redirect stderr to null 2020-03-31 22:20:19 +08:00
ra_prof Fix race in the tests 2020-03-30 11:33:01 +02:00
ra_project_model Reduce deps 2020-03-31 19:29:11 +02:00
ra_syntax Merge #3786 2020-03-31 12:53:51 +00:00
ra_text_edit Remove some TextUnit->usize escapees 2020-03-12 22:33:27 -04:00
ra_tt Implement ra_proc_macro client logic 2020-03-31 22:20:18 +08:00
rust-analyzer Generalize Flycheckconfig 2020-04-01 13:14:38 +02:00
stdx Fix typo 2020-03-30 18:51:30 +02:00
test_utils Move verbose tests out of line 2020-03-13 12:20:42 +01:00