Skip to content

Support array of any types in Cargo config #16111

@weihanglo

Description

@weihanglo

The motivation of this is mostly from the proposed -Zconfig-include syntax (#7723 (comment)).

I'd like extend Cargo to support arrays of any types, including nested array or tables, so that we can have a more flexible TOML syntax in the future.

Where we are today

Cargo today (e6cc50d) supports only arrays of strings, which is fine for most of the existing use cases.

[foo] tomato = ["hello", "world"] # ✅ supported banana = [1, 2, 3] # ❌ unsupported orange = [true, false] # ❌ unsupported citrus = [[], ["a", "b"]] # ❌ unsupported papaya = [{}, { x = "y" }] # ❌ unsupported pomelo = [true, "y", ["x"]] # ❌ unsupported

With the proposed "array of any types" support, every case will be supported

Why cutting this issue

#16103 adds the support of array of any types in Cargo config.

However, it’s unclear whether we want to stabilize this feature without a concrete use case (#16103 (comment)).

Stabilizing unused syntax risks committing to design decisions we haven’t fully vetted. Once stable, we may also start using it simply because it exists.

This issue tracks the discussion around this support and whether it should land insta-stable or behind a nightly flag. An FCP will be kicked off to decide the approach.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions