mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
Use ‘index’ terminology for arena consistently
This commit is contained in:
parent
3224ecea87
commit
1d103cf087
6 changed files with 56 additions and 53 deletions
|
@ -13,7 +13,7 @@
|
|||
//! See also a neighboring `body` module.
|
||||
|
||||
use hir_expand::name::Name;
|
||||
use la_arena::{Idx, RawId};
|
||||
use la_arena::{Idx, RawIdx};
|
||||
use syntax::ast::RangeOp;
|
||||
|
||||
use crate::{
|
||||
|
@ -24,7 +24,7 @@ use crate::{
|
|||
|
||||
pub type ExprId = Idx<Expr>;
|
||||
pub(crate) fn dummy_expr_id() -> ExprId {
|
||||
ExprId::from_raw(RawId::from(!0))
|
||||
ExprId::from_raw(RawIdx::from(!0))
|
||||
}
|
||||
|
||||
pub type PatId = Idx<Pat>;
|
||||
|
|
|
@ -20,7 +20,7 @@ use hir_expand::{
|
|||
name::{name, AsName, Name},
|
||||
HirFileId, InFile,
|
||||
};
|
||||
use la_arena::{Arena, Idx, RawId};
|
||||
use la_arena::{Arena, Idx, RawIdx};
|
||||
use rustc_hash::FxHashMap;
|
||||
use smallvec::SmallVec;
|
||||
use syntax::{ast, match_ast};
|
||||
|
|
|
@ -683,12 +683,12 @@ impl Ctx {
|
|||
}
|
||||
|
||||
fn next_field_idx(&self) -> Idx<Field> {
|
||||
Idx::from_raw(RawId::from(
|
||||
Idx::from_raw(RawIdx::from(
|
||||
self.tree.data.as_ref().map_or(0, |data| data.fields.len() as u32),
|
||||
))
|
||||
}
|
||||
fn next_variant_idx(&self) -> Idx<Variant> {
|
||||
Idx::from_raw(RawId::from(
|
||||
Idx::from_raw(RawIdx::from(
|
||||
self.tree.data.as_ref().map_or(0, |data| data.variants.len() as u32),
|
||||
))
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
//! absolute offsets. The `Trace` structure (inspired, at least in name, by
|
||||
//! Kotlin's `BindingTrace`) allows use the same code to compute both
|
||||
//! projections.
|
||||
use la_arena::{Arena, ArenaMap, Idx, RawId};
|
||||
use la_arena::{Arena, ArenaMap, Idx, RawIdx};
|
||||
|
||||
pub(crate) struct Trace<T, V> {
|
||||
arena: Option<Arena<T>>,
|
||||
|
@ -30,7 +30,7 @@ impl<T, V> Trace<T, V> {
|
|||
let id = if let Some(arena) = &mut self.arena {
|
||||
arena.alloc(data())
|
||||
} else {
|
||||
let id = Idx::<T>::from_raw(RawId::from(self.len));
|
||||
let id = Idx::<T>::from_raw(RawIdx::from(self.len));
|
||||
self.len += 1;
|
||||
id
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue