Skip to content

Commit d2d7bad

Browse files
committed
Improve error message on missing serde_derive exe
1 parent b978854 commit d2d7bad

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

precompiled/serde_derive/src/lib_precompiled.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use crate::bytecode::Bytecode;
88
use proc_macro::{Delimiter, Group, Ident, Literal, Punct, Spacing, Span, TokenStream, TokenTree};
99
use std::io::{Read, Write};
1010
use std::iter::FromIterator;
11+
use std::path::Path;
1112
use std::process::{Command, ExitStatus, Stdio};
1213
use std::str::FromStr;
1314

@@ -31,11 +32,17 @@ fn derive(select: u8, input: TokenStream) -> TokenStream {
3132
memory.linearize_token(token, &mut buf);
3233
}
3334

34-
let path = concat!(
35+
let exe_path = Path::new(concat!(
3536
env!("CARGO_MANIFEST_DIR"),
3637
"/serde_derive-x86_64-unknown-linux-gnu",
37-
);
38-
let mut child = Command::new(path)
38+
));
39+
if !exe_path.exists() {
40+
panic!(
41+
"file missing from serde_derive manifest directory during macro expansion: {}",
42+
exe_path.display(),
43+
);
44+
}
45+
let mut child = Command::new(exe_path)
3946
.stdin(Stdio::piped())
4047
.stdout(Stdio::piped())
4148
.spawn()

0 commit comments

Comments
 (0)