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

Don't enable anyhow's backtrace feature in opt-dist #135146

Merged
merged 1 commit into from
Jan 7, 2025

Conversation

Zalathar
Copy link
Contributor

@Zalathar Zalathar commented Jan 6, 2025

As of the stabilization of std::backtrace in Rust 1.65, this package flag has no effect other than to enable an unused dependency on the backtrace crate.

(See https://github.com/dtolnay/anyhow/blob/af0937ef72fbaf9784a6c991e029738728d025e2/Cargo.toml#L18-L23.)

While the presence of this feature in opt-dist doesn't cause other tools (which use anyhow) to actually build backtrace, it does affect the global crate graph used for dependency version resolution. After removing this feature, we can use cargo tree --invert --package backtrace to see that the only remaining reverse-dependency of backtrace is color-eyre, which is used by ui_test.

As of the stabilization of `std::backtrace` in Rust 1.65, this package flag has
no effect other than to enable an unused dependency on the `backtrace` crate.
@rustbot
Copy link
Collaborator

rustbot commented Jan 6, 2025

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
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

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 6, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jan 6, 2025

Some changes occurred in src/tools/opt-dist

cc @Kobzol

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

@Zalathar
Copy link
Contributor Author

Zalathar commented Jan 6, 2025

I noticed this while looking into why we use 3 different versions of gimli, via #135115 (comment).

@Zalathar
Copy link
Contributor Author

Zalathar commented Jan 6, 2025

(I'm not familiar with opt-dist, so it's possible that this is important for some reason that I'm not aware of, but I doubt it.)

@lqd
Copy link
Member

lqd commented Jan 6, 2025

How does an opt-dist error look with this PR?

@Zalathar
Copy link
Contributor Author

Zalathar commented Jan 6, 2025

As far as I can tell, the stack traces printed by opt-dist look identical with and without this PR, right down to the first line of the backtrace being this in both cases:

   0: std::backtrace_rs::backtrace::libunwind::trace
Here's the full stderr of an erroneous invocation of opt-dist. It's identical (other than timestamps) to the same invocation without this PR.
[2025-01-06T07:03:16.926Z INFO  opt_dist::utils::io] Resetting directory opt-artifacts
[2025-01-06T07:03:17.403Z INFO  opt_dist::utils::io] Copying directory ./src/tools/rustc-perf to opt-artifacts/rustc-perf
[2025-01-06T07:03:18.722Z INFO  opt_dist::exec] Executing `RUSTC=./build/bogus/stage0/bin/rustc RUSTC_BOOTSTRAP=1 ./build/bogus/stage0/bin/cargo build -p collector [at opt-artifacts/rustc-perf]`
[2025-01-06T07:03:18.723Z INFO  opt_dist] Timer results
    -----------------------------------------
    
    Total duration:                        0s
    -----------------------------------------
    
[2025-01-06T07:03:18.752Z INFO  opt_dist::utils] Free disk space: 994.42 GiB out of total 1.81 TiB (46.33% used)
Error: Optimized build pipeline has failed

Caused by:
    No such file or directory (os error 2)

Stack backtrace:
   0: std::backtrace_rs::backtrace::libunwind::trace
             at /rustc/b4297a573b4eefacd62e7ea1ba071536282d3254/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
   1: std::backtrace_rs::backtrace::trace_unsynchronized
             at /rustc/b4297a573b4eefacd62e7ea1ba071536282d3254/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2: std::backtrace::Backtrace::create
             at /rustc/b4297a573b4eefacd62e7ea1ba071536282d3254/library/std/src/backtrace.rs:331:13
   3: from<std::io::error::Error>
             at /Users/stuart/.cargo/registry/src/index.crates.io-6f17d22bba15001f/anyhow-1.0.95/src/backtrace.rs:27:14
   4: from_residual<(), std::io::error::Error, anyhow::Error>
             at /rustc/b4297a573b4eefacd62e7ea1ba071536282d3254/library/core/src/result.rs:2009:27
   5: run
             at ./src/tools/opt-dist/src/exec.rs:78:27
   6: build_rustc_perf
             at ./src/tools/opt-dist/src/main.rs:422:5
   7: copy_rustc_perf
             at ./src/tools/opt-dist/src/main.rs:418:5
   8: {closure#0}
             at ./src/tools/opt-dist/src/main.rs:205:9
   9: execute_pipeline
             at ./src/tools/opt-dist/src/main.rs:200:5
  10: main
             at ./src/tools/opt-dist/src/main.rs:401:18
  11: call_once<fn() -> core::result::Result<(), anyhow::Error>, ()>
             at /rustc/b4297a573b4eefacd62e7ea1ba071536282d3254/library/core/src/ops/function.rs:250:5
  12: __rust_begin_short_backtrace<fn() -> core::result::Result<(), anyhow::Error>, core::result::Result<(), anyhow::Error>>
             at /rustc/b4297a573b4eefacd62e7ea1ba071536282d3254/library/std/src/sys/backtrace.rs:154:18
  13: std::rt::lang_start::<core::result::Result<(), anyhow::Error>>::{closure#0}
  14: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once
             at /rustc/b4297a573b4eefacd62e7ea1ba071536282d3254/library/core/src/ops/function.rs:284:13
  15: std::panicking::try::do_call
             at /rustc/b4297a573b4eefacd62e7ea1ba071536282d3254/library/std/src/panicking.rs:557:40
  16: std::panicking::try
             at /rustc/b4297a573b4eefacd62e7ea1ba071536282d3254/library/std/src/panicking.rs:520:19
  17: std::panic::catch_unwind
             at /rustc/b4297a573b4eefacd62e7ea1ba071536282d3254/library/std/src/panic.rs:358:14
  18: std::rt::lang_start_internal::{{closure}}
             at /rustc/b4297a573b4eefacd62e7ea1ba071536282d3254/library/std/src/rt.rs:174:48
  19: std::panicking::try::do_call
             at /rustc/b4297a573b4eefacd62e7ea1ba071536282d3254/library/std/src/panicking.rs:557:40
  20: std::panicking::try
             at /rustc/b4297a573b4eefacd62e7ea1ba071536282d3254/library/std/src/panicking.rs:520:19
  21: std::panic::catch_unwind
             at /rustc/b4297a573b4eefacd62e7ea1ba071536282d3254/library/std/src/panic.rs:358:14
  22: std::rt::lang_start_internal
             at /rustc/b4297a573b4eefacd62e7ea1ba071536282d3254/library/std/src/rt.rs:174:20
  23: _main

Copy link
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

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

Thanks

@jieyouxu
Copy link
Member

jieyouxu commented Jan 6, 2025

r? jieyouxu @bors r+ rollup

@bors
Copy link
Contributor

bors commented Jan 6, 2025

📌 Commit 85e0d42 has been approved by jieyouxu

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 Jan 6, 2025
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 6, 2025
Don't enable anyhow's `backtrace` feature in opt-dist

As of the stabilization of `std::backtrace` in Rust 1.65, this package flag has no effect other than to enable an unused dependency on the `backtrace` crate.

(See <https://github.com/dtolnay/anyhow/blob/af0937ef72fbaf9784a6c991e029738728d025e2/Cargo.toml#L18-L23>.)

While the presence of this feature in opt-dist doesn't cause other tools (which use anyhow) to actually *build* backtrace, it does affect the global crate graph used for dependency version resolution. After removing this feature, we can use `cargo tree --invert --package backtrace` to see that the only remaining reverse-dependency of backtrace is `color-eyre`, which is used by `ui_test`.
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 6, 2025
…iaskrgr

Rollup of 4 pull requests

Successful merges:

 - rust-lang#134742 (Use `PostBorrowckAnalysis` in `check_coroutine_obligations`)
 - rust-lang#134771 (Report correct `SelectionError` for `ConstArgHasType` in new solver fulfill)
 - rust-lang#135146 (Don't enable anyhow's `backtrace` feature in opt-dist)
 - rust-lang#135153 (chore: remove redundant words in comment)

r? `@ghost`
`@rustbot` modify labels: rollup
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 6, 2025
Don't enable anyhow's `backtrace` feature in opt-dist

As of the stabilization of `std::backtrace` in Rust 1.65, this package flag has no effect other than to enable an unused dependency on the `backtrace` crate.

(See <https://github.com/dtolnay/anyhow/blob/af0937ef72fbaf9784a6c991e029738728d025e2/Cargo.toml#L18-L23>.)

While the presence of this feature in opt-dist doesn't cause other tools (which use anyhow) to actually *build* backtrace, it does affect the global crate graph used for dependency version resolution. After removing this feature, we can use `cargo tree --invert --package backtrace` to see that the only remaining reverse-dependency of backtrace is `color-eyre`, which is used by `ui_test`.
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 6, 2025
…iaskrgr

Rollup of 5 pull requests

Successful merges:

 - rust-lang#134742 (Use `PostBorrowckAnalysis` in `check_coroutine_obligations`)
 - rust-lang#134951 (Suppress host effect predicates if underlying trait doesn't hold)
 - rust-lang#135097 (bootstrap: Consolidate coverage test suite steps into a single step)
 - rust-lang#135146 (Don't enable anyhow's `backtrace` feature in opt-dist)
 - rust-lang#135157 (Move the has_errors check in rustdoc back to after TyCtxt is created)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 6, 2025
Rollup of 7 pull requests

Successful merges:

 - rust-lang#134742 (Use `PostBorrowckAnalysis` in `check_coroutine_obligations`)
 - rust-lang#134771 (Report correct `SelectionError` for `ConstArgHasType` in new solver fulfill)
 - rust-lang#134951 (Suppress host effect predicates if underlying trait doesn't hold)
 - rust-lang#135097 (bootstrap: Consolidate coverage test suite steps into a single step)
 - rust-lang#135146 (Don't enable anyhow's `backtrace` feature in opt-dist)
 - rust-lang#135153 (chore: remove redundant words in comment)
 - rust-lang#135157 (Move the has_errors check in rustdoc back to after TyCtxt is created)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 6, 2025
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#134742 (Use `PostBorrowckAnalysis` in `check_coroutine_obligations`)
 - rust-lang#134771 (Report correct `SelectionError` for `ConstArgHasType` in new solver fulfill)
 - rust-lang#134951 (Suppress host effect predicates if underlying trait doesn't hold)
 - rust-lang#135097 (bootstrap: Consolidate coverage test suite steps into a single step)
 - rust-lang#135146 (Don't enable anyhow's `backtrace` feature in opt-dist)
 - rust-lang#135153 (chore: remove redundant words in comment)
 - rust-lang#135157 (Move the has_errors check in rustdoc back to after TyCtxt is created)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 8e2631b into rust-lang:master Jan 7, 2025
6 checks passed
@rustbot rustbot added this to the 1.86.0 milestone Jan 7, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Jan 7, 2025
Rollup merge of rust-lang#135146 - Zalathar:anyhow-backtrace, r=jieyouxu

Don't enable anyhow's `backtrace` feature in opt-dist

As of the stabilization of `std::backtrace` in Rust 1.65, this package flag has no effect other than to enable an unused dependency on the `backtrace` crate.

(See <https://github.com/dtolnay/anyhow/blob/af0937ef72fbaf9784a6c991e029738728d025e2/Cargo.toml#L18-L23>.)

While the presence of this feature in opt-dist doesn't cause other tools (which use anyhow) to actually *build* backtrace, it does affect the global crate graph used for dependency version resolution. After removing this feature, we can use `cargo tree --invert --package backtrace` to see that the only remaining reverse-dependency of backtrace is `color-eyre`, which is used by `ui_test`.
@Zalathar Zalathar deleted the anyhow-backtrace branch January 7, 2025 02:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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