-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
oli-obk/cargo_metadata
#300Labels
C-bugCategory: bugCategory: bug
Description
rust-analyzer version: rust-analyzer version: 0.4.2497-standalone
rustc version: rustc 1.89.0-nightly (414482f6a 2025-05-13)
editor or extension: vscode
relevant settings: cargo flag -Z bindeps
repository link (if public, optional): https://github.com/rust-osdev/bootloader/blob/main/docs/create-disk-image.md
I am following the template of the bootloader
crate. It uses the bindeps feature within a workspace. rust-analyzer crashes with the following log (this is with RA_LOG=info)
2025-06-14T14:11:43.962787151+02:00 INFO did fetch workspaces workspaces=[Err(Failed to load the project at /rust/osdev/Cargo.toml
Caused by:
0: Failed to read Cargo metadata from Cargo.toml file /rust/osdev/Cargo.toml, Some(Version { major: 1, minor: 89, patch: 0, pre: Prerelease("nightly") })
1: Failed to run `cd "/rust/osdev" && RUSTUP_TOOLCHAIN="/.rustup/toolchains/nightly-2025-05-14-x86_64-unknown-linux-gnu" "/.cargo/bin/cargo" "metadata" "--format-version" "1" "--manifest-path" "/rust/osdev/Cargo.toml" "--filter-platform" "x86_64-unknown-linux-gnu"`
2: failed to interpret `cargo metadata`'s json: package name cannot be empty at line 1 column 373705
3: package name cannot be empty at line 1 column 373705
Stack backtrace:
0: anyhow::error::<impl core::convert::From<E> for anyhow::Error>::from
1: project_model::cargo_workspace::CargoWorkspace::fetch_metadata_
2: project_model::cargo_workspace::CargoWorkspace::fetch_metadata
3: std::sys::backtrace::__rust_begin_short_backtrace
4: core::ops::function::FnOnce::call_once{{vtable.shim}}
5: std::sys::pal::unix::thread::Thread::new::thread_start
6: start_thread
at ./nptl/pthread_create.c:447:8
7: clone3
at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78:0)]
2025-06-14T14:11:43.962919946+02:00 ERROR GlobalState::handle_event{event=Event::Task}:GlobalState::handle_event/task: FetchWorkspaceError: rust-analyzer failed to load workspace: Failed to load the project at /rust/osdev/Cargo.toml: Failed to read Cargo metadata from Cargo.toml file /rust/osdev/Cargo.toml, Some(Version { major: 1, minor: 89, patch: 0, pre: Prerelease("nightly") }): Failed to run `cd "/rust/osdev" && RUSTUP_TOOLCHAIN="/.rustup/toolchains/nightly-2025-05-14-x86_64-unknown-linux-gnu" "/.cargo/bin/cargo" "metadata" "--format-version" "1" "--manifest-path" "/rust/osdev/Cargo.toml" "--filter-platform" "x86_64-unknown-linux-gnu"`: failed to interpret `cargo metadata`'s json: package name cannot be empty at line 1 column 373705: package name cannot be empty at line 1 column 373705
the metadata json emitted by cargo does in fact have this entry in resolve.nodes
{
"id": "path+file:///rust/osdev#os@0.1.0",
"dependencies": [
"registry+https://github.com/rust-lang/crates.io-index#bootloader@0.11.10",
"path+file:///rust/osdev/kernel#0.1.0",
"registry+https://github.com/rust-lang/crates.io-index#ovmf-prebuilt@0.2.3"
],
"deps": [
{
"name": "bootloader",
"pkg": "registry+https://github.com/rust-lang/crates.io-index#bootloader@0.11.10",
"dep_kinds": [
{
"kind": "build",
"target": null
}
]
},
{
"name": "",
"pkg": "path+file:///rust/osdev/kernel#0.1.0",
"dep_kinds": [
{
"kind": "build",
"target": null,
"extern_name": "kernel",
"artifact": "bin",
"compile_target": "x86_64-unknown-none",
"bin_name": "kernel"
}
]
},
{
"name": "ovmf_prebuilt",
"pkg": "registry+https://github.com/rust-lang/crates.io-index#ovmf-prebuilt@0.2.3",
"dep_kinds": [
{
"kind": null,
"target": null
}
]
}
],
"features": []
},
kevinjoseph1995wada314, asahi-myzk, kevinjoseph1995 and YtvwlD
Metadata
Metadata
Assignees
Labels
C-bugCategory: bugCategory: bug