1- #![ allow( clippy:: needless_raw_string_hashes , clippy :: option_if_let_else) ]
1+ #![ allow( clippy:: option_if_let_else) ]
22
33use std:: env;
4- use std:: fs;
54use std:: path:: Path ;
65use std:: process:: { Command , ExitStatus , Stdio } ;
76use std:: str;
@@ -11,43 +10,10 @@ compile_error! {
1110 "`backtrace` feature without `std` feature is not supported"
1211}
1312
14- // This code exercises the surface area that we expect of the Error generic
15- // member access API. If the current toolchain is able to compile it, then
16- // anyhow is able to provide backtrace support.
17- const PROBE : & str = r#"
18- #![feature(error_generic_member_access)]
19-
20- use std::backtrace::Backtrace;
21- use std::error::{self, Error, Request};
22- use std::fmt::{self, Debug, Display};
23-
24- struct MyError(Thing);
25- struct Thing;
26-
27- impl Debug for MyError {
28- fn fmt(&self, _formatter: &mut fmt::Formatter) -> fmt::Result {
29- unimplemented!()
30- }
31- }
32-
33- impl Display for MyError {
34- fn fmt(&self, _formatter: &mut fmt::Formatter) -> fmt::Result {
35- unimplemented!()
36- }
37- }
38-
39- impl Error for MyError {
40- fn provide<'a>(&'a self, request: &mut Request<'a>) {
41- request.provide_ref(&self.0);
42- }
43- }
44-
45- const _: fn(&dyn Error) -> Option<&Backtrace> = |err| error::request_ref::<Backtrace>(err);
46- "# ;
47-
4813fn main ( ) {
4914 let mut error_generic_member_access = false ;
5015 if cfg ! ( feature = "std" ) {
16+ println ! ( "cargo:rerun-if-changed=build/probe.rs" ) ;
5117 println ! ( "cargo:rerun-if-env-changed=RUSTC_BOOTSTRAP" ) ;
5218
5319 match compile_probe ( ) {
@@ -102,8 +68,7 @@ fn compile_probe() -> Option<ExitStatus> {
10268
10369 let rustc = env:: var_os ( "RUSTC" ) ?;
10470 let out_dir = env:: var_os ( "OUT_DIR" ) ?;
105- let probefile = Path :: new ( & out_dir) . join ( "probe.rs" ) ;
106- fs:: write ( & probefile, PROBE ) . ok ( ) ?;
71+ let probefile = Path :: new ( "build" ) . join ( "probe.rs" ) ;
10772
10873 // Make sure to pick up Cargo rustc configuration.
10974 let mut cmd = if let Some ( wrapper) = env:: var_os ( "RUSTC_WRAPPER" ) {
0 commit comments