mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 05:15:04 +00:00
Fix panic in tuple fields
This commit is contained in:
parent
8f1792fde2
commit
4d66f5d7d2
1 changed files with 4 additions and 1 deletions
|
@ -93,7 +93,10 @@ impl AsName for ast::FieldKind {
|
||||||
fn as_name(&self) -> Name {
|
fn as_name(&self) -> Name {
|
||||||
match self {
|
match self {
|
||||||
ast::FieldKind::Name(nr) => nr.as_name(),
|
ast::FieldKind::Name(nr) => nr.as_name(),
|
||||||
ast::FieldKind::Index(idx) => Name::new_tuple_field(idx.text().parse().unwrap()),
|
ast::FieldKind::Index(idx) => {
|
||||||
|
let idx = idx.text().parse::<usize>().unwrap_or(0);
|
||||||
|
Name::new_tuple_field(idx)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue