Skip to content

fix(util-schemas): compile out the file-path hint where url can't build it - #17600

Merged
weihanglo merged 1 commit into
rust-lang:masterfrom
UebelAndre:from_file_path
Oct 19, 2026
Merged

weihanglo merged 1 commit into
rust-lang:masterfrom
UebelAndre:from_file_path

Conversation

@UebelAndre

@UebelAndre UebelAndre commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Part of #17595.

What does this PR try to resolve?

cargo-util-schemas is consumed by third-party tools, some of which run on targets with no filesystem, environment, or network, such as wasm32-unknown-unknown. PackageIdSpec::parse probed the current directory to suggest a file:// URL for specs that look like paths, and that does not compile there: url only provides Url::from_file_path on unix, windows, redox, wasi, and hermit.

The hint is purely diagnostic, so it is now compiled out behind the same cfg that url uses. Behavior is unchanged on every target that built before.

How to test and review this PR?

A new CI job checks that cargo-util-schemas builds for wasm32-unknown-unknown; locally that is cargo check -p cargo-util-schemas --all-features --target wasm32-unknown-unknown. The existing pkgid tests cover the hint on supported targets.

@rustbot rustbot added the A-infrastructure Area: infrastructure around the cargo repo, ci, releases, etc. label Oct 16, 2026
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 16, 2026
@rustbot

rustbot commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the pull request, and welcome! The Rust Project has assigned @Muscraft (or someone else) to review your changes, you should hear from them (or someone else) within the next two weeks.

Please see the contribution instructions and our LLM policy for more information.

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @Muscraft, @epage, @weihanglo
  • @Muscraft, @epage, @weihanglo expanded to Muscraft, epage, weihanglo
  • Random selection from Muscraft, epage, weihanglo

@UebelAndre
UebelAndre requested a review from epage October 16, 2026 16:51
@epage

epage commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Note that our contrib guide asks for atomic commits.

Comment thread .github/workflows/main.yml Outdated
Comment on lines +273 to +282
# `cargo-util-schemas` is consumed by third-party tools, some of which run
# on targets with no filesystem, environment, clock, or network.
- run: rustup target add wasm32-unknown-unknown
- run: cargo check -p cargo-util-schemas --all-features --target wasm32-unknown-unknown --locked

@epage epage Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unrelated to the job it is operating in

We also have a job for enforcing --locked

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated!

Comment on lines +87 to +91
// This is purely a diagnostic: if the spec names an existing
// path, suggest the `file://` URL that would be accepted instead.
// `Url::from_file_path` only exists on targets with a known path
// syntax, so the hint is compiled out elsewhere (e.g.
// `wasm32-unknown-unknown`), keeping this crate buildable there.

@epage epage Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels fairly verbose for what needs to be said

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated!

@UebelAndre UebelAndre changed the title fix(util-schemas): keep PackageIdSpec::parse free of host access fix(util-schemas): compile out the file-path hint where url can't build it Oct 17, 2026
@UebelAndre
UebelAndre requested a review from epage October 17, 2026 02:42
@UebelAndre

Copy link
Copy Markdown
Contributor Author

Updated the PR title, description, and commit.

@rustbot ready

…uild it

`cargo-util-schemas` is consumed by third-party tools, some of which run
on targets like `wasm32-unknown-unknown` that have no filesystem. There
`Url::from_file_path` doesn't exist, so the crate failed to compile.
The hint that suggests a `file://` URL for a path-like spec is purely
diagnostic, so gate it on the same `cfg` `url` uses.

@weihanglo weihanglo left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@weihanglo
weihanglo added this pull request to the merge queue Oct 19, 2026
Merged via the queue into rust-lang:master with commit 587d7ab Oct 19, 2026
30 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 19, 2026
rust-bors Bot pushed a commit to rust-lang/rust that referenced this pull request Oct 21, 2026
Update cargo submodule

12 commits in 3960fa69bb617e3d93c4ddc087c1b32bf12ad907..15be64aa0859b5c36f7a86d52f7aa0db44ba4d84
2026-10-12 19:29:05 +0000 to 2026-10-20 16:03:21 +0000
- feat(prerelease): support `[patch]` with `-Zprerelease` (rust-lang/cargo#17613)
- chore(gh): Overhaul PR template (rust-lang/cargo#17612)
- fix(util-schemas): compile out the file-path hint where url can't build it (rust-lang/cargo#17600)
- feat(build-std): Add build.build-std.when and crates config keys (rust-lang/cargo#17602)
- refactor(confg): Create a config abstraction (rust-lang/cargo#17606)
- fix(config): Apply dotted tuple support for rustflags (rust-lang/cargo#17594)
- Feat: Shell completion show all the packages having the feature (rust-lang/cargo#17574)
- fix(config): Don't load registry config from credentials.toml (rust-lang/cargo#17599)
- fix(fingerprint): choose a stable path when source mtimes tie (rust-lang/cargo#17521)
- Update gix crates to address CVE-2026-82248, CVE-2026-82249, and CVE-2026-82250, and update git utils.rs to accommodate gix-url v0.38.0. (rust-lang/cargo#17484)
- fix: check crate type when pruning `-L` paths (rust-lang/cargo#17589)
- refactor(parser): Simplify dep source validation (rust-lang/cargo#17506)

r? ghost
rust-bors Bot pushed a commit to rust-lang/rust that referenced this pull request Oct 22, 2026
Update cargo submodule

12 commits in 3960fa69bb617e3d93c4ddc087c1b32bf12ad907..15be64aa0859b5c36f7a86d52f7aa0db44ba4d84
2026-10-12 19:29:05 +0000 to 2026-10-20 16:03:21 +0000
- feat(prerelease): support `[patch]` with `-Zprerelease` (rust-lang/cargo#17613)
- chore(gh): Overhaul PR template (rust-lang/cargo#17612)
- fix(util-schemas): compile out the file-path hint where url can't build it (rust-lang/cargo#17600)
- feat(build-std): Add build.build-std.when and crates config keys (rust-lang/cargo#17602)
- refactor(confg): Create a config abstraction (rust-lang/cargo#17606)
- fix(config): Apply dotted tuple support for rustflags (rust-lang/cargo#17594)
- Feat: Shell completion show all the packages having the feature (rust-lang/cargo#17574)
- fix(config): Don't load registry config from credentials.toml (rust-lang/cargo#17599)
- fix(fingerprint): choose a stable path when source mtimes tie (rust-lang/cargo#17521)
- Update gix crates to address CVE-2026-82248, CVE-2026-82249, and CVE-2026-82250, and update git utils.rs to accommodate gix-url v0.38.0. (rust-lang/cargo#17484)
- fix: check crate type when pruning `-L` paths (rust-lang/cargo#17589)
- refactor(parser): Simplify dep source validation (rust-lang/cargo#17506)

r? ghost
@rustbot rustbot added this to the 1.101.0 milestone Oct 22, 2026
WhySoBad pushed a commit to WhySoBad/miri that referenced this pull request Oct 23, 2026
Update cargo submodule

12 commits in 3960fa69bb617e3d93c4ddc087c1b32bf12ad907..15be64aa0859b5c36f7a86d52f7aa0db44ba4d84
2026-10-12 19:29:05 +0000 to 2026-10-20 16:03:21 +0000
- feat(prerelease): support `[patch]` with `-Zprerelease` (rust-lang/cargo#17613)
- chore(gh): Overhaul PR template (rust-lang/cargo#17612)
- fix(util-schemas): compile out the file-path hint where url can't build it (rust-lang/cargo#17600)
- feat(build-std): Add build.build-std.when and crates config keys (rust-lang/cargo#17602)
- refactor(confg): Create a config abstraction (rust-lang/cargo#17606)
- fix(config): Apply dotted tuple support for rustflags (rust-lang/cargo#17594)
- Feat: Shell completion show all the packages having the feature (rust-lang/cargo#17574)
- fix(config): Don't load registry config from credentials.toml (rust-lang/cargo#17599)
- fix(fingerprint): choose a stable path when source mtimes tie (rust-lang/cargo#17521)
- Update gix crates to address CVE-2026-82248, CVE-2026-82249, and CVE-2026-82250, and update git utils.rs to accommodate gix-url v0.38.0. (rust-lang/cargo#17484)
- fix: check crate type when pruning `-L` paths (rust-lang/cargo#17589)
- refactor(parser): Simplify dep source validation (rust-lang/cargo#17506)

r? ghost
github-actions Bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Oct 25, 2026
Update cargo submodule

12 commits in 3960fa69bb617e3d93c4ddc087c1b32bf12ad907..15be64aa0859b5c36f7a86d52f7aa0db44ba4d84
2026-10-12 19:29:05 +0000 to 2026-10-20 16:03:21 +0000
- feat(prerelease): support `[patch]` with `-Zprerelease` (rust-lang/cargo#17613)
- chore(gh): Overhaul PR template (rust-lang/cargo#17612)
- fix(util-schemas): compile out the file-path hint where url can't build it (rust-lang/cargo#17600)
- feat(build-std): Add build.build-std.when and crates config keys (rust-lang/cargo#17602)
- refactor(confg): Create a config abstraction (rust-lang/cargo#17606)
- fix(config): Apply dotted tuple support for rustflags (rust-lang/cargo#17594)
- Feat: Shell completion show all the packages having the feature (rust-lang/cargo#17574)
- fix(config): Don't load registry config from credentials.toml (rust-lang/cargo#17599)
- fix(fingerprint): choose a stable path when source mtimes tie (rust-lang/cargo#17521)
- Update gix crates to address CVE-2026-82248, CVE-2026-82249, and CVE-2026-82250, and update git utils.rs to accommodate gix-url v0.38.0. (rust-lang/cargo#17484)
- fix: check crate type when pruning `-L` paths (rust-lang/cargo#17589)
- refactor(parser): Simplify dep source validation (rust-lang/cargo#17506)

r? ghost
github-actions Bot pushed a commit to rust-lang/stdarch that referenced this pull request Oct 26, 2026
Update cargo submodule

12 commits in 3960fa69bb617e3d93c4ddc087c1b32bf12ad907..15be64aa0859b5c36f7a86d52f7aa0db44ba4d84
2026-10-12 19:29:05 +0000 to 2026-10-20 16:03:21 +0000
- feat(prerelease): support `[patch]` with `-Zprerelease` (rust-lang/cargo#17613)
- chore(gh): Overhaul PR template (rust-lang/cargo#17612)
- fix(util-schemas): compile out the file-path hint where url can't build it (rust-lang/cargo#17600)
- feat(build-std): Add build.build-std.when and crates config keys (rust-lang/cargo#17602)
- refactor(confg): Create a config abstraction (rust-lang/cargo#17606)
- fix(config): Apply dotted tuple support for rustflags (rust-lang/cargo#17594)
- Feat: Shell completion show all the packages having the feature (rust-lang/cargo#17574)
- fix(config): Don't load registry config from credentials.toml (rust-lang/cargo#17599)
- fix(fingerprint): choose a stable path when source mtimes tie (rust-lang/cargo#17521)
- Update gix crates to address CVE-2026-82248, CVE-2026-82249, and CVE-2026-82250, and update git utils.rs to accommodate gix-url v0.38.0. (rust-lang/cargo#17484)
- fix: check crate type when pruning `-L` paths (rust-lang/cargo#17589)
- refactor(parser): Simplify dep source validation (rust-lang/cargo#17506)

r? ghost
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-infrastructure Area: infrastructure around the cargo repo, ci, releases, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants