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

GEN-115: Don't compile backtrace support if feature is disabled #4685

Conversation

TimDiekmann
Copy link
Member

🌟 What is the purpose of this PR?

In some contexts, such as with panic_immediate_abort set, backtraces should not be compiled into the binary. Currently, the std feature determines if backtraces are enabled or not. Making this a dedicated feature flag helps reduce the binary size.

🔗 Related links

🔍 What does this change?

  • Guard Backtrace behind the backtrace feature

@TimDiekmann TimDiekmann requested a review from indietyp July 6, 2024 08:33
@TimDiekmann TimDiekmann self-assigned this Jul 6, 2024
@github-actions github-actions bot added area/infra Relates to version control, CI, CD or IaC (area) area/libs > error-stack Affects the `error-stack` crate (library) area/libs Relates to first-party libraries/crates/packages (area) area/tests New or updated tests labels Jul 6, 2024
Copy link

codecov bot commented Jul 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 20.19%. Comparing base (9ec68c9) to head (40ae32d).
Report is 600 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4685   +/-   ##
=======================================
  Coverage   20.19%   20.19%           
=======================================
  Files         457      457           
  Lines       15714    15750   +36     
  Branches     2380     2380           
=======================================
+ Hits         3173     3181    +8     
- Misses      12500    12528   +28     
  Partials       41       41           
Flag Coverage Δ
error-stack 75.62% <100.00%> (-0.72%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@indietyp indietyp left a comment

Choose a reason for hiding this comment

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

minor questions, otherwise LGTM

@@ -41,8 +41,9 @@ thiserror = "1.0.59"
rustc_version = "0.4"

[features]
default = ["std"]
default = ["backtrace"]
Copy link
Member

Choose a reason for hiding this comment

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

I know that std is implied here, but can we make it explicit, as in: std, backtrace?

@@ -10,14 +10,9 @@ fn main() {
}

let rustc_version = version_meta.semver;
let trimmed_rustc_version = Version::new(
let _trimmed_rustc_version = Version::new(
Copy link
Member

Choose a reason for hiding this comment

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

why commented out, if we don't use it? shouldn't it be removed in that case?

indietyp
indietyp previously approved these changes Jul 7, 2024
@TimDiekmann TimDiekmann added this pull request to the merge queue Jul 7, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 7, 2024
@TimDiekmann TimDiekmann added this pull request to the merge queue Jul 8, 2024
Merged via the queue into main with commit 6f5cef7 Jul 8, 2024
35 checks passed
@TimDiekmann TimDiekmann deleted the t/gen-115-dont-compile-backtrace-support-if-rust-feature-is-disabled branch July 8, 2024 08:47
@tisonkun
Copy link

May we release a 0.5.0 for this change?

@TimDiekmann
Copy link
Member Author

I need to check for breaking changes and check if the MSRV did not change. Then we can file a new release, yes! 🙂
I probably get to this next week.

@TimDiekmann
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/infra Relates to version control, CI, CD or IaC (area) area/libs > error-stack Affects the `error-stack` crate (library) area/libs Relates to first-party libraries/crates/packages (area) area/tests New or updated tests
Development

Successfully merging this pull request may close these issues.

GEN-115: Way to disable error location and/or backtrace
3 participants