Skip to content

build(panic): Fix build without other dependencies #883

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

Merged
merged 4 commits into from
Aug 6, 2025

Conversation

liskin
Copy link
Contributor

@liskin liskin commented Aug 5, 2025

When sentry-panic is the only (or one of a few) dependencies of a crate, it might fail to build — it relies on sentry-core's "client" feature but doesn't declare it.

Reproducer:

  1. mkdir sentry-panic-test; cd sentry-panic-test
  2. cargo init .
  3. cargo add sentry-panic
  4. cargo build

This results in:

   Compiling sentry-panic v0.42.0
error[E0599]: no method named `client` found for reference `&Hub` in the current scope
  --> /home/tomi/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/sentry-panic-0.42.0/src/lib.rs:39:35
   |
39 |         if let Some(client) = hub.client() {
   |                                   ^^^^^^ method not found in `&Hub`

The fix is to declare the required "client" feature in the sentry-core dependency.

When sentry-panic is the only (or one of a few) dependencies of a
crate, it might fail to build — it relies on sentry-core's "client"
feature but doesn't declare it.

Reproducer:

1. mkdir sentry-panic-test; cd sentry-panic-test
2. cargo init .
3. cargo add sentry-panic
4. cargo build

This results in:

       Compiling sentry-panic v0.42.0
    error[E0599]: no method named `client` found for reference `&Hub` in the current scope
      --> /home/tomi/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/sentry-panic-0.42.0/src/lib.rs:39:35
       |
    39 |         if let Some(client) = hub.client() {
       |                                   ^^^^^^ method not found in `&Hub`

The fix is to declare the required "client" feature in the sentry-core
dependency.
@lcian
Copy link
Member

lcian commented Aug 6, 2025

Thank you @liskin !

@lcian lcian enabled auto-merge (squash) August 6, 2025 08:56
Copy link

codecov bot commented Aug 6, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.11%. Comparing base (0336a02) to head (aed6da1).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #883      +/-   ##
==========================================
- Coverage   73.13%   73.11%   -0.02%     
==========================================
  Files          64       64              
  Lines        7366     7366              
==========================================
- Hits         5387     5386       -1     
- Misses       1979     1980       +1     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lcian lcian merged commit c29c01f into getsentry:master Aug 6, 2025
18 checks passed
@liskin liskin deleted the sentry-panic-build-failure branch August 6, 2025 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants