We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 417123a commit eae54c0Copy full SHA for eae54c0
packages/std/src/errors/backtrace.rs
@@ -8,6 +8,7 @@ pub struct BT(Box<dyn Printable>);
8
impl BT {
9
#[track_caller]
10
pub fn capture() -> Self {
11
+ // in case of no_std, we can fill with a stub here
12
#[cfg(target_arch = "wasm32")]
13
return BT(Box::new(std::backtrace::Backtrace::disabled()));
14
#[cfg(not(target_arch = "wasm32"))]
@@ -47,3 +48,22 @@ macro_rules! impl_from_err {
47
48
};
49
}
50
pub(crate) use impl_from_err;
51
+
52
+#[cfg(test)]
53
+mod tests {
54
+ use super::*;
55
56
+ #[test]
57
+ fn bt_works_without_std() {
58
+ #[derive(Debug)]
59
+ struct BacktraceStub;
60
61
+ impl Display for BacktraceStub {
62
+ fn fmt(&self, _f: &mut Formatter<'_>) -> Result {
63
+ Ok(())
64
+ }
65
66
67
+ _ = BT(Box::new(BacktraceStub));
68
69
+}
0 commit comments