Skip to content

Does GreenNode actually use tagged pointers for children? #19832

@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.

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

    Issue actions