Skip to content

Book shows accumulator API as ::push() instead of .accumulate() #990

@joshuadavidthomas

Description

@joshuadavidthomas

The book's overview section shows this syntax for accumulators:

Diagnostics::push(db, "some_string".to_string())

But this gives a "no function or associated item named push found" error. The actual API uses:

Diagnostics("some_string".to_string()).accumulate(db)

All the examples and tests use .accumulate(db), not ::push(). The incorrect syntax appears in book/src/overview.md, dating back to this commit from August 2022.

Is ::push() a planned API change, or is this just outdated documentation? Happy to open a PR to fix it if it's the latter.

The discrepancy caused some confusion when following the book - took a bit to figure out the correct API.

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