Skip to content

Commit 26b0a26

Browse files
committed
Turn on cfg(std_backtrace) on new enough stable rustc
1 parent 53109e6 commit 26b0a26

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

build.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,15 @@ const PROBE: &str = r#"
4646
"#;
4747

4848
fn main() {
49+
let mut error_generic_member_access = false;
4950
if cfg!(feature = "std") {
5051
println!("cargo:rerun-if-env-changed=RUSTC_BOOTSTRAP");
5152

5253
match compile_probe() {
5354
Some(status) if status.success() => {
5455
println!("cargo:rustc-cfg=std_backtrace");
5556
println!("cargo:rustc-cfg=error_generic_member_access");
57+
error_generic_member_access = true;
5658
}
5759
_ => {}
5860
}
@@ -78,6 +80,12 @@ fn main() {
7880
// https://github.com/rust-lang/rust/issues/71668
7981
println!("cargo:rustc-cfg=anyhow_no_unsafe_op_in_unsafe_fn_lint");
8082
}
83+
84+
if !error_generic_member_access && cfg!(feature = "std") && rustc >= 65 {
85+
// std::backtrace::Backtrace
86+
// https://blog.rust-lang.org/2022/11/03/Rust-1.65.0.html#stabilized-apis
87+
println!("cargo:rustc-cfg=std_backtrace");
88+
}
8189
}
8290

8391
fn compile_probe() -> Option<ExitStatus> {

0 commit comments

Comments
 (0)