You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by "Xuanwo (via GitHub)" <gi...@apache.org> on 2025/05/16 14:42:45 UTC

[PR] refactor(core): Put Backtrace in a box to reduce error size [opendal]

Xuanwo opened a new pull request, #6193:
URL: https://github.com/apache/opendal/pull/6193

   # Which issue does this PR close?
   
   None
   
   # Rationale for this change
   
   This PR will address clippy issues around:
   
   ```rust
   error: the `Err`-variant returned from this function is very large
      --> src/services/oss/core.rs:176:10
       |
   176 |     ) -> Result<http::request::Builder> {
       |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the `Err`-variant is at least 128 bytes
       |
       = help: try reducing the size of `types::error::Error`, for example by boxing large elements or replacing it with `Box<types::error::Error>`
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#result_large_err
   ```
   
   # What changes are included in this PR?
   
   This PR also fixed other clippy issues at the same time to make CI happy.
   
   # Are there any user-facing changes?
   
   
   <!--
   If there are user-facing changes then we may require documentation to be updated before approving the PR.
   -->
   
   <!---
   If there are any breaking changes to public APIs, please add the `breaking-changes` label.
   -->
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] refactor(core): Put Backtrace in a box to reduce error size [opendal]

Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on code in PR #6193:
URL: https://github.com/apache/opendal/pull/6193#discussion_r2092609248


##########
core/src/types/error.rs:
##########
@@ -227,8 +227,9 @@ pub struct Error {
     status: ErrorStatus,
     operation: &'static str,
     context: Vec<(&'static str, String)>,
+
     source: Option<anyhow::Error>,
-    backtrace: Backtrace,
+    backtrace: Option<Box<Backtrace>>,

Review Comment:
   It's a tradeoff between "reducing the size from 88 to even smaller" and "always having a box allocation." I prefer to avoid the box allocation.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] refactor(core): Put Backtrace in a box to reduce error size [opendal]

Posted by "xxchan (via GitHub)" <gi...@apache.org>.
xxchan commented on code in PR #6193:
URL: https://github.com/apache/opendal/pull/6193#discussion_r2092589903


##########
core/src/types/error.rs:
##########
@@ -227,8 +227,9 @@ pub struct Error {
     status: ErrorStatus,
     operation: &'static str,
     context: Vec<(&'static str, String)>,
+
     source: Option<anyhow::Error>,
-    backtrace: Backtrace,
+    backtrace: Option<Box<Backtrace>>,

Review Comment:
   What about boxing everything except `kind`?
   
   



##########
core/src/types/error.rs:
##########
@@ -227,8 +227,9 @@ pub struct Error {
     status: ErrorStatus,
     operation: &'static str,
     context: Vec<(&'static str, String)>,
+
     source: Option<anyhow::Error>,
-    backtrace: Backtrace,
+    backtrace: Option<Box<Backtrace>>,

Review Comment:
   What about put everything except `kind` into a boxed `inner` struct?
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] refactor(core): Put Backtrace in a box to reduce error size [opendal]

Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo merged PR #6193:
URL: https://github.com/apache/opendal/pull/6193


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org