mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
b0c4b776b5
Our project model code is rather complicated -- the logic for lowering from `cargo metadata` to `CrateGraph` is fiddly and special-case. So far, we survived without testing this at all, but this increasingly seems like a poor option. So this PR introduces a simple tests just to detect the most obvious failures. The idea here is that, although we rely on external processes (cargo & rustc), we are actually using their stable interfaces, so we might just mock out the outputs. Long term, I would like to try to virtualize IO here, so as to do such mocking in a more principled way, but lets start simple. Should we forgo the mocking and just call `cargo metadata` directly perhaps? Touch question -- I personally feel that fast, in-process tests are more important in this case than any extra assurance we get from running the real thing. Super-long term, we would probably want to extend our heavy tests to cover more use-cases, but we should figure a way to do that without slowing the tests down for everyone. Perhaps we need two-tiered bors system, where we pull from `master` into `release` branch only when an additional set of tests passes?
245 lines
8.1 KiB
JSON
245 lines
8.1 KiB
JSON
{
|
|
"packages": [
|
|
{
|
|
"name": "hello-world",
|
|
"version": "0.1.0",
|
|
"id": "hello-world 0.1.0 (path+file://$ROOT$hello-world)",
|
|
"license": null,
|
|
"license_file": null,
|
|
"description": null,
|
|
"source": null,
|
|
"dependencies": [
|
|
{
|
|
"name": "libc",
|
|
"source": "registry+https://github.com/rust-lang/crates.io-index",
|
|
"req": "^0.2",
|
|
"kind": null,
|
|
"rename": null,
|
|
"optional": false,
|
|
"uses_default_features": true,
|
|
"features": [],
|
|
"target": null,
|
|
"registry": null
|
|
}
|
|
],
|
|
"targets": [
|
|
{
|
|
"kind": [
|
|
"lib"
|
|
],
|
|
"crate_types": [
|
|
"lib"
|
|
],
|
|
"name": "hello-world",
|
|
"src_path": "$ROOT$hello-world/src/lib.rs",
|
|
"edition": "2018",
|
|
"doc": true,
|
|
"doctest": true,
|
|
"test": true
|
|
},
|
|
{
|
|
"kind": [
|
|
"bin"
|
|
],
|
|
"crate_types": [
|
|
"bin"
|
|
],
|
|
"name": "hello-world",
|
|
"src_path": "$ROOT$hello-world/src/main.rs",
|
|
"edition": "2018",
|
|
"doc": true,
|
|
"doctest": false,
|
|
"test": true
|
|
},
|
|
{
|
|
"kind": [
|
|
"example"
|
|
],
|
|
"crate_types": [
|
|
"bin"
|
|
],
|
|
"name": "an-example",
|
|
"src_path": "$ROOT$hello-world/examples/an-example.rs",
|
|
"edition": "2018",
|
|
"doc": false,
|
|
"doctest": false,
|
|
"test": false
|
|
},
|
|
{
|
|
"kind": [
|
|
"test"
|
|
],
|
|
"crate_types": [
|
|
"bin"
|
|
],
|
|
"name": "it",
|
|
"src_path": "$ROOT$hello-world/tests/it.rs",
|
|
"edition": "2018",
|
|
"doc": false,
|
|
"doctest": false,
|
|
"test": true
|
|
}
|
|
],
|
|
"features": {},
|
|
"manifest_path": "$ROOT$hello-world/Cargo.toml",
|
|
"metadata": null,
|
|
"publish": null,
|
|
"authors": [],
|
|
"categories": [],
|
|
"keywords": [],
|
|
"readme": null,
|
|
"repository": null,
|
|
"homepage": null,
|
|
"documentation": null,
|
|
"edition": "2018",
|
|
"links": null
|
|
},
|
|
{
|
|
"name": "libc",
|
|
"version": "0.2.98",
|
|
"id": "libc 0.2.98 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
"license": "MIT OR Apache-2.0",
|
|
"license_file": null,
|
|
"description": "Raw FFI bindings to platform libraries like libc.\n",
|
|
"source": "registry+https://github.com/rust-lang/crates.io-index",
|
|
"dependencies": [
|
|
{
|
|
"name": "rustc-std-workspace-core",
|
|
"source": "registry+https://github.com/rust-lang/crates.io-index",
|
|
"req": "^1.0.0",
|
|
"kind": null,
|
|
"rename": null,
|
|
"optional": true,
|
|
"uses_default_features": true,
|
|
"features": [],
|
|
"target": null,
|
|
"registry": null
|
|
}
|
|
],
|
|
"targets": [
|
|
{
|
|
"kind": [
|
|
"lib"
|
|
],
|
|
"crate_types": [
|
|
"lib"
|
|
],
|
|
"name": "libc",
|
|
"src_path": "$ROOT$.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.98/src/lib.rs",
|
|
"edition": "2015",
|
|
"doc": true,
|
|
"doctest": true,
|
|
"test": true
|
|
},
|
|
{
|
|
"kind": [
|
|
"test"
|
|
],
|
|
"crate_types": [
|
|
"bin"
|
|
],
|
|
"name": "const_fn",
|
|
"src_path": "$ROOT$.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.98/tests/const_fn.rs",
|
|
"edition": "2015",
|
|
"doc": false,
|
|
"doctest": false,
|
|
"test": true
|
|
},
|
|
{
|
|
"kind": [
|
|
"custom-build"
|
|
],
|
|
"crate_types": [
|
|
"bin"
|
|
],
|
|
"name": "build-script-build",
|
|
"src_path": "$ROOT$.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.98/build.rs",
|
|
"edition": "2015",
|
|
"doc": false,
|
|
"doctest": false,
|
|
"test": false
|
|
}
|
|
],
|
|
"features": {
|
|
"align": [],
|
|
"const-extern-fn": [],
|
|
"default": [
|
|
"std"
|
|
],
|
|
"extra_traits": [],
|
|
"rustc-dep-of-std": [
|
|
"align",
|
|
"rustc-std-workspace-core"
|
|
],
|
|
"std": [],
|
|
"use_std": [
|
|
"std"
|
|
]
|
|
},
|
|
"manifest_path": "$ROOT$.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.98/Cargo.toml",
|
|
"metadata": null,
|
|
"publish": null,
|
|
"authors": [
|
|
"The Rust Project Developers"
|
|
],
|
|
"categories": [
|
|
"external-ffi-bindings",
|
|
"no-std",
|
|
"os"
|
|
],
|
|
"keywords": [
|
|
"libc",
|
|
"ffi",
|
|
"bindings",
|
|
"operating",
|
|
"system"
|
|
],
|
|
"readme": "README.md",
|
|
"repository": "https://github.com/rust-lang/libc",
|
|
"homepage": "https://github.com/rust-lang/libc",
|
|
"documentation": "https://docs.rs/libc/",
|
|
"edition": "2015",
|
|
"links": null
|
|
}
|
|
],
|
|
"workspace_members": [
|
|
"hello-world 0.1.0 (path+file://$ROOT$hello-world)"
|
|
],
|
|
"resolve": {
|
|
"nodes": [
|
|
{
|
|
"id": "hello-world 0.1.0 (path+file://$ROOT$hello-world)",
|
|
"dependencies": [
|
|
"libc 0.2.98 (registry+https://github.com/rust-lang/crates.io-index)"
|
|
],
|
|
"deps": [
|
|
{
|
|
"name": "libc",
|
|
"pkg": "libc 0.2.98 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
"dep_kinds": [
|
|
{
|
|
"kind": null,
|
|
"target": null
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"features": []
|
|
},
|
|
{
|
|
"id": "libc 0.2.98 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
"dependencies": [],
|
|
"deps": [],
|
|
"features": [
|
|
"default",
|
|
"std"
|
|
]
|
|
}
|
|
],
|
|
"root": "hello-world 0.1.0 (path+file://$ROOT$hello-world)"
|
|
},
|
|
"target_directory": "$ROOT$hello-world/target",
|
|
"version": 1,
|
|
"workspace_root": "$ROOT$hello-world",
|
|
"metadata": null
|
|
}
|