Skip to content
This issue has been moved to a discussionGo to the discussion

Does GreenNode actually use tagged pointers for children? #19832

Closed
@szmarczak

Description

@szmarczak

syntax.md

To more compactly store the children, we box both interior nodes and tokens, and represent Either<Arc<Node>, Arc<Token>> as a single pointer with a tag in the last bit.

However

https://github.com/rust-analyzer/rowan/blob/fe2e4a7059e1fb8961b92e9d7738844faad7d675/src/green/node.rs#L25-L53

In particular

static_assert!(mem::size_of::<GreenChild>() == mem::size_of::<usize>() * 2);
type Repr = HeaderSlice<GreenNodeHead, [GreenChild]>;
pub struct GreenNode {
    ptr: ThinArc<GreenNodeHead, GreenChild>,
}

It doesn't look like it does what the docs are saying.

Activity

locked and limited conversation to collaborators on May 20, 2025
converted this issue into a discussion #19833 on May 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @szmarczak

        Issue actions

          Does GreenNode actually use tagged pointers for children? · Issue #19832 · rust-lang/rust-analyzer