pub struct ShapeTable { /* private fields */ }Expand description
declared_shapes’ referrer-scoped lookup table — see that function’s
doc for the coexistence story this exists to resolve correctly.
Implementations§
Source§impl ShapeTable
impl ShapeTable
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Number of declared shapes in the project — referrer-free, since a count needs no disambiguation.
Sourcepub fn get_by_def(&self, id: DefinitionId) -> Option<&ShapeInfo>
pub fn get_by_def(&self, id: DefinitionId) -> Option<&ShapeInfo>
Resolve a shape already pinned to an exact DefinitionId — no
referrer ambiguity possible, since the identity was already resolved
once, correctly, by whatever recorded it (e.g. a construction
literal’s RefKind::Struct resolution, resolve::resolve_struct_ref).
Sourcepub fn resolve(
&self,
name: &str,
scope: &ImportScope,
index: &SymbolIndex,
) -> Option<&ShapeInfo>
pub fn resolve( &self, name: &str, scope: &ImportScope, index: &SymbolIndex, ) -> Option<&ShapeInfo>
Scope-aware lookup (issue #2241, corrected per #2245/#2246’s
peer-root ruling — docs/decision-log.md, 2026-08-04): when more
than one declared STRUCT shares name, resolve through the same
Candidacy-based module scoping every other symbol kind uses —
[crate::resolve::lookup_by_name], the exact function
resolve::resolve_struct_ref already calls for SymbolKind::Struct.
This used to hand-roll its own find(info.file == referrer) .or_else(find(!is_reserved_root_module)) fallback — a bolt-on std
gate the ruling calls out by name as one of the five symptom gates
to unwind, not a second, diverging implementation of the same
policy. Returns
None when name names no declared STRUCT at all, or
[crate::resolve::lookup_by_name] itself resolves to none (e.g.
every candidate sharing the name is std-declared and out of
scope).