Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(TomlManifest): fail when package_root is not a directory #12722

Merged
merged 1 commit into from
Sep 22, 2023

Conversation

lovesegfault
Copy link
Contributor

What does this PR try to resolve?

Currently, if you're trying to use TomlManifest::to_real_manifest, and
you pass in something incorrect as the package_root, such as the path
to the package's manifest, you will get a weird error that looks like
this:

can't find library `dummy_lib`, rename file to `src/lib.rs` or specify lib.path

This is not very helpful, so this change makes us check that
package_root is a directory, and reports an error early on if it
isn't.

Currently, if you're trying to use `TomlManifest::to_real_manifest`, and
you pass in something incorrect as the `package_root`, such as the path
to the package's manifest, you will get a weird error that looks like
this:

```
can't find library `dummy_lib`, rename file to `src/lib.rs` or specify lib.path
```

This is not very helpful, so this change makes us check that
`package_root` is a directory, and reports an error early on if it
isn't.
@rustbot
Copy link
Collaborator

rustbot commented Sep 21, 2023

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @ehuss (or someone else) soon.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@rustbot rustbot added A-manifest Area: Cargo.toml issues S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 21, 2023
Copy link
Member

@weihanglo weihanglo left a comment

Choose a reason for hiding this comment

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

Although the team prioritize Cargo its development over a good user experience of using Cargo as a library at this moment, this tiny change does make sense without any extra cost. Thank you for the contribution!

@weihanglo
Copy link
Member

@bors r+

@bors
Copy link
Collaborator

bors commented Sep 22, 2023

📌 Commit c30151b has been approved by weihanglo

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 22, 2023
@bors
Copy link
Collaborator

bors commented Sep 22, 2023

⌛ Testing commit c30151b with merge 414d9e3...

@bors
Copy link
Collaborator

bors commented Sep 22, 2023

☀️ Test successful - checks-actions
Approved by: weihanglo
Pushing 414d9e3 to master...

@bors bors merged commit 414d9e3 into rust-lang:master Sep 22, 2023
20 checks passed
@lovesegfault lovesegfault deleted the validate-pkg-root branch September 22, 2023 16:46
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 22, 2023
Update cargo

19 commits in b4ddf95ad9954118ac0dae835f2966394ad04c02..414d9e3a6d8096f3e276234ce220c868767a8792
2023-09-18 03:48:09 +0000 to 2023-09-22 07:03:57 +0000
- refactor(TomlManifest): fail when package_root is not a directory (rust-lang/cargo#12722)
- Better suggestion for unsupported mode in build command (rust-lang/cargo#12693)
- Update curl-sys to pull in curl 8.3.0 (rust-lang/cargo#12718)
- chore(ci): Ignore patch version in MSRV (rust-lang/cargo#12716)
- refactor: move cached crates.io SourceID to config module (rust-lang/cargo#12711)
- fix: typos in registry authentication documentation (rust-lang/cargo#12714)
- doc: mention unstable flag `-Z asymmetric-token` (rust-lang/cargo#12712)
- fix: copy PDBs for EFI targets (rust-lang/cargo#12688)
- infra: add auto-trigger rules for new labels (rust-lang/cargo#12713)
- fix: use channel-specific link for registry auth error (rust-lang/cargo#12709)
- Add some enhancements to `cargo clean` (rust-lang/cargo#12638)
- chore: Fix typos (rust-lang/cargo#12707)
- Shortest path (rust-lang/cargo#12678)
- doc/reference/manifest: Adjust `keywords` description (rust-lang/cargo#12705)
- Cargo add displays either feature list or summarized count (rust-lang/cargo#12702)
- SemVer: Update documentation about removing optional dependencies (rust-lang/cargo#12687)
- publish.py: Remove obsolete `sleep()` calls (rust-lang/cargo#12686)
- generalise suggestion on abiguous spec (rust-lang/cargo#12685)
- util/toml: Remove duplicate `serde(rename)` attributes (rust-lang/cargo#12682)

r? ghost
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 22, 2023
Update cargo

19 commits in b4ddf95ad9954118ac0dae835f2966394ad04c02..414d9e3a6d8096f3e276234ce220c868767a8792
2023-09-18 03:48:09 +0000 to 2023-09-22 07:03:57 +0000
- refactor(TomlManifest): fail when package_root is not a directory (rust-lang/cargo#12722)
- Better suggestion for unsupported mode in build command (rust-lang/cargo#12693)
- Update curl-sys to pull in curl 8.3.0 (rust-lang/cargo#12718)
- chore(ci): Ignore patch version in MSRV (rust-lang/cargo#12716)
- refactor: move cached crates.io SourceID to config module (rust-lang/cargo#12711)
- fix: typos in registry authentication documentation (rust-lang/cargo#12714)
- doc: mention unstable flag `-Z asymmetric-token` (rust-lang/cargo#12712)
- fix: copy PDBs for EFI targets (rust-lang/cargo#12688)
- infra: add auto-trigger rules for new labels (rust-lang/cargo#12713)
- fix: use channel-specific link for registry auth error (rust-lang/cargo#12709)
- Add some enhancements to `cargo clean` (rust-lang/cargo#12638)
- chore: Fix typos (rust-lang/cargo#12707)
- Shortest path (rust-lang/cargo#12678)
- doc/reference/manifest: Adjust `keywords` description (rust-lang/cargo#12705)
- Cargo add displays either feature list or summarized count (rust-lang/cargo#12702)
- SemVer: Update documentation about removing optional dependencies (rust-lang/cargo#12687)
- publish.py: Remove obsolete `sleep()` calls (rust-lang/cargo#12686)
- generalise suggestion on abiguous spec (rust-lang/cargo#12685)
- util/toml: Remove duplicate `serde(rename)` attributes (rust-lang/cargo#12682)

r? ghost
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 23, 2023
Update cargo

19 commits in b4ddf95ad9954118ac0dae835f2966394ad04c02..414d9e3a6d8096f3e276234ce220c868767a8792
2023-09-18 03:48:09 +0000 to 2023-09-22 07:03:57 +0000
- refactor(TomlManifest): fail when package_root is not a directory (rust-lang/cargo#12722)
- Better suggestion for unsupported mode in build command (rust-lang/cargo#12693)
- Update curl-sys to pull in curl 8.3.0 (rust-lang/cargo#12718)
- chore(ci): Ignore patch version in MSRV (rust-lang/cargo#12716)
- refactor: move cached crates.io SourceID to config module (rust-lang/cargo#12711)
- fix: typos in registry authentication documentation (rust-lang/cargo#12714)
- doc: mention unstable flag `-Z asymmetric-token` (rust-lang/cargo#12712)
- fix: copy PDBs for EFI targets (rust-lang/cargo#12688)
- infra: add auto-trigger rules for new labels (rust-lang/cargo#12713)
- fix: use channel-specific link for registry auth error (rust-lang/cargo#12709)
- Add some enhancements to `cargo clean` (rust-lang/cargo#12638)
- chore: Fix typos (rust-lang/cargo#12707)
- Shortest path (rust-lang/cargo#12678)
- doc/reference/manifest: Adjust `keywords` description (rust-lang/cargo#12705)
- Cargo add displays either feature list or summarized count (rust-lang/cargo#12702)
- SemVer: Update documentation about removing optional dependencies (rust-lang/cargo#12687)
- publish.py: Remove obsolete `sleep()` calls (rust-lang/cargo#12686)
- generalise suggestion on abiguous spec (rust-lang/cargo#12685)
- util/toml: Remove duplicate `serde(rename)` attributes (rust-lang/cargo#12682)

r? ghost
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Sep 23, 2023
Update cargo

19 commits in b4ddf95ad9954118ac0dae835f2966394ad04c02..414d9e3a6d8096f3e276234ce220c868767a8792
2023-09-18 03:48:09 +0000 to 2023-09-22 07:03:57 +0000
- refactor(TomlManifest): fail when package_root is not a directory (rust-lang/cargo#12722)
- Better suggestion for unsupported mode in build command (rust-lang/cargo#12693)
- Update curl-sys to pull in curl 8.3.0 (rust-lang/cargo#12718)
- chore(ci): Ignore patch version in MSRV (rust-lang/cargo#12716)
- refactor: move cached crates.io SourceID to config module (rust-lang/cargo#12711)
- fix: typos in registry authentication documentation (rust-lang/cargo#12714)
- doc: mention unstable flag `-Z asymmetric-token` (rust-lang/cargo#12712)
- fix: copy PDBs for EFI targets (rust-lang/cargo#12688)
- infra: add auto-trigger rules for new labels (rust-lang/cargo#12713)
- fix: use channel-specific link for registry auth error (rust-lang/cargo#12709)
- Add some enhancements to `cargo clean` (rust-lang/cargo#12638)
- chore: Fix typos (rust-lang/cargo#12707)
- Shortest path (rust-lang/cargo#12678)
- doc/reference/manifest: Adjust `keywords` description (rust-lang/cargo#12705)
- Cargo add displays either feature list or summarized count (rust-lang/cargo#12702)
- SemVer: Update documentation about removing optional dependencies (rust-lang/cargo#12687)
- publish.py: Remove obsolete `sleep()` calls (rust-lang/cargo#12686)
- generalise suggestion on abiguous spec (rust-lang/cargo#12685)
- util/toml: Remove duplicate `serde(rename)` attributes (rust-lang/cargo#12682)

r? ghost
@ehuss ehuss added this to the 1.74.0 milestone Sep 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-manifest Area: Cargo.toml issues S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants