1
- #![ allow( clippy:: needless_raw_string_hashes , clippy :: option_if_let_else) ]
1
+ #![ allow( clippy:: option_if_let_else) ]
2
2
3
3
use std:: env;
4
- use std:: fs;
5
4
use std:: path:: Path ;
6
5
use std:: process:: { Command , ExitStatus , Stdio } ;
7
6
use std:: str;
@@ -11,43 +10,10 @@ compile_error! {
11
10
"`backtrace` feature without `std` feature is not supported"
12
11
}
13
12
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
-
48
13
fn main ( ) {
49
14
let mut error_generic_member_access = false ;
50
15
if cfg ! ( feature = "std" ) {
16
+ println ! ( "cargo:rerun-if-changed=build/probe.rs" ) ;
51
17
println ! ( "cargo:rerun-if-env-changed=RUSTC_BOOTSTRAP" ) ;
52
18
53
19
match compile_probe ( ) {
@@ -102,8 +68,7 @@ fn compile_probe() -> Option<ExitStatus> {
102
68
103
69
let rustc = env:: var_os ( "RUSTC" ) ?;
104
70
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" ) ;
107
72
108
73
// Make sure to pick up Cargo rustc configuration.
109
74
let mut cmd = if let Some ( wrapper) = env:: var_os ( "RUSTC_WRAPPER" ) {
0 commit comments