Skip to content

Commit

Permalink
Merge pull request #143 from dtolnay/backtrace
Browse files Browse the repository at this point in the history
Add stable backtrace feature
  • Loading branch information
dtolnay authored Mar 20, 2021
2 parents 7e85bae + 0ba6408 commit d65af36
Show file tree
Hide file tree
Showing 6 changed files with 452 additions and 14 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ jobs:
toolchain: ${{matrix.rust}}
- run: cargo test
- run: cargo check --no-default-features
- run: cargo check --features backtrace

backtrace:
name: Rust 1.42.0
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: dtolnay/[email protected]
- run: cargo check --features backtrace

nostd:
name: Rust 1.36.0
Expand All @@ -37,6 +46,14 @@ jobs:
- uses: dtolnay/[email protected]
- run: cargo check

windows:
name: Windows
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@stable
- run: cargo check --features backtrace

clippy:
name: Clippy
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ categories = ["rust-patterns"]
default = ["std"]
std = []

[dependencies]
backtrace = { version = "0.3", optional = true }

[dev-dependencies]
futures = { version = "0.3", default-features = false }
rustversion = "1.0"
Expand Down
5 changes: 5 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ use std::path::Path;
use std::process::{Command, ExitStatus, Stdio};
use std::str;

#[cfg(all(feature = "backtrace", not(feature = "std")))]
compile_error! {
"`backtrace` feature without `std` feature is not supported"
}

// This code exercises the surface area that we expect of the std Backtrace
// type. If the current toolchain is able to compile it, we go ahead and use
// backtrace in anyhow.
Expand Down
Loading

0 comments on commit d65af36

Please sign in to comment.