Skip to content

Commit

Permalink
Improve error message on missing serde_derive exe
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Jul 26, 2023
1 parent b978854 commit d2d7bad
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions precompiled/serde_derive/src/lib_precompiled.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use crate::bytecode::Bytecode;
use proc_macro::{Delimiter, Group, Ident, Literal, Punct, Spacing, Span, TokenStream, TokenTree};
use std::io::{Read, Write};
use std::iter::FromIterator;
use std::path::Path;
use std::process::{Command, ExitStatus, Stdio};
use std::str::FromStr;

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

let path = concat!(
let exe_path = Path::new(concat!(
env!("CARGO_MANIFEST_DIR"),
"/serde_derive-x86_64-unknown-linux-gnu",
);
let mut child = Command::new(path)
));
if !exe_path.exists() {
panic!(
"file missing from serde_derive manifest directory during macro expansion: {}",
exe_path.display(),
);
}
let mut child = Command::new(exe_path)
.stdin(Stdio::piped())
.stdout(Stdio::piped())
.spawn()
Expand Down

0 comments on commit d2d7bad

Please sign in to comment.