rust-lang / rust-lang/cargo

workspace.members that point to a file are silently ignored

Open
#16,611 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

A-workspaces C-bug S-triage
Dominant language
Rust
Stars
15.5k
Forks
3k
Avg merge
23h 30m
Merged PRs (30d)
51

Description

Problem

When workspace.members includes a path to a file, that member is silently ignored. I think it should at least be a warning, if not an error. This regressed in https://github.com/rust-lang/cargo/pull/8511 where it was changed to ignore files. But I think the intention there was only in the case of globing (such as when members points to a directory, and that directory contains stray files). It wasn't intended to ignore entries in members that pointed directly to a file.

Steps

Create a workspace:

[workspace]
members = [".", "./foo"]
[package]
name = "x"

Create an empty file "foo".
Create src/lib.rs.

Run cargo metadata. Note that it complete ignores "foo".

Possible Solution(s)

I think this should at least be a warning, but should probably be an error.

Notes

No response

Version
cargo 1.95.0-nightly (fe2f314ae 2026-01-30)
release: 1.95.0-nightly
commit-hash: fe2f314aef06e688a9517da1ac0577bb1854d01f
commit-date: 2026-01-30
host: aarch64-apple-darwin
libgit2: 1.9.2 (sys:0.20.3 vendored)
libcurl: 8.7.1 (sys:0.4.83+curl-8.15.0 system ssl:(SecureTransport) LibreSSL/3.3.6)
ssl: OpenSSL 3.5.4 30 Sep 2025
os: Mac OS 26.2.0 [64-bit]

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the case described by running cargo metadata with workspace.members containing a direct file path, then inspect workspace member resolution and the regression from pull request 8511. Done means a direct file entry is no longer silently ignored and produces the agreed diagnostic, either a warning or an error.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.