Skip to content

Commit fee1f4b

Browse files
committed
add explanatory comment
1 parent 4c188ff commit fee1f4b

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

build.rs

+12-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,18 @@ use std::fs;
33
use std::path::Path;
44
use std::process::{Command, ExitStatus, Stdio};
55

6-
// This code exercises the surface area that we expect of the std Backtrace
7-
// type. If the current toolchain is able to compile it, we go ahead and use
8-
// backtrace in anyhow.
6+
// This build script is copied from
7+
// [anyhow](https://github.com/dtolnay/anyhow/blob/master/build.rs),
8+
// and is a type of feature detection to determine if the current rust
9+
// toolchain has backtraces available.
10+
//
11+
// It exercises the surface area that we expect of the std Backtrace
12+
// type. If the current toolchain is able to compile it, we enable a
13+
// backtrace compiler configuration flag in http-types. We then
14+
// conditionally require the compiler feature in src/lib.rs with
15+
// `#![cfg_attr(backtrace, feature(backtrace))]`
16+
// and gate our backtrace code behind `#[cfg(backtrace)]`
17+
918
const PROBE: &str = r#"
1019
#![feature(backtrace)]
1120
#![allow(dead_code)]

0 commit comments

Comments
 (0)