Skip to content

Const JSON does not compile #10

@code-mart

Description

@code-mart

The following example, found in test/const/rust.rs does not compile for me:

#[tsync]
const SERDE_JSON_2: serde_json::Value = json!({ "a": "b" });

I get this error, among others:

mutable references are not allowed in constants

From my understanding, the constructor for serde_json::Value is not const, so using json! macro to initialize a const macro is not possible. Is there some way to successfully compile the const JSON?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions