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

chore: Update snapbox #13441

Merged
merged 2 commits into from
Feb 16, 2024
Merged

chore: Update snapbox #13441

merged 2 commits into from
Feb 16, 2024

Conversation

epage
Copy link
Contributor

@epage epage commented Feb 15, 2024

No description provided.

@rustbot
Copy link
Collaborator

rustbot commented Feb 15, 2024

r? @ehuss

rustbot has assigned @ehuss.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@epage epage marked this pull request as draft February 15, 2024 15:51
@rustbot rustbot added A-testing-cargo-itself Area: cargo's tests S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 15, 2024
@epage epage force-pushed the snapbox branch 3 times, most recently from f222712 to 25ae68b Compare February 15, 2024 19:33
@rustbot rustbot added the A-cli-help Area: built-in command-line help label Feb 15, 2024
@epage epage marked this pull request as ready for review February 16, 2024 13:09
Copy link
Member

@Rustin170506 Rustin170506 left a comment

Choose a reason for hiding this comment

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

Looks good to me. Thanks! 👍

Snapbox's polyfill for `CARGO_RUSTC_CURRENT_DIR` looks for the furthest
away `Cargo.toml`.
That works in our repo but won't work as a submodule in rustc.
This uses the `config.toml` hack for setting the variable.

I verified
- Without this, the polyfill is used
- With this, it is used
- Without this on nightly, the official `CARGO_RUSTC_CURRENT_DIR` is
  used
@rustbot rustbot added the A-infrastructure Area: infrastructure around the cargo repo, ci, releases, etc. label Feb 16, 2024
@Muscraft
Copy link
Member

This looks good to me! I am a little worried about this working in rust-lang/rust but I think your solution should work.

@Muscraft
Copy link
Member

@bors r+

@bors
Copy link
Collaborator

bors commented Feb 16, 2024

📌 Commit 9f31f8c has been approved by Muscraft

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 Feb 16, 2024
@bors
Copy link
Collaborator

bors commented Feb 16, 2024

⌛ Testing commit 9f31f8c with merge 9090349...

@bors
Copy link
Collaborator

bors commented Feb 16, 2024

☀️ Test successful - checks-actions
Approved by: Muscraft
Pushing 9090349 to master...

@bors bors merged commit 9090349 into rust-lang:master Feb 16, 2024
23 checks passed
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 17, 2024
Update cargo

11 commits in fc1d58fd0531a57a6b942a14cdcdbcb82ece16f3..9090349adc88e0fcae2644c2cceb830124a10d5d
2024-02-09 15:54:29 +0000 to 2024-02-16 16:56:57 +0000
- chore: Update snapbox (rust-lang/cargo#13441)
- chore(deps): update openssl to 3.2.1 again (rust-lang/cargo#13449)
- fix(test): Suggest `--` for libtest arguments (rust-lang/cargo#13448)
- chore(ci): Drop MSRV:1 patch field (rust-lang/cargo#13442)
- fix(add): Remove inconsistent period (rust-lang/cargo#13446)
- fix(add): Ensure users know a feature is being created (rust-lang/cargo#13434)
- Update tests for changes in latest nightly (rust-lang/cargo#13444)
- docs: Minor clarification of build script metadata. (rust-lang/cargo#13436)
- Fix old_cargos tests (rust-lang/cargo#13435)
- Fix confusing error messages for sparse index replaced source (rust-lang/cargo#13433)
- Enable edition migration for 2024 (rust-lang/cargo#13429)

r? ghost
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 17, 2024
Update cargo

11 commits in fc1d58fd0531a57a6b942a14cdcdbcb82ece16f3..9090349adc88e0fcae2644c2cceb830124a10d5d
2024-02-09 15:54:29 +0000 to 2024-02-16 16:56:57 +0000
- chore: Update snapbox (rust-lang/cargo#13441)
- chore(deps): update openssl to 3.2.1 again (rust-lang/cargo#13449)
- fix(test): Suggest `--` for libtest arguments (rust-lang/cargo#13448)
- chore(ci): Drop MSRV:1 patch field (rust-lang/cargo#13442)
- fix(add): Remove inconsistent period (rust-lang/cargo#13446)
- fix(add): Ensure users know a feature is being created (rust-lang/cargo#13434)
- Update tests for changes in latest nightly (rust-lang/cargo#13444)
- docs: Minor clarification of build script metadata. (rust-lang/cargo#13436)
- Fix old_cargos tests (rust-lang/cargo#13435)
- Fix confusing error messages for sparse index replaced source (rust-lang/cargo#13433)
- Enable edition migration for 2024 (rust-lang/cargo#13429)

r? ghost
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 18, 2024
Update cargo

12 commits in fc1d58fd0531a57a6b942a14cdcdbcb82ece16f3..7b7af3077bff8d60b7f124189bc9de227d3063a9
2024-02-09 15:54:29 +0000 to 2024-02-17 14:13:00 +0000
- Remove unnecessary `use` statement in metabuild (rust-lang/cargo#13455)
- chore: Update snapbox (rust-lang/cargo#13441)
- chore(deps): update openssl to 3.2.1 again (rust-lang/cargo#13449)
- fix(test): Suggest `--` for libtest arguments (rust-lang/cargo#13448)
- chore(ci): Drop MSRV:1 patch field (rust-lang/cargo#13442)
- fix(add): Remove inconsistent period (rust-lang/cargo#13446)
- fix(add): Ensure users know a feature is being created (rust-lang/cargo#13434)
- Update tests for changes in latest nightly (rust-lang/cargo#13444)
- docs: Minor clarification of build script metadata. (rust-lang/cargo#13436)
- Fix old_cargos tests (rust-lang/cargo#13435)
- Fix confusing error messages for sparse index replaced source (rust-lang/cargo#13433)
- Enable edition migration for 2024 (rust-lang/cargo#13429)
@rustbot rustbot added this to the 1.78.0 milestone Feb 18, 2024
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Feb 18, 2024
Update cargo

12 commits in fc1d58fd0531a57a6b942a14cdcdbcb82ece16f3..7b7af3077bff8d60b7f124189bc9de227d3063a9
2024-02-09 15:54:29 +0000 to 2024-02-17 14:13:00 +0000
- Remove unnecessary `use` statement in metabuild (rust-lang/cargo#13455)
- chore: Update snapbox (rust-lang/cargo#13441)
- chore(deps): update openssl to 3.2.1 again (rust-lang/cargo#13449)
- fix(test): Suggest `--` for libtest arguments (rust-lang/cargo#13448)
- chore(ci): Drop MSRV:1 patch field (rust-lang/cargo#13442)
- fix(add): Remove inconsistent period (rust-lang/cargo#13446)
- fix(add): Ensure users know a feature is being created (rust-lang/cargo#13434)
- Update tests for changes in latest nightly (rust-lang/cargo#13444)
- docs: Minor clarification of build script metadata. (rust-lang/cargo#13436)
- Fix old_cargos tests (rust-lang/cargo#13435)
- Fix confusing error messages for sparse index replaced source (rust-lang/cargo#13433)
- Enable edition migration for 2024 (rust-lang/cargo#13429)
@epage epage deleted the snapbox branch February 19, 2024 19:42
epage added a commit to epage/cargo that referenced this pull request Mar 26, 2024
This provides what cargo sets as the `current_dir` for the `rustc`
process.
While `std::file!` is unspecified in what it is relative to,
it is relatively safe, it is generally relative to `rustc`s
`current_dir`.

This can be useful for snapshot testing.
For example, `snapbox` has been using this macro on nightly since
assert-rs/snapbox#247, falling back to finding a parent of
`CARGO_MANIFEST_DIR`, if present.
This has been in use in Cargo since rust-lang#13441.

This was added in rust-lang#12996.
Relevant points discussed in that issue:
- This diverged from the original proposal from the Cargo team of having
  a `CARGO_WORKSPACE_DIR` that is the "workspace" of the package being
  built (ie registry packages would map to `CARGO_MANIFEST_DIR`).
  In looking at the `std::file!` use case, `CARGO_MANIFEST_DIR`, no
  matter how we defined it, would only sort of work because no sane
  definition of that maps to `rustc`'s `current_dir`.a
  This instead focuses on the mechanism currently being used.
- Using "current dir" in the name is meant to be consistent with
  `std::env::current_dir`.
- I can go either way on `CARGO_RUSTC` vs `RUSTC`.  Existing related
  variables:
  - `RUSTC`
  - `RUSTC_WRAPPER`
  - `RUSTC_WORKSPACE_WRAPPER`
  - `RUSTFLAGS` (no `C`)
  - `CARGO_CACHE_RUSTC_INFO`

Note that rust-lang#3946 was overly broad and covered many use cases.
One of those was for packages to look up information on their
dependents.
Issue rust-lang#13484 is being left open to track that.

Fixes rust-lang#3946
epage added a commit to epage/cargo that referenced this pull request May 21, 2024
This provides what cargo sets as the `current_dir` for the `rustc`
process.
While `std::file!` is unspecified in what it is relative to,
it is relatively safe, it is generally relative to `rustc`s
`current_dir`.

This can be useful for snapshot testing.
For example, `snapbox` has been using this macro on nightly since
assert-rs/snapbox#247, falling back to finding a parent of
`CARGO_MANIFEST_DIR`, if present.
This has been in use in Cargo since rust-lang#13441.

This was added in rust-lang#12996.
Relevant points discussed in that issue:
- This diverged from the original proposal from the Cargo team of having
  a `CARGO_WORKSPACE_DIR` that is the "workspace" of the package being
  built (ie registry packages would map to `CARGO_MANIFEST_DIR`).
  In looking at the `std::file!` use case, `CARGO_MANIFEST_DIR`, no
  matter how we defined it, would only sort of work because no sane
  definition of that maps to `rustc`'s `current_dir`.a
  This instead focuses on the mechanism currently being used.
- Using "current dir" in the name is meant to be consistent with
  `std::env::current_dir`.
- I can go either way on `CARGO_RUSTC` vs `RUSTC`.  Existing related
  variables:
  - `RUSTC`
  - `RUSTC_WRAPPER`
  - `RUSTC_WORKSPACE_WRAPPER`
  - `RUSTFLAGS` (no `C`)
  - `CARGO_CACHE_RUSTC_INFO`

Note that rust-lang#3946 was overly broad and covered many use cases.
One of those was for packages to look up information on their
dependents.
Issue rust-lang#13484 is being left open to track that.

Fixes rust-lang#3946
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cli-help Area: built-in command-line help A-infrastructure Area: infrastructure around the cargo repo, ci, releases, etc. A-testing-cargo-itself Area: cargo's tests 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.

6 participants