aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-01-07 13:50:17 +0000
committerGitHub <[email protected]>2020-01-07 13:50:17 +0000
commit6c1401404baca846103c85e048b5d0a959ddc81b (patch)
tree4f71a0d17da6b4fd71bf84454f9620c77e6a5366
parent8f1792fde233799fe3335032834ee7281d78e55b (diff)
parent4d66f5d7d2355ce82aec0b41b4b94a1d7f2d9c1c (diff)
Merge #2754
2754: Fix panic in tuple fields r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
-rw-r--r--crates/ra_hir_expand/src/name.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/crates/ra_hir_expand/src/name.rs b/crates/ra_hir_expand/src/name.rs
index e62693b68..b3fa1efba 100644
--- a/crates/ra_hir_expand/src/name.rs
+++ b/crates/ra_hir_expand/src/name.rs
@@ -93,7 +93,10 @@ impl AsName for ast::FieldKind {
93 fn as_name(&self) -> Name { 93 fn as_name(&self) -> Name {
94 match self { 94 match self {
95 ast::FieldKind::Name(nr) => nr.as_name(), 95 ast::FieldKind::Name(nr) => nr.as_name(),
96 ast::FieldKind::Index(idx) => Name::new_tuple_field(idx.text().parse().unwrap()), 96 ast::FieldKind::Index(idx) => {
97 let idx = idx.text().parse::<usize>().unwrap_or(0);
98 Name::new_tuple_field(idx)
99 }
97 } 100 }
98 } 101 }
99} 102}