-
Notifications
You must be signed in to change notification settings - Fork 111
Cache whether RUST_BACKTRACE is enabled in a relaxed atomic static. #210
Conversation
e1f3a35
to
e246a16
Compare
Apparently there's a test that changes |
It's an edge case, I think a subprocess would be fine. |
|
Would it not make sense to implement this with |
src/bin/has_backtrace.rs
Outdated
@@ -0,0 +1,17 @@ | |||
//! Exits with exit code 0 if backtraces are disabled and 1 if they are enabled. | |||
//! Used by tests to make sure backtraces are available when they should be. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add that this bin should not be used outside of the tests?
let cmd_path = if cfg!(windows) { | ||
Path::new("./target/debug/has_backtrace.exe") | ||
} else { | ||
Path::new("./target/debug/has_backtrace") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would use cargo run
and maybe put it somewhere cargo
wouldn't pick up by default (maybe --example
?). I can try that if it sounds good.
Nice! Could you update the changelog? |
I added PR for updating change log: eddyb#2 |
I still have to play with |
What is it that you are trying to solve? Moving |
Manually compiling it has the downside of us not knowing how the user has configured their toolchain. Just running |
Hmm in those cases I don't know how to actually have a separate process. Then again, this is a test so if |
I still didn't get what the problem we are trying to solve is? Is it too ugly to have it in |
It doesn't work. Look at the test failure. It worked for you only because you built it manually. |
Hmm. What? |
@faern Huh, my bad, guess it... fixed itself? Really weird since the last failure I saw was not finding that executable. I'll try to rebase then. |
440a470
to
e6a936e
Compare
e6a936e
to
5814306
Compare
It looks like we have to bump the minimum required version from |
Ping @Yamakaky :) |
Clarify that has_backtrace.rs is only for tests
Yeah, it's good ! Good coop btw, keeping an eye on it ;) |
Are you good for merge? |
I think so. |
enabled | ||
} | ||
encoded => (encoded >> 1) != 0 | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm just thinking this piece of code could be reused in others libs. Something like LazyBool
or something like that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that this could me generalized. Or at least refactored into a separate function, since it's fairly large.
Manually merged. Thank you two! |
Fixes #207. Inspired by libfringe (thanks, @edef1c!).