Skip to content

Commit 4c8bdb1

Browse files
committed
Indicate no_std support is only available on Rust >= 1.30.0.
Issue #135
1 parent e50b0dc commit 4c8bdb1

File tree

4 files changed

+35
-3
lines changed

4 files changed

+35
-3
lines changed

.travis.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,25 @@ matrix:
4343
- rust: nightly
4444
script: *test_all
4545

46-
# Test everything on Rust 1.25.0 for backward compatibility
46+
# Test features with std on Rust 1.25.0 for backward compatibility
4747
- rust: 1.25.0
48-
script: *test_all
48+
script:
49+
- cargo build --manifest-path backtrace-sys/Cargo.toml
50+
- cargo build
51+
- cargo test
52+
- cargo test --no-default-features --features 'libunwind std'
53+
- cargo test --no-default-features --features 'libunwind dladdr std'
54+
- cargo test --no-default-features --features 'libunwind libbacktrace std'
55+
- cargo test --no-default-features --features 'unix-backtrace std'
56+
- cargo test --no-default-features --features 'unix-backtrace dladdr std'
57+
- cargo test --no-default-features --features 'unix-backtrace libbacktrace std'
58+
- cargo test --no-default-features --features 'serialize-serde std'
59+
- cargo test --no-default-features --features 'serialize-rustc std'
60+
- cargo test --no-default-features --features 'serialize-rustc serialize-serde std'
61+
- cargo test --no-default-features --features 'cpp_demangle std'
62+
- cargo test --no-default-features --features 'gimli-symbolize std'
63+
- cd ./cpp_smoke_test && cargo test && cd ..
64+
- cargo clean && cargo build
4965

5066
# Upload docs on nightly
5167
- rust: nightly

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ winapi = { version = "0.3.3", features = ["dbghelp", "processthreadsapi", "winnt
4141
[target.'cfg(all(unix, not(target_os = "fuchsia"), not(target_os = "emscripten"), not(target_os = "macos"), not(target_os = "ios")))'.dependencies]
4242
backtrace-sys = { path = "backtrace-sys", version = "0.1.17", optional = true }
4343

44+
[build-dependencies]
45+
autocfg = "0.1"
46+
4447
# Each feature controls the two phases of finding a backtrace: getting a
4548
# backtrace and then resolving instruction pointers to symbols. The default
4649
# feature enables all the necessary features for each platform this library

build.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
extern crate autocfg;
2+
3+
fn main() {
4+
let ac = autocfg::new();
5+
6+
// ffi types moved from `std` to `core` in Rust 1.30, so we need to adjust imports based on
7+
// this.
8+
//
9+
// <https://github.com/rust-lang/rust/pull/53910>
10+
ac.emit_rustc_version(1, 30);
11+
}

src/types.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ cfg_if! {
77
use std::fmt;
88
use std::path::PathBuf;
99
use std::prelude::v1::*;
10-
} else {
10+
} else if #[cfg(rustc_1_30)] {
1111
pub use core::ffi::c_void;
12+
} else {
13+
compile_error!("`backtrace` requires Rust >=1.30.0 to support `no_std`.");
1214
}
1315
}
1416

0 commit comments

Comments
 (0)