tamasfe / taplo

A TOML toolkit written in Rust
https://taplo.tamasfe.dev
MIT License
1.45k stars 114 forks source link

Error in Rust Toolchain File #317

Closed Tim-Paik closed 2 years ago

Tim-Paik commented 2 years ago

Here is my rust-toolchain.toml file:

[toolchain]
channel = "nightly"
components = ["rust-src"]

Even Better Toml, however, says there is a mistake here: pic

However, if you enter a value that is invalid, it does not report an error: pic

Is this a bug?

VSCode: 1.71.2 Even Better Toml: 0.18.1

gfgafn commented 2 years ago

I have fixed this bug by Modify schema for rust-toolchain.toml in my fork of schemastore, and I also add some tests to rust-toolchain for this schema at the same time.

The more tests using serde_json and jsonschema for this schema can be find in rust-playground.

I also use rust-toolchain.json as a local file association in VSCode for this schema, and everything is ok now.

// .vscode/settings.json
{
    "evenBetterToml.schema.associations": {
        "^(.*(/|\\\\)rust-toolchain([.]toml)?)$": "file:///C:/.../rust-toolchain.toml.json"
    },
}

@tamasfe If this solution can be accepteable, I will make a PR to schemastore from my fork, and this issue can be close.

Thanks!

tamasfe commented 2 years ago

Hi @gfgafn, sorry I did not follow this. If it's a schema issue, then yes, please go ahead and submit a PR, thank you.

gfgafn commented 2 years ago

@tamasfe @Tim-Paik I have submit the PR, and now the rust-toolchain.toml with channel field like below will not report an error

[toolchain]
channel = "nightly" # It can also be "stable", "1.64.0" ...
components = ["llvm-tools-preview"]
targets = ["riscv64gc-unknown-none-elf"]

and this issue can be closed.

tamasfe commented 2 years ago

Awesome, thank you!

gfgafn commented 1 year ago

I have fixed this bug by Modify schema for rust-toolchain.toml in my fork of schemastore, and I also add some tests to rust-toolchain for this schema at the same time.

The more tests using serde_json and jsonschema for this schema can be find in rust-playground.

I also use rust-toolchain.json as a local file association in VSCode for this schema, and everything is ok now.

// .vscode/settings.json
{
    "evenBetterToml.schema.associations": {
        "^(.*(/|\\\\)rust-toolchain([.]toml)?)$": "file:///C:/.../rust-toolchain.toml.json"
    },
}

@tamasfe If this solution can be accepteable, I will make a PR to schemastore from my fork, and this issue can be close.

Thanks!

The relevant new PR to fix https://github.com/tamasfe/taplo/pull/402 The new tests case:

Test Code

#[cfg(test)]
pub mod standard_toolchain_tests {
    use jsonschema::JSONSchema;
    use serde_json::json;

    pub fn is_validate_pass(schema: &JSONSchema, instance: serde_json::Value) -> bool {
        match schema.validate(&instance) {
            Ok(_) => true,
            Err(errors) => {
                errors.for_each(|e| println!("Validation error: {}", e));
                false
            }
        }
    }

    #[test]
    fn test_toolchain_channel_only() {
        let res: serde_json::Value =
            serde_json::from_str(RUST_TOOLCHAIN_SCHEME).expect("Unable to parse");
        let schema: JSONSchema = JSONSchema::compile(&res).expect("can't compile");
        assert!(!is_validate_pass(&schema, json!({})));
        assert!(!is_validate_pass(
            &schema,
            json!({
                "toolchain":{}
            })
        ));
        vec!["stable", "beta", "nightly"]
            .iter()
            .for_each(|&channel| {
                assert!(is_validate_pass(
                    &schema,
                    json!({
                        "toolchain":{
                            "channel":channel,
                        }
                    })
                ))
            });
        assert!(!is_validate_pass(
            &schema,
            json!({
                "toolchain":{
                    "channel":"unknown",
                }
            })
        ));
        assert!(is_validate_pass(
            &schema,
            json!({
                "toolchain":{
                    "channel":"1.63",
                }
            })
        ));
        assert!(is_validate_pass(
            &schema,
            json!({
                "toolchain":{
                    "channel":"1.63.0",
                }
            })
        ));
        assert!(!is_validate_pass(
            &schema,
            json!({
                "toolchain":{
                    "channel":"1.63.0.0",
                }
            })
        ));
    }

    #[test]
    fn test_toolchain_targets_only() {
        let res: serde_json::Value =
            serde_json::from_str(RUST_TOOLCHAIN_SCHEME).expect("Unable to parse");
        let schema: JSONSchema = JSONSchema::compile(&res).expect("can't compile");
        assert!(!is_validate_pass(&schema, json!({})));
        assert!(is_validate_pass(
            &schema,
            json!({
                "toolchain":{"targets":[]}
            })
        ));
    }

    #[test]
    fn test_toolchain_components_only() {
        let res: serde_json::Value =
            serde_json::from_str(RUST_TOOLCHAIN_SCHEME).expect("Unable to parse");
        let schema: JSONSchema = JSONSchema::compile(&res).expect("can't compile");
        assert!(!is_validate_pass(&schema, json!({})));
        assert!(is_validate_pass(
            &schema,
            json!({
                "toolchain":{"components":[]}
            })
        ));
    }

    #[test]
    fn test_components_and_targets() {
        let res: serde_json::Value =
            serde_json::from_str(RUST_TOOLCHAIN_SCHEME).expect("Unable to parse");
        let schema: JSONSchema = JSONSchema::compile(&res).expect("can't compile");
        assert!(!is_validate_pass(&schema, json!({})));
        assert!(is_validate_pass(
            &schema,
            json!({
                "toolchain":{"components":[],"targets":[]}
            })
        ));
    }

    #[test]
    fn test_toolchain_channel_and_data() {
        let res: serde_json::Value =
            serde_json::from_str(RUST_TOOLCHAIN_SCHEME).expect("Unable to parse");
        let schema: JSONSchema = JSONSchema::compile(&res).expect("can't compile");
        assert!(is_validate_pass(
            &schema,
            json!({
                "toolchain":{
                    "channel":"nightly-2022-09-20",
                }
            })
        ));
        assert!(!is_validate_pass(
            &schema,
            json!({
                "toolchain":{
                    "channel":"nightly-2022",
                }
            })
        ));
    }

    #[test]
    fn test_toolchain_channel_and_host() {
        let res: serde_json::Value =
            serde_json::from_str(RUST_TOOLCHAIN_SCHEME).expect("Unable to parse");
        let schema: JSONSchema = JSONSchema::compile(&res).expect("can't compile");
        assert!(is_validate_pass(
            &schema,
            json!({
                "toolchain":{
                    "channel":"stable-x86_64-pc-windows-msvc",
                }
            })
        ));
        assert!(is_validate_pass(
            &schema,
            json!({
                "toolchain":{
                    "channel":"1.63.0-x86_64-pc-windows-msvc",
                }
            })
        ));
    }

    #[test]
    fn test_toolchain_channel_and_data_and_host() {
        let res: serde_json::Value =
            serde_json::from_str(RUST_TOOLCHAIN_SCHEME).expect("Unable to parse");
        let schema: JSONSchema = JSONSchema::compile(&res).expect("can't compile");
        assert!(is_validate_pass(
            &schema,
            json!({
                "toolchain":{
                    "channel":"nightly-2022-09-20-x86_64-unknown-linux-gnu",
                }
            })
        ));
    }

    #[test]
    fn test_channel_and_targets() {
        let res: serde_json::Value =
            serde_json::from_str(RUST_TOOLCHAIN_SCHEME).expect("Unable to parse");
        let schema: JSONSchema = JSONSchema::compile(&res).expect("can't compile");
        assert!(is_validate_pass(
            &schema,
            json!({
                "toolchain":{
                    "channel":"stable",
                    "targets":[]
                }
            })
        ));
        assert!(is_validate_pass(
            &schema,
            json!({
                "toolchain":{
                    "channel":"1.63.0",
                    "targets":["x86_64-pc-windows-msvc","wasm32-unknown-unknown"]
                }
            })
        ));
        assert!(!is_validate_pass(
            &schema,
            json!({
                "toolchain":{
                    "channel":"stable",
                    "components":["wasm32-unknown-unknown","unknown_word"]
                }
            })
        ));
    }

    #[test]
    fn test_channel_and_components() {
        let res: serde_json::Value =
            serde_json::from_str(RUST_TOOLCHAIN_SCHEME).expect("Unable to parse");
        let schema: JSONSchema = JSONSchema::compile(&res).expect("can't compile");
        assert!(is_validate_pass(
            &schema,
            json!({
                "toolchain":{
                    "channel":"stable",
                    "components":[]
                }
            })
        ));
        assert!(is_validate_pass(
            &schema,
            json!({
                "toolchain":{
                    "channel":"stable",
                    "components":["llvm-tools","rust-std"]
                }
            })
        ));
        assert!(!is_validate_pass(
            &schema,
            json!({
                "toolchain":{
                    "channel":"stable",
                    "components":["llvm-tools","unknown_word"]
                }
            })
        ));
    }

    #[test]
    fn test_profile() {
        let res: serde_json::Value =
            serde_json::from_str(RUST_TOOLCHAIN_SCHEME).expect("Unable to parse");
        let schema: JSONSchema = JSONSchema::compile(&res).expect("can't compile");
        assert!(!is_validate_pass(
            &schema,
            json!({
                "toolchain":{
                    "profile":"default"
                }
            })
        ));
        assert!(is_validate_pass(
            &schema,
            json!({
                "toolchain":{
                    "channel":"stable",
                    "profile":"default"
                }
            })
        ));
        assert!(is_validate_pass(
            &schema,
            json!({
                "toolchain":{
                    "channel":"stable",
                    "components":["llvm-tools"],
                    "targets":[],
                    "profile":"default"
                }
            })
        ));
        assert!(!is_validate_pass(
            &schema,
            json!({
                "toolchain":{
                    "profile":"default",
                    "path":"",
                }
            })
        ));
    }

    #[test]
    fn test_custom_toolchain() {
        let res: serde_json::Value =
            serde_json::from_str(RUST_TOOLCHAIN_SCHEME).expect("Unable to parse");
        let schema: JSONSchema = JSONSchema::compile(&res).expect("can't compile");
        assert!(!is_validate_pass(&schema, json!({})));
        assert!(is_validate_pass(
            &schema,
            json!({
                "toolchain":{
                    "path":""
                }
            })
        ));
        assert!(is_validate_pass(
            &schema,
            json!({
                "toolchain":{
                    "path":"no_empty"
                }
            })
        ));
        assert!(!is_validate_pass(
            &schema,
            json!({
                "toolchain":{
                    "path":"no_empty",
                    "channel":""
                }
            })
        ));
        assert!(!is_validate_pass(
            &schema,
            json!({
                "toolchain":{
                    "path":"no_empty",
                    "channel":"stable",
                    "targets":[],
                    "components":[],
                    "profile":"default"
                }
            })
        ));
    }

    const RUST_TOOLCHAIN_SCHEME: &str = r#"{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "description": "https://rust-lang.github.io/rustup/overrides.html#the-toolchain-file",
    "properties": {
        "toolchain": {
        "description": "A `toolchain` is a complete installation of the Rust compiler (`rustc`) and related tools (like `cargo`). A toolchain specification includes the release channel or version, and the host platform that the toolchain runs on.\n\n Get more from [`Toolchains`](https://rust-lang.github.io/rustup/concepts/toolchains.html)",
        "type": "object",
        "minProperties": 1,
        "properties": {
            "channel": {
            "description": "`channel` is a named release channel, a major and minor version number such as `1.42`, or a fully specified version number, such as `1.42.0`. Channel names can be optionally appended with an archive date, as in `nightly-2014-12-18`, in which case the toolchain is downloaded from the archive for that date. Get more from [`Toolchain specification`](https://rust-lang.github.io/rustup/concepts/toolchains.html).\n\nOther valid channel like `stable`,`1.63`,`1.63.0`,`nightly-2022-09-20`,`stable-x86_64-pc-windows-msvc`,`1.63.0-riscv64gc-unknown-linux-gnu`,`nightly-2022-09-20-x86_64-unknown-nux-gnu`",
            "type": "string",
            "pattern": "^(?:stable|beta|nightly|\\d+(?:\\.\\d+){1,2})(?:-\\d{4}(?:-\\d{2}){2})?(?:-\\D[^-]*(?:(?:-(?:[^-]+)){1,3}))?$",
            "examples": [
                "stable",
                "1.63",
                "1.63.0",
                "nightly-2022-09-20",
                "stable-x86_64-pc-windows-msvc",
                "1.63.0-riscv64gc-unknown-linux-gnu",
                "nightly-2022-09-20-x86_64-unknown-linux-gnu"
            ],
            "x-taplo": {
                "links": {
                "key": "https://rust-lang.github.io/rustup/concepts/channels.html"
                }
            }
            },
            "components": {
            "description": "Each release of Rust includes several \"components\", some of\nwhich are required (like `rustc`) and some that are optional (like [`clippy`](https://github.com/rust-lang/rust-clippy)) \n\n Learn more from [`Components`](https://rust-lang.github.io/rustup/concepts/components.html)",
            "type": "array",
            "items": {
                "type": "string",
                "enum": [
                "rustc",
                "cargo",
                "rustfmt",
                "rust-std",
                "rust-docs",
                "rls",
                "clippy",
                "miri",
                "rust",
                "rust-analysis",
                "llvm-tools",
                "rustc-docs",
                "rustc-dev",
                "rust-analyzer",
                "reproducible-artifacts",
                "rust-docs-json"
                ],
                "x-taplo": {
                "docs": {
                    "enumValues": [
                    "The Rust compiler and [Rustdoc].\n\n[rustdoc]: https://doc.rust-lang.org/rustdoc/",
                    "[Cargo] is a package manager and build tool.\n\n[cargo]: https://doc.rust-lang.org/cargo/",
                    "[Rustfmt] is a tool for automatically formatting code.\n\n[rustfmt]: https://github.com/rust-lang/rustfmt",
                    "This is the Rust [standard library]. There is a separate\n  `rust-std` component for each target that `rustc` supports, such as\n  `rust-std-x86_64-pc-windows-msvc`. See the [Cross-compilation] chapter for\n  more detail.\n\n[standard library]: https://doc.rust-lang.org/std/\n[cross-compilation]: .https://rust-lang.github.io/rustup/cross-compilation.html",
                    "This is a local copy of the [Rust documentation]. Use the\n  `rustup doc` command to open the documentation in a web browser. Run `rustup\n  doc --help` for more options.\n\n[rust documentation]: https://doc.rust-lang.org/",
                    "[RLS] is a language server that provides support for editors and\n  IDEs.\n\n[RLS]: https://github.com/rust-lang/rls",
                    "[Clippy] is a lint tool that provides extra checks for common\n  mistakes and stylistic choices.\n\n[clippy]: https://github.com/rust-lang/rust-clippy",
                    "[Miri] is an experimental Rust interpreter, which can be used for\n  checking for undefined-behavior.\n\n[miri]: https://github.com/rust-lang/miri/",
                    "This is a local copy of the source code of the Rust standard\n  library. This can be used by some tools, such as [RLS], to provide\n  auto-completion for functions within the standard library; [Miri] which is a\n  Rust interpreter; and Cargo's experimental [build-std] feature, which allows\n  you to rebuild the standard library locally.\n\n[RLS]: https://github.com/rust-lang/rls\n[miri]: https://github.com/rust-lang/miri/\n[build-std]: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#build-std",
                    "Metadata about the standard library, used by tools like\n  [RLS].\n\n[RLS]: https://github.com/rust-lang/rls",
                    "This contains a linker and platform libraries for building on\n  the `x86_64-pc-windows-gnu` platform.",
                    "This is an experimental component which contains a\n  collection of [LLVM] tools.\n\n[LLVM]: https://llvm.org/",
                    "This component contains the compiler as a library. Most users\n  will not need this; it is only needed for development *of* tools that link\n  to the compiler, such as making modifications to [Clippy].\n\n[clippy]: https://github.com/rust-lang/rust-clippy"
                    ]
                }
                },
                "$comment": "Empty schema to allow for forward compatibility of new components"
            },
            "x-taplo": {
                "links": {
                "key": "https://rust-lang.github.io/rustup/concepts/components.html"
                }
            }
            },
            "targets": {
            "description": "`rustc` is capable of generating code for many platforms. The `target` specifies the platform that the code will be generated for. By default, `cargo` and `rustc` use the host toolchain's platform as the target. To build for a different `target`, usually the target's standard library needs to be installed first via the `rustup target` command. Or you can run `rustc --print target-list` to list [`\"built-in\" targets`](https://doc.rust-lang.org/rustc/targets/built-in.html) \n\n Get more from [`Platform Support`](https://doc.rust-lang.org/rustc/platform-support.html) and [`Targets`](https://doc.rust-lang.org/rustc/targets/index.html)",
            "type": "array",
            "$comment": "Allow arbitary strings for new targets or custom target JSON",
            "items": {
                "type": "string",
                "$comment": "From `rustc +nightly --print target-list`",
                "enum": [
                "aarch64-unknown-linux-gnu",
                "i686-pc-windows-gnu",
                "i686-pc-windows-msvc",
                "i686-unknown-linux-gnu",
                "x86_64-apple-darwin",
                "x86_64-pc-windows-gnu",
                "x86_64-pc-windows-msvc",
                "x86_64-unknown-linux-gnu",
                "aarch64-apple-darwin",
                "aarch64-pc-windows-msvc",
                "aarch64-unknown-linux-musl",
                "arm-unknown-linux-gnueabi",
                "arm-unknown-linux-gnueabihf",
                "armv7-unknown-linux-gnueabihf",
                "mips-unknown-linux-gnu",
                "mips64-unknown-linux-gnuabi64",
                "mips64el-unknown-linux-gnuabi64",
                "mipsel-unknown-linux-gnu",
                "powerpc-unknown-linux-gnu",
                "powerpc64-unknown-linux-gnu",
                "powerpc64le-unknown-linux-gnu",
                "riscv64gc-unknown-linux-gnu",
                "s390x-unknown-linux-gnu",
                "x86_64-unknown-freebsd",
                "x86_64-unknown-illumos",
                "x86_64-unknown-linux-musl",
                "x86_64-unknown-netbsd",
                "aarch64-apple-ios",
                "aarch64-apple-ios-sim",
                "aarch64-fuchsia",
                "aarch64-linux-android",
                "aarch64-unknown-fuchsia",
                "aarch64-unknown-none",
                "aarch64-unknown-none-softfloat",
                "aarch64-unknown-uefi",
                "arm-linux-androideabi",
                "arm-unknown-linux-musleabi",
                "arm-unknown-linux-musleabihf",
                "armebv7r-none-eabi",
                "armebv7r-none-eabihf",
                "armv5te-unknown-linux-gnueabi",
                "armv5te-unknown-linux-musleabi",
                "armv7-linux-androideabi",
                "armv7-unknown-linux-gnueabi",
                "armv7-unknown-linux-musleabi",
                "armv7-unknown-linux-musleabihf",
                "armv7a-none-eabi",
                "armv7r-none-eabi",
                "armv7r-none-eabihf",
                "asmjs-unknown-emscripten",
                "i586-pc-windows-msvc",
                "i586-unknown-linux-gnu",
                "i586-unknown-linux-musl",
                "i686-linux-android",
                "i686-unknown-freebsd",
                "i686-unknown-linux-musl",
                "i686-unknown-uefi",
                "mips-unknown-linux-musl",
                "mips64-unknown-linux-muslabi64",
                "mips64el-unknown-linux-muslabi64",
                "mipsel-unknown-linux-musl",
                "nvptx64-nvidia-cuda",
                "riscv32i-unknown-none-elf",
                "riscv32imac-unknown-none-elf",
                "riscv32imc-unknown-none-elf",
                "riscv64gc-unknown-none-elf",
                "riscv64imac-unknown-none-elf",
                "sparc64-unknown-linux-gnu",
                "sparcv9-sun-solaris",
                "thumbv6m-none-eabi",
                "thumbv7em-none-eabi",
                "thumbv7em-none-eabihf",
                "thumbv7m-none-eabi",
                "thumbv7neon-linux-androideabi",
                "thumbv7neon-unknown-linux-gnueabihf",
                "thumbv8m.base-none-eabi",
                "thumbv8m.main-none-eabi",
                "thumbv8m.main-none-eabihf",
                "wasm32-unknown-emscripten",
                "wasm32-unknown-unknown",
                "wasm32-wasi",
                "x86_64-apple-ios",
                "x86_64-fortanix-unknown-sgx",
                "x86_64-fuchsia",
                "x86_64-linux-android",
                "x86_64-pc-solaris",
                "x86_64-unknown-fuchsia",
                "x86_64-unknown-linux-gnux32",
                "x86_64-unknown-none",
                "x86_64-unknown-redox",
                "x86_64-unknown-uefi",
                "aarch64-apple-ios-macabi",
                "aarch64-apple-tvos",
                "aarch64-apple-watchos-sim",
                "aarch64-kmc-solid_asp3",
                "aarch64-nintendo-switch-freestanding",
                "aarch64-pc-windows-gnullvm",
                "aarch64-unknown-freebsd",
                "aarch64-unknown-hermit",
                "aarch64-unknown-linux-gnu_ilp32",
                "aarch64-unknown-linux-ohos",
                "aarch64-unknown-netbsd",
                "aarch64-unknown-nto-qnx710",
                "aarch64-unknown-openbsd",
                "aarch64-unknown-redox",
                "aarch64-uwp-windows-msvc",
                "aarch64-wrs-vxworks",
                "aarch64_be-unknown-linux-gnu",
                "aarch64_be-unknown-linux-gnu_ilp32",
                "arm64_32-apple-watchos",
                "armeb-unknown-linux-gnueabi",
                "armv4t-none-eabi",
                "armv4t-unknown-linux-gnueabi",
                "armv5te-none-eabi",
                "armv5te-unknown-linux-uclibceabi",
                "armv6-unknown-freebsd",
                "armv6-unknown-netbsd-eabihf",
                "armv6k-nintendo-3ds",
                "armv7-apple-ios",
                "armv7-sony-vita-newlibeabihf",
                "armv7-unknown-freebsd",
                "armv7-unknown-linux-ohos",
                "armv7-unknown-linux-uclibceabi",
                "armv7-unknown-linux-uclibceabihf",
                "armv7-unknown-netbsd-eabihf",
                "armv7-wrs-vxworks-eabihf",
                "armv7a-kmc-solid_asp3-eabi",
                "armv7a-kmc-solid_asp3-eabihf",
                "armv7a-none-eabihf",
                "armv7k-apple-watchos",
                "armv7s-apple-ios",
                "avr-unknown-gnu-atmega328",
                "bpfeb-unknown-none",
                "bpfel-unknown-none",
                "hexagon-unknown-linux-musl",
                "i386-apple-ios",
                "i586-pc-nto-qnx700",
                "i686-apple-darwin",
                "i686-unknown-haiku",
                "i686-unknown-netbsd",
                "i686-unknown-openbsd",
                "i686-uwp-windows-gnu",
                "i686-uwp-windows-msvc",
                "i686-wrs-vxworks",
                "loongarch64-unknown-linux-gnu",
                "m68k-unknown-linux-gnu",
                "mips-unknown-linux-uclibc",
                "mips64-openwrt-linux-musl",
                "mipsel-sony-psp",
                "mipsel-sony-psx",
                "mipsel-unknown-linux-uclibc",
                "mipsel-unknown-none",
                "mipsisa32r6-unknown-linux-gnu",
                "mipsisa32r6el-unknown-linux-gnu",
                "mipsisa64r6-unknown-linux-gnuabi64",
                "mipsisa64r6el-unknown-linux-gnuabi64",
                "msp430-none-elf",
                "powerpc-unknown-freebsd",
                "powerpc-unknown-linux-gnuspe",
                "powerpc-unknown-linux-musl",
                "powerpc-unknown-netbsd",
                "powerpc-unknown-openbsd",
                "powerpc-wrs-vxworks",
                "powerpc-wrs-vxworks-spe",
                "powerpc64-ibm-aix",
                "powerpc64-unknown-freebsd",
                "powerpc64-unknown-linux-musl",
                "powerpc64-unknown-openbsd",
                "powerpc64-wrs-vxworks",
                "powerpc64le-unknown-freebsd",
                "powerpc64le-unknown-linux-musl",
                "riscv32gc-unknown-linux-gnu",
                "riscv32gc-unknown-linux-musl",
                "riscv32im-unknown-none-elf",
                "riscv32imac-unknown-xous-elf",
                "riscv32imc-esp-espidf",
                "riscv64gc-unknown-freebsd",
                "riscv64gc-unknown-fuchsia",
                "riscv64gc-unknown-linux-musl",
                "riscv64gc-unknown-openbsd",
                "s390x-unknown-linux-musl",
                "sparc-unknown-linux-gnu",
                "sparc64-unknown-netbsd",
                "sparc64-unknown-openbsd",
                "thumbv4t-none-eabi",
                "thumbv5te-none-eabi",
                "thumbv7a-pc-windows-msvc",
                "thumbv7a-uwp-windows-msvc",
                "thumbv7neon-unknown-linux-musleabihf",
                "wasm64-unknown-unknown",
                "x86_64-apple-ios-macabi",
                "x86_64-apple-tvos",
                "x86_64-apple-watchos-sim",
                "x86_64-pc-nto-qnx710",
                "x86_64-pc-windows-gnullvm",
                "x86_64-sun-solaris",
                "x86_64-unknown-dragonfly",
                "x86_64-unknown-haiku",
                "x86_64-unknown-hermit",
                "x86_64-unknown-l4re-uclibc",
                "x86_64-unknown-openbsd",
                "x86_64-uwp-windows-gnu",
                "x86_64-uwp-windows-msvc",
                "x86_64-wrs-vxworks",
                "x86_64h-apple-darwin"
                ]
            },
            "x-taplo": {
                "links": {
                "key": "https://rust-lang.github.io/rustup/cross-compilation.html"
                }
            }
            },
            "profile": {
            "description": "[`Profiles`](https://rust-lang.github.io/rustup/concepts/profiles.htm) are groups of [`components`](https://rust-lang.github.io/rustup/concepts/components.html) you can choose to download while installing a new Rust [`toolchain`](https://rust-lang.github.io/rustup/concepts/toolchains.html).\n\n The `profiles` available at this time are `minimal`, `default`, and `complete`.",
            "type": "string",
            "default": "default",
            "enum": ["minimal", "default", "complete"],
            "x-taplo": {
                "links": {
                "key": "https://rust-lang.github.io/rustup/concepts/profiles.html"
                },
                "docs": {
                "enumValues": [
                    "This profile includes as few components as possible to get a\nworking compiler (`rustc`, `rust-std`, and `cargo`). It's recommended to use\nthis component on Windows systems if you don't use local documentation (the\nlarge number of files can cause issues with some Antivirus systems), and in\nCI.",
                    "This profile includes all of components in the **minimal**\nprofile, and adds `rust-docs`, `rustfmt`, and `clippy`. This profile will be\nused by `rustup` by default, and it's the one recommended for general use.",
                    "This profile includes all the components available through\n`rustup`. This should never be used, as it includes *every* component ever\nincluded in the metadata and thus will almost always fail. If you are\nlooking for a way to install devtools such as `miri` or IDE integration\ntools (`rls`), you should use the `default` profile and\ninstall the needed additional components manually, either by using `rustup\ncomponent add` or by using `-c` when installing the toolchain."
                ]
                }
            }
            },
            "path": {
            "type": "string",
            "description": "Path to a custom local toolchain. Since a `path` directive directly names a local toolchain, other options\nlike `components`, `targets`, and `profile` have no effect. `channel`\nand `path` are mutually exclusive, since a `path` already points to a\nspecific toolchain. A relative `path` is resolved relative to the\nlocation of the `rust-toolchain.toml` file.\n\n Learn more from [`Custom toolchains`](https://rust-lang.github.io/rustup/concepts/toolchains.html#custom-toolchains)"
            }
        },
        "oneOf": [
            {
            "not": {
                "properties": {
                "path": {
                    "type": "string"
                }
                },
                "required": ["path"]
            }
            },
            {
            "required": ["path"]
            }
        ],
        "dependencies": {
            "path": {
            "not": {
                "properties": {
                "channel": {
                    "type": "string"
                }
                },
                "required": ["channel"]
            }
            },
            "channel": {
            "not": {
                "properties": {
                "path": {
                    "type": "string"
                }
                },
                "required": ["path"]
            }
            },
            "profile": {
            "anyOf": [
                {
                "properties": {
                    "channel": {
                    "type": "string"
                    }
                },
                "required": ["channel"]
                },
                {
                "properties": {
                    "components": {
                    "type": "array"
                    }
                },
                "required": ["components"]
                },
                {
                "properties": {
                    "targets": {
                    "type": "array"
                    }
                },
                "required": ["targets"]
                }
            ]
            }
        },
        "x-taplo": {
            "links": {
            "key": "https://rust-lang.github.io/rustup/concepts/toolchains.html"
            },
            "initKeys": ["channel"]
        }
        }
    },
    "required": ["toolchain"],
    "title": "Schema for rust-toolchain.toml",
    "type": "object",
    "x-taplo-info": {
        "authors": ["ian-h-chamberlain (https://github.com/ian-h-chamberlain)"],
        "patterns": ["^(.*(/|\\\\)rust-toolchain([.]toml)?)$"]
    }
    }"#;
}