Skip to content

Const JSON does not compile #10

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?

Activity

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions